From patchwork Sat Mar 25 10:54:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 666909 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp248448wrt; Sat, 25 Mar 2023 04:52:53 -0700 (PDT) X-Google-Smtp-Source: AK7set9RRHJvDwEv5CmzYZZJsc9GgPKF4bJvzwPXk7LGh2IYHWkwacJwqXFctW9hzBSAi3+7jQJi X-Received: by 2002:ac8:5f91:0:b0:3dd:d7ca:535f with SMTP id j17-20020ac85f91000000b003ddd7ca535fmr10954086qta.58.1679745172978; Sat, 25 Mar 2023 04:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679745172; cv=none; d=google.com; s=arc-20160816; b=igsqlTk+kGMA6PS6WnnhPUhQVCVzElLOK4PrZyav72HpamYSw81WUvfpAypOoljl3F KwHvfXL/StOjGoJeN0mGVQasaoF8hLNyJ2RqebxTv7WH5u/R4NGFTZNPi7tjN5Uvv7nY l/nG132MGpWwCXxBGD0ojbSLqAp5VcaWPfRXUmL4Uc9GO+dABuEcVb2wW67zsS1N56Ra vFp1D3ZtaEUa37PIIHexpV8A7M64hl3d0i+kjpYbQLxsdAlCbMZu2wqkst/L9CV0vYYJ aw+pdobblpDGGjqufm86GL6M16FKPdhrqt4hMzAayBfnWxxUZkxB0jBuyo5FS8HKZH6A /Yaw== 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=4cy1xP5OQWUfnynTXfbvIKGvVE6egHD8uv4kncq6BSo=; b=h8QFT3MOpPMQkiO+TdVFm3ex235OgmCVcdDwS15TEXZbtMMUNR1W2FPa79H6NHAIVF Lg7KPPZKuG21T03uDyMpl9ubg106zkEnnUBZgQ8TL2OLjDhDTD+Qsg849yZtfNMMuWSH vfK1PJVEJJkfK0Cf5OMK0uVy5SBEHy5SpaL/Opht65wH/43cdeOBcBmymMkqfebpE9Jy 8DLTQ4xvVUFf6zXi7MlvoAPkfa1s4P/QpOcdojPNrMVvMt6ZiWbVzIYb4D3Qk/ph18B2 o4pauXeuOyVBIC+GcLMBPuhXuEmrHGNyd0RzRIjZOxan8qBf1vscJ68NAiZXuWGrw6Rq 7uAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jt3L1RgS; 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 19-20020ac85713000000b003e390d3d022si4963239qtw.623.2023.03.25.04.52.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 Mar 2023 04:52:52 -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=Jt3L1RgS; 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 1pg2S1-00050J-Ds; Sat, 25 Mar 2023 07:52:49 -0400 Received: from [2001:470:142:3::10] (helo=eggs.gnu.org) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pg2S0-0004uW-68 for qemu-devel@nongnu.org; Sat, 25 Mar 2023 07:52:48 -0400 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pg2Ry-0007np-7Z for qemu-devel@nongnu.org; Sat, 25 Mar 2023 07:52:47 -0400 Received: by mail-qt1-x82c.google.com with SMTP id t19so3937121qta.12 for ; Sat, 25 Mar 2023 04:52:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679745165; 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=4cy1xP5OQWUfnynTXfbvIKGvVE6egHD8uv4kncq6BSo=; b=Jt3L1RgS0vWFeAIfr06VQeQCJw+/RijrDmO4ZwHpniQTUNjZccZRVT4/UzBajg4AqH Qf/3uDA2oSgNoOMfsOuzT0Sqm67GQF23CqGnnLzA6niK0N7rD85kuEA2Jili4yTfm8kd WObDP5sr5btFNQXuBW2fR0QxQZLvVfGZ2dQ0BSAmCRd9zO5QnBh0xVIHZKCYlKELTGit 273XFHG8ueGuJxJM97gg8+YTi+hOypsVn8u04+wZJ+HJT8lNsB6xmnjstLP8H1WOzomB gE213VKtU2iZy85EW5WvNMKSklQQHmO+gq+FJHEpoXlbhxJbb/48uiEUB2uEUSg7InR+ U1Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679745165; 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=4cy1xP5OQWUfnynTXfbvIKGvVE6egHD8uv4kncq6BSo=; b=m6AgiWeW8q/0ly7OeSSKfubJSiyO3+AXJm2J75PvCXNLVg7XpUfPSF7fO6e3RLCexf 8E1i+uZVp7P+ow1w5h7SkRTbwigLZA09Eef1yo1iO2Af1OAbEWPtKVclzGjFfWZS6ATv x53iCgKAeNbksFS0CE/WkLfsItT03806vuPc8gc8MrYlkyRVT4LfH/5+LNDikaWPLfVf SHx7AxBm1PYi2PTCM0ABmVRkqxNvhrEhTd2JXCyfbenQvr04O/am+eWV6Ih7kWP3HpOv Bz1fdomP96W/UWDwVhR7WcSY8TKwSkByyJkxREe7bnCZQr4vjpsu65C47kBqW2dAfrYS d2EQ== X-Gm-Message-State: AO0yUKX3hUF6mUl3f3e6iNum62DAWMmk0Y6z6fEAAlZWnqnXCmTKSGUu aLYAiXEisQRH/tFmfwcntjN8qT4U5SbP1VkQgII= X-Received: by 2002:a17:90a:4fe5:b0:23d:48a9:3408 with SMTP id q92-20020a17090a4fe500b0023d48a93408mr5797910pjh.41.1679741678718; Sat, 25 Mar 2023 03:54:38 -0700 (PDT) Received: from stoup.. ([2602:ae:1544:6601:790a:6e23:4a91:70a]) by smtp.gmail.com with ESMTPSA id p14-20020a17090a2d8e00b0023af4eb597csm1234684pjd.52.2023.03.25.03.54.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 03:54:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, palmer@dabbelt.com, zhiwei_liu@linux.alibaba.com, fei2.wu@intel.com Subject: [PATCH v6 09/25] target/riscv: Use cpu_ld*_code_mmu for HLVX Date: Sat, 25 Mar 2023 03:54:13 -0700 Message-Id: <20230325105429.1142530-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230325105429.1142530-1-richard.henderson@linaro.org> References: <20230325105429.1142530-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::82c; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x82c.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.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 Use the new functions to properly check execute permission for the read rather than read permission. Signed-off-by: Richard Henderson Reviewed-by: Alistair Francis --- target/riscv/op_helper.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c index 962a061228..b2169a99ff 100644 --- a/target/riscv/op_helper.c +++ b/target/riscv/op_helper.c @@ -427,18 +427,27 @@ void helper_hyp_gvma_tlb_flush(CPURISCVState *env) helper_hyp_tlb_flush(env); } +/* + * TODO: These implementations are not quite correct. They perform the + * access using execute permission just fine, but the final PMP check + * is supposed to have read permission as well. Without replicating + * a fair fraction of cputlb.c, fixing this requires adding new mmu_idx + * which would imply that exact check in tlb_fill. + */ target_ulong helper_hyp_hlvx_hu(CPURISCVState *env, target_ulong address) { int mmu_idx = cpu_mmu_index(env, true) | MMU_HYP_ACCESS_BIT; + MemOpIdx oi = make_memop_idx(MO_TEUW, mmu_idx); - return cpu_lduw_mmuidx_ra(env, address, mmu_idx, GETPC()); + return cpu_ldw_code_mmu(env, address, oi, GETPC()); } target_ulong helper_hyp_hlvx_wu(CPURISCVState *env, target_ulong address) { int mmu_idx = cpu_mmu_index(env, true) | MMU_HYP_ACCESS_BIT; + MemOpIdx oi = make_memop_idx(MO_TEUL, mmu_idx); - return cpu_ldl_mmuidx_ra(env, address, mmu_idx, GETPC()); + return cpu_ldl_code_mmu(env, address, oi, GETPC()); } #endif /* !CONFIG_USER_ONLY */