Skip to contentSkip to conversation

functional tests and s390x patches

GIT PULL Applied Thomas Huth 2 participants 17 messages Jul 11, 2025 – Jul 13, 2025 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

Hi Stefan!

The following changes since commit df6fe2abf2e990f767ce755d426bc439c7bba336:

Merge tag 'pull-target-arm-20250704' of https://gitlab.com/pm215/qemu into staging (2025-07-07 09:22:41 -0400)

are available in the Git repository at:

https://gitlab.com/thuth/qemu.git tags/pull-request-2025-07-11

for you to fetch changes up to 693b3039d77195953e70f008991c80bf9c5b9691:

target/s390x: Have s390_cpu_halt() not return anything (2025-07-11 10:33:56 +0200)

----------------------------------------------------------------
* s390x: Allow to select different entries when booting via pxelinux.cfg
* Link s390-ccw.img statically
* Fix broken bamboo functional test
* s390x code cleanups and refactorings

----------------------------------------------------------------
Peter Maydell (1):

      hw/s390x/s390-pci-bus.c: Use g_assert_not_reached() in functions taking an ett

Philippe Mathieu-Daudé (5):

      target/s390x/kvm: Use vaddr in find/insert_hw_breakpoint()
      target/s390x/tcg: Use vaddr in s390_probe_access()
      target/s390x: Remove unused s390_cpu_[un]halt() user stubs
      target/s390x: Expose s390_count_running_cpus() method
      target/s390x: Have s390_cpu_halt() not return anything

Sertonix (1):
pc-bios/s390-ccw: link statically

Thomas Huth (8):
pc-bios/s390-ccw: Allow to select a different pxelinux.cfg entry via loadparm pc-bios/s390-ccw: Allow up to 31 entries for pxelinux.cfg pc-bios/s390-ccw: Make get_boot_index() from menu.c global pc-bios/s390-ccw: Add a boot menu for booting via pxelinux.cfg tests/functional: Add a test for s390x pxelinux.cfg network booting
pc-bios: Update the s390 bios images with the pxelinux.cfg loadparm changes tests/functional: Add dependency to the keymap_targets tests/functional/test_ppc_bamboo: Replace broken link with working assets

 MAINTAINERS                             |   1 +
 pc-bios/s390-ccw/s390-ccw.h             |   1 +
 target/s390x/s390x-internal.h           |  13 +---
 hw/s390x/s390-pci-bus.c                 |  26 +++----
 pc-bios/s390-ccw/menu.c                 |   6 +-
 pc-bios/s390-ccw/netmain.c              |  66 ++++++++++++++----
 target/s390x/cpu-system.c               |   6 +-
 target/s390x/helper.c                   |   4 +-
 target/s390x/kvm/kvm.c                  |   4 +-
 target/s390x/tcg/mem_helper.c           |  10 +--
 pc-bios/s390-ccw.img                    | Bin 96000 -> 87824 bytes
 pc-bios/s390-ccw/Makefile               |   2 +-
 tests/functional/meson.build            |   3 +-
 tests/functional/test_ppc_bamboo.py     |  34 +++++----
 tests/functional/test_s390x_pxelinux.py | 119 ++++++++++++++++++++++++++++++++
 15 files changed, 227 insertions(+), 68 deletions(-)
 create mode 100755 tests/functional/test_s390x_pxelinux.py
#1 lore raw

[PULL 01/15] target/s390x/kvm: Use vaddr in find/insert_hw_breakpoint()

From: Philippe Mathieu-Daudé <[email protected]>

Since commit b8a6eb1862a both kvm_arch_insert_hw_breakpoint() and kvm_arch_remove_hw_breakpoint() use a vaddr type. Use the same type for the callees.

Fixes b8a6eb1862a ("sysemu/kvm: Use vaddr for kvm_arch_[insert|remove]_hw_breakpoint")

Message-ID: <[email protected]>

---
 target/s390x/kvm/kvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/s390x/kvm/kvm.c +2 -2
