Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2012 Advanced Micro Devices, Inc.
0004  * Author: Joerg Roedel <joerg.roedel@amd.com>
0005  *
0006  * This header file contains the interface of the interrupt remapping code to
0007  * the x86 interrupt management code.
0008  */
0009 
0010 #ifndef __X86_IRQ_REMAPPING_H
0011 #define __X86_IRQ_REMAPPING_H
0012 
0013 #include <asm/irqdomain.h>
0014 #include <asm/hw_irq.h>
0015 #include <asm/io_apic.h>
0016 
0017 struct msi_msg;
0018 struct irq_alloc_info;
0019 
0020 enum irq_remap_cap {
0021     IRQ_POSTING_CAP = 0,
0022 };
0023 
0024 enum {
0025     IRQ_REMAP_XAPIC_MODE,
0026     IRQ_REMAP_X2APIC_MODE,
0027 };
0028 
0029 struct vcpu_data {
0030     u64 pi_desc_addr;   /* Physical address of PI Descriptor */
0031     u32 vector;     /* Guest vector of the interrupt */
0032 };
0033 
0034 #ifdef CONFIG_IRQ_REMAP
0035 
0036 extern raw_spinlock_t irq_2_ir_lock;
0037 
0038 extern bool irq_remapping_cap(enum irq_remap_cap cap);
0039 extern void set_irq_remapping_broken(void);
0040 extern int irq_remapping_prepare(void);
0041 extern int irq_remapping_enable(void);
0042 extern void irq_remapping_disable(void);
0043 extern int irq_remapping_reenable(int);
0044 extern int irq_remap_enable_fault_handling(void);
0045 extern void panic_if_irq_remap(const char *msg);
0046 
0047 /* Create PCI MSI/MSIx irqdomain, use @parent as the parent irqdomain. */
0048 extern struct irq_domain *
0049 arch_create_remap_msi_irq_domain(struct irq_domain *par, const char *n, int id);
0050 
0051 /* Get parent irqdomain for interrupt remapping irqdomain */
0052 static inline struct irq_domain *arch_get_ir_parent_domain(void)
0053 {
0054     return x86_vector_domain;
0055 }
0056 
0057 #else  /* CONFIG_IRQ_REMAP */
0058 
0059 static inline bool irq_remapping_cap(enum irq_remap_cap cap) { return 0; }
0060 static inline void set_irq_remapping_broken(void) { }
0061 static inline int irq_remapping_prepare(void) { return -ENODEV; }
0062 static inline int irq_remapping_enable(void) { return -ENODEV; }
0063 static inline void irq_remapping_disable(void) { }
0064 static inline int irq_remapping_reenable(int eim) { return -ENODEV; }
0065 static inline int irq_remap_enable_fault_handling(void) { return -ENODEV; }
0066 
0067 static inline void panic_if_irq_remap(const char *msg)
0068 {
0069 }
0070 
0071 #endif /* CONFIG_IRQ_REMAP */
0072 #endif /* __X86_IRQ_REMAPPING_H */