From patchwork Thu Aug 30 16:15:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 145547 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp92100ljw; Thu, 30 Aug 2018 09:16:26 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZvdr9rGMDipWLIXQA4a+wLRAOJOb/QDl3YDkFbWSK2yxBidEW48znpjwhA2J7twSyH/oxa X-Received: by 2002:a63:1413:: with SMTP id u19-v6mr10431222pgl.247.1535645786234; Thu, 30 Aug 2018 09:16:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535645786; cv=none; d=google.com; s=arc-20160816; b=Eq/RijMchlRN0kuG1nDBmVcwLIuXbhZN6Q9HLHwEhdLFJ5gHLKTFpmGzSN6ceSJOXy 8Tw4EE8vnv25STsiK87JEdUeFWnzMkp70ngQ7++nYaEWR5FybBT2g485XLcHdZtOFXF2 MT4+695tIVoOFbMl9ZDcLLvtMDWQe0Z7aGxKwa6+ZGwcGEF6worO18i1mmvkiHklUibz sswkkjB5ENIhrJe40oL3FNccz4vLHMhWTathpcl+fAOnlot5Mnq7HCr+wpGhOGXDGBc3 ANeeDwvjcbW4CVk8PiiQsRqpCM6I+xZCBbpR4iGkh+OfGXp7QG5fMLcj8BfGGH7VEG9g ZAYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=mgLzZPBJn+RP+iAVaiUfifPZNPKh2V3/3J8/kCSjBtc=; b=qphlcKsbEMafZb6CIDsOCB0DHMkqxbLd3a08gfTj7MvRjbRyAX/Tb0EVyGMZQeD96h 3nGI7ApjfpCMNu8TqfIypJY5hHV+Ujl6xlxEqHbBWoUbccZf1s51D5l92A5xcEnanYxH Z/O9wnOe6wCWFj/eN1AbosTAqvXKuAuiM6gKHADWRgm4CFBgyVP51/KKZ4bVaW2ZrzTu CXYeiEfzvNI/PYpMcEXfGjd9gOHMDu5t7ORulmTKBWzFaH4UxlihTw4HeB3+472EQFAt mzXkgUQ4fkEFZ9Obto6r6AtbIpNdbjJEgBOccVaOb/WVKYjA217htE9HJemVlvUtMN2l J2Qw== 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 t7-v6si7273901pgh.307.2018.08.30.09.16.25; Thu, 30 Aug 2018 09:16:26 -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 S1727610AbeH3USm (ORCPT + 32 others); Thu, 30 Aug 2018 16:18:42 -0400 Received: from foss.arm.com ([217.140.101.70]:44822 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726592AbeH3USl (ORCPT ); Thu, 30 Aug 2018 16:18:41 -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 2D6701684; Thu, 30 Aug 2018 09:15:49 -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 F34253F819; Thu, 30 Aug 2018 09:15:48 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 3C3B11AE36A1; Thu, 30 Aug 2018 17:16:01 +0100 (BST) From: Will Deacon To: linux-kernel@vger.kernel.org Cc: peterz@infradead.org, benh@au1.ibm.com, torvalds@linux-foundation.org, npiggin@gmail.com, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, Will Deacon Subject: [PATCH 03/12] arm64: pgtable: Implement p[mu]d_valid() and check in set_p[mu]d() Date: Thu, 30 Aug 2018 17:15:37 +0100 Message-Id: <1535645747-9823-4-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1535645747-9823-1-git-send-email-will.deacon@arm.com> References: <1535645747-9823-1-git-send-email-will.deacon@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that our walk-cache invalidation routines imply a DSB before the invalidation, we no longer need one when we are clearing an entry during unmap. Signed-off-by: Will Deacon --- arch/arm64/include/asm/pgtable.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.1.4 diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 1bdeca8918a6..2ab2031b778c 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -360,6 +360,7 @@ static inline int pmd_protnone(pmd_t pmd) #define pmd_present(pmd) pte_present(pmd_pte(pmd)) #define pmd_dirty(pmd) pte_dirty(pmd_pte(pmd)) #define pmd_young(pmd) pte_young(pmd_pte(pmd)) +#define pmd_valid(pmd) pte_valid(pmd_pte(pmd)) #define pmd_wrprotect(pmd) pte_pmd(pte_wrprotect(pmd_pte(pmd))) #define pmd_mkold(pmd) pte_pmd(pte_mkold(pmd_pte(pmd))) #define pmd_mkwrite(pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd))) @@ -431,7 +432,9 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, static inline void set_pmd(pmd_t *pmdp, pmd_t pmd) { WRITE_ONCE(*pmdp, pmd); - dsb(ishst); + + if (pmd_valid(pmd)) + dsb(ishst); } static inline void pmd_clear(pmd_t *pmdp) @@ -477,11 +480,14 @@ static inline phys_addr_t pmd_page_paddr(pmd_t pmd) #define pud_none(pud) (!pud_val(pud)) #define pud_bad(pud) (!(pud_val(pud) & PUD_TABLE_BIT)) #define pud_present(pud) pte_present(pud_pte(pud)) +#define pud_valid(pud) pte_valid(pud_pte(pud)) static inline void set_pud(pud_t *pudp, pud_t pud) { WRITE_ONCE(*pudp, pud); - dsb(ishst); + + if (pud_valid(pud)) + dsb(ishst); } static inline void pud_clear(pud_t *pudp)