From patchwork Tue Jan 21 09:49:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Xu X-Patchwork-Id: 182904 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp3650507ile; Tue, 21 Jan 2020 01:51:35 -0800 (PST) X-Google-Smtp-Source: APXvYqzftB95KGwdeltnzS2Liyf2DRhq3Yx+7iABloZfTRLCb3aukUopzsBSZBM4emey/nUFw2LP X-Received: by 2002:a05:6e02:8eb:: with SMTP id n11mr3011322ilt.26.1579600295523; Tue, 21 Jan 2020 01:51:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579600295; cv=none; d=google.com; s=arc-20160816; b=aeRVImXJaMcIbhLA+6TW7C7yBFpJrOc033Xu3zMu6DjxC7O+R7qYF0v94Wgm2rSZsH ChuvrnHYm2yI9r8FnOstIljPv7Yyp5v40FfXGB7mSe3Q2IK++ReuzP2p5v2JrtCRYmn2 YSwjl3cw16TbVXj90b1sM+AxQyp3e2fwJ19nrBqV6tbCzFB3iLnMXna1iTFvWrZtKr/F zolGPV4Gj0rE5MiLWL1vtQo0BaYokQS8MIS7Nn4cmT+YcY3Gv519R/BqpTNEzkeMUV78 8fgcIpWmClIl004pCCAvM90dOafXpN+04KQvKgsgJttCa7mpJOKXDIWUyoX1L8myPNiy TObw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post :list-unsubscribe:list-id:precedence:subject:mime-version:user-agent :date:message-id:from:to; bh=Fnds1HXsH1wC+c1j6yT5e0P8qkt7aW+Z/YGol7SHDt8=; b=ZTBbTEG36udUC3rvY4uUjFcldDHI1kGqdWZviRDRTrwdJpka5ObIWm7MD7jL3C0/MW HznfLukxgTGopIfBJEf2bcMlfBr8vZ9FkaStKYGwE4GnT4USpSlP4/dE/Gf4fVNYUJZB aV5Xki9qzNje3Cqo8PluNKNWTo9cx+9FAXBUIr6uiGaIFB33ACWrTX3wCENIDNZKqqDy uFaS9Xj6UJGaFPfPBZ91gymPVjjg1HbECUX6r3uEqzhEuSa2XvD8WrTlAjJOc3k5VoDS 6iPxYSJy+NLyEpDakDp2Qxz3i3gaD6VZ7RLiYY3xz0+DQY4aCeFG5yy7XL4gc7lP5k8y z7yQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id a14si32808350ild.116.2020.01.21.01.51.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Jan 2020 01:51:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1itqAh-0002ZE-3a; Tue, 21 Jan 2020 09:50:07 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1itqAf-0002Pq-KH for xen-devel@lists.xenproject.org; Tue, 21 Jan 2020 09:50:05 +0000 X-Inumbo-ID: 5f0c5336-3c33-11ea-9fd7-bc764e2007e4 Received: from huawei.com (unknown [45.249.212.35]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5f0c5336-3c33-11ea-9fd7-bc764e2007e4; Tue, 21 Jan 2020 09:49:53 +0000 (UTC) Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 76F659D12634EFFEEB6F; Tue, 21 Jan 2020 17:49:51 +0800 (CST) Received: from [127.0.0.1] (10.57.101.250) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Tue, 21 Jan 2020 17:49:42 +0800 To: From: Wei Xu Message-ID: <5E26C935.9080107@hisilicon.com> Date: Tue, 21 Jan 2020 17:49:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 X-Originating-IP: [10.57.101.250] X-CFilter-Loop: Reflected Subject: [Xen-devel] [PATCH] arm/acpi: Add __acpi_unmap_table function for ARM X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , "Zengtao \(B\)" , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Linuxarm , Shameerali Kolothum Thodi , xuwei5@hisilicon.com, Jan Beulich , Volodymyr_Babchuk@epam.com Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Add __acpi_unmap_table function for ARM and invoke it at acpi_os_unmap_memory to make sure the related fixmap has been cleared before using it for a different mapping. Signed-off-by: Wei Xu --- xen/arch/arm/acpi/lib.c | 25 +++++++++++++++++++++++++ xen/drivers/acpi/osl.c | 2 ++ xen/include/xen/acpi.h | 1 + 3 files changed, 28 insertions(+) -- 2.8.1 . diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c index 4fc6e17..69e87ec 100644 --- a/xen/arch/arm/acpi/lib.c +++ b/xen/arch/arm/acpi/lib.c @@ -49,6 +49,31 @@ char *__acpi_map_table(paddr_t phys, unsigned long size) return ((char *) base + offset); } +void __acpi_unmap_table(void __iomem * virt, unsigned long size) +{ + unsigned long base, end; + int idx; + + base = FIXMAP_ADDR(FIXMAP_ACPI_BEGIN); + end = FIXMAP_ADDR(FIXMAP_ACPI_END); + + if ( (unsigned long)virt < base || (unsigned long)virt > end ) + { + return; + } + + idx = FIXMAP_ACPI_BEGIN + ((unsigned long)virt - base) / PAGE_SIZE; + clear_fixmap(idx); + + while ( size > PAGE_SIZE ) + { + if ( ++idx > FIXMAP_ACPI_END ) + return; + clear_fixmap(idx); + size -= PAGE_SIZE; + } +} + /* True to indicate PSCI 0.2+ is implemented */ bool __init acpi_psci_present(void) { diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c index 4c8bb78..18666c7 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -114,6 +114,8 @@ void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) return; } + __acpi_unmap_table(virt, size); + if (system_state >= SYS_STATE_boot) vunmap((void *)((unsigned long)virt & PAGE_MASK)); } diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h index 5cfa060..acb00a2 100644 --- a/xen/include/xen/acpi.h +++ b/xen/include/xen/acpi.h @@ -68,6 +68,7 @@ typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, co unsigned int acpi_get_processor_id (unsigned int cpu); char * __acpi_map_table (paddr_t phys_addr, unsigned long size); +void __acpi_unmap_table(void __iomem * virt, unsigned long size); int acpi_boot_init (void); int acpi_boot_table_init (void); int acpi_numa_init (void);