Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754197AbbFATNH (ORCPT ); Mon, 1 Jun 2015 15:13:07 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38872 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932130AbbFATMn (ORCPT ); Mon, 1 Jun 2015 15:12:43 -0400 From: "Jonathan (Zhixiong) Zhang" To: Matt Fleming , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, leif.lindholm@linaro.org, al.stone@linaro.org, fu.wei@linaro.org Cc: "Jonathan (Zhixiong) Zhang" , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linaro-acpi@lists.linaro.org, vgandhi@codeaurora.org Subject: [PATCH V2 2/3] efi: add efi_remap() Date: Mon, 1 Jun 2015 12:12:19 -0700 Message-Id: <1433185940-24770-3-git-send-email-zjzhang@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1433185940-24770-1-git-send-email-zjzhang@codeaurora.org> References: <1433185940-24770-1-git-send-email-zjzhang@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1936 Lines: 53 From: "Jonathan (Zhixiong) Zhang" If it is a EFI system, if EFI memmap is enabled and if a memory region has attribute of EFI_MEMORY_UC, map it as uncached. On x86, EFI memmap is unmapped in efi_free_boot_services(), before kernel finishes booting. So when efi_remap() is called during runtime on x86, it maps the region as cached. Signed-off-by: Jonathan (Zhixiong) Zhang --- drivers/firmware/efi/efi.c | 9 +++++++++ include/linux/efi.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 86da85368778..5b42bb6d1fde 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -535,3 +535,12 @@ u64 efi_mem_attributes(unsigned long phys_addr) } return 0; } + +void __iomem *efi_remap(phys_addr_t phys_addr, size_t size) +{ + if (efi_enabled(EFI_MEMMAP) && + (efi_mem_attributes(phys_addr) & EFI_MEMORY_UC)) + return ioremap(phys_addr, size); + else + return ioremap_cache(phys_addr, size); +} diff --git a/include/linux/efi.h b/include/linux/efi.h index af5be0368dec..0a0aa25d44d7 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -888,6 +888,7 @@ extern void efi_get_time(struct timespec *now); extern void efi_reserve_boot_services(void); extern int efi_get_fdt_params(struct efi_fdt_params *params, int verbose); extern struct efi_memory_map memmap; +extern void __iomem *efi_remap(phys_addr_t phys_addr, size_t size); extern int efi_reboot_quirk_mode; extern bool efi_poweroff_required(void); -- 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/