index 67d9a1977c0..491cc5f9756 100644
@@ -889,7 +889,7 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
     return 0;
 }
 
-static struct kvm_hw_breakpoint *find_hw_breakpoint(target_ulong addr,
+static struct kvm_hw_breakpoint *find_hw_breakpoint(vaddr addr,
                                                     int len, int type)
 {
     int n;
@@ -904,7 +904,7 @@ static struct kvm_hw_breakpoint *find_hw_breakpoint(target_ulong addr,
     return NULL;
 }
 
-static int insert_hw_breakpoint(target_ulong addr, int len, int type)
+static int insert_hw_breakpoint(vaddr addr, int len, int type)
 {
     int size;
 
Signature · 1 line
2.50.0
#2 lore raw

[PULL 02/15] target/s390x/tcg: Use vaddr in s390_probe_access()

In reply to Thomas Huth

From: Philippe Mathieu-Daudé <[email protected]>

Commit 70ebd9ce1cb ("s390x/tcg: Fault-safe memset") passed vaddr type to access_prepare(), and commit b6c636f2cd6 ("s390x/tcg: Fault-safe memmove") to do_access_get_byte(), but declared S390Access::vaddr[1,2] as target_ulong. Directly declare these as vaddr type, and have s390_probe_access() use that type as argument.

Message-ID: <[email protected]>

---
 target/s390x/tcg/mem_helper.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
target/s390x/tcg/mem_helper.c +5 -5
index a03609a1406..f1acb1618f7 100644
@@ -126,8 +126,8 @@ static inline void cpu_stsize_data_ra(CPUS390XState *env, uint64_t addr,
 
 /* An access covers at most 4096 bytes and therefore at most two pages. */
 typedef struct S390Access {
-    target_ulong vaddr1;
-    target_ulong vaddr2;
+    vaddr vaddr1;
+    vaddr vaddr2;
     void *haddr1;
     void *haddr2;
     uint16_t size1;
@@ -148,7 +148,7 @@ typedef struct S390Access {
  * For !CONFIG_USER_ONLY, the TEC is stored stored to env->tlb_fill_tec.
  * For CONFIG_USER_ONLY, the faulting address is stored to env->__excp_addr.
  */
-static inline int s390_probe_access(CPUArchState *env, target_ulong addr,
+static inline int s390_probe_access(CPUArchState *env, vaddr addr,
                                     int size, MMUAccessType access_type,
                                     int mmu_idx, bool nonfault,
                                     void **phost, uintptr_t ra)
@@ -258,7 +258,7 @@ static void access_memset(CPUS390XState *env, S390Access *desta,
 static uint8_t access_get_byte(CPUS390XState *env, S390Access *access,
                                int offset, uintptr_t ra)
 {
-    target_ulong vaddr = access->vaddr1;
+    vaddr vaddr = access->vaddr1;
     void *haddr = access->haddr1;
 
     if (unlikely(offset >= access->size1)) {
@@ -278,7 +278,7 @@ static uint8_t access_get_byte(CPUS390XState *env, S390Access *access,
 static void access_set_byte(CPUS390XState *env, S390Access *access,
                             int offset, uint8_t byte, uintptr_t ra)
 {
-    target_ulong vaddr = access->vaddr1;
+    vaddr vaddr = access->vaddr1;
     void *haddr = access->haddr1;
 
     if (unlikely(offset >= access->size1)) {
Signature · 1 line
2.50.0
#3 lore raw

[PULL 07/15] pc-bios/s390-ccw: Add a boot menu for booting via pxelinux.cfg

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

Show a simple boot menu for pxelinux.cfg, too, if the user requested it.

Message-ID: <[email protected]>

---
 pc-bios/s390-ccw/netmain.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
pc-bios/s390-ccw/netmain.c +26 -0
index 6f64323cd84..a9521dff416 100644
@@ -332,6 +332,28 @@ static int load_kernel_with_initrd(filename_ip_t *fn_ip,
     return rc;
 }
 
+static int net_boot_menu(int num_ent, int def_ent,
+                         struct pl_cfg_entry *entries)
+{
+    bool valid_entries[MAX_BOOT_ENTRIES] = { false };
+    int idx;
+
+    puts("\ns390-ccw pxelinux.cfg boot menu:\n");
+    printf(" [0] default (%d)\n", def_ent + 1);
+    valid_entries[0] = true;
+
+    for (idx = 1; idx <= num_ent; idx++) {
+        printf(" [%d] %s\n", idx, entries[idx - 1].label);
+        valid_entries[idx] = true;
+    }
+    putchar('\n');
+
+    idx = menu_get_boot_index(valid_entries);
+    putchar('\n');
+
+    return idx;
+}
+
 static int net_select_and_load_kernel(filename_ip_t *fn_ip,
                                       int num_ent, int selected,
                                       struct pl_cfg_entry *entries)
@@ -342,6 +364,10 @@ static int net_select_and_load_kernel(filename_ip_t *fn_ip,
         return -1;
     }
 
+    if (menu_is_enabled_enum() && num_ent > 1) {
+        loadparm = net_boot_menu(num_ent, selected, entries);
+    }
+
     IPL_assert(loadparm <= num_ent,
                "loadparm is set to an entry that is not available in the "
                "pxelinux.cfg file!");
Signature · 1 line
2.50.0
#4 lore raw

[PULL 03/15] hw/s390x/s390-pci-bus.c: Use g_assert_not_reached() in functions taking an ett

In reply to Thomas Huth

From: Peter Maydell <[email protected]>

The s390-pci-bus.c code, Coverity complains about a possible overflow because get_table_index() can return -1 if the ett value passed in is not one of the three permitted ZPCI_ETT_PT, ZPCI_ETT_ST, ZPCI_ETT_RT, but the caller in table_translate() doesn't check this and instead uses the return value directly in a calculation of the guest address to read from.

In fact this case cannot happen, because:
* get_table_index() is called only from table_translate()
* the only caller of table_translate() loops through the ett values in the order RT, ST, PT until table_translate() returns 0
* table_translate() will return 0 for the error cases and when translate_iscomplete() returns true
* translate_iscomplete() is always true for ZPCI_ETT_PT

So table_translate() is always called with a valid ett value.

Instead of having the various functions called from table_translate() return a default or dummy value when the ett argument is out of range, use g_assert_not_reached() to indicate that this is impossible.

Coverity: CID 1547609

Message-ID: <[email protected]>

---
 hw/s390x/s390-pci-bus.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
hw/s390x/s390-pci-bus.c +14 -12
index e6aa44531f6..f87d2748b63 100644
@@ -384,9 +384,9 @@ static uint64_t get_table_index(uint64_t iova, int8_t ett)
         return calc_sx(iova);
     case ZPCI_ETT_RT:
         return calc_rtx(iova);
+    default:
+        g_assert_not_reached();
     }
-
-    return -1;
 }
 
 static bool entry_isvalid(uint64_t entry, int8_t ett)
@@ -397,22 +397,24 @@ static bool entry_isvalid(uint64_t entry, int8_t ett)
     case ZPCI_ETT_ST:
     case ZPCI_ETT_RT:
         return rt_entry_isvalid(entry);
+    default:
+        g_assert_not_reached();
     }
-
-    return false;
 }
 
 /* Return true if address translation is done */
 static bool translate_iscomplete(uint64_t entry, int8_t ett)
 {
     switch (ett) {
-    case 0:
+    case ZPCI_ETT_ST:
         return (entry & ZPCI_TABLE_FC) ? true : false;
-    case 1:
+    case ZPCI_ETT_RT:
         return false;
+    case ZPCI_ETT_PT:
+        return true;
+    default:
+        g_assert_not_reached();
     }
-
-    return true;
 }
 
 static uint64_t get_frame_size(int8_t ett)
@@ -424,9 +426,9 @@ static uint64_t get_frame_size(int8_t ett)
         return 1ULL << 20;
     case ZPCI_ETT_RT:
         return 1ULL << 31;
+    default:
+        g_assert_not_reached();
     }
-
-    return 0;
 }
 
 static uint64_t get_next_table_origin(uint64_t entry, int8_t ett)
@@ -438,9 +440,9 @@ static uint64_t get_next_table_origin(uint64_t entry, int8_t ett)
         return get_st_pto(entry);
     case ZPCI_ETT_RT:
         return get_rt_sto(entry);
+    default:
+        g_assert_not_reached();
     }
-
-    return 0;
 }
 
 /**
Signature · 1 line
2.50.0
#5 lore raw

[PULL 04/15] pc-bios/s390-ccw: Allow to select a different pxelinux.cfg entry via loadparm

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

Since we're linking the network booting code into the main firmware binary nowadays, we can support the "loadparm" parameter now quite easily for pxelinux.cfg config files that contain multiple entries.

Message-ID: <[email protected]>

---
 pc-bios/s390-ccw/netmain.c | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)
pc-bios/s390-ccw/netmain.c +24 -8
index 719a547ada0..c0aafca22d2 100644
@@ -332,6 +332,27 @@ static int load_kernel_with_initrd(filename_ip_t *fn_ip,
     return rc;
 }
 
+static int net_select_and_load_kernel(filename_ip_t *fn_ip,
+                                      int num_ent, int selected,
+                                      struct pl_cfg_entry *entries)
+{
+    unsigned int loadparm = get_loadparm_index();
+
+    if (num_ent <= 0) {
+        return -1;
+    }
+
+    IPL_assert(loadparm <= num_ent,
+               "loadparm is set to an entry that is not available in the "
+               "pxelinux.cfg file!");
+
+    if (loadparm > 0) {
+        selected = loadparm - 1;
+    }
+
+    return load_kernel_with_initrd(fn_ip, &entries[selected]);
+}
+
 #define MAX_PXELINUX_ENTRIES 16
 
 static int net_try_pxelinux_cfg(filename_ip_t *fn_ip)
@@ -343,11 +364,8 @@ static int net_try_pxelinux_cfg(filename_ip_t *fn_ip)
                                       DEFAULT_TFTP_RETRIES,
                                       cfgbuf, sizeof(cfgbuf),
                                       entries, MAX_PXELINUX_ENTRIES, &def_ent);
-    if (num_ent > 0) {
-        return load_kernel_with_initrd(fn_ip, &entries[def_ent]);
-    }
 
-    return -1;
+    return net_select_and_load_kernel(fn_ip, num_ent, def_ent, entries);
 }
 
 /**
@@ -433,10 +451,8 @@ static int net_try_direct_tftp_load(filename_ip_t *fn_ip)
 
             num_ent = pxelinux_parse_cfg(cfgbuf, sizeof(cfgbuf), entries,
                                          MAX_PXELINUX_ENTRIES, &def_ent);
-            if (num_ent <= 0) {
-                return -1;
-            }
-            return load_kernel_with_initrd(fn_ip, &entries[def_ent]);
+            return net_select_and_load_kernel(fn_ip, num_ent, def_ent,
+                                              entries);
         }
     }
 
Signature · 1 line
2.50.0
#6 lore raw

[PULL 12/15] tests/functional/test_ppc_bamboo: Replace broken link with working assets

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

The old image that we used for testing the bamboo machine has disappeared from the internet. Fortunately there is another kernel + initrd provided by Cédric that can be used for testing this machine, too.

Message-ID: <[email protected]>

---
 tests/functional/test_ppc_bamboo.py | 34 ++++++++++++++++-------------
 1 file changed, 19 insertions(+), 15 deletions(-)
tests/functional/test_ppc_bamboo.py +19 -15
index fddcc24d0da..c634ae7b4a7 100755
@@ -16,28 +16,32 @@ class BambooMachine(QemuSystemTest):
 
     timeout = 90
 
-    ASSET_IMAGE = Asset(
-        ('http://landley.net/aboriginal/downloads/binaries/'
-         'system-image-powerpc-440fp.tar.gz'),
-        'c12b58f841c775a0e6df4832a55afe6b74814d1565d08ddeafc1fb949a075c5e')
+    ASSET_KERNEL = Asset(
+        ('https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main/'
+         'buildroot/qemu_ppc_bamboo-2023.11-8-gdcd9f0f6eb-20240105/vmlinux'),
+        'a2e12eb45b73491ac62fc0bbeb68dead0dc5c0f22cf83146558389209b420ad1')
+    ASSET_INITRD = Asset(
+        ('https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main/'
+         'buildroot/qemu_ppc_bamboo-2023.11-8-gdcd9f0f6eb-20240105/rootfs.cpio'),
+        'd2a36bdb8763b389765dc8c29d4904cec2bd001c587f92e85ab9eb10d5ddda54')
 
     def test_ppc_bamboo(self):
         self.set_machine('bamboo')
         self.require_accelerator("tcg")
         self.require_netdev('user')
-        self.archive_extract(self.ASSET_IMAGE)
+
+        kernel = self.ASSET_KERNEL.fetch()
+        initrd = self.ASSET_INITRD.fetch()
+
         self.vm.set_console()
-        self.vm.add_args('-kernel',
-                         self.scratch_file('system-image-powerpc-440fp',
-                                           'linux'),
-                         '-initrd',
-                         self.scratch_file('system-image-powerpc-440fp',
-                                           'rootfs.cpio.gz'),
-                         '-nic', 'user,model=rtl8139,restrict=on')
+        self.vm.add_args('-kernel', kernel,
+                         '-initrd', initrd,
+                         '-nic', 'user,model=virtio-net-pci,restrict=on')
         self.vm.launch()
-        wait_for_console_pattern(self, 'Type exit when done')
-        exec_command_and_wait_for_pattern(self, 'ping 10.0.2.2',
-                                          '10.0.2.2 is alive!')
+        wait_for_console_pattern(self, 'buildroot login:')
+        exec_command_and_wait_for_pattern(self, 'root', '#')
+        exec_command_and_wait_for_pattern(self, 'ping -c1 10.0.2.2',
+                '1 packets transmitted, 1 packets received, 0% packet loss')
         exec_command_and_wait_for_pattern(self, 'halt', 'System Halted')
 
 if __name__ == '__main__':
Signature · 1 line
2.50.0
#7 lore raw

[PULL 14/15] target/s390x: Expose s390_count_running_cpus() method

In reply to Thomas Huth

From: Philippe Mathieu-Daudé <[email protected]>

In order to simplify the next commit where s390_count_running_cpus() is split out of s390_cpu_halt(), make its prototype public as a preliminary step.

Message-ID: <[email protected]>

---
 target/s390x/s390x-internal.h | 1 +
 target/s390x/cpu-system.c     | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
target/s390x/s390x-internal.h +1 -0
index 6894f0a2569..145e472edf0 100644
@@ -238,6 +238,7 @@ uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst,
 
 /* cpu.c */
 #ifndef CONFIG_USER_ONLY
+unsigned int s390_count_running_cpus(void);
 unsigned int s390_cpu_halt(S390CPU *cpu);
 void s390_cpu_unhalt(S390CPU *cpu);
 void s390_cpu_system_init(Object *obj);
target/s390x/cpu-system.c +1 -1
index 9b380e343c2..2fa8c4d75db 100644
@@ -196,7 +196,7 @@ static bool disabled_wait(CPUState *cpu)
                             (PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK));
 }
 
-static unsigned s390_count_running_cpus(void)
+unsigned s390_count_running_cpus(void)
 {
     CPUState *cpu;
     int nr_running = 0;
Signature · 1 line
2.50.0
#8 lore raw

[PULL 11/15] tests/functional: Add dependency to the keymap_targets

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

When doing a "configure" in a an empty build directory, followed by a "make check" without a normal build in between, the vnc functional test currently fails since the keymaps have not been built yet. Thus add a dependency to the keymap_targets here to make sure that the keymaps are built before running the functional tests.

Message-ID: <[email protected]>

---
 tests/functional/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/functional/meson.build +1 -1
index 1ae5f02fb37..ae5c52d79fe 100644
@@ -374,7 +374,7 @@ foreach speed : ['quick', 'thorough']
       target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
     endif
 
-    test_deps = roms
+    test_deps = [roms, keymap_targets]
     test_env = environment()
     if have_tools
       test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
Signature · 1 line
2.50.0
#9 lore raw

[PULL 06/15] pc-bios/s390-ccw: Make get_boot_index() from menu.c global

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

We are going to reuse this function for selecting an entry from the pxelinux.cfg menu, so rename this function with a "menu_" prefix and make it available globally.

Message-ID: <[email protected]>

---
 pc-bios/s390-ccw/s390-ccw.h | 1 +
 pc-bios/s390-ccw/menu.c     | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
pc-bios/s390-ccw/s390-ccw.h +1 -0
index 6cdce3e5e5b..b1dc35cdedf 100644
@@ -87,6 +87,7 @@ int menu_get_zipl_boot_index(const char *menu_data);
 bool menu_is_enabled_zipl(void);
 int menu_get_enum_boot_index(bool *valid_entries);
 bool menu_is_enabled_enum(void);
+int menu_get_boot_index(bool *valid_entries);
 
 #define MAX_BOOT_ENTRIES  31
 
pc-bios/s390-ccw/menu.c +3 -3
index 84062e94af4..eeaff78f870 100644
@@ -159,7 +159,7 @@ static void boot_menu_prompt(bool retry)
     }
 }
 
-static int get_boot_index(bool *valid_entries)
+int menu_get_boot_index(bool *valid_entries)
 {
     int boot_index;
     bool retry = false;
@@ -224,7 +224,7 @@ int menu_get_zipl_boot_index(const char *menu_data)
     }
 
     printf("\n");
-    return get_boot_index(valid_entries);
+    return menu_get_boot_index(valid_entries);
 }
 
 int menu_get_enum_boot_index(bool *valid_entries)
@@ -247,7 +247,7 @@ int menu_get_enum_boot_index(bool *valid_entries)
     }
 
     printf("\n");
