From patchwork Tue Jul 22 09:20:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 4600351 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7142E9F520 for ; Tue, 22 Jul 2014 09:21:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 87A042015A for ; Tue, 22 Jul 2014 09:21:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A0F2420145 for ; Tue, 22 Jul 2014 09:21:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753661AbaGVJUq (ORCPT ); Tue, 22 Jul 2014 05:20:46 -0400 Received: from mail-we0-f176.google.com ([74.125.82.176]:57130 "EHLO mail-we0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754212AbaGVJUo (ORCPT ); Tue, 22 Jul 2014 05:20:44 -0400 Received: by mail-we0-f176.google.com with SMTP id q58so8797944wes.7 for ; Tue, 22 Jul 2014 02:20:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yDz8KjFPifgqkecag/3xZmcQcAySc0mxLKfopURjQiI=; b=kYy4rds5p+T/yPp5W/6bYdvQu+zoL2BOsYRf+VN/FpF1DDDstMjJ/++5L5MiSMfRxO JKsqDnpDIvKjiss7rhOQb1nsaXP8kq7hI3Yuc6C9ifKP8mYXWJfVjJv2bc44hjtK6apv mBCugFUYTHGtq4N3oyA8XVLdPPtvFDvilg/lL5hzwkxCmMMuOXHqbiYAKfaZqZ3m25/y 3+iJNZYTgHQPnahCcUDLsHUQcfIgKWn+O5VuBrxorOwz5YOY+B7V/rZ91N51XY7LiY0P kQrqyntkx1f3r2mreOskD/ktLWyVrtwqYFHrl2uXxTQMz9T2Ql8H4Zx3abq3aFujUeGU 8zWw== X-Gm-Message-State: ALoCoQlxD1WvsV0Jjm6ZEZZqEhNhbU9qdXxOjkSgLCI6C/HK0fIk0ffiDq5iBUtDkN4/KAajTot6 X-Received: by 10.180.73.109 with SMTP id k13mr12618834wiv.11.1406020842009; Tue, 22 Jul 2014 02:20:42 -0700 (PDT) Received: from tn-HP-4.semihalf.com ([80.82.22.190]) by mx.google.com with ESMTPSA id h3sm44151472wjn.10.2014.07.22.02.20.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Jul 2014 02:20:41 -0700 (PDT) From: Tomasz Nowicki To: rjw@rjwysocki.net, lenb@kernel.org, tony.luck@intel.com, bp@alien8.de, m.chehab@samsung.com, bp@suse.de, rric@kernel.org Cc: linux-edac@vger.kernel.org, x86@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Tomasz Nowicki Subject: [PATCH v5 3/3] acpi, apei, ghes: Factor out ioremap virtual memory for IRQ and NMI context. Date: Tue, 22 Jul 2014 11:20:13 +0200 Message-Id: <1406020813-9176-4-git-send-email-tomasz.nowicki@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1406020813-9176-1-git-send-email-tomasz.nowicki@linaro.org> References: <1406020813-9176-1-git-send-email-tomasz.nowicki@linaro.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP GHES currently maps two pages with atomic_ioremap. From now on, NMI is architectural depended so there is no need to allocate an NMI page for platforms without NMI support. To make it possible to not use a second page, swap the existing page order so that the IRQ context page is first, and the optional NMI context page is second. Then, use HAVE_ACPI_APEI_NMI to decide how many pages are to be allocated. Acked-by: Borislav Petkov Signed-off-by: Tomasz Nowicki --- arch/x86/kernel/acpi/apei.c | 6 ++++++ drivers/acpi/apei/ghes.c | 18 +++++++++++------- include/acpi/apei.h | 1 + 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/acpi/apei.c b/arch/x86/kernel/acpi/apei.c index 12b13de..c280df6 100644 --- a/arch/x86/kernel/acpi/apei.c +++ b/arch/x86/kernel/acpi/apei.c @@ -15,6 +15,7 @@ #include #include +#include int arch_apei_enable_cmcff(struct acpi_hest_header *hest_hdr, void *data) { @@ -54,3 +55,8 @@ void arch_apei_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) apei_mce_report_mem_error(sev, mem_err); #endif } + +void arch_apei_flush_tlb_one(unsigned long addr) +{ + __flush_tlb_one(addr); +} diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 7fcf4d7..e05d84e7 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -105,12 +105,16 @@ static DEFINE_MUTEX(ghes_list_mutex); */ /* - * Two virtual pages are used, one for NMI context, the other for - * IRQ/PROCESS context + * Two virtual pages are used, one for IRQ/PROCESS context, the other for + * NMI context (optionally). */ -#define GHES_IOREMAP_PAGES 2 -#define GHES_IOREMAP_NMI_PAGE(base) (base) -#define GHES_IOREMAP_IRQ_PAGE(base) ((base) + PAGE_SIZE) +#ifdef CONFIG_HAVE_ACPI_APEI_NMI +#define GHES_IOREMAP_PAGES 2 +#else +#define GHES_IOREMAP_PAGES 1 +#endif +#define GHES_IOREMAP_IRQ_PAGE(base) (base) +#define GHES_IOREMAP_NMI_PAGE(base) ((base) + PAGE_SIZE) /* virtual memory area for atomic ioremap */ static struct vm_struct *ghes_ioremap_area; @@ -173,7 +177,7 @@ static void ghes_iounmap_nmi(void __iomem *vaddr_ptr) BUG_ON(vaddr != (unsigned long)GHES_IOREMAP_NMI_PAGE(base)); unmap_kernel_range_noflush(vaddr, PAGE_SIZE); - __flush_tlb_one(vaddr); + arch_apei_flush_tlb_one(vaddr); } static void ghes_iounmap_irq(void __iomem *vaddr_ptr) @@ -183,7 +187,7 @@ static void ghes_iounmap_irq(void __iomem *vaddr_ptr) BUG_ON(vaddr != (unsigned long)GHES_IOREMAP_IRQ_PAGE(base)); unmap_kernel_range_noflush(vaddr, PAGE_SIZE); - __flush_tlb_one(vaddr); + arch_apei_flush_tlb_one(vaddr); } static int ghes_estatus_pool_init(void) diff --git a/include/acpi/apei.h b/include/acpi/apei.h index 8a23c95..76284bb 100644 --- a/include/acpi/apei.h +++ b/include/acpi/apei.h @@ -44,6 +44,7 @@ int erst_clear(u64 record_id); int arch_apei_enable_cmcff(struct acpi_hest_header *hest_hdr, void *data); void arch_apei_report_mem_error(int sev, struct cper_sec_mem_err *mem_err); +void arch_apei_flush_tlb_one(unsigned long addr); #endif #endif