Skip to contentSkip to conversation

cxl/memdev: Activate firmware without a reset

RFC PATCH In review Unsung Lee 2 participants 7 messages Nov 25 CXL

lore
Share & tools
lore

Unsung Lee

author
#0 lore raw

cover cxl/memdev: Activate firmware without a reset

This series lets userspace activate an uploaded slot online once the device no longer decodes any memory, the same condition sanitize uses. Uploads keep their current behaviour; activation is a separate, explicit step:

1. upload as today (slot N becomes pending for the next cold reset)
2. move the data away, offline the memory, destroy the region
3. echo N > /sys/bus/cxl/devices/memX/firmware_activate
4. recreate the region and online the memory

Patch 1 lets Activate FW complete as a background command; without a poll budget the mailbox reports a timeout at once.
Patch 2 keeps the pending slot and the activation capability from Get FW Info.
Patch 3 adds the attribute.
Patch 4 lets cxl_test advertise online activation.

Questions:
- Patch 3 requires that the device decode no memory, as sanitize does. The driver cannot tell how long a device holds CXL.mem requests while it switches firmware, and the comment on the RAW command block list says activation "requires adjustment / coordination of transaction timeout values at the root bridge level". With no memory decoded nothing can time out. Is that the right condition, or too strict? It means moving the data away first.
- The Online FW Activation Capabilities ECN to CXL 3.1 allows Activate FW to complete as a background command (8.2.9.3.3), so patch 1 waits for it like Transfer FW. Should it carry a Fixes: tag? John Groves raised activations longer than the 2 s mailbox timeout at the June 2025 CXL collab sync; patch 1 may overlap with a patch from that.
- Patch 3 holds cxl_rwsem.region only to check the decoders and set a FW state bit that makes decoder commit refuse the device with EBUSY, as sanitize does. An earlier version held the rwsem across the command (up to 30 s); with an activation emulated in the kernel, create-region and region sysfs reads on other devices then waited for the whole activation. The cost is that a create-region on this device that races the write fails instead of waiting. Is that the preferred trade-off?
- After a timeout the device may still be activating, so patch 3 keeps refusing regions, uploads and sanitize until the slot shows as running or a later activation succeeds. A later error does not count, since it may come while the device is still busy. A device that ends up on its old firmware stays refused until cxl_pci is bound again. Reading the Background Command Status register would end this sooner, but needs a new mailbox callback. Would that be acceptable?
- Should the pending slot stay set after an online activation? QEMU keeps it, cxl_test clears it.

Not addressed in this series:
- State cached at probe (CEL, timestamp, event interrupt policy, features, Identify, CDAT) is not re-read after activation.
- Unbinding the port above the endpoint during the command tears the endpoint down, which clears HDM decoder enable and Mem_Enable on the activating device (exercised in QEMU without kernel warnings).

Testing (QEMU 11.1.3, one type3 device, guest v7.3.1 unless noted; no real hardware, so an activation that really takes long, polling while it runs, other hosts and other CCIs are not covered):
- Functional and race tests (concurrent writes, upload, create-region, cxl_mem and cxl_pci unbind, mailbox readers, kill -9, sanitize, upload cancel) on release and lockdep/KASAN kernels, 20-50x: no warnings; kprobes showed no activation while a decoder was committed and no commit while activating.
- A test-only build emulating slow and timed-out activations, release and debug, 20x each: refusal during and after a timeout; a failed activation after a timeout stays refused, with uploads and sanitize, until cxl_pci is bound again; a cxl_mem unbind waits for the command; a port unbind during the command. Create-region failing after the port is bound again also happens on plain v7.3.1, so that test does not check regions afterwards.
- The whole flow (move the data away, offline, activate, online, move it back): 100x without data; 20x with a process rewriting 2 GB on the device's node (longest write stall 78 ms, in QEMU only); through a maintenance script, deferring when there is no room (10x), rolling back when room runs out (20x), and SIGINT/SIGTERM/SIGKILL at each step (60x); and these mixed for 4 hours (1,462 iterations). No failures, and the data was intact after every iteration.
- cxl/next 32af781935: applies cleanly, no W=1 warnings; QEMU gets no root decoder there (CFMWS with both HDM-H and HDM-DB, rejected since e4c3f0d966), so only the tests without a region ran (all passing).

I designed the change and directed the work. An LLM coding assistant (Claude Code) wrote parts of the code, the changelogs and the test harness at my direction, and was used to review the code and run the tests. I reviewed every line of the series and take responsibility for it.

