162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2012 Advanced Micro Devices, Inc.
462306a36Sopenharmony_ci * Author: Joerg Roedel <jroedel@suse.de>
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * This header file contains stuff that is shared between different interrupt
762306a36Sopenharmony_ci * remapping drivers but with no need to be visible outside of the IOMMU layer.
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#ifndef __IRQ_REMAPPING_H
1162306a36Sopenharmony_ci#define __IRQ_REMAPPING_H
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#ifdef CONFIG_IRQ_REMAP
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cistruct irq_data;
1662306a36Sopenharmony_cistruct msi_msg;
1762306a36Sopenharmony_cistruct irq_domain;
1862306a36Sopenharmony_cistruct irq_alloc_info;
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ciextern int irq_remap_broken;
2162306a36Sopenharmony_ciextern int disable_sourceid_checking;
2262306a36Sopenharmony_ciextern int no_x2apic_optout;
2362306a36Sopenharmony_ciextern int irq_remapping_enabled;
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ciextern int disable_irq_post;
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_cistruct irq_remap_ops {
2862306a36Sopenharmony_ci	/* The supported capabilities */
2962306a36Sopenharmony_ci	int capability;
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci	/* Initializes hardware and makes it ready for remapping interrupts */
3262306a36Sopenharmony_ci	int  (*prepare)(void);
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci	/* Enables the remapping hardware */
3562306a36Sopenharmony_ci	int  (*enable)(void);
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci	/* Disables the remapping hardware */
3862306a36Sopenharmony_ci	void (*disable)(void);
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci	/* Reenables the remapping hardware */
4162306a36Sopenharmony_ci	int  (*reenable)(int);
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci	/* Enable fault handling */
4462306a36Sopenharmony_ci	int  (*enable_faulting)(void);
4562306a36Sopenharmony_ci};
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciextern struct irq_remap_ops intel_irq_remap_ops;
4862306a36Sopenharmony_ciextern struct irq_remap_ops amd_iommu_irq_ops;
4962306a36Sopenharmony_ciextern struct irq_remap_ops hyperv_irq_remap_ops;
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci#else  /* CONFIG_IRQ_REMAP */
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci#define irq_remapping_enabled 0
5462306a36Sopenharmony_ci#define irq_remap_broken      0
5562306a36Sopenharmony_ci#define disable_irq_post      1
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#endif /* CONFIG_IRQ_REMAP */
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci#endif /* __IRQ_REMAPPING_H */
60