From patchwork Tue Nov 17 09:40:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 56722 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1825117lbb; Tue, 17 Nov 2015 01:43:33 -0800 (PST) X-Received: by 10.194.90.169 with SMTP id bx9mr42186459wjb.1.1447753401740; Tue, 17 Nov 2015 01:43:21 -0800 (PST) Return-Path: Received: from lists.xen.org (lists.xenproject.org. [50.57.142.19]) by mx.google.com with ESMTPS id wp4si52194569wjc.97.2015.11.17.01.43.21 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Nov 2015 01:43:21 -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; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Zycm2-0002EM-UA; Tue, 17 Nov 2015 09:42:02 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Zycm1-0002DX-MM for xen-devel@lists.xen.org; Tue, 17 Nov 2015 09:42:01 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 23/C4-23747-866FA465; Tue, 17 Nov 2015 09:42:00 +0000 X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-7.tower-31.messagelabs.com!1447753320!4317677!1 X-Originating-IP: [74.125.82.51] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.19.2; banners=-,-,- X-VirusChecked: Checked Received: (qmail 48084 invoked from network); 17 Nov 2015 09:42:00 -0000 Received: from mail-wm0-f51.google.com (HELO mail-wm0-f51.google.com) (74.125.82.51) by server-7.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Nov 2015 09:42:00 -0000 Received: by wmdw130 with SMTP id w130so146611270wmd.0 for ; Tue, 17 Nov 2015 01:42:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ybCWWvTuq8gBaE3Je3QFhUpUITDOZ48sIihNo5/0HM8=; b=zmkPIDVOZBp3gQiaXu71514OsN6k3asdMvclR/feFnAp3JkUsrb0mdaYJh5HLaMBUr /lfQ+oWzfXn/XaVQJhb752CAb8if/XrtDDmkQcgSwGSsMvfPj80rEqboKPHXagOs6RRg x+dWEA5tFKSKllv/ll2iI+RBYxkFE4H2yiy7keXQZ3Nvnh1uzfPZnNTNLHmN9awtkQJC XX1za55UNrawyKojehnsKLA4WEevQ03y7KNqTPdz2Lh4RLEG5ELuacsqTCCIxzVWfUD4 yNKj5s23Sit/TKUuoYW/r6fFUSFd+FMA01tPRRY4BUDTGbuLdcx9BOuGiRq1DRK6sXnb NEjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ybCWWvTuq8gBaE3Je3QFhUpUITDOZ48sIihNo5/0HM8=; b=Z8As7ix+8vtiMLlYSPkSuyI+2194j/o60qYvAuyA1ok6lsO62WDzIWIOiwE5xPRFF+ 08Z1pwluJvuQkKN3LQHvATRHGYfNA873gdu8FKhNuV2KzkdAKjfaB/+/wuaJyP+kD7Zn G3UAcnWyCY2QTQpogoK8nNxnlcelyI5LD2pmgvNZzYOed7R9jQicf/bfGMnXIuRJbDy4 FuLQOwu01563fRb+DqWb5fmz2io0VsYr1MiB7yDSmUETbk2rBWnKkOZqfV91zDss6JCr Q07+cq6Hp9KlW5GyZGomGqmEvrqntThUCViWobAxm7mdm8/MYLLbcxZ2jSpXDe3qtjMw jU8A== X-Gm-Message-State: ALoCoQl17Nd2xv1Ep1ubGMXUCcL5nSbuCbWRNST+59oeKn9W9E1n4O2XAXZBHqPiHMOAK76wUtMI X-Received: by 10.28.156.75 with SMTP id f72mr1479350wme.91.1447753320149; Tue, 17 Nov 2015 01:42:00 -0800 (PST) Received: from localhost ([78.129.251.54]) by smtp.gmail.com with ESMTPSA id l1sm38996109wjx.13.2015.11.17.01.41.57 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Nov 2015 01:41:59 -0800 (PST) From: shannon.zhao@linaro.org To: ian.campbell@citrix.com, stefano.stabellini@citrix.com, keir@xen.org, jbeulich@suse.com, andrew.cooper3@citrix.com, julien.grall@citrix.com, xen-devel@lists.xen.org Date: Tue, 17 Nov 2015 17:40:05 +0800 Message-Id: <1447753261-7552-7-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1447753261-7552-1-git-send-email-shannon.zhao@linaro.org> References: <1447753261-7552-1-git-send-email-shannon.zhao@linaro.org> Cc: mark.rutland@arm.com, hangaohuai@huawei.com, ard.biesheuvel@linaro.org, shannon.zhao@linaro.org, christoffer.dall@linaro.org, peter.huangpeng@huawei.com, david.vrabel@citrix.com, zhaoshenglong@huawei.com, linux-arm-kernel@lists.infradead.org, roger.pau@citrix.com Subject: [Xen-devel] [PATCH v3 06/62] 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: , MIME-Version: 1.0 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. Signed-off-by: Shannon Zhao --- 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.1.0 _______________________________________________ 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 db74a90..54fb0f0 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -88,17 +88,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 0f1077d..48d7810 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);