public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Rohit Mathew" <rohit.mathew@arm.com>
To: Andrew Fish <afish@apple.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	Swatisri Kantamsetti <swatisrik@nvidia.com>
Cc: Sami Mujawar <Sami.Mujawar@arm.com>,
	Alexei Fedorov <Alexei.Fedorov@arm.com>,
	Mike Kinney <michael.d.kinney@intel.com>,
	"gaoliming@byosoft.com.cn" <gaoliming@byosoft.com.cn>,
	"zhiguang.liu@intel.com" <zhiguang.liu@intel.com>,
	Thomas Abraham <thomas.abraham@arm.com>,
	Thanu Rangarajan <Thanu.Rangarajan@arm.com>, nd <nd@arm.com>
Subject: Re: [edk2-devel] [PATCH 1/2] Mde Pkg: Support for MPAM ACPI Table
Date: Tue, 23 Aug 2022 21:28:50 +0000	[thread overview]
Message-ID: <AM6PR08MB37834E7331D7A6D40F85AE6A8F709@AM6PR08MB3783.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <D70D4793-08DB-4D6B-A7F0-4CA34D356A85@apple.com>

[-- Attachment #1: Type: text/plain, Size: 6457 bytes --]

Hi Andrew,

From: Andrew Fish <afish@apple.com>
Sent: 23 August 2022 21:11
To: devel@edk2.groups.io; Rohit Mathew <Rohit.Mathew@arm.com>
Cc: username@nvidia.com; Sami Mujawar <Sami.Mujawar@arm.com>; Alexei Fedorov <Alexei.Fedorov@arm.com>; Mike Kinney <michael.d.kinney@intel.com>; gaoliming@byosoft.com.cn; zhiguang.liu@intel.com; Swatisri Kantamsetti <swatisrik@nvidia.com>; Thomas Abraham <thomas.abraham@arm.com>; Thanu Rangarajan <Thanu.Rangarajan@arm.com>; nd <nd@arm.com>
Subject: Re: [edk2-devel] [PATCH 1/2] Mde Pkg: Support for MPAM ACPI Table




On Aug 19, 2022, at 1:26 AM, Rohit Mathew <rohit.mathew@arm.com<mailto:rohit.mathew@arm.com>> wrote:

Hi Swatisri,

Thanks for the patch. Please find my comments inline marked [Rohit] -


-----Original Message-----
From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Name
via groups.io<http://groups.io/>
Sent: 16 August 2022 21:18
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Sami Mujawar <Sami.Mujawar@arm.com<mailto:Sami.Mujawar@arm.com>>;
Alexei Fedorov <Alexei.Fedorov@arm.com<mailto:Alexei.Fedorov@arm.com>>; michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>;
gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>; zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>
Cc: Swatisri Kantamsetti <swatisrik@nvidia.com<mailto:swatisrik@nvidia.com>>
Subject: [edk2-devel] [PATCH 1/2] Mde Pkg: Support for MPAM ACPI Table

From: Swatisri Kantamsetti <swatisrik@nvidia.com<mailto:swatisrik@nvidia.com>>

Added MPAM table header, MSC and Resource Node info structures

Signed-off-by: Swatisri Kantamsetti <swatisrik@nvidia.com<mailto:swatisrik@nvidia.com>>
---
MdePkg/Include/IndustryStandard/Acpi64.h |  5 ++
MdePkg/Include/IndustryStandard/Mpam.h   | 69
++++++++++++++++++++++++
2 files changed, 74 insertions(+)
create mode 100644 MdePkg/Include/IndustryStandard/Mpam.h

diff --git a/MdePkg/Include/IndustryStandard/Acpi64.h
b/MdePkg/Include/IndustryStandard/Acpi64.h
index fe5ebfac2b..e54f631186 100644
--- a/MdePkg/Include/IndustryStandard/Acpi64.h
+++ b/MdePkg/Include/IndustryStandard/Acpi64.h
@@ -2952,6 +2952,11 @@ typedef struct {
///
#define
EFI_ACPI_6_4_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SI
GNATURE  SIGNATURE_32('P', 'P', 'T', 'T')

+///
+/// "MPAM" Memory System Resource Partitioning And Monitoring Table
///
+#define
+EFI_ACPI_6_4_MEMORY_SYSTEM_RESOURCE_PARTITIONING_MONITORI
NG_TABLE_STRUC
+TURE_SIGNATURE  SIGNATURE_32('M', 'P', 'A', 'M')
+
///
/// "PSDT" Persistent System Description Table  /// diff --git
a/MdePkg/Include/IndustryStandard/Mpam.h
b/MdePkg/Include/IndustryStandard/Mpam.h
new file mode 100644
index 0000000000..e0f75f0114
--- /dev/null
+++ b/MdePkg/Include/IndustryStandard/Mpam.h
@@ -0,0 +1,69 @@
+/** @file
+  ACPI Memory System Resource Partitioning And Monitoring (MPAM)
+  as specified in ARM spec DEN0065
+
+  Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
+  Copyright (c) 2022, ARM Limited. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent **/
+
+#ifndef _MPAM_H_
+#define _MPAM_H_
+
+#pragma pack(1)
+
+///
+/// Memory System Resource Partitioning and Monitoring Table (MPAM)
///
+typedef struct {
+  EFI_ACPI_DESCRIPTION_HEADER    Header;
+  UINT32                         NumNodes;
+  UINT32                         NodeOffset;
+  UINT32                         Reserved;
+}
+EFI_ACPI_6_4_MEMORY_SYSTEM_RESOURCE_PARTITIONING_MONITORI
NG_TABLE_HEADE
+R;

[Rohit] Shouldn't the header be followed by MSC node body type as defined in MPAM ACPI 1.0, section 2, table 3 - The MPAM table and section 2.1, table 4 - MSC Node body?


+
+///
+/// MPAM Revision (as defined in ACPI 6.4 spec.) /// #define
+EFI_ACPI_6_4_MEMORY_SYSTEM_RESOURCE_PARTITIONING_MONITORI
NG_TABLE_REVIS
+ION  0x01
+
+///
+/// Memory System Controller Node Structure ///
+
+typedef struct {
+  UINT16    Length;
+  UINT16    Reserved;
+  UINT32    Identifier;
+  UINT64    BaseAddress;
+  UINT32    MmioSize;
+  UINT32    OverflowInterrupt;
+  UINT32    OverflowInterruptFlags;

[Rohit] Would it be better to have a type (possibly bitfield struct) instead of a plain UINT32 for Flags? (MPAM ACPI 1.0, section 2.1.1, table 5 - Interrupt flags)


Probably better NOT to use bitfields in APIs that are produced and consumed by different worlds. While the the UEFI does speak to the bit order of or a bitfield the rules around packing of bitfields is compiler defined.

I just saw a bug last week with bitfield compatibility that was introduced by clang fixing its -mms-bitfields implementation. The GCC rules for packing bitfields is different than VC++ so that is why the compiler flag -mms-bitfields exists in the 1st place . A clang -mms-bitfields bug  got fixed and it broke the code as the extra padding required by VC++ got added to the bitfield.

[Rohit] Thanks for bringing this point. I think, this type could be left untouched in that case.

Thanks,

Andrew Fish


+  UINT32    Reserved1;
+  UINT32    OverflowInterruptAff;
+  UINT32    ErrorInterrupt;
+  UINT32    ErrorInterruptFlags;

[Rohit ] Same comment as before above.


+  UINT32    Reserved2;
+  UINT32    ErrorInterruptAff;
+  UINT32    MaxNRdyUsec;
+  UINT64    LinkedDeviceHwId;
+  UINT32    LinkedDeviceInstanceHwId;
+  UINT32    NumResourceNodes;
+} EFI_ACPI_6_4_MPAM_MSC_NODE;
+
+///
+/// Resource Node Structure
+///
+
+typedef struct {
+  UINT32    Identifier;
+  UINT8     RisIndex;
+  UINT16    Reserved1;
+  UINT8     LocatorType;
+  UINT64    Locator;

[Rohit ] Shouldn't " Locator " field be 12 bytes in size, possibly a separate type? (MPAM ACPI 1.0, section 2.2, table 7 - Resource node and section 2.3.2 table 10 - locator descriptor)


+  UINT32    NumFuncDep;
+} EFI_ACPI_6_4_MPAM_RESOURCE_NODE;

[Rohit] Since "NumFuncDep" field is part of EFI_ACPI_6_4_MPAM_RESOURCE_NODE type and this could be non-zero, should we also need the type for functional dependency descriptors? (MPAM ACPI 1.0, section 2.2.1, table 8 - Functional dependency descriptor)

[Rohit] Also, could some of the commonly used macros be added to this header, please? (location types, MPAM interrupt mode, interrupt types, affinity type, etc)


+
+#pragma pack()
+
+#endif
--
2.17.1





Regards,
Rohit






[-- Attachment #2: Type: text/html, Size: 16593 bytes --]

  reply	other threads:[~2022-08-23 21:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16 20:18 [PATCH 1/2] Mde Pkg: Support for MPAM ACPI Table Name
2022-08-16 20:18 ` [PATCH 2/2] Dynamic Tbl Mgr: MPAM: MPAM Generator and supporting files Name
2022-08-19  8:26   ` [edk2-devel] " Rohit Mathew
2022-08-24 10:51     ` Rohit Mathew
2022-08-23 17:51   ` Swatisri Kantamsetti
2022-08-19  8:26 ` [edk2-devel] [PATCH 1/2] Mde Pkg: Support for MPAM ACPI Table Rohit Mathew
2022-08-23 20:10   ` Andrew Fish
2022-08-23 21:28     ` Rohit Mathew [this message]
2022-08-23 22:59       ` Andrew Fish
2022-08-24 10:42         ` Rohit Mathew
2022-08-24 14:39     ` hesham.almatary
2022-08-24 16:25       ` Rohit Mathew
2022-08-25  9:36         ` hesham.almatary
2022-08-23 17:52 ` Swatisri Kantamsetti
2022-10-03 11:17 ` Sami Mujawar

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-list 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=AM6PR08MB37834E7331D7A6D40F85AE6A8F709@AM6PR08MB3783.eurprd08.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /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