2012-03-31 01:47:00 +07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Advanced Micro Devices, Inc.
|
2015-02-04 22:12:55 +07:00
|
|
|
* Author: Joerg Roedel <jroedel@suse.de>
|
2012-03-31 01:47:00 +07:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 as published
|
|
|
|
* by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
* This header file contains stuff that is shared between different interrupt
|
|
|
|
* remapping drivers but with no need to be visible outside of the IOMMU layer.
|
|
|
|
*/
|
|
|
|
|
2012-03-31 01:47:08 +07:00
|
|
|
#ifndef __IRQ_REMAPPING_H
|
|
|
|
#define __IRQ_REMAPPING_H
|
2012-03-31 01:47:00 +07:00
|
|
|
|
|
|
|
#ifdef CONFIG_IRQ_REMAP
|
|
|
|
|
2012-03-31 01:47:03 +07:00
|
|
|
struct irq_data;
|
2012-03-31 01:47:05 +07:00
|
|
|
struct msi_msg;
|
irq_remapping: Introduce new interfaces to support hierarchical irqdomains
Introduce new interfaces for interrupt remapping drivers to support
hierarchical irqdomains:
1) irq_remapping_get_ir_irq_domain(): get irqdomain associated with an
interrupt remapping unit. IOAPIC/HPET drivers use this interface to
get parent interrupt remapping irqdomain.
2) irq_remapping_get_irq_domain(): get irqdomain for an IRQ allocation.
This is mainly used to support MSI irqdomain. We must build one MSI
irqdomain for each interrupt remapping unit. MSI driver calls this
interface to get MSI irqdomain associated with an IR irqdomain which
manages the PCI devices. In a further step we will store the irqdomain
pointer in the device struct to avoid this call in the irq allocation
path.
Architecture specific hooks:
1) arch_get_ir_parent_domain(): get parent irqdomain for IR irqdomain,
which is x86_vector_domain on x86 platforms.
2) arch_create_msi_irq_domain(): create an MSI irqdomain associated with
the interrupt remapping unit.
We also add following callbacks into struct irq_remap_ops:
struct irq_domain *(*get_ir_irq_domain)(struct irq_alloc_info *);
struct irq_domain *(*get_irq_domain)(struct irq_alloc_info *);
Once all clients of IR have been converted to the new hierarchical irqdomain
interfaces, we will:
1) Remove set_ioapic_entry, set_affinity, free_irq, compose_msi_msg,
msi_alloc_irq, msi_setup_irq, setup_hpet_msi from struct remap_osp
2) Remove setup_ioapic_remapped_entry, free_remapped_irq,
compose_remapped_msi_msg, setup_hpet_msi_remapped, setup_remapped_irq.
3) Simplify x86_io_apic_ops and x86_msi.
We can achieve a way clearer architecture with all these changes
applied.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: David Cohen <david.a.cohen@linux.intel.com>
Cc: Sander Eikelenboom <linux@eikelenboom.it>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: iommu@lists.linux-foundation.org
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dimitri Sivanich <sivanich@sgi.com>
Cc: Joerg Roedel <joro@8bytes.org>
Link: http://lkml.kernel.org/r/1428905519-23704-9-git-send-email-jiang.liu@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2015-04-13 13:11:30 +07:00
|
|
|
struct irq_domain;
|
|
|
|
struct irq_alloc_info;
|
2012-03-31 01:47:02 +07:00
|
|
|
|
2013-04-17 03:38:32 +07:00
|
|
|
extern int irq_remap_broken;
|
2012-03-31 01:47:00 +07:00
|
|
|
extern int disable_sourceid_checking;
|
|
|
|
extern int no_x2apic_optout;
|
2012-09-26 17:44:43 +07:00
|
|
|
extern int irq_remapping_enabled;
|
2012-03-31 01:47:00 +07:00
|
|
|
|
2015-06-09 12:20:35 +07:00
|
|
|
extern int disable_irq_post;
|
|
|
|
|
2012-03-31 01:47:00 +07:00
|
|
|
struct irq_remap_ops {
|
2015-06-09 12:20:28 +07:00
|
|
|
/* The supported capabilities */
|
|
|
|
int capability;
|
|
|
|
|
2012-03-31 01:47:00 +07:00
|
|
|
/* Initializes hardware and makes it ready for remapping interrupts */
|
2012-03-31 01:47:07 +07:00
|
|
|
int (*prepare)(void);
|
2012-03-31 01:47:00 +07:00
|
|
|
|
|
|
|
/* Enables the remapping hardware */
|
2012-03-31 01:47:07 +07:00
|
|
|
int (*enable)(void);
|
2012-03-31 01:47:01 +07:00
|
|
|
|
|
|
|
/* Disables the remapping hardware */
|
2012-03-31 01:47:07 +07:00
|
|
|
void (*disable)(void);
|
2012-03-31 01:47:01 +07:00
|
|
|
|
|
|
|
/* Reenables the remapping hardware */
|
2012-03-31 01:47:07 +07:00
|
|
|
int (*reenable)(int);
|
2012-03-31 01:47:01 +07:00
|
|
|
|
|
|
|
/* Enable fault handling */
|
|
|
|
int (*enable_faulting)(void);
|
2012-03-31 01:47:02 +07:00
|
|
|
|
irq_remapping: Introduce new interfaces to support hierarchical irqdomains
Introduce new interfaces for interrupt remapping drivers to support
hierarchical irqdomains:
1) irq_remapping_get_ir_irq_domain(): get irqdomain associated with an
interrupt remapping unit. IOAPIC/HPET drivers use this interface to
get parent interrupt remapping irqdomain.
2) irq_remapping_get_irq_domain(): get irqdomain for an IRQ allocation.
This is mainly used to support MSI irqdomain. We must build one MSI
irqdomain for each interrupt remapping unit. MSI driver calls this
interface to get MSI irqdomain associated with an IR irqdomain which
manages the PCI devices. In a further step we will store the irqdomain
pointer in the device struct to avoid this call in the irq allocation
path.
Architecture specific hooks:
1) arch_get_ir_parent_domain(): get parent irqdomain for IR irqdomain,
which is x86_vector_domain on x86 platforms.
2) arch_create_msi_irq_domain(): create an MSI irqdomain associated with
the interrupt remapping unit.
We also add following callbacks into struct irq_remap_ops:
struct irq_domain *(*get_ir_irq_domain)(struct irq_alloc_info *);
struct irq_domain *(*get_irq_domain)(struct irq_alloc_info *);
Once all clients of IR have been converted to the new hierarchical irqdomain
interfaces, we will:
1) Remove set_ioapic_entry, set_affinity, free_irq, compose_msi_msg,
msi_alloc_irq, msi_setup_irq, setup_hpet_msi from struct remap_osp
2) Remove setup_ioapic_remapped_entry, free_remapped_irq,
compose_remapped_msi_msg, setup_hpet_msi_remapped, setup_remapped_irq.
3) Simplify x86_io_apic_ops and x86_msi.
We can achieve a way clearer architecture with all these changes
applied.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: David Cohen <david.a.cohen@linux.intel.com>
Cc: Sander Eikelenboom <linux@eikelenboom.it>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: iommu@lists.linux-foundation.org
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dimitri Sivanich <sivanich@sgi.com>
Cc: Joerg Roedel <joro@8bytes.org>
Link: http://lkml.kernel.org/r/1428905519-23704-9-git-send-email-jiang.liu@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2015-04-13 13:11:30 +07:00
|
|
|
/* Get the irqdomain associated the IOMMU device */
|
|
|
|
struct irq_domain *(*get_ir_irq_domain)(struct irq_alloc_info *);
|
|
|
|
|
|
|
|
/* Get the MSI irqdomain associated with the IOMMU device */
|
|
|
|
struct irq_domain *(*get_irq_domain)(struct irq_alloc_info *);
|
2012-03-31 01:47:00 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct irq_remap_ops intel_irq_remap_ops;
|
2012-06-26 21:46:04 +07:00
|
|
|
extern struct irq_remap_ops amd_iommu_irq_ops;
|
2012-03-31 01:47:00 +07:00
|
|
|
|
2012-06-15 21:53:51 +07:00
|
|
|
#else /* CONFIG_IRQ_REMAP */
|
|
|
|
|
|
|
|
#define irq_remapping_enabled 0
|
2013-04-17 03:38:32 +07:00
|
|
|
#define irq_remap_broken 0
|
2015-06-09 12:20:35 +07:00
|
|
|
#define disable_irq_post 1
|
2012-06-15 21:53:51 +07:00
|
|
|
|
2012-03-31 01:47:00 +07:00
|
|
|
#endif /* CONFIG_IRQ_REMAP */
|
|
|
|
|
2012-03-31 01:47:08 +07:00
|
|
|
#endif /* __IRQ_REMAPPING_H */
|