spapr: Allow boot from vhost-*-scsi backends
PATCH 1/1 spapr: Allow boot from vhost-*-scsi backends
This makes VMs bootable on spapr when using vhost-*-scsi.
Signed-off-by Felipe Franciosi <[email protected]>
Signed-off-by Mike Cui <[email protected]>
--- hw/ppc/spapr.c | 8 ++++++++ 1 file changed, 8 insertions(+)
hw/ppc/spapr.c +8 -0
@@ -57,6 +57,7 @@#include "hw/pci/pci.h" #include "hw/scsi/scsi.h" #include "hw/virtio/virtio-scsi.h" +#include "hw/virtio/vhost-scsi-common.h" #include "exec/address-spaces.h" #include "hw/usb.h"
@@ -2388,6 +2389,7 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus, ((type *)object_dynamic_cast(OBJECT(obj), (name)))SCSIDevice *d =CAST (SCSIDevice, dev,TYPE_SCSI_DEVICE );sPAPRPHBState *phb =CAST (sPAPRPHBState, dev,TYPE_SPAPR_PCI_HOST_BRIDGE ); +VHostSCSICommon *vsc =CAST (VHostSCSICommon, dev,TYPE_VHOST_SCSI_COMMON );if (d) {void *spapr =CAST (void, bus->parent,"spapr-vscsi" );
@@ -2444,6 +2446,12 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus,return g_strdup_printf ("pci@%" PRIX64 , phb->buid); } +if (vsc) { +/* Same logic as virtio above */ +unsigned id =0x1000000 | (vsc->target <<16 ) | vsc->lun; +return g_strdup_printf ("disk@%" PRIX64 , (uint64_t )id <<32 ); + } +return NULL ; }
Signature · 1 line
1.9.5
Quoted 1 line · Felipe Franciosi
This makes VMs bootable on spapr when using vhost-*-scsi.
This commit message needs more information: what previously prevented vhost-*-scsi from working?
Quoted 39 lines
Signed-off-by Felipe Franciosi <[email protected]>Signed-off-by Mike Cui <[email protected]>--- hw/ppc/spapr.c | 8 ++++++++ 1 file changed, 8 insertions(+)hw/ppc/spapr.c +8
-0@@ -57,6 +57,7 @@#include "hw/pci/pci.h" #include "hw/scsi/scsi.h" #include "hw/virtio/virtio-scsi.h" +#include "hw/virtio/vhost-scsi-common.h" #include "exec/address-spaces.h" #include "hw/usb.h" @@ -2388,6 +2389,7 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus, ((type *)object_dynamic_cast(OBJECT(obj), (name)))SCSIDevice *d =CAST (SCSIDevice, dev,TYPE_SCSI_DEVICE );sPAPRPHBState *phb =CAST (sPAPRPHBState, dev,TYPE_SPAPR_PCI_HOST_BRIDGE ); +VHostSCSICommon *vsc =CAST (VHostSCSICommon, dev,TYPE_VHOST_SCSI_COMMON );if (d) {void *spapr =CAST (void, bus->parent,"spapr-vscsi" );@@ -2444,6 +2446,12 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus,return g_strdup_printf ("pci@%" PRIX64 , phb->buid); } +if (vsc) { +/* Same logic as virtio above */ +unsigned id =0x1000000 | (vsc->target <<16 ) | vsc->lun; +return g_strdup_printf ("disk@%" PRIX64 , (uint64_t )id <<32 ); + } +return NULL ; }
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 8 lines · David Gibson
Quoted 1 line · Felipe Franciosi
This makes VMs bootable on spapr when using vhost-*-scsi.
This commit message needs more information: what previously prevented vhost-*-scsi from working?
Fair point. I elaborated on the commit message and sent a v2.
Thanks,
F.
Quoted 46 lines
Quoted 40 lines
Signed-off-by Felipe Franciosi <[email protected]>Signed-off-by Mike Cui <[email protected]>---
hw/ppc/spapr.c| 8 ++++++++1 file changed, 8 insertions(+)hw/ppc/spapr.c +8
-0@@ -57,6 +57,7 @@#include "hw/pci/pci.h" #include "hw/scsi/scsi.h" #include "hw/virtio/virtio-scsi.h" +#include "hw/virtio/vhost-scsi-common.h" #include "exec/address-spaces.h" #include "hw/usb.h" @@ -2388,6 +2389,7 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus, ((type *)object_dynamic_cast(OBJECT(obj), (name)))SCSIDevice *d =CAST (SCSIDevice, dev,TYPE_SCSI_DEVICE );sPAPRPHBState *phb =CAST (sPAPRPHBState, dev,TYPE_SPAPR_PCI_HOST_BRIDGE ); +VHostSCSICommon *vsc =CAST (VHostSCSICommon, dev,TYPE_VHOST_SCSI_COMMON );if (d) {void *spapr =CAST (void, bus->parent,"spapr-vscsi" );@@ -2444,6 +2446,12 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus,return g_strdup_printf ("pci@%" PRIX64 , phb->buid); } +if (vsc) { +/* Same logic as virtio above */ +unsigned id =0x1000000 | (vsc->target <<16 ) | vsc->lun; +return g_strdup_printf ("disk@%" PRIX64 , (uint64_t )id <<32 ); + } +return NULL ; }Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson