Received: by 10.213.65.68 with SMTP id h4csp889477imn; Tue, 27 Mar 2018 10:38:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+mTrju1fafpJd0ZlmVFecSq/YrewdNQCZRlQ12nRTW7aDkqtI3qzs4YzZ2eEvvUFG1kbVJ X-Received: by 10.101.99.149 with SMTP id h21mr146720pgv.345.1522172325925; Tue, 27 Mar 2018 10:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522172325; cv=none; d=google.com; s=arc-20160816; b=tbrBMPs05PnpbCH8oJQWRdeMK5wPLiOBP1SIXr+K6uE1WNb0Kl9rxaFX0wHTTtX4P7 EBHvPqN4L/FlL77Cc/B85KZy8ctgGWb9lvF0l2Y4Wk1alc3NRLK8iEcBtEtKknDeYa57 hrwAQ/0hP0ql9JylUm6U6JhoQFes7W34ByxMPOKdXSLfaeYjJHHyDHizVlke2GST4R6h xhstWm9piZU29FhtF/f2zCZkOdCiTI4hhdx2PcT7k1CxHmG7Fad/k95mKylkPtBKrWKs 0TRROplcrDMl9U8c3Pphuu2TGhrh5t/2HByhGcG7ZdW37+GU3TSfcrD+U8CpmLVSW4DM IT1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=q1Yt2jCKAceooj0URSO1juixpXM8C03svuGfmwLpMc4=; b=yd0WNl6ir2JGf9cgI/BRPXYKTohtkwpjZVvh75OrrK5wCgvBIgZSgU2xaE2QOqh4CN yhlEc9TAhfKqvg/O5uw74Aak8zIq6Ra4W0WWgoOJsuHQ+j0bEXzGj0zCdBJMRYv7nFuF EUy69spJUYTcOBr7/1u+oEPqBN6HkBmZTA1fp2WVJJrCI7k18d7IkXH6LxQO2rN4E7LN GbwctDS+8Ve1uYFA+CXKlEd1dKMJpZPtKHrMwg0sE94ZJmZipjzFdViPdNQ61/3iOMAa TKDvS/H6HlkC9nFaFOxPpBhBfUNLcpyVVXJ6+7e7RLO9kZLE37kabPSyusOjRid+lQLm iJrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10-v6si1643284plh.231.2018.03.27.10.38.31; Tue, 27 Mar 2018 10:38:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754576AbeC0RgF (ORCPT + 99 others); Tue, 27 Mar 2018 13:36:05 -0400 Received: from foss.arm.com ([217.140.101.70]:60818 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752060AbeC0RgD (ORCPT ); Tue, 27 Mar 2018 13:36:03 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 544EC1529; Tue, 27 Mar 2018 10:36:03 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 24B2A3F25D; Tue, 27 Mar 2018 10:36:03 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id EF5F51AE53E5; Tue, 27 Mar 2018 18:36:13 +0100 (BST) Date: Tue, 27 Mar 2018 18:36:13 +0100 From: Will Deacon To: Shanker Donthineni Cc: Robin Murphy , Philip Elcan , linux-arm-kernel@lists.infradead.org, Catalin Marinas , Mark Rutland , linux-kernel@vger.kernel.org, Thomas Speier Subject: Re: [PATCH V2] arm64: tlbflush: avoid writing RES0 bits Message-ID: <20180327173613.GI18435@arm.com> References: <1522120877-9136-1-git-send-email-pelcan@codeaurora.org> <985a0edd-e388-dade-8824-30cc58a236f3@arm.com> <56b560a5-6e57-8e01-32ca-9d3c95ccd2e5@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <56b560a5-6e57-8e01-32ca-9d3c95ccd2e5@codeaurora.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Shanker, On Tue, Mar 27, 2018 at 09:53:16AM -0500, Shanker Donthineni wrote: > On 03/27/2018 06:34 AM, Robin Murphy wrote: > > On 27/03/18 04:21, Philip Elcan wrote: > >> Several of the bits of the TLBI register operand are RES0 per the ARM > >> ARM, so TLBI operations should avoid writing non-zero values to these > >> bits. > >> > >> This patch adds a macro __TLBI_VADDR(addr, asid) that creates the > >> operand register in the correct format and honors the RES0 bits. > >> > >> Signed-off-by: Philip Elcan > >> --- > >> ? arch/arm64/include/asm/tlbflush.h | 23 ++++++++++++++++------- > >> ? 1 file changed, 16 insertions(+), 7 deletions(-) > >> > >> diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h > >> index 9e82dd7..b1205e9 100644 > >> --- a/arch/arm64/include/asm/tlbflush.h > >> +++ b/arch/arm64/include/asm/tlbflush.h > >> @@ -60,6 +60,15 @@ > >> ????????? __tlbi(op, (arg) | USER_ASID_FLAG);??????????????? \ > >> ? } while (0) > >> ? +/* This macro creates a properly formatted VA operand for the TLBI */ > >> +#define __TLBI_VADDR(addr, asid)??????????????? \ > >> +??? ({??????????????????????????? \ > >> +??????? unsigned long __ta = (addr) >> 12;??????? \ > >> +??????? __ta &= GENMASK_ULL(43, 0);??????????? \ > >> +??????? __ta |= (unsigned long)(asid) << 48;??????? \ > >> +??????? __ta;??????????????????????? \ > >> +??? }) > > > > I'd be inclined to make this a static inline function rather than a > > macro, since it doesn't need to do any wacky type-dodging, but either > > way the overall change now looks appropriate; > > > > Acked-by: Robin Murphy > > > > Tested-by: Shanker Donthineni [...] > >> @@ -154,8 +163,8 @@ static inline void __flush_tlb_range(struct vm_area_struct *vma, > >> ????????? return; > >> ????? } > >> ? -??? start = asid | (start >> 12); > >> -??? end = asid | (end >> 12); > >> +??? start = __TLBI_VADDR(start, asid); > >> +??? end = __TLBI_VADDR(end, asid); Can you test this bit too, please? ;) Will