[Qemu-devel] [PATCH v5 00/11] Implement network booting in the s390-ccw BIOS

Thomas Huth posted 11 patches 6 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1499863793-18627-1-git-send-email-thuth@redhat.com
Test FreeBSD passed
Test checkpatch failed
Test docker passed
Test s390x passed
pc-bios/s390-ccw/Makefile        |  13 +-
pc-bios/s390-ccw/bootmap.c       |   2 +
pc-bios/s390-ccw/bootmap.h       |  26 ---
pc-bios/s390-ccw/bswap.h         |  30 ++++
pc-bios/s390-ccw/libc.h          |  45 +++++
pc-bios/s390-ccw/main.c          |  14 +-
pc-bios/s390-ccw/netboot.mak     |  59 +++++++
pc-bios/s390-ccw/netmain.c       | 361 +++++++++++++++++++++++++++++++++++++++
pc-bios/s390-ccw/s390-ccw.h      |  33 +---
pc-bios/s390-ccw/sclp.c          |  37 ++--
pc-bios/s390-ccw/virtio-blkdev.c | 296 ++++++++++++++++++++++++++++++++
pc-bios/s390-ccw/virtio-net.c    | 135 +++++++++++++++
pc-bios/s390-ccw/virtio-scsi.c   |   1 +
pc-bios/s390-ccw/virtio.c        | 306 ++++-----------------------------
pc-bios/s390-ccw/virtio.h        |  46 ++---
roms/SLOF                        |   2 +-
16 files changed, 1018 insertions(+), 388 deletions(-)
create mode 100644 pc-bios/s390-ccw/bswap.h
create mode 100644 pc-bios/s390-ccw/libc.h
create mode 100644 pc-bios/s390-ccw/netboot.mak
create mode 100644 pc-bios/s390-ccw/netmain.c
create mode 100644 pc-bios/s390-ccw/virtio-blkdev.c
create mode 100644 pc-bios/s390-ccw/virtio-net.c
[Qemu-devel] [PATCH v5 00/11] Implement network booting in the s390-ccw BIOS
Posted by Thomas Huth 6 years, 8 months ago
It's already possible to do a network boot of an s390x guest with an
external netboot image based on a Linux installation, but it would
be much more convenient if the s390-ccw firmware supported network
booting right out of the box, without the need to assemble such an
external image first.

