Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9b6025b authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge tag 'ioapic-cleanups-for-tip' of...

Merge tag 'ioapic-cleanups-for-tip' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu

 into x86/apic

Pull "x86 IOAPIC code from interrupt remapping details cleanups" from
Joerg Roedel:

 "These patches move all interrupt remapping specific checks out of the
  x86 core code and replaces the respective call-sites with function
  pointers. As a result the interrupt remapping code is better abstraced
  from x86 core interrupt handling code.

  The code was rebased to v3.8-rc4 and tested on systems with AMD-Vi and
  Intel VT-d (both capable of interrupt remapping). The systems were
  tested with IOMMU enabled and with IOMMU disabled. No issues were found."

Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 3b4a5058 a1bb20c2
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -80,9 +80,9 @@ extern void hpet_msi_write(struct hpet_dev *hdev, struct msi_msg *msg);
extern void hpet_msi_read(struct hpet_dev *hdev, struct msi_msg *msg);
extern void hpet_msi_read(struct hpet_dev *hdev, struct msi_msg *msg);


#ifdef CONFIG_PCI_MSI
#ifdef CONFIG_PCI_MSI
extern int arch_setup_hpet_msi(unsigned int irq, unsigned int id);
extern int default_setup_hpet_msi(unsigned int irq, unsigned int id);
#else
#else
static inline int arch_setup_hpet_msi(unsigned int irq, unsigned int id)
static inline int default_setup_hpet_msi(unsigned int irq, unsigned int id)
{
{
	return -EINVAL;
	return -EINVAL;
}
}
@@ -111,6 +111,7 @@ extern void hpet_unregister_irq_handler(rtc_irq_handler handler);
static inline int hpet_enable(void) { return 0; }
static inline int hpet_enable(void) { return 0; }
static inline int is_hpet_enabled(void) { return 0; }
static inline int is_hpet_enabled(void) { return 0; }
#define hpet_readl(a) 0
#define hpet_readl(a) 0
#define default_setup_hpet_msi	NULL


#endif
#endif
#endif /* _ASM_X86_HPET_H */
#endif /* _ASM_X86_HPET_H */
+12 −1
Original line number Original line Diff line number Diff line
@@ -101,6 +101,7 @@ static inline void set_io_apic_irq_attr(struct io_apic_irq_attr *irq_attr,
	irq_attr->polarity	= polarity;
	irq_attr->polarity	= polarity;
}
}


