blob: e479fbda55cf5c26882e46eab7acc5cd2a4bbd4c [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
Neil Horman03bbcb22013-04-16 16:38:32 -040038extern void set_irq_remapping_broken(void);
Suresh Siddha95a02e92012-03-30 11:47:07 -070039extern int irq_remapping_prepare(void);
40extern int irq_remapping_enable(void);
41extern void irq_remapping_disable(void);
42extern int irq_remapping_reenable(int);
43extern int irq_remap_enable_fault_handling(void);
Joerg Roedel6a9f5de2012-09-26 12:44:41 +020044extern void panic_if_irq_remap(const char *msg);
Joerg Roedel9b1b0e42012-09-26 12:44:45 +020045
Jiang Liu947045a2015-04-13 14:11:30 +080046extern struct irq_domain *
47irq_remapping_get_ir_irq_domain(struct irq_alloc_info *info);
48extern struct irq_domain *
49irq_remapping_get_irq_domain(struct irq_alloc_info *info);
Jiang Liu947045a2015-04-13 14:11:30 +080050
51/* Create PCI MSI/MSIx irqdomain, use @parent as the parent irqdomain. */
Jiang Liu52f518a2015-04-13 14:11:35 +080052extern struct irq_domain *arch_create_msi_irq_domain(struct irq_domain *parent);
Jiang Liu947045a2015-04-13 14:11:30 +080053
54/* Get parent irqdomain for interrupt remapping irqdomain */
55static inline struct irq_domain *arch_get_ir_parent_domain(void)
56{
57 return x86_vector_domain;
58}
59
Feng Wu85411862015-06-09 13:20:31 +080060struct vcpu_data {
61 u64 pi_desc_addr; /* Physical address of PI Descriptor */
62 u32 vector; /* Guest vector of the interrupt */
63};
64
Joerg Roedel736baef2012-03-30 11:47:00 -070065#else /* CONFIG_IRQ_REMAP */
66
Neil Horman03bbcb22013-04-16 16:38:32 -040067static inline void set_irq_remapping_broken(void) { }
Suresh Siddha95a02e92012-03-30 11:47:07 -070068static inline int irq_remapping_prepare(void) { return -ENODEV; }
69static inline int irq_remapping_enable(void) { return -ENODEV; }
70static inline void irq_remapping_disable(void) { }
71static inline int irq_remapping_reenable(int eim) { return -ENODEV; }
72static inline int irq_remap_enable_fault_handling(void) { return -ENODEV; }
Joerg Roedel6a9f5de2012-09-26 12:44:41 +020073
74static inline void panic_if_irq_remap(const char *msg)
75{
76}
Joerg Roedel9b1b0e42012-09-26 12:44:45 +020077
Jiang Liu947045a2015-04-13 14:11:30 +080078static inline struct irq_domain *
79irq_remapping_get_ir_irq_domain(struct irq_alloc_info *info)
80{
81 return NULL;
82}
83
84static inline struct irq_domain *
85irq_remapping_get_irq_domain(struct irq_alloc_info *info)
86{
87 return NULL;
88}
89
Joerg Roedel736baef2012-03-30 11:47:00 -070090#endif /* CONFIG_IRQ_REMAP */
Suresh Siddha8a8f4222012-03-30 11:47:08 -070091#endif /* __X86_IRQ_REMAPPING_H */