From patchwork Sun May 17 20:03:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 48628 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 08BC121411 for ; Sun, 17 May 2015 20:05:47 +0000 (UTC) Received: by lagr1 with SMTP id r1sf30593369lag.3 for ; Sun, 17 May 2015 13:05:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=tu9dGDVQ1xYt80MCmDGdj2AwFjYZUOdTVV7gsVSfFcY=; b=fBo/Er85aJxx09qBCQ7g2Zt3Wc8TN1hcqQu/8hJpT/OkqySTKFZDYlsvO3blJ9aD0i wbsuSEtv6nJKNTOxhteCGmCACkXdbbC8imMtwVh7b5823NPXBuw/APfJIlJ6kkNHiq5G E/x/LpWUVK+k9wXZjtGvC4sMr3z0OdcLK40P7YlqaSMt52h8UpLoUL83Ahmj0ak5KYI3 YOxJTVYZZTYvNNn3UGeMwjA1nsRHPEsYl0R4eUh5Wn0jgVjbKyonLtoXRc83LJM51lJ+ ZVeRaplhz2UdjjLnrQvHduWknxsK8H+PWrwtsvED7D8BhWA3aVRaZ7NyXoRuVd8OF6rS IEVg== X-Gm-Message-State: ALoCoQk4PSr+t4pHsa8NZesKjFi7n/wBo9zsFfPDd66jXjBgqQamKSCPdqqZPD3cAd13+afCqEdu X-Received: by 10.194.143.98 with SMTP id sd2mr15233210wjb.6.1431893145582; Sun, 17 May 2015 13:05:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.171 with SMTP id az11ls271485lab.107.gmail; Sun, 17 May 2015 13:05:45 -0700 (PDT) X-Received: by 10.152.23.38 with SMTP id j6mr14272246laf.47.1431893145276; Sun, 17 May 2015 13:05:45 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id jn4si5337654lbc.49.2015.05.17.13.05.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2015 13:05:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by lagr1 with SMTP id r1so109729537lag.0 for ; Sun, 17 May 2015 13:05:45 -0700 (PDT) X-Received: by 10.152.9.66 with SMTP id x2mr14802494laa.36.1431893144980; Sun, 17 May 2015 13:05:44 -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.112.108.230 with SMTP id hn6csp3507613lbb; Sun, 17 May 2015 13:05:44 -0700 (PDT) X-Received: by 10.52.251.107 with SMTP id zj11mr17619773vdc.96.1431893140486; Sun, 17 May 2015 13:05:40 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id r4si3787051vdr.91.2015.05.17.13.05.39 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 17 May 2015 13:05:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yu4nm-0001Mb-4k; Sun, 17 May 2015 20:04:46 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yu4nk-0001Lc-L2 for xen-devel@lists.xen.org; Sun, 17 May 2015 20:04:44 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id 37/7B-03730-B54F8555; Sun, 17 May 2015 20:04:43 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-10.tower-31.messagelabs.com!1431893081!11240119!1 X-Originating-IP: [209.85.220.50] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.15; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10947 invoked from network); 17 May 2015 20:04:42 -0000 Received: from mail-pa0-f50.google.com (HELO mail-pa0-f50.google.com) (209.85.220.50) by server-10.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 17 May 2015 20:04:42 -0000 Received: by padbw4 with SMTP id bw4so119758452pad.0 for ; Sun, 17 May 2015 13:04:41 -0700 (PDT) X-Received: by 10.66.233.132 with SMTP id tw4mr37875378pac.80.1431893081571; Sun, 17 May 2015 13:04:41 -0700 (PDT) Received: from localhost.localdomain ([117.247.24.139]) by mx.google.com with ESMTPSA id j9sm7838401pdm.53.2015.05.17.13.04.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 May 2015 13:04:40 -0700 (PDT) From: Parth Dixit To: xen-devel@lists.xen.org Date: Mon, 18 May 2015 01:33:32 +0530 Message-Id: <1431893048-5214-6-git-send-email-parth.dixit@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431893048-5214-1-git-send-email-parth.dixit@linaro.org> References: <1431893048-5214-1-git-send-email-parth.dixit@linaro.org> Cc: keir@xen.org, ian.campbell@citrix.com, andrew.cooper3@citrix.com, tim@xen.org, julien.grall@citrix.com, stefano.stabellini@citrix.com, jbeulich@suse.com, parth.dixit@linaro.org, christoffer.dall@linaro.org Subject: [Xen-devel] [PATCH v2 05/41] acpi : add helper function for mapping memory X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: parth.dixit@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.215.47 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-Archive: common acpi code for memory mapping is specific to x86. Add a new helper function for mapping memory based on architecture. Signed-off-by: Parth Dixit --- xen/arch/arm/Makefile | 1 + xen/arch/arm/acpi/Makefile | 1 + xen/arch/arm/acpi/lib.c | 8 ++++++++ xen/arch/x86/acpi/lib.c | 15 +++++++++++++++ xen/drivers/acpi/osl.c | 11 +---------- xen/include/xen/acpi.h | 2 ++ 6 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 xen/arch/arm/acpi/Makefile create mode 100644 xen/arch/arm/acpi/lib.c diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 935999e..096e9ef 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -2,6 +2,7 @@ subdir-$(arm32) += arm32 subdir-$(arm64) += arm64 subdir-y += platforms subdir-$(arm64) += efi +subdir-$(HAS_ACPI) += acpi obj-$(EARLY_PRINTK) += early_printk.o obj-y += cpu.o diff --git a/xen/arch/arm/acpi/Makefile b/xen/arch/arm/acpi/Makefile new file mode 100644 index 0000000..b5be22d --- /dev/null +++ b/xen/arch/arm/acpi/Makefile @@ -0,0 +1 @@ +obj-y += lib.o diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c new file mode 100644 index 0000000..650beed --- /dev/null +++ b/xen/arch/arm/acpi/lib.c @@ -0,0 +1,8 @@ +#include +#include + +void __iomem * +acpi_os_map_iomem(acpi_physical_address phys, acpi_size size) +{ + return __va(phys); +} diff --git a/xen/arch/x86/acpi/lib.c b/xen/arch/x86/acpi/lib.c index 1f98c31..cb1b98e 100644 --- a/xen/arch/x86/acpi/lib.c +++ b/xen/arch/x86/acpi/lib.c @@ -34,6 +34,21 @@ u8 __read_mostly acpi_disable_value; u32 __read_mostly x86_acpiid_to_apicid[MAX_MADT_ENTRIES] = {[0 ... MAX_MADT_ENTRIES - 1] = BAD_APICID }; +void __iomem * +acpi_os_map_iomem(acpi_physical_address phys, acpi_size size) +{ + if (system_state >= SYS_STATE_active) { + unsigned long pfn = PFN_DOWN(phys); + unsigned int offs = phys & (PAGE_SIZE - 1); + + /* The low first Mb is always mapped. */ + if ( !((phys + size - 1) >> 20) ) + return __va(phys); + return __vmap(&pfn, PFN_UP(offs + size), 1, 1, PAGE_HYPERVISOR_NOCACHE) + offs; + } + return __acpi_map_table(phys, size); +} + /* * Important Safety Note: The fixed ACPI page numbers are *subtracted* * from the fixed base. That's why we start at FIX_ACPI_END and diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c index 93c983c..958caae 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -87,16 +87,7 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) void __iomem * acpi_os_map_memory(acpi_physical_address phys, acpi_size size) { - if (system_state >= SYS_STATE_active) { - unsigned long pfn = PFN_DOWN(phys); - unsigned int offs = phys & (PAGE_SIZE - 1); - - /* The low first Mb is always mapped. */ - if ( !((phys + size - 1) >> 20) ) - return __va(phys); - return __vmap(&pfn, PFN_UP(offs + size), 1, 1, PAGE_HYPERVISOR_NOCACHE) + offs; - } - return __acpi_map_table(phys, size); + return acpi_os_map_iomem(phys, size); } void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h index 3aeba4a..afe2dca 100644 --- a/xen/include/xen/acpi.h +++ b/xen/include/xen/acpi.h @@ -55,6 +55,8 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table); typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); +void __iomem * +acpi_os_map_iomem(acpi_physical_address phys, acpi_size size); unsigned int acpi_get_processor_id (unsigned int cpu); char * __acpi_map_table (paddr_t phys_addr, unsigned long size); int acpi_boot_init (void);