hw/cxl: Exclude Discovery from Media Operation Discovery output
Per CXL 4.0 Table 8-331, the Discovery operation "returns a list of all Media Operations that the device supports, with the exception of the Discovery operation (Class=0, Subclass=0)." Filter out Discovery entries when building the output list and adjust total_supported_operations accordingly. Fixes: 77a8e9fe0ecb ("hw/cxl/cxl-mailbox-utils: Add support for Media operations discovery commands cxl r3.2 (8.2.10.9.5.3)") Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net> Message-ID: <20260319184256.3762391-3-dave@stgolabs.net> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Davidlohr Bueso committed
Mar 19, 2026 at 11:42 UTC
20beec283b958e43cbe375ecbfb719e7af55e307
1 file changed
+5
-3
hw/cxl/cxl-mailbox-utils.c
+5
-3
@@ -2675,7 +2675,7 @@ static CXLRetCode media_operations_discovery(uint8_t *payload_in,
2675
} QEMU_PACKED *media_op_in_disc_pl = (void *)payload_in;
2676
struct media_op_discovery_out_pl *media_out_pl =
2677
(struct media_op_discovery_out_pl *)payload_out;
2678
- int total = ARRAY_SIZE(media_op_matrix);
2678
+ int total = ARRAY_SIZE(media_op_matrix) - 1; /* exclude Discovery */
2679
int num_ops, start_index, i;
2680
int count = 0;
2681
@@ -2701,10 +2701,12 @@ static CXLRetCode media_operations_discovery(uint8_t *payload_in,
2701
2702
num_ops = MIN(num_ops, total - start_index);
2703
for (i = 0; i < num_ops; i++) {
2704
+ int idx = start_index + i + 1; /* skip Discovery (first entry) */
2705
+
2706
media_out_pl->entry[count].media_op_class =
2705
- media_op_matrix[start_index + i].media_op_class;
2707
+ media_op_matrix[idx].media_op_class;
2708
media_out_pl->entry[count].media_op_subclass =
2707
- media_op_matrix[start_index + i].media_op_subclass;
2709
+ media_op_matrix[idx].media_op_subclass;
2710
count++;
2711
}
2712