blob: 8c89cb947cdb29e072f8218afa26601c8ee3ef7c [file] [log] [blame]
Thomas Gleixner45051532019-05-29 16:57:47 -07001/* SPDX-License-Identifier: GPL-2.0-only */
Joerg Roedel736baef2012-03-30 11:47:00 -07002/*
3 * Copyright (C) 2012 Advanced Micro Devices, Inc.
Joerg Roedel63ce3ae2015-02-04 16:12:55 +01004 * Author: Joerg Roedel <jroedel@suse.de>
Joerg Roedel736baef2012-03-30 11:47:00 -07005 *
Joerg Roedel736baef2012-03-30 11:47:00 -07006 * 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 Siddha8a8f4222012-03-30 11:47:08 -070010#ifndef __IRQ_REMAPPING_H
11#define __IRQ_REMAPPING_H
Joerg Roedel736baef2012-03-30 11:47:00 -070012
13#ifdef CONFIG_IRQ_REMAP
14
Joerg Roedel4c1bad62012-03-30 11:47:03 -070015struct irq_data;
Joerg Roedel5e2b9302012-03-30 11:47:05 -070016struct msi_msg;
Jiang Liu947045a2015-04-13 14:11:30 +080017struct irq_domain;
18struct irq_alloc_info;
Joerg Roedel0c3f1732012-03-30 11:47:02 -070019
Neil Horman03bbcb22013-04-16 16:38:32 -040020extern int irq_remap_broken;
Joerg Roedel736baef2012-03-30 11:47:00 -070021extern int disable_sourceid_checking;
22extern int no_x2apic_optout;
Joerg Roedel078e1ee2012-09-26 12:44:43 +020023extern int irq_remapping_enabled;
Joerg Roedel736baef2012-03-30 11:47:00 -070024
Feng Wu3d9b98f2015-06-09 13:20:35 +080025extern int disable_irq_post;
26
Joerg Roedel736baef2012-03-30 11:47:00 -070027struct irq_remap_ops {
Feng Wu6f281922015-06-09 13:20:28 +080028 /* The supported capabilities */
29 int capability;
30
Joerg Roedel736baef2012-03-30 11:47:00 -070031 /* Initializes hardware and makes it ready for remapping interrupts */
Suresh Siddha95a02e92012-03-30 11:47:07 -070032 int (*prepare)(void);
Joerg Roedel736baef2012-03-30 11:47:00 -070033
34 /* Enables the remapping hardware */
Suresh Siddha95a02e92012-03-30 11:47:07 -070035 int (*enable)(void);
Joerg Roedel4f3d8b62012-03-30 11:47:01 -070036
37 /* Disables the remapping hardware */
Suresh Siddha95a02e92012-03-30 11:47:07 -070038 void (*disable)(void);
Joerg Roedel4f3d8b62012-03-30 11:47:01 -070039
40 /* Reenables the remapping hardware */
Suresh Siddha95a02e92012-03-30 11:47:07 -070041 int (*reenable)(int);
Joerg Roedel4f3d8b62012-03-30 11:47:01 -070042
43 /* Enable fault handling */
44 int (*enable_faulting)(void);
Joerg Roedel736baef2012-03-30 11:47:00 -070045};
46
47extern struct irq_remap_ops intel_irq_remap_ops;
Joerg Roedel6b474b82012-06-26 16:46:04 +020048extern struct irq_remap_ops amd_iommu_irq_ops;
Lan Tianyu29217a42019-02-27 22:54:04 +080049extern struct irq_remap_ops hyperv_irq_remap_ops;
Joerg Roedel736baef2012-03-30 11:47:00 -070050
Joerg Roedel05152a02012-06-15 16:53:51 +020051#else /* CONFIG_IRQ_REMAP */
52
53#define irq_remapping_enabled 0
Neil Horman03bbcb22013-04-16 16:38:32 -040054#define irq_remap_broken 0
Feng Wu3d9b98f2015-06-09 13:20:35 +080055#define disable_irq_post 1
Joerg Roedel05152a02012-06-15 16:53:51 +020056
Joerg Roedel736baef2012-03-30 11:47:00 -070057#endif /* CONFIG_IRQ_REMAP */
58
Suresh Siddha8a8f4222012-03-30 11:47:08 -070059#endif /* __IRQ_REMAPPING_H */