public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Akshay Gupta <akshay.gupta@amd.com>,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
	Guenter Roeck <linux@roeck-us.net>,
	shyam-sundar.s-k@amd.com, gautham.shenoy@amd.com,
	Mario Limonciello <mario.limonciello@amd.com>,
	naveenkrishna.chatradhi@amd.com, anand.umarji@amd.com
Subject: Re: [PATCH v7 07/10] misc: amd-sbi: Add support for CPUID protocol
Date: Wed, 2 Apr 2025 13:16:58 +0100	[thread overview]
Message-ID: <2025040258-snap-aerospace-6e43@gregkh> (raw)
In-Reply-To: <c7efb154-9e44-402f-b0fb-c9bce54645b2@app.fastmail.com>

On Wed, Apr 02, 2025 at 02:13:22PM +0200, Arnd Bergmann wrote:
> On Wed, Apr 2, 2025, at 07:58, Akshay Gupta wrote:
> > - AMD provides custom protocol to read Processor feature
> >   capabilities and configuration information through side band.
> >   The information is accessed by providing CPUID Function,
> >   extended function and thread ID to the protocol.
> >   Undefined function returns 0.
> >
> > Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
> > Signed-off-by: Akshay Gupta <akshay.gupta@amd.com>
> > ---
> > Changes since v6:
> > - Address Arnd comment
> >   - Add padding to the uapi structure
> > - Rebased patch, previously patch 8
> 
> This changes the UAPI again. since you change the common structure
> layout.
> 
> > @@ -134,6 +279,9 @@ static long sbrmi_ioctl(struct file *fp, unsigned 
> > int cmd, unsigned long arg)
> >  		/* Mailbox protocol */
> >  		ret = rmi_mailbox_xfer(data, &msg);
> >  		break;
> > +	case APML_CPUID:
> > +		ret = rmi_cpuid_read(data, &msg);
> > +		break;
> >  	default:
> >  		return -EINVAL;
> 
> As I previously commented, I would prefer to have a highl-level
> interface per specific mailbox item you transfer, but I think that
> is something we can debate, in particular if Greg or the x86
> maintainers think it's ok, I'm not going to object.
> 
> However, having a combined ioctl command and data structure
> for rmi_mailbox_xfer(), rmi_cpuid_read() and the commands
> you add later seems to cause a lot of the extra complexity,
> and I think this really has to be done differently, using
> distinct ioctl command numbers for each of them, with an
> appropriate structure to go along with it.
> 
> This does mean the existing userspace tool will be incompatible
> with the upstream driver, but it can be easily updated to
> support both kernel interfaces (trying the new one first,
> and falling back to the old on after -ENOTTY).

Different structures per ioctl is the way to go.  It's more
self-describing and easier to audit for reviewing that the code is
working properly both in userspace and in the kernel (i.e. tools like
strace work better.)

So I agree with you here.

thanks,

greg k-h

  reply	other threads:[~2025-04-02 12:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-02  5:58 [PATCH v7 00/10] misc: Move AMD side band interface(SBI) functionality Akshay Gupta
2025-04-02  5:58 ` [PATCH v7 01/10] hwmon/misc: amd-sbi: Move core sbrmi from hwmon to misc Akshay Gupta
2025-04-02  5:58 ` [PATCH v7 02/10] misc: amd-sbi: Move protocol functionality to core file Akshay Gupta
2025-04-02  5:58 ` [PATCH v7 03/10] misc: amd-sbi: Move hwmon device sensor as separate entity Akshay Gupta
2025-04-02 11:03   ` Arnd Bergmann
2025-04-07 11:31     ` Gupta, Akshay
2025-04-02  5:58 ` [PATCH v7 04/10] misc: amd-sbi: Use regmap subsystem Akshay Gupta
2025-04-02  5:58 ` [PATCH v7 05/10] misc: amd-sbi: Optimize the wait condition for mailbox command completion Akshay Gupta
2025-04-02  5:58 ` [PATCH v7 06/10] misc: amd-sbi: Add support for AMD_SBI IOCTL Akshay Gupta
2025-04-02  5:58 ` [PATCH v7 07/10] misc: amd-sbi: Add support for CPUID protocol Akshay Gupta
2025-04-02 12:13   ` Arnd Bergmann
2025-04-02 12:16     ` Greg Kroah-Hartman [this message]
2025-04-07 11:31       ` Gupta, Akshay
2025-04-02  5:58 ` [PATCH v7 08/10] misc: amd-sbi: Add support for read MCA register protocol Akshay Gupta
2025-04-02  5:58 ` [PATCH v7 09/10] misc: amd-sbi: Add support for register xfer Akshay Gupta
2025-04-02  5:58 ` [PATCH v7 10/10] misc: amd-sbi: Add document for AMD SB IOCTL description Akshay Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2025040258-snap-aerospace-6e43@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=akshay.gupta@amd.com \
    --cc=anand.umarji@amd.com \
    --cc=arnd@arndb.de \
    --cc=gautham.shenoy@amd.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mario.limonciello@amd.com \
    --cc=naveenkrishna.chatradhi@amd.com \
    --cc=shyam-sundar.s-k@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox