From patchwork Sat Jan 23 08:00:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8096051 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8AE0EBEEE5 for ; Sat, 23 Jan 2016 08:04:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C3C0F205DE for ; Sat, 23 Jan 2016 08:04:25 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F0ABC205B5 for ; Sat, 23 Jan 2016 08:04:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aMt8Z-00024u-R1; Sat, 23 Jan 2016 08:01:35 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aMt8Y-000245-1q for xen-devel@lists.xen.org; Sat, 23 Jan 2016 08:01:34 +0000 Received: from [85.158.137.68] by server-17.bemta-3.messagelabs.com id 67/2C-02940-D5333A65; Sat, 23 Jan 2016 08:01:33 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-16.tower-31.messagelabs.com!1453536086!10169083!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 31946 invoked from network); 23 Jan 2016 08:01:31 -0000 Received: from szxga01-in.huawei.com (HELO szxga01-in.huawei.com) (58.251.152.64) by server-16.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 23 Jan 2016 08:01:31 -0000 Received: from 172.24.1.49 (EHLO szxeml433-hub.china.huawei.com) ([172.24.1.49]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DDP78224; Sat, 23 Jan 2016 16:00:51 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml433-hub.china.huawei.com (10.82.67.210) with Microsoft SMTP Server id 14.3.235.1; Sat, 23 Jan 2016 16:00:39 +0800 From: Shannon Zhao To: Date: Sat, 23 Jan 2016 16:00:15 +0800 Message-ID: <1453536020-16196-4-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1453536020-16196-1-git-send-email-zhaoshenglong@huawei.com> References: <1453536020-16196-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.0A090202.56A33333.0032, 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: bc58f8a97d4f2d758a08d1416b25c72c 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 v5 3/8] 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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 From: Shannon Zhao The first Mb handling is not necessary and the attribute of __vmap() is different for ARM. Factor the first Mb handling only for x86 and define a mapping attribute for each architecture. Cc: Jan Beulich Signed-off-by: Shannon Zhao --- v5: only factor the first Mb handling and the attribute of __vmap() --- xen/drivers/acpi/osl.c | 11 +++++++---- xen/include/asm-x86/acpi.h | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c index a2fc8c4..63a4b1f 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -92,11 +92,14 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size) 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); + if (IS_ENABLED(CONFIG_X86)) { + /* 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; + ACPI_MAP_MEM_ATTR) + offs; } return __acpi_map_table(phys, size); } diff --git a/xen/include/asm-x86/acpi.h b/xen/include/asm-x86/acpi.h index d3bde78..d532e3d 100644 --- a/xen/include/asm-x86/acpi.h +++ b/xen/include/asm-x86/acpi.h @@ -163,4 +163,6 @@ void hvm_acpi_sleep_button(struct domain *d); void save_rest_processor_state(void); void restore_rest_processor_state(void); +#define ACPI_MAP_MEM_ATTR PAGE_HYPERVISOR_NOCACHE + #endif /*__X86_ASM_ACPI_H*/