From patchwork Fri Jan 12 10:29: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: 13518275 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 9226AC47422 for ; Fri, 12 Jan 2024 10:30:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOEnC-0007vf-G3; Fri, 12 Jan 2024 05:29:38 -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 1rOEnA-0007v5-IH for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:36 -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 1rOEn8-0006B5-Pv for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:36 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 7B80161CB5; Fri, 12 Jan 2024 10:29:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB3E1C43390; Fri, 12 Jan 2024 10:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705055372; bh=day6KyXxhUli/IuqjOYXEYLGEYoeP1JU/ugYQ5fILLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ev7RNgDxHnfJB9MKVwx0DNcfbd6wH8DmiU8PONyNKF6zvQd0A03irmRr6Xdw9ZcBu CwqfKfmUNWkXU6ZjNTiE73ElFCBvzojF5RFEaydIXImlii18KAEdz02h/Khz4pscKi awuiOLRNUMMzE0YC6H3ctl8O2j7f4j4aZsFqJ78UBWCWw21owxb56DdcSAftp9gkqD tcC8mXJFe3KBC7PFh8uyX3DGPww0JCQ8mLud3ywVnEGVFxJga1hu+O23U5Iio3nVKb TrHv2c4XJU59lHhUq6UvP1wKJ2s76RwwltEkUYXyB5wGHQeLYSP+yZIY0316VoRCjr 4p7GNXd3ojUcQ== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller , "Nelson H . F . Beebe" , Bruno Haible Subject: [PATCH v3 1/9] hw/hppa/machine: Allow up to 3840 MB total memory Date: Fri, 12 Jan 2024 11:29:19 +0100 Message-ID: <20240112102927.35406-2-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240112102927.35406-1-deller@kernel.org> References: <20240112102927.35406-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: -95 X-Spam_score: -9.6 X-Spam_bar: --------- X-Spam_report: (-9.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.467, 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 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 Fri Jan 12 10:29: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: 13518271 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 A82E0C4707C for ; Fri, 12 Jan 2024 10:30:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOEnF-0007wd-CN; Fri, 12 Jan 2024 05:29: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 1rOEnC-0007vt-Uv for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:38 -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 1rOEnB-0006Eb-3V for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:38 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 32DB2CE23A9; Fri, 12 Jan 2024 10:29:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94FCCC433F1; Fri, 12 Jan 2024 10:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705055373; bh=eLWXWvIyT7eAbe9rN0poNQyUGNmJFaidvwWyu2pacVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q/EcO1wfub7eY+KNQYDFmg8NAg+eryLAArYy5nj4tmW/e+Jid+24cVgWnyby8yykw /SjU33YBdJyQHtW/ixRjInAkjKbjHR81pj1EZeuTdfkHZMIMexXLJx1N3FRnjnwSRu Fg78ytUdvr4tlyZMzhe8QVCgEnx9CK/6F6mFwWYDXCH0Ayb8r9StGlCTQSQNl5mS69 aSbT8j1lCVB6Cn6nxJ6x+hh8A7tWvA6twS9yb9YAqFyAkQh87im3Hjjp+D06w/49Zj tD8nhV7MLT0ERSMmRJV3+kRW9k90a7ksttaDnMSEDQzpLJD7LwNqDUKMTxrqMx01Lr TBiwUJ+G1KR1g== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PATCH v3 2/9] hw/hppa/machine: Disable default devices with --nodefaults option Date: Fri, 12 Jan 2024 11:29:20 +0100 Message-ID: <20240112102927.35406-3-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240112102927.35406-1-deller@kernel.org> References: <20240112102927.35406-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: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.467, 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 Fri Jan 12 10:29: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: 13518269 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 819BCC4706C for ; Fri, 12 Jan 2024 10:29:47 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOEnD-0007w2-QU; Fri, 12 Jan 2024 05:29:39 -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 1rOEnC-0007vc-AX for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:38 -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 1rOEnA-0006F0-GZ for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:38 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 44E2C61C55; Fri, 12 Jan 2024 10:29:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD1C6C43390; Fri, 12 Jan 2024 10:29:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705055374; bh=U3j/ToWx+85xBmo08X6T2XIlE9iXxB17T37IKGebClU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jsqtntYbXkRG0J8iWYh+AQr48dy56vsbt+I4FVR0HsJxUozAZ9Q8oguowZ5puCuKJ fsJbSfaJPkaL6rlFjALYYeZyXxFVJyYwwnIkJdlrCT/8/pnayX6kQbjHqfosA70zPu Q5fmBZpe43eLtoL3RuNL3rUwBpeuKdbVKjiwY4sE7CosEo23awE1CUCHgYljvzBHNC W0FHFTbBd9ipjorXvtD7sXS63t9yGw+Jao2n1zVGQeNkcV1ifT10OCXCbHBz1NuNw3 HtuO8L3ziTjvOp++LiGmwM4JdW+5oCas4prp3dM/FMJp+zHxWiOlbFXkMxp62J8+BG lTZkVMNKYPfPA== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller , Bruno Haible Subject: [PATCH v3 3/9] hw/pci-host/astro: Add missing astro & elroy registers for NetBSD Date: Fri, 12 Jan 2024 11:29:21 +0100 Message-ID: <20240112102927.35406-4-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240112102927.35406-1-deller@kernel.org> References: <20240112102927.35406-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: -95 X-Spam_score: -9.6 X-Spam_bar: --------- X-Spam_report: (-9.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.467, 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 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 Fri Jan 12 10:29: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: 13518276 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 9022CC4706C for ; Fri, 12 Jan 2024 10:30:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOEnH-0007xn-Tl; Fri, 12 Jan 2024 05:29: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 1rOEnF-0007x7-Td for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:41 -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 1rOEnD-0006HN-VN for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:41 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 48A82CE23AD; Fri, 12 Jan 2024 10:29:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B9E4C433C7; Fri, 12 Jan 2024 10:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705055376; bh=HpEUBmPX5EgN1uf9bgKCgE2CkewlySOnta131nELozs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mWGHIRX9PlUjAanub6gJEsw3fczC3hXKDPh7Jl/EMLszYCUjsfmMeeKKePy98mZFl fY1ezRe7knUTgoElXl1dQCLLfBZl13gYHFY+VDU00fUxfmx4Rv7RPJYGF7UL5ljhdp kIAyAdLcPx63JAwxoFcIjExq3ILkGfIBsHhBjhZfj+gjPG8KpUgQAAoTR+6U9DfKG9 +M7x9YerNk/6JEhL6JGxwik1hyevvT4zJoacVF8tG0+2ertkWYhh2maEpHu31awjXg CLNL1MnSdu4dNq5UwSiDWRPyQvM85eh3VyUkHPXx0EHzYfRhMM4k+8k9VuZRRORJkB Ss6Nt4llzY7oQ== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller , Bruno Haible Subject: [PATCH v3 4/9] target/hppa: Fix PDC address translation on PA2.0 with PSW.W=0 Date: Fri, 12 Jan 2024 11:29:22 +0100 Message-ID: <20240112102927.35406-5-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240112102927.35406-1-deller@kernel.org> References: <20240112102927.35406-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: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.467, 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 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 Signed-off-by: Helge Deller Tested-by: Bruno Haible Reviewed-by: Richard Henderson --- 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 08abd1a9f9..011b192406 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -56,7 +56,7 @@ hwaddr hppa_abs_to_phys_pa2_w0(vaddr addr) addr = (int32_t)addr; } else { /* PDC address space */ - addr &= MAKE_64BIT_MASK(0, 24); + addr = (uint32_t)addr; addr |= -1ull << (TARGET_PHYS_ADDR_SPACE_BITS - 4); } return addr; From patchwork Fri Jan 12 10:29: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: 13518277 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 7112AC4707C for ; Fri, 12 Jan 2024 10:30:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOEnH-0007xK-JL; Fri, 12 Jan 2024 05:29: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 1rOEnF-0007wD-0L for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:41 -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 1rOEnD-0006Hs-Dd for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:40 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 328CF61CB5; Fri, 12 Jan 2024 10:29:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE0D1C43390; Fri, 12 Jan 2024 10:29:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705055377; bh=RlkAaN0yX2H3dqDoNpVJQaqZRzFOKfP/8dh+xq5mKls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a/xLzBjObEd46yAAGpqfz0SRSzwPEH8iyNUNnt74P4KyRrRGuYEZZFTgSmEfwlVXa AWTDBmCpU+zVAQkbBIZxqDEMWa/UVJ819CFRI9Ap/YxcBHXnou/UsASZS+dcUfVsk/ U2L0XSEeRKaDHjtWdJFhI7zDigw5KYeBsMZNWBNtKSt9GEbbyHK566Bbx8xF465iGY xcGXrKZJi5tgDMz+mXd3k9V/zqVJLJEznGwQFIp9r1uvyZvtBiswQ3eN9+yNsL+vx2 AJm3LfafXjYDVsNJqB1ire2/BOugYbndfll0EvbRkQU5KqgRxuKBlAp7con/bpx20A PINtZuSBUmXiQ== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller , Bruno Haible Subject: [PATCH v3 5/9] hw/hppa: Move software power button address back into PDC Date: Fri, 12 Jan 2024 11:29:23 +0100 Message-ID: <20240112102927.35406-6-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240112102927.35406-1-deller@kernel.org> References: <20240112102927.35406-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: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.467, 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 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 Fri Jan 12 10:29: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: 13518270 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 2DA48C4706C for ; Fri, 12 Jan 2024 10:30:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOEnJ-0007yB-HO; Fri, 12 Jan 2024 05:29: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 1rOEnG-0007xE-3c for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:43 -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 1rOEnE-0006JC-Mo for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:41 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id A661161D60; Fri, 12 Jan 2024 10:29:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C5BBC433F1; Fri, 12 Jan 2024 10:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705055379; bh=T0zWmLqL4PeP4OsPPaums1oH1UrjBvb45taOTVT9lVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LA9HtXV8VswkczsEZ8YTipdZkGMi8Wr1joZaN/AWfnhVuFi103AWW2XOflLYwSt78 ugGJRDrpICVsj6zfvhVQEuww0+nAVXR0rYTcaoMwEVgYzOJlrL06qrCcx0pDENwtNb MpFbjEM3rg1MAdK3UYxI0CGWzXEaB45Mfim0e+fxkLp1Xm14rG4DeEFglbMXlm6ht7 JWj/9yaYf3VEBHt7+aVprdTrGxKOk/sQ2GAP1G2SzseHlOSkb4zRggD3HbTc5iGjH5 RZIWdiGTN5UGyLO4j6E+aEGoUpBa6ufzTrFlpZntRxbVmrWMFnypxsvuj60qh3LMIp s61OXFDS4pSGA== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller , Bruno Haible Subject: [PATCH v3 6/9] target/hppa: Avoid accessing %gr0 when raising exception Date: Fri, 12 Jan 2024 11:29:24 +0100 Message-ID: <20240112102927.35406-7-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240112102927.35406-1-deller@kernel.org> References: <20240112102927.35406-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: -95 X-Spam_score: -9.6 X-Spam_bar: --------- X-Spam_report: (-9.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.467, 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 011b192406..42bd0063c0 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -335,7 +335,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 Fri Jan 12 10:29: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: 13518272 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 C13F5C4707C for ; Fri, 12 Jan 2024 10:30:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOEnO-00083e-Rv; Fri, 12 Jan 2024 05:29: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 1rOEnJ-0007y3-4O for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:45 -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 1rOEnH-0006Km-9n for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:44 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 4240BB82166; Fri, 12 Jan 2024 10:29:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE6C5C433C7; Fri, 12 Jan 2024 10:29:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705055380; bh=qypgiZRgSoxPmEg5jgMnN4euLuf+DUWIGDATe+LsJPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GzBCNd1fS2DyyWXlhccrmPpQw0fQtQAP9Z1fMs16xnXbOhUQ9ewqnvmbfr6ozC307 6uyLTgeWPbPikVrrsCaqKunAuvHj5kuUzKRswtrCIgQKMHYCX2AThBN+VdrPF6FPWR 1S7uYog4/YgdQ4vivVKKm8Ug8Qb6IkPapcq17KIv3SwxuYyVNZFlmwdgFobozN4+3Q CLVUKmU84Dvtj+r/O85brdr6AEUzT9oXLwEPi7x6sd2dWsqSdbCjJF5NB+grCgXlZE lCQibqCdAbXreOPYsOWIcdaWhqNhfemtF6gWEhj8fUNaJrbZ+bm1uTavfpCr8kvKX7 GMVLCCHqGbvZw== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PATCH v3 7/9] target/hppa: Export function hppa_set_ior_and_isr() Date: Fri, 12 Jan 2024 11:29:25 +0100 Message-ID: <20240112102927.35406-8-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240112102927.35406-1-deller@kernel.org> References: <20240112102927.35406-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: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.467, 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 42bd0063c0..7f54160e4c 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -299,14 +299,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 @@ -333,16 +327,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 Fri Jan 12 10:29: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: 13518274 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 4B1A1C4706C for ; Fri, 12 Jan 2024 10:30:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOEnO-000842-S0; Fri, 12 Jan 2024 05:29: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 1rOEnK-0007yL-9e for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:46 -0500 Received: from ams.source.kernel.org ([145.40.68.75]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOEnI-0006LE-3s for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:46 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 88AE0B82296; Fri, 12 Jan 2024 10:29:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10907C433F1; Fri, 12 Jan 2024 10:29:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705055381; bh=1/Shn1bfOWinU0jRlavKVHl8hicEJQBQrs23UnAUgkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cIuR7SWGxaA+0WCBYaOCq0cMhQFUl61aPzg5uTWwwQmTJI7/SkclCF6aDymJtMF9J BdBOBtK+o3s+YxhIfo1xR6OUeXV4FfKvXL8MOUQfB1QQAdN9Nt1cIkGqv7r97SFdAM Luh+0tsG31G1iKEMJsNBbUuItjKFlJGx96Lx5bQcZc6Ra//7vwIhGqPizGT+94GFgy 3DBzHUxfSppsdfNsJLlQhyLsY3gvD4GaydxSRvwGoEyXblraLqshZ10QFatFtlVUIB W3G1yTNFmQgPvQJcIHMFIlyUrd5UkqdoE9s56PXI7hkG6xSXh49fie5/jrVLzUMMC0 ktmn2mH5qWq5w== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PATCH v3 8/9] target/hppa: Fix IOR and ISR on unaligned access trap Date: Fri, 12 Jan 2024 11:29:26 +0100 Message-ID: <20240112102927.35406-9-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240112102927.35406-1-deller@kernel.org> References: <20240112102927.35406-1-deller@kernel.org> MIME-Version: 1.0 Received-SPF: pass client-ip=145.40.68.75; envelope-from=deller@kernel.org; helo=ams.source.kernel.org X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.467, 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 Fri Jan 12 10:29: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: 13518278 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 D2DE0C4706C for ; Fri, 12 Jan 2024 10:31:08 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOEnQ-00086n-2k; Fri, 12 Jan 2024 05:29:52 -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 1rOEnK-0007yM-BZ for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:46 -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 1rOEnI-0006Lt-Gz for qemu-devel@nongnu.org; Fri, 12 Jan 2024 05:29:46 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8457461D60; Fri, 12 Jan 2024 10:29:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 574F1C43390; Fri, 12 Jan 2024 10:29:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705055383; bh=fXmfWG5wGeCbjGRjAUA62CMUoLzlw1DwHmq/Afn380k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YI/nNX7xLlg+Mt17XK81iQNwEmZGhI4UwDtQAVucfmSSZL4wRSEzAERBshwo20jH2 lw6uZeUubK/Y9j598ozLZOHQE3tA1MZfdHNukbUwW99ZH1cgbQ/k2a7Y/H6XH1KrDt 1Yw09RbEwsVaYOsuLTT/tB7RnRsMEJmof2W3P1MBzmihU33m+M+61NBm7J9Jaxx5oM x4vKAacstAfisMnfKyOTJEPParn/1UrMlRb8TbtECIxOYjtMLuIH0nxws+CpNOSmGC W6/ZV3Vg29NflHtcqRAhJ5Ek1ru4IxnNk+yyUy0qpi5rIPrzuNNMSSjs0aYL76msX6 cnpFNNgCA0Y6w== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PATCH v3 9/9] target/hppa: Fix IOR and ISR on error in probe Date: Fri, 12 Jan 2024 11:29:27 +0100 Message-ID: <20240112102927.35406-10-deller@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240112102927.35406-1-deller@kernel.org> References: <20240112102927.35406-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: -95 X-Spam_score: -9.6 X-Spam_bar: --------- X-Spam_report: (-9.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.467, 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 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; }