From patchwork Mon Jun 26 23:19:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 696533 Delivered-To: patch@linaro.org Received: by 2002:adf:e885:0:0:0:0:0 with SMTP id d5csp3475490wrm; Mon, 26 Jun 2023 16:23:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4RrbDOSRXH3rxZSQr5PwvlE+bEJYq8DxON+tIQgF8bBTBf30d5fH8j0xqrZ8bnUikPOT1R X-Received: by 2002:a05:622a:303:b0:400:9b89:fe06 with SMTP id q3-20020a05622a030300b004009b89fe06mr6706992qtw.54.1687821787649; Mon, 26 Jun 2023 16:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687821787; cv=none; d=google.com; s=arc-20160816; b=OnyUOuOLTlrPzRI8tvQxjnsrfRoaTLoqLkHdsbygN3zD3DwCSoxPWgo4TJiA5IEkkV texmj8exmEO78EJqO9igREnstSZVqXJNoDqs0Fr8MJD8BPy3FUuILdbz/mum102uAx8D +mCEgyFa9OQUyWtjxBOW11PdztVvKbGTmaiPXdanXRGnCGyesNVXFAwxU6kSE2AKNvi9 GrSmocP3wIZYok6sU7Uqp2h4bgewPxEdkF+8SYJ1fmueuBXtawl7Q/zKz8/4UWjM23U4 wL/jXbCRskzEHHUoBSseAVoSQ+mI96AL6uN4aAyy0/ga9ygS7GDCuQDt8WCGdHK+TmvL Tl2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=eiJRm9dNflVLbzk1HDloTKSsjOOAeGYdt13uGLUOy3Q=; fh=Q5PWRR3YGPXeAkQ7IpHJrCtvtZBBd6Ig9aRmT7uxHvE=; b=X/ej38Cjqo8hQXwQBmK5fUur1yJs3fg9gO3CV368g1AFAqdej9ICun3oa0nKKpQVOf l4z4RaY3BXX2dPw0F82wVAA+OE8y750l8jFQ5qbHa/v3d9DNRA+2mZVd4KZhn0F9rH3B TjWzSX9hX5BFDA4e2JM5sVG6VYqs/mdDLPjmKauuchlhtMldLp9dGvpeXFw57wT3aN5t Ocb1biClpTgM3zUfStEVsX3O/4ilUShTsL1CiDkRz2ktNg1TSM0+VfhAF/G0hvtxW/J3 sNXCYQ9Sm/eZ0+JSM5gPeKKzYZpz9Uv6Xkt74UyafxFa4mXi6yCTHr9v2pKgV//UEZ/3 e4EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TNbMGgUq; 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=pass (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 s20-20020a05622a179400b003f391e7d585si189487qtk.543.2023.06.26.16.23.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Jun 2023 16:23:07 -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=pass header.i=@linaro.org header.s=google header.b=TNbMGgUq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDvVv-0004l4-JU; Mon, 26 Jun 2023 19:20:55 -0400 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 1qDvVr-0004iX-VV for qemu-devel@nongnu.org; Mon, 26 Jun 2023 19:20:51 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDvVq-0000Ap-6f for qemu-devel@nongnu.org; Mon, 26 Jun 2023 19:20:51 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2b698dd515dso33673661fa.3 for ; Mon, 26 Jun 2023 16:20:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687821648; x=1690413648; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eiJRm9dNflVLbzk1HDloTKSsjOOAeGYdt13uGLUOy3Q=; b=TNbMGgUqpHFY7MHZV2HNUHTGA35ajJcS/qVxlzpC7BX/wWtSMFcQUH5VlTgPUsGwvv qA3ahx9+ziwpB1TE81UYqKW0lmHtfDB5a9s2MQ83ZYbP+laZoPsJQTrfqNwdnrgcUKPC wGmAfuZuZkwDUvhMxiqZlesjMkD20va9L/G1h2HfqaKjr85M0VagE1dYVd5S+WkbtxNt 9tloLnjN7R10pmW0GEHOLDVRsE8MKONGOx/HB7vRTMGUbnTlt+rmIykpIijcYm1hbekw 2iCP9T02pyjfXKRrklfobX3/IA4geb4x5V/beVHo29RzHOIsKCUBTH62WAfHUqnwmHDO RHyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687821648; x=1690413648; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eiJRm9dNflVLbzk1HDloTKSsjOOAeGYdt13uGLUOy3Q=; b=JjHJOB8rYmQ5cv05M6vIySksc36QnWwbsYd8o+iJv8oEp2NB4C1e5kX1KH/aSfV3gt ywtb/TVw19ZMR+Qw2nFHeZvj+XDl9eaDs9YCm9uwIHlJBdYMUseoWPPDsGXccGwHVs7W nQsGnfmE3BMGPq1kwGPxnkzW95xqd+990r0/n1ciSMmubYIbT2Cypeo7++bHBdVptf89 0U9PTPRphPKLaPPk6T5P4ShChY/PGHA0CBjs2V2lSnrCROtBKLGoGO7Rdie00sNKe2+H CufKL7R4ETP7pazg/XFEs67uekgaWvGDPdFs/FoA8dPAYK2t7dvEnoSQH0chNvMzGopr SvjA== X-Gm-Message-State: AC+VfDwEvl7MFg4nscnjeaLIwQUoCFNkfWrVBRehiqRjBdv/nJnUQvb7 TG/x2VCLmVYkkQRQldjhr76AwsLwOz4YS0uHah8= X-Received: by 2002:a2e:9542:0:b0:2b1:a89a:5f2b with SMTP id t2-20020a2e9542000000b002b1a89a5f2bmr19184807ljh.2.1687821648287; Mon, 26 Jun 2023 16:20:48 -0700 (PDT) Received: from m1x-phil.lan ([176.187.199.226]) by smtp.gmail.com with ESMTPSA id k19-20020a05640212d300b0051d988bd64bsm1670037edx.97.2023.06.26.16.20.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 26 Jun 2023 16:20:47 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Bin Meng , Liu Zhiwei , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Beraldo Leal , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Palmer Dabbelt , Wainer dos Santos Moschetta , Daniel Henrique Barboza , Weiwei Li , qemu-riscv@nongnu.org Subject: [PATCH 06/16] target/riscv: Restrict riscv_cpu_do_interrupt() to sysemu Date: Tue, 27 Jun 2023 01:19:57 +0200 Message-Id: <20230626232007.8933-7-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230626232007.8933-1-philmd@linaro.org> References: <20230626232007.8933-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=philmd@linaro.org; helo=mail-lj1-x231.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org riscv_cpu_do_interrupt() is not reachable on user emulation. Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/cpu.h | 5 +++-- target/riscv/cpu_helper.c | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 83a9a965d1..288df4c2b1 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -411,7 +411,6 @@ extern const char * const riscv_int_regnamesh[]; extern const char * const riscv_fpr_regnames[]; const char *riscv_cpu_get_trap_name(target_ulong cause, bool async); -void riscv_cpu_do_interrupt(CPUState *cpu); int riscv_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs, int cpuid, DumpState *s); int riscv_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs, @@ -444,6 +443,7 @@ void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp); #define cpu_mmu_index riscv_cpu_mmu_index #ifndef CONFIG_USER_ONLY +void riscv_cpu_do_interrupt(CPUState *cpu); void riscv_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, unsigned size, MMUAccessType access_type, @@ -467,7 +467,8 @@ void riscv_cpu_set_aia_ireg_rmw_fn(CPURISCVState *env, uint32_t priv, void *rmw_fn_arg); RISCVException smstateen_acc_ok(CPURISCVState *env, int index, uint64_t bit); -#endif +#endif /* !CONFIG_USER_ONLY */ + void riscv_cpu_set_mode(CPURISCVState *env, target_ulong newpriv); void riscv_translate_init(void); diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 5ff48be561..cc0050d110 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -1575,7 +1575,6 @@ static target_ulong riscv_transformed_insn(CPURISCVState *env, return xinsn; } -#endif /* !CONFIG_USER_ONLY */ /* * Handle Traps @@ -1585,8 +1584,6 @@ static target_ulong riscv_transformed_insn(CPURISCVState *env, */ void riscv_cpu_do_interrupt(CPUState *cs) { -#if !defined(CONFIG_USER_ONLY) - RISCVCPU *cpu = RISCV_CPU(cs); CPURISCVState *env = &cpu->env; bool write_gva = false; @@ -1779,6 +1776,6 @@ void riscv_cpu_do_interrupt(CPUState *cs) env->two_stage_lookup = false; env->two_stage_indirect_lookup = false; -#endif - cs->exception_index = RISCV_EXCP_NONE; /* mark handled to qemu */ } + +#endif /* !CONFIG_USER_ONLY */