-    return get_boot_index(valid_entries);
+    return menu_get_boot_index(valid_entries);
 }
 
 void menu_set_parms(uint8_t boot_menu_flag, uint32_t boot_menu_timeout)
Signature · 1 line
2.50.0
#10 lore raw

[PULL 13/15] target/s390x: Remove unused s390_cpu_[un]halt() user stubs

In reply to Thomas Huth

From: Philippe Mathieu-Daudé <[email protected]>

Since commit da944885469 ("target/s390x: make helper.c sysemu-only") target/s390x/helper.c is only built for system mode, so s390_cpu_halt() and s390_cpu_unhalt() are never called from user mode.

Fixes da944885469 ("target/s390x: make helper.c sysemu-only")

Message-ID: <[email protected]>

---
 target/s390x/s390x-internal.h | 10 ----------
 1 file changed, 10 deletions(-)
target/s390x/s390x-internal.h +0 -10
index a4ba6227ab4..6894f0a2569 100644
@@ -246,16 +246,6 @@ void s390_cpu_finalize(Object *obj);
 void s390_cpu_system_class_init(CPUClass *cc);
 void s390_cpu_machine_reset_cb(void *opaque);
 bool s390_cpu_has_work(CPUState *cs);
-
-#else
-static inline unsigned int s390_cpu_halt(S390CPU *cpu)
-{
-    return 0;
-}
-
-static inline void s390_cpu_unhalt(S390CPU *cpu)
-{
-}
 #endif /* CONFIG_USER_ONLY */
 
 
