From patchwork Tue Jun 23 19:36:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 191515 Delivered-To: patch@linaro.org Received: by 2002:a92:1f07:0:0:0:0:0 with SMTP id i7csp2281746ile; Tue, 23 Jun 2020 12:51:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYTZn8PucJvxFVhFbWIk/ZS5AmBnm0H9AGquxv1Vhk8R1Jv5uJlkl+O+S2HgNSid2uAG+7 X-Received: by 2002:a5b:282:: with SMTP id x2mr37589230ybl.304.1592941865506; Tue, 23 Jun 2020 12:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592941865; cv=none; d=google.com; s=arc-20160816; b=odedSHmlGlWHMdB10oNSg44HO2QIxxL+booNnYMNtz0FB0kQLw6ayTBoFpdCscyWZ5 saMKrOEMneCU08qY0ZOUui+zl+lofbUn8yoKlI2G67ESECFvCys4QsDdFCMnaVroJrP2 gqWSmwn84wic9BzvI/hj612G184j7CvxBjC6lE+45LLIftJEEWJDasksaG7kt3aCEyKV D30SoyzMRweoAtq+GkIYiW1NkYo0PAfvLU9VKOsnrxoOJHDqTX4MCXS0CtSB4xD5CjUs aJFLUlhUath4xy95VPUEKFCL9o00Yr2rICsBLbaD0JRY1uiK99QqCjphzSXGt7qQXRNb 6R6w== 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=lFZIBVnnlVZuvCXE23rLh8+qqZ5/2nVCbq1tYJwjFwg=; b=INKCOlwAqBSMuNGHEggqDS+z6VTYM0MOJaPwElzHLB56RStnibgtN/rF6GW5Q/T5sn QZyaMDpCmqy8pyPIcwqlc7WVgTH5y/rUTo6nmsGGvYC3g0WMRBHCpD+Y9yBGfxX2sJjz IHgYm0TR8SgVXcvRs9k/nD0bnKcZBgAnNEWJNl7WGZyIke0TzYF2YoYMD9T2GDDXKqN+ 1QkOIGwQHFshrmX/Xx7O6HyTLd1nAGtAlbiFYTGl7knO8/3vnLrkSLrqJEq6/RblVkJO nauKoDpCnLwxlPvexGS7+sm2nFoJXyOMB2QIesG5TOciPT7SwvlY18yYGBXOW+GKtlPO Xv4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=vOmstwkx; 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 x80si15695542ybg.445.2020.06.23.12.51.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jun 2020 12:51:05 -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=vOmstwkx; 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]:44892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnowi-0003cN-Ql for patch@linaro.org; Tue, 23 Jun 2020 15:51:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnok3-00059L-8e for qemu-devel@nongnu.org; Tue, 23 Jun 2020 15:37:59 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:34289) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jnojy-0005u6-DQ for qemu-devel@nongnu.org; Tue, 23 Jun 2020 15:37:58 -0400 Received: by mail-pf1-x436.google.com with SMTP id z63so10572096pfb.1 for ; Tue, 23 Jun 2020 12:37:54 -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=lFZIBVnnlVZuvCXE23rLh8+qqZ5/2nVCbq1tYJwjFwg=; b=vOmstwkxAs/gwrcc72YsEcWqCT3EAiWXwfrqY6qneV2A+eQy8XSggm1VIuogPJRP7h dl2od+DNNRJma0JAKOHFzxtH5eCB/hVvyOHe3+mYrDT/0RNYkbKQ/VuH4RP5u/s2tanZ 7HOH4aj2EMrHn4cVVrVhKFlNAb5Gt8Nv6brsHjRaqJJv4KQRnADXkBOokgRCc/eNq6h3 Ov0hUIX6R8xnMQoy1UpCV3v73kNSUuybYRJKk33cVM//NRBDVT+HmwTsaGptEw3DSUQv GcDiUj2z6PNODRcisM2yeVvkpmnWLZdJMBQip73LCM2osQVoM9RoSVcVd6zXOanoJrTp oA5A== 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=lFZIBVnnlVZuvCXE23rLh8+qqZ5/2nVCbq1tYJwjFwg=; b=gtGN3s+0LTC8JP0qeNvDEegGF+vzlT1jyIWZUNGdZjfRNHm+DofYSGt+eW7zA4rBQR Hhy8MtzlpehPS1nmFJqSvQkOJSXPv5MTJvJUa02GoAw4CLBifJparboFlhRXM2sGAH5O xDByRyzGoM8XcvxXTDE2j24yT77jk5ljdpsikK+bgK6fGlD5xLdhXncf8raa0zSgYOQz ZQkyrROcQ9IsB9iE8TwQ70SXNHjKvSoW7QjZRCYXTlTqzRMHGJY+qu6RGvlm4+tOCASU IXbBQN/DEwRYjfpb0ny3bnifia9z/gKngMeWvvBC5W11rwyTQm9+0UMAyDc/36z65zPb +RmQ== X-Gm-Message-State: AOAM531cL9m/SbPcY1oX+61FrVHjpH+yPgZBw2u61CT+NPLhF8qpyhum g2SmS9ntKa1Cx52ZrJlxt/DVtxXfqVY= X-Received: by 2002:a63:1207:: with SMTP id h7mr18448438pgl.241.1592941072798; Tue, 23 Jun 2020 12:37:52 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id p12sm17927642pfq.69.2020.06.23.12.37.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 12:37:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 38/45] target/arm: Complete TBI clearing for user-only for SVE Date: Tue, 23 Jun 2020 12:36:51 -0700 Message-Id: <20200623193658.623279-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200623193658.623279-1-richard.henderson@linaro.org> References: <20200623193658.623279-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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" There are a number of paths by which the TBI is still intact for user-only in the SVE helpers. Because we currently always set TBI for user-only, we do not need to pass down the actual TBI setting from above, and we can remove the top byte in the inner-most primitives, so that none are forgotten. Moreover, this keeps the "dirty" pointer around at the higher levels, where we need it for any MTE checking. Since the normal case, especially for user-only, goes through RAM, this clearing merely adds two insns per page lookup, which will be completely in the noise. Signed-off-by: Richard Henderson --- target/arm/sve_helper.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index ad974c2cc5..382fa82bc8 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -3966,14 +3966,16 @@ static void sve_##NAME##_host(void *vd, intptr_t reg_off, void *host) \ static void sve_##NAME##_tlb(CPUARMState *env, void *vd, intptr_t reg_off, \ target_ulong addr, uintptr_t ra) \ { \ - *(TYPEE *)(vd + H(reg_off)) = (TYPEM)TLB(env, addr, ra); \ + *(TYPEE *)(vd + H(reg_off)) = \ + (TYPEM)TLB(env, useronly_clean_ptr(addr), ra); \ } #define DO_ST_TLB(NAME, H, TYPEE, TYPEM, TLB) \ static void sve_##NAME##_tlb(CPUARMState *env, void *vd, intptr_t reg_off, \ target_ulong addr, uintptr_t ra) \ { \ - TLB(env, addr, (TYPEM)*(TYPEE *)(vd + H(reg_off)), ra); \ + TLB(env, useronly_clean_ptr(addr), \ + (TYPEM)*(TYPEE *)(vd + H(reg_off)), ra); \ } #define DO_LD_PRIM_1(NAME, H, TE, TM) \ @@ -4091,6 +4093,19 @@ static bool sve_probe_page(SVEHostPage *info, bool nofault, int flags; addr += mem_off; + + /* + * User-only currently always issues with TBI. See the comment + * above useronly_clean_ptr. Usually we clean this top byte away + * during translation, but we can't do that for e.g. vector + imm + * addressing modes. + * + * We currently always enable TBI for user-only, and do not provide + * a way to turn it off. So clean the pointer unconditionally here, + * rather than look it up here, or pass it down from above. + */ + addr = useronly_clean_ptr(addr); + flags = probe_access_flags(env, addr, access_type, mmu_idx, nofault, &info->host, retaddr); info->flags = flags;