Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946101AbbHGSQK (ORCPT ); Fri, 7 Aug 2015 14:16:10 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:51325 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1945898AbbHGSQI (ORCPT ); Fri, 7 Aug 2015 14:16:08 -0400 Subject: Re: [PATCH V10 4/5] arm64: apei: implement arch_apei_get_mem_attributes() To: Ard Biesheuvel , Matt Fleming References: <1438868434-28736-1-git-send-email-zjzhang@codeaurora.org> <1438868434-28736-5-git-send-email-zjzhang@codeaurora.org> <20150807093750.GB2625@codeblueprint.co.uk> Cc: Catalin Marinas , Will Deacon , Fu Wei , Al Stone , Borislav Petkov , Matt Fleming , "Rafael J. Wysocki" , Hanjun Guo , Leif Lindholm , "linux-kernel@vger.kernel.org" , Linaro ACPI Mailman List , Timur Tabi From: "Zhang, Jonathan Zhixiong" Message-ID: <55C4F5E3.30704@codeaurora.org> Date: Fri, 7 Aug 2015 11:16:03 -0700 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3149 Lines: 72 On 8/7/2015 2:50 AM, Ard Biesheuvel wrote: > On 7 August 2015 at 11:37, Matt Fleming wrote: >> On Fri, 07 Aug, at 11:00:17AM, Ard Biesheuvel wrote: >>> >>> The EFI memory types are not exclusive, and so many regions will have >>> all of the above set. The UEFI spec does not define how to interpret >>> these superimposed attributes, it is up to the OS to decide on a >>> consistent approach. >>> >>> For instance, this region (captured from a arm64 boot log with >>> uefi_debug set on the command line) >>> >>> [Runtime Data |RUN| | | | |WB|WT|WC|UC] >>> >>> would be mapped uncached when following the above logic, while it >>> makes more sense to map using PAGE_KERNEL in this case. >> >> Urgh... good point Ard. Right now this is limited to the GHES driver, so >> it's unclear whether this patch is buggy in practice or not. >> >> Does it *ever* make sense to map a region as cacheable (WB/WT/WC) on >> arm64 for the APEI/GHES case? Does the firmware handle the necessary >> cache flushing? >> > > No it does not. Currently, we only consider EFI_MEMORY_WB when > discovering system RAM from the UEFI memory map, so the direct linear > mapping should have a hole where the APEI/GHES regions lives if it > doesn't have the WB attribute set. This means we can map it WT/WC/UC > without violating architectural rules regarding mismatches attributes, > but it requires an explicit ioremap() On some (future) arm64 platforms, APEI/GHES region may have full coherent access by platform. In such case, the APEI/GHES region have the same memory attributes as the rest of system RAM, such region do not need to be advised by UEFI as separate entry, but as part of system RAM memory region. That being said, for arm64 platforms that do not have WB capability for APEI/GHES region, such region should be mapped accordingly. > >>> From the spec: >>> >>> """ >>> EFI_MEMORY_UC: The memory region supports being configured as not cacheable. >>> EFI_MEMORY_WC: The memory region supports being configured as write combining. >>> EFI_MEMORY_WT: The memory region supports being configured as >>> cacheable with a “write through” policy. Writes that hit in the cache >>> will also be written to main memory. >>> EFI_MEMORY_WB: The memory region supports being configured as >>> cacheable with a “write back” policy. Reads and writes that hit in the >>> cache do not propagate to main memory. Dirty data is written back to >>> main memory when a new cache line is allocated. >>> """ >> >> Jonathan, can you please provide the EFI memory map region attributes >> for the GHES region that requires this series? [Reserved | | | | | | | | |UC] >> >> -- >> Matt Fleming, Intel Open Source Technology Center -- Jonathan (Zhixiong) Zhang The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/