Unsung Lee (4):
cxl/memdev: Poll for completion of Activate FW
cxl/memdev: Keep pending slot and activation capabilities from Get FW
Info
cxl/memdev: Add firmware_activate to activate firmware without a reset tools/testing/cxl: Add a knob to advertise online FW activation

 Documentation/ABI/testing/sysfs-bus-cxl |  45 +++++
 drivers/cxl/core/hdm.c                  |   7 +
 drivers/cxl/core/mbox.c                 |   5 +
 drivers/cxl/core/memdev.c               | 209 +++++++++++++++++++++++-
 drivers/cxl/cxlmem.h                    |   8 +
 tools/testing/cxl/test/mem.c            |   8 +-
 6 files changed, 274 insertions(+), 8 deletions(-)

base-commit: 32af7819352bae9c690ebe277a44eceb501d5c68

Signature · 1 line
2.34.1
author
#1 lore raw

RFC PATCH 1/4 cxl/memdev: Poll for completion of Activate FW

cxl_mem_activate_fw() sends Activate FW without poll_interval_ms and poll_count. If the device answers "background command started", the mailbox code skips its wait loop and fails at once with -ETIMEDOUT ("timeout waiting for background (0 ms)"), so the firmware upload is reported as a hardware error while the device may still be activating.

Give the command the same 1 s x 30 budget as Transfer FW.

---
 drivers/cxl/core/memdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/cxl/core/memdev.c +8 -0
index 787988e929..67f467c267 100644
@@ -949,10 +949,18 @@ static int cxl_mem_activate_fw(struct cxl_memdev_state *mds, int slot)
 	if (slot == 0 || slot > mds->fw.num_slots)
 		return -EINVAL;
 
+	/*
+	 * Activate FW may complete as a background operation. Without a
+	 * poll budget the mailbox gives up at once and reports a timeout
+	 * even though the device is still activating. Use the same budget
+	 * as Transfer FW.
+	 */
 	mbox_cmd = (struct cxl_mbox_cmd) {
 		.opcode = CXL_MBOX_OP_ACTIVATE_FW,
 		.size_in = sizeof(activate),
 		.payload_in = &activate,
+		.poll_interval_ms = 1000,
+		.poll_count = 30,
 	};
 
 	/* Only offline activation supported for now */
Signature · 1 line
2.34.1
author
#2 lore raw

RFC PATCH 2/4 cxl/memdev: Keep pending slot and activation capabilities from Get FW Info

In reply to Unsung Lee

cxl_mem_get_fw_info() keeps only the number of slots and the active slot. Also keep the slot that will be activated on the next cold reset and the FW Activation Capabilities, for use by online activation in a following patch.

No functional change.

---
 drivers/cxl/core/memdev.c | 3 +++
 drivers/cxl/cxlmem.h      | 4 ++++
 2 files changed, 7 insertions(+)
drivers/cxl/core/memdev.c +3 -0
index 67f467c267..cdbebd1225 100644
@@ -925,6 +925,9 @@ static int cxl_mem_get_fw_info(struct cxl_memdev_state *mds)
 	mds->fw.num_slots = info.num_slots;
 	mds->fw.cur_slot = FIELD_GET(CXL_FW_INFO_SLOT_INFO_CUR_MASK,
 				       info.slot_info);
+	mds->fw.pending_slot = FIELD_GET(CXL_FW_INFO_SLOT_INFO_NEXT_MASK,
+					 info.slot_info);
+	mds->fw.activation_cap = info.activation_cap;
 
 	return 0;
 }
