[1/4] x86: move a check out of pci_xen_swiotlb_init
Commit Message
Move the exact checks when to initialize the Xen swiotlb code out
of pci_xen_swiotlb_init and into the caller so that is uses readable
positive checks, rather than negative ones that will get even more
confusing with another addition.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/x86/kernel/pci-dma.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
@@ -74,8 +74,6 @@ static inline void __init pci_swiotlb_detect(void)
#ifdef CONFIG_SWIOTLB_XEN
static void __init pci_xen_swiotlb_init(void)
{
- if (!xen_initial_domain() && !x86_swiotlb_enable)
- return;
x86_swiotlb_enable = true;
x86_swiotlb_flags |= SWIOTLB_ANY;
swiotlb_init_remap(true, x86_swiotlb_flags, xen_swiotlb_fixup);
@@ -113,7 +111,8 @@ static inline void __init pci_xen_swiotlb_init(void)
void __init pci_iommu_alloc(void)
{
if (xen_pv_domain()) {
- pci_xen_swiotlb_init();
+ if (xen_initial_domain() || x86_swiotlb_enable)
+ pci_xen_swiotlb_init();
return;
}
pci_swiotlb_detect();