Skip to contentSkip to conversation

hw/nvme: Add CLI options for PCI vendor/device IDs and IEEE-OUI ID

PATCH Superseded Saif Abrar 2 participants 2 messages May 9, 2024 – May 13, 2024

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Saif Abrar

author
#0 lore raw

PATCH 1/1 hw/nvme: Add CLI options for PCI vendor/device IDs and IEEE-OUI ID

Add CLI options for user specified
- PCI vendor, device, subsystem vendor and subsystem IDs
- IEEE-OUI ID

e.g. PCI IDs to be specified as follows:
-device nvme,id_vendor=0xABCD,id_device=0xA0B0,id_subsys_vendor=0xEF00,id_subsys=0xEF01

IEEE-OUI ID (Identify Controller bytes 75:73) is to be specified in LE format.
(e.g. ieee_oui=0xABCDEF => Byte[73]=0xEF, Byte[74]=0xCD, Byte[75]=0xAB).

---
 hw/nvme/nvme.h |  5 +++++
 hw/nvme/ctrl.c | 44 ++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 45 insertions(+), 4 deletions(-)
hw/nvme/nvme.h +5 -0
index bed8191bd5..6e19a479d1 100644
@@ -537,6 +537,11 @@ typedef struct NvmeParams {
     uint8_t  sriov_max_vq_per_vf;
     uint8_t  sriov_max_vi_per_vf;
     bool     msix_exclusive_bar;
+    uint16_t id_vendor;
+    uint16_t id_device;
+    uint16_t id_subsys_vendor;
+    uint16_t id_subsys;
+    uint32_t ieee_oui;
 } NvmeParams;
 
 typedef struct NvmeCtrl {
hw/nvme/ctrl.c +40 -4

74 lines not on this page · raw message

Signature · 1 line
2.39.3
#1 lore raw
Quoted 12 lines · Saif Abrar

Add CLI options for user specified
- PCI vendor, device, subsystem vendor and subsystem IDs
- IEEE-OUI ID

e.g. PCI IDs to be specified as follows:
-device nvme,id_vendor=0xABCD,id_device=0xA0B0,id_subsys_vendor=0xEF00,id_subsys=0xEF01

IEEE-OUI ID (Identify Controller bytes 75:73) is to be specified in LE format.
(e.g. ieee_oui=0xABCDEF => Byte[73]=0xEF, Byte[74]=0xCD, Byte[75]=0xAB).

[...]

Quoted 4 lines
hw/nvme/ctrl.c +0 -0
index 127c3d2383..35aeb48e0b 100644

[...]

hw/nvme/ctrl.c static Property nvme_props[] = { · line 8491

Quoted 13 lines
hw/nvme/ctrl.c +7 -0
@@ -8451,6 +8480,13 @@ static Property nvme_props[] = {
                       params.sriov_max_vq_per_vf, 0),
     DEFINE_PROP_BOOL("msix-exclusive-bar", NvmeCtrl, params.msix_exclusive_bar,
                      false),
+    DEFINE_PROP_UINT16("id_vendor", NvmeCtrl, params.id_vendor, 0),
+    DEFINE_PROP_UINT16("id_device", NvmeCtrl, params.id_device, 0),
+    DEFINE_PROP_UINT16("id_subsys_vendor", NvmeCtrl,
+                                                    params.id_subsys_vendor, 0),
+    DEFINE_PROP_UINT16("id_subsys", NvmeCtrl, params.id_subsys, 0),
+    DEFINE_PROP("ieee_oui", NvmeCtrl, params.ieee_oui, nvme_prop_ieee,
+                                                                      uint32_t),
     DEFINE_PROP_END_OF_LIST(),
 };

You add properties, not CLI options. Properties are accessible via CLI -device, but also via monitor device_add, qom-set, qom-get.

Please rephrase your commit message like "Add properties for".