From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>,
"George Dunlap" <george.dunlap@citrix.com>,
"Tim Deegan" <tim@xen.org>
Subject: [PATCH v2 03/12] x86/mm: the gva_to_gfn() hook is HVM-only
Date: Mon, 12 Apr 2021 16:07:10 +0200 [thread overview]
Message-ID: <ff26a66b-3cee-5f92-01a4-6096e7d28556@suse.com> (raw)
In-Reply-To: <3cf73378-b9d6-0eca-12b6-0f628518bebf@suse.com>
As is the adjacent ga_to_gfn() one as well as paging_gva_to_gfn().
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: Fix !SHADOW_PAGING && !HVM build.
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1793,7 +1793,6 @@ void np2m_schedule(int dir)
p2m_unlock(p2m);
}
}
-#endif
unsigned long paging_gva_to_gfn(struct vcpu *v,
unsigned long va,
@@ -1844,6 +1843,8 @@ unsigned long paging_gva_to_gfn(struct v
return hostmode->gva_to_gfn(v, hostp2m, va, pfec);
}
+#endif /* CONFIG_HVM */
+
/*
* If the map is non-NULL, we leave this function having acquired an extra ref
* on mfn_to_page(*mfn). In all cases, *pfec contains appropriate
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -3030,6 +3030,7 @@ static bool sh_invlpg(struct vcpu *v, un
return true;
}
+#ifdef CONFIG_HVM
static unsigned long
sh_gva_to_gfn(struct vcpu *v, struct p2m_domain *p2m,
@@ -3063,6 +3064,7 @@ sh_gva_to_gfn(struct vcpu *v, struct p2m
return gfn_x(gfn);
}
+#endif /* CONFIG_HVM */
static inline void
sh_update_linear_entries(struct vcpu *v)
@@ -4183,7 +4185,9 @@ int sh_audit_l4_table(struct vcpu *v, mf
const struct paging_mode sh_paging_mode = {
.page_fault = sh_page_fault,
.invlpg = sh_invlpg,
+#ifdef CONFIG_HVM
.gva_to_gfn = sh_gva_to_gfn,
+#endif
.update_cr3 = sh_update_cr3,
.update_paging_modes = shadow_update_paging_modes,
.flush_tlb = shadow_flush_tlb,
--- a/xen/arch/x86/mm/shadow/none.c
+++ b/xen/arch/x86/mm/shadow/none.c
@@ -43,12 +43,14 @@ static bool _invlpg(struct vcpu *v, unsi
return true;
}
+#ifdef CONFIG_HVM
static unsigned long _gva_to_gfn(struct vcpu *v, struct p2m_domain *p2m,
unsigned long va, uint32_t *pfec)
{
ASSERT_UNREACHABLE();
return gfn_x(INVALID_GFN);
}
+#endif
static void _update_cr3(struct vcpu *v, int do_locking, bool noflush)
{
@@ -63,7 +65,9 @@ static void _update_paging_modes(struct
static const struct paging_mode sh_paging_none = {
.page_fault = _page_fault,
.invlpg = _invlpg,
+#ifdef CONFIG_HVM
.gva_to_gfn = _gva_to_gfn,
+#endif
.update_cr3 = _update_cr3,
.update_paging_modes = _update_paging_modes,
};
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -127,6 +127,7 @@ struct paging_mode {
struct cpu_user_regs *regs);
bool (*invlpg )(struct vcpu *v,
unsigned long linear);
+#ifdef CONFIG_HVM
unsigned long (*gva_to_gfn )(struct vcpu *v,
struct p2m_domain *p2m,
unsigned long va,
@@ -136,6 +137,7 @@ struct paging_mode {
unsigned long cr3,
paddr_t ga, uint32_t *pfec,
unsigned int *page_order);
+#endif
void (*update_cr3 )(struct vcpu *v, int do_locking,
bool noflush);
void (*update_paging_modes )(struct vcpu *v);
@@ -287,6 +289,8 @@ unsigned long paging_gva_to_gfn(struct v
unsigned long va,
uint32_t *pfec);
+#ifdef CONFIG_HVM
+
/* Translate a guest address using a particular CR3 value. This is used
* to by nested HAP code, to walk the guest-supplied NPT tables as if
* they were pagetables.
@@ -305,6 +309,8 @@ static inline unsigned long paging_ga_to
page_order);
}
+#endif /* CONFIG_HVM */
+
/* Update all the things that are derived from the guest's CR3.
* Called when the guest changes CR3; the caller can then use v->arch.cr3
* as the value to load into the host CR3 to schedule this vcpu */
next prev parent reply other threads:[~2021-04-12 14:07 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-12 14:03 [PATCH v2 00/12] x86/p2m: restrict more code to build just for HVM Jan Beulich
2021-04-12 14:05 ` [PATCH v2 01/12] x86/p2m: set_{foreign,mmio}_p2m_entry() are HVM-only Jan Beulich
2021-04-29 13:17 ` Roger Pau Monné
2021-04-29 14:09 ` Jan Beulich
2021-04-29 15:06 ` Roger Pau Monné
2021-04-12 14:06 ` [PATCH v2 02/12] x86/p2m: {,un}map_mmio_regions() " Jan Beulich
2021-04-29 14:48 ` Roger Pau Monné
2021-04-29 15:01 ` Jan Beulich
2021-04-12 14:07 ` Jan Beulich [this message]
2021-04-15 16:22 ` [PATCH v2 03/12] x86/mm: the gva_to_gfn() hook is HVM-only Tim Deegan
2021-04-12 14:07 ` [PATCH v2 04/12] AMD/IOMMU: guest IOMMU support is for HVM only Jan Beulich
2021-04-29 15:14 ` Roger Pau Monné
2021-04-12 14:08 ` [PATCH v2 05/12] x86/p2m: change_entry_type_* hooks are HVM-only Jan Beulich
2021-04-29 15:49 ` Roger Pau Monné
2021-04-12 14:08 ` [PATCH v2 06/12] x86/p2m: hardware-log-dirty related " Jan Beulich
2021-04-29 16:05 ` Roger Pau Monné
2021-04-12 14:09 ` [PATCH v2 07/12] x86/p2m: the recalc hook is HVM-only Jan Beulich
2021-04-30 9:27 ` Roger Pau Monné
2021-04-12 14:10 ` [PATCH v2 08/12] x86: mem-access " Jan Beulich
2021-04-12 14:16 ` Tamas K Lengyel
2021-04-12 14:48 ` Isaila Alexandru
2021-04-12 14:12 ` [PATCH v2 09/12] x86: make mem-paging configuarable and default it to off for being unsupported Jan Beulich
2021-04-12 14:18 ` Tamas K Lengyel
2021-04-12 14:47 ` Isaila Alexandru
2021-04-12 14:27 ` Isaila Alexandru
2021-04-30 9:55 ` Roger Pau Monné
2021-04-30 14:16 ` Jan Beulich
2021-04-30 14:37 ` Roger Pau Monné
2021-04-12 14:13 ` [PATCH v2 10/12] x86/p2m: {get,set}_entry hooks and p2m-pt.c are HVM-only Jan Beulich
2021-04-30 10:57 ` Roger Pau Monné
2021-04-12 14:13 ` [PATCH v2 11/12] x86/p2m: write_p2m_entry_{pre,post} hooks " Jan Beulich
2021-04-15 16:22 ` Tim Deegan
2021-04-12 14:14 ` [PATCH v2 12/12] x86/p2m: re-arrange struct p2m_domain Jan Beulich
2021-04-30 10:59 ` Roger Pau Monné
2021-04-29 9:27 ` Ping: [PATCH v2 00/12] x86/p2m: restrict more code to build just for HVM Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ff26a66b-3cee-5f92-01a4-6096e7d28556@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=roger.pau@citrix.com \
--cc=tim@xen.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).