altp2m: Drop p2m_altp2m_check() stubs on non-x86, move prototype, and guard uses

Remove the no-op stubs from the ARM, PPC, and RISC‑V p2m headers and stop
providing a stub in arch/x86/include/asm/p2m.h.

Declare p2m_altp2m_check() in xen/include/xen/p2m-common.h and gate all
call sites with CONFIG_ALTP2M:
 - wrap the fast_single_step block in hvm/monitor.c with #ifdef CONFIG_ALTP2M
   (IS_ENABLED(CONFIG_ALTP2M) is not used here, because in the subsequent commit
   hvm_vcpu::fast_single_step will be guarded by CONFIG_ALTP2M)
 - make the vm_event.c path conditional via IS_ENABLED(CONFIG_ALTP2M)

No functional change intended: on builds without ALTP2M the calls are
compiled out; on builds with ALTP2M behavior is unchanged.

Signed-off-by: Petr Beneš <w1benny@gmail.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <jgrall@amazon.com> # arm
Acked-by: Tamas K Lengyel <tamas@tklengyel.com> # vm_event/monitor
This commit is contained in:
Petr Beneš authored and Jan Beulich committed 2025-08-25 12:44:58 +02:00
1 parent 4efc1da300
commit 5fe316e479
7 files changed
+8 -24

No files matched your search

-6
View File
@@ -180,12 +180,6 @@ static inline bool arch_acquire_resource_check(struct domain *d)
return true;
}
static inline
void p2m_altp2m_check(struct vcpu *v, uint16_t idx)
{
/* Not supported on ARM. */
}
/*
* Helper to restrict "p2m_ipa_bits" according the external entity
* (e.g. IOMMU) requirements.
-5
View File
@@ -88,9 +88,4 @@ static inline bool arch_acquire_resource_check(struct domain *d)
return false;
}
static inline void p2m_altp2m_check(struct vcpu *v, uint16_t idx)
{
/* Not supported on PPC. */
}
#endif /* __ASM_PPC_P2M_H__ */
-5
View File
@@ -88,11 +88,6 @@ static inline bool arch_acquire_resource_check(struct domain *d)
return false;
}
static inline void p2m_altp2m_check(struct vcpu *v, uint16_t idx)
{
/* Not supported on RISCV. */
}
#endif /* ASM__RISCV__P2M_H */
/*
+2
View File
@@ -178,6 +178,7 @@ int hvm_monitor_debug(unsigned long rip, enum hvm_monitor_debug_type type,
break;
case HVM_MONITOR_SINGLESTEP_BREAKPOINT:
#ifdef CONFIG_ALTP2M
if ( curr->arch.hvm.fast_single_step.enabled )
{
p2m_altp2m_check(curr, curr->arch.hvm.fast_single_step.p2midx);
@@ -186,6 +187,7 @@ int hvm_monitor_debug(unsigned long rip, enum hvm_monitor_debug_type type,
curr->arch.hvm.fast_single_step.p2midx = 0;
return 0;
}
#endif
if ( !ad->monitor.singlestep_enabled )
return 0;
req.reason = VM_EVENT_REASON_SINGLESTEP;
+1 -7
View File
@@ -962,17 +962,11 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn_t gfn,
/* Set a specific p2m view visibility */
int p2m_set_altp2m_view_visibility(struct domain *d, unsigned int altp2m_idx,
uint8_t visible);
#else /* !CONFIG_HVM */
struct p2m_domain *p2m_get_altp2m(struct vcpu *v);
#endif /* CONFIG_HVM */
#ifdef CONFIG_ALTP2M
/* Check to see if vcpu should be switched to a different p2m. */
void p2m_altp2m_check(struct vcpu *v, uint16_t idx);
#else
static inline void p2m_altp2m_check(struct vcpu *v, uint16_t idx) {}
#endif
/* p2m access to IOMMU flags */
static inline unsigned int p2m_access_to_iommu_flags(p2m_access_t p2ma)
{
+2 -1
View File
@@ -431,7 +431,8 @@ static int vm_event_resume(struct domain *d, struct vm_event_domain *ved)
vm_event_toggle_singlestep(d, v, &rsp);
/* Check for altp2m switch */
if ( rsp.flags & VM_EVENT_FLAG_ALTERNATE_P2M )
if ( IS_ENABLED(CONFIG_ALTP2M) &&
rsp.flags & VM_EVENT_FLAG_ALTERNATE_P2M )
p2m_altp2m_check(v, rsp.altp2m_idx);
if ( rsp.flags & VM_EVENT_FLAG_SET_REGISTERS )
+3
View File
@@ -24,6 +24,9 @@ int unmap_mmio_regions(struct domain *d,
unsigned long nr,
mfn_t mfn);
/* Check to see if vcpu should be switched to a different p2m. */
void p2m_altp2m_check(struct vcpu *v, uint16_t idx);
/*
* Populate-on-Demand
*/
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.