Blame SOURCES/kvm-hw-ppc-spapr-Fix-virtio-scsi-bootindex-handling-for-.patch

9bac43
From 8a285115ee19166f22024326063d330706639914 Mon Sep 17 00:00:00 2001
9bac43
From: Thomas Huth <thuth@redhat.com>
9bac43
Date: Thu, 23 Nov 2017 17:50:30 +0100
9bac43
Subject: [PATCH 4/7] hw/ppc/spapr: Fix virtio-scsi bootindex handling for LUNs
9bac43
 >= 256
9bac43
9bac43
RH-Author: Thomas Huth <thuth@redhat.com>
9bac43
Message-id: <1511459430-7395-2-git-send-email-thuth@redhat.com>
9bac43
Patchwork-id: 77832
9bac43
O-Subject: [RHEL-7.5 qemu-kvm-ma PATCH 1/1] hw/ppc/spapr: Fix virtio-scsi bootindex handling for LUNs >= 256
9bac43
Bugzilla: 1515393
9bac43
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9bac43
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
9bac43
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9bac43
9bac43
LUNs >= 256 have to be encoded with the so-called "flat space
9bac43
addressing method" for virtio-scsi, where an additional bit has to
9bac43
be set. SLOF already took care of this with the following commit:
9bac43
9bac43
 https://git.qemu.org/?p=SLOF.git;a=commitdiff;h=f72a37713fea47da
9bac43
 (see https://bugzilla.redhat.com/show_bug.cgi?id=1431584 for details)
9bac43
9bac43
But QEMU does not use this encoding yet for device tree paths
9bac43
that have to be handed over to SLOF to deal with the "bootindex"
9bac43
property, so SLOF currently fails to boot from virtio-scsi devices
9bac43
with LUNs >= 256 in the right boot order. Fix it by using the bit
9bac43
to indicate the "flat space addressing method" for LUNs >= 256.
9bac43
9bac43
Signed-off-by: Thomas Huth <thuth@redhat.com>
9bac43
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
9bac43
(cherry picked from commit bac658d1a4dc9dd637b2eb5006abda137071f17f)
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
---
9bac43
 hw/ppc/spapr.c | 4 ++++
9bac43
 1 file changed, 4 insertions(+)
9bac43
9bac43
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
9bac43
index 96df3a7..2065f09 100644
9bac43
--- a/hw/ppc/spapr.c
9bac43
+++ b/hw/ppc/spapr.c
9bac43
@@ -2628,6 +2628,10 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus,
9bac43
              * swap 0100 or 10 << or 20 << ( target lun-id -- srplun )
9bac43
              */
9bac43
             unsigned id = 0x1000000 | (d->id << 16) | d->lun;
9bac43
+            if (d->lun >= 256) {
9bac43
+                /* Use the LUN "flat space addressing method" */
9bac43
+                id |= 0x4000;
9bac43
+            }
9bac43
             return g_strdup_printf("%s@%"PRIX64, qdev_fw_name(dev),
9bac43
                                    (uint64_t)id << 32);
9bac43
         } else if (usb) {
9bac43
-- 
9bac43
1.8.3.1
9bac43