mirror of
https://github.com/qemu/qemu.git
synced 2026-04-05 22:00:58 +00:00
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: 77a8e9fe0e ("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>
This commit is contained in:
committed by
Philippe Mathieu-Daudé
parent
bc72b2996c
commit
20beec283b
@@ -2675,7 +2675,7 @@ static CXLRetCode media_operations_discovery(uint8_t *payload_in,
|
|||||||
} QEMU_PACKED *media_op_in_disc_pl = (void *)payload_in;
|
} QEMU_PACKED *media_op_in_disc_pl = (void *)payload_in;
|
||||||
struct media_op_discovery_out_pl *media_out_pl =
|
struct media_op_discovery_out_pl *media_out_pl =
|
||||||
(struct media_op_discovery_out_pl *)payload_out;
|
(struct media_op_discovery_out_pl *)payload_out;
|
||||||
int total = ARRAY_SIZE(media_op_matrix);
|
int total = ARRAY_SIZE(media_op_matrix) - 1; /* exclude Discovery */
|
||||||
int num_ops, start_index, i;
|
int num_ops, start_index, i;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
@@ -2701,10 +2701,12 @@ static CXLRetCode media_operations_discovery(uint8_t *payload_in,
|
|||||||
|
|
||||||
num_ops = MIN(num_ops, total - start_index);
|
num_ops = MIN(num_ops, total - start_index);
|
||||||
for (i = 0; i < num_ops; i++) {
|
for (i = 0; i < num_ops; i++) {
|
||||||
|
int idx = start_index + i + 1; /* skip Discovery (first entry) */
|
||||||
|
|
||||||
media_out_pl->entry[count].media_op_class =
|
media_out_pl->entry[count].media_op_class =
|
||||||
media_op_matrix[start_index + i].media_op_class;
|
media_op_matrix[idx].media_op_class;
|
||||||
media_out_pl->entry[count].media_op_subclass =
|
media_out_pl->entry[count].media_op_subclass =
|
||||||
media_op_matrix[start_index + i].media_op_subclass;
|
media_op_matrix[idx].media_op_subclass;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user