2024-04-10 06:36:50

by Ruidong Tian

[permalink] [raw]
Subject: [PATCH v2 0/2] ACPICA: AEST: Support AEST V2

AEST V2 was published[1], add V2 support based on AEST V1.

Fix some code styling issues as well.

Change from v1:
- fix error variable name in struct acpi_aest_node_interface_64k.

[1]: https://developer.arm.com/documentation/den0085/latest/

Ruidong Tian (2):
ACPICA: AEST: Fix coding style at struct definition
ACPICA: AEST: Add support for the AEST V2 table

include/acpi/actbl2.h | 132 +++++++++++++++++++++++++++++++-----------
1 file changed, 99 insertions(+), 33 deletions(-)

--
2.33.1



2024-04-10 06:37:15

by Ruidong Tian

[permalink] [raw]
Subject: [PATCH v2 2/2] ACPICA: AEST: Add support for the AEST V2 table

ACPICA commit ebb49799c78891cbe370f1264844664a3d8b6f35

AEST V2 was published[1], add V2 support based on AEST V1.

[1]: https://developer.arm.com/documentation/den0085/latest/

Link: https://github.com/acpica/acpica/commit/ebb4979
Signed-off-by: Ruidong Tian <[email protected]>
---
include/acpi/actbl2.h | 88 ++++++++++++++++++++++++++++++++++++++++---
1 file changed, 82 insertions(+), 6 deletions(-)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index f89b23b3d2aa..d1670ab93fc6 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -77,8 +77,8 @@
*
* AEST - Arm Error Source Table
*
- * Conforms to: ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document
- * September 2020.
+ * Conforms to: ACPI for the Armv8 RAS Extensions 1.1(Sep 2020) and
+ * 2.0(May 2023) Platform Design Document.
*
******************************************************************************/

