From patchwork Wed Jan 29 20:20:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11356777 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D07392A for ; Wed, 29 Jan 2020 20:21:58 +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 29B0D20702 for ; Wed, 29 Jan 2020 20:21:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gvI2Of03" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 29B0D20702 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=none 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 1iwtpm-0006dR-7O; Wed, 29 Jan 2020 20:21:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iwtpk-0006cr-WB for xen-devel@lists.xenproject.org; Wed, 29 Jan 2020 20:21:09 +0000 X-Inumbo-ID: d3bb65da-42d4-11ea-b211-bc764e2007e4 Received: from mail-wr1-x441.google.com (unknown [2a00:1450:4864:20::441]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d3bb65da-42d4-11ea-b211-bc764e2007e4; Wed, 29 Jan 2020 20:20:44 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id z7so979970wrl.13 for ; Wed, 29 Jan 2020 12:20:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ITFZiTyiTf8vIPKBbhv8PPdQmh+pCqfsfzWwanxg5Zc=; b=gvI2Of03ObHu/iEQibeI0lBSv6UU9zrXLeW71/w+iXSh//RCMfYN0c9QHkD3g3qM09 GzDbe11VNWTNav219i5NI+FsXnS225uIgk91Oyg5BA+Cvm64hK6fwte+EZKdIDJbRQtG 3lkrThmf0ISCfo+YhvDuHNI13nr6Ae0OU0UbHy6VMnT6LzmVfL4xLt8NuJcr0Je2LhkC R6t/Y49lIM3rMgM+bLVJusxjz0+iDdTSZMX/+rYyNFDzm3D2lxravWz1cchDga7l+vuV fnbWmjAIHU1VR9ASHtVrH3A4kdNfD+sZWHnctTWpwEBkYuomXRgrn/pAJ1p9Ud0Z+vxt oNJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ITFZiTyiTf8vIPKBbhv8PPdQmh+pCqfsfzWwanxg5Zc=; b=hLIPJYe5OEXUeQgEGCCnB+KlodbiRpt4V33LXTkoyhgHqSUUEyYGqAQn1530Zt9Gqs zuXBZIVWCzYx/vpICfGET8Kbn8hYNL8XwydVfEVgqVuhi9xXKeUnt29+y71DB8oucI+3 4FS6PmEk2lEtO9aHb4h1j+7XZgVIyKvXEbTM+8HuYVcBTQBeG6RecHsAxB1aCXo3uP89 M3zbZBJqJAIalP1Ino2STUX+imNXjsDutRbBlI20Z8BzMMGZtD+KHJbgcr6efy+WXC5B ew/+9uiFujqQxK1nQ4W+AuMI49oirkvUXf9SJrLRVW/O7RWdeMxTeOBo2yAnwwKtOQF5 uMfg== X-Gm-Message-State: APjAAAUeLR5fEzwQjkPwbwtZ34zBMsbO0sku2p5/PLwxWvClSrIugZu0 kaJbcvgMiXDqZH/hfSidGnsroAvLlT8= X-Google-Smtp-Source: APXvYqwU7K3c6tO3fT6jxXBkrE8TA2G8+vyjQ942jcAaTi+RClCSCHwZuD6A6JnLtf0tnHqannAHmA== X-Received: by 2002:adf:f3d0:: with SMTP id g16mr663979wrp.2.1580329243528; Wed, 29 Jan 2020 12:20:43 -0800 (PST) Received: from localhost.localdomain (41.142.6.51.dyn.plus.net. [51.6.142.41]) by smtp.gmail.com with ESMTPSA id a22sm3564115wmd.20.2020.01.29.12.20.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 12:20:43 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Wed, 29 Jan 2020 20:20:28 +0000 Message-Id: <20200129202034.15052-7-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200129202034.15052-1-liuwe@microsoft.com> References: <20200129202034.15052-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v5 06/12] x86/hypervisor: provide hypervisor_reserve_top_pages 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: Wei Liu , Wei Liu , Andrew Cooper , Paul Durrant , Michael Kelley , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" This function will return the number of pages that need to be reserved in the machine address space. E820 code will use that number to adjust the maximum PFN available to Xen. Signed-off-by: Wei Liu --- xen/arch/x86/guest/hypervisor.c | 8 ++++++++ xen/include/asm-x86/guest/hypervisor.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hypervisor.c index e72c92ffdf..8b9cf1ce4c 100644 --- a/xen/arch/x86/guest/hypervisor.c +++ b/xen/arch/x86/guest/hypervisor.c @@ -66,6 +66,14 @@ void hypervisor_resume(void) ops->resume(); } +unsigned int hypervisor_reserve_top_pages(void) +{ + if ( ops && ops->reserve_top_pages ) + return ops->reserve_top_pages(); + + return 0; +} + /* * Local variables: * mode: C diff --git a/xen/include/asm-x86/guest/hypervisor.h b/xen/include/asm-x86/guest/hypervisor.h index b503854c5b..37eb9d531e 100644 --- a/xen/include/asm-x86/guest/hypervisor.h +++ b/xen/include/asm-x86/guest/hypervisor.h @@ -28,6 +28,8 @@ struct hypervisor_ops { int (*ap_setup)(void); /* Resume from suspension */ void (*resume)(void); + /* How many top pages to be reserved in machine address space? */ + unsigned int (*reserve_top_pages)(void); }; #ifdef CONFIG_GUEST @@ -36,6 +38,7 @@ const char *hypervisor_probe(void); void hypervisor_setup(void); int hypervisor_ap_setup(void); void hypervisor_resume(void); +unsigned int hypervisor_reserve_top_pages(void); #else @@ -46,6 +49,7 @@ static inline const char *hypervisor_probe(void) { return NULL; } static inline void hypervisor_setup(void) { ASSERT_UNREACHABLE(); } static inline int hypervisor_ap_setup(void) { ASSERT_UNREACHABLE(); return 0; } static inline void hypervisor_resume(void) { ASSERT_UNREACHABLE(); } +static inline unsigned int hypervisor_reserve_top_pages(void) { return 0; } #endif /* CONFIG_GUEST */