Skip to contentSkip to conversation

hw/cxl: Support firmware updates

PATCH In review Jonathan Cameron 2 participants 3 messages Jul 5, 2024

lore
Share & tools
lore
#0 lore raw

v4 cover hw/cxl: Support firmware updates

v4: Trivial rebase due to reordering of patch queue for upstreaming.
A couple of white space fixes (checkpatch)

This one was waiting on a v3 revision from Davildlohr (which he posted last week) rather than DCD as such, but the various series before this one cause a lot of churn so it's easier to merge in this order.

Details in patch 1, but in short this fakes firmware updates, allowing testing of the OS support.

Based-on: [PATCH qemu v6 0/4] hw/cxl/cxl-mailbox-utils: Add feature commands, device patrol scrub control and DDR5 ECS control feature
Based-on: [PATCH qemu 0/4] hw/cxl: Add support for scan media.

Based-on: Message-id: [email protected]
Based-on: Message-id: [email protected]

Davidlohr Bueso (1):
hw/cxl: Support firmware updates

 include/hw/cxl/cxl_device.h |  15 +++
 hw/cxl/cxl-mailbox-utils.c  | 205 +++++++++++++++++++++++++++++++++++-
 2 files changed, 215 insertions(+), 5 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v4 1/1 hw/cxl: Support firmware updates

From: Davidlohr Bueso <[email protected]>

Implement transfer and activate functionality per 3.1 spec for supporting update metadata (no actual buffers). Transfer times are arbitrarily set to ten and two seconds for full and part transfers, respectively.

cxl update-firmware mem0 -F fw.img

<on-going fw update>

cxl update-firmware mem0
"memdev":"mem0",
"pmem_size":"1024.00 MiB (1073.74 MB)",
"serial":"0",
"host":"0000:0d:00.0",

  "firmware":{
    "num_slots":2,
    "active_slot":1,
    "online_activate_capable":true,
    "slot_1_version":"BWFW VERSION 0",
    "fw_update_in_progress":true,
    "remaining_size":22400

}
}

<completed fw update>

cxl update-firmware mem0
{
"memdev":"mem0",
"pmem_size":"1024.00 MiB (1073.74 MB)",
"serial":"0",
"host":"0000:0d:00.0",

  "firmware":{
    "num_slots":2,
    "active_slot":1,
    "staged_slot":2,
    "online_activate_capable":true,
    "slot_1_version":"BWFW VERSION 0",
    "slot_2_version":"BWFW VERSION 1",
    "fw_update_in_progress":false

}
}

---
v4: Rebased due to tree reordering.
Fixed a couple of tab / space issues reported by checkpatch.

---
 include/hw/cxl/cxl_device.h |  15 +++
 hw/cxl/cxl-mailbox-utils.c  | 205 +++++++++++++++++++++++++++++++++++-
 2 files changed, 215 insertions(+), 5 deletions(-)
include/hw/cxl/cxl_device.h +15 -0
index 5cae7159e6..fdd0f4e62b 100644
@@ -181,6 +181,21 @@ typedef struct CXLCCI {
         uint64_t runtime;
         QEMUTimer *timer;
     } bg;
+
+    /* firmware update */
+    struct {
+        uint8_t active_slot;
+        uint8_t staged_slot;
+        bool slot[4];
+        uint8_t curr_action;
+        uint8_t curr_slot;
+        /* handle partial transfers */
+        bool transferring;
+        size_t prev_offset;
+        size_t prev_len;
+        time_t last_partxfer;
+    } fw;
+
     size_t payload_max;
     /* Pointer to device hosting the CCI */
     DeviceState *d;
hw/cxl/cxl-mailbox-utils.c +200 -5

252 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

just a small request, pls use same prefix for all patches in the series including the cover letter.