Commit 959c870f authored by Feng Wu's avatar Feng Wu Committed by Thomas Gleixner

iommu, x86: Provide irq_remapping_cap() interface

Add a new interface irq_remapping_cap() to detect whether irq
remapping supports new features, such as VT-d Posted-Interrupts.

Export the function, so that KVM code can check this and use this
mechanism properly.
Signed-off-by: default avatarFeng Wu <feng.wu@intel.com>
Reviewed-by: default avatarJiang Liu <jiang.liu@linux.intel.com>
Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarJoerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org
Cc: dwmw2@infradead.org
Link: http://lkml.kernel.org/r/1433827237-3382-10-git-send-email-feng.wu@intel.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 3d9b98f4
...@@ -35,6 +35,7 @@ enum irq_remap_cap { ...@@ -35,6 +35,7 @@ enum irq_remap_cap {
#ifdef CONFIG_IRQ_REMAP #ifdef CONFIG_IRQ_REMAP
extern bool irq_remapping_cap(enum irq_remap_cap cap);
extern void set_irq_remapping_broken(void); extern void set_irq_remapping_broken(void);
extern int irq_remapping_prepare(void); extern int irq_remapping_prepare(void);
extern int irq_remapping_enable(void); extern int irq_remapping_enable(void);
...@@ -64,6 +65,7 @@ struct vcpu_data { ...@@ -64,6 +65,7 @@ struct vcpu_data {
#else /* CONFIG_IRQ_REMAP */ #else /* CONFIG_IRQ_REMAP */
static inline bool irq_remapping_cap(enum irq_remap_cap cap) { return 0; }
static inline void set_irq_remapping_broken(void) { } static inline void set_irq_remapping_broken(void) { }
static inline int irq_remapping_prepare(void) { return -ENODEV; } static inline int irq_remapping_prepare(void) { return -ENODEV; }
static inline int irq_remapping_enable(void) { return -ENODEV; } static inline int irq_remapping_enable(void) { return -ENODEV; }
......
...@@ -81,6 +81,15 @@ void set_irq_remapping_broken(void) ...@@ -81,6 +81,15 @@ void set_irq_remapping_broken(void)
irq_remap_broken = 1; irq_remap_broken = 1;
} }
bool irq_remapping_cap(enum irq_remap_cap cap)
{
if (!remap_ops || disable_irq_post)
return 0;
return (remap_ops->capability & (1 << cap));
}
EXPORT_SYMBOL_GPL(irq_remapping_cap);
int __init irq_remapping_prepare(void) int __init irq_remapping_prepare(void)
{ {
if (disable_irq_remap) if (disable_irq_remap)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment