[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/23] pc-bios/s390-ccw: Device detection in higher s
From: |
Cornelia Huck |
Subject: |
[Qemu-devel] [PULL 06/23] pc-bios/s390-ccw: Device detection in higher subchannel sets |
Date: |
Mon, 7 Sep 2015 16:48:20 +0200 |
From: Alexander Yarygin <address@hidden>
If no bootdevice was specified, we try to autodetect a suitable IPL
device. Current code only searched in subchannel set 0; extend this
search to higher subchannel sets as well.
Signed-off-by: Alexander Yarygin <address@hidden>
Reviewed-by: David Hildenbrand <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
pc-bios/s390-ccw/main.c | 66 ++++++++++++++++++++++++++++++-------------------
1 file changed, 41 insertions(+), 25 deletions(-)
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
index 584d4a2..d5fe4ce 100644
--- a/pc-bios/s390-ccw/main.c
+++ b/pc-bios/s390-ccw/main.c
@@ -38,40 +38,56 @@ void virtio_panic(const char *string)
while (1) { }
}
+static bool find_dev(struct schib *schib, int dev_no)
+{
+ int i, r;
+
+ for (i = 0; i < 0x10000; i++) {
+ blk_schid.sch_no = i;
+ r = stsch_err(blk_schid, schib);
+ if ((r == 3) || (r == -EIO)) {
+ break;
+ }
+ if (!schib->pmcw.dnv) {
+ continue;
+ }
+ if (!virtio_is_blk(blk_schid)) {
+ continue;
+ }
+ if ((dev_no < 0) || (schib->pmcw.dev == dev_no)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
static void virtio_setup(uint64_t dev_info)
{
struct schib schib;
- int i;
- int r;
+ int ssid;
bool found = false;
- bool check_devno = false;
- uint16_t dev_no = -1;
+ uint16_t dev_no;
+
+ /*
+ * We unconditionally enable mss support. In every sane configuration,
+ * this will succeed; and even if it doesn't, stsch_err() can deal
+ * with the consequences.
+ */
+ enable_mss_facility();
if (dev_info != -1) {
- check_devno = true;
dev_no = dev_info & 0xffff;
debug_print_int("device no. ", dev_no);
blk_schid.ssid = (dev_info >> 16) & 0x3;
- if (blk_schid.ssid != 0) {
- debug_print_int("ssid ", blk_schid.ssid);
- if (enable_mss_facility() != 0) {
- virtio_panic("Failed to enable mss facility\n");
- }
- }
- }
-
- for (i = 0; i < 0x10000; i++) {
- blk_schid.sch_no = i;
- r = stsch_err(blk_schid, &schib);
- if (r == 3) {
- break;
- }
- if (schib.pmcw.dnv) {
- if (!check_devno || (schib.pmcw.dev == dev_no)) {
- if (virtio_is_blk(blk_schid)) {
- found = true;
- break;
- }
+ debug_print_int("ssid ", blk_schid.ssid);
+ found = find_dev(&schib, dev_no);
+ } else {
+ for (ssid = 0; ssid < 0x3; ssid++) {
+ blk_schid.ssid = ssid;
+ found = find_dev(&schib, -1);
+ if (found) {
+ break;
}
}
}
--
2.5.1
- [Qemu-devel] [PULL 00/23] s390x: further patches, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 01/23] s390x/css: handle ccw-0 TIC correctly, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 10/23] sclp/s390: rework sclp cpu hotplug device notification, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 02/23] s390x/css: ccw-0 enforces count > 0, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 03/23] s390x/event-facility: fix receive mask check, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 05/23] s390x/event-facility: fix location of receive mask, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 06/23] pc-bios/s390-ccw: Device detection in higher subchannel sets,
Cornelia Huck <=
- [Qemu-devel] [PULL 07/23] pc-bios/s390-ccw: rebuild image, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 11/23] s390/sclp: rework sclp event facility initialization + device realization, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 12/23] s390/sclp: replace sclp event types with proper defines, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 04/23] s390x/css: start with cleared cstat/dstat, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 18/23] s390: disallow memory hotplug for the s390-virtio machine, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 08/23] s390x/kvm: make setting of in-kernel irq routes more efficient, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 16/23] s390/sclp: move sclp_service_interrupt into the sclp device, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 14/23] s390/sclp: introduce a root sclp device, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 21/23] s390: unify allocation of initial memory, Cornelia Huck, 2015/09/07
- [Qemu-devel] [PULL 19/23] s390/sclp: ignore memory hotplug operations if it is disabled, Cornelia Huck, 2015/09/07