From patchwork Sat Mar 25 10:54:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 666916 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp249503wrt; Sat, 25 Mar 2023 04:56:44 -0700 (PDT) X-Google-Smtp-Source: AKy350Y77J6h5bxxmy7gY4XIhSlCe5rtl1M7ZOFKxJjGA65aGtM+FVdMAbcF4V71gE9erxs/pjux X-Received: by 2002:a05:6214:400a:b0:53a:bf63:b053 with SMTP id kd10-20020a056214400a00b0053abf63b053mr9368726qvb.45.1679745404497; Sat, 25 Mar 2023 04:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679745404; cv=none; d=google.com; s=arc-20160816; b=aiLG/6HKjmhlOSblCRUo+LDQ1QzCpa7ksZq9nTbGBnt39zWIaoyUKtzTl9LI2oGZz+ O3f0FTOvWYWTLDRLSY5SsiX+1IWkiUxOOSgWM5yr6XrBI1G89mSd5ltmr0NP6+FoR583 XxBz5Nl2JQAqSqVNv8l/TPE+m2obyRUMTXD8VPv+1Gz7cyrtSHTTkx6mvI7kAFeOCRRR XY5E7nb5tYUmEWcf+aOKRguv6ttw8+Bg8LY/yISZYIUvOZ0/qQ2jxUDk2pqJGHRUJaEN MTFi/llO/yDTV5cui1eBWYTWFt3xlfjp++jXom9FAdisCc24qJd/AWRG9fhun5hi3FTn B0pw== 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=1C7JBeZYsSuK59INs65mEH6x0tpxz6ymfYLghIcQtMo=; b=Yk+nSlfbBts45GIHW8wlww3+3NjcF4LTGyyHmARyKhZI8dfXz54GQxj3mxnPJdI6j6 0yaoy0PSqa0l/qAnWUxLr0HKve8qq/ZKUg02BUYGr/vXrY4oNMrmLN9q+dLvEbbgnbb1 39L++BhIizYM2JM29jWaGB+pLEemufi96SEcEv0+3k4AL17F62SPlKPgrnCVAtIQBJa0 PHUG6a+gFhQXuBeli08TiSb6YZuiSLLbYB86uHeRSo98ZheOQ19rmbHszHgkG1nkDTAz Rf+G7H+1nKEdh9nSknWsSOLDmS4mNxT8u3EeyW9dsLminutCUEnlq1ZSZhSSF5WbwkRu Yi0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nMz0+sQQ; 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 qd11-20020ad4480b000000b0056ea322369bsi15409975qvb.64.2023.03.25.04.56.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 Mar 2023 04:56:44 -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=nMz0+sQQ; 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 1pg2Vc-0002gL-P9; Sat, 25 Mar 2023 07:56:32 -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 1pg2Vb-0002c6-6g for qemu-devel@nongnu.org; Sat, 25 Mar 2023 07:56:31 -0400 Received: from mail-qt1-x831.google.com ([2607:f8b0:4864:20::831]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pg2VZ-0001AN-Ir for qemu-devel@nongnu.org; Sat, 25 Mar 2023 07:56:30 -0400 Received: by mail-qt1-x831.google.com with SMTP id c19so3936140qtn.13 for ; Sat, 25 Mar 2023 04:56:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679745388; 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=1C7JBeZYsSuK59INs65mEH6x0tpxz6ymfYLghIcQtMo=; b=nMz0+sQQgJ37fBeD8S4rFQLNW/X9vGnC9tqiQz1TCTRldvSqpEO/I94B1pw89e9y4R 7CqDu52zE5WlO1MgbgnIEIzyuLcCiKjGGl6E8MIcD1KL7upLRq18d3GHFPReVshKkWtO AcCPRSZ3LikU968iz0ehxeHtLd+mjUhdwVwMm9mAUPNq/XIp32E3DejgOjnp33wBe27H mNRKCS4BUfsNx62bAMVWJYc3AwFie7fRg4if+pvHjUmruWHqOIB3kER7Bfp1oIc+pnLQ 4VRLDrek8G4e4WFYP3yv/NMIAI+CQKZoO67ylCB3vYAV/uZQTIi7IJR3f11O9+0Efk2A k/hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679745388; 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=1C7JBeZYsSuK59INs65mEH6x0tpxz6ymfYLghIcQtMo=; b=JJfitpmm/zxNJ/12/Sqj1c/IX6oRjcCcDiBsq2KGF7znXrhhrjN6cks3i07DUclpFg VzsjaVR9TEYVLLGbJUGFNuFIpBl22yNvbnGG+b02WZaWccKhhg5j6qwKy3e6eQ7Vkdux B1vIgM8cSwBN5Mxil/SOOiVKlJpMIwvX2lDapIzCP4Jo1M+YyHB5sdss+/ui60/8xDHR /q7FZr/6TJ7o2Tpp3v8szj6Ac3l1i5G0XS5Omz5TlDCChZnv9Ad+mt1tChpfiatyqafA f03NzsY+oszrJcmuVHvCLJWi1Ihmtt6iyX1wtgJJl/edVEbRATe2oCWfI1CJjHj9opfK GiAQ== X-Gm-Message-State: AO0yUKUQqVvVLUxvwAE2m7DWRdbkwtuXutgooJt4N+SUxBMnMz/A9PXX NUBJQo8jcvD8Le50gEXZGUIQ+LuBXMkk1DKs9xg= X-Received: by 2002:a17:90b:4a45:b0:23b:d506:226e with SMTP id lb5-20020a17090b4a4500b0023bd506226emr5973974pjb.42.1679741680473; Sat, 25 Mar 2023 03:54:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 03:54:40 -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 11/25] target/riscv: Rename MMU_HYP_ACCESS_BIT to MMU_2STAGE_BIT Date: Sat, 25 Mar 2023 03:54:15 -0700 Message-Id: <20230325105429.1142530-12-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::831; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x831.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 We will enable more uses of this bit in the future. Signed-off-by: Richard Henderson Reviewed-by: Alistair Francis --- target/riscv/internals.h | 6 ++++-- target/riscv/cpu_helper.c | 2 +- target/riscv/op_helper.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/target/riscv/internals.h b/target/riscv/internals.h index b55152a7dc..7b63c0f1b6 100644 --- a/target/riscv/internals.h +++ b/target/riscv/internals.h @@ -27,13 +27,15 @@ * - S 0b001 * - S+SUM 0b010 * - M 0b011 - * - HLV/HLVX/HSV adds 0b100 + * - U+2STAGE 0b100 + * - S+2STAGE 0b101 + * - S+SUM+2STAGE 0b110 */ #define MMUIdx_U 0 #define MMUIdx_S 1 #define MMUIdx_S_SUM 2 #define MMUIdx_M 3 -#define MMU_HYP_ACCESS_BIT (1 << 2) +#define MMU_2STAGE_BIT (1 << 2) /* share data between vector helpers and decode code */ FIELD(VDATA, VM, 0, 1) diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 9bb84be4e1..888f7ae0ef 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -605,7 +605,7 @@ void riscv_cpu_set_virt_enabled(CPURISCVState *env, bool enable) bool riscv_cpu_two_stage_lookup(int mmu_idx) { - return mmu_idx & MMU_HYP_ACCESS_BIT; + return mmu_idx & MMU_2STAGE_BIT; } int riscv_cpu_claim_interrupts(RISCVCPU *cpu, uint64_t interrupts) diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c index 0f81645adf..81362537b6 100644 --- a/target/riscv/op_helper.c +++ b/target/riscv/op_helper.c @@ -437,7 +437,7 @@ static int check_access_hlsv(CPURISCVState *env, bool x, uintptr_t ra) riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, ra); } - return cpu_mmu_index(env, x) | MMU_HYP_ACCESS_BIT; + return cpu_mmu_index(env, x) | MMU_2STAGE_BIT; } target_ulong helper_hyp_hlv_bu(CPURISCVState *env, target_ulong addr)