[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] VT-d: fix !HVM build
commit c038304b46ffb3d3d314819d1331ca61e9ff668b Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Fri May 20 12:17:52 2022 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri May 20 12:17:52 2022 +0200 VT-d: fix !HVM build EPT is of no interest when !HVM. While I'm observing gcc11 to fully eliminate the function, older gcc's DCE looks to not be as good. CONFIG_UBSAN apparently also limits how aggressively dead code is eliminated. Aid the compiler in eliminating the accesses of opt_hap_{2mb,1gb}, which otherwise cause undefined symbol errors when linking. While there adjust types. Fixes: c479415610f0 ("x86/P2M: p2m.c is HVM-only") Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> --- xen/drivers/passthrough/vtd/iommu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index f22caf269d..4ceb20632f 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -2206,14 +2206,17 @@ static int cf_check intel_iommu_lookup_page( return 0; } -static int __init vtd_ept_page_compatible(struct vtd_iommu *iommu) +static bool __init vtd_ept_page_compatible(const struct vtd_iommu *iommu) { - u64 ept_cap, vtd_cap = iommu->cap; + uint64_t ept_cap, vtd_cap = iommu->cap; + + if ( !IS_ENABLED(CONFIG_HVM) ) + return false; /* EPT is not initialised yet, so we must check the capability in * the MSR explicitly rather than use cpu_has_vmx_ept_*() */ if ( rdmsr_safe(MSR_IA32_VMX_EPT_VPID_CAP, ept_cap) != 0 ) - return 0; + return false; return (ept_has_2mb(ept_cap) && opt_hap_2mb) <= cap_sps_2mb(vtd_cap) && (ept_has_1gb(ept_cap) && opt_hap_1gb) <= cap_sps_1gb(vtd_cap); -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |