Received: from eggs.gnu.org ([2001:4830:134:3::10]:60346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHMxU-0005vZ-3v for qemu-devel@nongnu.org; Tue, 21 Nov 2017 23:48:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHMxT-000384-4j for qemu-devel@nongnu.org; Tue, 21 Nov 2017 23:48:24 -0500 From: David Gibson Date: Wed, 22 Nov 2017 15:48:12 +1100 Message-Id: <20171122044814.3001-2-david@gibson.dropbear.id.au> In-Reply-To: <20171122044814.3001-1-david@gibson.dropbear.id.au> References: <20171122044814.3001-1-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PULL 1/3] hw/ppc/spapr: Fix virtio-scsi bootindex handling for LUNs >= 256 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: agraf@suse.de, groug@kaod.org, lvivier@redhat.com, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Thomas Huth , David Gibson From: Thomas Huth LUNs >= 256 have to be encoded with the so-called "flat space addressing method" for virtio-scsi, where an additional bit has to be set. SLOF already took care of this with the following commit: https://git.qemu.org/?p=SLOF.git;a=commitdiff;h=f72a37713fea47da (see https://bugzilla.redhat.com/show_bug.cgi?id=1431584 for details) But QEMU does not use this encoding yet for device tree paths that have to be handed over to SLOF to deal with the "bootindex" property, so SLOF currently fails to boot from virtio-scsi devices with LUNs >= 256 in the right boot order. Fix it by using the bit to indicate the "flat space addressing method" for LUNs >= 256. Signed-off-by: Thomas Huth Signed-off-by: David Gibson --- hw/ppc/spapr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 6285f7211f..4d0a84f3ec 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2663,6 +2663,10 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus, * swap 0100 or 10 << or 20 << ( target lun-id -- srplun ) */ unsigned id = 0x1000000 | (d->id << 16) | d->lun; + if (d->lun >= 256) { + /* Use the LUN "flat space addressing method" */ + id |= 0x4000; + } return g_strdup_printf("%s@%"PRIX64, qdev_fw_name(dev), (uint64_t)id << 32); } else if (usb) { -- 2.14.3