From patchwork Sat Feb 15 02:16:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 13975926 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 B27B7C021A4 for ; Sat, 15 Feb 2025 02:18:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tj7k5-0004HU-H5; Fri, 14 Feb 2025 21:17:17 -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 1tj7jz-0004F8-GV for qemu-devel@nongnu.org; Fri, 14 Feb 2025 21:17:11 -0500 Received: from home.keithp.com ([63.227.221.253] helo=elaine.keithp.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tj7jw-0006dT-Fe for qemu-devel@nongnu.org; Fri, 14 Feb 2025 21:17:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1739585825; bh=T0TGaowpdk7Flput3BYwaWvnKQsX4zXMW7/eTHVce+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cU9rrJmNhjkJCPHeoNIkpWi05+0TAveSw6Jvfu2btUgmYRd0BoQiI+oB0xJM/xkt9 /saKF+ZFfgXcvDMulZtMPrQdfTz9JBwDQAFselAdmkkUpFBodrSVwVsgK5nOJX4fHq ApGe2bNFw3kvnQ52HwYP1ZvInB48d4LYaVkeA7guNe3qunV6bYBKPkPD8ix3nBImnJ aaIHyb0eO6r8hSkoxQd3pGh6r12fIPhzu5ghWmba+L7rcLgT84UyKKKGxxqXq+E3uQ /92HpQeHZ9g6ZrNPxir+7PeG+gL40gXt0n3pQCFBrSn2Zl0nh5ITyD4lv8FPNCzIjj kL2B0Vaup3vRA== Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id E598B3F22BEA for ; Fri, 14 Feb 2025 18:17:05 -0800 (PST) X-Virus-Scanned: Debian amavis at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavis, port 10024) with LMTP id 87LtWDR2-FFZ; Fri, 14 Feb 2025 18:17:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1739585822; bh=T0TGaowpdk7Flput3BYwaWvnKQsX4zXMW7/eTHVce+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VmE0ZYgXkEOC7k04Mh9lVuf/J+QnThwl6qmd31rgGtVHuyzfBBk+3H+CqmqZqXpSP /hkW1mN9CAauEK3A2wMjIN3+ZzCQUfSTTFWCTuj5dor5Fqv8rkF/jki+LmvV1dY02X vEd4QFFcqdjACOUOjWZgFCf2bilmp2ucx27c8mbbFztAp4xbUyRmfDOaDkqDGtNAwb DSLEAmyFw+Oa33aN+ttUg93dSSuy1sEYzh8FyQ05uFwTu766EP/l5NMmgqtAZ1kcHM QMP1ljchznmcKe0iG5nBzBp4qQ4opzsRtievgwEEjVgSi/43PvXXBTa75kFt4DGdzy XMgaoBsK9NmMg== Received: from keithp.com (koto.keithp.com [192.168.11.2]) by elaine.keithp.com (Postfix) with ESMTPSA id 7F3943F2076E; Fri, 14 Feb 2025 18:17:02 -0800 (PST) Received: by keithp.com (Postfix, from userid 1000) id 5613E1E6007A; Fri, 14 Feb 2025 18:17:02 -0800 (PST) To: qemu-devel@nongnu.org Cc: Keith Packard Subject: [PATCH 1/5] hw/rx: Allow execution without either bios or kernel Date: Fri, 14 Feb 2025 18:16:50 -0800 Message-ID: <20250215021654.1786679-2-keithp@keithp.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250215021654.1786679-1-keithp@keithp.com> References: <20250215021654.1786679-1-keithp@keithp.com> MIME-Version: 1.0 Received-SPF: pass client-ip=63.227.221.253; envelope-from=keithp@keithp.com; helo=elaine.keithp.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Keith Packard X-Patchwork-Original-From: Keith Packard via From: Keith Packard Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Users can use -device loader to get an ELF file loaded to memory, so we don't need to require one of these options. Signed-off-by: Keith Packard Reviewed-by: Richard Henderson --- hw/rx/rx-gdbsim.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c index 88c8f12c10..4afd77efd5 100644 --- a/hw/rx/rx-gdbsim.c +++ b/hw/rx/rx-gdbsim.c @@ -110,9 +110,6 @@ static void rx_gdbsim_init(MachineState *machine) if (!kernel_filename) { if (machine->firmware) { rom_add_file_fixed(machine->firmware, RX62N_CFLASH_BASE, 0); - } else if (!qtest_enabled()) { - error_report("No bios or kernel specified"); - exit(1); } } From patchwork Sat Feb 15 02:16:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 13975924 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 2B460C021A4 for ; Sat, 15 Feb 2025 02:17:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tj7k0-0004Fu-BH; Fri, 14 Feb 2025 21:17:12 -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 1tj7jz-0004F0-Ba for qemu-devel@nongnu.org; Fri, 14 Feb 2025 21:17:11 -0500 Received: from home.keithp.com ([63.227.221.253] helo=elaine.keithp.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tj7jw-0006dE-Fd for qemu-devel@nongnu.org; Fri, 14 Feb 2025 21:17:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1739585824; bh=hEdGGrdRnyKcM0NWUuU9kjR/8KwYnsAxspFYskjaN3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lAo2rbUjoMgSV6DM0bL3M5ngVmYPFbINcV/ia3lgXpVpw+P4HcQQfaQ980vTui/6U 9eQ2YSekKsljar8DmTyvQJ8CMVOqhG2QCvvReJShz5pI2BJRW1aZUcYyxN0S922xrt FnQiu3hxuS31L3dwKMNYMtkHu1zizJoW+Y16INTJi2FMUQFMkOSs7opJ7AFe5AOcM2 y0prpHhHa8T5Z12LwkHapaM8jugu2R7Zvky/WuoS/lqOvasS16+agNkaMV/tnY/eAl s6yFQTTjAdT1s3ERHC6nroTlNlgdOUUwYVwzc08ujNNLghncO26bPpDhKY3yVTW4ZG TQxdt0Kp18iIQ== Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 18F943F22BF4 for ; Fri, 14 Feb 2025 18:17:04 -0800 (PST) X-Virus-Scanned: Debian amavis at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavis, port 10024) with LMTP id yLTZX6ZfgMyv; Fri, 14 Feb 2025 18:17:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1739585822; bh=hEdGGrdRnyKcM0NWUuU9kjR/8KwYnsAxspFYskjaN3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GRuce0iEF4mrDT1yWIcQwDF8EHA3Qcijw7T9G/mSp0oKb546KAcA3zJHoa3Nkiuiu QmVTf2IcpoUnPTbSor1FJL8XbAZWZlOL59Hc7FAUvxNFp2me8SJDQnvX5FOnDnvsxK BypuK9w5VSnsH1xNGtuLZY6nP5OlyA/WWVuaHfm/waDmaF6lhTuL1I7jcfuZg1UWDN E7QmWu9EzlZueXoKKP4amyzvX6jOQ2NAbyjJHa60mGi1AEI8iOsT19goSiNbnHyD0D b4J1KG3dx1gQiTKP7sgJGHNEYOrc43EIT+Udhk5WD/7y2w9s3sY309w860a1Ezf9os piXhXoQ/1EsbQ== Received: from keithp.com (koto.keithp.com [192.168.11.2]) by elaine.keithp.com (Postfix) with ESMTPSA id 89AB33F22BBE; Fri, 14 Feb 2025 18:17:02 -0800 (PST) Received: by keithp.com (Postfix, from userid 1000) id 5828B1E6009D; Fri, 14 Feb 2025 18:17:02 -0800 (PST) To: qemu-devel@nongnu.org Cc: Keith Packard Subject: [PATCH 2/5] target/rx: Set exception vector base to 0xffffff80 Date: Fri, 14 Feb 2025 18:16:51 -0800 Message-ID: <20250215021654.1786679-3-keithp@keithp.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250215021654.1786679-1-keithp@keithp.com> References: <20250215021654.1786679-1-keithp@keithp.com> MIME-Version: 1.0 Received-SPF: pass client-ip=63.227.221.253; envelope-from=keithp@keithp.com; helo=elaine.keithp.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Keith Packard X-Patchwork-Original-From: Keith Packard via From: Keith Packard Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The documentation says the vector is at 0xffffff80, instead of the previous value of 0xffffffc0. That value must have been a bug because the standard vector values (20, 21, 23, 25, 30) were all past the end of the array. Signed-off-by: Keith Packard --- target/rx/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/rx/helper.c b/target/rx/helper.c index 80912e8dcb..55e2ae4a11 100644 --- a/target/rx/helper.c +++ b/target/rx/helper.c @@ -90,7 +90,7 @@ void rx_cpu_do_interrupt(CPUState *cs) cpu_stl_data(env, env->isp, env->pc); if (vec < 0x100) { - env->pc = cpu_ldl_data(env, 0xffffffc0 + vec * 4); + env->pc = cpu_ldl_data(env, 0xffffff80 + vec * 4); } else { env->pc = cpu_ldl_data(env, env->intb + (vec & 0xff) * 4); } From patchwork Sat Feb 15 02:16:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 13975922 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 A8089C02198 for ; Sat, 15 Feb 2025 02:17:39 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tj7jz-0004F1-Iw; Fri, 14 Feb 2025 21:17:11 -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 1tj7jy-0004Er-6i for qemu-devel@nongnu.org; Fri, 14 Feb 2025 21:17:10 -0500 Received: from home.keithp.com ([63.227.221.253] helo=elaine.keithp.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tj7jw-0006dF-Fk for qemu-devel@nongnu.org; Fri, 14 Feb 2025 21:17:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1739585824; bh=w/8IuRHPVdUTbyl/MhQywFst50Ay9Yr9V+RwhgAhxLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B7XDEs0iIAh+SmUnqqVGDBITNEdxdy8Z+23jybGm/dHySe1MnWPWhzil6R31+gOWl t6SZ+PJpl0fskAnbDPacD7oyXqrhUrsZh/00HhJM2w1m6BrU/FwfGrJbH0gVv+qEHO FtyZEdNOepmp2qGfVdozHdNdn8g/Bt6XS/5mAN2ZMi3/z08EtR0RQVJfcWnvezWF9D r+JvgLviJbx9RBtnbMoFp3gLxI04b8DjmaTm1+FkJ8XQgBI+1vMjnJsQ1TFX4QQvk/ R/MtOk6ZCgRsaS6ncoEDekbUO7duLFl0hNKFuv1Az0ODXDpZ88z8EuZmDRMFLq0of5 q5o2AYIwguo4w== Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 89D1C3F22BE0 for ; Fri, 14 Feb 2025 18:17:04 -0800 (PST) X-Virus-Scanned: Debian amavis at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavis, port 10024) with LMTP id mhTFRvRwtR3H; Fri, 14 Feb 2025 18:17:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1739585822; bh=w/8IuRHPVdUTbyl/MhQywFst50Ay9Yr9V+RwhgAhxLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VkFGz2UuBDy3UBL0VkJFsmMgspTF3ZxLf/XVorY5Z+C6vCQhvKJ/6ziDaOUSx97lJ nP1rJwUPnmUeoAgPeFYROP9rhgugztkeqYolNle6k/38ueFj6ZL4r7xbHxzGHQ3WUI ZH6APIUf2ib+/b2GnIhKSokMRmVVePAt/SjfBEUs/1Ym9LETXSUYNQDJIpuE0l7SbP 7Icp6gT65ie4WRs23YCjWG6PR1hNBI3Vc8gyht1WqOXeaHqbgbcc3LTEV7CYaH4CFQ cc8EqYyvRgI42mv7zbZQZecnPb6ZOaUrNmVgewlJ/dMx60naMMxa7osWaTmKIuJidc koP0hxawri2Pw== Received: from keithp.com (koto.keithp.com [192.168.11.2]) by elaine.keithp.com (Postfix) with ESMTPSA id 857D33F2294E; Fri, 14 Feb 2025 18:17:02 -0800 (PST) Received: by keithp.com (Postfix, from userid 1000) id 5B5811E6009E; Fri, 14 Feb 2025 18:17:02 -0800 (PST) To: qemu-devel@nongnu.org Cc: Keith Packard Subject: [PATCH 3/5] target/rx: Reset the CPU at qemu reset time Date: Fri, 14 Feb 2025 18:16:52 -0800 Message-ID: <20250215021654.1786679-4-keithp@keithp.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250215021654.1786679-1-keithp@keithp.com> References: <20250215021654.1786679-1-keithp@keithp.com> MIME-Version: 1.0 Received-SPF: pass client-ip=63.227.221.253; envelope-from=keithp@keithp.com; helo=elaine.keithp.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Keith Packard X-Patchwork-Original-From: Keith Packard via From: Keith Packard Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This ensure that the CPU gets reset every time QEMU resets. Signed-off-by: Keith Packard --- target/rx/cpu.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 37a6fdd569..04dd34b310 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -27,6 +27,7 @@ #include "hw/loader.h" #include "fpu/softfloat.h" #include "tcg/debug-assert.h" +#include "system/reset.h" static void rx_cpu_set_pc(CPUState *cs, vaddr value) { @@ -129,6 +130,13 @@ static ObjectClass *rx_cpu_class_by_name(const char *cpu_model) return oc; } +static void rx_cpu_reset(void *opaque) +{ + RXCPU *cpu = opaque; + + cpu_reset(CPU(cpu)); +} + static void rx_cpu_realize(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); @@ -142,9 +150,10 @@ static void rx_cpu_realize(DeviceState *dev, Error **errp) } qemu_init_vcpu(cs); - cpu_reset(cs); rcc->parent_realize(dev, errp); + + qemu_register_reset(rx_cpu_reset, RX_CPU(cs)); } static void rx_cpu_set_irq(void *opaque, int no, int request) From patchwork Sat Feb 15 02:16:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 13975927 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 04AC8C02198 for ; Sat, 15 Feb 2025 02:18:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tj7k3-0004Ge-0A; Fri, 14 Feb 2025 21:17:15 -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 1tj7jz-0004FT-L9 for qemu-devel@nongnu.org; Fri, 14 Feb 2025 21:17:11 -0500 Received: from home.keithp.com ([63.227.221.253] helo=elaine.keithp.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tj7jw-0006dP-Fo for qemu-devel@nongnu.org; Fri, 14 Feb 2025 21:17:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1739585825; bh=Kru5Oo9ytMLO/csVYud/FazrbyUaZhJC7XhcOH6Gf9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UfiLzZu5vLwn0Jfnbe22Rp/oEX/lRInro3MXyKr9qYJBwXG+C6UUeVniNCDaolsIs ODXkQYLv2iQeiw8LfeGvITrwwbpL+9jvLxlVhl02oPDFiDWzDxfASz5tgLM4PNrCdz CJgGRk/jP4iP1Ux1lIyPyx8tylFeIEx/NDrqT2Eu+x6dZrBe+Ob2QtZjm1VtRPtqYj 47xMIxLp4DaHB6DznAqf59/CDkgVdVWQ9LBz4oBMJ2rDNTUqjawtN/YHh5Ka1Djxcj fXdXFLJMxAZr9yFvOf+25qm7fJ5TNG/mLPqaqAzq+xOFJhlN+BlkRImyI1n17UBvmN KfDy7l5j07/jg== Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 55A643F22BBE for ; Fri, 14 Feb 2025 18:17:05 -0800 (PST) X-Virus-Scanned: Debian amavis at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavis, port 10024) with LMTP id 3wB3QZw-B8TM; Fri, 14 Feb 2025 18:17:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1739585822; bh=Kru5Oo9ytMLO/csVYud/FazrbyUaZhJC7XhcOH6Gf9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lgvQfK+/IOlA2GgUvON5wMb0vxPzHOd+ujKPy24VLWYtHHiIzRIf2wKcwNYB5//wN myoYXqCtCfmg6KfHSPFOC5JbZMlEyZBxsdD91mSafITo016xfPg6A2E8LnFr09Na60 e8Xf6O6QzxI4qbnSjFrySJQulKi43nWHyPM5L0UQDdFH/zChbNfY3ZVV7ve3AlmgG/ xs9VVSRsPTPReW0skAiNNRPZgGgNSSZWPJEjuq/06qpj58a+aM4CC90OnRvDAWj3os gG9fbHTmF0c1KNyfL01K5810JX3sd6XvA84p4ZG4EHa/uFDl1V4d0SZ5lIZ2kIBU7y plMIHvdupLPTw== Received: from keithp.com (koto.keithp.com [192.168.11.2]) by elaine.keithp.com (Postfix) with ESMTPSA id 9BADD3F22BEA; Fri, 14 Feb 2025 18:17:02 -0800 (PST) Received: by keithp.com (Postfix, from userid 1000) id 5DB351E6009F; Fri, 14 Feb 2025 18:17:02 -0800 (PST) To: qemu-devel@nongnu.org Cc: Keith Packard Subject: [PATCH 4/5] target/rx: Load reset vector from memory after first run Date: Fri, 14 Feb 2025 18:16:53 -0800 Message-ID: <20250215021654.1786679-5-keithp@keithp.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250215021654.1786679-1-keithp@keithp.com> References: <20250215021654.1786679-1-keithp@keithp.com> MIME-Version: 1.0 Received-SPF: pass client-ip=63.227.221.253; envelope-from=keithp@keithp.com; helo=elaine.keithp.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Keith Packard X-Patchwork-Original-From: Keith Packard via From: Keith Packard Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The ROM images all get deleted as they've been loaded to memory, so we can't go fetch the reset vector from there. Instead, fetch it from memory. To make that work, we need to execute the delayed mmu setup function tcg_commit_cpu as that wires up memory dispatching. Signed-off-by: Keith Packard --- target/rx/cpu.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 04dd34b310..a32b410bb1 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -24,6 +24,7 @@ #include "exec/exec-all.h" #include "exec/page-protection.h" #include "exec/translation-block.h" +#include "exec/cpu_ldst.h" #include "hw/loader.h" #include "fpu/softfloat.h" #include "tcg/debug-assert.h" @@ -77,7 +78,8 @@ static void rx_cpu_reset_hold(Object *obj, ResetType type) CPUState *cs = CPU(obj); RXCPUClass *rcc = RX_CPU_GET_CLASS(obj); CPURXState *env = cpu_env(cs); - uint32_t *resetvec; + uint32_t *resetvec_p; + vaddr resetvec; if (rcc->parent_phases.hold) { rcc->parent_phases.hold(obj, type); @@ -85,11 +87,23 @@ static void rx_cpu_reset_hold(Object *obj, ResetType type) memset(env, 0, offsetof(CPURXState, end_reset_fields)); - resetvec = rom_ptr(0xfffffffc, 4); - if (resetvec) { - /* In the case of kernel, it is ignored because it is not set. */ - env->pc = ldl_p(resetvec); + /* + * During the first reset phase, the memory dispatching hook + * hasn't been set, so we can't fetch the reset vector from + * memory. After that, the ROM image will have been discarded, so + * we can't fetch the reset vector from there. So we have two + * paths here. + */ + resetvec_p = rom_ptr_for_as(cs->as, 0xfffffffc, 4); + if (resetvec_p) + resetvec = ldl_p(resetvec_p); + else { + process_queued_cpu_work(cs); + resetvec = cpu_ldl_data(env, 0xfffffffc); } + if (resetvec) + env->pc = resetvec; + rx_cpu_unpack_psw(env, 0, 1); env->regs[0] = env->isp = env->usp = 0; env->fpsw = 0; From patchwork Sat Feb 15 02:16:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 13975923 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 0DACFC021A4 for ; Sat, 15 Feb 2025 02:17:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tj7k3-0004Gy-Ln; Fri, 14 Feb 2025 21:17:15 -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 1tj7k0-0004GL-NQ for qemu-devel@nongnu.org; Fri, 14 Feb 2025 21:17:12 -0500 Received: from home.keithp.com ([63.227.221.253] helo=elaine.keithp.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tj7jz-0006dn-6r for qemu-devel@nongnu.org; Fri, 14 Feb 2025 21:17:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1739585826; bh=/tsRwvbTOyoVzLtmCyEuFpgz4OrTtgDazD6Mn8+RzLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NQvCmP90k8rStqP9DgH4pcctkymMcQ/Len6NV524h6CjRH1Ls3XoW9H5BKXx2ufkM oeV3/5m9/6P/oYRKnCyI3+U2avKai4TMQuz3jrgrwfbRA60Vgfyimonxf5EhoOF1pG L36mymGUmiYurVqp+/7DEBHCHA2oQCmgZ4094kY7gIf9o7JtF4eUrOfLSoBWe74E6d G6h6lLFMpkENXFCDMQlX5f+fQbwvEREbfvzZ7eaQLfHE9dt7QW7kht6CyZ4RTa/YCO POONiNgkDCAysn0d6yzFYGAhQrYaWindL31GkFRS/vS+pdVlLp+cK9Ny0hl5j9dkyy BHRNi4zQCmHeA== Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 81D583F2294E for ; Fri, 14 Feb 2025 18:17:06 -0800 (PST) X-Virus-Scanned: Debian amavis at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavis, port 10024) with LMTP id iuS5Aqj3FqQs; Fri, 14 Feb 2025 18:17:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1739585822; bh=/tsRwvbTOyoVzLtmCyEuFpgz4OrTtgDazD6Mn8+RzLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mF+fCKjJ3lZaHlce9Es/pvfa9Qd2wG5xAOYTsR1plyUjN6OeGY3iIu0MfLpYoBwX/ Jm1yfdKycyn05pV2Yjq+Prqvf56ZQBwz0LIKYNY1OBJlrDmVf68JNe5iA/eIQ4x3II Os+f+R5m5TSFmtyotDepaoOSAieqU6T26Hxqi5W0i35HJzEQPzfpSMaFWhsCl+/pkD uYpHpgquyvuaSs/G9fTcE09aVIyT4LEUX35r3CXF+0P3Erdz7zNLG4RdXQ+mgxClWM 34bWSRUF7gtB/q6NLn2P90ke2+W3iIL+gaSd28bllCr87g1wt41uFvm91DI0hz2fPg SqJ+e6Q8YTorg== Received: from keithp.com (koto.keithp.com [192.168.11.2]) by elaine.keithp.com (Postfix) with ESMTPSA id A41203F22BF3; Fri, 14 Feb 2025 18:17:02 -0800 (PST) Received: by keithp.com (Postfix, from userid 1000) id 60A0A1E600A0; Fri, 14 Feb 2025 18:17:02 -0800 (PST) To: qemu-devel@nongnu.org Cc: Keith Packard Subject: [PATCH 5/5] target/rx: Remove TCG_CALL_NO_WG from helpers which write env Date: Fri, 14 Feb 2025 18:16:54 -0800 Message-ID: <20250215021654.1786679-6-keithp@keithp.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250215021654.1786679-1-keithp@keithp.com> References: <20250215021654.1786679-1-keithp@keithp.com> MIME-Version: 1.0 Received-SPF: pass client-ip=63.227.221.253; envelope-from=keithp@keithp.com; helo=elaine.keithp.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Keith Packard X-Patchwork-Original-From: Keith Packard via From: Keith Packard Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Functions which modify virtual machine state (such as virtual registers stored in memory) must not be marked TCG_CALL_NO_WG as that tells the optimizer that virtual registers values already loaded in machine registers are still valid, hence discards any changes which these helpers may have made. Signed-off-by: Keith Packard --- target/rx/helper.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target/rx/helper.h b/target/rx/helper.h index ebb4739474..ac21f4fddd 100644 --- a/target/rx/helper.h +++ b/target/rx/helper.h @@ -13,18 +13,18 @@ DEF_HELPER_FLAGS_2(ftoi, TCG_CALL_NO_WG, i32, env, f32) DEF_HELPER_FLAGS_2(round, TCG_CALL_NO_WG, i32, env, f32) DEF_HELPER_FLAGS_2(itof, TCG_CALL_NO_WG, f32, env, i32) DEF_HELPER_2(set_fpsw, void, env, i32) -DEF_HELPER_FLAGS_2(racw, TCG_CALL_NO_WG, void, env, i32) -DEF_HELPER_FLAGS_2(set_psw_rte, TCG_CALL_NO_WG, void, env, i32) -DEF_HELPER_FLAGS_2(set_psw, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_2(racw, void, env, i32) +DEF_HELPER_2(set_psw_rte, void, env, i32) +DEF_HELPER_2(set_psw, void, env, i32) DEF_HELPER_1(pack_psw, i32, env) DEF_HELPER_FLAGS_3(div, TCG_CALL_NO_WG, i32, env, i32, i32) DEF_HELPER_FLAGS_3(divu, TCG_CALL_NO_WG, i32, env, i32, i32) -DEF_HELPER_FLAGS_1(scmpu, TCG_CALL_NO_WG, void, env) +DEF_HELPER_1(scmpu, void, env) DEF_HELPER_1(smovu, void, env) DEF_HELPER_1(smovf, void, env) DEF_HELPER_1(smovb, void, env) DEF_HELPER_2(sstr, void, env, i32) -DEF_HELPER_FLAGS_2(swhile, TCG_CALL_NO_WG, void, env, i32) -DEF_HELPER_FLAGS_2(suntil, TCG_CALL_NO_WG, void, env, i32) -DEF_HELPER_FLAGS_2(rmpa, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_2(swhile, void, env, i32) +DEF_HELPER_2(suntil, void, env, i32) +DEF_HELPER_2(rmpa, void, env, i32) DEF_HELPER_1(satr, void, env)