Skip to contentSkip to conversation

Updates for hppa architecture

PATCH In review Helge Deller 3 participants 7 messages Jul 3 – Jul 5

lore
Share & tools
lore
#0 lore raw

cover Updates for hppa architecture

From: Helge Deller <[email protected]>

A few patches to fix TLB for HP-UX 9, and a lasi irq fix, as well as a new SeaBIOS-hppa v25 firmware.

Please review.
Thanks!
Helge

Helge Deller (3):
target/hppa: Work-around for Fast TLB insert instruction on HP-UX 9 target/hppa: Delay MMU update until TLB protection bits were set target/hppa: Update SeaBIOS-hppa to version 25

Keith Monahan (1):
hw/misc/lasi: derive IRR from pending and unmasked requests

 hw/misc/lasi.c              |  25 +++++++++++++++++++------
 pc-bios/hppa-firmware.img   | Bin 632780 -> 633992 bytes
 pc-bios/hppa-firmware64.img | Bin 665208 -> 666392 bytes
 roms/seabios-hppa           |   2 +-
 target/hppa/insns.decode    |   2 ++
 target/hppa/translate.c     |   4 ++--
 6 files changed, 24 insertions(+), 9 deletions(-)
Signature · 1 line
2.54.0
#1 lore raw

PATCH 1/4 target/hppa: Work-around for Fast TLB insert instruction on HP-UX 9

From: Helge Deller <[email protected]>

The HP-UX 9 kernel uses two TLB insert instructions (0x05315440 and 0x05385400), which seem to be wrongly encoded fast TLB instructions, but similiar to the non-fast instructions idtlba r17,(r9) and idtlbp r24,(r9).

It's not clear, if those undocumented instructions were used by mistake, or intentionally. Either way, this patch allows qemu to handle those instructions, so that a HP-UX 9 boot-CD can now boot somewhat further (but still crashes due to other reasons afterwards).

---
 target/hppa/insns.decode | 2 ++
 1 file changed, 2 insertions(+)
target/hppa/insns.decode +2 -0
index 13c6a55bf2..f700fe472e 100644
@@ -164,6 +164,8 @@ ixtlbx          000001 b:5 r:5 ... 000000 addr:1 0 00000        \
 
 # pcxl and pcxl2 Fast TLB Insert instructions
 ixtlbxf         000001 00000 r:5 00 0 data:1 01000 addr:1 0 00000
+# workaround for non-standard encoding as used in HP-UX 9
+ixtlbxf         000001 01001 r:5 01 0 data:1 01000 addr:1 0 00000
 
 # pa2.0 tlb insert idtlbt and iitlbt instructions
 ixtlbt          000001 r2:5 r1:5 000 data:1 100000 0 00000    # idtlbt
Signature · 1 line
2.54.0
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] target/hppa: Work-around for Fast TLB insert instruction on HP-UX 9

Quoted 22 lines · Helge Deller

From: Helge Deller <[email protected]>

The HP-UX 9 kernel uses two TLB insert instructions (0x05315440 and 0x05385400), which seem to be wrongly encoded fast TLB instructions, but similiar to the non-fast instructions idtlba r17,(r9) and idtlbp r24,(r9).

It's not clear, if those undocumented instructions were used by mistake, or intentionally. Either way, this patch allows qemu to handle those instructions, so that a HP-UX 9 boot-CD can now boot somewhat further (but still crashes due to other reasons afterwards).

---
  target/hppa/insns.decode | 2 ++
  1 file changed, 2 insertions(+)
target/hppa/insns.decode +0 -0
index 13c6a55bf2..f700fe472e 100644

target/hppa/insns.decode ixtlbx 000001 b:5 r:5 ... 000000 addr:1 0 00000 \ · line 171

Quoted 8 lines
target/hppa/insns.decode +2 -0
@@ -164,6 +164,8 @@ ixtlbx          000001 b:5 r:5 ... 000000 addr:1 0 00000        \
 
  # pcxl and pcxl2 Fast TLB Insert instructions
  ixtlbxf         000001 00000 r:5 00 0 data:1 01000 addr:1 0 00000
+# workaround for non-standard encoding as used in HP-UX 9
+ixtlbxf         000001 01001 r:5 01 0 data:1 01000 addr:1 0 00000
 
  # pa2.0 tlb insert idtlbt and iitlbt instructions
  ixtlbt          000001 r2:5 r1:5 000 data:1 100000 0 00000    # idtlbt

It's either this or ignore the field entirely.

r~

Reviewed-by on v1 1/4
#3 lore raw

Re: [PATCH 1/4] target/hppa: Work-around for Fast TLB insert instruction on HP-UX 9

In reply to Helge Deller
Quoted 12 lines · Helge Deller

From: Helge Deller <[email protected]>

The HP-UX 9 kernel uses two TLB insert instructions (0x05315440 and 0x05385400), which seem to be wrongly encoded fast TLB instructions, but similiar to the non-fast instructions idtlba r17,(r9) and idtlbp r24,(r9).

It's not clear, if those undocumented instructions were used by mistake, or intentionally. Either way, this patch allows qemu to handle those instructions, so that a HP-UX 9 boot-CD can now boot somewhat further (but still crashes due to other reasons afterwards).

Quoted 4 lines
---
  target/hppa/insns.decode | 2 ++
  1 file changed, 2 insertions(+)
#4 lore raw

PATCH 2/4 target/hppa: Delay MMU update until TLB protection bits were set

In reply to Helge Deller

From: Helge Deller <[email protected]>

