From patchwork Wed Jun 3 01:13:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187435 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp79405ilo; Tue, 2 Jun 2020 18:30:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3hT0uR87pMrqjzDm4Ngva47Tq2/m3ixBD8RNlcKgrgpT5pyHYPjsnY3wzVNBwwsLPTAxv X-Received: by 2002:a25:db06:: with SMTP id g6mr43011512ybf.401.1591147825514; Tue, 02 Jun 2020 18:30:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591147825; cv=none; d=google.com; s=arc-20160816; b=QXAjR1vjwfLSkRk8D8/G/h2DjuVmofu9q5/erjZK7Ygg8GGHiRsrJ2X9ri4JCMknjX g1yGSZ21z6FdAqVqrVQ3GYgqEDcbzbQLOcjqvOyBMB695tzxGJcepQJs3BOfvCAbsQwY IXbvMy9BWvD151nUETcypFfNl40g6fKyYQILyz2PEEA6eT9FjWHFWWknG9lbvGpPhvdF QsBbXG0vL2mAH1k/4pnKxruK+1FnV/Qi1XM3sqC6MRxgEJNLz9nKB3BCZR9M4ZbywrJN MEsk1WKjEjZ7roCyLnfXPXnR0JNCueG3XDcL/KhgrxKN73e20eCvmqKV3Uu9KSJcoYyC 2Hbg== 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=L5HmehI0u6Wl5CalJmhYTRnudOl8IyN54sr+tdgMFy8=; b=jIq/3wWMxFEHdZt4rBVZ0FBYM9G39jmEgpz0sGmGz2DJpphJOgghMv37ISANKgWmj2 wRmUwe4TqghjH0xQZju5yDFjchi3BA4F37I38C419Jz7mLNRsAqtqAE6y8uY9OZDr1yJ jjbiutFLRtNQ0YzhxMYt16E693V6h8vVQehxyCtXR9rKS9nVMS2NRhTLmtYPeTG4E1Pe MC1H2yfMvNXcTjuqeXeuGxp9mx4q634y316KX5WIVlilP4aSZfk5tYZ1WRCBJEleiyDd YV5VSuHtG7XelCw2YnzIp4/LETkSRi0zF6Ik1rG4VD6BvXDdg1kmbHR5IxZLQkm9ZUsl 913g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GQ5fwHhf; 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 y78si418105ybe.61.2020.06.02.18.30.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jun 2020 18:30:25 -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=GQ5fwHhf; 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]:38982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgIEa-0001u2-Qa for patch@linaro.org; Tue, 02 Jun 2020 21:30:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgHyq-00052e-Kl for qemu-devel@nongnu.org; Tue, 02 Jun 2020 21:14:08 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:40926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgHyp-0003gd-Ob for qemu-devel@nongnu.org; Tue, 02 Jun 2020 21:14:08 -0400 Received: by mail-pf1-x430.google.com with SMTP id v2so415519pfv.7 for ; Tue, 02 Jun 2020 18:14:07 -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=L5HmehI0u6Wl5CalJmhYTRnudOl8IyN54sr+tdgMFy8=; b=GQ5fwHhfRmrfSQOiJOp+xitMa1bz0gG0vGhe8roDv+urgOknORAf0CBlXKE2xDBN/2 ctgM53TJTuO+57u6u/KnPugD0jox3VSKKY798vuYy+GKSQz9lAM+d13vEba0ce1MXRaS L3mDKJezZ7ELO3jMVUC6jSU31XSO9edrSFAEzvwFczmAh1dRkCipTzPlnewuUbIN7rom 30RTmE3+U3198xpc5f+PSWwZrGltaJcBXvUEkFvwmOQRK1Dc2rqZB/s9NOM+zr+XwNNa x0CX/vcqmfs/Yj9IO4Md/AOjWWZ9vg1Z5Baa7gPxtbIVmnLh7HzmPcMsnGr8uIg2KzYn +51Q== 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=L5HmehI0u6Wl5CalJmhYTRnudOl8IyN54sr+tdgMFy8=; b=GOxZ/6rAmb4M2GEw65aRPFY0ItOyvgoQtYfJ4mCuBdDvb8+F3yrAkpV5dcFsNIw2ou s0BUQJM4r8etzXeu75lgDYEu161dSfh2PyGDPCy/1Wpea/7Wvj5OvZF8VRPRB4vb/pvF CoPKLP/ttfu0hg+RhSMKsFekKHT+LfKlt+QWXf9JK7ShoXV5MIuVx2/ZeRU+t1pn3Mq8 LRwcTrrY0Uqq4Ry5e+N/QDu4c8f0rW/4ZU2ZcZK4zkZBV6kzAuzKa58iaXhyfusO0naV cVQBTlCOaaZtiCmn4dZckk1XSTOtnI6GgelDkqQYmRDpJaBUdw4JW9lu7Kag1N9eKAva tlmw== X-Gm-Message-State: AOAM533+aW23XH6dMZ8vlhiP3TMi512s747d2MYcVOSDUM67mvABmNAv k2wyZi4C8AHnssPQGTF9pHvGNi+IpJ0= X-Received: by 2002:a62:7707:: with SMTP id s7mr28622157pfc.90.1591146845950; Tue, 02 Jun 2020 18:14:05 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id 3sm290067pfe.85.2020.06.02.18.14.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2020 18:14:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 36/42] target/arm: Complete TBI clearing for user-only for SVE Date: Tue, 2 Jun 2020 18:13:11 -0700 Message-Id: <20200603011317.473934-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200603011317.473934-1-richard.henderson@linaro.org> References: <20200603011317.473934-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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_PASS=-0.001, URIBL_BLOCKED=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, 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 diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 2d2aa14b43..460a3e5937 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;