On Mon, 9 Jun 2025 17:33:31 +0100 Jonathan Cameron via <qemu-devel@nongnu.org> wrote:
> The CCI and Fabric Manager APIs are used to configure CXL switches and > devices. DMTF has defined an MCTP binding specification to carry these > messages. The end goal of this work is to hook this up to emulated CXL > switches and devices to allow control of the configuration. > > Since this relies on i2c target mode, this can currently only be used with > an SoC that includes the Aspeed I2C controller. > > Note, only get timestamp added for now. > > Signed-off-by: Jonathan Cameron <jonathan.came...@huawei.com> Not very important given this is an RFC, but a chunk of code in here isn't used so I'll drop it from future version... (I noticed whilst wondering why Anisa didn't update it in they FMAPI DCD series). > --- > include/hw/cxl/cxl_device.h | 8 + > include/hw/pci-bridge/cxl_upstream_port.h | 1 + > hw/cxl/cxl-mailbox-utils.c | 49 ++++ > hw/cxl/i2c_mctp_cxl.c | 289 ++++++++++++++++++++++ > hw/cxl/Kconfig | 4 + > hw/cxl/meson.build | 4 + > 6 files changed, 355 insertions(+) > > diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h > index 6086d4c85b..8d87c7151e 100644 > --- a/include/hw/cxl/cxl_device.h > +++ b/include/hw/cxl/cxl_device.h > @@ -360,6 +360,10 @@ int cxl_process_cci_message(CXLCCI *cci, uint8_t set, > uint8_t cmd, > size_t len_in, uint8_t *pl_in, > size_t *len_out, uint8_t *pl_out, > bool *bg_started); > + > +void cxl_initialize_t3_mctpcci(CXLCCI *cci, DeviceState *d, DeviceState > *intf, > + size_t payload_max); > + > diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c > index 475547f212..4c9852642e 100644 > --- a/hw/cxl/cxl-mailbox-utils.c > +++ b/hw/cxl/cxl-mailbox-utils.c > @@ -3690,6 +3690,29 @@ void cxl_initialize_mailbox_t3(CXLCCI *cci, > DeviceState *d, size_t payload_max) > cxl_init_cci(cci, payload_max); > } > > +static const struct cxl_cmd cxl_cmd_set_t3_mctp[256][256] = { > + [INFOSTAT][IS_IDENTIFY] = { "IDENTIFY", cmd_infostat_identify, 0, 0 }, > + [INFOSTAT][GET_RESPONSE_MSG_LIMIT] = { "GET_RESPONSE_MSG_LIMIT", > + cmd_get_response_msg_limit, 0, 0 > }, > + [INFOSTAT][SET_RESPONSE_MSG_LIMIT] = { "SET_RESPONSE_MSG_LIMIT", > + cmd_set_response_msg_limit, 1, 0 > }, > + [TIMESTAMP][GET] = { "TIMESTAMP_GET", cmd_timestamp_get, 0, 0 }, > + [LOGS][GET_SUPPORTED] = { "LOGS_GET_SUPPORTED", cmd_logs_get_supported, > 0, > + 0 }, > + [LOGS][GET_LOG] = { "LOGS_GET_LOG", cmd_logs_get_log, 0x18, 0 }, > + [TUNNEL][MANAGEMENT_COMMAND] = { "TUNNEL_MANAGEMENT_COMMAND", > + cmd_tunnel_management_cmd, ~0, 0 }, > +}; > + > +void cxl_initialize_t3_mctpcci(CXLCCI *cci, DeviceState *d, DeviceState > *intf, > + size_t payload_max) > +{ > + cxl_copy_cci_commands(cci, cxl_cmd_set_t3_mctp); > + cci->d = d; > + cci->intf = intf; > + cxl_init_cci(cci, payload_max); > +} > + At some point a while back, when adding tunneling we decided to pretend we have an MLD (because it's more general) and as such introduced the fm owned mctpcci. That's the one one that is used for the landing point of mctp links to a type 3 device. So this code is unused.