All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Junjie Cao <junjie.cao@intel.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Junjie Cao <junjie.cao@linux.dev>,
	Anisa Su <anisa.su@samsung.com>,
	linux-cxl@vger.kernel.org
Subject: [PULL 39/78] hw/cxl: clear poison lists and feature transfer state on reset
Date: Wed, 28 Oct 2026 13:15:41 -0400	[thread overview]
Message-ID: <4ec0aba480960b90cd0acf2ff08ebbcb71b1973e.1793207602.git.mst@redhat.com> (raw)
In-Reply-To: <cover.1793207602.git.mst@redhat.com>

From: Junjie Cao <junjie.cao@intel.com>

The poison lists (active, backup, and scan-media results), their
associated overflow tracking, and the Set Feature partial-transfer
state are all device-internal dynamic state that accumulates during
the device's lifetime.

Per CXL r4.0 Table 8-309 (Identify Memory Device), the "Injects
Persistent Poison" capability bit (offset 41h, Bit[0]) controls poison
retention across reset.  When cleared — the QEMU default — "a
Conventional Reset or CXL Reset shall automatically clear the injected
poison."  Clear all poison lists accordingly, reusing the existing
cxl_clear_poison_list_overflowed() helper for the overflow tracking.

For the Set Feature transfer state, CXL r4.0 Section 8.2.10.6.3 (Set
Feature) requires: "If the Feature data transfer is interrupted by a
Conventional Reset or a CXL Reset, the Feature data transfer shall be
aborted by the device [...] the device shall require the Feature data
transfer to be started from the beginning."  Zero set_feat_info on
reset so any partially transferred Set Feature is abandoned and must
restart from the beginning.

Both clears run after the RESET_TYPE_WAKEUP early-return added in the
previous patch, so this state is preserved across a suspend-to-RAM
wakeup.

Signed-off-by: Junjie Cao <junjie.cao@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260729144645.1552511-8-junjie.cao@intel.com>
---
 hw/mem/cxl_type3.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c
index 26c3773dc0..1ff01121f8 100644
--- a/hw/mem/cxl_type3.c
+++ b/hw/mem/cxl_type3.c
@@ -1327,6 +1327,16 @@ MemTxResult cxl_type3_write(PCIDevice *d, hwaddr host_addr, uint64_t data,
     return address_space_write(as, dpa_offset, attrs, &data, size);
 }
 
+static void ct3d_clear_poison_list(CXLPoisonList *list)
+{
+    CXLPoison *ent, *next;
+
+    QLIST_FOREACH_SAFE(ent, list, node, next) {
+        QLIST_REMOVE(ent, node);
+        g_free(ent);
+    }
+}
+
 static void ct3d_reset_hold(Object *obj, ResetType type)
 {
     CXLType3Dev *ct3d = CXL_TYPE3(obj);
@@ -1377,6 +1387,14 @@ static void ct3d_reset_hold(Object *obj, ResetType type)
         ct3d->cxl_dstate.event_logs[i].irq_enabled = false;
     }
     ct3d->scan_media_hasrun = false;