Signature · 1 line
2.50.0
#11 lore raw

[PULL 09/15] pc-bios/s390-ccw: link statically

In reply to Thomas Huth

From: Sertonix <[email protected]>

Adding -pie to LDFLAGS caused s390-ccw.img to become dynamically linked. By using -static-pie it will be linked statically like other bios.

This ensures that the build output doesn't change depending on the default dynamic loader path of the toolchain.

Fixes d884c86dcd3b ("s390/bios: Make the s390-ccw.img relocatable")

Message-ID: <[email protected]>

---
 pc-bios/s390-ccw/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/Makefile +1 -1
index dc69dd484f9..a0f24c94a87 100644
@@ -47,7 +47,7 @@ EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables
 EXTRA_CFLAGS += -msoft-float
 EXTRA_CFLAGS += -std=gnu99
 EXTRA_CFLAGS += $(LIBC_INC) $(LIBNET_INC)
-EXTRA_LDFLAGS += -Wl,-pie -nostdlib -z noexecstack -z text
+EXTRA_LDFLAGS += -static-pie -nostdlib -z noexecstack -z text
 
 cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null
 cc-option = if $(call cc-test, $1); then \
Signature · 1 line
2.50.0
#12 lore raw

[PULL 05/15] pc-bios/s390-ccw: Allow up to 31 entries for pxelinux.cfg

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

