From mboxrd@z Thu Jan 1 00:00:00 1970 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=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 0B18CC433ED for ; Thu, 6 May 2021 10:23:06 +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 6A8DC6121F for ; Thu, 6 May 2021 10:23:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A8DC6121F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com 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:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Acuf4EQeyONmBkZVA/vQJ6rvllsYq+TpMVbs0qf6C58=; b=QlwcX3RaHzOUt9+YwbN453Y3o EQrOMAJLyrGJv6AImcS2tOY7MEo/LrkU0rV3rv3Nn4ccaBDzO/ky+sIdIwaGAq0316FEnpUS6pAp/ 4A07bqmcFX4ebjUr5IlciMfD5A7l14V8RfYRlcaOEGtFQgacipZ43h3ZLjgRlproWNVxp2YjGarTp 4BKHhl7NfLtW9avnl9WFrzZk8i/k4BVuQIMmGOSumZzsUdO8FcJvsUCwSMktlzhXYM1Uv81FWYC8U GmV3FliDu3DDQIgMXaTcm2A7jGO4R0IYjd9MNCBkY8/2vaifQJez8djQLh3/ZCn3md8xlbKfsiUal eW09fL/yg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leb7v-003wtP-Cd; Thu, 06 May 2021 10:21:03 +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 1leb7p-003wsF-NZ for linux-arm-kernel@desiato.infradead.org; Thu, 06 May 2021 10:20:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=WfvBfPzxSDyRBRnIxZIFsM8zJNBuuO5L6EQxoCOikzg=; b=HrK+A/XZ9TGiZsY+AXwdvlda4L k8qQ4pXAjY1xEBRGScgT9rUN5eXxQD5JV309cIhvEh70WDCrVBwwqgFLmCjS0qdSE04y3rDCoLo7y 63qU0H9hl7njbWuwSly48Q4Fu6JVrKrbD9qCDvXIK5r9tSDmekMQTKPIi51Z+0h3RZnu7ueNQKPp9 KSaitJOsTcnsPDAysh6kGfMjyJqhWQYx1tShD0aDs21KiADbBGrp1oLOi8oi38wX2ezU9FQLJBHmC +569pHRHCHR6/fhniHOCKyCPP3BnyyyTYhlYbbyzGPDtQ5J1UDJ2FXe3MQzjYu/oBYSxrSTZb15uM 6+KAnv9w==; Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leb7m-005wl1-I7 for linux-arm-kernel@lists.infradead.org; Thu, 06 May 2021 10:20:56 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AB0F5D6E; Thu, 6 May 2021 03:20:52 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.31.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8A0503F73B; Thu, 6 May 2021 03:20:51 -0700 (PDT) Date: Thu, 6 May 2021 11:20:45 +0100 From: Mark Rutland To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, Christoph Hellwig , Catalin Marinas , Ard Biesheuvel , Lorenzo Pieralisi Subject: Re: [PATCH 2/3] arm64: acpi: Map EFI_MEMORY_WT memory as Normal-NC Message-ID: <20210506102009.GA32366@C02TD0UTHF1T.local> References: <20210506095034.15246-1-will@kernel.org> <20210506095034.15246-3-will@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210506095034.15246-3-will@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210506_032054_735040_E581E98D X-CRM114-Status: GOOD ( 23.28 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, May 06, 2021 at 10:50:33AM +0100, Will Deacon wrote: > 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. The UEFI spec explicitly defines EFI_MEMORY_WT as Normal Outer-WT Inner-WT (and even explicitly specifies the MAIR.Attr value). In the UEFI 2.9 spec, see section 2.3.6.1 "Memory types", Table 2-5 "Map: EFI Cacheability Attributes to AArch64 Memory Types". The UEFI 2.9 spec can be found at: https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf Given that is specified explicitly, and given that we don't know how future CPUs will treat this equivalently, I don't think this change is architecturally sound and I don't think there's wiggle-room to read the spec as permitting this. Thanks, Mark. > > Cc: Ard Biesheuvel > Cc: Lorenzo Pieralisi > Cc: Christoph Hellwig > Signed-off-by: Will Deacon > --- > 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); > } > } > -- > 2.31.1.607.g51e8a6a459-goog > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel