public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Jonathan Cameron via groups.io" <jonathan.cameron=huawei.com@groups.io>
To: Yuquan Wang <wangyuquan1236@phytium.com.cn>
Cc: <AbdulLateef.Attar@amd.com>, <gaoliming@byosoft.com.cn>,
	<zhiguang.liu@intel.com>, <michael.d.kinney@intel.com>,
	<marcin.juszkiewicz@linaro.org>, <chenbaozi@phytium.com.cn>,
	<devel@edk2.groups.io>, <linux-cxl@vger.kernel.org>
Subject: Re: [edk2-devel] [RFC EDK2 PATCH v4 1/1] MdePkg/IndustryStandard: add definitions for CXL CEDT
Date: Tue, 26 Nov 2024 10:40:46 +0000	[thread overview]
Message-ID: <20241126104046.0000427b@huawei.com> (raw)
In-Reply-To: <20241126030159.72111-2-wangyuquan1236@phytium.com.cn>

On Tue, 26 Nov 2024 11:01:59 +0800
Yuquan Wang <wangyuquan1236@phytium.com.cn> wrote:

> This adds #defines and struct typedefs for the various structure
> types in the CXL Early Discovery Table (CEDT).
> 
> Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
Hi.

One errata applies. See below.

Otherwise,  I've checked these against the r3.2 specification and
they look correct.  Some suggestions on places where comments might
make that easier to establish when it comes to maximum sizing.
Otherwise, with the errata fixed.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


> diff --git a/MdePkg/Include/IndustryStandard/Cxl30.h b/MdePkg/Include/IndustryStandard/Cxl30.h
> index 7a9a6d69405d..63e56aea8254 100644
> --- a/MdePkg/Include/IndustryStandard/Cxl30.h
> +++ b/MdePkg/Include/IndustryStandard/Cxl30.h
> @@ -45,6 +45,13 @@
>  #define CXL_HDM_6_WAY_INTERLEAVING   0x9
>  #define CXL_HDM_12_WAY_INTERLEAVING  0xA
>  
> +///
> +/// "CEDT" CXL Early Discovery Table
> +///
> +#define CEDT_TYPE_CFMWS    0x1
> +#define CEDT_TYPE_CXIMS    0x2
> +#define CEDT_TYPE_RDPAS    0x3
> +
>  //
>  // Ensure proper structure formats
>  //
> @@ -311,6 +318,45 @@ typedef struct {
>    CXL_3_0_CXL_TIMEOUT_AND_ISOLATION_STATUS        TimeoutAndIsolationStatus;
>  } CXL_3_0_CXL_TIMEOUT_AND_ISOLATION_CAPABILITY_STRUCTURE;
>  
> +///
> +/// Definition for CXL Fixed Memory Window Structure (CFMWS)
> +///
> +typedef struct {
> +  CEDT_STRUCTURE                       Header;
> +  UINT32                               Reserved;
> +  UINT64                               BaseHpa;
> +  UINT64                               WindowSize;
> +  UINT8                                InterleaveMembers;
Spec naming now at least is Encode Number of Interleave Ways.
This name looses quite a bit of that.  I'd use a longer name,
perhaps EncodedInterleaveWays


> +  UINT8                                InterleaveArithmetic;
> +  UINT16                               Reserved1;
> +  UINT32                               Granularity;
> +  UINT16                               Restrictions;
> +  UINT16                               QtgId;
> +  UINT32                               TargetList[16];

Perhaps a comment on why 16 given it depends on decoded version
of EncodedInterleaveWays.  16 is the current maximum.

> +} CXL_FIXED_MEMORY_WINDOW_STRUCTURE;
> +
> +///
> +/// Definition for CXL XOR Interleave Math Structure (CXIMS)
> +///
> +typedef struct {
> +  CEDT_STRUCTURE                       Header;
> +  UINT16                               Reserved;
> +  UINT8                                HBIG;
> +  UINT8                                NIB;
> +  UINT64                               XORMAPLIST[4];

Why 4?  Number of entries depends on NIB. Add a comment if this
is the effective maximum to refer to specific part of spec that says that.


> +} CXL_XOR_INTERLEAVE_MATH_STRUCTURE;
> +
> +///
> +/// Definition for RCEC Downstream Port Association Structure (RDPAS)
> +///
> +typedef struct {
> +  CEDT_STRUCTURE                       Header;
> +  UINT16                               SegmentNumber;
> +  UINT16                               Bdf;
> +  UINT8                                ProtocolType;
> +  UINT64                               BaseAddress;

Always check the latest spec, which as of last week is 3.2 or
any errata released in the meantime.

There is an errata on this.  Key is that in the 3.1 and before
the fields don't fit.  Offset of RCEC BDF is 06h, length 2 bytes, yet
protocol type is in 07h so overlaps.

Fix was to move protocol type later.

> +} RCEC_DOWNSTREAM_PORT_ASSOCIATION_STRUCTURE;
> +
>  #pragma pack()
>  
>  #endif



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120845): https://edk2.groups.io/g/devel/message/120845
Mute This Topic: https://groups.io/mt/109784487/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



      reply	other threads:[~2024-11-26 10:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26  3:01 [edk2-devel] [RFC EDK2 PATCH v4 0/1] MdePkg/IndustryStandard: add definitions for CXL CEDT Yuquan Wang
2024-11-26  3:01 ` [edk2-devel] [RFC EDK2 PATCH v4 1/1] " Yuquan Wang
2024-11-26 10:40   ` Jonathan Cameron via groups.io [this message]

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=20241126104046.0000427b@huawei.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