From patchwork Fri Jun 26 03:31:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 191798 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp113950ilg; Thu, 25 Jun 2020 20:56:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjEqhcGPG+SqOySTktd/drFyR9d+8s+uLgb5lOl1u4ikhGiAbhVB71WGke8U9VK1zN19Mk X-Received: by 2002:a25:4901:: with SMTP id w1mr1874596yba.31.1593143787190; Thu, 25 Jun 2020 20:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593143787; cv=none; d=google.com; s=arc-20160816; b=sTKlNJlf8r0gppeFCazWot+TNdob5FAO1o4s10mZvzVOWBEnPlgmV7/PHAoaO2qNJi qJbIPQWtUN4H/QFGfnTGkx4IvD5ZpSnRKE+VsUxzUoTZZPWCeQtlgWTRtSTI/PgNCWIL onsbxxr1FOm8FiUk7PBkJGs2KpXTfCGMCfjwMy2zQ+BmMGZA3aRAZRjXsqt5z8IBCe+k pEdpYmdS7EmNbEDMON6QIbAX0NKaU2YMuJLnl6fMrt4XQbkh5WqkVnitT/2n21qB5ej+ fQjHYSD9OdMqImJTfbGOnbbn7M7x//To4l7TNFi1g0S3VGYEot4IkeqlI79SHLT54IyN f3gg== 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=2dxpfAALNb5XPHu6yGNW/9lvY8jd7zeVUnhvGixmCRk=; b=yJ/HSdU52Zvr+3FltXP42hltLIuksF6s8BR8lc+a168xdezi+hs9J9XgEhrSxgWbHh 9ywlwlIKPLR3VSTeZNS0m/7QstR2O0zoOkC+s4VFtlCV/+S3xJ+28d1ur/N7T0U9jYSC P7MIxlPuL3qKtQuhPF4R7+1o5fAKD0s8nE9V/ZCIpscKlwAFfsLD+eWxTj9HqaXD4AoK GtsNvjVgM2S9d4LLBvPSg+2H0R0bORf1eGAIc8QwnoSLYMCh+E3F1TSni2v5CWJKF2q1 mXL2um/tRl083Orp/IOw/WD8YHWLa0l+IrdHITCWShZFW3Qup48DQTgLB4PkDb3OejWJ 6HNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="kljY/tg6"; 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 h10si23756935ybp.442.2020.06.25.20.56.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Jun 2020 20:56:27 -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="kljY/tg6"; 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]:43024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jofTW-0008JU-Ne for patch@linaro.org; Thu, 25 Jun 2020 23:56:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jof6O-0000po-JI for qemu-devel@nongnu.org; Thu, 25 Jun 2020 23:32:32 -0400 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:38368) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jof6N-000223-2P for qemu-devel@nongnu.org; Thu, 25 Jun 2020 23:32:32 -0400 Received: by mail-pj1-x1043.google.com with SMTP id d6so4364180pjs.3 for ; Thu, 25 Jun 2020 20:32:30 -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=2dxpfAALNb5XPHu6yGNW/9lvY8jd7zeVUnhvGixmCRk=; b=kljY/tg6Bistn9AWqo8DXLls8tbqdXIGjUwRIYsToIvVMzlbCHSNRC+kwe8m3RN17D ohgsa338k+hriVsFYaW635R1rr/PtfFGlGgnojo5oLvpXoDmMtMjzXHEoRxxRdIIDseQ 3ztNDSjJekgvyFvqGFxRtBOwplSOP04HMLXbVbSnP5vcuHYn9IaTE5Y9cyX8bOsYLJ+z UYjihISs6+X3+GsKM03LlxG2mFDM+iD/ShrSftjk0NghDV8sSt9HJNgrjRMSnV0KO6Nd rgBo5AO5+ZPf2BzmD1rUz/jK6OH+9v1JzOmEU0UYyNFDZf5AZLZWCehLy+38uPiXbvX/ pcyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2dxpfAALNb5XPHu6yGNW/9lvY8jd7zeVUnhvGixmCRk=; b=H1Yw4rgnTiqecxtBRLldOQU0a5N7YMm8Yb0/CKZCTZKtwr7/VhYTkSTRx5i7PZcJ4v e/u1orY5H1E8BUdEDrv2OkHGRh3P7VRYrQYcgWBGboSkmIdd8FIPeJNj8rMFSmGRZsRb yjxPQbQWrGoTqHZBuJcGy9UUszxE+iqaeCg4KmNWqQecmzg0fEDZ8bonOhwFyk0dhrrz craBHjZ+pmPpssgD90U7Y05vbl1dUUfl5t+FM0/dRHQQ5XuKQR4NWSVOpxNv8X34x1mu Ch3nyZPvwAnR/ckJcZ2urglKJ501ALOzz+dDd9h3FFsRCxTJC5QP+exaO3W0w5wHVs+8 5c0w== X-Gm-Message-State: AOAM533LQhhHyJokCpViKtm3YV7HG8yHCmIROdxW3L7DHYZyhgRmfYx3 Vqe52MhN9FAIyhoAeQh8yLdta/ZEJh0= X-Received: by 2002:a17:902:8a96:: with SMTP id p22mr882471plo.281.1593142349428; Thu, 25 Jun 2020 20:32:29 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id y27sm1605256pgc.56.2020.06.25.20.32.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2020 20:32:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 32/46] target/arm: Add arm_tlb_bti_gp Date: Thu, 25 Jun 2020 20:31:30 -0700 Message-Id: <20200626033144.790098-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200626033144.790098-1-richard.henderson@linaro.org> References: <20200626033144.790098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1043; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1043.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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=_AUTOLEARN 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: peter.maydell@linaro.org, qemu-arm@nongnu.org, david.spickett@linaro.org, steplong@quicinc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Introduce an lvalue macro to wrap target_tlb_bit0. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.h | 13 +++++++++++++ target/arm/helper.c | 2 +- target/arm/translate-a64.c | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index cb4f6ba69f..c54f0ab18a 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3393,6 +3393,19 @@ static inline uint64_t *aa64_vfp_qreg(CPUARMState *env, unsigned regno) /* Shared between translate-sve.c and sve_helper.c. */ extern const uint64_t pred_esz_masks[4]; +/* Helper for the macros below, validating the argument type. */ +static inline MemTxAttrs *typecheck_memtxattrs(MemTxAttrs *x) +{ + return x; +} + +/* + * Lvalue macros for ARM TLB bits that we must cache in the TCG TLB. + * Using these should be a bit more self-documenting than using the + * generic target bits directly. + */ +#define arm_tlb_bti_gp(x) (typecheck_memtxattrs(x)->target_tlb_bit0) + /* * Naming convention for isar_feature functions: * Functions which test 32-bit ID registers should have _aa32_ in diff --git a/target/arm/helper.c b/target/arm/helper.c index 33f902387b..44a3f9fb48 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11079,7 +11079,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, } /* When in aarch64 mode, and BTI is enabled, remember GP in the IOTLB. */ if (aarch64 && guarded && cpu_isar_feature(aa64_bti, cpu)) { - txattrs->target_tlb_bit0 = true; + arm_tlb_bti_gp(txattrs) = true; } if (cacheattrs != NULL) { diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index a2a8280010..7a3774bfda 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14434,7 +14434,7 @@ static bool is_guarded_page(CPUARMState *env, DisasContext *s) * table entry even for that case. */ return (tlb_hit(entry->addr_code, addr) && - env_tlb(env)->d[mmu_idx].iotlb[index].attrs.target_tlb_bit0); + arm_tlb_bti_gp(&env_tlb(env)->d[mmu_idx].iotlb[index].attrs)); #endif }