blob: 023b4a9fc8465e3c643824582d9d77124a2150b3 [file] [log] [blame]
Joerg Roedel736baef2012-03-30 11:47:00 -07001/*
2 * Copyright (C) 2012 Advanced Micro Devices, Inc.
3 * Author: Joerg Roedel <joerg.roedel@amd.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * This header file contains the interface of the interrupt remapping code to
19 * the x86 interrupt management code.
20 */
21
Suresh Siddha8a8f4222012-03-30 11:47:08 -070022#ifndef __X86_IRQ_REMAPPING_H
23#define __X86_IRQ_REMAPPING_H
Joerg Roedel736baef2012-03-30 11:47:00 -070024
Jiang Liud746d1e2015-04-14 10:30:09 +080025#include <asm/irqdomain.h>
Jiang Liu947045a2015-04-13 14:11:30 +080026#include <asm/hw_irq.h>
Suresh Siddha399988e2012-05-08 00:08:52 -070027#include <asm/io_apic.h>
Joerg Roedel736baef2012-03-30 11:47:00 -070028
Joerg Roedel35d3d812013-04-19 20:34:55 +020029struct msi_msg;
Jiang Liu947045a2015-04-13 14:11:30 +080030struct irq_alloc_info;
Joerg Roedel35d3d812013-04-19 20:34:55 +020031
Feng Wu6f281922015-06-09 13:20:28 +080032enum irq_remap_cap {
33 IRQ_POSTING_CAP = 0,
34};
35
Paolo Bonzini18cd52c2015-09-18 18:04:17 +020036struct vcpu_data {
37 u64 pi_desc_addr; /* Physical address of PI Descriptor */
38 u32 vector; /* Guest vector of the interrupt */
39};
40
Suresh Siddha399988e2012-05-08 00:08:52 -070041#ifdef CONFIG_IRQ_REMAP
Joerg Roedel0c3f1732012-03-30 11:47:02 -070042
Feng Wu959c8702015-06-09 13:20:36 +080043extern bool irq_remapping_cap(enum irq_remap_cap cap);
Neil Horman03bbcb22013-04-16 16:38:32 -040044extern void set_irq_remapping_broken(void);
Suresh Siddha95a02e92012-03-30 11:47:07 -070045extern int irq_remapping_prepare(void);
46extern int irq_remapping_enable(void);
47extern void irq_remapping_disable(void);
48extern int irq_remapping_reenable(int);
49extern int irq_remap_enable_fault_handling(void);
Joerg Roedel6a9f5de2012-09-26 12:44:41 +020050extern void panic_if_irq_remap(const char *msg);
Joerg Roedel9b1b0e42012-09-26 12:44:45 +020051
Jiang Liu947045a2015-04-13 14:11:30 +080052extern struct irq_domain *
53irq_remapping_get_ir_irq_domain(struct irq_alloc_info *info);
54extern struct irq_domain *
55irq_remapping_get_irq_domain(struct irq_alloc_info *info);
Jiang Liu947045a2015-04-13 14:11:30 +080056
57/* Create PCI MSI/MSIx irqdomain, use @parent as the parent irqdomain. */
Thomas Gleixner667724c2017-06-20 01:37:10 +020058extern struct irq_domain *
59arch_create_remap_msi_irq_domain(struct irq_domain *par, const char *n, int id);
Jiang Liu947045a2015-04-13 14:11:30 +080060
61/* Get parent irqdomain for interrupt remapping irqdomain */
62static inline struct irq_domain *arch_get_ir_parent_domain(void)
63{
64 return x86_vector_domain;
65}
66
Joerg Roedel736baef2012-03-30 11:47:00 -070067#else /* CONFIG_IRQ_REMAP */
68
Feng Wu959c8702015-06-09 13:20:36 +080069static inline bool irq_remapping_cap(enum irq_remap_cap cap) { return 0; }
Neil Horman03bbcb22013-04-16 16:38:32 -040070static inline void set_irq_remapping_broken(void) { }
Suresh Siddha95a02e92012-03-30 11:47:07 -070071static inline int irq_remapping_prepare(void) { return -ENODEV; }
72static inline int irq_remapping_enable(void) { return -ENODEV; }
73static inline void irq_remapping_disable(void) { }
74static inline int irq_remapping_reenable(int eim) { return -ENODEV; }
75static inline int irq_remap_enable_fault_handling(void) { return -ENODEV; }
Joerg Roedel6a9f5de2012-09-26 12:44:41 +020076
77static inline void panic_if_irq_remap(const char *msg)
78{
79}
Joerg Roedel9b1b0e42012-09-26 12:44:45 +020080
Jiang Liu947045a2015-04-13 14:11:30 +080081static inline struct irq_domain *
82irq_remapping_get_ir_irq_domain(struct irq_alloc_info *info)
83{
84 return NULL;
85}
86
87static inline struct irq_domain *
88irq_remapping_get_irq_domain(struct irq_alloc_info *info)
89{
90 return NULL;
91}
92
Joerg Roedel736baef2012-03-30 11:47:00 -070093#endif /* CONFIG_IRQ_REMAP */
Suresh Siddha8a8f4222012-03-30 11:47:08 -070094#endif /* __X86_IRQ_REMAPPING_H */