We're going to support a menu for the pxelinux.cfg code, and to be able to reuse some functionality from menu.c, we should align the maximum amount of possible entries with the MAX_BOOT_ENTRIES constant that is used there. Thus replace MAX_PXELINUX_ENTRIES with MAX_BOOT_ENTRIES.

Message-ID: <[email protected]>

---
 pc-bios/s390-ccw/netmain.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
pc-bios/s390-ccw/netmain.c +4 -6
index c0aafca22d2..6f64323cd84 100644
@@ -353,17 +353,15 @@ static int net_select_and_load_kernel(filename_ip_t *fn_ip,
     return load_kernel_with_initrd(fn_ip, &entries[selected]);
 }
 
-#define MAX_PXELINUX_ENTRIES 16
-
 static int net_try_pxelinux_cfg(filename_ip_t *fn_ip)
 {
-    struct pl_cfg_entry entries[MAX_PXELINUX_ENTRIES];
+    struct pl_cfg_entry entries[MAX_BOOT_ENTRIES];
     int num_ent, def_ent = 0;
 
     num_ent = pxelinux_load_parse_cfg(fn_ip, mac, get_uuid(),
                                       DEFAULT_TFTP_RETRIES,
                                       cfgbuf, sizeof(cfgbuf),
-                                      entries, MAX_PXELINUX_ENTRIES, &def_ent);
+                                      entries, MAX_BOOT_ENTRIES, &def_ent);
 
     return net_select_and_load_kernel(fn_ip, num_ent, def_ent, entries);
 }
