^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2012 Advanced Micro Devices, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Author: Joerg Roedel <jroedel@suse.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * This header file contains stuff that is shared between different interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * remapping drivers but with no need to be visible outside of the IOMMU layer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifndef __IRQ_REMAPPING_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define __IRQ_REMAPPING_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #ifdef CONFIG_IRQ_REMAP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct irq_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct msi_msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct irq_domain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct irq_alloc_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) extern int irq_remap_broken;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) extern int disable_sourceid_checking;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) extern int no_x2apic_optout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) extern int irq_remapping_enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) extern int disable_irq_post;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct irq_remap_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /* The supported capabilities */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) int capability;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /* Initializes hardware and makes it ready for remapping interrupts */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) int (*prepare)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* Enables the remapping hardware */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) int (*enable)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /* Disables the remapping hardware */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) void (*disable)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* Reenables the remapping hardware */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) int (*reenable)(int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) /* Enable fault handling */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) int (*enable_faulting)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) /* Get the irqdomain associated to IOMMU device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct irq_domain *(*get_irq_domain)(struct irq_alloc_info *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) extern struct irq_remap_ops intel_irq_remap_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) extern struct irq_remap_ops amd_iommu_irq_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) extern struct irq_remap_ops hyperv_irq_remap_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #else /* CONFIG_IRQ_REMAP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define irq_remapping_enabled 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #define irq_remap_broken 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #define disable_irq_post 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #endif /* CONFIG_IRQ_REMAP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #endif /* __IRQ_REMAPPING_H */