pc-bios/s390-ccw: Allow network booting via pxelinux.cfg
PATCH v2 1/4 roms: Update SLOF submodule to current status
In reply to Thomas HuthWe need the latest version of SLOF's libnet for adding pxelinux.cfg support in the s390-ccw bios, too.
---
I assume that Alexey will send a SLOF update soon, too, which supplies the SLOF.bin file for these changes.
roms/SLOF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
roms/SLOF +1 -1
@@ -1 +1 @@ -Subproject commit fa981320a1e0968d6fc1b8de319723ff8212b337 +Subproject commit 2317427ce76006723f7ae103a6998ab41dd79c68
Signature · 1 line
1.8.3.1
PATCH v2 2/4 pc-bios/s390-ccw/net: Update code for the latest changes in SLOF
In reply to Thomas HuthThe ip_version information now has to be stored in the filename_ip_t structure, and there is now a common function called tftp_get_error_info() which can be used to get the error string for a TFTP error code. We can also get rid of some superfluous "(char *)" casts now.
--- pc-bios/s390-ccw/netboot.mak | 2 +- pc-bios/s390-ccw/netmain.c | 86 +++++++++----------------------------------- 2 files changed, 18 insertions(+), 70 deletions(-)
pc-bios/s390-ccw/netboot.mak +1 -1
@@ -34,7 +34,7 @@ STDLIB_OBJS = atoi.o atol.o strtoul.o strtol.o rand.o malloc.o free.o %.o : $(SLOF_DIR)/lib/libc/stdlib/%.c $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,"CC","$(TARGET_DIR)$@") -STDIO_OBJS = sprintf.o vfprintf.o vsnprintf.o vsprintf.o fprintf.o \ +STDIO_OBJS = sprintf.o snprintf.o vfprintf.o vsnprintf.o vsprintf.o fprintf.o \ printf.o putc.o puts.o putchar.o stdchnls.o fileno.o %.o : $(SLOF_DIR)/lib/libc/stdio/%.c $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,"CC","$(TARGET_DIR)$@")
pc-bios/s390-ccw/netmain.c +17 -69
159 lines not on this page · raw message
Signature · 1 line
1.8.3.1
v2 cover pc-bios/s390-ccw: Allow network booting via pxelinux.cfg
This patch series adds pxelinux.cfg-style network booting to the s390-ccw firmware. The core pxelinux.cfg loading and parsing logic has recently been merged to SLOF, so these patches now just have to make sure to call the right functions to get the config file loaded and parsed. Once this is done, the kernel and initrd are loaded separately, and are then glued together in RAM.
v2:
- Update SLOF submodule now that the git mirror is in sync again
- Last parameter to tftp_get_error_info() must not be NULL
- Check CC when calling STSI, and use a #define for the UUID offset
- Only support files with the magic "# pxelinux" string comment when trying to guess the contents of a file that has been downloaded via the "bootfile" DHCP parameter. This is just for developers' convenience, the official way to specify pxelinux.cfg files is to use the DHCP options 209 and 210 instead.
Thomas Huth (4):
roms: Update SLOF submodule to current status pc-bios/s390-ccw/net: Update code for the latest changes in SLOF pc-bios/s390-ccw/net: Add support for pxelinux-style config files pc-bios/s390-ccw/net: Try to load pxelinux.cfg file accoring to the
UUID
pc-bios/s390-ccw/netboot.mak | 9 +- pc-bios/s390-ccw/netmain.c | 226 +++++++++++++++++++++++++++++-------------- roms/SLOF | 2 +- 3 files changed, 162 insertions(+), 75 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v2 3/4 pc-bios/s390-ccw/net: Add support for pxelinux-style config files
Since it is quite cumbersome to manually create a combined kernel with initrd image for network booting, we now support loading via pxelinux configuration files, too. In these files, the kernel, initrd and command line parameters can be specified seperately, and the firmware then takes care of glueing everything together in memory after the files have been downloaded. See this URL for details about the config file layout:
https://www.syslinux.org/wiki/index.php?title=PXELINUX
The user can either specify a config file directly as bootfile via DHCP (but in this case, the file has to start with the magic "# pxelinux" comment so we can distinguish it from binary kernels), or a folder (i.e. the bootfile name must end with "/") where the firmware should look for the typical pxelinux.cfg file names, e.g. based on MAC or IP address. We also support the pxelinux.cfg DHCP options 209 and 210 from RFC 5071.
--- pc-bios/s390-ccw/netboot.mak | 7 ++-- pc-bios/s390-ccw/netmain.c | 86 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 89 insertions(+), 4 deletions(-)
pc-bios/s390-ccw/netboot.mak +4 -3
@@ -25,8 +25,9 @@ CTYPE_OBJS = isdigit.o isxdigit.o toupper.o %.o : $(SLOF_DIR)/lib/libc/ctype/%.c $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,"CC","$(TARGET_DIR)$@") -STRING_OBJS = strcat.o strchr.o strcmp.o strcpy.o strlen.o strncmp.o strncpy.o \ - strstr.o memset.o memcpy.o memmove.o memcmp.o +STRING_OBJS = strcat.o strchr.o strrchr.o strcpy.o strlen.o strncpy.o \ + strcmp.o strncmp.o strcasecmp.o strncasecmp.o strstr.o \ + memset.o memcpy.o memmove.o memcmp.o %.o : $(SLOF_DIR)/lib/libc/string/%.c $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,"CC","$(TARGET_DIR)$@")
@@ -50,7 +51,7 @@ libc.a: $(LIBCOBJS) # libnet files: LIBNETOBJS := args.o dhcp.o dns.o icmpv6.o ipv6.o tcp.o udp.o bootp.o \ - dhcpv6.o ethernet.o ipv4.o ndp.o tftp.o + dhcpv6.o ethernet.o ipv4.o ndp.o tftp.o pxelinux.o LIBNETCFLAGS := $(QEMU_CFLAGS) -DDHCPARCH=0x1F $(LIBC_INC) $(LIBNET_INC) %.o : $(SLOF_DIR)/lib/libnet/%.c
pc-bios/s390-ccw/netmain.c +85 -1
128 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 4/4 pc-bios/s390-ccw/net: Try to load pxelinux.cfg file accoring to the UUID
In reply to Thomas HuthWith the STSI instruction, we can get the UUID of the current VM instance, so we can support loading pxelinux config files via UUID in the file name, too.
--- pc-bios/s390-ccw/netmain.c | 56 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-)
pc-bios/s390-ccw/netmain.c +55 -1
@@ -44,6 +44,9 @@ extern char _start[];#define KERNEL_MAX_SIZE ((long)_start)#define ARCH_COMMAND_LINE_SIZE 896/* Taken from Linux kernel */ +/* STSI 3.2.2 offset of first vmdb + offset of uuid inside vmdb */ +#define STSI322_VMDB_UUID_OFFSET ((8 + 12) * 4) + char stack[PAGE_SIZE * 8] __attribute__((aligned(PAGE_SIZE))); IplParameterBlock iplb __attribute__((aligned(PAGE_SIZE)));static char cfgbuf[2048 ];
@@ -236,6 +239,56 @@ static void net_release(filename_ip_t *fn_ip) }/** +* Retrieve the Universally Unique Identifier of the VM. +* @return UUID string, or NULL in case of errors +*/ +static const char *get_uuid (void ) +{ + registerint r0 asm("0" ); + registerint r1 asm("1" ); +uint8_t *mem, *buf, uuid[16 ]; +int i, cc, chk =0 ; +static char uuid_str[37 ]; + + mem =malloc (2 *PAGE_SIZE ); +if (!mem) { +puts ("Out of memory ... can not get UUID." ); +return NULL ; + } + buf = (uint8_t *)(((uint64_t )mem +PAGE_SIZE -1 ) & ~(PAGE_SIZE -1 )); +memset (buf,0 ,PAGE_SIZE ); + +/* Get SYSIB 3.2.2 */ + r0 = (3 <<28 ) |2 ; + r1 =2 ; + asmvolatile (" stsi 0(%[addr])\n" +" ipm %[cc]\n" +" srl %[cc],28\n" + : [cc]"=d" (cc) + :"d" (r0),"d" (r1), [addr]"a" (buf) + :"cc" ,"memory" ); +if (cc) { +return NULL ; + } + +for (i =0 ; i <16 ; i++) { + uuid[i] = buf[STSI322_VMDB_UUID_OFFSET + i]; + chk |= uuid[i]; + } +free (mem); +if (!chk) { +return NULL ; + } + +sprintf (uuid_str,"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" +"%02x%02x%02x%02x%02x%02x" , uuid[0 ], uuid[1 ], uuid[2 ], uuid[3 ], + uuid[4 ], uuid[5 ], uuid[6 ], uuid[7 ], uuid[8 ], uuid[9 ], uuid[10 ], + uuid[11 ], uuid[12 ], uuid[13 ], uuid[14 ], uuid[15 ]); + +return uuid_str; +} + +/** * Load a kernel with initrd (i.e. with the information that we've got from * a pxelinux.cfg config file) */
@@ -285,7 +338,8 @@ static int net_try_pxelinux_cfg(filename_ip_t *fn_ip)struct pl_cfg_entry entries[MAX_PXELINUX_ENTRIES ];int num_ent, def_ent =0 ; - num_ent =pxelinux_load_parse_cfg (fn_ip, mac,NULL ,DEFAULT_TFTP_RETRIES , + num_ent =pxelinux_load_parse_cfg (fn_ip, mac,get_uuid (), +DEFAULT_TFTP_RETRIES , cfgbuf,sizeof (cfgbuf), entries,MAX_PXELINUX_ENTRIES , &def_ent);if (num_ent >0 ) {
Signature · 1 line
1.8.3.1
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH v2 0/4] pc-bios/s390-ccw: Allow network booting via pxelinux.cfg
=== 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
git config --local diff.algorithm histogram
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
From https://github.com/patchew-project/qemu
5d328d7d2f..8e36d27c5a master -> master * [new tag] patchew/[email protected] -> patchew/[email protected] * [new tag] patchew/[email protected] -> patchew/[email protected] t [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'132ffa3587 pc-bios/s390-ccw/net: Try to load pxelinux.cfg file accoring to the UUID b3b73613ba pc-bios/s390-ccw/net: Add support for pxelinux-style config files 699020402a pc-bios/s390-ccw/net: Update code for the latest changes in SLOF 5dd76a9c89 roms: Update SLOF submodule to current status
=== OUTPUT BEGIN ===
Checking PATCH 1/4: roms: Update SLOF submodule to current status...
Checking PATCH 2/4: pc-bios/s390-ccw/net: Update code for the latest changes in SLOF... Checking PATCH 3/4: pc-bios/s390-ccw/net: Add support for pxelinux-style config files... Checking PATCH 4/4: pc-bios/s390-ccw/net: Try to load pxelinux.cfg file accoring to the UUID...
ERROR: space prohibited before open square bracket '['
#57: FILE: pc-bios/s390-ccw/netmain.c:267:
+ : [cc] "=d" (cc)
total: 1 errors, 0 warnings, 74 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.
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Quoted 46 lines · On 07.06.2018 14:31, [email protected] wrote:
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH v2 0/4] pc-bios/s390-ccw: Allow network booting via pxelinux.cfg=== TEST SCRIPT BEGIN ===
#!/bin/bashBASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogramcommits="$(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
From https://github.com/patchew-project/qemu5d328d7d2f..8e36d27c5a master -> master * [new tag] patchew/[email protected] -> patchew/[email protected] * [new tag] patchew/[email protected] -> patchew/[email protected] t [tag update] patchew/[email protected] -> patchew/[email protected]Switched to a new branch 'test'
132ffa3587pc-bios/s390-ccw/net: Try to load pxelinux.cfg file accoring to the UUIDb3b73613bapc-bios/s390-ccw/net: Add support for pxelinux-style config files699020402apc-bios/s390-ccw/net: Update code for the latest changes in SLOF5dd76a9c89roms: Update SLOF submodule to current status
Quoted 8 lines
=== OUTPUT BEGIN ===
Checking PATCH 1/4: roms: Update SLOF submodule to current status...
Checking PATCH 2/4: pc-bios/s390-ccw/net: Update code for the latest changes in SLOF... Checking PATCH 3/4: pc-bios/s390-ccw/net: Add support for pxelinux-style config files... Checking PATCH 4/4: pc-bios/s390-ccw/net: Try to load pxelinux.cfg file accoring to the UUID...
ERROR: space prohibited before open square bracket '['
#57: FILE:pc-bios/s390-ccw/netmain.c:267:
+ : [cc] "=d" (cc)
Patchew obviously does not know about inline assembly ... I think I prefer to keep the space here.
Thomas
Re: [Qemu-devel] [qemu-s390x] [PATCH v2 2/4] pc-bios/s390-ccw/net: Update code for the latest changes in SLOF
In reply to Thomas HuthQuoted 6 lines · Thomas Huth
The
ip_versioninformation now has to be stored in thefilename_ip_tstructure, and there is now a common function calledtftp_get_error_info()which can be used to get the error string for a TFTP error code. We can also get rid of some superfluous "(char *)" casts now.Signed-off-by Thomas Huth <[email protected]>
Quoted 192 lines
--- pc-bios/s390-ccw/netboot.mak | 2 +- pc-bios/s390-ccw/netmain.c | 86 +++++++++----------------------------------- 2 files changed, 18 insertions(+), 70 deletions(-)pc-bios/s390-ccw/netboot.mak +1
-1@@ -34,7 +34,7 @@ STDLIB_OBJS = atoi.o atol.o strtoul.o strtol.o rand.o malloc.o free.o %.o : $(SLOF_DIR)/lib/libc/stdlib/%.c $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,"CC","$(TARGET_DIR)$@") -STDIO_OBJS = sprintf.o vfprintf.o vsnprintf.o vsprintf.o fprintf.o \ +STDIO_OBJS = sprintf.o snprintf.o vfprintf.o vsnprintf.o vsprintf.o fprintf.o \ printf.o putc.o puts.o putchar.o stdchnls.o fileno.o %.o : $(SLOF_DIR)/lib/libc/stdio/%.c $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,"CC","$(TARGET_DIR)$@")pc-bios/s390-ccw/netmain.c +17
-69@@ -47,7 +47,6 @@ IplParameterBlock iplb __attribute__((aligned(PAGE_SIZE)));static char cfgbuf[2048 ];static SubChannelId net_schid = { .one =1 }; -static int ip_version =4 ;static uint64_t dest_timer;static uint64_t get_timer_ms (void )@@ -100,10 +99,10 @@ static int dhcp(struct filename_ip *fn_ip, int retries)printf ("\nGiving up after %d DHCP requests\n" , retries);return -1 ; } - ip_version =4 ; + fn_ip->ip_version =4 ; rc =dhcpv4 (NULL , fn_ip);if (rc ==-1 ) { - ip_version =6 ; + fn_ip->ip_version =6 ;set_ipv6_address (fn_ip->fd,0 ); rc =dhcpv6 (NULL , fn_ip);if (rc ==0 ) {@@ -137,8 +136,7 @@ static int tftp_load(filename_ip_t *fnip, void *buffer, int len)tftp_err_t tftp_err;int rc; - rc =tftp (fnip, buffer, len,DEFAULT_TFTP_RETRIES , &tftp_err,1 ,1428 , - ip_version); + rc =tftp (fnip, buffer, len,DEFAULT_TFTP_RETRIES , &tftp_err);if (rc <0 ) {/* Make sure that error messages are put into a new line */ @@ -149,61 +147,11 @@ static int tftp_load(filename_ip_t *fnip, void *buffer, int len)printf (" TFTP: Received %s (%d KBytes)\n" , fnip->filename, rc /1024 ); }else if (rc >0 ) {printf (" TFTP: Received %s (%d Bytes)\n" , fnip->filename, rc); - }else if (rc ==-1 ) { -puts ("unknown TFTP error" ); - }else if (rc ==-2 ) { -printf ("TFTP buffer of %d bytes is too small for %s\n" , - len, fnip->filename); - }else if (rc ==-3 ) { -printf ("file not found: %s\n" , fnip->filename); - }else if (rc ==-4 ) { -puts ("TFTP access violation" ); - }else if (rc ==-5 ) { -puts ("illegal TFTP operation" ); - }else if (rc ==-6 ) { -puts ("unknown TFTP transfer ID" ); - }else if (rc ==-7 ) { -puts ("no such TFTP user" ); - }else if (rc ==-8 ) { -puts ("TFTP blocksize negotiation failed" ); - }else if (rc ==-9 ) { -puts ("file exceeds maximum TFTP transfer size" ); - }else if (rc <=-10 && rc >=-15 ) { -const char *icmp_err_str; -switch (rc) { -case -ICMP_NET_UNREACHABLE -10 : - icmp_err_str ="net unreachable" ; -break ; -case -ICMP_HOST_UNREACHABLE -10 : - icmp_err_str ="host unreachable" ; -break ; -case -ICMP_PROTOCOL_UNREACHABLE -10 : - icmp_err_str ="protocol unreachable" ; -break ; -case -ICMP_PORT_UNREACHABLE -10 : - icmp_err_str ="port unreachable" ; -break ; -case -ICMP_FRAGMENTATION_NEEDED -10 : - icmp_err_str ="fragmentation needed and DF set" ; -break ; -case -ICMP_SOURCE_ROUTE_FAILED -10 : - icmp_err_str ="source route failed" ; -break ; -default : - icmp_err_str =" UNKNOWN" ; -break ; - } -printf ("ICMP ERROR \"%s\"\n" , icmp_err_str); - }else if (rc ==-40 ) { -printf ("TFTP error occurred after %d bad packets received" , - tftp_err.bad_tftp_packets); - }else if (rc ==-41 ) { -printf ("TFTP error occurred after missing %d responses" , - tftp_err.no_packets); - }else if (rc ==-42 ) { -printf ("TFTP error missing block %d, expected block was %d" , - tftp_err.blocks_missed, - tftp_err.blocks_received); + }else { +const char *errstr =NULL ; +int ecode; +tftp_get_error_info (fnip, &tftp_err, rc, &errstr, &ecode); +printf ("TFTP error: %s\n" , errstr ? errstr :"unknown error" ); }return rc;@@ -231,7 +179,7 @@ static int net_init(filename_ip_t *fn_ip) rc =dhcp (fn_ip,DEFAULT_BOOT_RETRIES );if (rc >=0 ) { -if (ip_version ==4 ) { +if (fn_ip->ip_version ==4 ) {set_ipv4_address (fn_ip->own_ip); } }else {@@ -239,11 +187,11 @@ static int net_init(filename_ip_t *fn_ip)return -101 ; } -if (ip_version ==4 ) { +if (fn_ip->ip_version ==4 ) {printf (" Using IPv4 address: %d.%d.%d.%d\n" , (fn_ip->own_ip >>24 ) &0xFF , (fn_ip->own_ip >>16 ) &0xFF , (fn_ip->own_ip >>8 ) &0xFF , fn_ip->own_ip &0xFF ); - }else if (ip_version ==6 ) { + }else if (fn_ip->ip_version ==6 ) {char ip6_str[40 ];ipv6_to_str (fn_ip->own_ip6.addr, ip6_str);printf (" Using IPv6 address: %s\n" , ip6_str);@@ -261,17 +209,17 @@ static int net_init(filename_ip_t *fn_ip) }printf (" Using TFTP server: " ); -if (ip_version ==4 ) { +if (fn_ip->ip_version ==4 ) {printf ("%d.%d.%d.%d\n" , (fn_ip->server_ip >>24 ) &0xFF , (fn_ip->server_ip >>16 ) &0xFF , (fn_ip->server_ip >>8 ) &0xFF , fn_ip->server_ip &0xFF ); - }else if (ip_version ==6 ) { + }else if (fn_ip->ip_version ==6 ) {char ip6_str[40 ];ipv6_to_str (fn_ip->server_ip6.addr, ip6_str);printf ("%s\n" , ip6_str); } -if (strlen ((char *)fn_ip->filename) >0 ) { +if (strlen (fn_ip->filename) >0 ) {printf (" Bootfile name: '%s'\n" , fn_ip->filename); }@@ -280,7 +228,7 @@ static int net_init(filename_ip_t *fn_ip)static void net_release (filename_ip_t *fn_ip) { -if (ip_version ==4 ) { +if (fn_ip->ip_version ==4 ) {dhcp_send_release (fn_ip->fd); } }@@ -322,7 +270,7 @@ static int handle_ins_cfg(filename_ip_t *fn_ip, char *cfg, int cfgsize)return -1 ; } *ptr =0 ; -strncpy ((char *)fn_ip->filename, insbuf,sizeof (fn_ip->filename)); +strncpy (fn_ip->filename, insbuf,sizeof (fn_ip->filename)); destaddr = (char *)atol (ptr +1 ); rc =tftp_load (fn_ip, destaddr, (long )_start - (long )destaddr);if (rc <=0 ) {@@ -455,7 +403,7 @@ void main(void)panic ("Network initialization failed. Halting.\n" ); } - fnlen =strlen ((char *)fn_ip.filename); + fnlen =strlen (fn_ip.filename);if (fnlen >0 && fn_ip.filename[fnlen -1 ] !='/' ) { rc =net_try_direct_tftp_load (&fn_ip); }
Quoted 24 lines · Thomas Huth
This patch series adds pxelinux.cfg-style network booting to the s390-ccw firmware. The core pxelinux.cfg loading and parsing logic has recently been merged to SLOF, so these patches now just have to make sure to call the right functions to get the config file loaded and parsed. Once this is done, the kernel and initrd are loaded separately, and are then glued together in RAM.
v2:
- Update SLOF submodule now that the git mirror is in sync again
- Last parameter totftp_get_error_info()must not be NULL
- Check CC when calling STSI, and use a #define for the UUID offset
- Only support files with the magic "# pxelinux" string comment when trying to guess the contents of a file that has been downloaded via the "bootfile" DHCP parameter. This is just for developers' convenience, the official way to specify pxelinux.cfg files is to use the DHCP options 209 and 210 instead.Thomas Huth (4):
roms: Update SLOF submodule to current status pc-bios/s390-ccw/net: Update code for the latest changes in SLOF pc-bios/s390-ccw/net: Add support for pxelinux-style config files pc-bios/s390-ccw/net: Try to load pxelinux.cfg file accoring to the
UUID
Quoted 5 lines
pc-bios/s390-ccw/netboot.mak | 9 +- pc-bios/s390-ccw/netmain.c | 226 +++++++++++++++++++++++++++++-------------- roms/SLOF | 2 +- 3 files changed, 162 insertions(+), 75 deletions(-)
I tested the series both with a self-created pxelinux.0 blob (to verify backward compatibility) and without an existing pxelinux.0 file (to force the standard pxelinux pattern). Both worked as expected, although the built-in search took significantly longer (timeout?).
Signature · 2 lines
Regards, Viktor Mihajlovski
Quoted 24 lines · Thomas Huth
This patch series adds pxelinux.cfg-style network booting to the s390-ccw firmware. The core pxelinux.cfg loading and parsing logic has recently been merged to SLOF, so these patches now just have to make sure to call the right functions to get the config file loaded and parsed. Once this is done, the kernel and initrd are loaded separately, and are then glued together in RAM.
v2:
- Update SLOF submodule now that the git mirror is in sync again
- Last parameter totftp_get_error_info()must not be NULL
- Check CC when calling STSI, and use a #define for the UUID offset
- Only support files with the magic "# pxelinux" string comment when trying to guess the contents of a file that has been downloaded via the "bootfile" DHCP parameter. This is just for developers' convenience, the official way to specify pxelinux.cfg files is to use the DHCP options 209 and 210 instead.Thomas Huth (4):
roms: Update SLOF submodule to current status pc-bios/s390-ccw/net: Update code for the latest changes in SLOF pc-bios/s390-ccw/net: Add support for pxelinux-style config files pc-bios/s390-ccw/net: Try to load pxelinux.cfg file accoring to the
UUID
Quoted 5 lines
pc-bios/s390-ccw/netboot.mak | 9 +- pc-bios/s390-ccw/netmain.c | 226 +++++++++++++++++++++++++++++-------------- roms/SLOF | 2 +- 3 files changed, 162 insertions(+), 75 deletions(-)
Series
Quoted 30 lines · Viktor VM Mihajlovski
Quoted 24 lines · Thomas Huth
This patch series adds pxelinux.cfg-style network booting to the s390-ccw firmware. The core pxelinux.cfg loading and parsing logic has recently been merged to SLOF, so these patches now just have to make sure to call the right functions to get the config file loaded and parsed. Once this is done, the kernel and initrd are loaded separately, and are then glued together in RAM.
v2:
- Update SLOF submodule now that the git mirror is in sync again
- Last parameter totftp_get_error_info()must not be NULL
- Check CC when calling STSI, and use a #define for the UUID offset
- Only support files with the magic "# pxelinux" string comment when trying to guess the contents of a file that has been downloaded via the "bootfile" DHCP parameter. This is just for developers' convenience, the official way to specify pxelinux.cfg files is to use the DHCP options 209 and 210 instead.Thomas Huth (4):
roms: Update SLOF submodule to current status pc-bios/s390-ccw/net: Update code for the latest changes in SLOF pc-bios/s390-ccw/net: Add support for pxelinux-style config files pc-bios/s390-ccw/net: Try to load pxelinux.cfg file accoring to the
UUIDQuoted 5 lines
pc-bios/s390-ccw/netboot.mak | 9 +- pc-bios/s390-ccw/netmain.c | 226 +++++++++++++++++++++++++++++-------------- roms/SLOF | 2 +- 3 files changed, 162 insertions(+), 75 deletions(-)
Quoted 6 lines
I tested the series both with a self-created pxelinux.0 blob (to verify backward compatibility) and without an existing pxelinux.0 file (to force the standard pxelinux pattern). Both worked as expected, although the built-in search took significantly longer (timeout?).
Tested-by Viktor Mihajlovski <[email protected]>
Thanks a lot for the testing!
Hmm, I've got no real clue why there should be a big difference in the amount of time here ... is there maybe a lot of unrelated broadcast network traffic from other hosts going on in that network where you've tested it? It could be that the virtio-net driver of the s390-ccw bios can not deal with that situation very well yet. You could try to increase the "64" in virtio_net_init() in pc-bios/s390-ccw/virtio-net.c to see whether it makes a difference. Or if you've got some spare time, could you maybe run Wireshark on the server side to have a look at the time-stamps of the related packets, and to see whether there are duplicated TFTP read requests? This could indicate that the firmware missed a packet and thus ran into a timeout.
Thomas
PS: After I posted v1 of the patch set, you reported on IRC that you saw a problem with a corrupted initrd download or something similar. Is that problem now fixed for you?
Quoted 40 lines · Thomas Huth
Quoted 30 lines · Viktor VM Mihajlovski
Quoted 24 lines · Thomas Huth
This patch series adds pxelinux.cfg-style network booting to the s390-ccw firmware. The core pxelinux.cfg loading and parsing logic has recently been merged to SLOF, so these patches now just have to make sure to call the right functions to get the config file loaded and parsed. Once this is done, the kernel and initrd are loaded separately, and are then glued together in RAM.
v2:
- Update SLOF submodule now that the git mirror is in sync again
- Last parameter totftp_get_error_info()must not be NULL
- Check CC when calling STSI, and use a #define for the UUID offset
- Only support files with the magic "# pxelinux" string comment when trying to guess the contents of a file that has been downloaded via the "bootfile" DHCP parameter. This is just for developers' convenience, the official way to specify pxelinux.cfg files is to use the DHCP options 209 and 210 instead.Thomas Huth (4):
roms: Update SLOF submodule to current status pc-bios/s390-ccw/net: Update code for the latest changes in SLOF pc-bios/s390-ccw/net: Add support for pxelinux-style config files pc-bios/s390-ccw/net: Try to load pxelinux.cfg file accoring to the
UUIDQuoted 5 lines
pc-bios/s390-ccw/netboot.mak | 9 +- pc-bios/s390-ccw/netmain.c | 226 +++++++++++++++++++++++++++++-------------- roms/SLOF | 2 +- 3 files changed, 162 insertions(+), 75 deletions(-)Quoted 6 lines
I tested the series both with a self-created pxelinux.0 blob (to verify backward compatibility) and without an existing pxelinux.0 file (to force the standard pxelinux pattern). Both worked as expected, although the built-in search took significantly longer (timeout?).
Tested-by Viktor Mihajlovski <[email protected]>Thanks a lot for the testing!
Quoted 11 lines
Hmm, I've got no real clue why there should be a big difference in the amount of time here ... is there maybe a lot of unrelated broadcast network traffic from other hosts going on in that network where you've tested it? It could be that the virtio-net driver of the s390-ccw bios can not deal with that situation very well yet. You could try to increase the "64" in
virtio_net_init()inpc-bios/s390-ccw/virtio-net.cto see whether it makes a difference. Or if you've got some spare time, could you maybe run Wireshark on the server side to have a look at the time-stamps of the related packets, and to see whether there are duplicated TFTP read requests? This could indicate that the firmware missed a packet and thus ran into a timeout.
FWIW: I'm using the isolated libvirt network on an otherwise idle host, so it's unlikely that there's interference. If I find the time I'll have a look at the traffic.
Quoted 7 lines
Thomas
PS: After I posted v1 of the patch set, you reported on IRC that you saw a problem with a corrupted initrd download or something similar. Is that problem now fixed for you?
Yes, it was my bad. I used an older kernel with the following problem
https://lkml.org/lkml/2017/3/13/683.
Signature · 2 lines
Regards, Viktor Mihajlovski
Quoted 52 lines · Viktor VM Mihajlovski
Quoted 40 lines · Thomas Huth
Quoted 30 lines · Viktor VM Mihajlovski
Quoted 24 lines · Thomas Huth
This patch series adds pxelinux.cfg-style network booting to the s390-ccw firmware. The core pxelinux.cfg loading and parsing logic has recently been merged to SLOF, so these patches now just have to make sure to call the right functions to get the config file loaded and parsed. Once this is done, the kernel and initrd are loaded separately, and are then glued together in RAM.
v2:
- Update SLOF submodule now that the git mirror is in sync again
- Last parameter totftp_get_error_info()must not be NULL
- Check CC when calling STSI, and use a #define for the UUID offset
- Only support files with the magic "# pxelinux" string comment when trying to guess the contents of a file that has been downloaded via the "bootfile" DHCP parameter. This is just for developers' convenience, the official way to specify pxelinux.cfg files is to use the DHCP options 209 and 210 instead.Thomas Huth (4):
roms: Update SLOF submodule to current status pc-bios/s390-ccw/net: Update code for the latest changes in SLOF pc-bios/s390-ccw/net: Add support for pxelinux-style config files pc-bios/s390-ccw/net: Try to load pxelinux.cfg file accoring to the
UUIDQuoted 5 lines
pc-bios/s390-ccw/netboot.mak | 9 +- pc-bios/s390-ccw/netmain.c | 226 +++++++++++++++++++++++++++++-------------- roms/SLOF | 2 +- 3 files changed, 162 insertions(+), 75 deletions(-)Quoted 6 lines
I tested the series both with a self-created pxelinux.0 blob (to verify backward compatibility) and without an existing pxelinux.0 file (to force the standard pxelinux pattern). Both worked as expected, although the built-in search took significantly longer (timeout?).
Tested-by Viktor Mihajlovski <[email protected]>Thanks a lot for the testing!
Quoted 11 lines
Hmm, I've got no real clue why there should be a big difference in the amount of time here ... is there maybe a lot of unrelated broadcast network traffic from other hosts going on in that network where you've tested it? It could be that the virtio-net driver of the s390-ccw bios can not deal with that situation very well yet. You could try to increase the "64" in
virtio_net_init()inpc-bios/s390-ccw/virtio-net.cto see whether it makes a difference. Or if you've got some spare time, could you maybe run Wireshark on the server side to have a look at the time-stamps of the related packets, and to see whether there are duplicated TFTP read requests? This could indicate that the firmware missed a packet and thus ran into a timeout.
Quoted 3 lines
FWIW: I'm using the isolated libvirt network on an otherwise idle host, so it's unlikely that there's interference. If I find the time I'll have a look at the traffic.
If you have the time to look at the traffic, could you please also check the TFTP block size option that is negotiated at the beginning of the TFTP transfer? If this other client is negotiating a transfer block size that is bigger than the one from the s390-ccw firmware, this could explain the differences in the downloading time, too.
libnet from SLOF currently uses a block size of 1428. This is the size where all TFTP data should still fit nicely into one ethernet packet - and this is also the size which is still supported by all TFTP servers that support the blksize option. But theoretically it's also possible to use a bigger block sizes if both, the server and the client support fragmented UDP packets. Unfortunately, as far as I can see, SLOF's libnet does not support fragmented UDP packets, so we can't increase the block size here anymore so easily.
Can you tell which tftp client you are using in your other pxelinux.0 blob? (busybox tftp? HPA-tftp ?)
Thomas
Quoted 1 line · Thomas Huth
On 11.06.2018 14:03, Viktor VM Mihajlovski wrote:
[...]
Quoted 7 lines
If you have the time to look at the traffic, could you please also check the TFTP block size option that is negotiated at the beginning of the TFTP transfer? If this other client is negotiating a transfer block size that is bigger than the one from the s390-ccw firmware, this could explain the differences in the downloading time, too.
Quoted 8 lines
libnet from SLOF currently uses a block size of 1428. This is the size where all TFTP data should still fit nicely into one ethernet packet - and this is also the size which is still supported by all TFTP servers that support the blksize option. But theoretically it's also possible to use a bigger block sizes if both, the server and the client support fragmented UDP packets. Unfortunately, as far as I can see, SLOF's libnet does not support fragmented UDP packets, so we can't increase the block size here anymore so easily.
You will be pleased to hear that the SLOF TFTP client outperforms the busybox version (which uses 544-byte packets) by 30%. There's some randomness introduced by the differences in DHCP response times which is clearly not the client's fault. All is good...
[...]
Signature · 2 lines
Regards, Viktor Mihajlovski
Quoted 19 lines · Viktor VM Mihajlovski
Quoted 1 line · Thomas Huth
On 11.06.2018 14:03, Viktor VM Mihajlovski wrote:
[...]
Quoted 7 lines
If you have the time to look at the traffic, could you please also check the TFTP block size option that is negotiated at the beginning of the TFTP transfer? If this other client is negotiating a transfer block size that is bigger than the one from the s390-ccw firmware, this could explain the differences in the downloading time, too.
Quoted 8 lines
libnet from SLOF currently uses a block size of 1428. This is the size where all TFTP data should still fit nicely into one ethernet packet - and this is also the size which is still supported by all TFTP servers that support the blksize option. But theoretically it's also possible to use a bigger block sizes if both, the server and the client support fragmented UDP packets. Unfortunately, as far as I can see, SLOF's libnet does not support fragmented UDP packets, so we can't increase the block size here anymore so easily.
Quoted 4 lines
You will be pleased to hear that the SLOF TFTP client outperforms the busybox version (which uses 544-byte packets) by 30%. There's some randomness introduced by the differences in DHCP response times which is clearly not the client's fault. All is good...
Ah, great, thanks for checking!
So I'm going to prepare a pull request for this next...
Thomas