drivers/cxl/cxlmem.h +4 -0
index 4cf8a0f6cf..a67e451a62 100644
@@ -388,6 +388,8 @@ struct cxl_mbox_activate_fw {
  * @num_slots: Number of FW slots available
  * @cur_slot: Slot number currently active
  * @next_slot: Slot number for the new firmware
+ * @pending_slot: Slot to be activated on the next cold reset, 0 if none
+ * @activation_cap: FW Activation Capabilities from Get FW Info
  */
 struct cxl_fw_state {
 	DECLARE_BITMAP(state, CXL_FW_STATE_BITS);
@@ -395,6 +397,8 @@ struct cxl_fw_state {
 	int num_slots;
 	int cur_slot;
 	int next_slot;
+	int pending_slot;
+	u8 activation_cap;
 };
 
 /**
Signature · 1 line
2.34.1
author
#3 lore raw

RFC PATCH 3/4 cxl/memdev: Add firmware_activate to activate firmware without a reset

In reply to Unsung Lee

Linux activates newly uploaded firmware only on the next cold reset, so running it requires a reboot or a power cycle even when the device reports that it supports online activation (FW Activation Capabilities bit 0 in Get FW Info).

Add a write-only memdev attribute, firmware_activate, that activates a given slot online. Uploads are unchanged and still set up the new slot for activation on the next cold reset, so nothing changes unless userspace asks for an online activation.

Online activation is meant to let the device keep serving requests, but the driver cannot tell how long a given device holds CXL.mem requests while it switches firmware, and a stall the platform does not tolerate would take the memory down. Apply the same condition as sanitize: the memdev must be bound and no endpoint decoder may be committed, checked under the device lock, which is held until the command completes, and under cxl_rwsem.region. There a FW state bit is set that makes decoder commit refuse the device until the command has completed, as sanitize_active does for sanitize. cxl_rwsem.region is not held across the command, which may take up to 30 seconds, so regions of other devices are not held up. If the command times out the device may still be activating, so the bit stays set until Get FW Info reports the slot as running or an activation succeeds. An error from a later Activate FW may come while the device is still busy with the earlier one, so it leaves the bit set; a device that ends up keeping its old firmware then refuses regions until cxl_pci is bound again. While the bit stays set after a timeout, also refuse firmware uploads and sanitize, which would otherwise send state changing commands to a device that may still be activating and rely on it to answer Busy.

Userspace is expected to move the data away, take the memory offline and destroy the regions before writing the attribute, and to recreate them afterwards. The policy of when to do this, or to leave the activation to the next reset, stays in userspace.

Check the slot number against Get FW Info before the state checks, so an invalid slot gets EINVAL rather than EBUSY; a device without online activation support reports EOPNOTSUPP first. Also refuse while a sanitize is running, and when another slot is set up for activation on the next cold reset, since that reset would silently replace the firmware activated now. Exclude concurrent uploads with a busy bit in the FW state. After the command, read Get FW Info again and report the slot the device runs, so that a failure shows whether the device kept the old firmware, and warn if the device still reports another slot for the next cold reset.

Only decoders of this host are visible, so devices shared with other hosts are not covered by the check.

---
 Documentation/ABI/testing/sysfs-bus-cxl |  45 ++++++
 drivers/cxl/core/hdm.c                  |   7 +
 drivers/cxl/core/mbox.c                 |   5 +
 drivers/cxl/core/memdev.c               | 198 +++++++++++++++++++++++-
 drivers/cxl/cxlmem.h                    |   4 +
 5 files changed, 252 insertions(+), 7 deletions(-)
Documentation/ABI/testing/sysfs-bus-cxl +45 -0
index cf45b3fde0..d1135b2fb8 100644
@@ -18,6 +18,45 @@ Description:
 		specification.
 
 
+What:		/sys/bus/cxl/devices/memX/firmware_activate
+Date:		November, 2026
+KernelVersion:	v7.6
+Contact:	[email protected]
+Description:
+		(WO) Write a firmware slot number to activate the firmware in
+		that slot now, without a reset ("online" activation in the
+		Activate FW command). Firmware uploaded through
+		/sys/class/firmware/memX/ is set up for activation on the next
+		cold reset; this attribute lets userspace switch to it earlier.
+		Like sanitize, this requires the device to be disabled, that
+		is, not actively decoding any HPA ranges, so the caller has to
+		take its memory offline and destroy its regions first. The
+		write fails with EOPNOTSUPP if the device does not support
+		online activation, EINVAL for an invalid or already active
+		slot, and EBUSY if the device is decoding memory, a firmware
+		upload or a sanitize is in progress, or a different slot is set
+		up for activation on the next cold reset. Only the decoders of
+		this host are checked. If the device fails the command, the
+		write fails with the error of the mailbox command: ENXIO for
+		most device errors, including a device still busy with an
+		earlier activation, or ETIMEDOUT if the command does not
+		complete in time. While the device activates, committing a
+		region on it fails with EBUSY. If the command times out, the
+		device may still be activating. Until a later write finds the
+		slot running or an activation succeeds, committing a region
+		still fails with EBUSY, a firmware upload fails with the error
+		device-busy, and sanitize and secure erase fail with EBUSY. If
+		the device ends up keeping its old firmware, this lasts until
+		cxl_pci is bound again; firmware can be uploaded again after
+		that. If the device still reports another slot set up for
+		activation on the next cold reset after the online activation,
+		a warning is logged. The firmware_version attribute is read
+		once at probe and is not updated by an online activation; the
+		version of each slot is available from the Get FW Info command.
+		If this file is not present, the device does not support
+		firmware update.
+
+
 What:		/sys/bus/cxl/devices/memX/payload_max
 Date:		December, 2020
 KernelVersion:	v5.12
@@ -140,6 +179,9 @@ Description:
 		transitions between software programmed and hardware committed
 		states. If this file is not present, then there is no hardware
 		support for the operation.
+		While an online firmware activation started through
+		firmware_activate may still be running, the write fails with
+		EBUSY.
 
 
 What            /sys/bus/cxl/devices/memX/security/erase
@@ -156,6 +198,9 @@ Description:
 		transitions between software programmed and hardware committed
 		states. If this file is not present, then there is no hardware
 		support for the operation.
+		While an online firmware activation started through
+		firmware_activate may still be running, the write fails with
+		EBUSY.
 
 
 What:		/sys/bus/cxl/devices/memX/firmware/
drivers/cxl/core/hdm.c +7 -0
index ad60be0964..503f8f4a18 100644
@@ -923,6 +923,7 @@ static int cxl_decoder_commit(struct cxl_decoder *cxld)
 	/*
 	 * For endpoint decoders hosted on CXL memory devices that
 	 * support the sanitize operation, make sure sanitize is not in-flight.
+	 * Likewise for an online firmware activation.
 	 */
 	if (is_endpoint_decoder(&cxld->dev)) {
 		struct cxl_endpoint_decoder *cxled =
@@ -937,6 +938,12 @@ static int cxl_decoder_commit(struct cxl_decoder *cxld)
 				dev_name(&cxld->dev));
 			return -EBUSY;
 		}
+		if (mds && test_bit(CXL_FW_ACTIVATING, mds->fw.state)) {
+			dev_dbg(&cxlmd->dev,
+				"attempted to commit %s during firmware activation\n",
+				dev_name(&cxld->dev));
+			return -EBUSY;
+		}
 	}
 
 	scoped_guard(rwsem_read, &cxl_rwsem.dpa)
