2019-05-30 07:57:47 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2012-03-31 02:47:00 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Advanced Micro Devices, Inc.
|
2015-02-04 23:12:55 +08:00
|
|
|
* Author: Joerg Roedel <jroedel@suse.de>
|
2012-03-31 02:47:00 +08:00
|
|
|
*
|
|
|
|
* 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 02:47:08 +08:00
|
|
|
#ifndef __IRQ_REMAPPING_H
|
|
|
|
#define __IRQ_REMAPPING_H
|
2012-03-31 02:47:00 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_IRQ_REMAP
|
|
|
|
|
2012-03-31 02:47:03 +08:00
|
|
|
struct irq_data;
|
2012-03-31 02:47:05 +08: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 14:11:30 +08:00
|
|
|
struct irq_domain;
|
|
|
|
struct irq_alloc_info;
|
2012-03-31 02:47:02 +08:00
|
|
|
|
2013-04-17 04:38:32 +08:00
|
|
|
extern int irq_remap_broken;
|
2012-03-31 02:47:00 +08:00
|
|
|
extern int disable_sourceid_checking;
|
|
|
|
extern int no_x2apic_optout;
|
2012-09-26 18:44:43 +08:00
|
|
|
extern int irq_remapping_enabled;
|
2012-03-31 02:47:00 +08:00
|
|
|
|
2015-06-09 13:20:35 +08:00
|
|
|
extern int disable_irq_post;
|
|
|
|
|
2012-03-31 02:47:00 +08:00
|
|
|
struct irq_remap_ops {
|
2015-06-09 13:20:28 +08:00
|
|
|
/* The supported capabilities */
|
|
|
|
int capability;
|
|
|
|
|
2012-03-31 02:47:00 +08:00
|
|
|
/* Initializes hardware and makes it ready for remapping interrupts */
|
2012-03-31 02:47:07 +08:00
|
|
|
int (*prepare)(void);
|
2012-03-31 02:47:00 +08:00
|
|
|
|
|
|
|
/* Enables the remapping hardware */
|
2012-03-31 02:47:07 +08:00
|
|
|
int (*enable)(void);
|
2012-03-31 02:47:01 +08:00
|
|
|
|
|
|
|
/* Disables the remapping hardware */
|
2012-03-31 02:47:07 +08:00
|
|
|
void (*disable)(void);
|
2012-03-31 02:47:01 +08:00
|
|
|
|
|
|
|
/* Reenables the remapping hardware */
|
2012-03-31 02:47:07 +08:00
|
|
|
int (*reenable)(int);
|
2012-03-31 02:47:01 +08:00
|
|
|
|
|
|
|
/* Enable fault handling */
|
|
|
|
int (*enable_faulting)(void);
|
2012-03-31 02:47:02 +08: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 14:11:30 +08: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 02:47:00 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct irq_remap_ops intel_irq_remap_ops;
|
2012-06-26 22:46:04 +08:00
|
|
|
extern struct irq_remap_ops amd_iommu_irq_ops;
|
2019-02-27 22:54:04 +08:00
|
|
|
extern struct irq_remap_ops hyperv_irq_remap_ops;
|
2012-03-31 02:47:00 +08:00
|
|
|
|
2012-06-15 22:53:51 +08:00
|
|
|
#else /* CONFIG_IRQ_REMAP */
|
|
|
|
|
|
|
|
#define irq_remapping_enabled 0
|
2013-04-17 04:38:32 +08:00
|
|
|
#define irq_remap_broken 0
|
2015-06-09 13:20:35 +08:00
|
|
|
#define disable_irq_post 1
|
2012-06-15 22:53:51 +08:00
|
|
|
|
2012-03-31 02:47:00 +08:00
|
|
|
#endif /* CONFIG_IRQ_REMAP */
|
|
|
|
|
2012-03-31 02:47:08 +08:00
|
|
|
#endif /* __IRQ_REMAPPING_H */
|