@@ -108,7 +108,9 @@ struct acpi_aest_hdr {
#define ACPI_AEST_SMMU_ERROR_NODE 2
#define ACPI_AEST_VENDOR_ERROR_NODE 3
#define ACPI_AEST_GIC_ERROR_NODE 4
-#define ACPI_AEST_NODE_TYPE_RESERVED 5 /* 5 and above are reserved */
+#define ACPI_AEST_PCIE_ERROR_NODE 5
+#define ACPI_AEST_PROXY_ERROR_NODE 6
+#define ACPI_AEST_NODE_TYPE_RESERVED 7 /* 7 and above are reserved */

/*
* AEST subtables (Error nodes)
@@ -180,6 +182,12 @@ struct acpi_aest_vendor {
u8 vendor_specific_data[16];
};

+struct acpi_aest_vendor_v2 {
+ char acpi_hid[8];
+ u32 acpi_uid;
+ u8 vendor_specific_data[16];
+};
+
/* 4: Gic Error */

struct acpi_aest_gic {
@@ -195,6 +203,18 @@ struct acpi_aest_gic {
#define ACPI_AEST_GIC_ITS 3
#define ACPI_AEST_GIC_RESERVED 4 /* 4 and above are reserved */

+/* 5: PCIe Error */
+
+struct acpi_aest_pcie {
+ u32 iort_node_reference;
+};
+
+/* 6: Proxy Error */
+
+struct acpi_aest_proxy {
+ u64 node_address;
+};
+
/* Node Interface Structure */

struct acpi_aest_node_interface {
@@ -209,11 +229,57 @@ struct acpi_aest_node_interface {
u64 addressing_mode;
};

+/* Node Interface Structure V2 */
+
+struct acpi_aest_node_interface_header {
+ u8 type;
+ u8 group_format;
+ u8 reserved[2];
+ u32 flags;
+ u64 address;
+ u32 error_record_index;
+ u32 error_record_count;
+};
+
+#define ACPI_AEST_NODE_GROUP_FORMAT_4K 0
+#define ACPI_AEST_NODE_GROUP_FORMAT_16K 1
+#define ACPI_AEST_NODE_GROUP_FORMAT_64K 2
+
+struct acpi_aest_node_interface_common {
+ u32 error_node_device;
+ u32 processor_affinity;
+ u64 error_group_register_base;
+ u64 fault_inject_register_base;
+ u64 interrupt_config_register_base;
+};
+
+struct acpi_aest_node_interface_4k {
+ u64 error_record_implemented;
+ u64 error_status_reporting;
+ u64 addressing_mode;
+ struct acpi_aest_node_interface_common common;
+};
+
+struct acpi_aest_node_interface_16k {
+ u64 error_record_implemented[4];
+ u64 error_status_reporting[4];
+ u64 addressing_mode[4];
+ struct acpi_aest_node_interface_common common;
+};
+
+struct acpi_aest_node_interface_64k {
+ u64 error_record_implemented[14];
+ u64 error_status_reporting[14];
+ u64 addressing_mode[14];
+ struct acpi_aest_node_interface_common common;
+};
+
/* Values for Type field above */

-#define ACPI_AEST_NODE_SYSTEM_REGISTER 0
-#define ACPI_AEST_NODE_MEMORY_MAPPED 1
-#define ACPI_AEST_XFACE_RESERVED 2 /* 2 and above are reserved */
+#define ACPI_AEST_NODE_SYSTEM_REGISTER 0
+#define ACPI_AEST_NODE_MEMORY_MAPPED 1
+#define ACPI_AEST_NODE_SINGLE_RECORD_MEMORY_MAPPED 2
+#define ACPI_AEST_XFACE_RESERVED 3 /* 2 and above are reserved */

/* Node Interrupt Structure */

@@ -226,6 +292,16 @@ struct acpi_aest_node_interrupt {
u8 reserved1[3];
};

+/* Node Interrupt Structure V2 */
+
+struct acpi_aest_node_interrupt_v2 {
+ u8 type;
+ u8 reserved[2];
+ u8 flags;
+ u32 gsiv;
+ u8 reserved1[4];
+};
+
/* Values for Type field above */

#define ACPI_AEST_NODE_FAULT_HANDLING 0
--
2.33.1


2024-04-10 06:41:07

by Ruidong Tian

[permalink] [raw]
Subject: [PATCH v2 1/2] ACPICA: AEST: Fix coding style at struct definition

Delete unnecessary blank lines and typedef to follow Kernel coding
style.

Signed-off-by: Ruidong Tian <[email protected]>
---
include/acpi/actbl2.h | 50 +++++++++++++++++--------------------------
1 file changed, 20 insertions(+), 30 deletions(-)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index f237269bd1cb..f89b23b3d2aa 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -116,15 +116,14 @@ struct acpi_aest_hdr {

/* 0: Processor Error */

-typedef struct acpi_aest_processor {
+struct acpi_aest_processor {
u32 processor_id;
u8 resource_type;
u8 reserved;
u8 flags;
u8 revision;
u64 processor_affinity;
-
-} acpi_aest_processor;
+};

/* Values for resource_type above, related structs below */

@@ -135,11 +134,10 @@ typedef struct acpi_aest_processor {

/* 0R: Processor Cache Resource Substructure */

-typedef struct acpi_aest_processor_cache {
+struct acpi_aest_processor_cache {
u32 cache_reference;
u32 reserved;
-
-} acpi_aest_processor_cache;
+};

/* Values for cache_type above */

@@ -150,50 +148,44 @@ typedef struct acpi_aest_processor_cache {

/* 1R: Processor TLB Resource Substructure */

-typedef struct acpi_aest_processor_tlb {
+struct acpi_aest_processor_tlb {
u32 tlb_level;
u32 reserved;
-
-} acpi_aest_processor_tlb;
+};

/* 2R: Processor Generic Resource Substructure */

-typedef struct acpi_aest_processor_generic {
+struct acpi_aest_processor_generic {
u32 resource;
-
-} acpi_aest_processor_generic;
+};

/* 1: Memory Error */

-typedef struct acpi_aest_memory {
+struct acpi_aest_memory {
u32 srat_proximity_domain;
-
-} acpi_aest_memory;
+};

/* 2: Smmu Error */

-typedef struct acpi_aest_smmu {
+struct acpi_aest_smmu {
u32 iort_node_reference;
u32 subcomponent_reference;
-
-} acpi_aest_smmu;
+};

/* 3: Vendor Defined */

-typedef struct acpi_aest_vendor {
+struct acpi_aest_vendor {
u32 acpi_hid;
u32 acpi_uid;
u8 vendor_specific_data[16];
-
-} acpi_aest_vendor;
+};

/* 4: Gic Error */

-typedef struct acpi_aest_gic {
+struct acpi_aest_gic {
u32 interface_type;
u32 instance_id;
-
-} acpi_aest_gic;
+};

/* Values for interface_type above */

@@ -205,7 +197,7 @@ typedef struct acpi_aest_gic {

/* Node Interface Structure */

-typedef struct acpi_aest_node_interface {
+struct acpi_aest_node_interface {
u8 type;
u8 reserved[3];
u32 flags;
@@ -215,8 +207,7 @@ typedef struct acpi_aest_node_interface {
u64 error_record_implemented;
u64 error_status_reporting;
u64 addressing_mode;
-
-} acpi_aest_node_interface;
+};

/* Values for Type field above */

@@ -226,15 +217,14 @@ typedef struct acpi_aest_node_interface {

/* Node Interrupt Structure */

-typedef struct acpi_aest_node_interrupt {
+struct acpi_aest_node_interrupt {
u8 type;
u8 reserved[2];
u8 flags;
u32 gsiv;
u8 iort_id;
u8 reserved1[3];
-
-} acpi_aest_node_interrupt;
+};

/* Values for Type field above */

--
2.33.1


2024-04-10 09:23:07

by Sudeep Holla

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] ACPICA: AEST: Support AEST V2

On Wed, Apr 10, 2024 at 02:36:00PM +0800, Ruidong Tian wrote:
> AEST V2 was published[1], add V2 support based on AEST V1.
>

Any changes to ACPICA has to get merged in the external ACPICA project.
Refer [1] for details from Rafael. You can also refer [2] in the kernel
docs.

--
Regards,
Sudeep

[1] https://lore.kernel.org/all/CAJZ5v0g087vTJmgLHssedyCuhh61F_hR+TP3HQpoTACuzh+0jA@mail.gmail.com
[2] Documentation/driver-api/acpi/linuxized-acpica.rst

2024-04-11 07:55:03

by Ruidong Tian

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] ACPICA: AEST: Support AEST V2



在 2024/4/10 17:22, Sudeep Holla 写道:
> On Wed, Apr 10, 2024 at 02:36:00PM +0800, Ruidong Tian wrote:
>> AEST V2 was published[1], add V2 support based on AEST V1.
>>
>
> Any changes to ACPICA has to get merged in the external ACPICA project.
> Refer [1] for details from Rafael. You can also refer [2] in the kernel
> docs.
>

Patch1 is just a fix to follow kernel code style. Patch2 had merged to
acpica project, PR link can be see in patch2 comment:

Link: https://github.com/acpica/acpica/commit/ebb4979

2024-04-11 09:15:09

by Sudeep Holla

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] ACPICA: AEST: Support AEST V2

On Thu, Apr 11, 2024 at 03:54:48PM +0800, Ruidong Tian wrote:
>
>
> 在 2024/4/10 17:22, Sudeep Holla 写道:
> > On Wed, Apr 10, 2024 at 02:36:00PM +0800, Ruidong Tian wrote:
> > > AEST V2 was published[1], add V2 support based on AEST V1.
> > >
> >
> > Any changes to ACPICA has to get merged in the external ACPICA project.
> > Refer [1] for details from Rafael. You can also refer [2] in the kernel
> > docs.
> >
>
> Patch1 is just a fix to follow kernel code style.

IIUC such changes are not allowed as ACPICA changes are always imported
from the external project. So you have to take same route as patch2

> Patch2 had merged to
> acpica project, PR link can be see in patch2 comment:
>
> Link: https://github.com/acpica/acpica/commit/ebb4979

Thanks, this will then get imported into kernel next time ACPICA changes
get merged which usually happens regularly.

--
Regards,
Sudeep

2024-04-12 02:44:33

by Ruidong Tian

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] ACPICA: AEST: Support AEST V2



在 2024/4/11 17:14, Sudeep Holla 写道:
> On Thu, Apr 11, 2024 at 03:54:48PM +0800, Ruidong Tian wrote:
>>
>>
>> 在 2024/4/10 17:22, Sudeep Holla 写道:
>>> On Wed, Apr 10, 2024 at 02:36:00PM +0800, Ruidong Tian wrote:
>>>> AEST V2 was published[1], add V2 support based on AEST V1.
>>>>
>>>
>>> Any changes to ACPICA has to get merged in the external ACPICA project.
>>> Refer [1] for details from Rafael. You can also refer [2] in the kernel
>>> docs.
>>>
>>
>> Patch1 is just a fix to follow kernel code style.
>
> IIUC such changes are not allowed as ACPICA changes are always imported
> from the external project. So you have to take same route as patch2

In ACPICA, all struct use typedef which is not allowed in kernel:

It's a **mistake** to use typedef for structures and pointers[1].

I see all other structs in actbl2.h follow this rule, so I fix all
typedef in AEST struct to follow kernel code style. But i can not apple
this fix in ACPICA. Patch1 is just a kernel patch.

[1]: Documentation/process/coding-style.rst

> 1
>> Patch2 had merged to
>> acpica project, PR link can be see in patch2 comment:
>>
>> Link: https://github.com/acpica/acpica/commit/ebb4979
>
> Thanks, this will then get imported into kernel next time ACPICA changes
> get merged which usually happens regularly.
>

2024-04-12 09:26:59

by Sudeep Holla

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] ACPICA: AEST: Support AEST V2

On Fri, Apr 12, 2024 at 10:41:31AM +0800, Ruidong Tian wrote:
>
>
> 在 2024/4/11 17:14, Sudeep Holla 写道:
> > On Thu, Apr 11, 2024 at 03:54:48PM +0800, Ruidong Tian wrote:
> > >
> > >
> > > 在 2024/4/10 17:22, Sudeep Holla 写道:
> > > > On Wed, Apr 10, 2024 at 02:36:00PM +0800, Ruidong Tian wrote:
> > > > > AEST V2 was published[1], add V2 support based on AEST V1.
> > > > >
> > > >
> > > > Any changes to ACPICA has to get merged in the external ACPICA project.
> > > > Refer [1] for details from Rafael. You can also refer [2] in the kernel
> > > > docs.
> > > >
> > >
> > > Patch1 is just a fix to follow kernel code style.
> >
> > IIUC such changes are not allowed as ACPICA changes are always imported
> > from the external project. So you have to take same route as patch2
>
> In ACPICA, all struct use typedef which is not allowed in kernel:
>
> It's a **mistake** to use typedef for structures and pointers[1].
>

Fair enough.

> I see all other structs in actbl2.h follow this rule, so I fix all typedef
> in AEST struct to follow kernel code style. But i can not apple this fix in
> ACPICA. Patch1 is just a kernel patch.
>

No patches from the kernel tree applies to APCICA because of some variations
in the coding style that the import script modifies when applying to the
kernel. So make similar changes in APCICA project and send it there. It will
get imported if it gets merged there.

--
Regards,
Sudeep

2024-04-22 16:51:05

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] ACPICA: AEST: Add support for the AEST V2 table

On Wed, Apr 10, 2024 at 8:36 AM Ruidong Tian
<[email protected]> wrote:
>
> ACPICA commit ebb49799c78891cbe370f1264844664a3d8b6f35
>
> AEST V2 was published[1], add V2 support based on AEST V1.
>
> [1]: https://developer.arm.com/documentation/den0085/latest/
>
> Link: https://github.com/acpica/acpica/commit/ebb4979
> Signed-off-by: Ruidong Tian <[email protected]>
> ---
> include/acpi/actbl2.h | 88 ++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 82 insertions(+), 6 deletions(-)
>
> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
> index f89b23b3d2aa..d1670ab93fc6 100644
> --- a/include/acpi/actbl2.h
> +++ b/include/acpi/actbl2.h
> @@ -77,8 +77,8 @@
> *
> * AEST - Arm Error Source Table
> *
> - * Conforms to: ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document
> - * September 2020.
> + * Conforms to: ACPI for the Armv8 RAS Extensions 1.1(Sep 2020) and
> + * 2.0(May 2023) Platform Design Document.
> *
> ******************************************************************************/
>
> @@ -108,7 +108,9 @@ struct acpi_aest_hdr {
> #define ACPI_AEST_SMMU_ERROR_NODE 2
> #define ACPI_AEST_VENDOR_ERROR_NODE 3
> #define ACPI_AEST_GIC_ERROR_NODE 4
> -#define ACPI_AEST_NODE_TYPE_RESERVED 5 /* 5 and above are reserved */
> +#define ACPI_AEST_PCIE_ERROR_NODE 5
> +#define ACPI_AEST_PROXY_ERROR_NODE 6
> +#define ACPI_AEST_NODE_TYPE_RESERVED 7 /* 7 and above are reserved */
>
> /*
> * AEST subtables (Error nodes)
> @@ -180,6 +182,12 @@ struct acpi_aest_vendor {
> u8 vendor_specific_data[16];
> };
>
> +struct acpi_aest_vendor_v2 {
> + char acpi_hid[8];
> + u32 acpi_uid;
> + u8 vendor_specific_data[16];
> +};
> +
> /* 4: Gic Error */
>
> struct acpi_aest_gic {
> @@ -195,6 +203,18 @@ struct acpi_aest_gic {
> #define ACPI_AEST_GIC_ITS 3
> #define ACPI_AEST_GIC_RESERVED 4 /* 4 and above are reserved */
>
> +/* 5: PCIe Error */
> +
> +struct acpi_aest_pcie {
> + u32 iort_node_reference;
> +};
> +
> +/* 6: Proxy Error */
> +
> +struct acpi_aest_proxy {
> + u64 node_address;
> +};
> +
> /* Node Interface Structure */
>
> struct acpi_aest_node_interface {
> @@ -209,11 +229,57 @@ struct acpi_aest_node_interface {
> u64 addressing_mode;
> };
>
> +/* Node Interface Structure V2 */
> +
> +struct acpi_aest_node_interface_header {
> + u8 type;
> + u8 group_format;
> + u8 reserved[2];
> + u32 flags;
> + u64 address;
> + u32 error_record_index;
> + u32 error_record_count;
> +};
> +
> +#define ACPI_AEST_NODE_GROUP_FORMAT_4K 0
> +#define ACPI_AEST_NODE_GROUP_FORMAT_16K 1
> +#define ACPI_AEST_NODE_GROUP_FORMAT_64K 2
> +
> +struct acpi_aest_node_interface_common {
> + u32 error_node_device;
> + u32 processor_affinity;
> + u64 error_group_register_base;
> + u64 fault_inject_register_base;
> + u64 interrupt_config_register_base;
> +};
> +
> +struct acpi_aest_node_interface_4k {
> + u64 error_record_implemented;
> + u64 error_status_reporting;
> + u64 addressing_mode;
> + struct acpi_aest_node_interface_common common;
> +};
> +
> +struct acpi_aest_node_interface_16k {
> + u64 error_record_implemented[4];
> + u64 error_status_reporting[4];
> + u64 addressing_mode[4];
> + struct acpi_aest_node_interface_common common;
> +};
> +
> +struct acpi_aest_node_interface_64k {
> + u64 error_record_implemented[14];
> + u64 error_status_reporting[14];
> + u64 addressing_mode[14];
> + struct acpi_aest_node_interface_common common;
> +};
> +
> /* Values for Type field above */
>
> -#define ACPI_AEST_NODE_SYSTEM_REGISTER 0
> -#define ACPI_AEST_NODE_MEMORY_MAPPED 1
> -#define ACPI_AEST_XFACE_RESERVED 2 /* 2 and above are reserved */
> +#define ACPI_AEST_NODE_SYSTEM_REGISTER 0
> +#define ACPI_AEST_NODE_MEMORY_MAPPED 1
> +#define ACPI_AEST_NODE_SINGLE_RECORD_MEMORY_MAPPED 2
> +#define ACPI_AEST_XFACE_RESERVED 3 /* 2 and above are reserved */
>
> /* Node Interrupt Structure */
>
> @@ -226,6 +292,16 @@ struct acpi_aest_node_interrupt {
> u8 reserved1[3];
> };
>
> +/* Node Interrupt Structure V2 */
> +
> +struct acpi_aest_node_interrupt_v2 {
> + u8 type;
> + u8 reserved[2];
> + u8 flags;
> + u32 gsiv;
> + u8 reserved1[4];
> +};
> +
> /* Values for Type field above */
>
> #define ACPI_AEST_NODE_FAULT_HANDLING 0
> --

This does not apply for me, can you please rebase on top of linux-next
and resend?