iommu/vt-d: Convert missing apic.c intr-remapping call to remap_ops

Convert these calls too:

	* Disable of remapping hardware
	* Reenable of remapping hardware
	* Enable fault handling

With that all of arch/x86/kernel/apic/apic.c is converted to
use the generic intr-remapping interface.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
This commit is contained in:
Joerg Roedel 2012-03-30 11:47:01 -07:00
parent 736baef447
commit 4f3d8b67ad
6 changed files with 47 additions and 23 deletions

View File

@ -30,6 +30,9 @@ extern void setup_intr_remapping(void);
extern int intr_remapping_supported(void); extern int intr_remapping_supported(void);
extern int intr_hardware_init(void); extern int intr_hardware_init(void);
extern int intr_hardware_enable(void); extern int intr_hardware_enable(void);
extern void intr_hardware_disable(void);
extern int intr_hardware_reenable(int);
extern int intr_enable_fault_handling(void);
#else /* CONFIG_IRQ_REMAP */ #else /* CONFIG_IRQ_REMAP */
@ -39,6 +42,9 @@ static inline void setup_intr_remapping(void) { }
static inline int intr_remapping_supported(void) { return 0; } static inline int intr_remapping_supported(void) { return 0; }
static inline int intr_hardware_init(void) { return -ENODEV; } static inline int intr_hardware_init(void) { return -ENODEV; }
static inline int intr_hardware_enable(void) { return -ENODEV; } static inline int intr_hardware_enable(void) { return -ENODEV; }
static inline void intr_hardware_disable(void) { }
static inline int intr_hardware_reenable(int eim) { return -ENODEV; }
static inline int intr_enable_fault_handling(void) { return -ENODEV; }
#endif /* CONFIG_IRQ_REMAP */ #endif /* CONFIG_IRQ_REMAP */

View File

@ -1443,7 +1443,7 @@ void __init bsp_end_local_APIC_setup(void)
* handling for interrupt remapping. * handling for interrupt remapping.
*/ */
if (intr_remapping_enabled) if (intr_remapping_enabled)
enable_drhd_fault_handling(); intr_enable_fault_handling();
} }
@ -2181,7 +2181,7 @@ static int lapic_suspend(void)
disable_local_APIC(); disable_local_APIC();
if (intr_remapping_enabled) if (intr_remapping_enabled)
disable_intr_remapping(); intr_hardware_disable();
local_irq_restore(flags); local_irq_restore(flags);
return 0; return 0;
@ -2250,7 +2250,7 @@ static void lapic_resume(void)
apic_read(APIC_ESR); apic_read(APIC_ESR);
if (intr_remapping_enabled) if (intr_remapping_enabled)
reenable_intr_remapping(x2apic_mode); intr_hardware_reenable(x2apic_mode);
local_irq_restore(flags); local_irq_restore(flags);
} }

View File

@ -764,7 +764,7 @@ int __init ir_dev_scope_init(void)
} }
rootfs_initcall(ir_dev_scope_init); rootfs_initcall(ir_dev_scope_init);
void disable_intr_remapping(void) static void disable_intr_remapping(void)
{ {
struct dmar_drhd_unit *drhd; struct dmar_drhd_unit *drhd;
struct intel_iommu *iommu = NULL; struct intel_iommu *iommu = NULL;
@ -780,7 +780,7 @@ void disable_intr_remapping(void)
} }
} }
int reenable_intr_remapping(int eim) static int reenable_intr_remapping(int eim)
{ {
struct dmar_drhd_unit *drhd; struct dmar_drhd_unit *drhd;
int setup = 0; int setup = 0;
@ -818,4 +818,7 @@ struct irq_remap_ops intel_irq_remap_ops = {
.supported = intel_intr_remapping_supported, .supported = intel_intr_remapping_supported,
.hardware_init = dmar_table_init, .hardware_init = dmar_table_init,
.hardware_enable = intel_enable_intr_remapping, .hardware_enable = intel_enable_intr_remapping,
.hardware_disable = disable_intr_remapping,
.hardware_reenable = reenable_intr_remapping,
.enable_faulting = enable_drhd_fault_handling,
}; };

View File

@ -74,3 +74,27 @@ int __init intr_hardware_enable(void)
return remap_ops->hardware_enable(); return remap_ops->hardware_enable();
} }
void intr_hardware_disable(void)
{
if (!remap_ops || !remap_ops->hardware_disable)
return;
remap_ops->hardware_disable();
}
int intr_hardware_reenable(int mode)
{
if (!remap_ops || !remap_ops->hardware_reenable)
return 0;
return remap_ops->hardware_reenable(mode);
}
int __init intr_enable_fault_handling(void)
{
if (!remap_ops || !remap_ops->enable_faulting)
return -ENODEV;
return remap_ops->enable_faulting();
}

View File

@ -37,6 +37,15 @@ struct irq_remap_ops {
/* Enables the remapping hardware */ /* Enables the remapping hardware */
int (*hardware_enable)(void); int (*hardware_enable)(void);
/* Disables the remapping hardware */
void (*hardware_disable)(void);
/* Reenables the remapping hardware */
int (*hardware_reenable)(int);
/* Enable fault handling */
int (*enable_faulting)(void);
}; };
extern struct irq_remap_ops intel_irq_remap_ops; extern struct irq_remap_ops intel_irq_remap_ops;

View File

@ -115,9 +115,6 @@ struct irte {
}; };
#ifdef CONFIG_IRQ_REMAP #ifdef CONFIG_IRQ_REMAP
extern void disable_intr_remapping(void);
extern int reenable_intr_remapping(int);
extern int get_irte(int irq, struct irte *entry); extern int get_irte(int irq, struct irte *entry);
extern int modify_irte(int irq, struct irte *irte_modified); extern int modify_irte(int irq, struct irte *irte_modified);
extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count); extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count);
@ -179,21 +176,6 @@ static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev)
return 0; return 0;
} }
#define intr_remapping_enabled (0)
static inline int enable_intr_remapping(void)
{
return -1;
}
static inline void disable_intr_remapping(void)
{
}
static inline int reenable_intr_remapping(int eim)
{
return 0;
}
#endif #endif
enum { enum {