/* Intel specific interrupt remapping information */
struct irq_2_iommu {
struct irq_2_iommu {
	struct intel_iommu *iommu;
	struct intel_iommu *iommu;
	u16 irte_index;
	u16 irte_index;
@@ -108,6 +109,12 @@ struct irq_2_iommu {
	u8  irte_mask;
	u8  irte_mask;
};
};


/* AMD specific interrupt remapping information */
struct irq_2_irte {
	u16 devid; /* Device ID for IRTE table */
	u16 index; /* Index into IRTE table*/
};

/*
/*
 * This is performance-critical, we want to do it O(1)
 * This is performance-critical, we want to do it O(1)
 *
 *
@@ -120,7 +127,11 @@ struct irq_cfg {
	u8			vector;
	u8			vector;
	u8			move_in_progress : 1;
	u8			move_in_progress : 1;
#ifdef CONFIG_IRQ_REMAP
#ifdef CONFIG_IRQ_REMAP
	u8			remapped : 1;
	union {
		struct irq_2_iommu irq_2_iommu;
		struct irq_2_iommu irq_2_iommu;
		struct irq_2_irte  irq_2_irte;
	};
#endif
#endif
};
};


+28 −0
Original line number Original line Diff line number Diff line
@@ -144,11 +144,24 @@ extern int timer_through_8259;
	(mp_irq_entries && !skip_ioapic_setup && io_apic_irqs)
	(mp_irq_entries && !skip_ioapic_setup && io_apic_irqs)


struct io_apic_irq_attr;
struct io_apic_irq_attr;
struct irq_cfg;
extern int io_apic_set_pci_routing(struct device *dev, int irq,
extern int io_apic_set_pci_routing(struct device *dev, int irq,
		 struct io_apic_irq_attr *irq_attr);
		 struct io_apic_irq_attr *irq_attr);
void setup_IO_APIC_irq_extra(u32 gsi);
void setup_IO_APIC_irq_extra(u32 gsi);
extern void ioapic_insert_resources(void);
extern void ioapic_insert_resources(void);


extern int native_setup_ioapic_entry(int, struct IO_APIC_route_entry *,
				     unsigned int, int,
				     struct io_apic_irq_attr *);
extern int native_setup_ioapic_entry(int, struct IO_APIC_route_entry *,
				     unsigned int, int,
				     struct io_apic_irq_attr *);
extern void eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg);

extern void native_compose_msi_msg(struct pci_dev *pdev,
				   unsigned int irq, unsigned int dest,
				   struct msi_msg *msg, u8 hpet_id);
extern void native_eoi_ioapic_pin(int apic, int pin, int vector);
int io_apic_setup_irq_pin_once(unsigned int irq, int node, struct io_apic_irq_attr *attr);
int io_apic_setup_irq_pin_once(unsigned int irq, int node, struct io_apic_irq_attr *attr);


extern int save_ioapic_entries(void);
extern int save_ioapic_entries(void);
@@ -179,6 +192,12 @@ extern void __init native_io_apic_init_mappings(void);
extern unsigned int native_io_apic_read(unsigned int apic, unsigned int reg);
extern unsigned int native_io_apic_read(unsigned int apic, unsigned int reg);
extern void native_io_apic_write(unsigned int apic, unsigned int reg, unsigned int val);
extern void native_io_apic_write(unsigned int apic, unsigned int reg, unsigned int val);
extern void native_io_apic_modify(unsigned int apic, unsigned int reg, unsigned int val);
extern void native_io_apic_modify(unsigned int apic, unsigned int reg, unsigned int val);
extern void native_disable_io_apic(void);
extern void native_io_apic_print_entries(unsigned int apic, unsigned int nr_entries);
extern void intel_ir_io_apic_print_entries(unsigned int apic, unsigned int nr_entries);
extern int native_ioapic_set_affinity(struct irq_data *,
				      const struct cpumask *,
				      bool);


static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
{
{
@@ -193,6 +212,9 @@ static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned
{
{
	x86_io_apic_ops.modify(apic, reg, value);
	x86_io_apic_ops.modify(apic, reg, value);
}
}

extern void io_apic_eoi(unsigned int apic, unsigned int vector);

#else  /* !CONFIG_X86_IO_APIC */
#else  /* !CONFIG_X86_IO_APIC */


#define io_apic_assign_pci_irqs 0
#define io_apic_assign_pci_irqs 0
@@ -223,6 +245,12 @@ static inline void disable_ioapic_support(void) { }
#define native_io_apic_read		NULL
#define native_io_apic_read		NULL
#define native_io_apic_write		NULL
#define native_io_apic_write		NULL
#define native_io_apic_modify		NULL
#define native_io_apic_modify		NULL
#define native_disable_io_apic		NULL
#define native_io_apic_print_entries	NULL
#define native_ioapic_set_affinity	NULL
#define native_setup_ioapic_entry	NULL
#define native_compose_msi_msg		NULL
#define native_eoi_ioapic_pin		NULL
#endif
#endif


#endif /* _ASM_X86_IO_APIC_H */
#endif /* _ASM_X86_IO_APIC_H */
+18 −22
Original line number Original line Diff line number Diff line
@@ -26,8 +26,6 @@


#ifdef CONFIG_IRQ_REMAP
#ifdef CONFIG_IRQ_REMAP


extern int irq_remapping_enabled;

extern void setup_irq_remapping_ops(void);
extern void setup_irq_remapping_ops(void);
extern int irq_remapping_supported(void);
extern int irq_remapping_supported(void);
extern int irq_remapping_prepare(void);
extern int irq_remapping_prepare(void);
@@ -40,21 +38,19 @@ extern int setup_ioapic_remapped_entry(int irq,
				       unsigned int destination,
				       unsigned int destination,
				       int vector,
				       int vector,
				       struct io_apic_irq_attr *attr);
				       struct io_apic_irq_attr *attr);
extern int set_remapped_irq_affinity(struct irq_data *data,
				     const struct cpumask *mask,
				     bool force);
