qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: qemu-devel Developers <qemu-devel@nongnu.org>
Cc: borntraeger@de.ibm.com, aliguori@us.ibm.com,
	Dominik Dingel <dingel@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PULL 1/3] s390/IPL: Allow boot from other ssid than 0
Date: Mon, 29 Jul 2013 12:05:22 +0200	[thread overview]
Message-ID: <1375092324-23943-2-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1375092324-23943-1-git-send-email-agraf@suse.de>

From: Dominik Dingel <dingel@linux.vnet.ibm.com>

We now take the subchannel set id also into account to find the boot device.
If we want to use a subchannel set other than the default set 0, we first
need to enable the mss facility.

Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 pc-bios/s390-ccw/cio.h      |   20 ++++++++++++++++++++
 pc-bios/s390-ccw/main.c     |    7 +++++++
 pc-bios/s390-ccw/s390-ccw.h |    1 +
 pc-bios/s390-ccw/virtio.c   |   18 ++++++++++++++++++
 4 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/pc-bios/s390-ccw/cio.h b/pc-bios/s390-ccw/cio.h
index cb5815a..f5b4549 100644
--- a/pc-bios/s390-ccw/cio.h
+++ b/pc-bios/s390-ccw/cio.h
@@ -93,6 +93,26 @@ struct subchannel_id {
         __u32 sch_no : 16;
 } __attribute__ ((packed, aligned(4)));
 
+struct chsc_header {
+    __u16 length;
+    __u16 code;
+} __attribute__((packed));
+
+struct chsc_area_sda {
+    struct chsc_header request;
+    __u8 reserved1:4;
+    __u8 format:4;
+    __u8 reserved2;
+    __u16 operation_code;
+    __u32 reserved3;
+    __u32 reserved4;
+    __u32 operation_data_area[252];
+    struct chsc_header response;
+    __u32 reserved5:4;
+    __u32 format2:4;
+    __u32 reserved6:24;
+} __attribute__((packed));
+
 /*
  * TPI info structure
  */
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
index 1665c57..c5d5332 100644
--- a/pc-bios/s390-ccw/main.c
+++ b/pc-bios/s390-ccw/main.c
@@ -35,6 +35,13 @@ static void virtio_setup(uint64_t dev_info)
         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++) {
diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h
index 8241b0a..5e871ac 100644
--- a/pc-bios/s390-ccw/s390-ccw.h
+++ b/pc-bios/s390-ccw/s390-ccw.h
@@ -61,6 +61,7 @@ unsigned long virtio_load_direct(ulong rec_list1, ulong rec_list2,
 bool virtio_is_blk(struct subchannel_id schid);
 void virtio_setup_block(struct subchannel_id schid);
 int virtio_read(ulong sector, void *load_addr);
+int enable_mss_facility(void);
 
 /* bootmap.c */
 int zipl_load(void);
diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c
index f438af1..49f2d29 100644
--- a/pc-bios/s390-ccw/virtio.c
+++ b/pc-bios/s390-ccw/virtio.c
@@ -13,6 +13,8 @@
 
 struct vring block;
 
+static char chsc_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
+
 static long kvm_hypercall(unsigned long nr, unsigned long param1,
                           unsigned long param2)
 {
@@ -301,3 +303,19 @@ bool virtio_is_blk(struct subchannel_id schid)
     return true;
 }
 
+int enable_mss_facility(void)
+{
+    int ret;
+    struct chsc_area_sda *sda_area = (struct chsc_area_sda *) chsc_page;
+
+    memset(sda_area, 0, PAGE_SIZE);
+    sda_area->request.length = 0x0400;
+    sda_area->request.code = 0x0031;
+    sda_area->operation_code = 0x2;
+
+    ret = chsc(sda_area);
+    if ((ret == 0) && (sda_area->response.code == 0x0001)) {
+        return 0;
+    }
+    return -EIO;
+}
-- 
1.6.0.2

  reply	other threads:[~2013-07-29 10:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 10:05 [Qemu-devel] [PULL 0/3] s390 patch queue 2013-07-29 Alexander Graf
2013-07-29 10:05 ` Alexander Graf [this message]
2013-07-29 10:05 ` [Qemu-devel] [PULL 2/3] s390/ipl: Fix boot order Alexander Graf
2013-07-29 10:05 ` [Qemu-devel] [PULL 3/3] s390: update s390-ccw.img Alexander Graf
2013-07-29 14:00 ` [Qemu-devel] [PULL 0/8] s390 patch queue part 2 Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 1/8] s390/sclpconsole: handle char layer busy conditions Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 2/8] s390x/ioinst: Add missing alignment checks for IO instructions Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 3/8] s390x/ioinst: Throw addressing exception when memory_map failed Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 4/8] s390x/ioinst: Fixed alignment check in SCHM instruction Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 5/8] s390x/ioinst: Fixed priority of operand exceptions Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 6/8] s390x/kvm: Reworked/fixed handling of cc3 in kvm_handle_css_inst() Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 7/8] s390x/kvm: Remove redundant return code Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 8/8] s390: Implement dump-guest-memory support for target s390x Christian Borntraeger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1375092324-23943-2-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=dingel@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).