On Tue, 26 Aug 2025 15:46:30 +1000 Wilfred Mallawa <wilfred.opensou...@gmail.com> wrote:
> From: Wilfred Mallawa <wilfred.mall...@wdc.com> > > This patch extends the existing support we have for NVMe with only DoE > to also add support to SPDM over the NVMe Security Send/Recv commands. > > With the new definition of the `spdm-trans` argument, users can specify > `spdm_trans=nvme` or `spdm_trans=doe`. This allows us to select the SPDM > transport respectively. SPDM over the NVMe Security Send/Recv commands > are defined in the DMTF DSP0286. > > Signed-off-by: Wilfred Mallawa <wilfred.mall...@wdc.com> A few comments inline. Jonathan > diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c > index 442144642d..61feb9b35a 100644 > --- a/hw/nvme/ctrl.c > +++ b/hw/nvme/ctrl.c > @@ -8849,6 +8849,23 @@ static DOEProtocol doe_spdm_prot[] = { > { } > }; > > +static inline uint32_t nvme_get_spdm_trans_type(PCIDevice *pci_dev) > +{ > + if (!pci_dev) { > + return false; It's a uin32_t, false doesn't make sense as a return value. > + } > + > + if (!strcmp(pci_dev->spdm_trans, "nvme")) { > + return SPDM_SOCKET_TRANSPORT_TYPE_NVME; > + } > + > + if (!strcmp(pci_dev->spdm_trans, "doe")) { > + return SPDM_SOCKET_TRANSPORT_TYPE_PCI_DOE; > + } > + > + return 0; > +} > + > @@ -9297,6 +9332,7 @@ static const Property nvme_props[] = { > false), > DEFINE_PROP_UINT16("mqes", NvmeCtrl, params.mqes, 0x7ff), > DEFINE_PROP_UINT16("spdm_port", PCIDevice, spdm_port, 0), > + DEFINE_PROP_STRING("spdm_trans", PCIDevice, spdm_trans), There is enum support, (look for qdev_propinfo_get_enum() usage) but seems not that much used and there are examples of strings used for things that are enums underneath. > DEFINE_PROP_BOOL("ctratt.mem", NvmeCtrl, params.ctratt.mem, false),