extern void free_remapped_irq(int irq);
extern void free_remapped_irq(int irq);
extern void compose_remapped_msi_msg(struct pci_dev *pdev,
extern void compose_remapped_msi_msg(struct pci_dev *pdev,
				     unsigned int irq, unsigned int dest,
				     unsigned int irq, unsigned int dest,
				     struct msi_msg *msg, u8 hpet_id);
				     struct msi_msg *msg, u8 hpet_id);
extern int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, int nvec);
extern int msi_setup_remapped_irq(struct pci_dev *pdev, unsigned int irq,
				  int index, int sub_handle);
extern int setup_hpet_msi_remapped(unsigned int irq, unsigned int id);
extern int setup_hpet_msi_remapped(unsigned int irq, unsigned int id);
extern void panic_if_irq_remap(const char *msg);
extern bool setup_remapped_irq(int irq,
			       struct irq_cfg *cfg,
			       struct irq_chip *chip);


#else  /* CONFIG_IRQ_REMAP */
void irq_remap_modify_chip_defaults(struct irq_chip *chip);


#define irq_remapping_enabled	0
#else  /* CONFIG_IRQ_REMAP */


static inline void setup_irq_remapping_ops(void) { }
static inline void setup_irq_remapping_ops(void) { }
static inline int irq_remapping_supported(void) { return 0; }
static inline int irq_remapping_supported(void) { return 0; }
@@ -71,30 +67,30 @@ static inline int setup_ioapic_remapped_entry(int irq,
{
{
	return -ENODEV;
	return -ENODEV;
}
}
static inline int set_remapped_irq_affinity(struct irq_data *data,
					    const struct cpumask *mask,
					    bool force)
{
	return 0;
}
static inline void free_remapped_irq(int irq) { }
static inline void free_remapped_irq(int irq) { }
static inline void compose_remapped_msi_msg(struct pci_dev *pdev,
static inline void compose_remapped_msi_msg(struct pci_dev *pdev,
					    unsigned int irq, unsigned int dest,
					    unsigned int irq, unsigned int dest,
					    struct msi_msg *msg, u8 hpet_id)
					    struct msi_msg *msg, u8 hpet_id)
{
{
}
}
static inline int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, int nvec)
static inline int setup_hpet_msi_remapped(unsigned int irq, unsigned int id)
{
{
	return -ENODEV;
	return -ENODEV;
}
}
static inline int msi_setup_remapped_irq(struct pci_dev *pdev, unsigned int irq,

					 int index, int sub_handle)
static inline void panic_if_irq_remap(const char *msg)
{
}

static inline void irq_remap_modify_chip_defaults(struct irq_chip *chip)
{
{
	return -ENODEV;
}
}
static inline int setup_hpet_msi_remapped(unsigned int irq, unsigned int id)

static inline bool setup_remapped_irq(int irq,
				      struct irq_cfg *cfg,
				      struct irq_chip *chip)
{
{
	return -ENODEV;
	return false;
}
}
#endif /* CONFIG_IRQ_REMAP */
#endif /* CONFIG_IRQ_REMAP */


+3 −0
Original line number Original line Diff line number Diff line
@@ -121,9 +121,12 @@ static inline void x86_restore_msi_irqs(struct pci_dev *dev, int irq)
#define arch_teardown_msi_irq x86_teardown_msi_irq
#define arch_teardown_msi_irq x86_teardown_msi_irq
#define arch_restore_msi_irqs x86_restore_msi_irqs
#define arch_restore_msi_irqs x86_restore_msi_irqs
/* implemented in arch/x86/kernel/apic/io_apic. */
/* implemented in arch/x86/kernel/apic/io_apic. */
struct msi_desc;
int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
void native_teardown_msi_irq(unsigned int irq);
void native_teardown_msi_irq(unsigned int irq);
void native_restore_msi_irqs(struct pci_dev *dev, int irq);
void native_restore_msi_irqs(struct pci_dev *dev, int irq);
int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
		  unsigned int irq_base, unsigned int irq_offset);
/* default to the implementation in drivers/lib/msi.c */
/* default to the implementation in drivers/lib/msi.c */
#define HAVE_DEFAULT_MSI_TEARDOWN_IRQS
#define HAVE_DEFAULT_MSI_TEARDOWN_IRQS
#define HAVE_DEFAULT_MSI_RESTORE_IRQS
#define HAVE_DEFAULT_MSI_RESTORE_IRQS
Loading