IOMMU: iommu_use_hap_pt() implies CONFIG_HVM
PATCH 1/1 IOMMU: iommu_use_hap_pt() implies CONFIG_HVM
Allow the compiler a little more room on DCE by moving the compile-time- constant condition into the predicate (from the one place where it was added in an open-coded fashion for XSA-450).
xen/drivers/passthrough/vtd/iommu.c +1 -1
@@ -438,7 +438,7 @@ static paddr_t domain_pgd_maddr(struct dif ( pgd_maddr )/* nothing */ ; -else if (IS_ENABLED (CONFIG_HVM ) &&iommu_use_hap_pt (d) ) +else if (iommu_use_hap_pt (d) ) {pagetable_t pgt =p2m_get_pagetable (p2m_get_hostp2m (d));
xen/include/xen/iommu.h +2 -1
@@ -381,7 +381,8 @@ struct domain_iommu {#define iommu_clear_feature (d, f) clear_bit(f, dom_iommu(d)->features)/* Are we using the domain P2M table as its IOMMU pagetable? */ -#define iommu_use_hap_pt (d) (dom_iommu(d)->hap_pt_share) +#define iommu_use_hap_pt (d) (IS_ENABLED(CONFIG_HVM) && \ + dom_iommu(d)->hap_pt_share)/* Does the IOMMU pagetable need to be kept synchronized with the P2M */ #ifdef CONFIG_HAS_PASSTHROUGH
Quoted 5 lines · Jan Beulich
Allow the compiler a little more room on DCE by moving the compile-time- constant condition into the predicate (from the one place where it was added in an open-coded fashion for XSA-450).
Signed-off-by Jan Beulich <[email protected]>
I'm surprised that's happy compiling if it's actually doing anything at all, given that it's an unguarded variable reference.
Quoted 8 lines · Andrew Cooper
Quoted 5 lines · Jan Beulich
Allow the compiler a little more room on DCE by moving the compile-time- constant condition into the predicate (from the one place where it was added in an open-coded fashion for XSA-450).
Signed-off-by Jan Beulich <[email protected]>Acked-by Andrew Cooper <[email protected]>
Thanks, but ...
Quoted 2 lines
I'm surprised that's happy compiling if it's actually doing anything at all, given that it's an unguarded variable reference.
... I'm afraid I don't understand: What "unguarded variable reference" are you seeing me add? Even if you were talking about the hap_pt_share struct field (which was accessed before as well) - that's part of struct domain_iommu no matter what .config has.
Jan
Quoted 8 lines · Jan Beulich
Quoted 7 lines · Andrew Cooper
Quoted 5 lines · Jan Beulich
Allow the compiler a little more room on DCE by moving the compile-time- constant condition into the predicate (from the one place where it was added in an open-coded fashion for XSA-450).
Signed-off-by Jan Beulich <[email protected]>Acked-by Andrew Cooper <[email protected]>
Quoted 8 lines
Thanks, but ...
Quoted 2 lines
I'm surprised that's happy compiling if it's actually doing anything at all, given that it's an unguarded variable reference.
... I'm afraid I don't understand: What "unguarded variable reference" are you seeing me add? Even if you were talking about the
hap_pt_sharestruct field (which was accessed before as well) - that's part of structdomain_iommuno matter what .config has.
Ah. That will be why it compiles.
Fine.
~Andrew