Re: [PATCH v5 1/2] platforms/x86: Add AMD system management interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 16, 2022 at 5:34 AM Naveen Krishna Chatradhi
<nchatrad@xxxxxxx> wrote:
>
> From: Suma Hegde <suma.hegde@xxxxxxx>
>
> Recent Fam19h EPYC server line of processors from AMD support system
> management functionality via HSMP (Host System Management Port) interface.
>
> The Host System Management Port (HSMP) is an interface to provide
> OS-level software with access to system management functions via a
> set of mailbox registers.
>
> More details on the interface can be found in chapter
> "7 Host System Management Port (HSMP)" of the following PPR
> https://www.amd.com/system/files/TechDocs/55898_B1_pub_0.50.zip
>
> This patch adds new amd_hsmp module under the drivers/platforms/x86/
> which creates miscdevice with an IOCTL interface to the user space.
> /dev/hsmp is for running the hsmp mailbox commands.
>
> Signed-off-by: Suma Hegde <suma.hegde@xxxxxxx>
> Signed-off-by: Naveen Krishna Chatradhi <nchatrad@xxxxxxx>
> Reviewed-by: Carlos Bilbao <carlos.bilbao@xxxxxxx>

Acked-by: Song Liu <song@xxxxxxxxxx>

With a couple minor comments below.

> ---

[...]

> +
> +struct hsmp_message {
> +       __u32   msg_id;                 /* Message ID */
> +       __u16   num_args;               /* Number of input argument words in message */
> +       __u16   response_sz;            /* Number of expected output/response words */
> +       __u32   buf[HSMP_MAX_MSG_LEN];  /* argument/response buffer */

How about we call these args instead of buf?

[...]

> +
> +static long hsmp_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
> +{
> +       int __user *arguser = (int  __user *)arg;
> +       struct hsmp_message msg = { 0 };
> +       int ret;
> +
> +       if (copy_struct_from_user(&msg, sizeof(msg), arguser, sizeof(struct hsmp_message)))
> +               return -EFAULT;
> +
> +       ret = validate_message(&msg);

We call validate_message() twice in this path. This is not a big issue, but it
will be nice if we can avoid the extra check.

[...]



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux