From: Joerg Roedel Date: Thu, 29 Mar 2018 13:24:40 +0000 (+0200) Subject: Merge branches 'x86/amd', 'x86/vt-d', 'arm/rockchip', 'arm/omap', 'arm/mediatek'... X-Git-Tag: v4.19~1223^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d4f96fd5c249defda290299f9646287dd3df0803;p=platform%2Fkernel%2Flinux-rpi.git Merge branches 'x86/amd', 'x86/vt-d', 'arm/rockchip', 'arm/omap', 'arm/mediatek', 'arm/exynos', 'arm/renesas', 'arm/smmu' and 'core' into next --- d4f96fd5c249defda290299f9646287dd3df0803 diff --cc drivers/iommu/amd_iommu.c index 6107e24,74788fd,74788fd,74788fd,74788fd,74788fd,74788fd,74788fd,ecdeb04..8c469b5 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@@@@@@@@@ -3670,36 -3615,55 -3615,55 -3615,55 -3615,55 -3615,55 -3615,55 -3615,55 -3615,55 +3670,36 @@@@@@@@@@ static struct irq_remap_table *alloc_ir alias = amd_iommu_alias_table[devid]; table = irq_lookup_table[alias]; if (table) { -------- irq_lookup_table[devid] = table; -------- set_dte_irq_entry(devid, table); -------- iommu_flush_dte(iommu, devid); -------- goto out; ++++++++ set_remap_table_entry(iommu, devid, table); ++++++++ goto out_wait; } ++++++++ spin_unlock_irqrestore(&iommu_table_lock, flags); /* Nothing there yet, allocate new irq remapping table */ -------- table = kzalloc(sizeof(*table), GFP_ATOMIC); -------- if (!table) -------- goto out_unlock; -------- -------- /* Initialize table spin-lock */ -------- spin_lock_init(&table->lock); ++++++++ new_table = __alloc_irq_table(); ++++++++ if (!new_table) ++++++++ return NULL; -------- if (ioapic) -------- /* Keep the first 32 indexes free for IOAPIC interrupts */ -------- table->min_index = 32; ++++++++ spin_lock_irqsave(&iommu_table_lock, flags); -------- table->table = kmem_cache_alloc(amd_iommu_irq_cache, GFP_ATOMIC); -------- if (!table->table) { -------- kfree(table); -------- table = NULL; ++++++++ table = irq_lookup_table[devid]; ++++++++ if (table) goto out_unlock; -------- } - - if (!AMD_IOMMU_GUEST_IR_GA(amd_iommu_guest_ir)) - memset(table->table, 0, - MAX_IRQS_PER_TABLE * sizeof(u32)); - else - memset(table->table, 0, - (MAX_IRQS_PER_TABLE * (sizeof(u64) * 2))); ------- if (!AMD_IOMMU_GUEST_IR_GA(amd_iommu_guest_ir)) ------- memset(table->table, 0, ------- MAX_IRQS_PER_TABLE * sizeof(u32)); ------- else ------- memset(table->table, 0, ------- (MAX_IRQS_PER_TABLE * (sizeof(u64) * 2))); ------- -------- if (ioapic) { -------- int i; -------- -------- for (i = 0; i < 32; ++i) -------- iommu->irte_ops->set_allocated(table, i); ++++++++ table = irq_lookup_table[alias]; ++++++++ if (table) { ++++++++ set_remap_table_entry(iommu, devid, table); ++++++++ goto out_wait; } -------- irq_lookup_table[devid] = table; -------- set_dte_irq_entry(devid, table); -------- iommu_flush_dte(iommu, devid); -------- if (devid != alias) { -------- irq_lookup_table[alias] = table; -------- set_dte_irq_entry(alias, table); -------- iommu_flush_dte(iommu, alias); -------- } ++++++++ table = new_table; ++++++++ new_table = NULL; --------out: ++++++++ set_remap_table_entry(iommu, devid, table); ++++++++ if (devid != alias) ++++++++ set_remap_table_entry(iommu, alias, table); ++++++++ ++++++++out_wait: iommu_completion_wait(iommu); out_unlock: