X86 platform drivers
 help / color / mirror / Atom feed
From: Suma Hegde <Suma.Hegde@amd.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org,
	Hans de Goede <hdegoede@redhat.com>,
	Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Subject: Re: [PATCH 05/10] platform/x86/amd/hsmp: Move ACPI code to acpi.c
Date: Tue, 9 Jul 2024 16:20:27 +0530	[thread overview]
Message-ID: <41b9c3ff-c406-4df5-bae7-25be4d4c361f@amd.com> (raw)
In-Reply-To: <40c43c62-6666-573f-e0cc-a86bfbff12db@linux.intel.com>

Hi Ilpo,

On 7/9/2024 3:39 PM, Ilpo Järvinen wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Thu, 27 Jun 2024, Suma Hegde wrote:
>
>> Move ACPI related code to acpi.c from hsmp.c.
>> We still have one driver, the driver probe will be split in the next patch.
>>
>> Signed-off-by: Suma Hegde <suma.hegde@amd.com>
>> Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
>> ---
>>   drivers/platform/x86/amd/hsmp/Makefile |   2 +-
>>   drivers/platform/x86/amd/hsmp/acpi.c   | 261 +++++++++++++++++++++++++
>>   drivers/platform/x86/amd/hsmp/hsmp.c   | 247 -----------------------
>>   drivers/platform/x86/amd/hsmp/hsmp.h   |   2 +
>>   4 files changed, 264 insertions(+), 248 deletions(-)
>>   create mode 100644 drivers/platform/x86/amd/hsmp/acpi.c
>>
>> diff --git a/drivers/platform/x86/amd/hsmp/Makefile b/drivers/platform/x86/amd/hsmp/Makefile
>> index fb8ba04b2f0d..0cc92865c0a2 100644
>> --- a/drivers/platform/x86/amd/hsmp/Makefile
>> +++ b/drivers/platform/x86/amd/hsmp/Makefile
>> @@ -5,4 +5,4 @@
>>   #
>>
>>   obj-$(CONFIG_AMD_HSMP)               += amd_hsmp.o
>> -amd_hsmp-objs                        := hsmp.o plat.o
>> +amd_hsmp-objs                        := hsmp.o plat.o acpi.o
>> diff --git a/drivers/platform/x86/amd/hsmp/acpi.c b/drivers/platform/x86/amd/hsmp/acpi.c
>> new file mode 100644
>> index 000000000000..90bfa1ddadbf
>> --- /dev/null
>> +++ b/drivers/platform/x86/amd/hsmp/acpi.c
>> @@ -0,0 +1,261 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * AMD HSMP Platform Driver
>> + * Copyright (c) 2024, AMD.
>> + * All Rights Reserved.
>> + *
>> + * This file provides a device implementation for HSMP interface
>> + */
>> +
>> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>> +
>> +#include "hsmp.h"
>> +
>> +#include <linux/acpi.h>
>> +
>> +/* These are the strings specified in ACPI table */
>> +#define MSG_IDOFF_STR                "MsgIdOffset"
>> +#define MSG_ARGOFF_STR               "MsgArgOffset"
>> +#define MSG_RESPOFF_STR              "MsgRspOffset"
>> +
>> +void amd_hsmp_acpi_rdwr(struct hsmp_socket *sock, u32 offset,
>> +                     u32 *value, bool write)
>> +{
>> +     if (write)
>> +             iowrite32(*value, sock->virt_base_addr + offset);
>> +     else
>> +             *value = ioread32(sock->virt_base_addr + offset);
>> +}
>> +
>> +/* This is the UUID used for HSMP */
>> +static const guid_t acpi_hsmp_uuid = GUID_INIT(0xb74d619d, 0x5707, 0x48bd,
>> +                                             0xa6, 0x9f, 0x4e, 0xa2,
>> +                                             0x87, 0x1f, 0xc2, 0xf6);
>> +
>> +static inline bool is_acpi_hsmp_uuid(union acpi_object *obj)
>> +{
>> +     if (obj->type == ACPI_TYPE_BUFFER && obj->buffer.length == UUID_SIZE)
>> +             return guid_equal((guid_t *)obj->buffer.pointer, &acpi_hsmp_uuid);
> #include for GUID_INIT() and guid_equal().
Ok, will change it.
>> +     return false;
>> +}
>> +
>> +static inline int hsmp_get_uid(struct device *dev, u16 *sock_ind)
>> +{
>> +     char *uid;
>> +
>> +     /*
>> +      * UID (ID00, ID01..IDXX) is used for differentiating sockets,
>> +      * read it and strip the "ID" part of it and convert the remaining
>> +      * bytes to integer.
>> +      */
>> +     uid = acpi_device_uid(ACPI_COMPANION(dev));
>> +
>> +     return kstrtou16(uid + 2, 10, sock_ind);
> #include for kstrtou16().
>
> I think I mentioned already earlier that each file should include what
> they use, but it seems that not even the original hsmp.c contained these
> so they came from somewhere deeper in the include chain.

Sorry, probably i had not understood the comment clearly.

Will include all the header files explicitly in alphabetical order.


Also will address all the comments for this patch series and will send v2.

>> +}
>> +
>> +static acpi_status hsmp_resource(struct acpi_resource *res, void *data)
>> +{
>> +     struct hsmp_socket *sock = data;
>> +     struct resource r;
> #include for struct resource
>
>> +
>> +     switch (res->type) {
>> +     case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
>> +             if (!acpi_dev_resource_memory(res, &r))
>> +                     return AE_ERROR;
>> +             if (!r.start || r.end < r.start || !(r.flags & IORESOURCE_MEM_WRITEABLE))
>> +                     return AE_ERROR;
>> +             sock->mbinfo.base_addr = r.start;
>> +             sock->mbinfo.size = resource_size(&r);
> #include for resource_size()
ok.
>> +             break;
>> +     case ACPI_RESOURCE_TYPE_END_TAG:
>> +             break;
>> +     default:
>> +             return AE_ERROR;
>> +     }
>> +
>> +     return AE_OK;
>> +}
>> +
>> +static int hsmp_read_acpi_dsd(struct hsmp_socket *sock)
>> +{
>> +     struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
>> +     union acpi_object *guid, *mailbox_package;
>> +     union acpi_object *dsd;
>> +     acpi_status status;
>> +     int ret = 0;
>> +     int j;
>> +
>> +     status = acpi_evaluate_object_typed(ACPI_HANDLE(sock->dev), "_DSD", NULL,
>> +                                         &buf, ACPI_TYPE_PACKAGE);
>> +     if (ACPI_FAILURE(status)) {
>> +             dev_err(sock->dev, "Failed to read mailbox reg offsets from DSD table, err: %s\n",
>> +                     acpi_format_exception(status));
> #include for dev_err()
ok.
>> +             return -ENODEV;
> #include for -Exx codes.
ok
>> +     }
>> +
>> +     dsd = buf.pointer;
>> +
>> +     /* HSMP _DSD property should contain 2 objects.
>> +      * 1. guid which is an acpi object of type ACPI_TYPE_BUFFER
>> +      * 2. mailbox which is an acpi object of type ACPI_TYPE_PACKAGE
>> +      *    This mailbox object contains 3 more acpi objects of type
>> +      *    ACPI_TYPE_PACKAGE for holding msgid, msgresp, msgarg offsets
>> +      *    these packages inturn contain 2 acpi objects of type
>> +      *    ACPI_TYPE_STRING and ACPI_TYPE_INTEGER
>> +      */
>> +     if (!dsd || dsd->type != ACPI_TYPE_PACKAGE || dsd->package.count != 2) {
>> +             ret = -EINVAL;
>> +             goto free_buf;
>> +     }
>> +
>> +     guid = &dsd->package.elements[0];
>> +     mailbox_package = &dsd->package.elements[1];
>> +     if (!is_acpi_hsmp_uuid(guid) || mailbox_package->type != ACPI_TYPE_PACKAGE) {
>> +             dev_err(sock->dev, "Invalid hsmp _DSD table data\n");
>> +             ret = -EINVAL;
>> +             goto free_buf;
>> +     }
>> +
>> +     for (j = 0; j < mailbox_package->package.count; j++) {
>> +             union acpi_object *msgobj, *msgstr, *msgint;
>> +
>> +             msgobj  = &mailbox_package->package.elements[j];
>> +             msgstr  = &msgobj->package.elements[0];
>> +             msgint  = &msgobj->package.elements[1];
>> +
>> +             /* package should have 1 string and 1 integer object */
>> +             if (msgobj->type != ACPI_TYPE_PACKAGE ||
>> +                 msgstr->type != ACPI_TYPE_STRING ||
>> +                 msgint->type != ACPI_TYPE_INTEGER) {
>> +                     ret = -EINVAL;
>> +                     goto free_buf;
>> +             }
>> +
>> +             if (!strncmp(msgstr->string.pointer, MSG_IDOFF_STR,
>> +                          msgstr->string.length)) {
>> +                     sock->mbinfo.msg_id_off = msgint->integer.value;
>> +             } else if (!strncmp(msgstr->string.pointer, MSG_RESPOFF_STR,
>> +                                 msgstr->string.length)) {
>> +                     sock->mbinfo.msg_resp_off =  msgint->integer.value;
>> +             } else if (!strncmp(msgstr->string.pointer, MSG_ARGOFF_STR,
>> +                                 msgstr->string.length)) {
>> +                     sock->mbinfo.msg_arg_off = msgint->integer.value;
>> +             } else {
>> +                     ret = -ENOENT;
>> +                     goto free_buf;
>> +             }
>> +     }
>> +
>> +     if (!sock->mbinfo.msg_id_off || !sock->mbinfo.msg_resp_off ||
>> +         !sock->mbinfo.msg_arg_off)
>> +             ret = -EINVAL;
>> +
>> +free_buf:
>> +     ACPI_FREE(buf.pointer);
>> +     return ret;
>> +}
>> +
>> +static int hsmp_read_acpi_crs(struct hsmp_socket *sock)
>> +{
>> +     acpi_status status;
>> +
>> +     status = acpi_walk_resources(ACPI_HANDLE(sock->dev), METHOD_NAME__CRS,
>> +                                  hsmp_resource, sock);
>> +     if (ACPI_FAILURE(status)) {
>> +             dev_err(sock->dev, "Failed to look up MP1 base address from CRS method, err: %s\n",
>> +                     acpi_format_exception(status));
>> +             return -EINVAL;
>> +     }
>> +     if (!sock->mbinfo.base_addr || !sock->mbinfo.size)
>> +             return -EINVAL;
>> +
>> +     /* The mapped region should be un cached */
> uncached
ok.
>> +     sock->virt_base_addr = devm_ioremap_uc(sock->dev, sock->mbinfo.base_addr,
>> +                                            sock->mbinfo.size);
>> +     if (!sock->virt_base_addr) {
>> +             dev_err(sock->dev, "Failed to ioremap MP1 base address\n");
>> +             return -ENOMEM;
>> +     }
>> +
>> +     return 0;
>> +}
>> +
>> +/* Parse the ACPI table to read the data */
>> +static int hsmp_parse_acpi_table(struct device *dev, u16 sock_ind)
>> +{
>> +     struct hsmp_socket *sock = &plat_dev.sock[sock_ind];
>> +     int ret;
>> +
>> +     sock->sock_ind          = sock_ind;
>> +     sock->dev               = dev;
>> +     plat_dev.is_acpi_device = true;
>> +
>> +     sema_init(&sock->hsmp_sem, 1);
>> +
>> +     /* Read MP1 base address from CRS method */
>> +     ret = hsmp_read_acpi_crs(sock);
>> +     if (ret)
>> +             return ret;
>> +
>> +     /* Read mailbox offsets from DSD table */
>> +     return hsmp_read_acpi_dsd(sock);
>> +}
>> +
>> +int hsmp_create_acpi_sysfs_if(struct device *dev)
>> +{
>> +     struct attribute_group *attr_grp;
>> +     u16 sock_ind;
>> +     int ret;
>> +
>> +     attr_grp = devm_kzalloc(dev, sizeof(struct attribute_group), GFP_KERNEL);
> #include for devm_kzalloc()
ok.
>> +     if (!attr_grp)
>> +             return -ENOMEM;
>> +
>> +     attr_grp->is_bin_visible = hsmp_is_sock_attr_visible;
>> +
>> +     ret = hsmp_get_uid(dev, &sock_ind);
>> +     if (ret)
>> +             return ret;
>> +
>> +     ret = hsmp_create_attr_list(attr_grp, dev, sock_ind);
>> +     if (ret)
>> +             return ret;
>> +
>> +     return devm_device_add_group(dev, attr_grp);
> #include for devm_device_add_group()
ok.
>
> --
>   i.
>
>> +}
>> +
>> +int init_acpi(struct device *dev)
>> +{
>> +     u16 sock_ind;
>> +     int ret;
>> +
>> +     ret = hsmp_get_uid(dev, &sock_ind);
>> +     if (ret)
>> +             return ret;
>> +     if (sock_ind >= plat_dev.num_sockets)
>> +             return -EINVAL;
>> +
>> +     ret = hsmp_parse_acpi_table(dev, sock_ind);
>> +     if (ret) {
>> +             dev_err(dev, "Failed to parse ACPI table\n");
>> +             return ret;
>> +     }
>> +
>> +     /* Test the hsmp interface */
>> +     ret = hsmp_test(sock_ind, 0xDEADBEEF);
>> +     if (ret) {
>> +             dev_err(dev, "HSMP test message failed on Fam:%x model:%x\n",
>> +                     boot_cpu_data.x86, boot_cpu_data.x86_model);
>> +             dev_err(dev, "Is HSMP disabled in BIOS ?\n");
>> +             return ret;
>> +     }
>> +
>> +     ret = hsmp_cache_proto_ver(sock_ind);
>> +     if (ret) {
>> +             dev_err(dev, "Failed to read HSMP protocol version\n");
>> +             return ret;
>> +     }
>> +
>> +     return ret;
>> +}
>> diff --git a/drivers/platform/x86/amd/hsmp/hsmp.c b/drivers/platform/x86/amd/hsmp/hsmp.c
>> index cd4de107a470..d3f0f08cebf7 100644
>> --- a/drivers/platform/x86/amd/hsmp/hsmp.c
>> +++ b/drivers/platform/x86/amd/hsmp/hsmp.c
>> @@ -28,22 +28,8 @@
>>   #define HSMP_WR                      true
>>   #define HSMP_RD                      false
>>
>> -/* These are the strings specified in ACPI table */
>> -#define MSG_IDOFF_STR                "MsgIdOffset"
>> -#define MSG_ARGOFF_STR               "MsgArgOffset"
>> -#define MSG_RESPOFF_STR              "MsgRspOffset"
>> -
>>   struct hsmp_plat_device plat_dev;
>>
>> -static void amd_hsmp_acpi_rdwr(struct hsmp_socket *sock, u32 offset,
>> -                            u32 *value, bool write)
>> -{
>> -     if (write)
>> -             iowrite32(*value, sock->virt_base_addr + offset);
>> -     else
>> -             *value = ioread32(sock->virt_base_addr + offset);
>> -}
>> -
>>   static int amd_hsmp_rdwr(struct hsmp_socket *sock, u32 offset,
>>                         u32 *value, bool write)
>>   {
>> @@ -298,181 +284,6 @@ long hsmp_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
>>        return 0;
>>   }
>>
>> -/* This is the UUID used for HSMP */
>> -static const guid_t acpi_hsmp_uuid = GUID_INIT(0xb74d619d, 0x5707, 0x48bd,
>> -                                             0xa6, 0x9f, 0x4e, 0xa2,
>> -                                             0x87, 0x1f, 0xc2, 0xf6);
>> -
>> -static inline bool is_acpi_hsmp_uuid(union acpi_object *obj)
>> -{
>> -     if (obj->type == ACPI_TYPE_BUFFER && obj->buffer.length == UUID_SIZE)
>> -             return guid_equal((guid_t *)obj->buffer.pointer, &acpi_hsmp_uuid);
>> -
>> -     return false;
>> -}
>> -
>> -static inline int hsmp_get_uid(struct device *dev, u16 *sock_ind)
>> -{
>> -     char *uid;
>> -
>> -     /*
>> -      * UID (ID00, ID01..IDXX) is used for differentiating sockets,
>> -      * read it and strip the "ID" part of it and convert the remaining
>> -      * bytes to integer.
>> -      */
>> -     uid = acpi_device_uid(ACPI_COMPANION(dev));
>> -
>> -     return kstrtou16(uid + 2, 10, sock_ind);
>> -}
>> -
>> -static acpi_status hsmp_resource(struct acpi_resource *res, void *data)
>> -{
>> -     struct hsmp_socket *sock = data;
>> -     struct resource r;
>> -
>> -     switch (res->type) {
>> -     case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
>> -             if (!acpi_dev_resource_memory(res, &r))
>> -                     return AE_ERROR;
>> -             if (!r.start || r.end < r.start || !(r.flags & IORESOURCE_MEM_WRITEABLE))
>> -                     return AE_ERROR;
>> -             sock->mbinfo.base_addr = r.start;
>> -             sock->mbinfo.size = resource_size(&r);
>> -             break;
>> -     case ACPI_RESOURCE_TYPE_END_TAG:
>> -             break;
>> -     default:
>> -             return AE_ERROR;
>> -     }
>> -
>> -     return AE_OK;
>> -}
>> -
>> -static int hsmp_read_acpi_dsd(struct hsmp_socket *sock)
>> -{
>> -     struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
>> -     union acpi_object *guid, *mailbox_package;
>> -     union acpi_object *dsd;
>> -     acpi_status status;
>> -     int ret = 0;
>> -     int j;
>> -
>> -     status = acpi_evaluate_object_typed(ACPI_HANDLE(sock->dev), "_DSD", NULL,
>> -                                         &buf, ACPI_TYPE_PACKAGE);
>> -     if (ACPI_FAILURE(status)) {
>> -             dev_err(sock->dev, "Failed to read mailbox reg offsets from DSD table, err: %s\n",
>> -                     acpi_format_exception(status));
>> -             return -ENODEV;
>> -     }
>> -
>> -     dsd = buf.pointer;
>> -
>> -     /* HSMP _DSD property should contain 2 objects.
>> -      * 1. guid which is an acpi object of type ACPI_TYPE_BUFFER
>> -      * 2. mailbox which is an acpi object of type ACPI_TYPE_PACKAGE
>> -      *    This mailbox object contains 3 more acpi objects of type
>> -      *    ACPI_TYPE_PACKAGE for holding msgid, msgresp, msgarg offsets
>> -      *    these packages inturn contain 2 acpi objects of type
>> -      *    ACPI_TYPE_STRING and ACPI_TYPE_INTEGER
>> -      */
>> -     if (!dsd || dsd->type != ACPI_TYPE_PACKAGE || dsd->package.count != 2) {
>> -             ret = -EINVAL;
>> -             goto free_buf;
>> -     }
>> -
>> -     guid = &dsd->package.elements[0];
>> -     mailbox_package = &dsd->package.elements[1];
>> -     if (!is_acpi_hsmp_uuid(guid) || mailbox_package->type != ACPI_TYPE_PACKAGE) {
>> -             dev_err(sock->dev, "Invalid hsmp _DSD table data\n");
>> -             ret = -EINVAL;
>> -             goto free_buf;
>> -     }
>> -
>> -     for (j = 0; j < mailbox_package->package.count; j++) {
>> -             union acpi_object *msgobj, *msgstr, *msgint;
>> -
>> -             msgobj  = &mailbox_package->package.elements[j];
>> -             msgstr  = &msgobj->package.elements[0];
>> -             msgint  = &msgobj->package.elements[1];
>> -
>> -             /* package should have 1 string and 1 integer object */
>> -             if (msgobj->type != ACPI_TYPE_PACKAGE ||
>> -                 msgstr->type != ACPI_TYPE_STRING ||
>> -                 msgint->type != ACPI_TYPE_INTEGER) {
>> -                     ret = -EINVAL;
>> -                     goto free_buf;
>> -             }
>> -
>> -             if (!strncmp(msgstr->string.pointer, MSG_IDOFF_STR,
>> -                          msgstr->string.length)) {
>> -                     sock->mbinfo.msg_id_off = msgint->integer.value;
>> -             } else if (!strncmp(msgstr->string.pointer, MSG_RESPOFF_STR,
>> -                                 msgstr->string.length)) {
>> -                     sock->mbinfo.msg_resp_off =  msgint->integer.value;
>> -             } else if (!strncmp(msgstr->string.pointer, MSG_ARGOFF_STR,
>> -                                 msgstr->string.length)) {
>> -                     sock->mbinfo.msg_arg_off = msgint->integer.value;
>> -             } else {
>> -                     ret = -ENOENT;
>> -                     goto free_buf;
>> -             }
>> -     }
>> -
>> -     if (!sock->mbinfo.msg_id_off || !sock->mbinfo.msg_resp_off ||
>> -         !sock->mbinfo.msg_arg_off)
>> -             ret = -EINVAL;
>> -
>> -free_buf:
>> -     ACPI_FREE(buf.pointer);
>> -     return ret;
>> -}
>> -
>> -static int hsmp_read_acpi_crs(struct hsmp_socket *sock)
>> -{
>> -     acpi_status status;
>> -
>> -     status = acpi_walk_resources(ACPI_HANDLE(sock->dev), METHOD_NAME__CRS,
>> -                                  hsmp_resource, sock);
>> -     if (ACPI_FAILURE(status)) {
>> -             dev_err(sock->dev, "Failed to look up MP1 base address from CRS method, err: %s\n",
>> -                     acpi_format_exception(status));
>> -             return -EINVAL;
>> -     }
>> -     if (!sock->mbinfo.base_addr || !sock->mbinfo.size)
>> -             return -EINVAL;
>> -
>> -     /* The mapped region should be un cached */
>> -     sock->virt_base_addr = devm_ioremap_uc(sock->dev, sock->mbinfo.base_addr,
>> -                                            sock->mbinfo.size);
>> -     if (!sock->virt_base_addr) {
>> -             dev_err(sock->dev, "Failed to ioremap MP1 base address\n");
>> -             return -ENOMEM;
>> -     }
>> -
>> -     return 0;
>> -}
>> -
>> -/* Parse the ACPI table to read the data */
>> -static int hsmp_parse_acpi_table(struct device *dev, u16 sock_ind)
>> -{
>> -     struct hsmp_socket *sock = &plat_dev.sock[sock_ind];
>> -     int ret;
>> -
>> -     sock->sock_ind          = sock_ind;
>> -     sock->dev               = dev;
>> -     plat_dev.is_acpi_device = true;
>> -
>> -     sema_init(&sock->hsmp_sem, 1);
>> -
>> -     /* Read MP1 base address from CRS method */
>> -     ret = hsmp_read_acpi_crs(sock);
>> -     if (ret)
>> -             return ret;
>> -
>> -     /* Read mailbox offsets from DSD table */
>> -     return hsmp_read_acpi_dsd(sock);
>> -}
>> -
>>   ssize_t hsmp_metric_tbl_read(struct file *filp, struct kobject *kobj,
>>                             struct bin_attribute *bin_attr, char *buf,
>>                             loff_t off, size_t count)
>> @@ -581,29 +392,6 @@ int hsmp_create_attr_list(struct attribute_group *attr_grp,
>>        return hsmp_init_metric_tbl_bin_attr(hsmp_bin_attrs, sock_ind);
>>   }
>>
>> -int hsmp_create_acpi_sysfs_if(struct device *dev)
>> -{
>> -     struct attribute_group *attr_grp;
>> -     u16 sock_ind;
>> -     int ret;
>> -
>> -     attr_grp = devm_kzalloc(dev, sizeof(struct attribute_group), GFP_KERNEL);
>> -     if (!attr_grp)
>> -             return -ENOMEM;
>> -
>> -     attr_grp->is_bin_visible = hsmp_is_sock_attr_visible;
>> -
>> -     ret = hsmp_get_uid(dev, &sock_ind);
>> -     if (ret)
>> -             return ret;
>> -
>> -     ret = hsmp_create_attr_list(attr_grp, dev, sock_ind);
>> -     if (ret)
>> -             return ret;
>> -
>> -     return devm_device_add_group(dev, attr_grp);
>> -}
>> -
>>   int hsmp_cache_proto_ver(u16 sock_ind)
>>   {
>>        struct hsmp_message msg = { 0 };
>> @@ -619,38 +407,3 @@ int hsmp_cache_proto_ver(u16 sock_ind)
>>
>>        return ret;
>>   }
>> -
>> -int init_acpi(struct device *dev)
>> -{
>> -     u16 sock_ind;
>> -     int ret;
>> -
>> -     ret = hsmp_get_uid(dev, &sock_ind);
>> -     if (ret)
>> -             return ret;
>> -     if (sock_ind >= plat_dev.num_sockets)
>> -             return -EINVAL;
>> -
>> -     ret = hsmp_parse_acpi_table(dev, sock_ind);
>> -     if (ret) {
>> -             dev_err(dev, "Failed to parse ACPI table\n");
>> -             return ret;
>> -     }
>> -
>> -     /* Test the hsmp interface */
>> -     ret = hsmp_test(sock_ind, 0xDEADBEEF);
>> -     if (ret) {
>> -             dev_err(dev, "HSMP test message failed on Fam:%x model:%x\n",
>> -                     boot_cpu_data.x86, boot_cpu_data.x86_model);
>> -             dev_err(dev, "Is HSMP disabled in BIOS ?\n");
>> -             return ret;
>> -     }
>> -
>> -     ret = hsmp_cache_proto_ver(sock_ind);
>> -     if (ret) {
>> -             dev_err(dev, "Failed to read HSMP protocol version\n");
>> -             return ret;
>> -     }
>> -
>> -     return ret;
>> -}
>> diff --git a/drivers/platform/x86/amd/hsmp/hsmp.h b/drivers/platform/x86/amd/hsmp/hsmp.h
>> index d65ff2acdf3d..2baeef57ca54 100644
>> --- a/drivers/platform/x86/amd/hsmp/hsmp.h
>> +++ b/drivers/platform/x86/amd/hsmp/hsmp.h
>> @@ -68,4 +68,6 @@ umode_t hsmp_is_sock_attr_visible(struct kobject *kobj,
>>   int hsmp_create_attr_list(struct attribute_group *attr_grp,
>>                          struct device *dev, u16 sock_ind);
>>   int hsmp_test(u16 sock_ind, u32 value);
>> +void amd_hsmp_acpi_rdwr(struct hsmp_socket *sock, u32 offset,
>> +                     u32 *value, bool write);
>>   #endif /* HSMP_H */


Thanks and Regards,

Suma


  reply	other threads:[~2024-07-09 10:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27  5:39 [PATCH 00/10] platform/x86/amd/hsmp: Split ACPI and plat device driver Suma Hegde
2024-06-27  5:39 ` [PATCH 01/10] platform/x86/amd/hsmp: Create hsmp/ directory Suma Hegde
2024-06-27  5:39 ` [PATCH 02/10] platform/x86/amd/hsmp: Create wrapper function init_acpi() Suma Hegde
2024-07-09 10:24   ` Ilpo Järvinen
2024-06-27  5:39 ` [PATCH 03/10] platform/x86/amd/hsmp: Move strcuture and macros to header file Suma Hegde
2024-06-27 19:30   ` Mario Limonciello
2024-07-09 10:21   ` Ilpo Järvinen
2024-06-27  5:39 ` [PATCH 04/10] platform/x86/amd/hsmp: Move platform device specific code to plat.c Suma Hegde
2024-07-09 10:20   ` Ilpo Järvinen
2024-06-27  5:39 ` [PATCH 05/10] platform/x86/amd/hsmp: Move ACPI code to acpi.c Suma Hegde
2024-07-09 10:09   ` Ilpo Järvinen
2024-07-09 10:50     ` Suma Hegde [this message]
2024-06-27  5:39 ` [PATCH 06/10] platform/x86/amd/hsmp: Create mutually exclusive ACPI and plat drivers Suma Hegde
2024-07-08 10:15   ` Ilpo Järvinen
2024-07-09  6:41     ` Suma Hegde
2024-06-27  5:39 ` [PATCH 07/10] platform/x86/amd/hsmp: Use name space while exporting module symbols Suma Hegde
2024-07-08 10:23   ` Ilpo Järvinen
2024-06-27  5:39 ` [PATCH 08/10] platform/x86/amd/hsmp: Move read and is_visible to respective files Suma Hegde
2024-06-27 19:48   ` Mario Limonciello
2024-06-28  3:50     ` Suma Hegde
2024-06-27  5:39 ` [PATCH 09/10] platform/x86/amd/hsmp: Use dev_groups in the driver structure Suma Hegde
2024-06-27  5:39 ` [PATCH 10/10] platform/x86/amd/hsmp: Fix potential spectre issue Suma Hegde

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=41b9c3ff-c406-4df5-bae7-25be4d4c361f@amd.com \
    --to=suma.hegde@amd.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=naveenkrishna.chatradhi@amd.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /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