[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/63] hw/cxl/events: discard all event records during sanitation
From: |
Michael S. Tsirkin |
Subject: |
[PULL 08/63] hw/cxl/events: discard all event records during sanitation |
Date: |
Sun, 21 Jul 2024 20:17:05 -0400 |
From: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Per CXL r3.1 Section 8.2.9.9.5.1: Sanitize (Opcode 4400h), the
sanitize command should delete all event logs. Introduce
cxl_discard_all_event_logs() and call
this in __do_sanitization().
Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/20231222090051.3265307-5-42.hyeyoo@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20240705120643.959422-4-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/cxl/cxl_device.h | 1 +
hw/cxl/cxl-events.c | 13 +++++++++++++
hw/cxl/cxl-mailbox-utils.c | 1 +
3 files changed, 15 insertions(+)
diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h
index 42a622197e..0509d961c3 100644
--- a/include/hw/cxl/cxl_device.h
+++ b/include/hw/cxl/cxl_device.h
@@ -562,6 +562,7 @@ CXLRetCode cxl_event_get_records(CXLDeviceState *cxlds,
CXLGetEventPayload *pl,
size_t *len);
CXLRetCode cxl_event_clear_records(CXLDeviceState *cxlds,
CXLClearEventPayload *pl);
+void cxl_discard_all_event_records(CXLDeviceState *cxlds);
void cxl_event_irq_assert(CXLType3Dev *ct3d);
diff --git a/hw/cxl/cxl-events.c b/hw/cxl/cxl-events.c
index d397718b1b..12dee2e467 100644
--- a/hw/cxl/cxl-events.c
+++ b/hw/cxl/cxl-events.c
@@ -139,6 +139,19 @@ bool cxl_event_insert(CXLDeviceState *cxlds,
CXLEventLogType log_type,
return cxl_event_count(log) == 1;
}
+void cxl_discard_all_event_records(CXLDeviceState *cxlds)
+{
+ CXLEventLogType log_type;
+ CXLEventLog *log;
+
+ for (log_type = 0; log_type < CXL_EVENT_TYPE_MAX; log_type++) {
+ log = &cxlds->event_logs[log_type];
+ while (!cxl_event_empty(log)) {
+ cxl_event_delete_head(cxlds, log_type, log);
+ }
+ }
+}
+
CXLRetCode cxl_event_get_records(CXLDeviceState *cxlds, CXLGetEventPayload *pl,
uint8_t log_type, int max_recs,
size_t *len)
diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
index 522d9aa589..3c9600c39c 100644
--- a/hw/cxl/cxl-mailbox-utils.c
+++ b/hw/cxl/cxl-mailbox-utils.c
@@ -949,6 +949,7 @@ static void __do_sanitization(CXLType3Dev *ct3d)
memset(lsa, 0, memory_region_size(mr));
}
}
+ cxl_discard_all_event_records(&ct3d->cxl_dstate);
}
/*
--
MST
- [PULL 00/63] virtio,pci,pc: features,fixes, Michael S. Tsirkin, 2024/07/21
- [PULL 01/63] hw/virtio/virtio-crypto: Fix op_code assignment in virtio_crypto_create_asym_session, Michael S. Tsirkin, 2024/07/21
- [PULL 02/63] MAINTAINERS: add Stefano Garzarella as vhost/vhost-user reviewer, Michael S. Tsirkin, 2024/07/21
- [PULL 04/63] hw/cxl: Check for multiple mappings of memory backends., Michael S. Tsirkin, 2024/07/21
- [PULL 05/63] hw/cxl/cxl-host: Fix segmentation fault when getting cxl-fmw property, Michael S. Tsirkin, 2024/07/21
- [PULL 03/63] hw/cxl/cxl-mailbox-utils: remove unneeded mailbox output payload space zeroing, Michael S. Tsirkin, 2024/07/21
- [PULL 07/63] hw/cxl/mbox: replace sanitize_running() with cxl_dev_media_disabled(), Michael S. Tsirkin, 2024/07/21
- [PULL 06/63] hw/cxl: Add get scan media capabilities cmd support, Michael S. Tsirkin, 2024/07/21
- [PULL 08/63] hw/cxl/events: discard all event records during sanitation,
Michael S. Tsirkin <=
- [PULL 09/63] hw/cxl: Add get scan media results cmd support, Michael S. Tsirkin, 2024/07/21
- [PULL 10/63] cxl/mailbox: move mailbox effect definitions to a header, Michael S. Tsirkin, 2024/07/21
- [PULL 11/63] hw/cxl/cxl-mailbox-utils: Add support for feature commands (8.2.9.6), Michael S. Tsirkin, 2024/07/21
- [PULL 12/63] hw/cxl/cxl-mailbox-utils: Add device patrol scrub control feature, Michael S. Tsirkin, 2024/07/21
- [PULL 13/63] hw/cxl/cxl-mailbox-utils: Add device DDR5 ECS control feature, Michael S. Tsirkin, 2024/07/21
- [PULL 14/63] hw/cxl: Support firmware updates, Michael S. Tsirkin, 2024/07/21
- [PULL 15/63] MAINTAINERS: Add myself as a VT-d reviewer, Michael S. Tsirkin, 2024/07/21
- [PULL 16/63] virtio-snd: add max size bounds check in input cb, Michael S. Tsirkin, 2024/07/21
- [PULL 17/63] virtio-snd: check for invalid param shift operands, Michael S. Tsirkin, 2024/07/21
- [PULL 18/63] intel_iommu: fix FRCD construction macro, Michael S. Tsirkin, 2024/07/21