* [PULL 1/4] target/hppa: clear EIRR under the BQL and keep the interval timer matching
2026-11-19 22:47 [PULL 0/4] Hp715 fixes patches Helge Deller
@ 2026-11-19 22:47 ` Helge Deller
2026-11-19 22:47 ` [PULL 2/4] target/hppa: re-arm the interval timer after loadvm Helge Deller
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Helge Deller @ 2026-11-19 22:47 UTC (permalink / raw)
To: qemu-devel; +Cc: Keith Monahan, Helge Deller, Richard Henderson
From: Keith Monahan <keith@techtravels.org>
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.
Signed-off-by: Keith Monahan <keith@techtravels.org>
Signed-off-by: Helge Deller <deller@gmx.de>
---
target/hppa/int_helper.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c
index 598d1c6cef..da9c7c6457 100644
--- a/target/hppa/int_helper.c
+++ b/target/hppa/int_helper.c
@@ -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();
}
--
2.54.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PULL 2/4] target/hppa: re-arm the interval timer after loadvm
2026-11-19 22:47 [PULL 0/4] Hp715 fixes patches Helge Deller
2026-11-19 22:47 ` [PULL 1/4] target/hppa: clear EIRR under the BQL and keep the interval timer matching Helge Deller
@ 2026-11-19 22:47 ` Helge Deller
2026-11-19 22:47 ` [PULL 3/4] Revert "target/hppa: Move emulated power button into CPU I/O region" Helge Deller
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Helge Deller @ 2026-11-19 22:47 UTC (permalink / raw)
To: qemu-devel; +Cc: Keith Monahan, Helge Deller, Richard Henderson
From: Keith Monahan <keith@techtravels.org>
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.
Signed-off-by: Keith Monahan <keith@techtravels.org>
Signed-off-by: Helge Deller <deller@gmx.de>
---
target/hppa/machine.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/target/hppa/machine.c b/target/hppa/machine.c
index 6a143cf8df..1e59b8c2c9 100644
--- a/target/hppa/machine.c
+++ b/target/hppa/machine.c
@@ -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,
};
--
2.54.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PULL 3/4] Revert "target/hppa: Move emulated power button into CPU I/O region"
2026-11-19 22:47 [PULL 0/4] Hp715 fixes patches Helge Deller
2026-11-19 22:47 ` [PULL 1/4] target/hppa: clear EIRR under the BQL and keep the interval timer matching Helge Deller
2026-11-19 22:47 ` [PULL 2/4] target/hppa: re-arm the interval timer after loadvm Helge Deller
@ 2026-11-19 22:47 ` Helge Deller
2026-11-19 22:47 ` [PULL 4/4] hw/hppa: preload a BTLB entry for the soft power button page Helge Deller
2026-11-20 19:43 ` [PULL 0/4] Hp715 fixes patches Richard Henderson
4 siblings, 0 replies; 6+ messages in thread
From: Helge Deller @ 2026-11-19 22:47 UTC (permalink / raw)
To: qemu-devel; +Cc: Keith Monahan, Helge Deller, Richard Henderson
From: Keith Monahan <keith@techtravels.org>
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.
Signed-off-by: Keith Monahan <keith@techtravels.org>
Signed-off-by: Helge Deller <deller@gmx.de>
---
hw/hppa/machine.c | 13 ++++---------
target/hppa/cpu.h | 2 --
2 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index 8a3f673daf..f23936fc5b 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -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) {
diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h
index 22f8a1727d..7b708a564b 100644
--- a/target/hppa/cpu.h
+++ b/target/hppa/cpu.h
@@ -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;
--
2.54.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PULL 4/4] hw/hppa: preload a BTLB entry for the soft power button page
2026-11-19 22:47 [PULL 0/4] Hp715 fixes patches Helge Deller
` (2 preceding siblings ...)
2026-11-19 22:47 ` [PULL 3/4] Revert "target/hppa: Move emulated power button into CPU I/O region" Helge Deller
@ 2026-11-19 22:47 ` Helge Deller
2026-11-20 19:43 ` [PULL 0/4] Hp715 fixes patches Richard Henderson
4 siblings, 0 replies; 6+ messages in thread
From: Helge Deller @ 2026-11-19 22:47 UTC (permalink / raw)
To: qemu-devel; +Cc: Keith Monahan, Helge Deller, Richard Henderson
From: Keith Monahan <keith@techtravels.org>
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.
Signed-off-by: Keith Monahan <keith@techtravels.org>
Signed-off-by: Helge Deller <deller@gmx.de>
---
hw/hppa/machine.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index f23936fc5b..3b83968f33 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -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;
--
2.54.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PULL 0/4] Hp715 fixes patches
2026-11-19 22:47 [PULL 0/4] Hp715 fixes patches Helge Deller
` (3 preceding siblings ...)
2026-11-19 22:47 ` [PULL 4/4] hw/hppa: preload a BTLB entry for the soft power button page Helge Deller
@ 2026-11-20 19:43 ` Richard Henderson
4 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2026-11-20 19:43 UTC (permalink / raw)
To: Helge Deller, qemu-devel; +Cc: Keith Monahan, Helge Deller
On 11/19/26 14:47, Helge Deller wrote:
> From: Helge Deller<deller@gmx.de>
>
> 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:
>
> 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~
^ permalink raw reply [flat|nested] 6+ messages in thread