[PATCH 1/2] hw/mem/cxl_type3: Fix More flag setting for dynamic capacity event records

nifan.cxl@gmail.com posted 2 patches 2 months, 4 weeks ago
[PATCH 1/2] hw/mem/cxl_type3: Fix More flag setting for dynamic capacity event records
Posted by nifan.cxl@gmail.com 2 months, 4 weeks ago
From: Fan Ni <fan.ni@samsung.com>

Per cxl spec r3.1, for multiple dynamic capacity event records grouped via
the More flag, the last record in the sequence should clear the More flag.

Before the change, the More flag of the event record is cleared before
the loop of inserting records into the event log, which will leave the flag
always set once it is set in the loop.

Signed-off-by: Fan Ni <fan.ni@samsung.com>
---
 hw/mem/cxl_type3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c
index d648192ab9..e616801c81 100644
--- a/hw/mem/cxl_type3.c
+++ b/hw/mem/cxl_type3.c
@@ -2060,11 +2060,11 @@ static void qmp_cxl_process_dynamic_capacity_prescriptive(const char *path,
     stw_le_p(&dCap.host_id, hid);
     /* only valid for DC_REGION_CONFIG_UPDATED event */
     dCap.updated_region_id = 0;
-    dCap.flags = 0;
     for (i = 0; i < num_extents; i++) {
         memcpy(&dCap.dynamic_capacity_extent, &extents[i],
                sizeof(CXLDCExtentRaw));
 
+        dCap.flags = 0;
         if (i < num_extents - 1) {
             /* Set "More" flag */
             dCap.flags |= BIT(0);
-- 
2.43.0
Re: [PATCH 1/2] hw/mem/cxl_type3: Fix More flag setting for dynamic capacity event records
Posted by Jonathan Cameron via 2 months, 3 weeks ago
On Tue, 27 Aug 2024 09:40:04 -0700
nifan.cxl@gmail.com wrote:

> From: Fan Ni <fan.ni@samsung.com>
> 
> Per cxl spec r3.1, for multiple dynamic capacity event records grouped via
> the More flag, the last record in the sequence should clear the More flag.
> 
> Before the change, the More flag of the event record is cleared before
> the loop of inserting records into the event log, which will leave the flag
> always set once it is set in the loop.
> 
> Signed-off-by: Fan Ni <fan.ni@samsung.com>
Oops.  I'll queue this up, though not sure I'll get a fixes series
out this week so it might only hit after the QEMU release.

Jonathan

> ---
>  hw/mem/cxl_type3.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c
> index d648192ab9..e616801c81 100644
> --- a/hw/mem/cxl_type3.c
> +++ b/hw/mem/cxl_type3.c
> @@ -2060,11 +2060,11 @@ static void qmp_cxl_process_dynamic_capacity_prescriptive(const char *path,
>      stw_le_p(&dCap.host_id, hid);
>      /* only valid for DC_REGION_CONFIG_UPDATED event */
>      dCap.updated_region_id = 0;
> -    dCap.flags = 0;
>      for (i = 0; i < num_extents; i++) {
>          memcpy(&dCap.dynamic_capacity_extent, &extents[i],
>                 sizeof(CXLDCExtentRaw));
>  
> +        dCap.flags = 0;
>          if (i < num_extents - 1) {
>              /* Set "More" flag */
>              dCap.flags |= BIT(0);