blob: 046c7fb1ca4332ef19044f5a482c1d0a3e3fc632 [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
Suresh Siddha399988e2012-05-08 00:08:52 -070036#ifdef CONFIG_IRQ_REMAP
Joerg Roedel0c3f1732012-03-30 11:47:02 -070037
Feng Wu959c8702015-06-09 13:20:36 +080038extern bool irq_remapping_cap(enum irq_remap_cap cap);
Neil Horman03bbcb22013-04-16 16:38:32 -040039extern void set_irq_remapping_broken(void);
Suresh Siddha95a02e92012-03-30 11:47:07 -070040extern int irq_remapping_prepare(void);
41extern int irq_remapping_enable(void);
42extern void irq_remapping_disable(void);
43extern int irq_remapping_reenable(int);
44extern int irq_remap_enable_fault_handling(void);
Joerg Roedel6a9f5de2012-09-26 12:44:41 +020045extern void panic_if_irq_remap(const char *msg);
Joerg Roedel9b1b0e42012-09-26 12:44:45 +020046
Jiang Liu947045a2015-04-13 14:11:30 +080047extern struct irq_domain *
48irq_remapping_get_ir_irq_domain(struct irq_alloc_info *info);
49extern struct irq_domain *
50irq_remapping_get_irq_domain(struct irq_alloc_info *info);
Jiang Liu947045a2015-04-13 14:11:30 +080051
52/* Create PCI MSI/MSIx irqdomain, use @parent as the parent irqdomain. */
Jiang Liu52f518a2015-04-13 14:11:35 +080053extern struct irq_domain *arch_create_msi_irq_domain(struct irq_domain *parent);
Jiang Liu947045a2015-04-13 14:11:30 +080054
55/* Get parent irqdomain for interrupt remapping irqdomain */
56static inline struct irq_domain *arch_get_ir_parent_domain(void)
57{
58 return x86_vector_domain;
59}
60
Feng Wu85411862015-06-09 13:20:31 +080061struct vcpu_data {
62 u64 pi_desc_addr; /* Physical address of PI Descriptor */
63 u32 vector; /* Guest vector of the interrupt */
64};
65
Joerg Roedel736baef2012-03-30 11:47:00 -070066#else /* CONFIG_IRQ_REMAP */
67
Feng Wu959c8702015-06-09 13:20:36 +080068static inline bool irq_remapping_cap(enum irq_remap_cap cap) { return 0; }
Neil Horman03bbcb22013-04-16 16:38:32 -040069static inline void set_irq_remapping_broken(void) { }
Suresh Siddha95a02e92012-03-30 11:47:07 -070070static inline int irq_remapping_prepare(void) { return -ENODEV; }
71static inline int irq_remapping_enable(void) { return -ENODEV; }
72static inline void irq_remapping_disable(void) { }
73static inline int irq_remapping_reenable(int eim) { return -ENODEV; }
74static inline int irq_remap_enable_fault_handling(void) { return -ENODEV; }
Joerg Roedel6a9f5de2012-09-26 12:44:41 +020075
76static inline void panic_if_irq_remap(const char *msg)
77{
78}
Joerg Roedel9b1b0e42012-09-26 12:44:45 +020079
Jiang Liu947045a2015-04-13 14:11:30 +080080static inline struct irq_domain *
81irq_remapping_get_ir_irq_domain(struct irq_alloc_info *info)
82{
83 return NULL;
84}
85
86static inline struct irq_domain *
87irq_remapping_get_irq_domain(struct irq_alloc_info *info)
88{
89 return NULL;
90}
91
Joerg Roedel736baef2012-03-30 11:47:00 -070092#endif /* CONFIG_IRQ_REMAP */
Suresh Siddha8a8f4222012-03-30 11:47:08 -070093#endif /* __X86_IRQ_REMAPPING_H */