aboutsummaryrefslogtreecommitdiff
path: root/hw/s390x/ipl.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-07-11 18:46:38 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-07-11 18:46:38 +0100
commitf1ef55786691a1bf79db0b74ba1e5347a0d38c1b (patch)
treee42476d052ce6815b18f2a2460c30d64a99585d6 /hw/s390x/ipl.c
parent7de2cc8f787a9cf8edff616c75ea9e73a86db9ca (diff)
parent93d16d81c8af0fe93a04bee8a4cb3259f480cab6 (diff)
downloadqemu-f1ef55786691a1bf79db0b74ba1e5347a0d38c1b.zip
qemu-f1ef55786691a1bf79db0b74ba1e5347a0d38c1b.tar.gz
qemu-f1ef55786691a1bf79db0b74ba1e5347a0d38c1b.tar.bz2
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20160711' into staging
Last round of s390x patches for 2.7: - A large update of the s390x PCI code, bringing it in line with the architecture - Fixes and improvements in the ipl (boot) code - Refactoring in the css code # gpg: Signature made Mon 11 Jul 2016 09:04:51 BST # gpg: using RSA key 0xDECF6B93C6F02FAF # gpg: Good signature from "Cornelia Huck <huckc@linux.vnet.ibm.com>" # gpg: aka "Cornelia Huck <cornelia.huck@de.ibm.com>" # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0 18CE DECF 6B93 C6F0 2FAF * remotes/cohuck/tags/s390x-20160711: (25 commits) s390x/pci: make hot-unplug handler smoother s390x/pci: replace fid with idx in msg data of msix s390x/pci: fix stpcifc_service_call s390x/pci: refactor list_pci s390x/pci: refactor s390_pci_find_dev_by_idx s390x/pci: add checkings in CLP_SET_PCI_FN s390x/pci: enable zpci hot-plug/hot-unplug s390x/pci: enable uid-checking s390x/pci: introduce S390PCIBusDevice qdev s390x/pci: introduce S390PCIIOMMU s390x/pci: introduce S390PCIBus s390x/pci: enforce zPCI state checking s390x/pci: refactor s390_pci_find_dev_by_fh s390x/pci: unify FH_ macros s390x/pci: write fid in CLP_QUERY_PCI_FN s390x/pci: acceleration for getting S390pciState s390x/pci: fix failures of dma map/unmap s390x/css: Unplug handler of virtual css bridge s390x/css: Factor out virtual css bridge and bus s390x/css: use define for "virtual-css-bridge" literal ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/s390x/ipl.c')
-rw-r--r--hw/s390x/ipl.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index e6bf7cf..2e2664f 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -69,8 +69,8 @@ static const VMStateDescription vmstate_ipl = {
.version_id = 0,
.minimum_version_id = 0,
.fields = (VMStateField[]) {
- VMSTATE_UINT64(start_addr, S390IPLState),
- VMSTATE_UINT64(bios_start_addr, S390IPLState),
+ VMSTATE_UINT64(compat_start_addr, S390IPLState),
+ VMSTATE_UINT64(compat_bios_start_addr, S390IPLState),
VMSTATE_STRUCT(iplb, S390IPLState, 0, vmstate_iplb, IplParameterBlock),
VMSTATE_BOOL(iplb_valid, S390IPLState),
VMSTATE_UINT8(cssid, S390IPLState),
@@ -192,6 +192,13 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
stq_p(rom_ptr(INITRD_PARM_SIZE), initrd_size);
}
}
+ /*
+ * Don't ever use the migrated values, they could come from a different
+ * BIOS and therefore don't work. But still migrate the values, so
+ * QEMUs relying on it don't break.
+ */
+ ipl->compat_start_addr = ipl->start_addr;
+ ipl->compat_bios_start_addr = ipl->bios_start_addr;
qemu_register_reset(qdev_reset_all_fn, dev);
error:
error_propagate(errp, err);
@@ -214,10 +221,14 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl)
dev_st = get_boot_device(0);
if (dev_st) {
- VirtioCcwDevice *ccw_dev = (VirtioCcwDevice *) object_dynamic_cast(
- OBJECT(qdev_get_parent_bus(dev_st)->parent),
+ VirtioCcwDevice *virtio_ccw_dev = (VirtioCcwDevice *)
+ object_dynamic_cast(OBJECT(qdev_get_parent_bus(dev_st)->parent),
TYPE_VIRTIO_CCW_DEVICE);
- if (ccw_dev) {
+ SCSIDevice *sd = (SCSIDevice *) object_dynamic_cast(OBJECT(dev_st),
+ TYPE_SCSI_DEVICE);
+ if (virtio_ccw_dev) {
+ CcwDevice *ccw_dev = CCW_DEVICE(virtio_ccw_dev);
+
ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN);
ipl->iplb.blk0_len =
cpu_to_be32(S390_IPLB_MIN_CCW_LEN - S390_IPLB_HEADER_LEN);
@@ -225,6 +236,22 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl)
ipl->iplb.ccw.devno = cpu_to_be16(ccw_dev->sch->devno);
ipl->iplb.ccw.ssid = ccw_dev->sch->ssid & 3;
return true;
+ } else if (sd) {
+ SCSIBus *bus = scsi_bus_from_device(sd);
+ VirtIOSCSI *vdev = container_of(bus, VirtIOSCSI, bus);
+ VirtIOSCSICcw *scsi_ccw = container_of(vdev, VirtIOSCSICcw, vdev);
+ CcwDevice *ccw_dev = CCW_DEVICE(scsi_ccw);
+
+ ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN);
+ ipl->iplb.blk0_len =
+ cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN - S390_IPLB_HEADER_LEN);
+ ipl->iplb.pbt = S390_IPL_TYPE_QEMU_SCSI;
+ ipl->iplb.scsi.lun = cpu_to_be32(sd->lun);
+ ipl->iplb.scsi.target = cpu_to_be16(sd->id);
+ ipl->iplb.scsi.channel = cpu_to_be16(sd->channel);
+ ipl->iplb.scsi.devno = cpu_to_be16(ccw_dev->sch->devno);
+ ipl->iplb.scsi.ssid = ccw_dev->sch->ssid & 3;
+ return true;
}
}