@@ -446,11 +444,11 @@ static int net_try_direct_tftp_load(filename_ip_t *fn_ip)
          * a magic comment string.
          */
         if (!strncasecmp("# pxelinux", cfgbuf, 10)) {
-            struct pl_cfg_entry entries[MAX_PXELINUX_ENTRIES];
+            struct pl_cfg_entry entries[MAX_BOOT_ENTRIES];
             int num_ent, def_ent = 0;
 
             num_ent = pxelinux_parse_cfg(cfgbuf, sizeof(cfgbuf), entries,
-                                         MAX_PXELINUX_ENTRIES, &def_ent);
+                                         MAX_BOOT_ENTRIES, &def_ent);
             return net_select_and_load_kernel(fn_ip, num_ent, def_ent,
                                               entries);
         }
Signature · 1 line
2.50.0
#13 lore raw

[PULL 08/15] tests/functional: Add a test for s390x pxelinux.cfg network booting

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

Check the various ways of booting a kernel via pxelinux.cfg file, e.g. by specifying the config file name via the MAC address or the UUID of the guest. Also check whether we can successfully load an alternate kernel via the "loadparm" parameter here and whether the boot menu shows up with "-boot menu=on".

Message-ID: <[email protected]>

---
 MAINTAINERS                             |   1 +
 tests/functional/meson.build            |   1 +
 tests/functional/test_s390x_pxelinux.py | 119 ++++++++++++++++++++++++
 3 files changed, 121 insertions(+)
 create mode 100755 tests/functional/test_s390x_pxelinux.py
