From nobody Sun May 19 15:29:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496678271258392.25222608234947; Mon, 5 Jun 2017 08:57:51 -0700 (PDT) Received: from localhost ([::1]:34009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHuO4-0005Cr-Kw for importer@patchew.org; Mon, 05 Jun 2017 11:57:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHuMR-0003tz-4n for qemu-devel@nongnu.org; Mon, 05 Jun 2017 11:56:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHuMO-0008Sy-0p for qemu-devel@nongnu.org; Mon, 05 Jun 2017 11:56:07 -0400 Received: from [62.254.189.133] (port=23817 helo=centos.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHuMN-0007us-C1 for qemu-devel@nongnu.org; Mon, 05 Jun 2017 11:56:03 -0400 Received: by centos.localdomain (Postfix, from userid 500) id 9B1829FBCF; Mon, 5 Jun 2017 16:55:20 +0100 (BST) From: Felipe Franciosi To: David Gibson , Alexey Kardashevskiy , Alexander Graf , Paolo Bonzini Date: Mon, 5 Jun 2017 16:55:18 +0100 Message-Id: <1496678118-27350-2-git-send-email-felipe@nutanix.com> X-Mailer: git-send-email 1.9.5 In-Reply-To: <1496678118-27350-1-git-send-email-felipe@nutanix.com> References: <1496678118-27350-1-git-send-email-felipe@nutanix.com> X-detected-operating-system: by eggs.gnu.org: Mac OS X [generic] [fuzzy] X-Received-From: 62.254.189.133 Subject: [Qemu-devel] [PATCH v2] spapr: Allow boot from vhost-*-scsi backends X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mike Cui , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Felipe Franciosi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The current implementation of spapr_get_fw_dev_path() doesn't take into consideration vhost-*-scsi devices. This makes said devices unbootable on PPC as SLOF is unable to work out the path to scan boot disks. This makes VMs bootable on spapr when using vhost-*-scsi by implementing a disk path for VHostSCSICommon (which currently includes both vhost-user-scsi and vhost-scsi). Signed-off-by: Felipe Franciosi Signed-off-by: Mike Cui --- hw/ppc/spapr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index ab3aab1..1c87886 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -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" =20 #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 =3D CAST(SCSIDevice, dev, TYPE_SCSI_DEVICE); sPAPRPHBState *phb =3D CAST(sPAPRPHBState, dev, TYPE_SPAPR_PCI_HOST_BR= IDGE); + VHostSCSICommon *vsc =3D CAST(VHostSCSICommon, dev, TYPE_VHOST_SCSI_CO= MMON); =20 if (d) { void *spapr =3D 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); } =20 + if (vsc) { + /* Same logic as virtio above */ + unsigned id =3D 0x1000000 | (vsc->target << 16) | vsc->lun; + return g_strdup_printf("disk@%"PRIX64, (uint64_t)id << 32); + } + return NULL; } =20 --=20 1.9.5