Subject: linux-next: manual merge of the tip tree with the iommu tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 9 Jun 2015 16:57:26 +1000

Hi all,

Today's linux-next merge of the tip tree got a conflict in
drivers/iommu/intel_irq_remapping.c between commits 82a09c904f6a
("iommu/vt-d: Load old data structures only in kdump kernel") and
b1e27c302979 ("iommu/vt-d: Move EIM detection to
intel_prepare_irq_remapping") from the iommu tree and commits
b106ee63abcc ("irq_remapping/vt-d: Enhance Intel IR driver to support
hierarchical irqdomains") and 84bea5cc7709 ("x86/irq: Remove
x86_io_apic_ops.print_entries and related interfaces") from the tip
tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    [email-masked]

diff --cc drivers/iommu/intel_irq_remapping.c
index b49aa8cf9d13,8fad71cc27e7..000000000000
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@@ -11,7 -8,7 +11,8 @@@
  #include <linux/irq.h>
  #include <linux/intel-iommu.h>
  #include <linux/acpi.h>
 +#include <linux/crash_dump.h>
+ #include <linux/irqdomain.h>
  #include <asm/io_apic.h>
  #include <asm/smp.h>
  #include <asm/cpu.h>
@@@ -118,9 -98,8 +105,8 @@@ static int alloc_irte(struct intel_iomm
  	index = bitmap_find_free_region(table->bitmap,
  					INTR_REMAP_TABLE_ENTRIES, mask);
  	if (index < 0) {
 -		pr_warn("IR%d: can't allocate an IRTE\n", iommu->seq_id);
 +		pr_warn("Can't allocate an IRTE for IR[%d]\n", iommu->seq_id);
  	} else {
- 		cfg->remapped = 1;
  		irq_iommu->iommu = iommu;
  		irq_iommu->irte_index =  index;
  		irq_iommu->sub_handle = 0;
@@@ -502,10 -413,9 +427,9 @@@ static int intel_setup_irq_remapping(st
  
  	pages = alloc_pages_node(iommu->node, GFP_KERNEL | __GFP_ZERO,
  				 INTR_REMAP_PAGE_ORDER);
- 
  	if (!pages) {
 -		pr_err("IR%d: failed to allocate pages of order %d\n",
 -		       iommu->seq_id, INTR_REMAP_PAGE_ORDER);
 +		pr_err("Failed to allocate pages of order %d for IR[%d]\n",
 +		       INTR_REMAP_PAGE_ORDER, iommu->seq_id);
  		goto out_free_table;
  	}
  
@@@ -519,41 -439,10 +453,43 @@@
  	ir_table->base = page_address(pages);
  	ir_table->bitmap = bitmap;
  	iommu->ir_table = ir_table;
 +
 +	if (!iommu->qi) {
 +		/*
 +		 * Clear previous faults.
 +		 */
 +		dmar_fault(-1, iommu);
 +		dmar_disable_qi(iommu);
 +		if (dmar_enable_qi(iommu)) {
 +			pr_err("Failed to enable queued invalidation\n");
 +			goto out_free_pages;
 +		}
 +	}
 +
 +	iommu_check_pre_ir_status(iommu);
 +
 +	if (!is_kdump_kernel() && iommu->pre_enabled_ir) {
 +		iommu_disable_irq_remapping(iommu);
 +		iommu->pre_enabled_ir = 0;
 +		pr_warn("IRQ remapping was enabled on %s but we are not in kdump mode\n",
 +				iommu->name);
 +	}
 +
 +	if (iommu->pre_enabled_ir) {
 +		if (iommu_load_old_irte(iommu))
 +			pr_err("Failed to copy IR table for %s from previous kernel\n",
 +			       iommu->name);
 +		else
 +			pr_info("Copied IR table for %s from previous kernel\n",
 +				iommu->name);
 +	}
 +
 +	iommu_set_irq_remapping(iommu, eim_mode);
 +
  	return 0;
  
+ out_free_bitmap:
+ 	kfree(bitmap);
  out_free_pages:
  	__free_pages(pages, INTR_REMAP_PAGE_ORDER);
  out_free_table:
@@@ -709,16 -646,9 +653,9 @@@ static int __init intel_enable_irq_rema
  
  	irq_remapping_enabled = 1;
  
- 	/*
- 	 * VT-d has a different layout for IO-APIC entries when
- 	 * interrupt remapping is enabled. So it needs a special routine
- 	 * to print IO-APIC entries for debugging purposes too.
- 	 */
- 	x86_io_apic_ops.print_entries = intel_ir_io_apic_print_entries;
- 
- 	pr_info("Enabled IRQ remapping in %s mode\n", eim_mode ? "x2apic" : "xapic");
+ 	pr_info("Enabled IRQ remapping in %s mode\n", eim ? "x2apic" : "xapic");
  
 -	return eim ? IRQ_REMAP_X2APIC_MODE : IRQ_REMAP_XAPIC_MODE;
 +	return eim_mode ? IRQ_REMAP_X2APIC_MODE : IRQ_REMAP_XAPIC_MODE;
  
  error:
  	intel_cleanup_irq_remapping();