From patchwork Wed Apr 12 11:43:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 672626 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:184:0:0:0:0 with SMTP id p4csp288859wrx; Wed, 12 Apr 2023 04:48:31 -0700 (PDT) X-Google-Smtp-Source: AKy350b6d6Rg7v36KbBlpxcRyUC0safg+ZHDl4eag4cVuVLhhfCJYv3z19t2o0gsRaZ+jbBLJEdn X-Received: by 2002:a05:6214:260d:b0:5b4:ccc0:4f60 with SMTP id gu13-20020a056214260d00b005b4ccc04f60mr31325621qvb.37.1681300111003; Wed, 12 Apr 2023 04:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681300110; cv=none; d=google.com; s=arc-20160816; b=kk/Ov+c217LsCYgp6C+jlYPCh3R8/rgWBjGS0o6tLBdZwnp1fOcjvI2R+eaPcPM2zs KoAbHRFWVNgPUPxwOQEnyIRmvGk7fDqeAmsVIpGmi8Ho2jS/0jyBvUzCLhyEmILAXNY5 +lAWXbEEDn42QF/XQEkXHlKf+j7pxIlCXD/ziUZkiIMIVXsSTt72TooUTDd8aJcJjUQx 01qfn6wZNzD5UKMZ5K6fefUSAGuWQgNXwnSlDZXZnbGp4N24NnnBjUli3KnQ+rmFhqKY 4ZzvFhuO7teHl7jMK9ZSji6x6EmBSh18vhPEL3+Hw66OARLEEQwdUHQGfTh1/bYIMOpm nLxg== 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=jf2N922f7MxhHGZfTcgNdzsCq9UU22b0tOdlcxX9fy8=; b=b7PseRCgO+1NoYlO5So4KdlKg/ekl3NWhokT2uKdLKwCT/tiMaI5bbrRfO1PRWr4PV u238YF2y62QzYqjpUcfuanJrgZpaMRkXIB5pddWfWz3x4P0q81F0nN8ITBcODflQ1ek2 dHXsxHgahL6kngRfZlGt5xOVK6sDSHDQytTzTHUoa1N24mHxrNBKaLGqQmxciptDqNNA +e1KsvEfe3Kv6WAY3qR8MBIsUHiG7ogUkv25sFYyRqhgYClL/qhfYrijyxJMfAGMuD3p qukfN72h+j3vBqxVU3pZMO8I/U+fVALzORVoPnnzDP/j8TSj1GQVgD4DcFapNo/ceq9L Yv8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="v/jWYxdJ"; 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 i184-20020a3786c1000000b00747d1d07939si10297671qkd.655.2023.04.12.04.48.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Apr 2023 04:48:30 -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="v/jWYxdJ"; 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 1pmYtf-0005yk-Hd; Wed, 12 Apr 2023 07:44:19 -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 1pmYt9-0004ml-PL for qemu-devel@nongnu.org; Wed, 12 Apr 2023 07:43:47 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pmYt7-0002PS-T9 for qemu-devel@nongnu.org; Wed, 12 Apr 2023 07:43:47 -0400 Received: by mail-wr1-x42b.google.com with SMTP id g5so13963139wrb.5 for ; Wed, 12 Apr 2023 04:43:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681299823; x=1683891823; 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=jf2N922f7MxhHGZfTcgNdzsCq9UU22b0tOdlcxX9fy8=; b=v/jWYxdJsgTuWFPt6wHpyVXn2fUj/zYPVBvMTgmj+8NBdxqnxOIr6zyx31dKLv5sb1 Sfie28Z3vW3trfGGnL5kSPdiUVVO0joqiR7ai//b4jKF19uxA9okt4+bE2EHzQaCMn0x APUQMJmhYKtWRT+nyCENCV+Uu85AydKyV98g5lkYq/bC83I2iPAFsGkhFFEE3SP2Q6eV o1lkCwKEPPHNT0/j+jblNG6qAu53yve3LL6hpW/fs1KH8pQ1K9XoPeuUP7jku/Vt7lEL WkRnCVFnDgwIQBaEyaNazdcfYly/h8jTN64LsmhvAV4QJ4+rWdTxMUjEAZEWUstQmoJa vU6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681299823; x=1683891823; 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=jf2N922f7MxhHGZfTcgNdzsCq9UU22b0tOdlcxX9fy8=; b=PE7dsA15B32lB08sZsX45GAmtJ/+r72rrHicNk3JyRjlSpzTAbndotqQ7ZUiZrsMWx 2Oyo2KBzn+38aj9cmtx4pRiRBI+eQ1kAK7y5LKhffqpfUQ8cvwvPPWVFskaCC6gcjQHq NgvyvSMkB4Z6Z2YYQVMZUqF/dSnSMswQCE5qZ5miYRhC0QW31cQluTTZGfalCIZ9+EXY iaUTwAglwPL6hageHV10NwKmknvf7DZACif+TcHT/MEtEraka7DsRCUTeojETyl1x7bK f2wKXMmBEKH1Zcw/PTk+OjXDDp6U7pmhfUBa1coZtyecAV/lh6aAcII88oiO85/MZKm7 nOBA== X-Gm-Message-State: AAQBX9fefW6P8eNCalruf+WycQFnAcFHDde0ST1ZVPf1aVSMTYk53vOg 8slb+zbrYW719vr1uCcGtil0gXmywGP0BjD3JPeSr8sh X-Received: by 2002:a5d:4e8b:0:b0:2f5:20b:e944 with SMTP id e11-20020a5d4e8b000000b002f5020be944mr586206wru.29.1681299823058; Wed, 12 Apr 2023 04:43:43 -0700 (PDT) Received: from stoup.hotel.gast (ip-037-024-010-236.um08.pools.vodafone-ip.de. [37.24.10.236]) by smtp.gmail.com with ESMTPSA id k9-20020a5d4289000000b002d21379bcabsm16980826wrq.110.2023.04.12.04.43.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 04:43:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, qemu-riscv@nongnu.org, Alistair Francis , Weiwei Li , Daniel Henrique Barboza Subject: [PATCH v7 09/25] target/riscv: Use cpu_ld*_code_mmu for HLVX Date: Wed, 12 Apr 2023 13:43:17 +0200 Message-Id: <20230412114333.118895-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230412114333.118895-1-richard.henderson@linaro.org> References: <20230412114333.118895-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42b.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=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 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 Reviewed-by: Weiwei Li Tested-by: Daniel Henrique Barboza Message-Id: <20230325105429.1142530-10-richard.henderson@linaro.org> --- 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 00bdf77f32..4a0bb5b11a 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 */