aboutsummaryrefslogtreecommitdiff
path: root/pc-bios/s390-ccw/Makefile
AgeCommit message (Collapse)AuthorFilesLines
2024-07-02pc-bios/s390-ccw: Remove duplicated LDFLAGSThomas Huth1-3/+1
The -Wl,-pie and -nostdlib flags are added to LDFLAGS twice. Merge the two lines to get rid of the duplicates. Message-ID: <20240621082422.136217-2-thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2023-06-29pc-bios/s390-ccw/Makefile: Use -z noexecstack to silence linker warningThomas Huth1-1/+1
Recent versions of ld complain when linking the s390-ccw bios: /usr/bin/ld: warning: start.o: missing .note.GNU-stack section implies executable stack /usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker We can silence the warning by telling the linker to mark the stack as not executable. Message-Id: <20230622130822.396793-1-thuth@redhat.com> Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2023-06-06pc-bios/s390-ccw: always build network bootloaderPaolo Bonzini1-5/+0
In the beginning, the network bootloader was considered experimental and thus optional, but it is well established nowadays and configure always checks for roms/SLOF before compiling pc-bios/s390-ccw. Therefore, it makes sense to always build it together with the other part of the s390-ccw bios. Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-06-06configure: move SLOF submodule handling to pc-bios/s390-ccwPaolo Bonzini1-0/+11
Move the handling of the roms/SLOF submodule out of the main Makefile, since we are going to remove submodules from the build process of QEMU. Acked-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-10-06pc-bios/s390-ccw: Adopt meson style Make outputPaolo Bonzini1-6/+6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220929114231.583801-31-alex.bennee@linaro.org>
2022-10-06pc-bios/s390-ccw: detect CC options just oncePaolo Bonzini1-8/+25
In preparation for adding Docker container support, detect compiler options just once rather than once per Make run; container startup overhead is substantial and doing the detection just once makes things faster. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220929114231.583801-15-alex.bennee@linaro.org>
2022-07-13pc-bios/s390-ccw: add -Wno-array-boundsPaolo Bonzini1-0/+1
The option generates a lot of warnings for integers casted to pointers, for example: /home/pbonzini/work/upstream/qemu/pc-bios/s390-ccw/dasd-ipl.c:174:19: warning: array subscript 0 is outside array bounds of ‘CcwSeekData[0]’ [-Warray-bounds] 174 | seekData->cyl = 0x00; | ~~~~~~~~~~~~~~^~~~~~ Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-07-06configure, pc-bios/s390-ccw: pass cross CFLAGS correctlyPaolo Bonzini1-10/+10
QEMU_CFLAGS is not available in pc-bios/s390-ccw/netboot.mak, but the Makefile needs to access the flags passed to the configure script for the s390x cross compiler. Fix everything and rename QEMU_CFLAGS to EXTRA_CFLAGS for consistency with tests/tcg. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-06-01configure: enable cross-compilation of s390-ccwPaolo Bonzini1-4/+5
While container-based cross compilers are not supported, this already makes it possible to build s390-ccw on any machine that has s390x GCC and binutils installed. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20220517092616.1272238-14-pbonzini@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220527153603.887929-25-alex.bennee@linaro.org>
2022-01-12configure: parse --enable/--disable-strip automatically, flip defaultPaolo Bonzini1-2/+0
Always include the STRIP variable in config-host.mak (it's only used by the s390-ccw firmware build, and it adds a default if configure omitted it), and use meson-buildoptions.sh to turn --enable/--disable-strip into -Dstrip. The default is now not to strip the binaries like for almost every other package that has a configure script. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-05-09pc-bios/s390-ccw: Allow building with Clang, tooThomas Huth1-1/+2
Clang unfortunately does not support generating code for the z900 architecture level and starts with the z10 instead. Thus to be able to support compiling with Clang, we have to check for the supported compiler flags. The disadvantage is of course that the bios image will only run with z10 guest CPUs upwards (which is what most people use anyway), so just in case let's also emit a warning in that case (we will continue to ship firmware images that have been pre-built with GCC in future releases, so this should not impact normal users, too). Message-Id: <20210502174836.838816-5-thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2021-05-09pc-bios/s390-ccw: Silence GCC 11 stringop-overflow warningPhilippe Mathieu-Daudé1-0/+1
When building on Fedora 34 (gcc version 11.0.0 20210210) we get: In file included from pc-bios/s390-ccw/main.c:11: In function ‘memset’, inlined from ‘boot_setup’ at pc-bios/s390-ccw/main.c:185:5, inlined from ‘main’ at pc-bios/s390-ccw/main.c:288:5: pc-bios/s390-ccw/libc.h:28:14: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] 28 | p[i] = c; | ~~~~~^~~ The offending code is: memset((char *)S390EP, 0, 6); where S390EP is a const address: #define S390EP 0x10008 The compiler doesn't know how big that pointed area is, so it assume that its length is zero. This has been reported as BZ#99578 to GCC: "gcc-11 -Warray-bounds or -Wstringop-overread warning when accessing a pointer from integer literal" https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578 As this warning does us more harm than good in the BIOS code (where lot of direct accesses to low memory are done), silence this warning for all BIOS objects. Suggested-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210422145911.2513980-1-philmd@redhat.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Message-Id: <20210502174836.838816-4-thuth@redhat.com> [thuth: Use the pre-existing cc-option macro instead of adding a new one] Reviewed-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2021-05-09pc-bios/s390-ccw: Fix the cc-option macro in the MakefileThomas Huth1-2/+2
The cc-option macro is not doing what it should - compared with the original from the rules.mak file that got removed with commit 660f793093 ("Makefile: inline the relevant parts of rules.mak"), the arguments got changed and thus the macro is rather doubling the QEMU_CFLAGS than adding the flag that should be tested. Message-Id: <20210502174836.838816-3-thuth@redhat.com> Fixes: 22fb2ab096 ("pc-bios/s390-ccw: do not use rules.mak") Signed-off-by: Thomas Huth <thuth@redhat.com>
2020-10-06pc-bios/s390-ccw/Makefile: Compile with -std=gnu99, -fwrapv and -fno-commonThomas Huth1-3/+4
The main QEMU code is compiled with -std=gnu99, -fwrapv and -fno-common. We should use the same flags for the s390-ccw bios, too, to avoid that we get different behavior with different compiler versions that changed their default settings in the course of time (it happened at least with -std=... and -fno-common in the past already). While we're at it, also group the other flags here in a little bit nicer fashion: Move the two "-m" flags out of the "-f" area and specify them on a separate line. Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Acked-by: Cornelia Huck <cohuck@redhat.com> Acked-by: Janosch Frank <frankja@linux.ibm.com> Message-Id: <20200806105349.632-2-thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2020-09-01build: fix recurse-all targetPaolo Bonzini1-1/+2
The missing "/all" suffix prevents the pc-bios/ parts of the build from running. In the meanwhile, -Wall has moved from QEMU_CFLAGS to CFLAGS. Simplify everything by not passing down CFLAGS, and add -Wall in the recursive Makefiles. Reported-by: Miroslav Rezanina <mrezanin@redhat.com> Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com> Tested-by: Thomas Huth <thuth@redhat.com> Fixes: 5e6d1573b4 ("remove Makefile.target", 2020-08-21) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-08-21pc-bios/s390-ccw: do not use rules.makThomas Huth1-1/+17
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-07-02pc-bios/s390-ccw: Generate and include dependency files in the MakefileThomas Huth1-0/+3
The Makefile of the s390-ccw bios does not handle dependencies of the *.c files from the headers yet, so that you often have to run a "make clean" to get the build right when one of the headers has been changed. Let's make sure that we generate and include dependency files for all *.c files now to avoid this problem in the future. Acked-by: Cornelia Huck <cohuck@redhat.com> Message-Id: <20200630142955.7662-1-thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2019-04-12s390-bios: Support booting from real dasd deviceJason J. Herne1-1/+1
Allows guest to boot from a vfio configured real dasd device. Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Message-Id: <1554388475-18329-16-git-send-email-jjherne@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2019-04-12s390-bios: Decouple channel i/o logic from virtioJason J. Herne1-1/+1
Create a separate library for channel i/o related code. This decouples channel i/o operations from virtio and allows us to make use of them for the real dasd boot path. Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <1554388475-18329-6-git-send-email-jjherne@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-06-18pc-bios/s390-ccw: Optimize the s390-netboot.img for sizeThomas Huth1-0/+1
The -O2 optimization flag is passed via CFLAGS to the firmware Makefile, but in netbook.mak, we've got some rules that only use QEMU_CFLAGS for compiling the libc and libnet from SLOF, so these files get compiled without optimization so far. Use CFLAGS here, too, to create faster and smaller code. We can additionally save some more bytes in the firmware images by compi- ling the code with -fno-asynchronous-unwind-tables. This will omit some ELF sections (used for stack unwinding for example) from the image that we do not need in the firmware. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-05-02pc-bios/s390-ccw/net: Use diag308 to reset machine before jumping to the OSThomas Huth1-1/+3
The netboot firmware so far simply jumped directly into the OS kernel after the download has been completed. This, however, bears the risk that the virtio-net device still might be active in the background and incoming packets are still placed into the buffers - which could destroy memory of the now-running Linux kernel in case it did not take over the device fast enough. Also the SCLP console is not put into a well-defined state here. We should hand over the system in a clean state when jumping into the kernel, so let's use the same mechanism as it's done in the main s390-ccw firmware and reset the machine with diag308 into a clean state before jumping into the OS kernel code. To be able to share the code with the main s390-ccw firmware, the related functions are now extracted from bootmap.c into a new file called jump2ipl.c. Since we now also set the boot device schid at address 184 for the network boot device, this patch also slightly changes the way how we detect the entry points for non-ELF binary images: The code now looks for the "S390EP" magic first and then jumps to 0x10000 in case it has been found. This is necessary for booting from network devices, since the normal kernel code (where the PSW at ddress 0 points to) tries to do a block load from the boot device. This of course fails for a virtio-net device and causes the kernel to abort with a panic-PSW silently. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-02-26s390-ccw: set up interactive boot menu parametersCollin L. Walling1-1/+1
Reads boot menu flag and timeout values from the iplb and sets the respective fields for the menu. Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-02-26s390-ccw: update libcCollin L. Walling1-1/+1
Moved: memcmp from bootmap.h to libc.h (renamed from _memcmp) strlen from sclp.c to libc.h (renamed from _strlen) Added C standard functions: isdigit Added non C-standard function: uitoa atoui Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Janosch Frank <frankja@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2017-08-15pc-bios/s390-ccw: Use rm command during make cleanEric Farman1-1/+1
This reverts a change that replaced the "rm -f" command with the undefined variable RM (expected to be set by make), and causes the "make clean" command to fail for a s390 target: make[1]: Entering directory '/usr/src/qemu/build/pc-bios/s390-ccw' rm -f *.timestamp *.o *.d *.img *.elf *~ *.a /bin/sh: *.o: command not found Makefile:39: recipe for target 'clean' failed make[1]: *** [clean] Error 127 make[1]: Leaving directory '/usr/src/qemu/build/pc-bios/s390-ccw' Makefile:489: recipe for target 'clean' failed make: *** [clean] Error 1 Fixes: 3e4415a751d2 ("pc-bios/s390-ccw: Add core files for the network bootloading program") Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com> Message-Id: <20170814204450.24118-2-farman@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-14pc-bios/s390-ccw: Add core files for the network bootloading programThomas Huth1-2/+9
This is just a preparation for the next steps: Add a makefile and a stripped down copy of pc-bios/s390-ccw/main.c as a basis for the network bootloader program, linked against the libc from SLOF already (which we will need for SLOF's libnet). The networking code is not included yet. Reviewed-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1499863793-18627-10-git-send-email-thuth@redhat.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2017-07-14pc-bios/s390-ccw: Move virtio-block related functions into a separate fileThomas Huth1-1/+1
The netboot code is going to link against the code from virtio.c, too, so we've got to move the virtio-block and -scsi related code out of the way. Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1499863793-18627-4-git-send-email-thuth@redhat.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2017-06-06pc-bios/s390-ccw: use STRIP variable in MakefileGreg Kurz1-1/+3
The docker-run-test-build@debian-s390x-cross target fails with: strip --strip-unneeded s390-ccw.elf -o s390-ccw.img strip: Unable to recognise the format of the input file `s390-ccw.elf' The configure script defines a STRIP makefile variable whose default value is ${cross_prefix}strip. Let's use it. We default to using the non-prefixed strip command in case --enable-debug or --disable-strip was passed to configure during a regular build. Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <149623617700.4947.12490877660892961664.stgit@bahia.lan> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2017-05-02pc-bios/s390-ccw: get LOADPARM stored in SCP Read InfoFarhan Ali1-1/+1
Obtain the loadparm value stored in SCP Read Info by performing a SCLP Read Info request. Rename sclp-ascii.c to sclp.c to reflect the changed scope of the file. 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>
2016-10-06rules.mak: quiet-command: Split command name and args to printPeter Maydell1-2/+2
The quiet-command make rule currently takes two arguments: the command and arguments to run, and a string to print if the V flag is not set (ie we are not being verbose). By convention, the string printed is of the form " NAME some args". Unfortunately to get nicely lined up output all the strings have to agree about what column the arguments should start in, which means that if we add a new quiet-command usage which wants a slightly longer CMD name then we either put up with misalignment or change every quiet-command string. Split the quiet-mode string into two, the "NAME" and the "same args" part, and use printf(1) to format the string automatically. This means we only need to change one place if we want to support a longer maximum name. In particular, we can now print 7-character names lined up properly (they are needed for the OSX "SETTOOL" invocation). Change all the uses of quiet-command to the new syntax. (Any which are missed or inadvertently reintroduced via later merges will result in slightly misformatted quiet output rather than disaster.) A few places in the pc-bios/ makefiles are updated to use "BUILD", "SIGN" and "STRIP" rather than "Building", "Signing" and "Stripping" for consistency and to keep them below 7 characters. Module .mo links now print "LD" rather than the nonstandard "LD -r". Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1475598441-27908-1-git-send-email-peter.maydell@linaro.org
2016-08-16pc-bios/s390-ccw.img: Fix buildChristian Borntraeger1-2/+4
Since commit a9c87304b76d ("build-sys: fix building with make CFLAGS=.. argument") pc-bios/s390-ccw.img build might fail with --- snip --- main.o: In function `virtio_setup': qemu/pc-bios/s390-ccw/main.c:117: undefined reference to `__stack_chk_fail' --- snip --- Changing the CFLAGS to QEMU_CFLAGS does the trick. We also need to add -fno-strict-aliasing as this was filtered out. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Message-Id: <1471258997-5811-1-git-send-email-borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-03-23pc-bios/s390-ccw: enable virtio-scsiEugene (jno) Dvurechenski1-1/+1
Make the code added before to work. Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-12-01pc-bios/s390-ccw: build for z900Christian Borntraeger1-1/+1
Newer distributions have an architecture level set to z9, z196 or similar - also as default option for the compiler. We should build the bios for z900 to allow it to run with all 64bit CPUs. This will become more important as soon as QEMU/KVM does support CPU models. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Reviewed-By: Sascha Silbe <silbe@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-10-02pc-bios/s390-ccw: avoid floating point operationsChristian Borntraeger1-1/+2
Some gcc versions (e.g. Fedora 22 gcc 5.1.1) seem to use floating point registers for spilling and filling of general purpose registers. As the BIOS does not activate the AFP register setting of CR0 this can cause data exception program checks. Disallow floating point in the BIOS as a simple solution. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Message-Id: <1443689387-34473-2-git-send-email-jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-06-15s390/bios: build with -fdelete-null-pointer-checksAurelien Jarno1-1/+1
Starting with version 4.9, GCC assumes it can't safely dereference null pointers, and uses this for some optimizations. On s390, the lowcore memory is located at address 0, so this assumption is wrong and breaks the s390-ccw firmware. Pass -fdelete-null-pointer-checks to avoid that. Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Message-Id: <1434363843-14576-1-git-send-email-aurelien@aurel32.net> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-03-11s390/bios: Make the s390-ccw.img relocatableThomas Huth1-5/+6
The current bios sits at location 0x7e00000 in the guest RAM and thus prevents loading of bigger ramdisks. By making the image relocatable we can move it to the end of the RAM so that it is getting out of the way. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Message-Id: <1425895973-15239-3-git-send-email-thuth@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> [Fixup build failure on 32 bit hosts]
2013-04-26s390-ccw.img: Take care of the elf->img transitionChristian Borntraeger1-2/+2
We have to call strip with s390-ccw.elf as input and s390-ccw.img as output Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2013-04-26S390: ccw firmware: Add MakefileAlexander Graf1-0/+26
This patch adds a makefile, so we can build our ccw firmware. Also add the resulting binaries to .gitignore, so that nobody is annoyed they might be in the tree. Signed-off-by: Alexander Graf <agraf@suse.de>