Skip to contentSkip to conversation

Hp715 fixes patches

GIT PULL Applied Helge Deller 2 participants 6 messages Nov 19 – Nov 20

lore
Share & tools
lore
#0 lore raw

From: Helge Deller <[email protected]>

The following changes since commit 45b7c3e45e2b778e560a0734daa6aa0059bc0edc:

Merge tag 'pull-ppc-for-11.2-rc2-20261119' of https://gitlab.com/harshpb/qemu into staging (2026-11-19 09:17:10 -0800)

are available in the Git repository at:

https://github.com/hdeller/qemu-hppa.git tags/hp715-fixes-pull-request

for you to fetch changes up to 42497091287f8ddbcb7537a8d1f28073430062d0:

hw/hppa: preload a BTLB entry for the soft power button page (2026-11-19 22:58:20 +0100)

----------------------------------------------------------------
HPPA 715 core fixes for v11.2

Four patches from Keith for the 715 machine which fix interrupt issues, and netbsd boot issues due to a badly mapped power button. For the latter a previous commit from me needs to be reverted.

----------------------------------------------------------------

Keith Monahan (4):
target/hppa: clear EIRR under the BQL and keep the interval timer
matching
target/hppa: re-arm the interval timer after loadvm Revert "target/hppa: Move emulated power button into CPU I/O region" hw/hppa: preload a BTLB entry for the soft power button page

 hw/hppa/machine.c        | 14 +++++---------
 target/hppa/cpu.h        |  2 --
 target/hppa/int_helper.c | 23 ++++++++++++++++++++++-
 target/hppa/machine.c    | 13 +++++++++++++
 4 files changed, 40 insertions(+), 12 deletions(-)
Signature · 1 line
2.54.0
#1 lore raw

[PULL 2/4] target/hppa: re-arm the interval timer after loadvm

From: Keith Monahan <[email protected]>

CR_IT holds the absolute expiry of the interval timer and is migrated with the other control registers, but the QEMUTimer behind it was not re-armed, so a restored guest never saw another clock interrupt.

---
 target/hppa/machine.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
target/hppa/machine.c +13 -0
index 6a143cf8df..1e59b8c2c9 100644
@@ -21,6 +21,7 @@
 #include "cpu.h"
 #include "migration/qemu-file-types.h"
 #include "migration/vmstate.h"
