From patchwork Mon May 4 21:02:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jonathan (Zhixiong) Zhang" X-Patchwork-Id: 6330031 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4F0319F373 for ; Mon, 4 May 2015 21:03:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7AB1F20274 for ; Mon, 4 May 2015 21:03:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7BA66202E6 for ; Mon, 4 May 2015 21:03:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752454AbbEDVDL (ORCPT ); Mon, 4 May 2015 17:03:11 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:51653 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752680AbbEDVDE (ORCPT ); Mon, 4 May 2015 17:03:04 -0400 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id E7263140904; Mon, 4 May 2015 21:03:03 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id D2AF7140907; Mon, 4 May 2015 21:03:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from zjzhang-lab.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: zjzhang@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1E008140904; Mon, 4 May 2015 21:03:03 +0000 (UTC) From: "Jonathan (Zhixiong) Zhang" To: rjw@rjwysocki.net, lenb@kernel.org, ying.huang@intel.com Cc: "Jonathan (Zhixiong) Zhang" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linaro-acpi@lists.linaro.org Subject: [PATCH 2/2] acpi, apei: use EFI memmap to map GHES memory Date: Mon, 4 May 2015 14:02:15 -0700 Message-Id: <1430773335-22897-3-git-send-email-zjzhang@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1430773335-22897-1-git-send-email-zjzhang@codeaurora.org> References: <1430773335-22897-1-git-send-email-zjzhang@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jonathan (Zhixiong) Zhang" With ACPI APEI firmware first handling, generic hardware error record is updated by firmware in GHES memory region. After firmware updated GHES memory region, Linux reads stale data from cache. GHES memory region should be mapped with cache attributes defined by EFI memory map when applicable. If firmware updates DDR directly, EFI memory map would have GHES memory region defined as uncached; If firmware updates cache, EFI memory map would have GHES memory region defined as cached. When EFI is configued, map IRQ page using efi_remap() provided by EFI subsystem. Signed-off-by: Jonathan (Zhixiong) Zhang --- drivers/acpi/apei/ghes.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index e82d0976a5d0..56875ca76aa7 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -159,6 +160,7 @@ static void __iomem *ghes_ioremap_pfn_nmi(u64 pfn) return (void __iomem *)vaddr; } +#ifndef CONFIG_EFI static void __iomem *ghes_ioremap_pfn_irq(u64 pfn) { unsigned long vaddr; @@ -169,6 +171,7 @@ static void __iomem *ghes_ioremap_pfn_irq(u64 pfn) return (void __iomem *)vaddr; } +#endif static void ghes_iounmap_nmi(void __iomem *vaddr_ptr) { @@ -180,6 +183,7 @@ static void ghes_iounmap_nmi(void __iomem *vaddr_ptr) arch_apei_flush_tlb_one(vaddr); } +#ifndef CONFIG_EFI static void ghes_iounmap_irq(void __iomem *vaddr_ptr) { unsigned long vaddr = (unsigned long __force)vaddr_ptr; @@ -189,6 +193,7 @@ static void ghes_iounmap_irq(void __iomem *vaddr_ptr) unmap_kernel_range_noflush(vaddr, PAGE_SIZE); arch_apei_flush_tlb_one(vaddr); } +#endif static int ghes_estatus_pool_init(void) { @@ -309,7 +314,11 @@ static void ghes_copy_tofrom_phys(void *buffer, u64 paddr, u32 len, vaddr = ghes_ioremap_pfn_nmi(paddr >> PAGE_SHIFT); } else { spin_lock_irqsave(&ghes_ioremap_lock_irq, flags); +#ifdef CONFIG_EFI + vaddr = efi_remap(paddr & PAGE_MASK, PAGE_SIZE); +#else vaddr = ghes_ioremap_pfn_irq(paddr >> PAGE_SHIFT); +#endif } trunk = PAGE_SIZE - offset; trunk = min(trunk, len); @@ -324,7 +333,11 @@ static void ghes_copy_tofrom_phys(void *buffer, u64 paddr, u32 len, ghes_iounmap_nmi(vaddr); raw_spin_unlock(&ghes_ioremap_lock_nmi); } else { +#ifdef CONFIG_EFI + iounmap(vaddr); +#else ghes_iounmap_irq(vaddr); +#endif spin_unlock_irqrestore(&ghes_ioremap_lock_irq, flags); } }