[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v3 28/41] hw/cxl/cxl-mailbox-utils: Add superset extent release ma
From: |
Michael S. Tsirkin |
Subject: |
[PULL v3 28/41] hw/cxl/cxl-mailbox-utils: Add superset extent release mailbox support |
Date: |
Wed, 5 Jun 2024 19:36:23 -0400 |
From: Fan Ni <fan.ni@samsung.com>
With the change, we extend the extent release mailbox command processing
to allow more flexible release. As long as the DPA range of the extent to
release is covered by accepted extent(s) in the device, the release can be
performed.
Tested-by: Svetly Todorov <svetly.todorov@memverge.com>
Reviewed-by: Gregory Price <gregory.price@memverge.com>
Signed-off-by: Fan Ni <fan.ni@samsung.com>
Message-Id: <20240523174651.1089554-14-nifan.cxl@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/cxl/cxl-mailbox-utils.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
index c4852112fe..74eeb6fde7 100644
--- a/hw/cxl/cxl-mailbox-utils.c
+++ b/hw/cxl/cxl-mailbox-utils.c
@@ -1704,6 +1704,13 @@ static CXLRetCode
cxl_dc_extent_release_dry_run(CXLType3Dev *ct3d,
dpa = in->updated_entries[i].start_dpa;
len = in->updated_entries[i].len;
+ /* Check if the DPA range is not fully backed with valid extents */
+ if (!ct3_test_region_block_backed(ct3d, dpa, len)) {
+ ret = CXL_MBOX_INVALID_PA;
+ goto free_and_exit;
+ }
+
+ /* After this point, extent overflow is the only error can happen */
while (len > 0) {
QTAILQ_FOREACH(ent, updated_list, node) {
range_init_nofail(&range, ent->start_dpa, ent->len);
@@ -1718,14 +1725,7 @@ static CXLRetCode
cxl_dc_extent_release_dry_run(CXLType3Dev *ct3d,
if (range_contains(&range, dpa + len - 1)) {
len2 = ent_start_dpa + ent_len - dpa - len;
} else {
- /*
- * TODO: we reject the attempt to remove an extent
- * that overlaps with multiple extents in the device
- * for now. We will allow it once superset release
- * support is added.
- */
- ret = CXL_MBOX_INVALID_PA;
- goto free_and_exit;
+ dpa = ent_start_dpa + ent_len;
}
len_done = ent_len - len1 - len2;
@@ -1752,14 +1752,9 @@ static CXLRetCode
cxl_dc_extent_release_dry_run(CXLType3Dev *ct3d,
}
len -= len_done;
- /* len == 0 here until superset release is added */
break;
}
}
- if (len) {
- ret = CXL_MBOX_INVALID_PA;
- goto free_and_exit;
- }
}
}
free_and_exit:
--
MST
- [PULL v3 19/41] hw/cxl/cxl-mailbox-utils: Add dynamic capacity region representative and mailbox command support, (continued)
- [PULL v3 19/41] hw/cxl/cxl-mailbox-utils: Add dynamic capacity region representative and mailbox command support, Michael S. Tsirkin, 2024/06/05
- [PULL v3 20/41] include/hw/cxl/cxl_device: Rename mem_size as static_mem_size for type3 memory devices, Michael S. Tsirkin, 2024/06/05
- [PULL v3 21/41] hw/mem/cxl_type3: Add support to create DC regions to type3 memory devices, Michael S. Tsirkin, 2024/06/05
- [PULL v3 22/41] hw/mem/cxl-type3: Refactor ct3_build_cdat_entries_for_mr to take mr size instead of mr as argument, Michael S. Tsirkin, 2024/06/05
- [PULL v3 23/41] hw/mem/cxl_type3: Add host backend and address space handling for DC regions, Michael S. Tsirkin, 2024/06/05
- [PULL v3 24/41] hw/mem/cxl_type3: Add DC extent list representative and get DC extent list mailbox support, Michael S. Tsirkin, 2024/06/05
- [PULL v3 12/41] virtio-pci: only reset pm state during resetting, Michael S. Tsirkin, 2024/06/05
- [PULL v3 25/41] hw/cxl/cxl-mailbox-utils: Add mailbox commands to support add/release dynamic capacity response, Michael S. Tsirkin, 2024/06/05
- [PULL v3 26/41] hw/cxl/events: Add qmp interfaces to add/release dynamic capacity extents, Michael S. Tsirkin, 2024/06/05
- [PULL v3 27/41] hw/mem/cxl_type3: Add DPA range validation for accesses to DC regions, Michael S. Tsirkin, 2024/06/05
- [PULL v3 28/41] hw/cxl/cxl-mailbox-utils: Add superset extent release mailbox support,
Michael S. Tsirkin <=
- [PULL v3 30/41] hw/acpi/GI: Fix trivial parameter alignment issue., Michael S. Tsirkin, 2024/06/05
- [PULL v3 29/41] hw/mem/cxl_type3: Allow to release extent superset in QMP interface, Michael S. Tsirkin, 2024/06/05
- [PULL v3 31/41] hw/acpi: Insert an acpi-generic-node base under acpi-generic-initiator, Michael S. Tsirkin, 2024/06/05
- [PULL v3 32/41] scripts/update-linux-headers: Copy setup_data.h to correct directory, Michael S. Tsirkin, 2024/06/05
- [PULL v3 33/41] linux-headers: update to 6.10-rc1, Michael S. Tsirkin, 2024/06/05
- [PULL v3 34/41] hw/misc/pvpanic: centralize definition of supported events, Michael S. Tsirkin, 2024/06/05
- [PULL v3 35/41] tests/qtest/pvpanic: use centralized definition of supported events, Michael S. Tsirkin, 2024/06/05
- [PULL v3 36/41] hw/misc/pvpanic: add support for normal shutdowns, Michael S. Tsirkin, 2024/06/05
- [PULL v3 37/41] pvpanic: Emit GUEST_PVSHUTDOWN QMP event on pvpanic shutdown signal, Michael S. Tsirkin, 2024/06/05
- [PULL v3 38/41] tests/qtest/pvpanic: add tests for pvshutdown event, Michael S. Tsirkin, 2024/06/05