From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: peter.maydell@linaro.org
Cc: borntraeger@de.ibm.com, agraf@suse.de, jfrei@linux.vnet.ibm.com,
qemu-devel@nongnu.org,
Alexander Yarygin <yarygin@linux.vnet.ibm.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>
Subject: [Qemu-devel] [PULL 07/20] pc-bios/s390-ccw: Get device address via diag 308/6
Date: Tue, 17 May 2016 16:46:04 +0200 [thread overview]
Message-ID: <1463496377-9729-8-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1463496377-9729-1-git-send-email-cornelia.huck@de.ibm.com>
From: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
To IPL from a device, pc-bios receives from qemu a device address via
general register 7. The better way to do it is to use diag308/6
instruction which returns so called
"IplParameterBlock". IplParameterBlock contains the device address for
IPL and additional parameters that can be used by pc-bios.
This patch allows pc-bios to get device address via diag308/6 and
doesn't use gr7 passed boot information anymore.
Signed-off-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
pc-bios/s390-ccw/iplb.h | 79 +++++++++++++++++++++++++++++++++++++++++++++
pc-bios/s390-ccw/main.c | 25 ++++++++------
pc-bios/s390-ccw/s390-ccw.h | 2 +-
pc-bios/s390-ccw/start.S | 2 --
4 files changed, 95 insertions(+), 13 deletions(-)
create mode 100644 pc-bios/s390-ccw/iplb.h
diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h
new file mode 100644
index 0000000..1cf509f
--- /dev/null
+++ b/pc-bios/s390-ccw/iplb.h
@@ -0,0 +1,79 @@
+/*
+ * QEMU S390 IPL Block
+ *
+ * Copyright 2015 IBM Corp.
+ * Author(s): Alexander Yarygin <yarygin@linux.vnet.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or (at
+ * your option) any later version. See the COPYING file in the top-level
+ * directory.
+ */
+
+#ifndef IPLB_H
+#define IPLB_H
+
+struct IplBlockCcw {
+ uint8_t reserved0[85];
+ uint8_t ssid;
+ uint16_t devno;
+ uint8_t vm_flags;
+ uint8_t reserved3[3];
+ uint32_t vm_parm_len;
+ uint8_t nss_name[8];
+ uint8_t vm_parm[64];
+ uint8_t reserved4[8];
+} __attribute__ ((packed));
+typedef struct IplBlockCcw IplBlockCcw;
+
+struct IplBlockFcp {
+ uint8_t reserved1[305 - 1];
+ uint8_t opt;
+ uint8_t reserved2[3];
+ uint16_t reserved3;
+ uint16_t devno;
+ uint8_t reserved4[4];
+ uint64_t wwpn;
+ uint64_t lun;
+ uint32_t bootprog;
+ uint8_t reserved5[12];
+ uint64_t br_lba;
+ uint32_t scp_data_len;
+ uint8_t reserved6[260];
+ uint8_t scp_data[];
+} __attribute__ ((packed));
+typedef struct IplBlockFcp IplBlockFcp;
+
+struct IplParameterBlock {
+ uint32_t len;
+ uint8_t reserved0[3];
+ uint8_t version;
+ uint32_t blk0_len;
+ uint8_t pbt;
+ uint8_t flags;
+ uint16_t reserved01;
+ uint8_t loadparm[8];
+ union {
+ IplBlockCcw ccw;
+ IplBlockFcp fcp;
+ };
+} __attribute__ ((packed));
+typedef struct IplParameterBlock IplParameterBlock;
+
+extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));
+
+#define S390_IPL_TYPE_FCP 0x00
+#define S390_IPL_TYPE_CCW 0x02
+
+static inline bool store_iplb(IplParameterBlock *iplb)
+{
+ register unsigned long addr asm("0") = (unsigned long) iplb;
+ register unsigned long rc asm("1") = 0;
+
+ asm volatile ("diag %0,%2,0x308\n"
+ : "+d" (addr), "+d" (rc)
+ : "d" (6)
+ : "memory", "cc");
+ return rc == 0x01;
+}
+
+#endif /* IPLB_H */
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
index 1c9e079..9446ecc 100644
--- a/pc-bios/s390-ccw/main.c
+++ b/pc-bios/s390-ccw/main.c
@@ -12,8 +12,8 @@
#include "virtio.h"
char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));
-uint64_t boot_value;
static SubChannelId blk_schid = { .one = 1 };
+IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));
/*
* Priniciples of Operations (SA22-7832-09) chapter 17 requires that
@@ -61,7 +61,7 @@ static bool find_dev(Schib *schib, int dev_no)
return false;
}
-static void virtio_setup(uint64_t dev_info)
+static void virtio_setup(void)
{
Schib schib;
int ssid;
@@ -75,12 +75,18 @@ static void virtio_setup(uint64_t dev_info)
*/
enable_mss_facility();
- if (dev_info != -1) {
- dev_no = dev_info & 0xffff;
- debug_print_int("device no. ", dev_no);
- blk_schid.ssid = (dev_info >> 16) & 0x3;
- debug_print_int("ssid ", blk_schid.ssid);
- found = find_dev(&schib, dev_no);
+ if (store_iplb(&iplb)) {
+ switch (iplb.pbt) {
+ case S390_IPL_TYPE_CCW:
+ dev_no = iplb.ccw.devno;
+ debug_print_int("device no. ", dev_no);
+ blk_schid.ssid = iplb.ccw.ssid & 0x3;
+ debug_print_int("ssid ", blk_schid.ssid);
+ found = find_dev(&schib, dev_no);
+ break;
+ default:
+ panic("List-directed IPL not supported yet!\n");
+ }
} else {
for (ssid = 0; ssid < 0x3; ssid++) {
blk_schid.ssid = ssid;
@@ -101,8 +107,7 @@ static void virtio_setup(uint64_t dev_info)
int main(void)
{
sclp_setup();
- debug_print_int("boot reg[7] ", boot_value);
- virtio_setup(boot_value);
+ virtio_setup();
zipl_load(); /* no return */
diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h
index 616d967..ded67bc 100644
--- a/pc-bios/s390-ccw/s390-ccw.h
+++ b/pc-bios/s390-ccw/s390-ccw.h
@@ -44,6 +44,7 @@ typedef unsigned long long __u64;
#endif
#include "cio.h"
+#include "iplb.h"
typedef struct irb Irb;
typedef struct ccw1 Ccw1;
@@ -61,7 +62,6 @@ void consume_sclp_int(void);
void panic(const char *string);
void write_subsystem_identification(void);
extern char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));
-extern uint64_t boot_value;
/* sclp-ascii.c */
void sclp_print(const char *string);
diff --git a/pc-bios/s390-ccw/start.S b/pc-bios/s390-ccw/start.S
index b6dd8c2..43f9bd2 100644
--- a/pc-bios/s390-ccw/start.S
+++ b/pc-bios/s390-ccw/start.S
@@ -14,8 +14,6 @@
_start:
larl %r15, stack + 0x8000 /* Set up stack */
-larl %r6, boot_value
-stg %r7, 0(%r6) /* save the boot_value before any function calls */
j main /* And call C */
/*
--
2.8.2
next prev parent reply other threads:[~2016-05-17 14:46 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-17 14:45 [Qemu-devel] [PULL 00/20] First round of s390x patches for 2.7 Cornelia Huck
2016-05-17 14:45 ` [Qemu-devel] [PULL 01/20] s390x: add compat machine " Cornelia Huck
2016-05-17 14:45 ` [Qemu-devel] [PULL 02/20] s390x: enable runtime instrumentation Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 03/20] s390x/ipl: Extend the IplParameterBlock struct Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 04/20] s390x/ipl: Add type and length checks for IplParameterBlock values Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 05/20] s390x/ipl: Provide ipl parameter block Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 06/20] s390x/ipl: Add ssid field to IplParameterBlock Cornelia Huck
2016-05-17 14:46 ` Cornelia Huck [this message]
2016-05-17 14:46 ` [Qemu-devel] [PULL 08/20] s390-ccw.img: rebuild image Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 09/20] s390x/ipl: Remove redundant usage of gr7 Cornelia Huck
2016-05-18 10:01 ` Paolo Bonzini
2016-05-18 10:09 ` Christian Borntraeger
2016-05-18 10:37 ` Paolo Bonzini
2016-05-17 14:46 ` [Qemu-devel] [PULL 10/20] hw/char: QOM'ify sclpconsole-lm.c Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 11/20] hw/char: QOM'ify sclpconsole.c Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 12/20] s390x/pci: fix reg_irqs() Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 13/20] s390x/pci: separate s390_sclp_configure function Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 14/20] s390x/pci: separate s390_pcihost_iommu_configure function Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 15/20] s390x/pci: export pci_dereg_ioat and pci_dereg_irqs Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 16/20] s390x/pci: introduce S390PCIBusDevice.iommu_enabled Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 17/20] s390x/pci: fix s390_pci_sclp_deconfigure Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 18/20] s390x/pci: enhance mpcifc_service_call Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 19/20] s390x/pci: add length checking for pci sclp handlers Cornelia Huck
2016-05-17 14:46 ` [Qemu-devel] [PULL 20/20] s390x/pci: remove whitespace Cornelia Huck
2016-05-17 16:26 ` [Qemu-devel] [PULL 00/20] First round of s390x patches for 2.7 Peter Maydell
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=1463496377-9729-8-git-send-email-cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=jfrei@linux.vnet.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=yarygin@linux.vnet.ibm.com \
/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).