On a 32-bit HPPA CPU, the TLB update for a data translation happens with two consecutive instructions: IDTLBA and IDTLBP. The former sets the target page address, while the second sets the protection bits. There is no need to update the MMU after setting the address bits only, so delay the final update of the MMU until after the execution of the second instruction when the protection bits are known too.

---
 target/hppa/translate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/hppa/translate.c +2 -2
index 4e34822565..002189ddfb 100644
@@ -2570,7 +2570,7 @@ static bool trans_ixtlbx(DisasContext *ctx, arg_ixtlbx *a)
     }
 
     /* Exit TB for TLB change if mmu is enabled.  */
-    if (ctx->tb_flags & PSW_C) {
+    if (ctx->tb_flags & PSW_C && !a->addr) {
         ctx->base.is_jmp = DISAS_IAQ_N_STALE;
     }
     return nullify_end(ctx);
@@ -2687,7 +2687,7 @@ static bool trans_ixtlbxf(DisasContext *ctx, arg_ixtlbxf *a)
     }
 
     /* Exit TB for TLB change if mmu is enabled.  */
-    if (ctx->tb_flags & PSW_C) {
+    if (ctx->tb_flags & PSW_C && !a->addr) {
         ctx->base.is_jmp = DISAS_IAQ_N_STALE;
     }
     return nullify_end(ctx);
Signature · 1 line
2.54.0
#5 lore raw

PATCH 3/4 hw/misc/lasi: derive IRR from pending and unmasked requests

In reply to Helge Deller

From: Keith Monahan <[email protected]>

The LASI interrupt request register (IRR) was latched: set when a source asserted and then never cleared or re-evaluated against the mask, so a masked or dropped request stayed set forever. The parisc core I/O dispatcher reads IRR to find its interrupt source, so the stuck bit was returned on every later interrupt as an "unexpected core I/O interrupt". On an installed HP-UX system an unacknowledged i82596 LAN interrupt latched this way and the flood wedged the boot.

Derive IRR as (pending & unmasked) with IPR tracking each source's level, matching the hardware and the in-tree parisc gsc/lasi driver.

---
 hw/misc/lasi.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
hw/misc/lasi.c +19 -6
index e8e1578b75..f0dfd78b4d 100644
@@ -62,7 +62,15 @@ static MemTxResult lasi_chip_read_with_attrs(void *opaque, hwaddr addr,
 
     switch (addr) {
     case LASI_IRR:
-        val = s->irr;
+        /*
+         * The interrupt request register reports the interrupts that are both
+         * pending and unmasked, derived live from IPR and IMR rather than
+         * latched, so masking or deasserting a source removes it immediately.
+         * The parisc core I/O interrupt dispatcher reads IRR; a latched bit
+         * that never cleared would be redelivered forever as a phantom
+         * "unexpected" interrupt.
+         */
+        val = s->ipr & s->imr;
         break;
     case LASI_IMR:
         val = s->imr;
@@ -234,13 +242,18 @@ static void lasi_set_irq(void *opaque, int irq, int level)
 
     if (level) {
         s->ipr |= bit;
-        if (bit & s->imr) {
+        if ((bit & s->imr) && (s->icr & ICR_BUS_ERROR_BIT) == 0) {
             uint32_t iar = s->iar;
-            s->irr |= bit;
-            if ((s->icr & ICR_BUS_ERROR_BIT) == 0) {
-                stl_be_phys(&address_space_memory, iar & -32, iar & 31);
-            }
+            stl_be_phys(&address_space_memory, iar & -32, iar & 31);
         }
+    } else {
+        /*
+         * The interrupt sources are level triggered, so a source that drops
+         * its request must clear its pending bit.  Otherwise the bit stays set
+         * in IPR (and hence IRR) and is redelivered as a phantom "unexpected"
+         * core I/O interrupt on every later interrupt.
+         */
+        s->ipr &= ~bit;
     }
 }
 
Signature · 1 line
2.54.0
#6 lore raw

PATCH 4/4 target/hppa: Update SeaBIOS-hppa to version 25

In reply to Helge Deller

From: Helge Deller <[email protected]>

New SeaBIOS-hppa release with various fixes and updates for qemu-v11.1:
- Work around SCSI transfer limit on 715
- Fix PDC_MODEL call to not copy PSW default word on 32-bit machines
- Fix PDC_SYSTEM_MAP call to prevent boot issues on C3700 machine
- Fix cc_line in pdc_cache to allow BSDs to boot
- Initial support to boot from SCSI TAPE drives

---
 pc-bios/hppa-firmware.img   | Bin 632780 -> 633992 bytes
 pc-bios/hppa-firmware64.img | Bin 665208 -> 666392 bytes
 roms/seabios-hppa           |   2 +-
 3 files changed, 1 insertion(+), 1 deletion(-)
pc-bios/hppa-firmware.img binary +0 -0
index 5c1de0eacece7c07002c8d6c2cf1547e0a3a52c8..2ce4460fabd87fa753e1f78bd779e3805fa7e71a 100644
GIT binary patch
pc-bios/hppa-firmware64.img binary +0 -0
index 5dd74906054f0155a7b3c6e1053588cf687f35b2..9fef825ed82b891c124504bdaa9ef1a44968f61f 100644
GIT binary patch
roms/seabios-hppa +1 -1
index d9560852a3..6d6a72c218 160000
@@ -1 +1 @@
-Subproject commit d9560852a34f156155b3777745baa0d96d553f22
+Subproject commit 6d6a72c218f6bf6b0e0b6a8bd26c5c67ba3ad2e0
Signature · 1 line
2.54.0