[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/16] x86/P2M: p2m_get_page_from_gfn() is HVM-only
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 5 Jul 2021 18:10:45 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i9R/6Ft2bTf/P4epKQB2jkiAfHntWtgxvduuxZdy6KA=; b=YkOfDEK1Y6rFYnfacNP6UVJjXegz99vLF85wsbRjkoGahpPNLLODWnpCq3fOzptS0elicVIA2ufj/gLqlWtVIOzPZGQtg54hG6CcrOULLCt7IG5KLUA+5d2zmvOufJ1O8brGT7jBSZKz9cUkhX72dbTncm8HU/X6df+ZShBNzJgMfqGDaHwd9xYNi4mO2IuuhQNQdZsWjAPzKbI5LFNhCJy5NjNsSu3hiuHSqfRKaEvF8IjhtvadvJeMptfp/VxuAYWwb223aUCg+zaRwWl8rZmWnFocLI/luoDuE0qRvjpLNB7ufer/Gcqx0L/TLfKggXX6A5+lmToT1qjNZy1VqA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N3RLa/lS/jUuwexFDHRCc4dhS5f+h1wERt3i8vwwSrbH9hcRd3+F7s6uB0KUZmOoa1HtPzbZinYixFl9ZONIZOb12i84iQaGzYkujD3Dk2/ezMkl6mPypD1p1W44DB24q5gcOWaLfHRYx9kC8WTC1eyp4UpOW9JAO+Z6cqdDD3wcQYk+v6SV/D3aMVNh0OgKg78MaepauQAZx/0aetipCLS8mCvpOtEGBP7egWjLTqpFi55jNnh5SgzhE51kttXvzpJRgx7PEqvvA/B7tcmEs3RumIDrtB/Wv6UV0iItu8Y2kLTQYpZHr/wfHfp5sio96409l5YFym9noRLdlG01IQ==
- Authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>
- Delivery-date: Mon, 05 Jul 2021 16:10:52 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
This function is the wrong layer to go through for PV guests. It happens
to work, but produces results which aren't fully consistent with
get_page_from_gfn(). The latter function, however, cannot be used in
map_domain_gfn() as it may not be the host P2M we mean to act on.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
--- a/xen/arch/x86/mm/guest_walk.c
+++ b/xen/arch/x86/mm/guest_walk.c
@@ -554,7 +554,9 @@ void *map_domain_gfn(struct p2m_domain *
}
/* Translate the gfn, unsharing if shared. */
- page = p2m_get_page_from_gfn(p2m, gfn, &p2mt, NULL, q);
+ page = paging_mode_translate(p2m->domain)
+ ? p2m_get_page_from_gfn(p2m, gfn, &p2mt, NULL, q)
+ : get_page_from_gfn(p2m->domain, gfn_x(gfn), &p2mt, q);
if ( p2m_is_paging(p2mt) )
{
ASSERT(p2m_is_hostp2m(p2m));
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -357,6 +357,8 @@ void __put_gfn(struct p2m_domain *p2m, u
gfn_unlock(p2m, gfn, 0);
}
+#ifdef CONFIG_HVM
+
/* Atomically look up a GFN and take a reference count on the backing page. */
struct page_info *p2m_get_page_from_gfn(
struct p2m_domain *p2m, gfn_t gfn,
@@ -422,8 +424,6 @@ struct page_info *p2m_get_page_from_gfn(
return page;
}
-#ifdef CONFIG_HVM
-
/* Returns: 0 for success, -errno for failure */
int p2m_set_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
unsigned int page_order, p2m_type_t p2mt, p2m_access_t p2ma)
|