+
+    ct3d_clear_poison_list(&ct3d->poison_list);
+    ct3d_clear_poison_list(&ct3d->poison_list_bkp);
+    ct3d_clear_poison_list(&ct3d->scan_media_results);
+    ct3d->poison_list_cnt = 0;
+    cxl_clear_poison_list_overflowed(ct3d);
+
+    memset(&ct3d->set_feat_info, 0, sizeof(ct3d->set_feat_info));
 }
 
 static const Property ct3_props[] = {
-- 
MST


  parent reply	other threads:[~2026-10-28 17:15 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 17:13 [PULL 00/78] pci, vhost, virtio, iommu, acpi: features, fixes Michael S. Tsirkin
2026-10-28 17:13 ` [PULL 01/78] libvhost-user: protect against OOB memory table access Michael S. Tsirkin
2026-10-28 17:13 ` [PULL 02/78] vhost-user: fix SET_MEM_TABLE number of regions Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 03/78] hw/virtio/vhost-shadow-virtqueue: fix range boundary in SVQ translation Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 04/78] tests/functional: add test_tap_migration Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 05/78] net/tap: tap_post_load(): poll only on success Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 06/78] hw/net: finish backend initialization earler for local migration Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 07/78] net/tap: move vmstate initialization to new_tap() Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 08/78] net/tap: net_init_tap_one(): fix failure path Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 09/78] Revert 9696846600ca ("multiboot: Prevent loading of x86_64 images") Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 10/78] migration/cpr: forbid saving duplicate CprFds into hash table Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 11/78] tests/unit: add test for duplicate keys in CPR FD table Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 12/78] migration: forbid snapshots in CPR migration modes Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 13/78] migration: forbid snapshots under Xen Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 14/78] tests/qtest/migration: add test for snapshot rejection in CPR modes Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 15/78] vhost-vsock: block CPR migration modes Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 16/78] vhost: add vhost_reset_owner op Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 17/78] vhost-vsock: don't reset connections during CPR Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 18/78] vhost-vsock: fix FD leak in realize() Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 19/78] vhost-vsock: preserve vhost FD during CPR Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 20/78] vhost: factor out vhost_dev_init_backend() Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 21/78] vhost: make vhost_dev_cleanup() safe on a partially initialized device Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 22/78] vhost: add vhost_dev_set_owner() / vhost_dev_reset_owner() helpers Michael S. Tsirkin
2026-10-28 17:14 ` [PULL 23/78] vhost: add vhost_dev_is_initialized() helper Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 24/78] vhost: release ownership in vhost_dev_cleanup() Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 25/78] migration: add MIG_EVENT_INCOMING_FAILED Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 26/78] vhost: release ownership when the incoming migration fails Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 27/78] vhost: release ownership on exit Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 28/78] vhost-vsock: hand off device ownership across CPR Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 29/78] tests/qtest/migration: add vhost-vsock tests for cpr-transfer and cpr-exec Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 30/78] tests/functional: add vhost-vsock CPR test with a live guest Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 31/78] tests/functional: cover a cpr-transfer target going away with vhost-vsock Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 32/78] qapi/virtio: Restore backend features in x-query-virtio-status Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 33/78] qapi/monitor: Handle missing vhost-user protocol features Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 34/78] hw/cxl: destroy primary CCI before re-initialization on reset Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 35/78] hw/cxl: convert cxl-type3 to three-phase reset Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 36/78] hw/cxl: add cxl_destroy_mailbox_t3() as the mailbox teardown counterpart Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 37/78] hw/cxl: discard in-flight sanitize state on mailbox teardown Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 38/78] hw/cxl: clear event logs, scan media and interrupt policy on reset Michael S. Tsirkin
2026-10-28 17:15 ` Michael S. Tsirkin [this message]
2026-10-28 17:15 ` [PULL 40/78] pcie_sriov: register user created virtual function before realizing it Michael S. Tsirkin
2026-10-28 17:34   ` Daniel Paziyski
2026-10-30  6:28     ` Michael Tokarev
2026-10-30 13:10       ` Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 41/78] hw/pci-bridge: Add generic PCIe switch upstream and downstream ports Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 42/78] hw/pci-bridge: Make speed and width for PCIe ports non-experimental Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 43/78] hw/pci-bridge: Default the generic PCIe root port as Gen6 capable Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 44/78] hw/pci: Ensure PCIe link speed/width is consistent between both ends Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 45/78] vdpa-dev: implement guest_notifier_mask/pending Michael S. Tsirkin
2026-10-28 17:15 ` [PULL 46/78] vhost-user: remove shared object entries during cleanup Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 47/78] vhost: fix off-by-one in vhost_svq_next_desc with IN_ORDER Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 48/78] pcie_sriov: fix wrong write width and off-by-one in pf_reset Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 49/78] util/event_notifier: more strict API Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 50/78] virtio-qmp: Fix out-of-bounds vqs index in vhost queue status Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 51/78] contrib/vhost-user-bridge: Use stderr for debug output Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 52/78] tests/functional/x86_64/test_vhost_user_bridge: Eliminate stdbuf usage Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 53/78] pcie_aer: fix pci_set_long overflow into PCI_EXP_LNKCAP Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 54/78] MAINTAINERS: Update Junjie Cao's email address Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 55/78] hw/arm: remove pci-bridge/pci_expander_bridge.h from virt.c Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 56/78] hw/pci-bridge: split CXL PXB into separate file Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 57/78] vhost-user: add missing stub for vhost_user_has_protocol_feature() Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 58/78] vhost: move skip-drain feature check to vhost-user Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 59/78] virtio-snd: don't use virtio_snd_pcm_get_stream() in virtio_snd_post_load() Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 60/78] vhost-user: add dedicated mailing list Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 61/78] amd_iommu: Assign ioapic_as only when interrupt remapping is supported Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 62/78] x86-iommu: Introduce x86_iommu_device_get() for x86-iommu retrieval Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 63/78] amd_iommu: Add support for get_x86_iommu callback Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 64/78] intel_iommu: " Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 65/78] i386/kvm: Use x86_iommu_device_get() for per-device IOMMU lookup Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 66/78] amd_iommu: Introduce root bus Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 67/78] acpi-build: Create PCI topology using amd iommu " Michael S. Tsirkin
2026-10-28 17:16 ` [PULL 68/78] amd_iommu: Allow IOMMU to attachment on non-system (pcie.0) bus Michael S. Tsirkin
2026-10-28 17:17 ` [PULL 69/78] intel_iommu_accel: Guard VTDAccelPASIDCacheEntry definition Michael S. Tsirkin
2026-10-28 17:17 ` [PULL 70/78] backends/iommufd: Introduce iommufd_backend_alloc_faultq Michael S. Tsirkin
2026-10-28 17:17 ` [PULL 71/78] backends/iommufd: Extend iommufd_backend_alloc_hwpt() with fault_id Michael S. Tsirkin
2026-10-28 17:17 ` [PULL 72/78] intel_iommu_accel: Add PRQ injection for passthrough device Michael S. Tsirkin
2026-10-28 17:17 ` [PULL 73/78] intel_iommu_accel: Accept PRQ response " Michael S. Tsirkin
2026-10-28 17:17 ` [PULL 74/78] intel_iommu_accel: Teardown FAULTQ resources in bottom half Michael S. Tsirkin
2026-10-28 17:17 ` [PULL 75/78] hw/virtio/virtio-mem: Fix error message on invalid NUMA node Michael S. Tsirkin
2026-10-28 17:17 ` [PULL 76/78] net/tap: add tap_fd_get_mtu() to query host tap MTU Michael S. Tsirkin
2026-10-28 17:17 ` [PULL 77/78] net: add generic get_mtu NetClientInfo callback Michael S. Tsirkin
2026-10-28 17:17 ` [PULL 78/78] virtio-net: add mtu-from-tap property for automatic MTU detection Michael S. Tsirkin
2026-10-29 14:45 ` [PULL 00/78] pci, vhost, virtio, iommu, acpi: features, fixes Richard Henderson
2026-10-29 18:31   ` Michael S. Tsirkin
2026-10-29 22:07     ` Richard Henderson
2026-10-29 22:44       ` Daniel Paziyski

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-all 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=4ec0aba480960b90cd0acf2ff08ebbcb71b1973e.1793207602.git.mst@redhat.com \
    --to=mst@redhat.com \
    --cc=anisa.su@samsung.com \
    --cc=jic23@kernel.org \
    --cc=junjie.cao@intel.com \
    --cc=junjie.cao@linux.dev \
    --cc=linux-cxl@vger.kernel.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.