MAINTAINERS +1 -0
index 1842c3dd83f..e88ed2c0a97 100644
@@ -1805,6 +1805,7 @@ F: hw/s390x/ipl.*
 F: pc-bios/s390-ccw/
 F: pc-bios/s390-ccw.img
 F: docs/devel/s390-dasd-ipl.rst
+F: tests/functional/test_s390x_pxelinux.py
 T: git https://github.com/borntraeger/qemu.git s390-next
 L: [email protected]
 
tests/functional/meson.build +1 -0
index 050c9000b95..1ae5f02fb37 100644
@@ -281,6 +281,7 @@ tests_rx_system_thorough = [
 
 tests_s390x_system_thorough = [
   's390x_ccw_virtio',
+  's390x_pxelinux',
   's390x_replay',
   's390x_topology',
   's390x_tuxrun',
tests/functional/test_s390x_pxelinux.py new file +119 -0

119 lines not on this page · raw message

Signature · 1 line
2.50.0
#14 lore raw

[PULL 15/15] target/s390x: Have s390_cpu_halt() not return anything

In reply to Thomas Huth

From: Philippe Mathieu-Daudé <[email protected]>

Since halting a vCPU and how many left running do not need to be tied together, split the s390_count_running_cpus() call out of s390_cpu_halt() to the single caller using it:
s390_handle_wait().

Message-ID: <[email protected]>

---
 target/s390x/s390x-internal.h | 2 +-
 target/s390x/cpu-system.c     | 4 +---
 target/s390x/helper.c         | 4 +++-
 3 files changed, 5 insertions(+), 5 deletions(-)
target/s390x/s390x-internal.h +1 -1
index 145e472edf0..56cce2e7f50 100644
@@ -239,7 +239,7 @@ uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst,
 /* cpu.c */
 #ifndef CONFIG_USER_ONLY
 unsigned int s390_count_running_cpus(void);
-unsigned int s390_cpu_halt(S390CPU *cpu);
+void s390_cpu_halt(S390CPU *cpu);
 void s390_cpu_unhalt(S390CPU *cpu);
 void s390_cpu_system_init(Object *obj);
 bool s390_cpu_system_realize(DeviceState *dev, Error **errp);
target/s390x/cpu-system.c +1 -3
index 2fa8c4d75db..709ccd52992 100644
@@ -214,7 +214,7 @@ unsigned s390_count_running_cpus(void)
     return nr_running;
 }
 
-unsigned int s390_cpu_halt(S390CPU *cpu)
+void s390_cpu_halt(S390CPU *cpu)
 {
     CPUState *cs = CPU(cpu);
     trace_cpu_halt(cs->cpu_index);
@@ -223,8 +223,6 @@ unsigned int s390_cpu_halt(S390CPU *cpu)
         cs->halted = 1;
         cs->exception_index = EXCP_HLT;
     }
-
-    return s390_count_running_cpus();
 }
 
 void s390_cpu_unhalt(S390CPU *cpu)
target/s390x/helper.c +3 -1
index 3c57c32e479..5c127da1a6a 100644
@@ -91,7 +91,9 @@ void s390_handle_wait(S390CPU *cpu)
 {
     CPUState *cs = CPU(cpu);
 
-    if (s390_cpu_halt(cpu) == 0) {
+    s390_cpu_halt(cpu);
+
+    if (s390_count_running_cpus() == 0) {
         if (is_special_wait_psw(cpu->env.psw.addr)) {
             qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
         } else {
Signature · 1 line
2.50.0
#15 lore raw

[PULL 10/15] pc-bios: Update the s390 bios images with the pxelinux.cfg loadparm changes

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

This new s390-ccw.img binary contains the addition of the loadparm feature to the pxelinux.cfg network booting code.

---
 pc-bios/s390-ccw.img | Bin 96000 -> 87824 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
pc-bios/s390-ccw.img binary +0 -0
index 47240f0a74eec17b0da3ad334157d1b0e62632b4..ff60978d28c59a3d9ee706e48ff268aad6476ddc 100644
GIT binary patch
Signature · 1 line
2.50.0