+#include "qemu/timer.h"
 
 
 static int get_psw(QEMUFile *f, void *opaque, size_t size,
@@ -222,9 +223,21 @@ static const VMStateField vmstate_cpu_fields[] = {
     VMSTATE_END_OF_LIST()
 };
 
+static int cpu_post_load(void *opaque, int version_id)
+{
+    HPPACPU *cpu = opaque;
+
+    /* CR_IT holds the absolute expiry of the interval timer; re-arm it */
+    if (cpu->env.cr[CR_IT]) {
+        timer_mod(cpu->alarm_timer, cpu->env.cr[CR_IT]);
+    }
+    return 0;
+}
+
 const VMStateDescription vmstate_hppa_cpu = {
     .name = "cpu",
     .version_id = 1,
     .minimum_version_id = 1,
+    .post_load = cpu_post_load,
     .fields = vmstate_cpu_fields,
 };
Signature · 1 line
2.54.0
#2 lore raw

[PULL 3/4] Revert "target/hppa: Move emulated power button into CPU I/O region"

In reply to Helge Deller

From: Keith Monahan <[email protected]>

This reverts commit a524a188c0c01cc39d4af518ee7a39addcdc1091.

NetBSD 9.4, 10.1, 10.2 and 11.1 panic at boot on -M 715: power0 cannot map the power switch register inside the CPU I/O page, and its polling thread then reads through a NULL mapping. HP-UX 9.05 is handled by a BTLB entry for the power button page instead.

---
 hw/hppa/machine.c | 13 ++++---------
 target/hppa/cpu.h |  2 --
 2 files changed, 4 insertions(+), 11 deletions(-)
hw/hppa/machine.c +4 -9
index 8a3f673daf..f23936fc5b 100644
@@ -50,6 +50,7 @@ struct HppaMachineState {
 
 #define MIN_SEABIOS_HPPA_VERSION 26 /* require at least this fw version */
 
+#define HPA_POWER_BUTTON        (FIRMWARE_END - 0x10)
 static hwaddr soft_power_reg;
 
 static void hppa_powerdown_req(Notifier *n, void *opaque)
@@ -122,7 +123,6 @@ static time_t rtc_ref;
 
 static uint64_t io_cpu_read(void *opaque, hwaddr addr, unsigned size)
 {
-    HPPACPU *cpu = opaque;
     uint64_t val = 0;
 
     switch (addr) {
@@ -132,8 +132,6 @@ static uint64_t io_cpu_read(void *opaque, hwaddr addr, unsigned size)
         break;
     case 8:             /* DebugOutputPort */
         return 0xe9;    /* readback */
-    case 16:            /* Power switch button */
-        return cpu->env.power_btn;
     }
     return val;
 }
@@ -141,7 +139,6 @@ static uint64_t io_cpu_read(void *opaque, hwaddr addr, unsigned size)
 static void io_cpu_write(void *opaque, hwaddr addr,
                          uint64_t val, unsigned size)
 {
-    HPPACPU *cpu = opaque;
     unsigned char ch;
     Chardev *debugout;
 
@@ -158,9 +155,6 @@ static void io_cpu_write(void *opaque, hwaddr addr,
             fprintf(stderr, "%c", ch);
         }
         break;
-    case 16:
-        cpu->env.power_btn = val;
-        break;
     }
 }
 
@@ -318,6 +312,8 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine,
         ram_max = FIRMWARE_START;  /* 3.75 GB (32-bit CPU) */
     }
 
+    soft_power_reg = translate(NULL, HPA_POWER_BUTTON);
+
     for (unsigned int i = 0; i < smp_cpus; i++) {
         g_autofree char *name = g_strdup_printf("cpu%u-io-eir", i);
         g_autofree char *cflush_name = NULL;
@@ -352,11 +348,10 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine,
     /* RTC and DebugOutputPort on CPU #0 */
     cpu_region = g_new(MemoryRegion, 1);
     memory_region_init_io(cpu_region, OBJECT(cpu[0]), &hppa_io_helper_ops,
-                          cpu[0], "cpu0-io-rtc", 3 * sizeof(uint64_t));
+                          cpu[0], "cpu0-io-rtc", 2 * sizeof(uint64_t));
     memory_region_add_subregion(addr_space,
                                 translate(NULL, cpu[0]->env.cpu_hpa + 16),
                                 cpu_region);
