From nobody Mon Nov 23 04:26:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1793138020; cv=none; d=zohomail.com; s=zohoarc; b=cuFhJL2ua8w2n/kdw87pSm1GL7WyuawpFIV/+uPm8Xjt+4GPuH+SzeQs9Oh72XXuj61Basmgt6bcGBDPgoNss14ub/WkTWRwAzsPO9/f/9w+MT7Sv7CTXGInxE2mr0uEnix+kujEcfz2J96bZLpCYBZDeyr3OHBCB5FST3SqCY4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793138020; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QaVRcb8yXZ4o8Ma7MN3IF8FH4J0vdEYFJdp2P80b7Q0=; b=icDB64kU/nHkXV2BA1Mgr6I0vieDkqrokr3UVwWQzahF1GhaXtT04qnbrKBjREr9nt2+lxhdpWUCJuAb8x5BodEHjAxwulnWgb29XaoeERZoUyCxgOOlE31bc6UT8orYjBBGI3rmsRGZYMT02+1IiGjgm/5wYlRPYJnabRU4hQI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179313802063552.7636655872501; Tue, 27 Oct 2026 14:53:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xLp5g-0002x1-IA; Tue, 27 Oct 2026 17:52:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5e-0002wF-P1 for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:18 -0400 Received: from tor.source.kernel.org ([172.105.4.254]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5b-00006r-Bl for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:18 -0400 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 46834600C8; Tue, 27 Oct 2026 21:52:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9AFB1F01825; Tue, 27 Oct 2026 21:52:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793137934; bh=QaVRcb8yXZ4o8Ma7MN3IF8FH4J0vdEYFJdp2P80b7Q0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BhKn0Ocqu5n0uaqJd402RGt5bhj/8Jd+sKBMgO7Fc6y3KpQ415l4neJg0DfjA3nIf ZKvhJJKBYRbsJl8UdV2foY1EsItAK1+b+vled1wczcjl3/Yxkqcmqhj+/QBYJz4qPA HFbCdVNHdf3sRh7tpTNJaxueCrC8YJ4Y0J2CroAzLFJRzwvx1bp5qcw8FXeg1BseMY al0iBfbOzgaSgNn52gg9DMkYuNXYiYwQzNU2RbSsQXnYuJWkMl4zL19C4zxyeGig6C P24m7ubt6p16xOOvpthaaUEzwBI99XC/OjpnRZcQTRwsSHGt1vHzlhwvZVmPeL7KCk VIXdugCnABC4w== From: Helge Deller To: qemu-devel@nongnu.org Cc: Richard Henderson , Keith Monahan , "Kirill A . Korinsky" , Helge Deller Subject: [PATCH 1/8] target/hppa: restore lazy FPU context isolation Date: Tue, 27 Oct 2026 22:52:02 +0100 Message-ID: <20261027215209.21150-2-deller@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261027215209.21150-1-deller@kernel.org> References: <20261027215209.21150-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=172.105.4.254; envelope-from=deller@kernel.org; helo=tor.source.kernel.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1793138022927158500 Content-Type: text/plain; charset="utf-8" From: "Kirill A. Korinsky" Raise assist emulation trap 22 when CCR disables FP execution; this restores lazy FPU context isolation, stabilizes OpenBSD/hppa, and fixes unexplained SSH "incorrect signature" failures. I keep FP enabled on firmware entry because SeaBIOS uses FP registers before configuring CCR. The regression test is based on lazy.elf and eager.elf, compiled from firmware.ld and fpu-state.s with OpenBSD/hppa 8.0's patched GCC 4.2.1 and BFD 2.17. Closes: https://gitlab.com/qemu-project/qemu/-/work_items/4715 Signed-off-by: Kirill A. Korinsky Signed-off-by: Helge Deller --- hw/hppa/machine.c | 2 + target/hppa/cpu.c | 1 + target/hppa/cpu.h | 1 + target/hppa/helper.h | 1 + target/hppa/mem_helper.c | 15 ++ target/hppa/translate.c | 61 ++++- tests/functional/hppa/test_seabios.py | 6 +- tests/qtest/hppa-fpu-test.c | 371 ++++++++++++++++++++++++++ tests/qtest/meson.build | 2 + 9 files changed, 456 insertions(+), 4 deletions(-) create mode 100644 tests/qtest/hppa-fpu-test.c diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 0b0a8047ed..96d57b9b0f 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -842,6 +842,8 @@ static void hppa_machine_reset(MachineState *ms, ResetT= ype type) =20 cpu_set_pc(cs, firmware_entry); cpu[i]->env.psw =3D PSW_Q; + /* Firmware uses FP registers before configuring CCR. */ + cpu[i]->env.cr[CR_SCRCCR] =3D 0xc0; cpu[i]->env.gr[5] =3D CPU_HPA + i * 0x1000; } =20 diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 9d64322398..83104ae0c7 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -91,6 +91,7 @@ static TCGTBCPUState hppa_get_tb_cpu_state(CPUState *cs) #ifdef CONFIG_USER_ONLY flags |=3D TB_FLAG_UNALIGN * !env_cpu(env)->prctl_unalign_sigbus; #else + flags |=3D TB_FLAG_FPU_DISABLED * !(env->cr[CR_SCRCCR] & 0xc0); if ((env->sr[4] =3D=3D env->sr[5]) & (env->sr[4] =3D=3D env->sr[6]) & (env->sr[4] =3D=3D env->sr[7])) { diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 8818d47dcd..c0ba787974 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -372,6 +372,7 @@ hwaddr hppa_abs_to_phys_pa2_w1(uint8_t phys_addr_bits, = vaddr addr); #define TB_FLAG_PRIV_SHIFT 8 #define TB_FLAG_UNALIGN 0x400 #define TB_FLAG_SPHASH 0x800 +#define TB_FLAG_FPU_DISABLED 0x1000 #define CS_BASE_DIFFPAGE (1 << 12) #define CS_BASE_DIFFSPACE (1 << 13) =20 diff --git a/target/hppa/helper.h b/target/hppa/helper.h index 8d7fa1ae34..449818f9dd 100644 --- a/target/hppa/helper.h +++ b/target/hppa/helper.h @@ -82,6 +82,7 @@ DEF_HELPER_FLAGS_4(fmpynfadd_d, TCG_CALL_NO_RWG, i64, env= , i64, i64, i64) DEF_HELPER_FLAGS_0(read_interval_timer, TCG_CALL_NO_RWG, tl) =20 #ifndef CONFIG_USER_ONLY +DEF_HELPER_5(fpu_mem, noreturn, env, tl, i32, i32, i32) DEF_HELPER_1(hppa_halt, noreturn, env) DEF_HELPER_1(hppa_reset, noreturn, env) DEF_HELPER_1(rfi, void, env) diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index 2393a15507..a5da0bc851 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -427,6 +427,21 @@ raise_exception_with_ior(CPUHPPAState *env, int excp, = uintptr_t retaddr, cpu_loop_exit(cs); } =20 +G_NORETURN void HELPER(fpu_mem)(CPUHPPAState *env, target_ulong addr, + uint32_t mmu_idx, uint32_t mop, uint32_t ty= pe) +{ + hwaddr phys; + int prot, excp; + + /* Memory faults take priority over the assist emulation trap. */ + excp =3D hppa_get_physical_address(env, addr, mmu_idx, type, mop, &phy= s, &prot); + if (excp < 0) { + excp =3D EXCP_ASSIST_EMU; + } + raise_exception_with_ior(env, excp, GETPC(), addr, + MMU_IDX_MMU_DISABLED(mmu_idx)); +} + void hppa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, unsigned size, MMUAccessType access_type, diff --git a/target/hppa/translate.c b/target/hppa/translate.c index befdb58e9a..6a4072a630 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1711,8 +1711,30 @@ static bool do_floadw(DisasContext *ctx, unsigned rt= , unsigned rb, return nullify_end(ctx); } =20 +static bool gen_fmem_excp(DisasContext *ctx, arg_ldst *a, MemOp mop, int t= ype) +{ +#ifndef CONFIG_USER_ONLY + TCGv_i64 addr, ofs; + + nullify_over(ctx); + form_gva(ctx, &addr, &ofs, a->b, a->x, + a->scale ? mop & MO_SIZE : 0, a->disp, a->sp, a->m, + MMU_DISABLED(ctx)); + gen_helper_fpu_mem(tcg_env, addr, tcg_constant_i32(ctx->mmu_idx), + tcg_constant_i32(mop | ctx->mo_align | mo_endian(ct= x)), + tcg_constant_i32(type)); + ctx->base.is_jmp =3D DISAS_NORETURN; + return nullify_end(ctx); +#else + g_assert_not_reached(); +#endif +} + static bool trans_fldw(DisasContext *ctx, arg_ldst *a) { + if (ctx->tb_flags & TB_FLAG_FPU_DISABLED) { + return gen_fmem_excp(ctx, a, MO_UL, PAGE_READ); + } return do_floadw(ctx, a->t, a->b, a->x, a->scale ? 2 : 0, a->disp, a->sp, a->m); } @@ -1738,6 +1760,9 @@ static bool do_floadd(DisasContext *ctx, unsigned rt,= unsigned rb, =20 static bool trans_fldd(DisasContext *ctx, arg_ldst *a) { + if (ctx->tb_flags & TB_FLAG_FPU_DISABLED) { + return gen_fmem_excp(ctx, a, MO_UQ, PAGE_READ); + } return do_floadd(ctx, a->t, a->b, a->x, a->scale ? 3 : 0, a->disp, a->sp, a->m); } @@ -1767,6 +1792,9 @@ static bool do_fstorew(DisasContext *ctx, unsigned rt= , unsigned rb, =20 static bool trans_fstw(DisasContext *ctx, arg_ldst *a) { + if (ctx->tb_flags & TB_FLAG_FPU_DISABLED) { + return gen_fmem_excp(ctx, a, MO_UL, PAGE_WRITE); + } return do_fstorew(ctx, a->t, a->b, a->x, a->scale ? 2 : 0, a->disp, a->sp, a->m); } @@ -1787,6 +1815,9 @@ static bool do_fstored(DisasContext *ctx, unsigned rt= , unsigned rb, =20 static bool trans_fstd(DisasContext *ctx, arg_ldst *a) { + if (ctx->tb_flags & TB_FLAG_FPU_DISABLED) { + return gen_fmem_excp(ctx, a, MO_UQ, PAGE_WRITE); + } return do_fstored(ctx, a->t, a->b, a->x, a->scale ? 3 : 0, a->disp, a->sp, a->m); } @@ -2311,8 +2342,9 @@ static bool trans_mtctl(DisasContext *ctx, arg_mtctl = *a) #endif break; =20 + case CR_SCRCCR: case CR_EIEM: - /* Exit to re-evaluate interrupts in the main loop. */ + /* Exit to re-evaluate translation flags and interrupts. */ ctx->base.is_jmp =3D DISAS_IAQ_N_STALE_EXIT; /* FALLTHRU */ default: @@ -4721,6 +4753,31 @@ static void hppa_tr_insn_start(DisasContextBase *dcb= ase, CPUState *cs) ctx->insn_start_updated =3D false; } =20 +static bool decode_insn(DisasContext *ctx, uint32_t insn) +{ +#ifndef CONFIG_USER_ONLY + if (ctx->tb_flags & TB_FLAG_FPU_DISABLED) { + switch (insn >> 26) { + case 0x0b: + /* Both floating-point uids trap when the coprocessor is disab= led. */ + insn &=3D ~0x40; + break; + case 0x0c: + if (extract32(insn, 7, 2)) { + break; + } + /* fall through */ + case 0x06: + case 0x0e: + case 0x26: + case 0x2e: + return gen_excp_iir(ctx, EXCP_ASSIST_EMU); + } + } +#endif + return decode(ctx, insn); +} + static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) { DisasContext *ctx =3D container_of(dcbase, DisasContext, base); @@ -4754,7 +4811,7 @@ static void hppa_tr_translate_insn(DisasContextBase *= dcbase, CPUState *cs) ret =3D DISAS_NEXT; } else { ctx->insn =3D insn; - if (!decode(ctx, insn)) { + if (!decode_insn(ctx, insn)) { gen_illegal(ctx); } ret =3D ctx->base.is_jmp; diff --git a/tests/functional/hppa/test_seabios.py b/tests/functional/hppa/= test_seabios.py index bdb9d534ef..9fd42d70ac 100755 --- a/tests/functional/hppa/test_seabios.py +++ b/tests/functional/hppa/test_seabios.py @@ -20,8 +20,10 @@ def boot_seabios(self): self.vm.add_args('-no-shutdown') self.vm.set_console() self.vm.launch() - wait_for_console_pattern(self, f'SeaBIOS PA-RISC {bits}-bit Firmwa= re') - wait_for_console_pattern(self, f'Emulated machine: HP {mach} (= {bits}-bit') + wait_for_console_pattern(self, f'SeaBIOS PA-RISC {bits}-bit Firmwa= re', + failure_message=3D'SeaBIOS: Detected trap= ') + wait_for_console_pattern(self, f'Emulated machine: HP {mach} (= {bits}-bit', + failure_message=3D'SeaBIOS: Detected trap= ') =20 def test_hppa_32(self): self.set_machine('B160L') diff --git a/tests/qtest/hppa-fpu-test.c b/tests/qtest/hppa-fpu-test.c new file mode 100644 index 0000000000..af4ff2a162 --- /dev/null +++ b/tests/qtest/hppa-fpu-test.c @@ -0,0 +1,371 @@ +/* + * HPPA CCR floating-point enable and lazy context switching tests. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "libqtest.h" + +#define BOOT 0x1000 +#define CODE 0x1100 +#define FP_CODE 0x1300 +#define ASSIST 0x1400 +#define UNEXPECTED 0x1500 +#define HALT 0x1600 +#define DATA 0x1800 +#define RESULT 0x1900 +#define LOG 0x1a00 + +/* Enable interruption-state collection through IPSW before entering CODE.= */ +static const uint32_t bootstrap[] =3D { + 0x34010010, /* ldi 8,r1 */ + 0x02c11840, /* mtctl r1,ipsw */ + 0x02201840, /* mtctl r0,iiasq */ + 0x02201840, /* mtctl r0,iiasq */ + 0x34012200, /* ldi 0x1100,r1 */ + 0x02411840, /* mtctl r1,iiaoq */ + 0x34012208, /* ldi 0x1104,r1 */ + 0x02411840, /* mtctl r1,iiaoq */ + 0x00000c00, /* rfi */ +}; + +/* + * r20 counts assists. After the first call, the shared CCR writer is ente= red + * with FP enabled. Alternating its input must reselect the next translati= on. + */ +static const uint32_t fp_guest[] =3D { + 0x34011000, /* ldi 0x800,r1 */ + 0x01c11840, /* mtctl r1,iva */ + 0x08000240, /* nop */ + 0x34103000, /* ldi 0x1800,r16 */ + 0x34113200, /* ldi 0x1900,r17 */ + 0x341a3400, /* ldi 0x1a00,r26 */ + 0x34140000, /* ldi 0,r20 */ + 0x34010180, /* ldi 0xc0,r1 */ + 0x01411840, /* mtctl r1,ccr */ + 0x2e00100c, /* fldd 0(r16),fr12 */ + 0x34010000, /* ldi 0,r1 */ + 0x01411840, /* mtctl r1,ccr */ + 0x08142880, /* cmpclr,=3D r20,r0,r0: nullify the next instruction */ + 0x08000240, /* replaced by the FP instruction under test */ + 0x6a340008, /* stw r20,4(r17) */ + 0x34010180, /* ldi 0xc0,r1 */ + 0xe8400370, /* bl 0x1300,rp */ + 0x08000240, /* nop */ + 0x6a340010, /* stw r20,8(r17) */ + 0x34010000, /* ldi 0,r1 */ + 0xe8400350, /* bl 0x1300,rp */ + 0x08000240, /* nop */ + 0x6a340018, /* stw r20,12(r17) */ + 0x34010180, /* ldi 0xc0,r1 */ + 0xe8400330, /* bl 0x1300,rp */ + 0x08000240, /* nop */ + 0x6a340020, /* stw r20,16(r17) */ + 0x34010000, /* ldi 0,r1 */ + 0xe8400310, /* bl 0x1300,rp */ + 0x08000240, /* nop */ + 0x6a340028, /* stw r20,20(r17) */ + 0x34010180, /* ldi 0xc0,r1 */ + 0xe84002f0, /* bl 0x1300,rp */ + 0x08000240, /* nop */ + 0x6a340030, /* stw r20,24(r17) */ + 0x34010000, /* ldi 0,r1 */ + 0xe84002d0, /* bl 0x1300,rp */ + 0x08000240, /* nop */ + 0x6a340038, /* stw r20,28(r17) */ + 0x34010180, /* ldi 0xc0,r1 */ + 0x01411840, /* mtctl r1,ccr */ + 0x2e10120c, /* fstd fr12,8(r16) */ + 0x36100010, /* ldo 8(r16),r16 */ + 0x2e10120d, /* fstd fr13,8(r16) */ + 0x34010002, /* ldi 1,r1 */ + 0x6a210000, /* stw r1,0(r17): completion */ + 0xe8000882, /* b,n 0x1600 */ +}; + +static const uint32_t fp_site[] =3D { + 0x01411840, /* mtctl r1,ccr */ + 0x08000240, /* replaced by the FP instruction under test */ + 0xe840c002, /* bv,n 0(rp) */ +}; + +/* r20 and r26 are outside the shadow register set restored by rfir. */ +static const uint32_t assist_handler[] =3D { + 0x026008a1, /* mfctl iir,r1 */ + 0x6b410000, /* stw r1,0(r26) */ + 0x024008a1, /* mfctl iiaoq,r1 */ + 0x6b410008, /* stw r1,4(r26) */ + 0x028008a1, /* mfctl isr,r1 */ + 0x6b410010, /* stw r1,8(r26) */ + 0x02a008a1, /* mfctl ior,r1 */ + 0x6b410018, /* stw r1,12(r26) */ + 0x375a0020, /* ldo 16(r26),r26 */ + 0x36940002, /* ldo 1(r20),r20 */ + 0x34010180, /* ldi 0xc0,r1 */ + 0x01411840, /* mtctl r1,ccr */ + 0x00000ca0, /* rfir: retry the faulting instruction */ +}; + +static const uint32_t unexpected_handler[] =3D { + 0x026008a1, /* mfctl iir,r1 */ + 0x6a210008, /* stw r1,4(r17) */ + 0x024008a1, /* mfctl iiaoq,r1 */ + 0x6a210010, /* stw r1,8(r17) */ + 0x028008a1, /* mfctl isr,r1 */ + 0x6a210018, /* stw r1,12(r17) */ + 0x02a008a1, /* mfctl ior,r1 */ + 0x6a210020, /* stw r1,16(r17) */ + 0x6a380000, /* stw r24,0(r17): 0x100 | exception number */ + 0xe80001aa, /* b,n 0x1600 */ +}; + +/* r18 owns the live FP state; r19 requests the next logical context. */ +static const uint32_t lazy_guest[] =3D { + 0x34011000, /* ldi 0x800,r1 */ + 0x01c11840, /* mtctl r1,iva */ + 0x08000240, /* nop */ + 0x34123000, /* ldi 0x1800,r18: owner A */ + 0x34113200, /* ldi 0x1900,r17 */ + 0x34140000, /* ldi 0,r20 */ + 0x34010180, /* ldi 0xc0,r1 */ + 0x01411840, /* mtctl r1,ccr */ + 0x2e40100c, /* fldd 0(r18),fr12 */ + 0x318c0e0c, /* fadd,d fr12,fr12,fr12: A =3D 2 */ + 0x34173240, /* ldi 0x1920,r23 */ + 0x34133020, /* ldi 0x1810,r19: request B */ + 0xe8400390, /* bl 0x1300,rp */ + 0x08000240, /* nop */ + 0x318c0e0c, /* fadd,d fr12,fr12,fr12: B =3D 32 */ + 0x36f70010, /* ldo 8(r23),r23 */ + 0x34133000, /* ldi 0x1800,r19: request A */ + 0xe8400368, /* bl 0x1300,rp */ + 0x08000240, /* nop */ + 0x318c0e0c, /* fadd,d fr12,fr12,fr12: A =3D 4 */ + 0x36f70010, /* ldo 8(r23),r23 */ + 0x34133020, /* ldi 0x1810,r19: request B */ + 0xe8400340, /* bl 0x1300,rp */ + 0x08000240, /* nop */ + 0x318c0e0c, /* fadd,d fr12,fr12,fr12: B =3D 64 */ + 0x36f70010, /* ldo 8(r23),r23 */ + 0x34133000, /* ldi 0x1800,r19: request A */ + 0xe8400318, /* bl 0x1300,rp */ + 0x08000240, /* nop */ + 0x6a340008, /* stw r20,4(r17) */ + 0x34010002, /* ldi 1,r1 */ + 0x6a210000, /* stw r1,0(r17) */ + 0xe80008f2, /* b,n 0x1600 */ +}; + +static const uint32_t lazy_site[] =3D { + 0x01401840, /* mtctl r0,ccr */ + 0x2ee0120c, /* fstd fr12,0(r23) */ + 0xe840c002, /* bv,n 0(rp) */ +}; + +static const uint32_t lazy_handler[] =3D { + 0x34010180, /* ldi 0xc0,r1 */ + 0x01411840, /* mtctl r1,ccr */ + 0x2e40120c, /* fstd fr12,0(r18): save owner */ + 0x2e60100c, /* fldd 0(r19),fr12: restore requested context */ + 0x08130252, /* copy r19,r18 */ + 0x36940002, /* ldo 1(r20),r20 */ + 0x00000ca0, /* rfir */ +}; + +static void write_words(QTestState *qts, uint32_t addr, + const uint32_t *words, size_t count) +{ + for (size_t i =3D 0; i < count; i++) { + qtest_writel(qts, addr + 4 * i, words[i]); + } +} + +static uint32_t branch(uint32_t pc, uint32_t target) +{ + uint32_t d =3D (target - pc - 8) / 4; + + return 0xe8000002 | ((d & 0x10000) >> 16) | ((d & 0xf800) << 5) | + ((d & 0x400) >> 8) | ((d & 0x3ff) << 3); +} + +static QTestState *start_guest(bool retry_assist) +{ + QTestState *qts =3D qtest_init("-machine none -cpu pa-7300lc -m 1M " + "-S -accel tcg -no-shutdown " + "-device loader,addr=3D0x1000,cpu-num=3D0"= ); + + write_words(qts, BOOT, bootstrap, G_N_ELEMENTS(bootstrap)); + /* Shutdown may re-enter this TB before the main loop stops the CPU. */ + qtest_writel(qts, HALT, 0xfffdead0); + write_words(qts, UNEXPECTED, unexpected_handler, + G_N_ELEMENTS(unexpected_handler)); + for (unsigned int i =3D 0; i < 32; i++) { + uint32_t pc =3D 0x800 + i * 32; + uint32_t target =3D retry_assist && i =3D=3D 22 ? ASSIST : UNEXPEC= TED; + + qtest_writel(qts, pc, 0x34180000 | ((0x100 | i) << 1)); + qtest_writel(qts, pc + 4, branch(pc + 4, target)); + } + return qts; +} + +static void run_guest(QTestState *qts, uint32_t expected) +{ + uint32_t result; + + qtest_qmp_assert_success(qts, "{'execute':'cont'}"); + qtest_qmp_eventwait(qts, "SHUTDOWN"); + result =3D qtest_readl(qts, RESULT); + g_test_message("completion=3D0x%x, result[1]=3D0x%x, result[2]=3D0x%x", + result, qtest_readl(qts, RESULT + 4), + qtest_readl(qts, RESULT + 8)); + g_assert_cmphex(result, =3D=3D, expected); +} + +typedef struct FPTest { + const char *name; + uint32_t instruction; + bool memory; + uint64_t fr13; +} FPTest; + +static const FPTest fp_tests[] =3D { + { "fldw", 0x2600100c, true }, + { "fstw", 0x2600120c, true }, + { "fldd", 0x2e00100c, true }, + { "fstd", 0x2e00120c, true }, + { "fid", 0x30000000 }, + { "fadd-double", 0x318c0e0d, false, 0x4010000000000000ULL }, + { "fadd-double-extended", 0x398c0e0d, false, 0x4010000000000000ULL }, + { "fmpyadd-single", 0x188541e6 }, /* fr20L,fr21L,fr22L,fr23L,fr24L */ + { "fmpysub-double", 0x988541c6 }, /* fr4,fr5,fr6,fr7,fr8 */ +}; + +static void test_fp(const void *opaque) +{ + const FPTest *test =3D opaque; + static const uint32_t counts[] =3D { 0, 0, 1, 1, 2, 2, 3 }; + QTestState *qts =3D start_guest(true); + + write_words(qts, CODE, fp_guest, G_N_ELEMENTS(fp_guest)); + write_words(qts, FP_CODE, fp_site, G_N_ELEMENTS(fp_site)); + write_words(qts, ASSIST, assist_handler, G_N_ELEMENTS(assist_handler)); + qtest_writel(qts, CODE + 13 * 4, test->instruction); + qtest_writel(qts, FP_CODE + 4, test->instruction); + qtest_writeq(qts, DATA, 0x4000000000000000ULL); /* double 2 */ + run_guest(qts, 1); + for (size_t i =3D 0; i < G_N_ELEMENTS(counts); i++) { + g_assert_cmpuint(qtest_readl(qts, RESULT + 4 + 4 * i), =3D=3D, cou= nts[i]); + } + for (unsigned int i =3D 0; i < 3; i++) { + g_assert_cmphex(qtest_readl(qts, LOG + 16 * i), =3D=3D, test->inst= ruction); + g_assert_cmphex(qtest_readl(qts, LOG + 16 * i + 4), =3D=3D, FP_COD= E + 4); + if (test->memory) { + g_assert_cmphex(qtest_readl(qts, LOG + 16 * i + 8), =3D=3D, 0); + g_assert_cmphex(qtest_readl(qts, LOG + 16 * i + 12), =3D=3D, D= ATA); + } + } + g_assert_cmphex(qtest_readq(qts, DATA + 8), =3D=3D, 0x4000000000000000= ULL); + g_assert_cmphex(qtest_readq(qts, DATA + 16), =3D=3D, test->fr13); + qtest_quit(qts); +} + +static void test_lazy(void) +{ + static const uint64_t markers[] =3D { + 0x4030000000000000ULL, /* B =3D 16 */ + 0x4000000000000000ULL, /* A =3D 2 */ + 0x4040000000000000ULL, /* B =3D 32 */ + 0x4010000000000000ULL, /* A =3D 4 */ + }; + QTestState *qts =3D start_guest(true); + + write_words(qts, CODE, lazy_guest, G_N_ELEMENTS(lazy_guest)); + write_words(qts, FP_CODE, lazy_site, G_N_ELEMENTS(lazy_site)); + write_words(qts, ASSIST, lazy_handler, G_N_ELEMENTS(lazy_handler)); + qtest_writeq(qts, DATA, 0x3ff0000000000000ULL); /* A =3D 1 */ + qtest_writeq(qts, DATA + 16, markers[0]); + run_guest(qts, 1); + g_assert_cmpuint(qtest_readl(qts, RESULT + 4), =3D=3D, 4); + for (size_t i =3D 0; i < G_N_ELEMENTS(markers); i++) { + g_assert_cmphex(qtest_readq(qts, RESULT + 32 + 8 * i), =3D=3D, mar= kers[i]); + } + g_assert_cmphex(qtest_readq(qts, DATA), =3D=3D, 0x4010000000000000ULL); + g_assert_cmphex(qtest_readq(qts, DATA + 16), =3D=3D, 0x405000000000000= 0ULL); + qtest_quit(qts); +} + +static const uint32_t fault_guest[] =3D { + 0x34011000, /* ldi 0x800,r1 */ + 0x01c11840, /* mtctl r1,iva */ + 0x34103000, /* ldi 0x1800,r16: replaced for unaligned cases */ + 0x34113200, /* ldi 0x1900,r17 */ + 0x01401840, /* mtctl r0,ccr */ + 0x08000240, /* replaced by ssm 2,r0 for data translation */ + 0x08000240, /* replaced by the FP instruction under test */ + 0x34010002, /* ldi 1,r1 */ + 0x6a210000, /* stw r1,0(r17): unexpectedly completed */ + 0xe80009aa, /* b,n 0x1600 */ +}; + +typedef struct FaultTest { + const char *name; + uint32_t instruction; + unsigned int exception; + uint32_t address; + bool dtlb; + bool memory; +} FaultTest; + +static const FaultTest fault_tests[] =3D { + { "unaligned-load", 0x2e00100c, 28, DATA + 2, false, true }, + { "unaligned-store", 0x2e00120c, 28, DATA + 2, false, true }, + { "dtlb-load", 0x2e00100c, 15, DATA, true, true }, + { "dtlb-store", 0x2e00120c, 15, DATA, true, true }, + { "disabled-uid1-arithmetic", 0x30000040, 22, DATA, false, false }, + { "disabled-uid1-memory", 0x2e00104c, 22, DATA, false, true }, +}; + +static void test_fault(const void *opaque) +{ + const FaultTest *test =3D opaque; + uint32_t addr =3D test->address; + QTestState *qts =3D start_guest(false); + + write_words(qts, CODE, fault_guest, G_N_ELEMENTS(fault_guest)); + qtest_writel(qts, CODE + 8, 0x34100000 | (addr << 1)); + if (test->dtlb) { + qtest_writel(qts, CODE + 20, 0x00020d60); /* ssm 2,r0 */ + } + qtest_writel(qts, CODE + 24, test->instruction); + run_guest(qts, 0x100 | test->exception); + g_assert_cmphex(qtest_readl(qts, RESULT + 4), =3D=3D, test->instructio= n); + g_assert_cmphex(qtest_readl(qts, RESULT + 8), =3D=3D, CODE + 24); + if (test->memory) { + g_assert_cmphex(qtest_readl(qts, RESULT + 12), =3D=3D, 0); + g_assert_cmphex(qtest_readl(qts, RESULT + 16), =3D=3D, addr); + } + qtest_quit(qts); +} + +int main(int argc, char **argv) +{ + g_test_init(&argc, &argv, NULL); + if (!qtest_has_accel("tcg")) { + g_test_skip("TCG accelerator required"); + return 0; + } + for (size_t i =3D 0; i < G_N_ELEMENTS(fp_tests); i++) { + g_autofree char *name =3D g_strdup_printf("fpu/%s", fp_tests[i].na= me); + + qtest_add_data_func(name, &fp_tests[i], test_fp); + } + qtest_add_func("fpu/lazy-contexts", test_lazy); + for (size_t i =3D 0; i < G_N_ELEMENTS(fault_tests); i++) { + g_autofree char *name =3D g_strdup_printf("fpu/%s", fault_tests[i]= .name); + + qtest_add_data_func(name, &fault_tests[i], test_fault); + } + return g_test_run(); +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 46685d6d46..9d422886d8 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -158,6 +158,8 @@ qtests_alpha =3D ['boot-serial-test'] + \ qtests_avr =3D [ 'boot-serial-test' ] =20 qtests_hppa =3D \ + (config_all_accel.has_key('CONFIG_TCG') and \ + config_all_devices.has_key('CONFIG_GENERIC_LOADER') ? ['hppa-fpu-test']= : []) + \ qtests_filter + \ (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) =20 --=20 2.54.0 From nobody Mon Nov 23 04:26:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1793138001; cv=none; d=zohomail.com; s=zohoarc; b=GErLpw4m4++k/xzEyK0mnc6NDggpE+A+Qy47tMMux/xunX/LIbsqThekkQNEciLb0zUG1RGlC/k3X55i7lgqQCxHgJKmAWLrqnTlIj8C3cvKM0F70tNyl8ZTz09Di9qzxlxLTjlULVj+ZkNyRMl5m4wPIv8OTtmYW6g1YG95/6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793138001; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nifQMAWhUHxIgumuVEN0zZOLJDIsThVO7vDNUEJNWF4=; b=gTPe6tPF+LW9IQEjD4o/I9B0xwaTbPIJyNUxsrYgi+brZwLO0PcAKf0v5Jie1+5upLyxmPnb6UPsIe8T0ymR2W8cZtJHtFYkg3P2JceOrqIS3VsBEfc1cOYTovMXC63FwoTgfupU3PbiTe5rKwkB691+hsGwjSf0ctv7BqGusf8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793138001910325.0356730293953; Tue, 27 Oct 2026 14:53:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xLp5f-0002wQ-N0; Tue, 27 Oct 2026 17:52:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5e-0002vl-2H for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:18 -0400 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5c-000072-GX for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:17 -0400 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id D0CD560136; Tue, 27 Oct 2026 21:52:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63CF71F01828; Tue, 27 Oct 2026 21:52:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793137935; bh=nifQMAWhUHxIgumuVEN0zZOLJDIsThVO7vDNUEJNWF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RlbyEcwG8w7YHMFFUrzOB3QF0z0/lBt1kl6360j01gk/7itPa/ndLvh0VHQgXwEnV KfefFtl7+RZd2mWQ4DYX8T07kyTvzUHzyrmikCghLnXdFnhs5y/GnJuznMbYdaWa4/ 7Dgq52pE53xtE6pungGglyl1eH6m7T2Div7aB47Oz+3ZW2GyNOVwghSGypLmcaiZEj y8Gh++KjeOJdIhFBWzwxqN2qtk0c0Lj9htcg/4EBejl2ql4N29c6Fh9emXUVCAmwWO TFJbHMMWjgMyKVcDRoCFHqIyGR37+PyVLdaCnLHtf8EYgNTs/yYH0hOLVoGqKVHShn pxKSnJUsrGVbg== From: Helge Deller To: qemu-devel@nongnu.org Cc: Richard Henderson , Keith Monahan , "Kirill A . Korinsky" , Helge Deller Subject: [PATCH 2/8] target/hppa: Use 15 bit protection IDs on PA1.1 CPUs Date: Tue, 27 Oct 2026 22:52:03 +0100 Message-ID: <20261027215209.21150-3-deller@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261027215209.21150-1-deller@kernel.org> References: <20261027215209.21150-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2600:3c04:e001:324:0:1991:8:25; envelope-from=deller@kernel.org; helo=tor.source.kernel.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1793138003330154100 Content-Type: text/plain; charset="utf-8" From: Keith Monahan HP-UX 9.05 only supports 15-bit protection IDs and gets a protection fault on its own interrupt stack when allowing 18-bits. Since the architecture manual states that if smaller than 18-bit access IDs are physically implemented in the CPU, only the appropriate number of rightmost bits of GR[r]{13..30} are stored in the TLB. PA7100 and PA7100LC only support 15 bit protection IDs, so use this amount of bits here. Signed-off-by: Keith Monahan Signed-off-by: Helge Deller --- target/hppa/mem_helper.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index a5da0bc851..7a316f59ea 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -538,7 +538,15 @@ void HELPER(itlba_pa11)(CPUHPPAState *env, target_ulon= g addr, target_ulong reg) static void set_access_bits_pa11(CPUHPPAState *env, HPPATLBEntry *ent, target_ulong reg) { - ent->access_id =3D extract32(reg, 1, 18); + /* + * The architecture manual states that if smaller than 18-bit access I= Ds + * are physically implemented in the CPU, only the appropriate number = of + * rightmost bits of GR[r]{13..30} are stored in the TLB. Older parisc + * chips (PCXS, PCXT, PCXL, PCXL2) only support 15 bit protection IDs. + * PCXT' (pa7200) has 18 bit protection IDs, but only 16 bit spaceids. + * We currently emulate PA7100 and PA7100LC CPUs, so use 15 bits here. + */ + ent->access_id =3D extract32(reg, 1, 15); /* 15-bit PA1.1 PIDs */ ent->u =3D extract32(reg, 19, 1); ent->ar_pl2 =3D extract32(reg, 20, 2); ent->ar_pl1 =3D extract32(reg, 22, 2); --=20 2.54.0 From nobody Mon Nov 23 04:26:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1793137979; cv=none; d=zohomail.com; s=zohoarc; b=QeZGnyXIBjRDpLR31rJveqDr9IPnQISm9wX5s7t7L85jgC+cDKtxngvmpuIQCMWmmJWXGJDq8yYMD73iP2ERCkvMuicUx/wRFVbbUMRCgrU8qveo4ZwMvhtGQwIN1q4C89bN6xpBGdsLY4FZj7596zpNONTBdC1WcW056wNU0V0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793137979; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ncuZGiDq7qjELiRW4lF+A0ExaCCvEQiV272wfgrMbWQ=; b=cZ6LKAqTj5oX1BkW5diPY/8IgyR5+JIYJ9R24Qmz0Itr4E4NKejvus8+PTWRjbCGz5Swh4BF8zHmFFjgxLQZniQN41dwD72pd3mFCbcuU8pkHFlcziNHBmPrYGGKDCGfCTZ9pFrhjTMoVPu8FPyzArZ6XAyNpXd6QO3IMTIQfIw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793137979320253.34343681656003; Tue, 27 Oct 2026 14:52:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xLp5h-0002x7-7U; Tue, 27 Oct 2026 17:52:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5g-0002wg-2j for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:20 -0400 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5e-00007I-JH for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:19 -0400 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 87199401BE; Tue, 27 Oct 2026 21:52:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2002D1F01825; Tue, 27 Oct 2026 21:52:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793137937; bh=ncuZGiDq7qjELiRW4lF+A0ExaCCvEQiV272wfgrMbWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VeVaJdYgXvchzuSfZR+SUShnSHXqgh+/hYAyiUNOvF/70jLochNwFI+4X60ibYrnd IT7fLI9oP471f4W81197I2ZdE4yYLHnIHGqWOMK03U/5lNf2CKyncOOyHAGXLvts3D MSKNHRDjZP37/TqCb0rRETgD6je5QZvWZEHF6UCC3EHoTgDmapcE7+pTV/Het1lXSH /ml9IdQ7OzF0thg29+OUUtkps7mAydvylSKJyMxusptduxswrn2OZYgmJ2xhO1SBQZ 3IyHYAGAlsBcr2hwwBDgGgCwyHV1UF3L/YLuCfB39BvoQ45tlbOLtQKywY4usWQG74 /5Ts8wEjl53Gg== From: Helge Deller To: qemu-devel@nongnu.org Cc: Richard Henderson , Keith Monahan , "Kirill A . Korinsky" , Helge Deller Subject: [PATCH 3/8] target/hppa: Only allow 8 BTLB entries for HP-UX 9.05 Date: Tue, 27 Oct 2026 22:52:04 +0100 Message-ID: <20261027215209.21150-4-deller@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261027215209.21150-1-deller@kernel.org> References: <20261027215209.21150-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=deller@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1793137983126154100 Content-Type: text/plain; charset="utf-8" From: Keith Monahan The physical PA100LC and PA7300LC CPUs implement 8 BTLB entries only. HP-UX 9.05 seems to have problems if more are available, so reduce the number to 8 entries to allow HP-UX 9.05 to boot. Signed-off-by: Keith Monahan Signed-off-by: Helge Deller --- target/hppa/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index c0ba787974..da48a78569 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -248,7 +248,7 @@ typedef struct CPUArchState { * ??? The number of entries isn't specified by the architecture. * BTLBs are not supported in 64-bit machines. */ -#define PA10_BTLB_FIXED 16 +#define PA10_BTLB_FIXED 8 #define PA10_BTLB_VARIABLE 0 #define HPPA_TLB_ENTRIES 256 =20 --=20 2.54.0 From nobody Mon Nov 23 04:26:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1793137979; cv=none; d=zohomail.com; s=zohoarc; b=ieskP/f/bPDY1kq6sHwuPZPwTGgvP+1XkERPkdTn0BVgTcL3IYS6vAyohHQ7lsdCbnH9vq3q9lmWF9YsUefs/VFJjoq5w2JUdHnor9NS6sKOn3RJqkLTcJQrbg06eiITy9qfBveovmXbmflMmZdixJIVkK+hMmUEKlLHV6So06E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793137979; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=M6khnN4p2EYxNVrIWHFbBZ9IyWZpUi0pUO8tKjJnifI=; b=e4jf/f8FLQAtHpqbaj1KbWISVPr3aCTtJUtVzXh/90I2289z2xz6oe95n3i5/oadSKdNk6hTnxPlhE4JHXWqbXc07P4gIB/WkiYJUzBrz40KisIsylNvrP/Hkkxos1ktTq9Okocm5HudkhZqgVfGRridTrqb4q7WGb5/jF3K5Yw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793137979933608.4464843354623; Tue, 27 Oct 2026 14:52:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xLp5k-0002xe-J7; Tue, 27 Oct 2026 17:52:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5h-0002xN-Sw for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:21 -0400 Received: from tor.source.kernel.org ([172.105.4.254]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5g-00007b-6c for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:21 -0400 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 87B76600C8; Tue, 27 Oct 2026 21:52:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D92031F01825; Tue, 27 Oct 2026 21:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793137939; bh=M6khnN4p2EYxNVrIWHFbBZ9IyWZpUi0pUO8tKjJnifI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Oj+rCg1D5BNCWnuW2eyN0M0vPPCy3E3DgB+x5IEEjyK7nZhzYdKLCyZOYFhdAfFwS /zqii5D0thzfZAOH3eeVK3cNmw/P/inl7/WkQP1y5K5b7YqcbYEuIX6UgZTCqZo6Hk vgsf8Qjqp+BpjEr656DkfDJDhm30W56XXxRk1//oZp/DZXSmq6pnTMELne3i0Ob6Hm AGIQR5spiq7SvYaia7FKw2vOd6Bu5WhZYyCFmIMP9Y0ho6K+3epbUyXqhZf6pRij5r xVpwuS/tD/J/ZfACaioZiU7EKdSOhjQabZqngKzd8atikev62yJvEvZ3DQ/C2GIcDM dWXTiEtDj6F/g== From: Helge Deller To: qemu-devel@nongnu.org Cc: Richard Henderson , Keith Monahan , "Kirill A . Korinsky" , Helge Deller Subject: [PATCH 4/8] target/hppa: Implement local broadcast I/O space Date: Tue, 27 Oct 2026 22:52:05 +0100 Message-ID: <20261027215209.21150-5-deller@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261027215209.21150-1-deller@kernel.org> References: <20261027215209.21150-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=172.105.4.254; envelope-from=deller@kernel.org; helo=tor.source.kernel.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1793137982856158500 Content-Type: text/plain; charset="utf-8" From: Keith Monahan The local broadcast I/O space is used by older operating systems like HP-UX= 9.05 to send an interrupt to all CPUs, or to issue a system reset. Wire it up on the emulated 715 machine to allow HP-UX 9.05 to run. Signed-off-by: Keith Monahan Signed-off-by: Helge Deller --- hw/hppa/machine.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 96d57b9b0f..8d378385b2 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -573,6 +573,47 @@ static void machine_HP_common_init_tail(MachineState *= machine, PCIBus *pci_bus, cpu[0]->env.kernel_entry =3D kernel_entry; } =20 +/* + * Local broadcast I/O space: a write to IO_EIR (offset 0) posts an extern= al + * interrupt on all processors, CMD_RESET (5) written to IO_COMMAND (0x30) + * resets the system. HP-UX 9 reboots through the latter. + */ +#define HPPA_BROADCAST_HPA 0xfffc0000 +#define HPPA_IO_COMMAND 0x30 +#define HPPA_CMD_RESET 5 + +static uint64_t hppa_broadcast_read(void *opaque, hwaddr addr, unsigned si= ze) +{ + return 0; +} + +static void hppa_broadcast_write(void *opaque, hwaddr addr, uint64_t val, + unsigned size) +{ + unsigned int i; + + switch (addr) { + case 0: + for (i =3D 0; i < current_machine->smp.cpus; i++) { + hppa_io_eir_ops.write(cpu[i], 0, val, 4); + } + break; + case HPPA_IO_COMMAND: + if (val =3D=3D HPPA_CMD_RESET) { + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); + } + break; + } +} + +static const MemoryRegionOps hppa_broadcast_ops =3D { + .read =3D hppa_broadcast_read, + .write =3D hppa_broadcast_write, + .endianness =3D DEVICE_BIG_ENDIAN, + .valid.min_access_size =3D 4, + .valid.max_access_size =3D 4, +}; + /* * Create HP 715/64 workstation */ @@ -597,6 +638,14 @@ static void machine_HP_715_init(MachineState *machine) isa_bus =3D hppa_isa_bus(translate(NULL, IDE_HPA)); assert(isa_bus); =20 + /* Local broadcast I/O space */ + MemoryRegion *dev_mr_bcast =3D g_new(MemoryRegion, 1); + memory_region_init_io(dev_mr_bcast, NULL, &hppa_broadcast_ops, NULL, + "local-broadcast", 0x1000); + memory_region_add_subregion(addr_space, + translate(NULL, HPPA_BROADCAST_HPA), + dev_mr_bcast); + /* Init Lasi chip */ lasi_dev =3D DEVICE(lasi_init()); hpm->lasi_dev =3D lasi_dev; --=20 2.54.0 From nobody Mon Nov 23 04:26:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1793137979; cv=none; d=zohomail.com; s=zohoarc; b=aXqQ5KLSnnot4phhgm1+EBtx8chICFeXEixJSPztt82UZx2CiROEEVeWyShMzkrp5eB8PaL2he1usQVPH34YvMU1n77dmZR89Qn4UEFQ5NSzo1+3TPyrV5uu1S0H56xLE6dvLyPhZ12Jnj86Ac+KPSZ3PziZ2iiKy66aBcnNKIA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793137979; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bTBTtjYW8t5JMYhZRolyj7KJl2yanea6gt+IEaYH3eM=; b=KOPgEwmdb3BgwgQi3KMs6+ilaGeaNtpZc3gEfoQDCHaxcRQ9BYehvObXVj6q4M8ozQ1WHM/QjE8nEnH5plGwj9FBVTBf7vxhOuvzu4PpRUwfNvCMHqB9P6ZEzsmlCUWabpLGhaw1iU8KdnFwYBbknBboFJmZaFfmIZ69t4fi3tw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793137979874531.2291642871123; Tue, 27 Oct 2026 14:52:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xLp5o-0002yZ-0K; Tue, 27 Oct 2026 17:52:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5j-0002xo-T6 for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:24 -0400 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5i-00007r-7O for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:23 -0400 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 6CF4160136; Tue, 27 Oct 2026 21:52:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B72131F01825; Tue, 27 Oct 2026 21:52:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793137941; bh=bTBTtjYW8t5JMYhZRolyj7KJl2yanea6gt+IEaYH3eM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PnnGZGanaQwzBu2QDp2ZtwarBF8H22ys/q/4B+pvYFX9W8lxQ4s4L3CSMCW7HXL+S F8OCzFnuBtL6n3denmHikmsUw8m9/u5J+S+xinZKNQFOc7s6YC3DEs0+ib0QEdUitt SK/2oiumLRVp5edUH4IA++ixFl9XbGLOC5UK66lRWFf8TV04l9A/bxV0aeYp3qEKKS KpV8yBdvPqGP24WRhQ8wsqyKrbNHigIsR8nRILI5hgFzLyxjYjtU07JyfDjaw61g41 vlnv0W0FOWa7mnj3X4YfXrK/fqVbXqp04HarSgTjNvwTu0l2R1Y/xTLDT7rNmChk9T uU4BowYBU2apw== From: Helge Deller To: qemu-devel@nongnu.org Cc: Richard Henderson , Keith Monahan , "Kirill A . Korinsky" , Helge Deller Subject: [PATCH 5/8] target/hppa: Preload I/O-space BTLB entries for LASI and the central bus Date: Tue, 27 Oct 2026 22:52:06 +0100 Message-ID: <20261027215209.21150-6-deller@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261027215209.21150-1-deller@kernel.org> References: <20261027215209.21150-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2600:3c04:e001:324:0:1991:8:25; envelope-from=deller@kernel.org; helo=tor.source.kernel.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1793137982846158500 Content-Type: text/plain; charset="utf-8" From: Keith Monahan Set up the BTLB to allow operating systems to access LASI and central bus addresses. Signed-off-by: Keith Monahan Signed-off-by: Helge Deller --- hw/hppa/machine.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 8d378385b2..e403ae5fc9 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -896,6 +896,38 @@ static void hppa_machine_reset(MachineState *ms, Reset= Type type) cpu[i]->env.gr[5] =3D CPU_HPA + i * 0x1000; } =20 + /* + * BTLB equivalence maps for the I/O ranges HP-UX 9 uses + * without creating page directory entries: the LASI block and the + * central bus (CPU HPA, broadcast). Must not cover other I/O space, = as + * HP-UX probes with LPA and skips pdir setup for already mapped pages. + */ + if (!hppa_is_pa20(&cpu[0]->env)) { + static const struct { uint32_t start, last; } io_btlb[] =3D { + { 0xf0100000, 0xf01fffff }, /* LASI */ + { 0xfff80000, 0xffffffff }, /* central bus */ + }; + CPUHPPAState *env =3D &cpu[0]->env; + + for (i =3D 0; i < ARRAY_SIZE(io_btlb); i++) { + HPPATLBEntry *ent =3D &env->tlb[HPPA_BTLB_ENTRIES(env) - 1 - i= ]; + + ent->itree.start =3D io_btlb[i].start; + ent->itree.last =3D io_btlb[i].last; + ent->pa =3D io_btlb[i].start; + ent->access_id =3D 0; + ent->u =3D 1; + ent->ar_pl2 =3D 0; + ent->ar_pl1 =3D 0; + ent->ar_type =3D 1; + ent->b =3D 0; + ent->d =3D 1; + ent->t =3D 0; + ent->entry_valid =3D 1; + interval_tree_insert(&ent->itree, &env->tlb_root); + } + } + cpu[0]->env.gr[26] =3D ms->ram_size; cpu[0]->env.gr[25] =3D cpu[0]->env.kernel_entry; cpu[0]->env.gr[24] =3D cpu[0]->env.cmdline_or_bootorder; --=20 2.54.0 From nobody Mon Nov 23 04:26:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1793138051; cv=none; d=zohomail.com; s=zohoarc; b=Jj+Mvj0rxLYdv71xXDn6SAZ3gG7cQqJAujpiHawk8ZgTh7n/ClC4myOFVlAILcdi187JbARsDFd79ESnhv6mrzRBXgCVmRuTDeSJL9Gowab7FNYTeft8zb7y60FHjWi61WVTMXmrR8lLOY00x07hHXvMuI0qkZbIUueu4luwA6w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793138051; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+gnzdvy0CCdCGT8bLxvlqtrh/ZI6VuK7vXYb6nUotf4=; b=Te5JOfuVlRbelzosQmfJDuW2w8DhxVXAhn8sFQDwvvwMqnXYugrTaDdGe2neRXRglykVChQW3rDc83zSnrRNE9WYs8keKPS+nu8uOFPrH6GiUqstnKnRBca+CkYjEGu9mojcKriAcqhDVnqbnpOSJuV01kDQBiUjwaMHeZ4PazQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793138051035449.6627128117899; Tue, 27 Oct 2026 14:54:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xLp5r-0002zO-LQ; Tue, 27 Oct 2026 17:52:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5l-0002yG-Hf for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:25 -0400 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5k-00008C-4L for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:25 -0400 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 1C681401BE; Tue, 27 Oct 2026 21:52:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EC111F01825; Tue, 27 Oct 2026 21:52:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793137943; bh=+gnzdvy0CCdCGT8bLxvlqtrh/ZI6VuK7vXYb6nUotf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=J+0Zrdmz+Pxy2kjDdWUqwXj5BPqG8Mj7sZb/Prz/3/nC5Be/nS0+AsEcO6OvvZnCF z/b7Vvmc6LgAwQxx6QQZNbzTImkF1PuGvitGmKsc+N95Zn0zvz1d8cNuH/MAbL1Bh1 g2rkyd2Jyer/kHbDftKIZnr6WSxXX2EGqYItR13OPUKbFJooTViwE5ERFSsX/1n/u6 dEQ6kFeIRa2e2MUHLQ7IYblUpyZD8MHKgEc61PAzh2kkRHEy+mZd9fX+zksQzvvoYp oxe6TAO6BEINTgjtg/nT0FdWIZZ4GvVKjfo0k0GLQ/2tZ7H+i0N1hubFYYeqd+d/iL +7zH9tbKbJTDw== From: Helge Deller To: qemu-devel@nongnu.org Cc: Richard Henderson , Keith Monahan , "Kirill A . Korinsky" , Helge Deller Subject: [PATCH 6/8] artist: Redraw screen on colormap changes Date: Tue, 27 Oct 2026 22:52:07 +0100 Message-ID: <20261027215209.21150-7-deller@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261027215209.21150-1-deller@kernel.org> References: <20261027215209.21150-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=deller@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1793138052915158500 Content-Type: text/plain; charset="utf-8" From: Keith Monahan Invalidate screen on colormap change, as it affects every pixel on screen. This fixes VUE GUI on HP-UX 9.05. Signed-off-by: Keith Monahan Signed-off-by: Helge Deller --- hw/display/artist.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/display/artist.c b/hw/display/artist.c index 288d466ec6..300ad40e72 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -855,6 +855,12 @@ static int vram_bit_write(ARTISTState *s, uint32_t pos= , int posy, vram_write_bufidx(s) =3D=3D ARTIST_BUFFER_CURSOR2) { artist_invalidate_cursor(s); } + + if (vram_write_bufidx(s) =3D=3D ARTIST_BUFFER_CMAP) { + /* A colormap change affects every pixel on screen. */ + artist_invalidate(s); + } + return pos; } =20 --=20 2.54.0 From nobody Mon Nov 23 04:26:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1793138050; cv=none; d=zohomail.com; s=zohoarc; b=mZiKJsvzUE7Cg4kVH5B1AhbHwzw4lfms4ESQIHD3LmBeAQf0vxf8gn7v4BvNej6tvpXon1GrQZ3aBTqmDwBRXHIZhaBAw06AaEki7TKGk2GYZA5AzEttt/CzumV1SfZK/uV91MggmI8pLL3a14lJEgnFOKzLkI3eOtte3Sd74yA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793138050; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TdxpH9LqEk8teunsiMxYnCMRFckdheAuMSAcz8Ybunk=; b=nv/DoEg8WOSKkgqGZg4jyBcVbRqAb1umjWyKeOT3xg1n0QnMhfAsckdPa8jKudfLw9MOOw38cv/X1kWSY0uyLA9NUyJzWhWoTbIYzCCHtzMu9c4KPkeY8HyWWO0aMUqdmLAy+8eSDBwsmqDQwSTnb49UWZPMQLu8nrLmAGo7F1M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793138050839614.8794371074499; Tue, 27 Oct 2026 14:54:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xLp60-00030J-H7; Tue, 27 Oct 2026 17:52:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5n-0002yf-Cx for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:27 -0400 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5l-00008R-Sp for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:27 -0400 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id F14C343B15; Tue, 27 Oct 2026 21:52:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 769EE1F01825; Tue, 27 Oct 2026 21:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793137944; bh=TdxpH9LqEk8teunsiMxYnCMRFckdheAuMSAcz8Ybunk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cMMYurCV7eizWENUvMwDpedUbpi+CZaOdO3A6wcZ4bl/qimo3Plv1IX/zbCv5joyv A6ZLK1BO78v8h1EBS2+aoALuBDO23TNTWDVcDxqn5veKvgDYUoenm5U/uT0prajXZz WCKVxRRPAbz/LyDfb3yXu1nYc0h9zbqJPrr8RMfKobcDrqxBfINOL8BNkIGalMx3+1 1BbyWxcUP29OfiR2TTRyq0ui/33RwE3KCl3g2t0ycEb9KvBXj4aTNCxjzFpXF5Bt3H zOKImOk5K7jI67ETmvVc31dgeC16Rcr0LLcaYux3yHrb5Z1EDz1MDvKQBFZDTDwNDj GO1i1ID2mALaw== From: Helge Deller To: qemu-devel@nongnu.org Cc: Richard Henderson , Keith Monahan , "Kirill A . Korinsky" , Helge Deller Subject: [PATCH 7/8] hw/misc/lasi: LASI Harmony Audio presence emulation Date: Tue, 27 Oct 2026 22:52:08 +0100 Message-ID: <20261027215209.21150-8-deller@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261027215209.21150-1-deller@kernel.org> References: <20261027215209.21150-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=deller@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1793138052072154100 Content-Type: text/plain; charset="utf-8" From: Helge Deller HP-UX 9 beeps through the harmony audio chip, and it panics if there isn't one, because the 715/64 has no HIL keyboard to beep through instead. Emulate the bare minimum of the chip's registers and report a running audio clock. There's still no sound. In the long run we plan to add a Harmony driver, but for now this is sufficient. Suggested-by: Keith Monahan Signed-off-by: Helge Deller --- hw/misc/lasi.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/misc/lasi.c b/hw/misc/lasi.c index f0dfd78b4d..76029804e1 100644 --- a/hw/misc/lasi.c +++ b/hw/misc/lasi.c @@ -36,8 +36,7 @@ static bool lasi_chip_mem_valid(void *opaque, hwaddr addr, case LASI_IAR: =20 case LASI_LPT: - case LASI_AUDIO: - case LASI_AUDIO + 4: + case LASI_AUDIO ... LASI_AUDIO + 0xFF: case LASI_UART: case LASI_LAN: case LASI_LAN + 12: /* LASI LAN MAC */ @@ -87,6 +86,13 @@ static MemTxResult lasi_chip_read_with_attrs(void *opaqu= e, hwaddr addr, val =3D s->iar; break; =20 + case LASI_AUDIO ... LASI_AUDIO + 0xFF: + /* + * Harmony audio not yet emulated. DIAG (0x3c) reports a running + * sample clock, which HP-UX 9 checks before using the beeper. + */ + val =3D (addr =3D=3D LASI_AUDIO + 0x3c); + break; case LASI_LPT: case LASI_UART: case LASI_LAN: @@ -158,9 +164,8 @@ static MemTxResult lasi_chip_write_with_attrs(void *opa= que, hwaddr addr, case LASI_LPT: /* XXX: reset parallel port */ break; - case LASI_AUDIO: - case LASI_AUDIO + 4: - /* XXX: reset audio port */ + case LASI_AUDIO ... LASI_AUDIO + 0xFF: + /* XXX: Harmony audio is not emulated */ break; case LASI_UART: /* XXX: reset serial port */ --=20 2.54.0 From nobody Mon Nov 23 04:26:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1793137980; cv=none; d=zohomail.com; s=zohoarc; b=ce2YsCgfVgeXvDSsblErLUrC63DXngGWTi+tPwFgOJ9Es/eINKvqLdozKHN2uhulfFxOd+0zsoW1oWaCh8nw7RpAjpTftmKb4TUqkXuOZhl/jx42FXXxzRsJO1w5PG5zMFmDuI+ZfbxG8c+lWP4f4utjYEtqXe1TSB0l0EJ/pFA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793137980; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dTZCJTYWVWJqF6kvOj5k8Dq8jE2tqLp4YrotU+lPUFg=; b=ftNv/7XoUkYEUXHSdyIzMR1aTs/l2gQImr6vhpJfexhcFBSCTwYNkPueRrtw3KttdLw4luCzVZ+16S2W8pOdwzkl6m51YR4w02N84D6dqaEAHec4pmtauDqJPU6H+PbpZ3fJnZ2sM5xPEjb578cbjLncK0o6Wro5AyZmqziFv0w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793137980757143.01810566159907; Tue, 27 Oct 2026 14:53:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xLp5x-0002zn-2B; Tue, 27 Oct 2026 17:52:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5p-0002z5-Uc for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:30 -0400 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xLp5n-00008b-TI for qemu-devel@nongnu.org; Tue, 27 Oct 2026 17:52:29 -0400 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 087A1409CA; Tue, 27 Oct 2026 21:52:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C5C41F01825; Tue, 27 Oct 2026 21:52:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793137946; bh=dTZCJTYWVWJqF6kvOj5k8Dq8jE2tqLp4YrotU+lPUFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SNvZQ8/c2DF4Ld+ctuJDDbTNOf0Ta7VMRG+87nHtm/TjB0bpL/BD8J2RyGUwt/VEM r9XZJ7O1SR6L9OWaO1Sl6NqqbUGXnJA+UDwWs5t3W3H7IMpQAY/zYFcvYJv2ULIiN9 MYMQ52RGiSJIORV3g4dTH+wHBW3t8cPWEWM0/BahJkpdIR7JkNUfScyFsS9uFjfOUB CVxdMbZQF41I3tpE6/11WLnGMUKisqHdX2oCD51kVFykAz0VHTrnOnQefuUqybJt2o tPlkVz/mSAfsHLF1xnKNpqy5KWWqLWTV6ZqN2hz0n9eMkFH8b3dKaIEKMIBrK8vflU F/c+t8if65RCw== From: Helge Deller To: qemu-devel@nongnu.org Cc: Richard Henderson , Keith Monahan , "Kirill A . Korinsky" , Helge Deller Subject: [PATCH 8/8] target/hppa: Map CPUs at same addresses as on physical machines Date: Tue, 27 Oct 2026 22:52:09 +0100 Message-ID: <20261027215209.21150-9-deller@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261027215209.21150-1-deller@kernel.org> References: <20261027215209.21150-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=deller@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1793137982868158500 Content-Type: text/plain; charset="utf-8" From: Helge Deller SeaBIOS version 26 allows to use random addresses for CPU_HPA, so drop the hardcoded CPU_HPA which was used until now for all machines, and use individual addresses which correspond to the CPU HPA on the physical machines. Signed-off-by: Helge Deller --- hw/hppa/machine.c | 23 +++++++++++++---------- target/hppa/cpu.h | 1 + 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index e403ae5fc9..f23936fc5b 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -241,11 +241,11 @@ static FWCfgState *create_fw_cfg(MachineState *ms, PC= IBus *pci_bus, fw_cfg_add_file(fw_cfg, "/etc/hppa/power-button-addr", g_memdup2(&val, sizeof(val)), sizeof(val)); =20 - val =3D cpu_to_le64(CPU_HPA + 16); + val =3D cpu_to_le64(cpu[0]->env.cpu_hpa + 16); fw_cfg_add_file(fw_cfg, "/etc/hppa/rtc-addr", g_memdup2(&val, sizeof(val)), sizeof(val)); =20 - val =3D cpu_to_le64(CPU_HPA + 24); + val =3D cpu_to_le64(cpu[0]->env.cpu_hpa + 24); fw_cfg_add_file(fw_cfg, "/etc/hppa/DebugOutputPort", g_memdup2(&val, sizeof(val)), sizeof(val)); =20 @@ -286,7 +286,8 @@ static DinoState *dino_init(MemoryRegion *addr_space) /* * Step 1: Create CPUs and Memory */ -static TranslateFn *machine_HP_common_init_cpus(MachineState *machine) +static TranslateFn *machine_HP_common_init_cpus(MachineState *machine, + target_ulong initial_cpu_hpa) { MemoryRegion *addr_space =3D get_system_memory(); unsigned int smp_cpus =3D machine->smp.cpus; @@ -299,6 +300,7 @@ static TranslateFn *machine_HP_common_init_cpus(Machine= State *machine) /* Create CPUs. */ for (unsigned int i =3D 0; i < smp_cpus; i++) { cpu[i] =3D HPPA_CPU(cpu_create(machine->cpu_type)); + cpu[i]->env.cpu_hpa =3D initial_cpu_hpa + i * 0x1000; } =20 /* Initialize memory */ @@ -321,7 +323,7 @@ static TranslateFn *machine_HP_common_init_cpus(Machine= State *machine) memory_region_init_io(cpu_region, OBJECT(cpu[i]), &hppa_io_eir_ops, cpu[i], name, 4); memory_region_add_subregion(addr_space, - translate(NULL, CPU_HPA + i * 0x1000), + translate(NULL, cpu[i]->env.cpu_hpa), cpu_region); =20 if (!hppa_is_pa20(&cpu[0]->env)) { @@ -339,7 +341,7 @@ static TranslateFn *machine_HP_common_init_cpus(Machine= State *machine) memory_region_init_io(cflush, NULL, &hppa_pci_ignore_ops, NULL, cflush_name, 4); memory_region_add_subregion(addr_space, - translate(NULL, CPU_HPA + i * 0x1000 + 0x500= ), + translate(NULL, cpu[i]->env.cpu_hpa + 0x500), cflush); } =20 @@ -347,7 +349,8 @@ static TranslateFn *machine_HP_common_init_cpus(Machine= State *machine) cpu_region =3D g_new(MemoryRegion, 1); memory_region_init_io(cpu_region, OBJECT(cpu[0]), &hppa_io_helper_ops, cpu[0], "cpu0-io-rtc", 2 * sizeof(uint64_t)); - memory_region_add_subregion(addr_space, translate(NULL, CPU_HPA + 16), + memory_region_add_subregion(addr_space, + translate(NULL, cpu[0]->env.cpu_hpa + 16), cpu_region); =20 /* Main memory region. */ @@ -626,7 +629,7 @@ static void machine_HP_715_init(MachineState *machine) ISABus *isa_bus; =20 /* Create CPUs and RAM. */ - translate =3D machine_HP_common_init_cpus(machine); + translate =3D machine_HP_common_init_cpus(machine, 0xfffbe000); =20 if (hppa_is_pa20(&cpu[0]->env)) { error_report("The HP 715/64 workstation requires a 32-bit " @@ -713,7 +716,7 @@ static void machine_HP_B160L_init(MachineState *machine) PCIBus *pci_bus; =20 /* Create CPUs and RAM. */ - translate =3D machine_HP_common_init_cpus(machine); + translate =3D machine_HP_common_init_cpus(machine, 0xfff10000); =20 if (hppa_is_pa20(&cpu[0]->env)) { error_report("The HP B160L workstation requires a 32-bit " @@ -810,7 +813,7 @@ static void machine_HP_C3700_init(MachineState *machine) bool is_C3700 =3D strcmp(mc->name, "C3700") =3D=3D 0; =20 /* Create CPUs and RAM. */ - translate =3D machine_HP_common_init_cpus(machine); + translate =3D machine_HP_common_init_cpus(machine, 0xfffa0000); =20 if (!hppa_is_pa20(&cpu[0]->env)) { error_report("The HP C3000 workstation requires a 64-bit CPU. " @@ -893,7 +896,7 @@ static void hppa_machine_reset(MachineState *ms, ResetT= ype type) cpu[i]->env.psw =3D PSW_Q; /* Firmware uses FP registers before configuring CCR. */ cpu[i]->env.cr[CR_SCRCCR] =3D 0xc0; - cpu[i]->env.gr[5] =3D CPU_HPA + i * 0x1000; + cpu[i]->env.gr[5] =3D cpu[i]->env.cpu_hpa; } =20 /* diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index da48a78569..7b708a564b 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -272,6 +272,7 @@ typedef struct CPUArchState { /* Fields up to this point are cleared by a CPU reset */ struct {} end_reset_fields; =20 + target_ulong cpu_hpa; /* HPA of this CPU */ target_ulong kernel_entry; /* Linux kernel was loaded here */ target_ulong cmdline_or_bootorder; target_ulong initrd_base, initrd_end; --=20 2.54.0