x86/P2M: PoD, altp2m, and nested-p2m are HVM-only
authorJan Beulich <jbeulich@suse.com>
Fri, 8 Apr 2022 12:41:51 +0000 (14:41 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 8 Apr 2022 12:41:51 +0000 (14:41 +0200)
commit26c719f67e71d5ff4cabc44cba37de2155204cbb
tree06e9e915a69cdd1aecb2deba40364aaaa6f6d040
parent033ff90aa9c17306ae0026fd10f6532b2ea3fca2
x86/P2M: PoD, altp2m, and nested-p2m are HVM-only

There's no need to initialize respective data for PV domains. Note that
p2m_teardown_{alt,nested}p2m() will handle the lack-of-initialization
case fine.

As a result, despite PV domains having a host P2M associated with them
and hence using XENMEM_get_pod_target on such may not be a real problem,
calling p2m_pod_set_mem_target() for a PV domain is surely wrong, even
if benign at present. Add a guard there as well.

In p2m_pod_demand_populate() the situation is a little different: This
function is reachable only for HVM domains anyway, but following from
other PoD functions only ever acting on the host P2M (and hence PoD
entries only ever existing in host P2Ms), assert and bail from there for
non-host-P2Ms.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
xen/arch/x86/include/asm/p2m.h
xen/arch/x86/mm.c
xen/arch/x86/mm/p2m-pod.c
xen/arch/x86/mm/p2m.c
xen/arch/x86/mm/p2m.h [new file with mode: 0644]