From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F306C4724C for ; Fri, 1 May 2020 12:03:06 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1A93B20836 for ; Fri, 1 May 2020 12:03:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A93B20836 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass 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.92) (envelope-from ) id 1jUUNa-0002q0-Oq; Fri, 01 May 2020 12:02:54 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jUUNY-0002pv-ND for xen-devel@lists.xenproject.org; Fri, 01 May 2020 12:02:52 +0000 X-Inumbo-ID: aeb0f260-8ba3-11ea-9b00-12813bfff9fa Received: from mail-wm1-f66.google.com (unknown [209.85.128.66]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id aeb0f260-8ba3-11ea-9b00-12813bfff9fa; Fri, 01 May 2020 12:02:51 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id g12so6106310wmh.3 for ; Fri, 01 May 2020 05:02:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=g8BdGaK3T4ewPDAvcqcX4aOkqblz2cj6sMht5XmYlIg=; b=STZidTBjy3wOraNnG/zyvqsdwfW3BgSDlkwpCMr4U4Zz7bMxyrYu7Y3H7blTrmEwSG wopG418fiUA9G8DXxMNXQXIhbfTn1/LSjTGKzO486lCkAUqoCSQTWS2cGuHqD/42LUbH /sqqEqfxL6tIXIBFYflVOYsOl2t8i/ZMYs54dFoQBDfW5zbiat/SkBnFGc5uHxl6ZQGX XZcQNNx3K7/RJy1mSuE/8VH3Agx6ofP/rmLOc9yBcof2Ms/u5t+EDEYK/QpOjM5r87kS nvhYS4AGZebSNS6K8nLuip/Rxfv8nFdavpLhjxKsPHvrH7dfsK19xWMcJ/IkjWTW2+w1 5C7A== X-Gm-Message-State: AGi0PubD4evoLdMWrRVXbwEdp16JGyrhuBThOoyUHbtjYM+FQfSMSg7I D2UVuxAphwGcVu9PccPrTtQ= X-Google-Smtp-Source: APiQypI6FOwjwFUFoxCqiVkExJmPNqtNHhxS4j3S4de2+aPiykkhZf4ltYXR0BbSXlIwgXxO+G3Tlw== X-Received: by 2002:a05:600c:2214:: with SMTP id z20mr3990339wml.189.1588334571169; Fri, 01 May 2020 05:02:51 -0700 (PDT) Received: from liuwe-devbox-debian-v2.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id q8sm3650021wmg.22.2020.05.01.05.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 05:02:50 -0700 (PDT) Date: Fri, 1 May 2020 12:02:49 +0000 From: Wei Liu To: Hongyan Xia Subject: Re: [PATCH 02/16] acpi: vmap pages in acpi_os_alloc_memory Message-ID: <20200501120249.bd2w6ksgii4tkrai@liuwe-devbox-debian-v2.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , julien@xen.org, Wei Liu , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , xen-devel@lists.xenproject.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On Thu, Apr 30, 2020 at 09:44:11PM +0100, Hongyan Xia wrote: > From: Hongyan Xia > > Also, introduce a wrapper around vmap that maps a contiguous range for > boot allocations. > > Signed-off-by: Hongyan Xia > --- > xen/drivers/acpi/osl.c | 9 ++++++++- > xen/include/xen/vmap.h | 5 +++++ > 2 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c > index 4c8bb7839e..d0762dad4e 100644 > --- a/xen/drivers/acpi/osl.c > +++ b/xen/drivers/acpi/osl.c > @@ -219,7 +219,11 @@ void *__init acpi_os_alloc_memory(size_t sz) > void *ptr; > > if (system_state == SYS_STATE_early_boot) > - return mfn_to_virt(mfn_x(alloc_boot_pages(PFN_UP(sz), 1))); > + { > + mfn_t mfn = alloc_boot_pages(PFN_UP(sz), 1); > + > + return vmap_boot_pages(mfn, PFN_UP(sz)); > + } > > ptr = xmalloc_bytes(sz); > ASSERT(!ptr || is_xmalloc_memory(ptr)); > @@ -244,5 +248,8 @@ void __init acpi_os_free_memory(void *ptr) > if (is_xmalloc_memory(ptr)) > xfree(ptr); > else if (ptr && system_state == SYS_STATE_early_boot) > + { > + vunmap(ptr); > init_boot_pages(__pa(ptr), __pa(ptr) + PAGE_SIZE); > + } > } > diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h > index 369560e620..c70801e195 100644 > --- a/xen/include/xen/vmap.h > +++ b/xen/include/xen/vmap.h > @@ -23,6 +23,11 @@ void *vmalloc_xen(size_t size); > void *vzalloc(size_t size); > void vfree(void *va); > > +static inline void *vmap_boot_pages(mfn_t mfn, unsigned int nr_pages) Nothing seems to tie this to boot pages only. Maybe it is better to name it after what it does, like vmap_mfns? > +{ > + return __vmap(&mfn, nr_pages, 1, 1, PAGE_HYPERVISOR, VMAP_DEFAULT); > +} > + > void __iomem *ioremap(paddr_t, size_t); > > static inline void iounmap(void __iomem *va) > -- > 2.24.1.AMZN >