From patchwork Thu May 6 09:50:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 12241941 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64DAAC433ED for ; Thu, 6 May 2021 09:53:21 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BDD1561157 for ; Thu, 6 May 2021 09:53:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BDD1561157 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WgERDS4iA2poEGwb8WYNsse4bAav44PuiXf2KJ0SDUk=; b=KPEinJOkERNiyvFWoA3mzOJJE mxxnck4QN2vuMHrJgPWfdUEQthwhlvZlq7RLhtMy1g7WvbBgo4YiQ7bpoGEyShdAkRh9lJTswPDAh HxC0643ew99zvemd/wUtER/srlqiqjDiWCDngC9IcxItAOGKr1K1yS7sOniYhikG/Ru1Gr52IRq4p YS0EnLHl4Z1liluhnQXuOsv3EieIWWnLGJWolYMWFcvJDdnjzbneUAf+rIf6wXxfTRc6JAnc8K3X1 wKw2vQTBkMEp0fqvlMbMUKrG74jVR5o5WtpLwKVZ5won1FRslWLxE39CYhx0kXIdNMJubJdlCo2s1 tMtu3mmpA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leafB-003sHM-UW; Thu, 06 May 2021 09:51:22 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leaef-003sDV-RM for linux-arm-kernel@desiato.infradead.org; Thu, 06 May 2021 09:50:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=zvRvJRudOKw2WbR2BqsR6VtnL0rudsdl2ceg0YRYIRo=; b=l3sajWQX/IWZKC1gXv31R9BFsb jlWkODQT6wuISvZQmnsH6KrsOn1vh34pP1BIVHrqM57d7/rcD35nzuo57bP9yxFNN2dcN9ySTP5U5 /frwE6YrHsSyYBaqin7Z4DiTfDE/o9z4OPOrN1esNYFBgQLV/2w3eaoZIK/0UHbWU3aGLbqEhkAbZ 8n7hxf/+PTBVAN8i3dZXzEG4LB2V/H1jTwvfSXN36JR7VVRD3t3FjxP0TM3WdLupYPzrR3/PTZiW9 jB7qzsnwXFG2QqU7LTQpN8utuOf6oYgonW2exT0NO75EECOQ3SkPXmKMvvXEMARu03jauxlvtYAqf Gs7Dwx7A==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leaed-005vUz-Ck for linux-arm-kernel@lists.infradead.org; Thu, 06 May 2021 09:50:48 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id B85D561207; Thu, 6 May 2021 09:50:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620294647; bh=t672HeVht4NsOOzQN9cFgQ+XFQAwfOyHO0c/I4CsQF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FWbOK0kH0k13ys8U3dQf+yWXja5M/1BLhQ9pg//PXiC9Ixh0bAjx6WFx0GQOMYOYC 93jUeE3DWR1G9Ble2nPSPdhQ5IAy45HouLPjp//YYVxu3zCep9pRTo3NeedJvwzWz9 1xrCIgpU2NUSHzQ82D4ho++sToxS7SJItEggia4GPqVIlnaST0z7cIocLGh1BZ88zG Xfj8uztUI4yKeUOl5W0k1kD8PDBSXShOtX8Y6xmWMZVs42UNfp/8tW59LvauftPbV+ lSScAeqtSn9MmmVRcqduRUSmOuc5tfi8J/r/NHRNlD289ilbsySxJ1wLTSF8rzu28l t7+3dnWB9INsw== From: Will Deacon To: linux-arm-kernel@lists.infradead.org Cc: Will Deacon , Christoph Hellwig , Catalin Marinas , Ard Biesheuvel , Lorenzo Pieralisi Subject: [PATCH 2/3] arm64: acpi: Map EFI_MEMORY_WT memory as Normal-NC Date: Thu, 6 May 2021 10:50:33 +0100 Message-Id: <20210506095034.15246-3-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210506095034.15246-1-will@kernel.org> References: <20210506095034.15246-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210506_025047_472670_7358C864 X-CRM114-Status: GOOD ( 13.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The only user we have of Normal Write-Through memory is in the ACPI code when mapping memory regions advertised as EFI_MEMORY_WT. Since most (all?) CPUs treat write-through as non-cacheable under the hood, don't bother with the extra memory type here and just treat EFI_MEMORY_WT the same way as EFI_MEMORY_WC by mapping it to the Normal-NC memory type instead. Cc: Ard Biesheuvel Cc: Lorenzo Pieralisi Cc: Christoph Hellwig Signed-off-by: Will Deacon Acked-by: Ard Biesheuvel Acked-by: Catalin Marinas --- arch/arm64/kernel/acpi.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c index cada0b816c8a..aca5ee2a9e64 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c @@ -246,7 +246,7 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr) * types" of UEFI 2.5 section 2.3.6.1, each EFI memory type is * mapped to a corresponding MAIR attribute encoding. * The EFI memory attribute advises all possible capabilities - * of a memory region. We use the most efficient capability. + * of a memory region. */ u64 attr; @@ -254,9 +254,7 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr) attr = efi_mem_attributes(addr); if (attr & EFI_MEMORY_WB) return PAGE_KERNEL; - if (attr & EFI_MEMORY_WT) - return __pgprot(PROT_NORMAL_WT); - if (attr & EFI_MEMORY_WC) + if (attr & (EFI_MEMORY_WC | EFI_MEMORY_WT)) return __pgprot(PROT_NORMAL_NC); return __pgprot(PROT_DEVICE_nGnRnE); } @@ -340,9 +338,7 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) default: if (region->attribute & EFI_MEMORY_WB) prot = PAGE_KERNEL; - else if (region->attribute & EFI_MEMORY_WT) - prot = __pgprot(PROT_NORMAL_WT); - else if (region->attribute & EFI_MEMORY_WC) + else if (region->attribute & (EFI_MEMORY_WC | EFI_MEMORY_WT)) prot = __pgprot(PROT_NORMAL_NC); } }