From patchwork Tue Jun 24 11:41:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 32409 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1846C201EF for ; Tue, 24 Jun 2014 11:42:00 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wm4sf803212obc.11 for ; Tue, 24 Jun 2014 04:41:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=9B3S0odo/Xmam5fHqgC8XUKobt/6QFCgP2fYoRv+KPo=; b=ESrFopfA2rLRVlELmbnQQ/7dP8MdOT73tusc42e2aq8lBbbW5fXf2Lxqt5jISHzDdv GHwlGI4MI+59gcaEDf28PqykNMlm2UBSwLic96KIxPoGa2+SbjhAJBI0rqjfMbmUpSw3 /s5txL8rE8ORWvIQiAJqdDYudIByJqFu3iSFvV4OaRszssCqXVSkh4XpIditVFm24IHk wYEHtGKLL8MiUaVdbOLp4j2KyOQj3fU0Xnhq3JbNt2796nWaoEcxmFqI7X8myaQ+kOuZ /zhFAgz8FQQkZ3/j6bCIodyUahQfoWHBWGAsUkXZZ63jUgh9HRixm27Mn6Ql+AJmYYXE hyHg== X-Gm-Message-State: ALoCoQnZTtZDCselofYrrEyBiIXXL6raOzKDT3Kzc48KKR9AKKIUCduHOMbRAflEMvtRAQtzWW5l X-Received: by 10.182.213.37 with SMTP id np5mr203203obc.36.1403610119689; Tue, 24 Jun 2014 04:41:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.49.1 with SMTP id p1ls2435248qga.97.gmail; Tue, 24 Jun 2014 04:41:59 -0700 (PDT) X-Received: by 10.52.163.208 with SMTP id yk16mr206653vdb.36.1403610119581; Tue, 24 Jun 2014 04:41:59 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id i8si15270vco.4.2014.06.24.04.41.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 24 Jun 2014 04:41:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id hy4so152350vcb.5 for ; Tue, 24 Jun 2014 04:41:59 -0700 (PDT) X-Received: by 10.220.164.198 with SMTP id f6mr154183vcy.51.1403610119461; Tue, 24 Jun 2014 04:41:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp203663vcb; Tue, 24 Jun 2014 04:41:59 -0700 (PDT) X-Received: by 10.67.16.67 with SMTP id fu3mr747634pad.38.1403610118356; Tue, 24 Jun 2014 04:41:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ko7si25881687pab.160.2014.06.24.04.41.57; Tue, 24 Jun 2014 04:41:57 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752787AbaFXLlq (ORCPT + 27 others); Tue, 24 Jun 2014 07:41:46 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:52376 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752564AbaFXLlm (ORCPT ); Tue, 24 Jun 2014 07:41:42 -0400 Received: by mail-wi0-f169.google.com with SMTP id hi2so5684061wib.2 for ; Tue, 24 Jun 2014 04:41:38 -0700 (PDT) X-Received: by 10.194.120.103 with SMTP id lb7mr699830wjb.40.1403610097408; Tue, 24 Jun 2014 04:41:37 -0700 (PDT) Received: from tn-HP3-PC.semihalf.com ([80.82.22.190]) by mx.google.com with ESMTPSA id hc4sm24898wjc.38.2014.06.24.04.41.35 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 24 Jun 2014 04:41:36 -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 Cc: linux-edac@vger.kernel.org, x86@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, rric@kernel.org, Tomasz Nowicki Subject: [PATCH v4 3/3] acpi, apei, ghes: Factor out ioremap virtual memory for IRQ and NMI context. Date: Tue, 24 Jun 2014 13:41:35 +0200 Message-Id: <1403610095-5354-4-git-send-email-tomasz.nowicki@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1403610095-5354-1-git-send-email-tomasz.nowicki@linaro.org> References: <1403610095-5354-1-git-send-email-tomasz.nowicki@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: tomasz.nowicki@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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. Signed-off-by: Tomasz Nowicki Acked-by: Borislav Petkov --- 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 d1fadf2..6d36f19 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