Skip to contentSkip to conversation

hw/cxl: Misc fixes

PATCH New Jonathan Cameron 1 participant 3 messages Nov 1, 2024

lore
Share & tools
lore
#0 lore raw

cover hw/cxl: Misc fixes

Two fixes that Fan posted a while back found testing the improving Linux kernel support.
(qemu prefix is just to avoid confusion in the linux-cxl patchwork instance)

Based-on: [PATCH 0/7] hw/cxl: Round up of fixes.
Based-on: Message-id: [email protected]

Fan Ni (2):
cxl/cxl-mailbox-utils: Fix size check for cmd_firmware_update_get_info hw/cxl/cxl-mailbox-util: Fix output buffer index update when
retrieving DC extents

 hw/cxl/cxl-mailbox-utils.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 cxl/cxl-mailbox-utils: Fix size check for cmd_firmware_update_get_info

From: Fan Ni <[email protected]>

In the function cmd_firmware_update_get_info for handling Get FW info command (0x0200h), the vmem, pmem and DC capacity size check were incorrect. The size should be aligned to 256MiB, not smaller than 256MiB.

---
 hw/cxl/cxl-mailbox-utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/cxl/cxl-mailbox-utils.c +3 -3
index 5f63099724..8bb0d2dd29 100644
@@ -649,9 +649,9 @@ static CXLRetCode cmd_firmware_update_get_info(const struct cxl_cmd *cmd,
     } QEMU_PACKED *fw_info;
     QEMU_BUILD_BUG_ON(sizeof(*fw_info) != 0x50);
 
-    if ((cxl_dstate->vmem_size < CXL_CAPACITY_MULTIPLIER) ||
-        (cxl_dstate->pmem_size < CXL_CAPACITY_MULTIPLIER) ||
-        (ct3d->dc.total_capacity < CXL_CAPACITY_MULTIPLIER)) {
+    if (!QEMU_IS_ALIGNED(cxl_dstate->vmem_size, CXL_CAPACITY_MULTIPLIER) ||
+        !QEMU_IS_ALIGNED(cxl_dstate->pmem_size, CXL_CAPACITY_MULTIPLIER) ||
+        !QEMU_IS_ALIGNED(ct3d->dc.total_capacity, CXL_CAPACITY_MULTIPLIER)) {
         return CXL_MBOX_INTERNAL_ERROR;
     }
 
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/2 hw/cxl/cxl-mailbox-util: Fix output buffer index update when retrieving DC extents

In reply to Jonathan Cameron

From: Fan Ni <[email protected]>

In the function of retrieving DC extents (cmd_dcd_get_dyn_cap_ext_list), the output buffer index was not correctly updated while iterating the extent list on the device, leaving the extents returned incorrect except for the first one.

Fixes 1c9221f19e62 ("hw/mem/cxl_type3: Add DC extent list representative and get DC extent list mailbox support")
---
 hw/cxl/cxl-mailbox-utils.c | 1 +
 1 file changed, 1 insertion(+)
hw/cxl/cxl-mailbox-utils.c +1 -0
index 8bb0d2dd29..97cb8bbcec 100644
@@ -2227,6 +2227,7 @@ static CXLRetCode cmd_dcd_get_dyn_cap_ext_list(const struct cxl_cmd *cmd,
             stw_le_p(&out_rec->shared_seq, ent->shared_seq);
 
             record_done++;
+            out_rec++;
             if (record_done == record_count) {
                 break;
             }
Signature · 1 line
2.43.0