Go ahead.

Thanks.

On 10/6/2020 4:43 PM, Charlene Wendling wrote:

Hi,

I wanted to install the latest OpenBSD/hppa snapshot using qemu, but
it croaked when configuring lasi0 with:

assertion "(val & LASI_IRQ_BITS) == val" failed
It makes the system impossible to boot. It appears that NetBSD folks
already met the issue and upstreamed a fix [0]. After reading our
lasi(4) code i've found out that we do the same thing.

With the below diff, i've been able to boot the ramdisk, then
perform a full hppa install. It boots properly from that install,
but is stuck after enabling pf if you were curious about that.

Comments/feedback are welcome,

Charlène.


[0] https://github.com/qemu/qemu/commit/b899fe41


Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/qemu/Makefile,v
retrieving revision 1.198
diff -u -p -u -p -r1.198 Makefile
--- Makefile    17 Aug 2020 09:58:44 -0000      1.198
+++ Makefile    6 Oct 2020 20:12:32 -0000
@@ -5,6 +5,7 @@ ONLY_FOR_ARCHS= aarch64 amd64 arm i386 p
  COMMENT=      multi system emulator
DISTNAME= qemu-5.1.0
+REVISION=      0
  CATEGORIES=   emulators
  MASTER_SITES= https://download.qemu.org/
  EXTRACT_SUFX= .tar.xz
Index: patches/patch-hw_hppa_lasi_c
===================================================================
RCS file: patches/patch-hw_hppa_lasi_c
diff -N patches/patch-hw_hppa_lasi_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-hw_hppa_lasi_c        6 Oct 2020 20:12:32 -0000
@@ -0,0 +1,33 @@
+$OpenBSD$
+
+From upstream commit b899fe41:
+
+OpenBSD initializes the LASI IMR value with 0xffffffff to disable all LASI
+interrupts. This triggered an assert() and stopped the emulation.  By replacing
+the check with a warning in the guest log we now allow OpenBSD to boot again.
+
+Index: hw/hppa/lasi.c
+--- hw/hppa/lasi.c.orig
++++ hw/hppa/lasi.c
+@@ -11,6 +11,7 @@
+
+ #include "qemu/osdep.h"
+ #include "qemu/units.h"
++#include "qemu/log.h"
+ #include "qapi/error.h"
+ #include "cpu.h"
+ #include "trace.h"
+@@ -172,8 +173,11 @@ static MemTxResult lasi_chip_write_with_attrs(void *op
+         /* read-only.  */
+         break;
+     case LASI_IMR:
+-        s->imr = val;  /* 0x20 ?? */
+-        assert((val & LASI_IRQ_BITS) == val);
++        s->imr = val;
++        if (((val & LASI_IRQ_BITS) != val) && (val != 0xffffffff))
++            qemu_log_mask(LOG_GUEST_ERROR,
++                "LASI: tried to set invalid %lx IMR value.\n",
++                (unsigned long) val);
+         break;
+     case LASI_IPR:
+         /* Any write to IPR clears the register. */

Reply via email to