From patchwork Sat Jan 13 05:57:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13518867 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2AF12C4707B for ; Sat, 13 Jan 2024 05:58:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOX1Y-0007O1-W5; Sat, 13 Jan 2024 00:57:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1X-0007NJ-AI for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:39 -0500 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1V-00080T-HZ for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:39 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 64FF9CE259F; Sat, 13 Jan 2024 05:57:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF360C43143; Sat, 13 Jan 2024 05:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705125454; bh=day6KyXxhUli/IuqjOYXEYLGEYoeP1JU/ugYQ5fILLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wm6Li8nDws9aqsIS8czyk/aKK+R4ShXmcWUZyEoswYD/3PL6pP//XEsmk6mljazFj xvT536Pn8IPVtg5HIzyVTtxRdPhBFl1yYIpIpg/LkCKx0TX4P8AnilMK/8F8GMkzdt fXuUrmVKGdbORdKsCvjemEmRhTkzHvvsnzShXY/4r97rlZ2ZNxpoqv+Tq56irLqS2R CJH5mV34u6IHeQ4+ohzQtGlXdjoOk20kilb23R651Wz5tTk4dgZAM0j1WJewi/3vZB SmLTpgebsMxW3a9fmr71280iVYRSXQJCI93Ze+JaQLKSBEzHJ9lIxSF5Uv9F8hTXpp Uk5foUS/Isqtw== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Helge Deller , Richard Henderson , "Nelson H . F . Beebe" , Bruno Haible Subject: [PULL 01/10] hw/hppa/machine: Allow up to 3840 MB total memory Date: Sat, 13 Jan 2024 06:57:19 +0100 Message-ID: <20240113055729.4480-2-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240113055729.4480-1-deller@kernel.org> References: <20240113055729.4480-1-deller@kernel.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2604:1380:40e1:4800::1; envelope-from=deller@kernel.org; helo=sin.source.kernel.org X-Spam_score_int: -64 X-Spam_score: -6.5 X-Spam_bar: ------ X-Spam_report: (-6.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.09, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Helge Deller The physical hardware allows DIMMs of 4 MB size and above, allowing up to 3840 MB of memory, but is restricted by setup code to 3 GB. Increase the limit to allow up to the maximum amount of memory. Btw. the memory area from 0xf000.0000 to 0xffff.ffff is reserved by the architecture for firmware and I/O memory and can not be used for standard memory. An upcoming 64-bit SeaBIOS-hppa firmware will allow more than 3.75GB on 64-bit HPPA64. In this case the ram_max for the pa20 case will change. Signed-off-by: Helge Deller Noticed-by: Nelson H. F. Beebe Fixes: b7746b1194c8 ("hw/hppa/machine: Restrict the total memory size to 3GB") Reviewed-by: Richard Henderson Tested-by: Bruno Haible --- hw/hppa/machine.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index c8da7c18d5..b11907617e 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -276,6 +276,7 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine) unsigned int smp_cpus = machine->smp.cpus; TranslateFn *translate; MemoryRegion *cpu_region; + uint64_t ram_max; /* Create CPUs. */ for (unsigned int i = 0; i < smp_cpus; i++) { @@ -288,8 +289,10 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine) */ if (hppa_is_pa20(&cpu[0]->env)) { translate = translate_pa20; + ram_max = 0xf0000000; /* 3.75 GB (limited by 32-bit firmware) */ } else { translate = translate_pa10; + ram_max = 0xf0000000; /* 3.75 GB (32-bit CPU) */ } for (unsigned int i = 0; i < smp_cpus; i++) { @@ -311,9 +314,9 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine) cpu_region); /* Main memory region. */ - if (machine->ram_size > 3 * GiB) { - error_report("RAM size is currently restricted to 3GB"); - exit(EXIT_FAILURE); + if (machine->ram_size > ram_max) { + info_report("Max RAM size limited to %" PRIu64 " MB", ram_max / MiB); + machine->ram_size = ram_max; } memory_region_add_subregion_overlap(addr_space, 0, machine->ram, -1); From patchwork Sat Jan 13 05:57:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13518870 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C0A5BC4707B for ; Sat, 13 Jan 2024 05:58:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOX1Y-0007NS-17; Sat, 13 Jan 2024 00:57:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1W-0007NA-CT for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:38 -0500 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1U-00080d-VB for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:38 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id CC65060A1C; Sat, 13 Jan 2024 05:57:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AF9BC433F1; Sat, 13 Jan 2024 05:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705125455; bh=0yPQV6qryJK1G6FSn0cxJJf29iihOzbG0wiZ/T7WCYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SgAX2EftHV3dDI4c0442KRC7/VEC5nw+fOY/WOrKaSS+fBTWUz3fzqySKb3Nw31wN 0GGUMLkz5ZGBsEyftg0qpfusIkUvq9zLLGtIP3sSuRroP6K7OFBWSNftktwc7yAu+M nnD9tg1VHqXvT0RAgJRsJffopCtv8fJmSdE+uUA6G2ROkNRsKijbDm02n0tS2q9eqS nr2u7yiz02440yHMjhhizMYEIa8QDlG34eb5tpnOhRKfIzqlRRvhgICWN/YMCs18ED yUGZOQZ+VXe1WgeG5BOYBxF8ILNyb4XfBUAoVg17iJR7r86bn8lRDyIlxrh46DFjqN VAk+2ALSmJHWw== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Helge Deller , Richard Henderson Subject: [PULL 02/10] hw/hppa/machine: Disable default devices with --nodefaults option Date: Sat, 13 Jan 2024 06:57:20 +0100 Message-ID: <20240113055729.4480-3-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240113055729.4480-1-deller@kernel.org> References: <20240113055729.4480-1-deller@kernel.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2604:1380:4641:c500::1; envelope-from=deller@kernel.org; helo=dfw.source.kernel.org X-Spam_score_int: -64 X-Spam_score: -6.5 X-Spam_bar: ------ X-Spam_report: (-6.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.09, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Helge Deller Recognize the qemu --nodefaults option, which will disable the following default devices on hppa: - lsi53c895a SCSI controller, - artist graphics card, - LASI 82596 NIC, - tulip PCI NIC, - second serial PCI card, - USB OHCI controller. Adding this option is very useful to allow manual testing and debugging of the other possible devices on the command line. Signed-off-by: Helge Deller Reviewed-by: Richard Henderson --- hw/hppa/machine.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index b11907617e..54ca2fd91a 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -346,8 +346,10 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, SysBusDevice *s; /* SCSI disk setup. */ - dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a")); - lsi53c8xx_handle_legacy_cmdline(dev); + if (drive_get_max_bus(IF_SCSI) >= 0) { + dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a")); + lsi53c8xx_handle_legacy_cmdline(dev); + } /* Graphics setup. */ if (machine->enable_graphics && vga_interface_type != VGA_NONE) { @@ -360,7 +362,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, } /* Network setup. */ - if (enable_lasi_lan()) { + if (nd_table[0].used && enable_lasi_lan()) { lasi_82596_init(addr_space, translate(NULL, LASI_LAN_HPA), qdev_get_gpio_in(lasi_dev, LASI_IRQ_LAN_HPA)); } @@ -385,7 +387,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, pci_set_word(&pci_dev->config[PCI_SUBSYSTEM_ID], 0x1227); /* Powerbar */ /* create a second serial PCI card when running Astro */ - if (!lasi_dev) { + if (serial_hd(1) && !lasi_dev) { pci_dev = pci_new(-1, "pci-serial-4x"); qdev_prop_set_chr(DEVICE(pci_dev), "chardev1", serial_hd(1)); qdev_prop_set_chr(DEVICE(pci_dev), "chardev2", serial_hd(2)); From patchwork Sat Jan 13 05:57:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13518868 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61211C47DA6 for ; Sat, 13 Jan 2024 05:58:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOX1c-0007Pb-LK; Sat, 13 Jan 2024 00:57:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1Z-0007OG-5I for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:41 -0500 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1X-00081W-Fa for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:40 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id A41E3B81E96; Sat, 13 Jan 2024 05:57:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCE19C43390; Sat, 13 Jan 2024 05:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705125457; bh=U3j/ToWx+85xBmo08X6T2XIlE9iXxB17T37IKGebClU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QS6YRqAQDSUDQKx8pyQ1PJIHr11SPm7pG0yboYHW2FLj+zfFG7I16lGrsghRsdnB5 7XE16zgYdhyYUl2Cz2c24ShiWi0R89w5k5k2A+VBOiHVaRQdlwYUXaOyWLk9fG5TcL 6dlErxqfZ34l6yh2z9+zQ9v99wN6m5tdQIQCLMW6lpzoFvpHx1IR2Po032oQUBieEd 2Ayce7KSbiR91JvFESGPUUNTkuUHjejs8vG9Stm//Bs+MFqMnCcvF/u6pcUKixA3Ud To1qppc00oIaSG4lV4NX+TTt9dbPkor+yvieRjtKbNQn+lq+PcS0rW/4lR8cWatDAf aF65xSQ/FbW1Q== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Helge Deller , Richard Henderson , Bruno Haible Subject: [PULL 03/10] hw/pci-host/astro: Add missing astro & elroy registers for NetBSD Date: Sat, 13 Jan 2024 06:57:21 +0100 Message-ID: <20240113055729.4480-4-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240113055729.4480-1-deller@kernel.org> References: <20240113055729.4480-1-deller@kernel.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2604:1380:4601:e00::1; envelope-from=deller@kernel.org; helo=ams.source.kernel.org X-Spam_score_int: -64 X-Spam_score: -6.5 X-Spam_bar: ------ X-Spam_report: (-6.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.09, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Helge Deller NetBSD accesses some astro and elroy registers which aren't accessed by Linux yet. Add emulation for those registers to allow NetBSD to boot further. Please note that this patch is not sufficient to completely boot up NetBSD on the 64-bit C3700 machine yet. Signed-off-by: Helge Deller Tested-by: Bruno Haible --- hw/pci-host/astro.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/astro.c b/hw/pci-host/astro.c index 7d68ccee7e..cb2c8a828d 100644 --- a/hw/pci-host/astro.c +++ b/hw/pci-host/astro.c @@ -166,6 +166,8 @@ static MemTxResult elroy_chip_write_with_attrs(void *opaque, hwaddr addr, trace_elroy_write(addr, size, val); switch ((addr >> 3) << 3) { + case 0x000: /* PCI_ID & PCI_COMMAND_STATUS_REG */ + break; case 0x080: put_val_in_int64(&s->arb_mask, addr, size, val); break; @@ -175,6 +177,9 @@ static MemTxResult elroy_chip_write_with_attrs(void *opaque, hwaddr addr, case 0x200 ... 0x250 - 1: /* LMMIO, GMMIO, WLMMIO, WGMMIO, ... */ put_val_in_arrary(s->mmio_base, 0x200, addr, size, val); break; + case 0x300: /* ibase */ + case 0x308: /* imask */ + break; case 0x0680: put_val_in_int64(&s->error_config, addr, size, val); break; @@ -538,6 +543,9 @@ static MemTxResult astro_chip_read_with_attrs(void *opaque, hwaddr addr, case 0x0030: /* HP-UX 10.20 and 11.11 reads it. No idea. */ val = -1; break; + case 0x0078: /* NetBSD reads 0x78 ? */ + val = -1; + break; case 0x0300 ... 0x03d8: /* LMMIO_DIRECT0_BASE... */ index = (addr - 0x300) / 8; val = s->ioc_ranges[index]; @@ -624,31 +632,43 @@ static MemTxResult astro_chip_write_with_attrs(void *opaque, hwaddr addr, case 0x10220: case 0x10230: /* HP-UX 11.11 reads it. No idea. */ break; - case 0x22108: /* IOC STATUS_CONTROL */ - put_val_in_int64(&s->ioc_status_ctrl, addr, size, val); - break; case 0x20200 ... 0x20240 - 1: /* IOC Rope0_Control ... */ put_val_in_arrary(s->ioc_rope_control, 0x20200, addr, size, val); break; case 0x20040: /* IOC Rope config */ + case 0x22040: put_val_in_int64(&s->ioc_rope_config, addr, size, val); break; case 0x20300: + case 0x22300: put_val_in_int64(&s->tlb_ibase, addr, size, val); break; case 0x20308: + case 0x22308: put_val_in_int64(&s->tlb_imask, addr, size, val); break; case 0x20310: + case 0x22310: put_val_in_int64(&s->tlb_pcom, addr, size, val); /* TODO: flush iommu */ break; case 0x20318: + case 0x22318: put_val_in_int64(&s->tlb_tcnfg, addr, size, val); break; case 0x20320: + case 0x22320: put_val_in_int64(&s->tlb_pdir_base, addr, size, val); break; + case 0x22000: /* func_id */ + break; + case 0x22008: /* func_class */ + break; + case 0x22050: /* rope_debug */ + break; + case 0x22108: /* IOC STATUS_CONTROL */ + put_val_in_int64(&s->ioc_status_ctrl, addr, size, val); + break; /* * empty placeholders for non-existent elroys, e.g. * func_class, pci config & data From patchwork Sat Jan 13 05:57:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13518871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DC3C0C4707C for ; Sat, 13 Jan 2024 05:59:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOX1b-0007PS-1n; Sat, 13 Jan 2024 00:57:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1Z-0007OZ-EU for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:41 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1X-00081x-PA for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:41 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0305960A27; Sat, 13 Jan 2024 05:57:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 799DDC43394; Sat, 13 Jan 2024 05:57:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705125458; bh=mOLktRonaKZH8C27AtbCAzb//NlMZREdq+fLru7r8/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HWrXRklsDD0Vy4yy7aAPnGvLsTkacQ0V/VHzfWmPY+0psZMcPuV0YDzRsIVtANvUU k9SWXxKRZCNzWPsA5yP4oX7p0Y0CE6JxyJ3quP3kvQNslRrgN7YgqpukLU3NhvsNwu WRZitCH6UohTasW7Ra+09GXUbcQ7bmOwsCgcGqy5ckYbpVIgiA13SJhnAhkqvYKZXh 2oG3RcCbv8xsZODmN2dMNsvSlhGcgNIqcPLz1+czkAMeLZNGNamdpfrtk04GkFfQLG EVKcbKf/8DCNtLpPtmhJZdFcpvzoX9g8JwXqBxIVFRZULXyBhokwtk/SqDEj2Dp/K4 yw9ocMhVCEBwQ== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Helge Deller , Richard Henderson , Bruno Haible Subject: [PULL 04/10] target/hppa: Fix PDC address translation on PA2.0 with PSW.W=0 Date: Sat, 13 Jan 2024 06:57:22 +0100 Message-ID: <20240113055729.4480-5-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240113055729.4480-1-deller@kernel.org> References: <20240113055729.4480-1-deller@kernel.org> MIME-Version: 1.0 Received-SPF: pass client-ip=139.178.84.217; envelope-from=deller@kernel.org; helo=dfw.source.kernel.org X-Spam_score_int: -91 X-Spam_score: -9.2 X-Spam_bar: --------- X-Spam_report: (-9.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.09, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Helge Deller Fix the address translation for PDC space on PA2.0 if PSW.W=0. Basically, for any address in the 32-bit PDC range from 0xf0000000 to 0xf1000000 keep the lower 32-bits and just set the upper 32-bits to 0xfffffff0. This mapping fixes the emulated power button in PDC space for 32- and 64-bit machines and is how the physical C3700 machine seems to map PDC. Figures H-10 and H-11 in the parisc2.0 spec [1] show that the 32-bit region will be mapped somewhere into a higher and bigger 64-bit PDC space. The start and end of this 64-bit space is defined by the physical address bits. But the figures don't specifiy where exactly the mapping will start inside that region. Tests on a real HP C3700 regarding the address of the power button indicate, that the lower 32-bits will stay the same though. [1] https://parisc.wiki.kernel.org/images-parisc/7/73/Parisc2.0.pdf Signed-off-by: Helge Deller Tested-by: Bruno Haible Reviewed-by: Richard Henderson --- roms/seabios-hppa | 2 +- target/hppa/mem_helper.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/roms/seabios-hppa b/roms/seabios-hppa index 4c6ecda618..e4eac85880 160000 --- a/roms/seabios-hppa +++ b/roms/seabios-hppa @@ -1 +1 @@ -Subproject commit 4c6ecda618f2066707f50c53f31419244fd7f77a +Subproject commit e4eac85880e8677f96d8b9e94de9f2eec9c0751f diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index 08abd1a9f9..4c28c58ee9 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -55,8 +55,14 @@ hwaddr hppa_abs_to_phys_pa2_w0(vaddr addr) /* I/O address space */ addr = (int32_t)addr; } else { - /* PDC address space */ - addr &= MAKE_64BIT_MASK(0, 24); + /* + * PDC address space: + * Figures H-10 and H-11 of the parisc2.0 spec do not specify + * where to map into the 64-bit PDC address space. + * We map with an offset which equals the 32-bit address, which + * is what can be seen on physical machines too. + */ + addr = (uint32_t)addr; addr |= -1ull << (TARGET_PHYS_ADDR_SPACE_BITS - 4); } return addr; From patchwork Sat Jan 13 05:57:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13518869 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3DEA7C47DA2 for ; Sat, 13 Jan 2024 05:58:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOX1d-0007QE-JH; Sat, 13 Jan 2024 00:57:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1b-0007PT-P0 for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:43 -0500 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1a-00082e-4O for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:43 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id CE914B81C20; Sat, 13 Jan 2024 05:57:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15B62C433F1; Sat, 13 Jan 2024 05:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705125460; bh=IJ5Hk2c4pKpbKMUvwDlIeYXsDmcBPJqd+q6o7IPAq8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IyUWrTXAX9cPKHJHwBHJQMUYI7EyhLBkz7tNhbGuDR+W2KuWTs8lBR9WJP4sxEh86 wTZoCjHEscqG0gdtB2DbS5rWZd3Y7z39txIcZZXazDedGIJ93KoDamDOudpncqWscs rXoTjt4EP/cowHN0R4nZ5LVPxDCPMGWNgB5xNyDgNXWzazjUqGouLbemPuWaT4lv1+ yJqCMqifQ1J9MnBhtJBLVK/wbNNi7TiilUTyaWYRW5GpVrH1SIlXIhFuquYzlQxaNx eCiJs3pmzcM90ycMp12xewBNrf86W21SsomFwJ/0hlH6fX5Xcg+XEVbWRKa+U3VsJD KYZIx4Rm4vPDQ== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Helge Deller , Richard Henderson , Bruno Haible Subject: [PULL 05/10] hw/hppa: Move software power button address back into PDC Date: Sat, 13 Jan 2024 06:57:23 +0100 Message-ID: <20240113055729.4480-6-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240113055729.4480-1-deller@kernel.org> References: <20240113055729.4480-1-deller@kernel.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2604:1380:4601:e00::1; envelope-from=deller@kernel.org; helo=ams.source.kernel.org X-Spam_score_int: -64 X-Spam_score: -6.5 X-Spam_bar: ------ X-Spam_report: (-6.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.09, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Helge Deller The various operating systems (e.g. Linux, NetBSD) have issues mapping the power button when it's stored in page zero. NetBSD even crashes, because it fails to map that page and then accesses unmapped memory. Since we now have a consistent memory mapping of PDC in 32-bit and 64-bit address space (the lower 32-bits of the address are in sync) the power button can be moved back to PDC space. This patch fixes the power button on Linux, NetBSD and HP-UX. Signed-off-by: Helge Deller Tested-by: Bruno Haible Reviewed-by: Richard Henderson --- hw/hppa/machine.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 54ca2fd91a..9e611620cc 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -36,8 +36,8 @@ #define MIN_SEABIOS_HPPA_VERSION 12 /* require at least this fw version */ -/* Power button address at &PAGE0->pad[4] */ -#define HPA_POWER_BUTTON (0x40 + 4 * sizeof(uint32_t)) +#define HPA_POWER_BUTTON (FIRMWARE_END - 0x10) +static hwaddr soft_power_reg; #define enable_lasi_lan() 0 @@ -45,7 +45,6 @@ static DeviceState *lasi_dev; static void hppa_powerdown_req(Notifier *n, void *opaque) { - hwaddr soft_power_reg = HPA_POWER_BUTTON; uint32_t val; val = ldl_be_phys(&address_space_memory, soft_power_reg); @@ -221,7 +220,7 @@ static FWCfgState *create_fw_cfg(MachineState *ms, PCIBus *pci_bus, fw_cfg_add_file(fw_cfg, "/etc/hppa/machine", g_memdup(mc->name, len), len); - val = cpu_to_le64(HPA_POWER_BUTTON); + val = cpu_to_le64(soft_power_reg); fw_cfg_add_file(fw_cfg, "/etc/hppa/power-button-addr", g_memdup(&val, sizeof(val)), sizeof(val)); @@ -295,6 +294,8 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine) ram_max = 0xf0000000; /* 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); From patchwork Sat Jan 13 05:57:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13518872 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 365A3C4707B for ; Sat, 13 Jan 2024 05:59:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOX1e-0007QH-5w; Sat, 13 Jan 2024 00:57:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1c-0007Pc-OJ for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:44 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1b-00083P-B2 for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:44 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 323F960A27; Sat, 13 Jan 2024 05:57:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6104C43390; Sat, 13 Jan 2024 05:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705125461; bh=oUCHbLTLt1MvvljpncvV3usL/WuleAJ+iiuW0ytrHv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cYREz1eeMe+mwAqt7hjr7GuhGjFX3D8/xzB2BdDY/qjjCgavnsQ6y0W89MR4kVXp6 VVz+XuqVSjWXV8uwEIz/gcC5I2K4BFMURn5iS76cM34U3DdExIwJvKtQ4mDQD+VdiD QGWf5zCls36VCH/Ik710MptMAcJtG4DEUxZuJE+PAvE+/H2qMkvAmejZcZeOpInMfj h7WrBmlWCQboBadRRLySSUju868aZMfdQIqgIuQjpDBKQgMQX3n7CPmQwCOXJVbKPq jsakxqihdd+r38BOAqRQQV6xAf0GDK3j4GpXM8VqScPEC5hXIZIQFoAeuIn4o7BDBT OgWdJIpwiI4pQ== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Helge Deller , Richard Henderson , Bruno Haible Subject: [PULL 06/10] target/hppa: Avoid accessing %gr0 when raising exception Date: Sat, 13 Jan 2024 06:57:24 +0100 Message-ID: <20240113055729.4480-7-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240113055729.4480-1-deller@kernel.org> References: <20240113055729.4480-1-deller@kernel.org> MIME-Version: 1.0 Received-SPF: pass client-ip=139.178.84.217; envelope-from=deller@kernel.org; helo=dfw.source.kernel.org X-Spam_score_int: -91 X-Spam_score: -9.2 X-Spam_bar: --------- X-Spam_report: (-9.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.09, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Helge Deller The value of unwind_breg may reference register %r0, but we need to avoid accessing gr0 directly and use the value 0 instead. At runtime I've seen unwind_breg being zero with the Linux kernel when rfi is used to jump to smp_callin(). Signed-off-by: Helge Deller Reviewed-by: Richard Henderson Tested-by: Bruno Haible --- target/hppa/mem_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index 4c28c58ee9..1387f4a64b 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -341,7 +341,7 @@ raise_exception_with_ior(CPUHPPAState *env, int excp, uintptr_t retaddr, cpu_restore_state(cs, retaddr); - b = env->gr[env->unwind_breg]; + b = env->unwind_breg ? env->gr[env->unwind_breg] : 0; b >>= (env->psw & PSW_W ? 62 : 30); env->cr[CR_IOR] |= b << 62; From patchwork Sat Jan 13 05:57:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13518866 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F59CC47258 for ; Sat, 13 Jan 2024 05:58:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOX1i-0007R7-Q0; Sat, 13 Jan 2024 00:57:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1g-0007Qd-UU for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:48 -0500 Received: from sin.source.kernel.org ([145.40.73.55]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1f-00084p-6F for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:48 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id F0DFACE1DBF; Sat, 13 Jan 2024 05:57:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42421C433C7; Sat, 13 Jan 2024 05:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705125463; bh=yzm3CMifRY3radrXwAH5GaBfEDdVB95MfErfKwEwvpM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fTpaQoKDj6pnxL8+gdeV22tGc/ROuaimsWvYqKWh/F/eq9WJEwwdpJ1KYWbyieeAB mCQLUcrr/cR1hC7pSDPxHH9LnSXGG/YIWm9WSZhxa/79qYLW8zGu8q+kQ5wTnrc+nR 0Qp0T0lOLvxzlrPpHmnFe0437CYawFAltJ8IUWKRPFrDVjMIgYwc0WL5cRgCwsbNbL LaHONkQcLpfkhRBojop3TMxxn+BHlexKy5gM7DDOw7Dn0QYRIXDIb8vN1aPDeYkviz 9FWGzYpfMbyIQ+4ziPiabYaDoED6eY3wZ8Xk8pA3H1Jke6AFvxAtrdIYnwKJfE/amk Y+jwMaC5ySNyw== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Helge Deller , Richard Henderson Subject: [PULL 07/10] target/hppa: Export function hppa_set_ior_and_isr() Date: Sat, 13 Jan 2024 06:57:25 +0100 Message-ID: <20240113055729.4480-8-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240113055729.4480-1-deller@kernel.org> References: <20240113055729.4480-1-deller@kernel.org> MIME-Version: 1.0 Received-SPF: pass client-ip=145.40.73.55; envelope-from=deller@kernel.org; helo=sin.source.kernel.org X-Spam_score_int: -64 X-Spam_score: -6.5 X-Spam_bar: ------ X-Spam_report: (-6.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.09, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Helge Deller Move functionality to set IOR and ISR on fault into own function. This will be used by follow-up patches. Signed-off-by: Helge Deller Reviewed-by: Richard Henderson --- target/hppa/cpu.h | 1 + target/hppa/mem_helper.c | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 8be45c69c9..9556e95fab 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -385,6 +385,7 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f, int); #ifndef CONFIG_USER_ONLY void hppa_ptlbe(CPUHPPAState *env); hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr); +void hppa_set_ior_and_isr(CPUHPPAState *env, vaddr addr, bool mmu_disabled); bool hppa_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MMUAccessType access_type, int mmu_idx, bool probe, uintptr_t retaddr); diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index 1387f4a64b..4fcc612754 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -305,14 +305,8 @@ hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) return excp == EXCP_DTLB_MISS ? -1 : phys; } -G_NORETURN static void -raise_exception_with_ior(CPUHPPAState *env, int excp, uintptr_t retaddr, - vaddr addr, bool mmu_disabled) +void hppa_set_ior_and_isr(CPUHPPAState *env, vaddr addr, bool mmu_disabled) { - CPUState *cs = env_cpu(env); - - cs->exception_index = excp; - if (env->psw & PSW_Q) { /* * For pa1.x, the offset and space never overlap, and so we @@ -339,16 +333,23 @@ raise_exception_with_ior(CPUHPPAState *env, int excp, uintptr_t retaddr, */ uint64_t b; - cpu_restore_state(cs, retaddr); - b = env->unwind_breg ? env->gr[env->unwind_breg] : 0; b >>= (env->psw & PSW_W ? 62 : 30); env->cr[CR_IOR] |= b << 62; - - cpu_loop_exit(cs); } } } +} + +G_NORETURN static void +raise_exception_with_ior(CPUHPPAState *env, int excp, uintptr_t retaddr, + vaddr addr, bool mmu_disabled) +{ + CPUState *cs = env_cpu(env); + + cs->exception_index = excp; + hppa_set_ior_and_isr(env, addr, mmu_disabled); + cpu_loop_exit_restore(cs, retaddr); } From patchwork Sat Jan 13 05:57:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13518873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E778C4707B for ; Sat, 13 Jan 2024 05:59:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOX1j-0007RG-9X; Sat, 13 Jan 2024 00:57:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1h-0007Ql-QV for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:49 -0500 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1g-00085c-4J for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:49 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 5D215CE23C7; Sat, 13 Jan 2024 05:57:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A38BBC433F1; Sat, 13 Jan 2024 05:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705125464; bh=sM2ZWgk6JWatVLRPpAnEmobohCrep0P3Z/YMyGxKwtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iAn6o6LwipUiNz2YwBneIi7anfobVuqeM7ykxzCr6gTiTnNRZ6j+2NV3lTm2j9gsg dASxfW8YnLlmr9veIQ5g5B6AEpiJSTSmKJQ+6aqUpOpqmsN7aVDb2miPBSnrmWQWXW GIRU5pe6PNAi6odyYqPuIt8jd6CQszy3g+enTVSO+73s1O4dlMVW+EqDTpelkkc5Tf h7aC1Im7vS2UPOiBa7BA87CRUASJ7II9oa/Hda4i+slahiyeB9Mmwp2M6zMNWk2mg/ EPBoIHjT7NSyc6agud5BeOvGhbjgh58Di7ZY1IcjhOwHSu+7xI1i3gaDNHbcLPWHTj Jaz2LTZY3Dr3A== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Helge Deller , Richard Henderson Subject: [PULL 08/10] target/hppa: Fix IOR and ISR on unaligned access trap Date: Sat, 13 Jan 2024 06:57:26 +0100 Message-ID: <20240113055729.4480-9-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240113055729.4480-1-deller@kernel.org> References: <20240113055729.4480-1-deller@kernel.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2604:1380:40e1:4800::1; envelope-from=deller@kernel.org; helo=sin.source.kernel.org X-Spam_score_int: -64 X-Spam_score: -6.5 X-Spam_bar: ------ X-Spam_report: (-6.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.09, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Helge Deller Put correct values (depending on CPU arch) into IOR and ISR on fault. Signed-off-by: Helge Deller Reviewed-by: Richard Henderson --- target/hppa/cpu.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 04de1689d7..fda32d7f59 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -110,11 +110,7 @@ void hppa_cpu_do_unaligned_access(CPUState *cs, vaddr addr, CPUHPPAState *env = &cpu->env; cs->exception_index = EXCP_UNALIGN; - if (env->psw & PSW_Q) { - /* ??? Needs tweaking for hppa64. */ - env->cr[CR_IOR] = addr; - env->cr[CR_ISR] = addr >> 32; - } + hppa_set_ior_and_isr(env, addr, MMU_IDX_MMU_DISABLED(mmu_idx)); cpu_loop_exit_restore(cs, retaddr); } From patchwork Sat Jan 13 05:57:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13518874 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F358C47258 for ; Sat, 13 Jan 2024 05:59:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOX1j-0007RO-Qt; Sat, 13 Jan 2024 00:57:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1i-0007R8-TK for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:50 -0500 Received: from sin.source.kernel.org ([145.40.73.55]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOX1h-00086D-AP for qemu-devel@nongnu.org; Sat, 13 Jan 2024 00:57:50 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C7887CE259A; Sat, 13 Jan 2024 05:57:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 109F0C433C7; Sat, 13 Jan 2024 05:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705125466; bh=HMscmGeaFXpMMw/G897fJ5R4jD8hIiSvdjBj8a9jRtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uwjiqwg09U/PqwY7smY4eO93K3GyciKXFTHut7sBWTTGTPj0W0o7sFVFX4Kr81Mfm ZKRTWQ/+qg9i7RpgvshhBZSobRNsu9hwQCTvWVkBuUdwDA0ZtJvlEeu1HU5QnHO1wz V63nY/xKHF3FLOAZgAJ9oZgbuWfEX8AROPf81pgeaDEFzk/Lx64g/hJgcxYuZuZ3CH UrYcav/ddIilunr4AQJ0I57mWiHnAnXXyhKKfotWl1vRlJxNrctFBycNXLdu1dM319 qxS46aaAo9+htfYg5WXyMlZiK1KzP9/fxbhu+JjKmNKW27jlFOn5ot3TTfOE4M7ml4 h8vSzCTYzzp+g== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Helge Deller , Richard Henderson Subject: [PULL 09/10] target/hppa: Fix IOR and ISR on error in probe Date: Sat, 13 Jan 2024 06:57:27 +0100 Message-ID: <20240113055729.4480-10-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240113055729.4480-1-deller@kernel.org> References: <20240113055729.4480-1-deller@kernel.org> MIME-Version: 1.0 Received-SPF: pass client-ip=145.40.73.55; envelope-from=deller@kernel.org; helo=sin.source.kernel.org X-Spam_score_int: -64 X-Spam_score: -6.5 X-Spam_bar: ------ X-Spam_report: (-6.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.09, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Helge Deller Put correct values (depending on CPU arch) into IOR and ISR on fault. Signed-off-by: Helge Deller Reviewed-by: Richard Henderson --- target/hppa/op_helper.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c index 7f607c3afd..ce15469465 100644 --- a/target/hppa/op_helper.c +++ b/target/hppa/op_helper.c @@ -351,11 +351,7 @@ target_ulong HELPER(probe)(CPUHPPAState *env, target_ulong addr, excp = hppa_get_physical_address(env, addr, mmu_idx, 0, &phys, &prot, NULL); if (excp >= 0) { - if (env->psw & PSW_Q) { - /* ??? Needs tweaking for hppa64. */ - env->cr[CR_IOR] = addr; - env->cr[CR_ISR] = addr >> 32; - } + hppa_set_ior_and_isr(env, addr, MMU_IDX_MMU_DISABLED(mmu_idx)); if (excp == EXCP_DTLB_MISS) { excp = EXCP_NA_DTLB_MISS; }