From patchwork Fri Jan 22 08:38:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8088421 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 EBD26BEEE5 for ; Fri, 22 Jan 2016 08:43:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 152BE20457 for ; Fri, 22 Jan 2016 08:43:50 +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 39C19202B8 for ; Fri, 22 Jan 2016 08:43:49 +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 1aMXGr-0005gg-97; Fri, 22 Jan 2016 08:40:41 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aMXGp-0005gS-6w for xen-devel@lists.xen.org; Fri, 22 Jan 2016 08:40:39 +0000 Received: from [85.158.137.68] by server-13.bemta-3.messagelabs.com id 90/F5-31443-60BE1A65; Fri, 22 Jan 2016 08:40:38 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-10.tower-31.messagelabs.com!1453452030!17424927!1 X-Originating-IP: [119.145.14.65] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NSA9PiA3NzQ2Mw==\n X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 45272 invoked from network); 22 Jan 2016 08:40:36 -0000 Received: from szxga02-in.huawei.com (HELO szxga02-in.huawei.com) (119.145.14.65) by server-10.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 22 Jan 2016 08:40:36 -0000 Received: from 172.24.1.47 (EHLO szxeml422-hub.china.huawei.com) ([172.24.1.47]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DAK01043; Fri, 22 Jan 2016 16:40:19 +0800 (CST) Received: from [127.0.0.1] (10.177.16.142) by szxeml422-hub.china.huawei.com (10.82.67.152) with Microsoft SMTP Server id 14.3.235.1; Fri, 22 Jan 2016 16:40:11 +0800 Message-ID: <56A1EA87.5050404@huawei.com> Date: Fri, 22 Jan 2016 16:38:31 +0800 From: Shannon Zhao User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Jan Beulich References: <1452920477-13916-1-git-send-email-zhaoshenglong@huawei.com> <1452920477-13916-6-git-send-email-zhaoshenglong@huawei.com> <569CF7AF02000078000C806A@prv-mh.provo.novell.com> In-Reply-To: <569CF7AF02000078000C806A@prv-mh.provo.novell.com> X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.56A1EAF5.006A, 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: 94271c533f1dcd7bbebca29b7684bb38 Cc: ian.campbell@citrix.com, peter.huangpeng@huawei.com, xen-devel@lists.xen.org, julien.grall@citrix.com, stefano.stabellini@citrix.com, shannon.zhao@linaro.org Subject: Re: [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 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 On 2016/1/18 21:33, Jan Beulich wrote: >>>> On 16.01.16 at 06:01, wrote: >> > --- 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); >> > } > I'm quite sure I've said before that this goes too far: The __vmap() > part and likely also the early-boot __acpi_map_table() one already > are architecture independent and hence should stay. The factoring > hence should only concern the first Mb handling and maybe the > the mapping attributes passed to __vmap(). Yes, the first MB handling and __vmap() should refactor. So if it only moves them to an architecture function, how about below patch? diff --git a/xen/arch/x86/acpi/lib.c b/xen/arch/x86/acpi/lib.c index cc15ea3..5885a3a 100644 --- a/xen/arch/x86/acpi/lib.c +++ b/xen/arch/x86/acpi/lib.c @@ -33,6 +33,19 @@ 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) +{ + 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; +} + /* * 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 a2fc8c4..e2dda2e 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -88,16 +88,8 @@ 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; - } + if (system_state >= SYS_STATE_active) + return arch_acpi_os_map_memory(phys, size); return __acpi_map_table(phys, size); }