~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/include/asm/posted_intr.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _X86_POSTED_INTR_H
  3 #define _X86_POSTED_INTR_H
  4 #include <asm/irq_vectors.h>
  5 
  6 #define POSTED_INTR_ON  0
  7 #define POSTED_INTR_SN  1
  8 
  9 #define PID_TABLE_ENTRY_VALID 1
 10 
 11 /* Posted-Interrupt Descriptor */
 12 struct pi_desc {
 13         union {
 14                 u32 pir[8];     /* Posted interrupt requested */
 15                 u64 pir64[4];
 16         };
 17         union {
 18                 struct {
 19                         u16     notifications; /* Suppress and outstanding bits */
 20                         u8      nv;
 21                         u8      rsvd_2;
 22                         u32     ndst;
 23                 };
 24                 u64 control;
 25         };
 26         u32 rsvd[6];
 27 } __aligned(64);
 28 
 29 static inline bool pi_test_and_set_on(struct pi_desc *pi_desc)
 30 {
 31         return test_and_set_bit(POSTED_INTR_ON, (unsigned long *)&pi_desc->control);
 32 }
 33 
 34 static inline bool pi_test_and_clear_on(struct pi_desc *pi_desc)
 35 {
 36         return test_and_clear_bit(POSTED_INTR_ON, (unsigned long *)&pi_desc->control);
 37 }
 38 
 39 static inline bool pi_test_and_clear_sn(struct pi_desc *pi_desc)
 40 {
 41         return test_and_clear_bit(POSTED_INTR_SN, (unsigned long *)&pi_desc->control);
 42 }
 43 
 44 static inline bool pi_test_and_set_pir(int vector, struct pi_desc *pi_desc)
 45 {
 46         return test_and_set_bit(vector, (unsigned long *)pi_desc->pir);
 47 }
 48 
 49 static inline bool pi_is_pir_empty(struct pi_desc *pi_desc)
 50 {
 51         return bitmap_empty((unsigned long *)pi_desc->pir, NR_VECTORS);
 52 }
 53 
 54 static inline void pi_set_sn(struct pi_desc *pi_desc)
 55 {
 56         set_bit(POSTED_INTR_SN, (unsigned long *)&pi_desc->control);
 57 }
 58 
 59 static inline void pi_set_on(struct pi_desc *pi_desc)
 60 {
 61         set_bit(POSTED_INTR_ON, (unsigned long *)&pi_desc->control);
 62 }
 63 
 64 static inline void pi_clear_on(struct pi_desc *pi_desc)
 65 {
 66         clear_bit(POSTED_INTR_ON, (unsigned long *)&pi_desc->control);
 67 }
 68 
 69 static inline void pi_clear_sn(struct pi_desc *pi_desc)
 70 {
 71         clear_bit(POSTED_INTR_SN, (unsigned long *)&pi_desc->control);
 72 }
 73 
 74 static inline bool pi_test_on(struct pi_desc *pi_desc)
 75 {
 76         return test_bit(POSTED_INTR_ON, (unsigned long *)&pi_desc->control);
 77 }
 78 
 79 static inline bool pi_test_sn(struct pi_desc *pi_desc)
 80 {
 81         return test_bit(POSTED_INTR_SN, (unsigned long *)&pi_desc->control);
 82 }
 83 
 84 /* Non-atomic helpers */
 85 static inline void __pi_set_sn(struct pi_desc *pi_desc)
 86 {
 87         pi_desc->notifications |= BIT(POSTED_INTR_SN);
 88 }
 89 
 90 static inline void __pi_clear_sn(struct pi_desc *pi_desc)
 91 {
 92         pi_desc->notifications &= ~BIT(POSTED_INTR_SN);
 93 }
 94 
 95 #ifdef CONFIG_X86_POSTED_MSI
 96 /*
 97  * Not all external vectors are subject to interrupt remapping, e.g. IOMMU's
 98  * own interrupts. Here we do not distinguish them since those vector bits in
 99  * PIR will always be zero.
100  */
101 static inline bool pi_pending_this_cpu(unsigned int vector)
102 {
103         struct pi_desc *pid = this_cpu_ptr(&posted_msi_pi_desc);
104 
105         if (WARN_ON_ONCE(vector > NR_VECTORS || vector < FIRST_EXTERNAL_VECTOR))
106                 return false;
107 
108         return test_bit(vector, (unsigned long *)pid->pir);
109 }
110 
111 extern void intel_posted_msi_init(void);
112 #else
113 static inline bool pi_pending_this_cpu(unsigned int vector) { return false; }
114 
115 static inline void intel_posted_msi_init(void) {};
116 #endif /* X86_POSTED_MSI */
117 
118 #endif /* _X86_POSTED_INTR_H */
119 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php