drivers/cxl/core/mbox.c +5 -0
index f9f1c6ce79..5eef96d39f 100644
@@ -1339,6 +1339,11 @@ int cxl_mem_sanitize(struct cxl_memdev *cxlmd, u16 cmd)
 	guard(device)(&cxlmd->dev);
 	endpoint = cxlmd->endpoint;
 	guard(rwsem_read)(&cxl_rwsem.region);
+
+	/* An online FW activation that timed out may still be running */
+	if (test_bit(CXL_FW_ACTIVATING, mds->fw.state))
+		return -EBUSY;
+
 	/*
 	 * Require an endpoint to be safe otherwise the driver can not
 	 * be sure that the device is unmapped.
drivers/cxl/core/memdev.c +191 -7

266 lines not on this page · raw message

drivers/cxl/cxlmem.h +4 -0
index a67e451a62..7674390a73 100644
@@ -379,6 +379,8 @@ struct cxl_mbox_activate_fw {
 /* FW state bits */
 #define CXL_FW_STATE_BITS		32
 #define CXL_FW_CANCEL			0
+#define CXL_FW_BUSY			1
+#define CXL_FW_ACTIVATING		2
 
 /**
  * struct cxl_fw_state - Firmware upload / activation state
@@ -390,6 +392,7 @@ struct cxl_mbox_activate_fw {
  * @next_slot: Slot number for the new firmware
  * @pending_slot: Slot to be activated on the next cold reset, 0 if none
  * @activation_cap: FW Activation Capabilities from Get FW Info
+ * @activating_slot: Slot of an online activation that timed out, 0 if none
  */
 struct cxl_fw_state {
 	DECLARE_BITMAP(state, CXL_FW_STATE_BITS);
@@ -399,6 +402,7 @@ struct cxl_fw_state {
 	int next_slot;
 	int pending_slot;
 	u8 activation_cap;
+	int activating_slot;
 };
 
 /**
Signature · 1 line
2.34.1
#4 lore raw

Re: [RFC PATCH 3/4] cxl/memdev: Add firmware_activate to activate firmware without a reset

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] cxl/memdev: stale CXL_FW_ACTIVATING bit in cxl_mem_activate_fw_online() - [Medium] cxl/memdev…

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Medium] cxl/memdev: stale CXL_FW_ACTIVATING bit in cxl_mem_activate_fw_online()
- [Medium] cxl/memdev: activating_slot overwrite in cxl_mem_activate_fw_online()
--

commit 19d55015d9b6225e3059d6173d8fb4365535c893
Author: Unsung Lee <[email protected]>

cxl/memdev: Add firmware_activate to activate firmware without a reset

This commit adds a write-only firmware_activate sysfs attribute to activate a firmware slot online when the device is not decoding memory, while blocking decoder commits, firmware uploads, and sanitization until activation completes.

Quoted 4 lines
drivers/cxl/core/memdev.c +0 -0
index cdbebd12258b9..cc9ff0dd9cd8a 100644

[ ... ]

Quoted 34 lines
drivers/cxl/core/memdev.c +23 -2
@@ -966,13 +1010,136 @@ static int cxl_mem_activate_fw(struct cxl_memdev_state *mds, int slot)
 		.poll_count = 30,
 	};
 
-	/* Only offline activation supported for now */
-	activate.action = CXL_FW_ACTIVATE_OFFLINE;
+	activate.action = action;
 	activate.slot = slot;
 
 	return cxl_internal_send_cmd(cxl_mbox, &mbox_cmd);
 }
 
