Thomas Gleixner | 4505153 | 2019-05-29 16:57:47 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2012 Advanced Micro Devices, Inc. |
Joerg Roedel | 63ce3ae | 2015-02-04 16:12:55 +0100 | [diff] [blame] | 4 | * Author: Joerg Roedel <jroedel@suse.de> |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 5 | * |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 6 | * This header file contains stuff that is shared between different interrupt |
| 7 | * remapping drivers but with no need to be visible outside of the IOMMU layer. |
| 8 | */ |
| 9 | |
Suresh Siddha | 8a8f422 | 2012-03-30 11:47:08 -0700 | [diff] [blame] | 10 | #ifndef __IRQ_REMAPPING_H |
| 11 | #define __IRQ_REMAPPING_H |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 12 | |
| 13 | #ifdef CONFIG_IRQ_REMAP |
| 14 | |
Joerg Roedel | 4c1bad6 | 2012-03-30 11:47:03 -0700 | [diff] [blame] | 15 | struct irq_data; |
Joerg Roedel | 5e2b930 | 2012-03-30 11:47:05 -0700 | [diff] [blame] | 16 | struct msi_msg; |
Jiang Liu | 947045a | 2015-04-13 14:11:30 +0800 | [diff] [blame] | 17 | struct irq_domain; |
| 18 | struct irq_alloc_info; |
Joerg Roedel | 0c3f173 | 2012-03-30 11:47:02 -0700 | [diff] [blame] | 19 | |
Neil Horman | 03bbcb2 | 2013-04-16 16:38:32 -0400 | [diff] [blame] | 20 | extern int irq_remap_broken; |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 21 | extern int disable_sourceid_checking; |
| 22 | extern int no_x2apic_optout; |
Joerg Roedel | 078e1ee | 2012-09-26 12:44:43 +0200 | [diff] [blame] | 23 | extern int irq_remapping_enabled; |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 24 | |
Feng Wu | 3d9b98f | 2015-06-09 13:20:35 +0800 | [diff] [blame] | 25 | extern int disable_irq_post; |
| 26 | |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 27 | struct irq_remap_ops { |
Feng Wu | 6f28192 | 2015-06-09 13:20:28 +0800 | [diff] [blame] | 28 | /* The supported capabilities */ |
| 29 | int capability; |
| 30 | |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 31 | /* Initializes hardware and makes it ready for remapping interrupts */ |
Suresh Siddha | 95a02e9 | 2012-03-30 11:47:07 -0700 | [diff] [blame] | 32 | int (*prepare)(void); |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 33 | |
| 34 | /* Enables the remapping hardware */ |
Suresh Siddha | 95a02e9 | 2012-03-30 11:47:07 -0700 | [diff] [blame] | 35 | int (*enable)(void); |
Joerg Roedel | 4f3d8b6 | 2012-03-30 11:47:01 -0700 | [diff] [blame] | 36 | |
| 37 | /* Disables the remapping hardware */ |
Suresh Siddha | 95a02e9 | 2012-03-30 11:47:07 -0700 | [diff] [blame] | 38 | void (*disable)(void); |
Joerg Roedel | 4f3d8b6 | 2012-03-30 11:47:01 -0700 | [diff] [blame] | 39 | |
| 40 | /* Reenables the remapping hardware */ |
Suresh Siddha | 95a02e9 | 2012-03-30 11:47:07 -0700 | [diff] [blame] | 41 | int (*reenable)(int); |
Joerg Roedel | 4f3d8b6 | 2012-03-30 11:47:01 -0700 | [diff] [blame] | 42 | |
| 43 | /* Enable fault handling */ |
| 44 | int (*enable_faulting)(void); |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | extern struct irq_remap_ops intel_irq_remap_ops; |
Joerg Roedel | 6b474b8 | 2012-06-26 16:46:04 +0200 | [diff] [blame] | 48 | extern struct irq_remap_ops amd_iommu_irq_ops; |
Lan Tianyu | 29217a4 | 2019-02-27 22:54:04 +0800 | [diff] [blame] | 49 | extern struct irq_remap_ops hyperv_irq_remap_ops; |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 50 | |
Joerg Roedel | 05152a0 | 2012-06-15 16:53:51 +0200 | [diff] [blame] | 51 | #else /* CONFIG_IRQ_REMAP */ |
| 52 | |
| 53 | #define irq_remapping_enabled 0 |
Neil Horman | 03bbcb2 | 2013-04-16 16:38:32 -0400 | [diff] [blame] | 54 | #define irq_remap_broken 0 |
Feng Wu | 3d9b98f | 2015-06-09 13:20:35 +0800 | [diff] [blame] | 55 | #define disable_irq_post 1 |
Joerg Roedel | 05152a0 | 2012-06-15 16:53:51 +0200 | [diff] [blame] | 56 | |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 57 | #endif /* CONFIG_IRQ_REMAP */ |
| 58 | |
Suresh Siddha | 8a8f422 | 2012-03-30 11:47:08 -0700 | [diff] [blame] | 59 | #endif /* __IRQ_REMAPPING_H */ |