This patch series now introduces a s390-netboot.img that can be used
for network booting via DHCP and TFTP by re-using the networking stack
from the SLOF firmware (see https://github.com/aik/SLOF/ for details),
and adds a driver for virtio-net-ccw devices.

The code can only be built if the roms/SLOF submodule has been checked
out (there is a sanity check for this in the Makefile). Once it has
been built, you can download a combined kernel + initrd image via TFTP
by starting QEMU for example with:

 qemu-system-s390x ... -device virtio-net,netdev=n1,bootindex=1 \
       -netdev user,id=n1,tftp=/path/to/tftp,bootfile=kernel.img

Note that this version does not support downloading via config
files (i.e. pxelinux config files or .INS config files) yet. This
will be added later.

v5:
 - Fixed problem when compiling the code natively on a s390x machine
   (do not try to re-use the Makefile.inc files from SLOF, and define
   our own rules instead)
 - Fixed typos that Cornelia discovered while reviewing v4

v4:
 - Cosmetic clean-ups according to the review feedback from v3
 - Fixed bug in the find_dev() function (spotted by Cornelia in v3)
 - Added an additional patch to remove some unused structs from
   virtio.h

v3:
 - Adressed the review feedback from v2
 - The last remaining SLOF patch has now been merged (big thanks to
   Alexey!), so not sending this as RFC anymore - it is ready now for
   integration, I think.

v2:
 - Put the network boot loader into a separate s390-netboot.img
   binary instead of linking it directly into the s390-ccw firmware.
 - Use the SLOF sources from the roms/SLOF/ submodule instead of
   copying them into the pc-bios/s390-ccw folder
 - Removed the .INS config file loading code for now - only support
   combined kernel + initrd images in this initial implementation.

Thomas Huth (11):
  pc-bios/s390-ccw: Move libc functions to separate header
  pc-bios/s390-ccw: Move ebc2asc to sclp.c
  pc-bios/s390-ccw: Move virtio-block related functions into a separate
    file
  pc-bios/s390-ccw: Add a write() function for stdio
  pc-bios/s390-ccw: Move byteswap functions to a separate header
  pc-bios/s390-ccw: Remove unused structs from virtio.h
  pc-bios/s390-ccw: Add code for virtio feature negotiation
  roms/SLOF: Update submodule to latest status
  pc-bios/s390-ccw: Add core files for the network bootloading program
  pc-bios/s390-ccw: Add virtio-net driver code
  pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP
    load

 pc-bios/s390-ccw/Makefile        |  13 +-
 pc-bios/s390-ccw/bootmap.c       |   2 +
 pc-bios/s390-ccw/bootmap.h       |  26 ---
 pc-bios/s390-ccw/bswap.h         |  30 ++++
 pc-bios/s390-ccw/libc.h          |  45 +++++
 pc-bios/s390-ccw/main.c          |  14 +-
 pc-bios/s390-ccw/netboot.mak     |  59 +++++++
 pc-bios/s390-ccw/netmain.c       | 361 +++++++++++++++++++++++++++++++++++++++
 pc-bios/s390-ccw/s390-ccw.h      |  33 +---
 pc-bios/s390-ccw/sclp.c          |  37 ++--
 pc-bios/s390-ccw/virtio-blkdev.c | 296 ++++++++++++++++++++++++++++++++
 pc-bios/s390-ccw/virtio-net.c    | 135 +++++++++++++++
 pc-bios/s390-ccw/virtio-scsi.c   |   1 +
 pc-bios/s390-ccw/virtio.c        | 306 ++++-----------------------------
 pc-bios/s390-ccw/virtio.h        |  46 ++---
 roms/SLOF                        |   2 +-
 16 files changed, 1018 insertions(+), 388 deletions(-)
 create mode 100644 pc-bios/s390-ccw/bswap.h
 create mode 100644 pc-bios/s390-ccw/libc.h
 create mode 100644 pc-bios/s390-ccw/netboot.mak
 create mode 100644 pc-bios/s390-ccw/netmain.c
 create mode 100644 pc-bios/s390-ccw/virtio-blkdev.c
 create mode 100644 pc-bios/s390-ccw/virtio-net.c

-- 
1.8.3.1


Re: [Qemu-devel] [PATCH v5 00/11] Implement network booting in the s390-ccw BIOS
Posted by Christian Borntraeger 6 years, 8 months ago
On 07/12/2017 02:49 PM, Thomas Huth wrote:
> It's already possible to do a network boot of an s390x guest with an
> external netboot image based on a Linux installation, but it would
> be much more convenient if the s390-ccw firmware supported network
> booting right out of the box, without the need to assemble such an
> external image first.
> 
> This patch series now introduces a s390-netboot.img that can be used
> for network booting via DHCP and TFTP by re-using the networking stack
> from the SLOF firmware (see https://github.com/aik/SLOF/ for details),
> and adds a driver for virtio-net-ccw devices.
> 
> The code can only be built if the roms/SLOF submodule has been checked
> out (there is a sanity check for this in the Makefile). Once it has
> been built, you can download a combined kernel + initrd image via TFTP
> by starting QEMU for example with:
> 
>  qemu-system-s390x ... -device virtio-net,netdev=n1,bootindex=1 \
>        -netdev user,id=n1,tftp=/path/to/tftp,bootfile=kernel.img
> 
> Note that this version does not support downloading via config
> files (i.e. pxelinux config files or .INS config files) yet. This
> will be added later.
> 
> v5:
>  - Fixed problem when compiling the code natively on a s390x machine
>    (do not try to re-use the Makefile.inc files from SLOF, and define
>    our own rules instead)
>  - Fixed typos that Cornelia discovered while reviewing v4
> 
> v4:
>  - Cosmetic clean-ups according to the review feedback from v3
>  - Fixed bug in the find_dev() function (spotted by Cornelia in v3)
>  - Added an additional patch to remove some unused structs from
>    virtio.h
> 
> v3:
>  - Adressed the review feedback from v2
>  - The last remaining SLOF patch has now been merged (big thanks to
>    Alexey!), so not sending this as RFC anymore - it is ready now for
>    integration, I think.
> 
> v2:
>  - Put the network boot loader into a separate s390-netboot.img
>    binary instead of linking it directly into the s390-ccw firmware.
>  - Use the SLOF sources from the roms/SLOF/ submodule instead of
>    copying them into the pc-bios/s390-ccw folder
>  - Removed the .INS config file loading code for now - only support
>    combined kernel + initrd images in this initial implementation.
> 
> Thomas Huth (11):
>   pc-bios/s390-ccw: Move libc functions to separate header
>   pc-bios/s390-ccw: Move ebc2asc to sclp.c
>   pc-bios/s390-ccw: Move virtio-block related functions into a separate
>     file
>   pc-bios/s390-ccw: Add a write() function for stdio
>   pc-bios/s390-ccw: Move byteswap functions to a separate header
>   pc-bios/s390-ccw: Remove unused structs from virtio.h
>   pc-bios/s390-ccw: Add code for virtio feature negotiation
>   roms/SLOF: Update submodule to latest status
>   pc-bios/s390-ccw: Add core files for the network bootloading program
>   pc-bios/s390-ccw: Add virtio-net driver code
>   pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP
>     load
> 
>  pc-bios/s390-ccw/Makefile        |  13 +-
>  pc-bios/s390-ccw/bootmap.c       |   2 +
>  pc-bios/s390-ccw/bootmap.h       |  26 ---
>  pc-bios/s390-ccw/bswap.h         |  30 ++++
>  pc-bios/s390-ccw/libc.h          |  45 +++++
>  pc-bios/s390-ccw/main.c          |  14 +-
>  pc-bios/s390-ccw/netboot.mak     |  59 +++++++
>  pc-bios/s390-ccw/netmain.c       | 361 +++++++++++++++++++++++++++++++++++++++
>  pc-bios/s390-ccw/s390-ccw.h      |  33 +---
>  pc-bios/s390-ccw/sclp.c          |  37 ++--
>  pc-bios/s390-ccw/virtio-blkdev.c | 296 ++++++++++++++++++++++++++++++++
>  pc-bios/s390-ccw/virtio-net.c    | 135 +++++++++++++++
>  pc-bios/s390-ccw/virtio-scsi.c   |   1 +
>  pc-bios/s390-ccw/virtio.c        | 306 ++++-----------------------------
>  pc-bios/s390-ccw/virtio.h        |  46 ++---
>  roms/SLOF                        |   2 +-
>  16 files changed, 1018 insertions(+), 388 deletions(-)
>  create mode 100644 pc-bios/s390-ccw/bswap.h
>  create mode 100644 pc-bios/s390-ccw/libc.h
>  create mode 100644 pc-bios/s390-ccw/netboot.mak
>  create mode 100644 pc-bios/s390-ccw/netmain.c
>  create mode 100644 pc-bios/s390-ccw/virtio-blkdev.c
>  create mode 100644 pc-bios/s390-ccw/virtio-net.c
> 

thanks applied.

(will do some testing and rebuilding of the image files on top). Where do
we want to put the binary result? pc-bios/s390-netboot.img I assume?


Re: [Qemu-devel] [PATCH v5 00/11] Implement network booting in the s390-ccw BIOS
Posted by Thomas Huth 6 years, 8 months ago
On 12.07.2017 15:00, Christian Borntraeger wrote:
> On 07/12/2017 02:49 PM, Thomas Huth wrote:
>> It's already possible to do a network boot of an s390x guest with an
>> external netboot image based on a Linux installation, but it would
>> be much more convenient if the s390-ccw firmware supported network
>> booting right out of the box, without the need to assemble such an
>> external image first.
>>
>> This patch series now introduces a s390-netboot.img that can be used
>> for network booting via DHCP and TFTP by re-using the networking stack
>> from the SLOF firmware (see https://github.com/aik/SLOF/ for details),
>> and adds a driver for virtio-net-ccw devices.
[...]
> thanks applied.
> 
> (will do some testing and rebuilding of the image files on top). Where do
> we want to put the binary result? pc-bios/s390-netboot.img I assume?

Yes. And I guess we need to add a BLOBS entry in main Makefile for this,
too, so that it gets installed properly? Could you please do that, too,
after you've added the binary?

 Thomas

Re: [Qemu-devel] [PATCH v5 00/11] Implement network booting in the s390-ccw BIOS
Posted by Cornelia Huck 6 years, 8 months ago
On Wed, 12 Jul 2017 15:04:17 +0200
Thomas Huth <thuth@redhat.com> wrote:

> On 12.07.2017 15:00, Christian Borntraeger wrote:
> > On 07/12/2017 02:49 PM, Thomas Huth wrote:  
> >> It's already possible to do a network boot of an s390x guest with an
> >> external netboot image based on a Linux installation, but it would
> >> be much more convenient if the s390-ccw firmware supported network
> >> booting right out of the box, without the need to assemble such an
> >> external image first.
> >>
> >> This patch series now introduces a s390-netboot.img that can be used
> >> for network booting via DHCP and TFTP by re-using the networking stack
> >> from the SLOF firmware (see https://github.com/aik/SLOF/ for details),
> >> and adds a driver for virtio-net-ccw devices.  
> [...]
> > thanks applied.
> > 
> > (will do some testing and rebuilding of the image files on top). Where do
> > we want to put the binary result? pc-bios/s390-netboot.img I assume?  
> 
> Yes. And I guess we need to add a BLOBS entry in main Makefile for this,
> too, so that it gets installed properly? Could you please do that, too,
> after you've added the binary?

+1

Re: [Qemu-devel] [PATCH v5 00/11] Implement network booting in the s390-ccw BIOS
Posted by Viktor Mihajlovski 6 years, 8 months ago
On 12.07.2017 14:49, Thomas Huth wrote:
> It's already possible to do a network boot of an s390x guest with an
> external netboot image based on a Linux installation, but it would
> be much more convenient if the s390-ccw firmware supported network
> booting right out of the box, without the need to assemble such an
> external image first.
> 
> This patch series now introduces a s390-netboot.img that can be used
> for network booting via DHCP and TFTP by re-using the networking stack
> from the SLOF firmware (see https://github.com/aik/SLOF/ for details),
> and adds a driver for virtio-net-ccw devices.
> 
> The code can only be built if the roms/SLOF submodule has been checked
> out (there is a sanity check for this in the Makefile). Once it has
> been built, you can download a combined kernel + initrd image via TFTP
> by starting QEMU for example with:
> 
>  qemu-system-s390x ... -device virtio-net,netdev=n1,bootindex=1 \
>        -netdev user,id=n1,tftp=/path/to/tftp,bootfile=kernel.img
> 
> Note that this version does not support downloading via config
> files (i.e. pxelinux config files or .INS config files) yet. This
> will be added later.
> 
> v5:
>  - Fixed problem when compiling the code natively on a s390x machine
>    (do not try to re-use the Makefile.inc files from SLOF, and define
>    our own rules instead)
>  - Fixed typos that Cornelia discovered while reviewing v4
> 
> v4:
>  - Cosmetic clean-ups according to the review feedback from v3
>  - Fixed bug in the find_dev() function (spotted by Cornelia in v3)
>  - Added an additional patch to remove some unused structs from
>    virtio.h
> 
> v3:
>  - Adressed the review feedback from v2
>  - The last remaining SLOF patch has now been merged (big thanks to
>    Alexey!), so not sending this as RFC anymore - it is ready now for
>    integration, I think.
> 
> v2:
>  - Put the network boot loader into a separate s390-netboot.img
>    binary instead of linking it directly into the s390-ccw firmware.
>  - Use the SLOF sources from the roms/SLOF/ submodule instead of
>    copying them into the pc-bios/s390-ccw folder
>  - Removed the .INS config file loading code for now - only support
>    combined kernel + initrd images in this initial implementation.
> 
> Thomas Huth (11):
>   pc-bios/s390-ccw: Move libc functions to separate header
>   pc-bios/s390-ccw: Move ebc2asc to sclp.c
>   pc-bios/s390-ccw: Move virtio-block related functions into a separate
>     file
>   pc-bios/s390-ccw: Add a write() function for stdio
>   pc-bios/s390-ccw: Move byteswap functions to a separate header
>   pc-bios/s390-ccw: Remove unused structs from virtio.h
>   pc-bios/s390-ccw: Add code for virtio feature negotiation
>   roms/SLOF: Update submodule to latest status
>   pc-bios/s390-ccw: Add core files for the network bootloading program
>   pc-bios/s390-ccw: Add virtio-net driver code
>   pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP
>     load
> 
>  pc-bios/s390-ccw/Makefile        |  13 +-
>  pc-bios/s390-ccw/bootmap.c       |   2 +
>  pc-bios/s390-ccw/bootmap.h       |  26 ---
>  pc-bios/s390-ccw/bswap.h         |  30 ++++
>  pc-bios/s390-ccw/libc.h          |  45 +++++
>  pc-bios/s390-ccw/main.c          |  14 +-
>  pc-bios/s390-ccw/netboot.mak     |  59 +++++++
>  pc-bios/s390-ccw/netmain.c       | 361 +++++++++++++++++++++++++++++++++++++++
>  pc-bios/s390-ccw/s390-ccw.h      |  33 +---
>  pc-bios/s390-ccw/sclp.c          |  37 ++--
>  pc-bios/s390-ccw/virtio-blkdev.c | 296 ++++++++++++++++++++++++++++++++
>  pc-bios/s390-ccw/virtio-net.c    | 135 +++++++++++++++
>  pc-bios/s390-ccw/virtio-scsi.c   |   1 +
>  pc-bios/s390-ccw/virtio.c        | 306 ++++-----------------------------
>  pc-bios/s390-ccw/virtio.h        |  46 ++---
>  roms/SLOF                        |   2 +-
>  16 files changed, 1018 insertions(+), 388 deletions(-)
>  create mode 100644 pc-bios/s390-ccw/bswap.h
>  create mode 100644 pc-bios/s390-ccw/libc.h
>  create mode 100644 pc-bios/s390-ccw/netboot.mak
>  create mode 100644 pc-bios/s390-ccw/netmain.c
>  create mode 100644 pc-bios/s390-ccw/virtio-blkdev.c
>  create mode 100644 pc-bios/s390-ccw/virtio-net.c
> 
With the patches applied I could successfully perform a network boot
using a libvirt-defined dnsmasq TFTP server (even emulating a PXELINUX
setup with a special crafted boot image :-). So, FWIW:

(Series) Tested-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>

-- 

Mit freundlichen Grüßen/Kind Regards
   Viktor Mihajlovski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Köderitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


Re: [Qemu-devel] [PATCH v5 00/11] Implement network booting in the s390-ccw BIOS
Posted by no-reply@patchew.org 6 years, 8 months ago
Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 1499863793-18627-1-git-send-email-thuth@redhat.com
Subject: [Qemu-devel] [PATCH v5 00/11] Implement network booting in the s390-ccw BIOS

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
f1b84c9 pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP load
e503195 pc-bios/s390-ccw: Add virtio-net driver code
b1c645d pc-bios/s390-ccw: Add core files for the network bootloading program
e73c389 roms/SLOF: Update submodule to latest status
b54fa54 pc-bios/s390-ccw: Add code for virtio feature negotiation
bbd5677 pc-bios/s390-ccw: Remove unused structs from virtio.h
a576747 pc-bios/s390-ccw: Move byteswap functions to a separate header
5b05827 pc-bios/s390-ccw: Add a write() function for stdio
a71e81f pc-bios/s390-ccw: Move virtio-block related functions into a separate file
6f36844 pc-bios/s390-ccw: Move ebc2asc to sclp.c
d609df1 pc-bios/s390-ccw: Move libc functions to separate header

=== OUTPUT BEGIN ===
Checking PATCH 1/11: pc-bios/s390-ccw: Move libc functions to separate header...
Checking PATCH 2/11: pc-bios/s390-ccw: Move ebc2asc to sclp.c...
Checking PATCH 3/11: pc-bios/s390-ccw: Move virtio-block related functions into a separate file...
Checking PATCH 4/11: pc-bios/s390-ccw: Add a write() function for stdio...
ERROR: externs should be avoided in .c files
#23: FILE: pc-bios/s390-ccw/sclp.c:15:
+long write(int fd, const void *str, size_t len);

total: 1 errors, 0 warnings, 37 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 5/11: pc-bios/s390-ccw: Move byteswap functions to a separate header...
Checking PATCH 6/11: pc-bios/s390-ccw: Remove unused structs from virtio.h...
Checking PATCH 7/11: pc-bios/s390-ccw: Add code for virtio feature negotiation...
Checking PATCH 8/11: roms/SLOF: Update submodule to latest status...
Checking PATCH 9/11: pc-bios/s390-ccw: Add core files for the network bootloading program...
ERROR: externs should be avoided in .c files
#127: FILE: pc-bios/s390-ccw/netmain.c:26:
+extern char _start[];

ERROR: externs should be avoided in .c files
#130: FILE: pc-bios/s390-ccw/netmain.c:29:
+IplParameterBlock iplb __attribute__((aligned(PAGE_SIZE)));

total: 2 errors, 0 warnings, 204 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 10/11: pc-bios/s390-ccw: Add virtio-net driver code...
Checking PATCH 11/11: pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP load...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org