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: 7634401 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9B9CF9F1C2 for ; Tue, 17 Nov 2015 09:45:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ABE0820454 for ; Tue, 17 Nov 2015 09:45:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6AA9A20435 for ; Tue, 17 Nov 2015 09:45:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zycni-0006Sd-1d; Tue, 17 Nov 2015 09:43:46 +0000 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZycmM-0005Ir-2a for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2015 09:42:25 +0000 Received: by wmec201 with SMTP id c201so217859503wme.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=QoIGACY466wQiWQrcIy9XPTPnUpTrj1M2mLHNr5ey0J0bjOEHOql5QDfTmQsR63D89 AIhLRurpke+LGW/czL3Crpyt5j+tUTgNkUv93SEyeMFd7q3XPgCedG8a0+4i7KQwI61f 8zn9+IIbxBBPLNOLVZz5gRVIjwXtGJFzvMdeMEHAg1W+YrAkWdXiaWxeHIp3oykk4gut ilEQzokzIda938K16MasbWVhWpt+K/58BkhidTZ6v4qcU8Y0rEIy2W5rLPruvmi46mYa E+36tbvUqOXJJ6CpAbkwM8ifFb8CLJQDdAO6qItwOg9iG79AIVQHvtq3JVNPh6WfIx1w BOIg== X-Gm-Message-State: ALoCoQm0nCvbJwcyI3sDT/rgagTHyACHP3KqTdozoAj4TGMVtMbXvmIURtmO3u0Ttrt1UgkOIlvN 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 Subject: [PATCH v3 06/62] acpi: Refactor acpi_os_map_memory to be architecturally independent 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151117_014222_497039_06879D7D X-CRM114-Status: GOOD ( 13.84 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Current acpi_os_map_memory is specific to x86. Refactor it to be architecturally independent. 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(-) 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);