diff --git a/hw/esp.c b/hw/esp.c
index a821a0a..0f16dcf 100644
--- a/hw/esp.c
+++ b/hw/esp.c
@@ -751,7 +751,7 @@ static int esp_init1(SysBusDevice *dev)
 
     qdev_init_gpio_in(&dev->qdev, esp_gpio_demux, 2);
 
-    scsi_bus_new(&s->bus, &dev->qdev, 0, ESP_MAX_DEVS, &esp_scsi_ops);
+    scsi_bus_new(&s->bus, &dev->qdev, 0, ESP_MAX_DEVS, SCSI_PATH, &esp_scsi_ops);
     return scsi_bus_legacy_handle_cmdline(&s->bus);
 }
 
diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index a908324..2e5dd42 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -2287,7 +2287,7 @@ static int lsi_scsi_init(PCIDevice *dev)
                            PCI_BASE_ADDRESS_SPACE_MEMORY, lsi_ram_mapfunc);
     QTAILQ_INIT(&s->queue);
 
-    scsi_bus_new(&s->bus, &dev->qdev, 1, LSI_MAX_DEVS, &lsi_scsi_ops);
+    scsi_bus_new(&s->bus, &dev->qdev, 1, LSI_MAX_DEVS, SCSI_PATH, &lsi_scsi_ops);
     if (!dev->qdev.hotplugged) {
         return scsi_bus_legacy_handle_cmdline(&s->bus);
     }
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 54f308d..43a1cd7 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -21,10 +21,11 @@ static int next_scsi_bus;
 
 /* Create a scsi bus, and attach devices to it.  */
 void scsi_bus_new(SCSIBus *bus, DeviceState *host, int tcq, int ndev,
-                  const SCSIBusOps *ops)
+		  enum SCSIDeviceLevel level, const SCSIBusOps *ops)
 {
     qbus_create_inplace(&bus->qbus, &scsi_bus_info, host, NULL);
     bus->busnr = next_scsi_bus++;
+    bus->level = level;
     bus->tcq = tcq;
     bus->ndev = ndev;
     bus->ops = ops;
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index b2c8d6e..0a4fbee 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -1263,6 +1263,7 @@ static SCSIDeviceInfo scsi_disk_info[] = {
         .qdev.fw_name = "disk",
         .qdev.desc    = "virtual SCSI disk",
         .qdev.size    = sizeof(SCSIDiskState),
+        .level        = SCSI_LUN,
         .reset        = scsi_disk_reset,
         .init         = scsi_hd_initfn,
         .destroy      = scsi_destroy,
@@ -1284,6 +1285,7 @@ static SCSIDeviceInfo scsi_disk_info[] = {
         .qdev.fw_name = "disk",
         .qdev.desc    = "virtual SCSI CD-ROM",
         .qdev.size    = sizeof(SCSIDiskState),
+        .level        = SCSI_LUN,
         .reset        = scsi_disk_reset,
         .init         = scsi_cd_initfn,
         .destroy      = scsi_destroy,
@@ -1304,6 +1306,7 @@ static SCSIDeviceInfo scsi_disk_info[] = {
         .qdev.fw_name = "disk",
         .qdev.desc    = "virtual SCSI disk or CD-ROM (legacy)",
         .qdev.size    = sizeof(SCSIDiskState),
+        .level        = SCSI_LUN,
         .reset        = scsi_disk_reset,
         .init         = scsi_disk_initfn,
         .destroy      = scsi_destroy,
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 1611023..e1f9d0e 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -561,6 +561,7 @@ static SCSIDeviceInfo scsi_generic_info = {
     .qdev.name    = "scsi-generic",
     .qdev.desc    = "pass through generic scsi device (/dev/sg*)",
     .qdev.size    = sizeof(SCSIGenericState),
+    .level        = SCSI_LUN,
     .init         = scsi_generic_initfn,
     .destroy      = scsi_destroy,
     .alloc_req    = scsi_new_request,
diff --git a/hw/scsi-luns.c b/hw/scsi-luns.c
index 4b158a9..2cf36f0 100644
--- a/hw/scsi-luns.c
+++ b/hw/scsi-luns.c
@@ -319,7 +319,7 @@ static struct SCSIBusOps path_scsi_ops = {
 static int scsi_path_initfn(SCSIDevice *s)
 {
     s->children = qemu_mallocz(sizeof(SCSIBus));
-    scsi_bus_new(s->children, &s->qdev, 1, MAX_SCSI_DEVS,
+    scsi_bus_new(s->children, &s->qdev, 1, MAX_SCSI_DEVS, SCSI_PATH,
                  &path_scsi_ops);
     return 0;
 }
@@ -329,6 +329,7 @@ static SCSIDeviceInfo scsi_path_info = {
     .qdev.desc    = "SCSI initiator device connected to multiple targets",
     .qdev.size    = sizeof(SCSIDevice),
     .init         = scsi_path_initfn,
+    .level        = SCSI_PATH,
     .qdev.props   = (Property[]) {
         DEFINE_PROP_END_OF_LIST(),
     },
@@ -352,7 +353,7 @@ static int scsi_target_initfn(SCSIDevice *dev)
     }
 
     s->qdev.children = qemu_mallocz(sizeof(SCSIBus));
-    scsi_bus_new(s->qdev.children, &dev->qdev, 1, MAX_SCSI_DEVS,
+    scsi_bus_new(s->qdev.children, &dev->qdev, 1, MAX_SCSI_DEVS, SCSI_TARGET,
                  &target_scsi_ops);
     return 0;
 }
@@ -361,6 +362,7 @@ static SCSIDeviceInfo scsi_target_info = {
     .qdev.name    = "scsi-target",
     .qdev.desc    = "SCSI target device connected to multiple logical units",
     .qdev.size    = sizeof(SCSITargetState),
+    .level        = SCSI_TARGET,
     .init         = scsi_target_initfn,
     .alloc_req    = scsi_new_request,
     .free_req     = scsi_free_request,
diff --git a/hw/scsi.h b/hw/scsi.h
index 9f70771..f4fec61 100644
--- a/hw/scsi.h
+++ b/hw/scsi.h
@@ -27,6 +27,13 @@ enum SCSILun {
     LUN_WLUN_MASK = 255
 };
 
+enum SCSIDeviceLevel {
+    SCSI_HOST = 0,
+    SCSI_PATH = 1,
+    SCSI_TARGET = 2,
+    SCSI_LUN = 3
+};
+
 typedef struct SCSISense {
     uint8_t key;
     uint8_t asc;
@@ -73,6 +80,7 @@ int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num);
 /* scsi-bus.c */
 struct SCSIDeviceInfo {
     DeviceInfo qdev;
+    enum SCSIDeviceLevel level;
     int (*init)(SCSIDevice *dev);
     void (*destroy)(SCSIDevice *s);
     void (*reset)(SCSIDevice *s);
@@ -100,6 +108,7 @@ struct SCSIBus {
     BusState qbus;
     int busnr;
 
+    enum SCSIDeviceLevel level;
     int tcq, ndev;
     const SCSIBusOps *ops;
 
@@ -107,7 +116,7 @@ struct SCSIBus {
 };
 
 void scsi_bus_new(SCSIBus *bus, DeviceState *host, int tcq, int ndev,
-                  const SCSIBusOps *ops);
+		  enum SCSIDeviceLevel level, const SCSIBusOps *ops);
 void scsi_qdev_register(SCSIDeviceInfo *info);
 
 static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d, DeviceState *initiator)
diff --git a/hw/spapr_vscsi.c b/hw/spapr_vscsi.c
index ace9dac..36dba40 100644
--- a/hw/spapr_vscsi.c
+++ b/hw/spapr_vscsi.c
@@ -935,7 +935,7 @@ static int spapr_vscsi_init(VIOsPAPRDevice *dev)
 
     dev->crq.SendFunc = vscsi_do_crq;
 
-    scsi_bus_new(&s->bus, &dev->qdev, 1, VSCSI_REQ_LIMIT,
+    scsi_bus_new(&s->bus, &dev->qdev, 1, VSCSI_REQ_LIMIT, SCSI_HOST,
                  &vscsi_scsi_ops);
     if (!dev->qdev.hotplugged) {
         scsi_bus_legacy_handle_cmdline(&s->bus);
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 195089c..5b34b7b 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -537,7 +537,7 @@ static int usb_msd_initfn(USBDevice *dev)
     }
 
     usb_desc_init(dev);
-    scsi_bus_new(&s->bus, &s->dev.qdev, 0, 1, &usb_msd_scsi_ops);
+    scsi_bus_new(&s->bus, &s->dev.qdev, 0, 1, SCSI_PATH, &usb_msd_scsi_ops);
     s->scsi_dev = scsi_bus_legacy_add_drive(&s->bus, bs, 0, !!s->removable);
     if (!s->scsi_dev) {
         return -1;
