From patchwork Fri Oct 1 17:11:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 515080 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp1016064jaf; Fri, 1 Oct 2021 10:36:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/bimhEMt5Nj376s1V70wq+ICu68/ir9WqP1gYE7+g/iaE7mhvRuh9cUQ+U/XzZTdAQ+Nq X-Received: by 2002:ab0:3447:: with SMTP id a7mr11734465uaq.56.1633109808973; Fri, 01 Oct 2021 10:36:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633109808; cv=none; d=google.com; s=arc-20160816; b=UBWX8AgA1dI1RU1B0l9kFr1sF3rZ++IBFaCxpVZ1Sh5KAa4f7RPJAdMSSZXfVdnTQV HA6H/VFhEz2u0lNfregLx/9yMJ7Sfq9MXP4FGW1BgDBBYhHsAOsxz65KD2x5TZyhsIbt eipK5TWupBxMZPo3utgeE2D8lMAM5ZkyG3x3ZYWQi6QC2YXuhm9Xxwzs8XGwCJ6TIlGb yGEAKpM43UoJvBwJ+1MeTIseah5401BcChUGQKGmYWrijc4ypNJGpdiYxX0R6oDgMyZI CyLXGPJ6RljA27xzHLqnmlo8QlyfTY7QK1BqUXTqTqNddT41klFhUTnAbwoERGThOPiu y2XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=bhFTWYUd/DdGCKOIwhaKfMZGLTFXZbTF8Lut7J+0pC4=; b=qZ32as4L4GnpPSOhUK0ZHwvlAqqo/BbJuJCa+qKT3bkDmqxCcKRApEnGe3USaCVG0v xTiGjuQIc+196W4L1A+6U2HDwqQHeVp/pHUq0KaabUbWMPmgtKb8/GTrCAD/9ZC50o9F CABFeK65oPUz3FUwm/bF+a2oGRwCWr7gub9XC1px7VLhZRxUp/hsJ3H+Tnd5XwLnwNsI lq4KcJxCMiKDv3vGejNCSQf42ElEDW9ZTZbOWA76JsyPTreRK4Kbl/vb83xxw2jFawp/ 476HJxYpX4eD2UfWnTJS+wOBu8EyXB2gCnpx6rFthJCGeJ44FnXA0KGs/5EKoVJ1Hyc9 /IkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ms8cDPku; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x195si4836028vke.41.2021.10.01.10.36.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Oct 2021 10:36:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ms8cDPku; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWMSl-00049w-Af for patch@linaro.org; Fri, 01 Oct 2021 13:36:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWM5D-0005Bb-3C for qemu-devel@nongnu.org; Fri, 01 Oct 2021 13:12:28 -0400 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]:39515) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWM5A-0005Ib-CD for qemu-devel@nongnu.org; Fri, 01 Oct 2021 13:12:26 -0400 Received: by mail-qt1-x835.google.com with SMTP id j13so9634624qtq.6 for ; Fri, 01 Oct 2021 10:12:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bhFTWYUd/DdGCKOIwhaKfMZGLTFXZbTF8Lut7J+0pC4=; b=ms8cDPku6CsT7oadKBdKUoWiqGzmZmjw02tvLWHNlMkpOc+F2A9xYzc7s0P7Gxl6Kt FYmmPUmiYb9uTaqDvGqbt7RpHx/2y6UE9LS5kcVvEwDE5qkB834bZcdc6tkv5PnBHYRZ rBCyj69yKuCL23clZhh8t2cK+tLuQEyK57qeWiu4I6JfNV9AnB+VcwF+HyRSl+Vp2K6U YEz2aGPbpQx092ZbX6j0vRlZpE+z0Goe2eSFtk87lwlgzxcxr4AwWfN3SGLgr2wDkdEB 3OIBzFzOB65No6l1Yug423mYDwloWrkAmk7vH0imwojzqmtLnVO0qFJJKrm4dUgRX3qH mxVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bhFTWYUd/DdGCKOIwhaKfMZGLTFXZbTF8Lut7J+0pC4=; b=hTRU29fukkntJB0rxm2mCV24P6VHD0vCjvnb8sC79q0g1ctOdoX4b9dEOK9HVpoa39 AM0Q2pE1SnxyE2dQuz3FJA8X5Xr4ueSHHrM2rtR7DvAppQmVaZ382vqYo8Nf/vim4ytx dbZUq0XVfafSvjNULi/LZIQs03t/HJgCKfPZ/RCq5Qj7DpLzsCyLMnGbkFv5gXI9ROwN u2HaUhaGxC3u93zevdvj4UHf/BZ4n34Y/7VaZgwfehkdXAe2dHvErgLIwRrIEHJMsWQ0 CXq8W/whfQQuqiCWdXvfJVygkb6VYsQCojNYF2WzROcojhtE/iX1ym0rb2eaOTiY8N89 PzOA== X-Gm-Message-State: AOAM530KHuco4L0qJubY5V2odcQJvHnzxjue3INrTkfehJD0KAOYc8PR s4Ta9Tp4yEhcaeff/bvUIaruOlNWQw4TJw== X-Received: by 2002:ac8:59ca:: with SMTP id f10mr14411387qtf.334.1633108342200; Fri, 01 Oct 2021 10:12:22 -0700 (PDT) Received: from localhost.localdomain (c-67-174-166-185.hsd1.ga.comcast.net. [67.174.166.185]) by smtp.gmail.com with ESMTPSA id y15sm3557250qko.78.2021.10.01.10.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 10:12:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 33/41] target/openrisc: Make openrisc_cpu_tlb_fill sysemu only Date: Fri, 1 Oct 2021 13:11:43 -0400 Message-Id: <20211001171151.1739472-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211001171151.1739472-1-richard.henderson@linaro.org> References: <20211001171151.1739472-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::835; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x835.google.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_DNSWL_NONE=-0.0001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stafford Horne , alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The fallback code in raise_sigsegv is sufficient for openrisc. This makes all of the code in mmu.c sysemu only, so remove the ifdefs and move the file to openrisc_softmmu_ss. Remove the code from cpu_loop that handled EXCP_DPF. Cc: Stafford Horne Signed-off-by: Richard Henderson --- target/openrisc/cpu.h | 7 ++++--- linux-user/openrisc/cpu_loop.c | 8 -------- target/openrisc/cpu.c | 2 +- target/openrisc/mmu.c | 8 -------- target/openrisc/meson.build | 2 +- 5 files changed, 6 insertions(+), 21 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index 187a4a114e..ee069b080c 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -317,14 +317,15 @@ hwaddr openrisc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); int openrisc_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int openrisc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); void openrisc_translate_init(void); -bool openrisc_cpu_tlb_fill(CPUState *cs, vaddr address, int size, - MMUAccessType access_type, int mmu_idx, - bool probe, uintptr_t retaddr); int print_insn_or1k(bfd_vma addr, disassemble_info *info); #define cpu_list cpu_openrisc_list #ifndef CONFIG_USER_ONLY +bool openrisc_cpu_tlb_fill(CPUState *cs, vaddr address, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr); + extern const VMStateDescription vmstate_openrisc_cpu; void openrisc_cpu_do_interrupt(CPUState *cpu); diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c index de5417a262..fb37fb7651 100644 --- a/linux-user/openrisc/cpu_loop.c +++ b/linux-user/openrisc/cpu_loop.c @@ -54,14 +54,6 @@ void cpu_loop(CPUOpenRISCState *env) cpu_set_gpr(env, 11, ret); } break; - case EXCP_DPF: - case EXCP_IPF: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - break; case EXCP_RANGE: case EXCP_FPE: /* ??? The kernel vectors both of these to unhandled_exception. */ diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index 27cb04152f..dfbafc5236 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -186,9 +186,9 @@ static const struct SysemuCPUOps openrisc_sysemu_ops = { static const struct TCGCPUOps openrisc_tcg_ops = { .initialize = openrisc_translate_init, - .tlb_fill = openrisc_cpu_tlb_fill, #ifndef CONFIG_USER_ONLY + .tlb_fill = openrisc_cpu_tlb_fill, .cpu_exec_interrupt = openrisc_cpu_exec_interrupt, .do_interrupt = openrisc_cpu_do_interrupt, #endif /* !CONFIG_USER_ONLY */ diff --git a/target/openrisc/mmu.c b/target/openrisc/mmu.c index 94df8c7bef..91cedf4125 100644 --- a/target/openrisc/mmu.c +++ b/target/openrisc/mmu.c @@ -23,11 +23,8 @@ #include "exec/exec-all.h" #include "exec/gdbstub.h" #include "qemu/host-utils.h" -#ifndef CONFIG_USER_ONLY #include "hw/loader.h" -#endif -#ifndef CONFIG_USER_ONLY static inline void get_phys_nommu(hwaddr *phys_addr, int *prot, target_ulong address) { @@ -94,7 +91,6 @@ static int get_phys_mmu(OpenRISCCPU *cpu, hwaddr *phys_addr, int *prot, return need & PAGE_EXEC ? EXCP_ITLBMISS : EXCP_DTLBMISS; } } -#endif static void raise_mmu_exception(OpenRISCCPU *cpu, target_ulong address, int exception) @@ -113,7 +109,6 @@ bool openrisc_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, OpenRISCCPU *cpu = OPENRISC_CPU(cs); int excp = EXCP_DPF; -#ifndef CONFIG_USER_ONLY int prot; hwaddr phys_addr; @@ -138,13 +133,11 @@ bool openrisc_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, if (probe) { return false; } -#endif raise_mmu_exception(cpu, addr, excp); cpu_loop_exit_restore(cs, retaddr); } -#ifndef CONFIG_USER_ONLY hwaddr openrisc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) { OpenRISCCPU *cpu = OPENRISC_CPU(cs); @@ -177,4 +170,3 @@ hwaddr openrisc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) return phys_addr; } } -#endif diff --git a/target/openrisc/meson.build b/target/openrisc/meson.build index e445dec4a0..84322086ec 100644 --- a/target/openrisc/meson.build +++ b/target/openrisc/meson.build @@ -10,7 +10,6 @@ openrisc_ss.add(files( 'fpu_helper.c', 'gdbstub.c', 'interrupt_helper.c', - 'mmu.c', 'sys_helper.c', 'translate.c', )) @@ -19,6 +18,7 @@ openrisc_softmmu_ss = ss.source_set() openrisc_softmmu_ss.add(files( 'interrupt.c', 'machine.c', + 'mmu.c', )) target_arch += {'openrisc': openrisc_ss}