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, Farhan Ali <alifm@linux.vnet.ibm.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>
Subject: [Qemu-devel] [PULL for-2.9 4/5] pc-bios/s390-ccw: Use the ccw bios to start the network boot
Date: Tue, 28 Feb 2017 12:31:52 +0100 [thread overview]
Message-ID: <20170228113153.23867-5-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <20170228113153.23867-1-cornelia.huck@de.ibm.com>
From: Farhan Ali <alifm@linux.vnet.ibm.com>
We want to use the ccw bios to start final network boot. To do
this we use ccw bios to detect if the boot device is a virtio
network device and retrieve the start address of the
network boot image.
Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
pc-bios/s390-ccw/bootmap.c | 8 +++++++-
pc-bios/s390-ccw/iplb.h | 3 ++-
pc-bios/s390-ccw/main.c | 20 ++++++++++++++------
pc-bios/s390-ccw/virtio.c | 1 +
pc-bios/s390-ccw/virtio.h | 1 +
5 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
index 611102e3ef..b21c877b53 100644
--- a/pc-bios/s390-ccw/bootmap.c
+++ b/pc-bios/s390-ccw/bootmap.c
@@ -724,11 +724,17 @@ static void zipl_load_vscsi(void)
void zipl_load(void)
{
- if (virtio_get_device()->is_cdrom) {
+ VDev *vdev = virtio_get_device();
+
+ if (vdev->is_cdrom) {
ipl_iso_el_torito();
panic("\n! Cannot IPL this ISO image !\n");
}
+ if (virtio_get_device_type() == VIRTIO_ID_NET) {
+ jump_to_IPL_code(vdev->netboot_start_addr);
+ }
+
ipl_scsi();
switch (virtio_get_device_type()) {
diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h
index 86abc56a90..890aed9ece 100644
--- a/pc-bios/s390-ccw/iplb.h
+++ b/pc-bios/s390-ccw/iplb.h
@@ -13,7 +13,8 @@
#define IPLB_H
struct IplBlockCcw {
- uint8_t reserved0[85];
+ uint64_t netboot_start_addr;
+ uint8_t reserved0[77];
uint8_t ssid;
uint16_t devno;
uint8_t vm_flags;
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
index 345b848752..0946766d86 100644
--- a/pc-bios/s390-ccw/main.c
+++ b/pc-bios/s390-ccw/main.c
@@ -53,6 +53,12 @@ static bool find_dev(Schib *schib, int dev_no)
if (!virtio_is_supported(blk_schid)) {
continue;
}
+ /* Skip net devices since no IPLB is created and therefore no
+ * no network bootloader has been loaded
+ */
+ if (virtio_get_device_type() == VIRTIO_ID_NET && dev_no < 0) {
+ continue;
+ }
if ((dev_no < 0) || (schib->pmcw.dev == dev_no)) {
return true;
}
@@ -67,6 +73,7 @@ static void virtio_setup(void)
int ssid;
bool found = false;
uint16_t dev_no;
+ VDev *vdev = virtio_get_device();
/*
* We unconditionally enable mss support. In every sane configuration,
@@ -85,9 +92,6 @@ static void virtio_setup(void)
found = find_dev(&schib, dev_no);
break;
case S390_IPL_TYPE_QEMU_SCSI:
- {
- VDev *vdev = virtio_get_device();
-
vdev->scsi_device_selected = true;
vdev->selected_scsi_device.channel = iplb.scsi.channel;
vdev->selected_scsi_device.target = iplb.scsi.target;
@@ -95,7 +99,6 @@ static void virtio_setup(void)
blk_schid.ssid = iplb.scsi.ssid & 0x3;
found = find_dev(&schib, iplb.scsi.devno);
break;
- }
default:
panic("List-directed IPL not supported yet!\n");
}
@@ -111,9 +114,14 @@ static void virtio_setup(void)
IPL_assert(found, "No virtio device found");
- virtio_setup_device(blk_schid);
+ if (virtio_get_device_type() == VIRTIO_ID_NET) {
+ sclp_print("Network boot device detected\n");
+ vdev->netboot_start_addr = iplb.ccw.netboot_start_addr;
+ } else {
+ virtio_setup_device(blk_schid);
- IPL_assert(virtio_ipl_disk_is_valid(), "No valid IPL device detected");
+ IPL_assert(virtio_ipl_disk_is_valid(), "No valid IPL device detected");
+ }
}
int main(void)
diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c
index b333734955..6ee93d56db 100644
--- a/pc-bios/s390-ccw/virtio.c
+++ b/pc-bios/s390-ccw/virtio.c
@@ -585,6 +585,7 @@ bool virtio_is_supported(SubChannelId schid)
switch (vdev.senseid.cu_model) {
case VIRTIO_ID_BLOCK:
case VIRTIO_ID_SCSI:
+ case VIRTIO_ID_NET:
return true;
}
}
diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h
index eb35ea5faf..3388a423e5 100644
--- a/pc-bios/s390-ccw/virtio.h
+++ b/pc-bios/s390-ccw/virtio.h
@@ -276,6 +276,7 @@ struct VDev {
uint8_t scsi_dev_heads;
bool scsi_device_selected;
ScsiDevice selected_scsi_device;
+ uint64_t netboot_start_addr;
};
typedef struct VDev VDev;
--
2.11.0
next prev parent reply other threads:[~2017-02-28 11:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-28 11:31 [Qemu-devel] [PULL for-2.9 0/5] s390x: network boot Cornelia Huck
2017-02-28 11:31 ` [Qemu-devel] [PULL for-2.9 1/5] elf-loader: Allow late loading of elf Cornelia Huck
2017-02-28 11:31 ` [Qemu-devel] [PULL for-2.9 2/5] s390x/ipl: Extend S390IPLState to support network boot Cornelia Huck
2017-02-28 11:31 ` [Qemu-devel] [PULL for-2.9 3/5] s390x/ipl: Load network boot image Cornelia Huck
2017-02-28 11:31 ` Cornelia Huck [this message]
2017-02-28 11:31 ` [Qemu-devel] [PULL for-2.9 5/5] pc-bios/s390-ccw.img: rebuild image Cornelia Huck
2017-03-01 13:04 ` [Qemu-devel] [PULL for-2.9 0/5] s390x: network boot 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=20170228113153.23867-5-cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=agraf@suse.de \
--cc=alifm@linux.vnet.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=jfrei@linux.vnet.ibm.com \
--cc=peter.maydell@linaro.org \
--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).