-    soft_power_reg = translate(NULL, cpu[0]->env.cpu_hpa + 16 + 16);
 
     /* Main memory region. */
     if (machine->ram_size > ram_max) {
target/hppa/cpu.h +0 -2
index 22f8a1727d..7b708a564b 100644
@@ -269,8 +269,6 @@ typedef struct CPUArchState {
 
     HPPATLBEntry tlb[HPPA_TLB_ENTRIES];
 
-    target_ulong power_btn;    /* virtual power button (0 = reboot) */
-
     /* Fields up to this point are cleared by a CPU reset */
     struct {} end_reset_fields;
 
Signature · 1 line
2.54.0
#3 lore raw

[PULL 4/4] hw/hppa: preload a BTLB entry for the soft power button page

In reply to Helge Deller

From: Keith Monahan <[email protected]>

HP-UX 9 reads the soft power button register from its clock interrupt without mapping it. The guest boots without
-fw_cfg opt/power-button-enable,string=0 and powers off cleanly on system_powerdown.

---
 hw/hppa/machine.c | 1 +
 1 file changed, 1 insertion(+)
hw/hppa/machine.c +1 -0
index f23936fc5b..3b83968f33 100644
@@ -909,6 +909,7 @@ static void hppa_machine_reset(MachineState *ms, ResetType type)
         static const struct { uint32_t start, last; } io_btlb[] = {
             { 0xf0100000, 0xf01fffff },     /* LASI */
             { 0xfff80000, 0xffffffff },     /* central bus */
+            { 0xf00ff000, 0xf00fffff },     /* soft power button register */
         };
         CPUHPPAState *env = &cpu[0]->env;
 
Signature · 1 line
2.54.0
#4 lore raw

[PULL 1/4] target/hppa: clear EIRR under the BQL and keep the interval timer matching

In reply to Helge Deller

From: Keith Monahan <[email protected]>

An unlocked EIRR clear could drop a tick set by the main loop thread, leaving the guest clock dead. HP-UX 10.20 installs wedged this way.

---
 target/hppa/int_helper.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
target/hppa/int_helper.c +22 -1
index 598d1c6cef..da9c7c6457 100644
@@ -25,6 +25,7 @@
 #include "hw/core/cpu.h"
 #include "hw/hppa/hppa_hardware.h"
 #include "qemu/plugin.h"
+#include "qemu/timer.h"
 
 static void eval_interrupt(HPPACPU *cpu)
 {
@@ -78,14 +79,34 @@ const MemoryRegionOps hppa_io_eir_ops = {
 
 void hppa_cpu_alarm_timer(void *opaque)
 {
+    HPPACPU *cpu = opaque;
+
     /* Raise interrupt 0.  */
     io_eir_write(opaque, 0, 0, 4);
+
+    /*
+     * Re-arm the alarm one counter wrap later.  The hardware compares CR16
+     * against a free running 32-bit counter, so the match recurs every
+     * 2^32 counts, which is 2^34 ns at the 250 MHz shown to the guest.
+     * This brings the model closer to that and limits a lost tick to a
+     * 17 s stall instead of a dead clock.
+     */
+    cpu->env.cr[CR_IT] += 1ULL << 34;
+    timer_mod(cpu->alarm_timer, cpu->env.cr[CR_IT]);
 }
 
 void HELPER(write_eirr)(CPUHPPAState *env, target_ulong val)
 {
-    env->cr[CR_EIRR] &= ~val;
+    /*
+     * Clear EIRR under the BQL.  io_eir_write() sets EIRR bits from the main
+     * loop thread for the interval timer and for device interrupts, and it
+     * holds the BQL.  This helper runs in the vCPU thread, so an unlocked
+     * read-modify-write here drops any bit set between the load and the
+     * store.  A dropped interval timer bit is never re-armed and the guest
+     * clock stops, which is how HP-UX 10.20 installs wedged under load.
+     */
     bql_lock();
+    env->cr[CR_EIRR] &= ~val;
     eval_interrupt(env_archcpu(env));
     bql_unlock();
 }
Signature · 1 line
2.54.0
#5 lore raw
In reply to Helge Deller
Quoted 12 lines · Helge Deller

From: Helge Deller<[email protected]>

The following changes since commit 45b7c3e45e2b778e560a0734daa6aa0059bc0edc:

   Merge tag 'pull-ppc-for-11.2-rc2-20261119' ofhttps://gitlab.com/harshpb/qemu into staging (2026-11-19 09:17:10 -0800)

are available in the Git repository at:

https://github.com/hdeller/qemu-hppa.git tags/hp715-fixes-pull-request

for you to fetch changes up to 42497091287f8ddbcb7537a8d1f28073430062d0:

Quoted 8 lines

hw/hppa: preload a BTLB entry for the soft power button page (2026-11-19 22:58:20 +0100)

----------------------------------------------------------------
HPPA 715 core fixes for v11.2

Four patches from Keith for the 715 machine which fix interrupt issues, and netbsd boot issues due to a badly mapped power button. For the latter a previous commit from me needs to be reverted.

Applied, thanks.

r~