From patchwork Sat Jan 16 05:01:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 59903 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp932286lbb; Fri, 15 Jan 2016 21:08:46 -0800 (PST) X-Received: by 10.28.158.194 with SMTP id h185mr2224805wme.48.1452920926514; Fri, 15 Jan 2016 21:08:46 -0800 (PST) Return-Path: Received: from lists.xen.org (lists.xenproject.org. [50.57.142.19]) by mx.google.com with ESMTPS id pd7si22513941wjb.47.2016.01.15.21.08.45 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 15 Jan 2016 21:08:46 -0800 (PST) Received-SPF: neutral (google.com: 50.57.142.19 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=50.57.142.19; Authentication-Results: mx.google.com; spf=neutral (google.com: 50.57.142.19 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aKJ5A-0007b2-VK; Sat, 16 Jan 2016 05:07:24 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aKJ58-0007aZ-UZ for xen-devel@lists.xen.org; Sat, 16 Jan 2016 05:07:23 +0000 Received: from [193.109.254.147] by server-6.bemta-14.messagelabs.com id B2/8B-16618-A00D9965; Sat, 16 Jan 2016 05:07:22 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1452920833!17261256!1 X-Originating-IP: [58.251.152.64] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 65534 invoked from network); 16 Jan 2016 05:07:16 -0000 Received: from szxga01-in.huawei.com (HELO szxga01-in.huawei.com) (58.251.152.64) by server-5.tower-27.messagelabs.com with SMTP; 16 Jan 2016 05:07:16 -0000 Received: from 172.24.1.51 (EHLO szxeml430-hub.china.huawei.com) ([172.24.1.51]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DDC66674; Sat, 16 Jan 2016 13:02:24 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml430-hub.china.huawei.com (10.82.67.185) with Microsoft SMTP Server id 14.3.235.1; Sat, 16 Jan 2016 13:02:17 +0800 From: Shannon Zhao To: Date: Sat, 16 Jan 2016 13:01:12 +0800 Message-ID: <1452920477-13916-6-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1452920477-13916-1-git-send-email-zhaoshenglong@huawei.com> References: <1452920477-13916-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.5699CEE1.006F, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: e8b10dc10b20aa19044606a55b472e5f Cc: ian.campbell@citrix.com, peter.huangpeng@huawei.com, julien.grall@citrix.com, stefano.stabellini@citrix.com, shannon.zhao@linaro.org, Jan Beulich Subject: [Xen-devel] [PATCH v4 05/10] acpi: Refactor acpi_os_map_memory to be architecturally independent X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org From: Shannon Zhao Current acpi_os_map_memory is specific to x86. Refactor it to be architecturally independent. Cc: Jan Beulich Signed-off-by: Shannon Zhao Acked-by: Stefano Stabellini --- xen/arch/x86/acpi/lib.c | 16 ++++++++++++++++ xen/drivers/acpi/osl.c | 12 +----------- xen/include/xen/acpi.h | 2 ++ 3 files changed, 19 insertions(+), 11 deletions(-) -- 2.0.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel diff --git a/xen/arch/x86/acpi/lib.c b/xen/arch/x86/acpi/lib.c index cc15ea3..1e2e124 100644 --- a/xen/arch/x86/acpi/lib.c +++ b/xen/arch/x86/acpi/lib.c @@ -33,6 +33,22 @@ 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 * +arch_acpi_os_map_memory(acpi_physical_address phys, acpi_size size) +{ + if (system_state >= SYS_STATE_active) { + mfn_t mfn = _mfn(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(&mfn, 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 ce15470..dc971af 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -86,17 +86,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) { - mfn_t mfn = _mfn(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(&mfn, PFN_UP(offs + size), 1, 1, - PAGE_HYPERVISOR_NOCACHE) + offs; - } - return __acpi_map_table(phys, size); + return arch_acpi_os_map_memory(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 65e53a6..9d90d6b 100644 --- a/xen/include/xen/acpi.h +++ b/xen/include/xen/acpi.h @@ -54,6 +54,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 * +arch_acpi_os_map_memory(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);