+/*
+ * cxl_mem_activate_fw_online - Activate a FW slot without a reset
+ *
+ * How long a device holds CXL.mem requests while it switches to the new
+ * firmware is not known here, and a stall the platform does not tolerate
+ * would take the memory down. Like sanitize, only proceed when the device
+ * is not decoding any HPA range, i.e. no endpoint decoder is committed,
+ * and set CXL_FW_ACTIVATING under cxl_rwsem.region so that none can be
+ * committed until the command has completed. After a timeout the device
+ * may still be activating: keep CXL_FW_ACTIVATING until Get FW Info
+ * reports the slot as running or an activation succeeds. A device that
+ * keeps its old firmware then refuses regions until cxl_pci is bound
+ * again.
+ *
+ * Decoders of other hosts sharing the device are not visible here.
+ */
+static int cxl_mem_activate_fw_online(struct cxl_memdev_state *mds,
+				      unsigned int slot)
+{
+	struct cxl_mailbox *cxl_mbox = &mds->cxlds.cxl_mbox;
+	struct cxl_memdev *cxlmd = mds->cxlds.cxlmd;
+	int rc, info_rc;

drivers/cxl/core/memdev.c static int cxl_mem_activate_fw(struct cxl_memdev_state *mds, int slot) · line 1050

Quoted 10 lines
drivers/cxl/core/memdev.c +10 -0
+
+	rc = cxl_mem_get_fw_info(mds);
+	if (rc)
+		return rc;
+
+	/* An activation that timed out has completed (cur_slot is never 0) */
+	if (mds->fw.activating_slot == mds->fw.cur_slot) {
+		mds->fw.activating_slot = 0;
+		clear_bit(CXL_FW_ACTIVATING, mds->fw.state);
+	}

[Severity: Medium]
What happens if an online activation of one slot times out (leaving mds->fw.activating_slot set) and a subsequent write to firmware_activate requests a different slot before the first activation finishes?

cxl_mem_activate_fw_online() proceeds to issue an online Activate FW command for the new slot while the earlier activation may still be running. If the second command also times out, mds->fw.activating_slot = slot overwrites the original slot number; once the device finishes switching to the first slot, mds->fw.cur_slot will not match the overwritten mds->fw.activating_slot, leaving CXL_FW_ACTIVATING set and blocking region commits, firmware uploads, and sanitization.

Quoted 54 lines
drivers/cxl/core/memdev.c +54 -0
+
+	if (!(mds->fw.activation_cap &
+	      CXL_FW_INFO_ACTIVATION_CAP_HAS_LIVE_ACTIVATE))
+		return -EOPNOTSUPP;
+
+	if (!slot || slot > mds->fw.num_slots || slot == mds->fw.cur_slot)
+		return -EINVAL;
+
+	/*
+	 * A different slot set up for activation on the next cold reset
+	 * would silently replace this firmware at that reset.
+	 */
+	if (mds->fw.pending_slot && mds->fw.pending_slot != slot &&
+	    mds->fw.pending_slot != mds->fw.cur_slot) {
+		dev_err(&cxlmd->dev,
+			"slot %d is pending activation on reset, not activating slot %u\n",
+			mds->fw.pending_slot, slot);
+		return -EBUSY;
+	}
+
+	/*
+	 * synchronize with cxl_mem_probe(), sanitize and decoder write
+	 * operations
+	 */
+	guard(device)(&cxlmd->dev);
+
+	/* A running sanitize owns the device until it completes */
+	scoped_guard(mutex, &cxl_mbox->mbox_mutex) {
+		if (mds->security.sanitize_active)
+			return -EBUSY;
+	}
+
+	scoped_guard(rwsem_read, &cxl_rwsem.region) {
+		/* Without a bound endpoint the device may still be mapped */
+		if (!cxlmd->dev.driver ||
+		    cxl_num_decoders_committed(cxlmd->endpoint)) {
+			dev_err(&cxlmd->dev,
+				"device is decoding memory, not activating firmware online\n");
+			return -EBUSY;
+		}
+		set_bit(CXL_FW_ACTIVATING, mds->fw.state);
+	}
+
+	rc = cxl_mem_activate_fw(mds, slot, CXL_FW_ACTIVATE_ONLINE);
+	if (rc == -ETIMEDOUT) {
+		mds->fw.activating_slot = slot;
+		dev_warn(&cxlmd->dev,
+			 "slot %u may still be activating, refusing regions on this device\n",
+			 slot);
+	} else if (!rc || !mds->fw.activating_slot) {
+		/*
+		 * After a timeout only a success shows that the device is
+		 * done. Any error may come while it is still busy with the
+		 * activation that timed out, so the mark stays.

drivers/cxl/core/memdev.c static int cxl_mem_activate_fw(struct cxl_memdev_state *mds, int slot) · line 1114

Quoted 10 lines
drivers/cxl/core/memdev.c +10 -0
+		 */
+		mds->fw.activating_slot = 0;
+		clear_bit(CXL_FW_ACTIVATING, mds->fw.state);
+	}
+
+	/* Report the slot the device runs now, also after a failure */
+	info_rc = cxl_mem_get_fw_info(mds);
+	if (info_rc)
+		dev_warn(&cxlmd->dev, "cannot read FW slot state: %d\n",
+			 info_rc);

[Severity: Medium]
Should the post-command cxl_mem_get_fw_info() call also clear mds->fw.activating_slot and CXL_FW_ACTIVATING when mds->fw.activating_slot == mds->fw.cur_slot?

If cxl_mem_activate_fw() times out (or fails while a previous timed-out activation was finishing) and the activation completes right before this second cxl_mem_get_fw_info() call, mds->fw.cur_slot is updated to the new slot, but CXL_FW_ACTIVATING remains set and locks out region commits, firmware uploads, and sanitization until another write to firmware_activate. Re-attempting firmware_activate on that same slot will also see slot == mds->fw.cur_slot and fail with -EINVAL after clearing the bit.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
author
#5 lore raw

RFC PATCH 4/4 tools/testing/cxl: Add a knob to advertise online FW activation

In reply to Unsung Lee

cxl_test memdevs report no online activation support, so the new firmware_activate attribute can only be tested for the EOPNOTSUPP case. Add a fw_online_activation module parameter that sets bit 0 of FW Activation Capabilities in Get FW Info. The default keeps the current behaviour.

---
 tools/testing/cxl/test/mem.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
tools/testing/cxl/test/mem.c +7 -1
index c740372bda..7fefc91921 100644
@@ -23,6 +23,11 @@
 #define MOCK_INJECT_DEV_MAX 8
 #define MOCK_INJECT_TEST_MAX 128
 
+static bool fw_online_activation;
+module_param(fw_online_activation, bool, 0444);
+MODULE_PARM_DESC(fw_online_activation,
+		 "Advertise online FW activation in Get FW Info");
+
 static unsigned int poison_inject_dev_max = MOCK_INJECT_DEV_MAX;
 
 enum cxl_command_effects {
@@ -1327,7 +1332,8 @@ static int mock_fw_info(struct cxl_mockmem_data *mdata,
 		.num_slots = FW_SLOTS,
 		.slot_info = (mdata->fw_slot & 0x7) |
 			     ((mdata->fw_staged & 0x7) << 3),
-		.activation_cap = 0,
+		.activation_cap = fw_online_activation ?
+			CXL_FW_INFO_ACTIVATION_CAP_HAS_LIVE_ACTIVATE : 0,
 	};
 
 	strcpy(fw_info.slot_1_revision, "cxl_test_fw_001");
Signature · 1 line
2.34.1
author
#6 lore raw
In reply to Unsung Lee

Sorry for the noise. A mistake in my test sends put six copies of this cover letter on the list on their own (12:10 to 12:42 UTC), without the patches, and some with older text. Please ignore those; this thread, with patches 1-4, is the series.

Unsung