tree: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git irq/domain_cleanup head: 550eec9280bbaf3704f847777e7a1468d9ed8db0 commit: 702ba25bbe5e01f95ee505140cbf6ab97044e881 [8/12] powerpc: Convert irq_domain_add_legacy_isa use to irq_domain_add_legacy config: powerpc-ppc64e_defconfig (attached as .config) compiler: powerpc64-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?id=702ba25bbe5e01f95ee505140cbf6ab97044e881 git remote add arm-platforms https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git git fetch --no-tags arm-platforms irq/domain_cleanup git checkout 702ba25bbe5e01f95ee505140cbf6ab97044e881 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): arch/powerpc/sysdev/ehv_pic.c:44:6: error: no previous prototype for 'ehv_pic_unmask_irq' [-Werror=missing-prototypes] 44 | void ehv_pic_unmask_irq(struct irq_data *d) | ^~~~~~~~~~~~~~~~~~ arch/powerpc/sysdev/ehv_pic.c:51:6: error: no previous prototype for 'ehv_pic_mask_irq' [-Werror=missing-prototypes] 51 | void ehv_pic_mask_irq(struct irq_data *d) | ^~~~~~~~~~~~~~~~ arch/powerpc/sysdev/ehv_pic.c:58:6: error: no previous prototype for 'ehv_pic_end_irq' [-Werror=missing-prototypes] 58 | void ehv_pic_end_irq(struct irq_data *d) | ^~~~~~~~~~~~~~~ arch/powerpc/sysdev/ehv_pic.c:65:6: error: no previous prototype for 'ehv_pic_direct_end_irq' [-Werror=missing-prototypes] 65 | void ehv_pic_direct_end_irq(struct irq_data *d) | ^~~~~~~~~~~~~~~~~~~~~~ arch/powerpc/sysdev/ehv_pic.c:70:5: error: no previous prototype for 'ehv_pic_set_affinity' [-Werror=missing-prototypes] 70 | int ehv_pic_set_affinity(struct irq_data *d, const struct cpumask *dest, | ^~~~~~~~~~~~~~~~~~~~ arch/powerpc/sysdev/ehv_pic.c:111:5: error: no previous prototype for 'ehv_pic_set_irq_type' [-Werror=missing-prototypes] 111 | int ehv_pic_set_irq_type(struct irq_data *d, unsigned int flow_type) | ^~~~~~~~~~~~~~~~~~~~ arch/powerpc/sysdev/ehv_pic.c: In function 'ehv_pic_get_irq': >> arch/powerpc/sysdev/ehv_pic.c:177:9: error: implicit declaration of function 'irq_linear_revmap' [-Werror=implicit-function-declaration] 177 | return irq_linear_revmap(global_ehv_pic->irqhost, irq); | ^~~~~~~~~~~~~~~~~ arch/powerpc/sysdev/ehv_pic.c: At top level: arch/powerpc/sysdev/ehv_pic.c:181:15: error: 'enum irq_domain_bus_token' declared inside parameter list will not be visible outside of this definition or declaration [-Werror] 181 | enum irq_domain_bus_token bus_token) | ^~~~~~~~~~~~~~~~~~~~ >> arch/powerpc/sysdev/ehv_pic.c:181:36: error: parameter 3 ('bus_token') has incomplete type 181 | enum irq_domain_bus_token bus_token) | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~ >> arch/powerpc/sysdev/ehv_pic.c:180:12: error: function declaration isn't a prototype [-Werror=strict-prototypes] 180 | static int ehv_pic_host_match(struct irq_domain *h, struct device_node *node, | ^~~~~~~~~~~~~~~~~~ arch/powerpc/sysdev/ehv_pic.c: In function 'ehv_pic_host_match': >> arch/powerpc/sysdev/ehv_pic.c:184:32: error: implicit declaration of function 'irq_domain_get_of_node'; did you mean 'irq_data_get_node'? [-Werror=implicit-function-declaration] 184 | struct device_node *of_node = irq_domain_get_of_node(h); | ^~~~~~~~~~~~~~~~~~~~~~ | irq_data_get_node >> arch/powerpc/sysdev/ehv_pic.c:184:32: error: initialization of 'struct device_node *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion] arch/powerpc/sysdev/ehv_pic.c: In function 'ehv_pic_host_map': >> arch/powerpc/sysdev/ehv_pic.c:191:29: error: dereferencing pointer to incomplete type 'struct irq_domain' 191 | struct ehv_pic *ehv_pic = h->host_data; | ^~ arch/powerpc/sysdev/ehv_pic.c: At top level: >> arch/powerpc/sysdev/ehv_pic.c:248:21: error: variable 'ehv_pic_host_ops' has initializer but incomplete type 248 | static const struct irq_domain_ops ehv_pic_host_ops = { | ^~~~~~~~~~~~~~ >> arch/powerpc/sysdev/ehv_pic.c:249:3: error: 'const struct irq_domain_ops' has no member named 'match' 249 | .match = ehv_pic_host_match, | ^~~~~ arch/powerpc/sysdev/ehv_pic.c:249:11: error: excess elements in struct initializer [-Werror] 249 | .match = ehv_pic_host_match, | ^~~~~~~~~~~~~~~~~~ arch/powerpc/sysdev/ehv_pic.c:249:11: note: (near initialization for 'ehv_pic_host_ops') >> arch/powerpc/sysdev/ehv_pic.c:250:3: error: 'const struct irq_domain_ops' has no member named 'map' 250 | .map = ehv_pic_host_map, | ^~~ arch/powerpc/sysdev/ehv_pic.c:250:9: error: excess elements in struct initializer [-Werror] 250 | .map = ehv_pic_host_map, | ^~~~~~~~~~~~~~~~ arch/powerpc/sysdev/ehv_pic.c:250:9: note: (near initialization for 'ehv_pic_host_ops') >> arch/powerpc/sysdev/ehv_pic.c:251:3: error: 'const struct irq_domain_ops' has no member named 'xlate' 251 | .xlate = ehv_pic_host_xlate, | ^~~~~ arch/powerpc/sysdev/ehv_pic.c:251:11: error: excess elements in struct initializer [-Werror] 251 | .xlate = ehv_pic_host_xlate, | ^~~~~~~~~~~~~~~~~~ arch/powerpc/sysdev/ehv_pic.c:251:11: note: (near initialization for 'ehv_pic_host_ops') arch/powerpc/sysdev/ehv_pic.c: In function 'ehv_pic_init': >> arch/powerpc/sysdev/ehv_pic.c:275:21: error: implicit declaration of function 'irq_domain_add_linear' [-Werror=implicit-function-declaration] 275 | ehv_pic->irqhost = irq_domain_add_linear(np, NR_EHV_PIC_INTS, | ^~~~~~~~~~~~~~~~~~~~~ >> arch/powerpc/sysdev/ehv_pic.c:275:19: error: assignment to 'struct irq_domain *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion] 275 | ehv_pic->irqhost = irq_domain_add_linear(np, NR_EHV_PIC_INTS, | ^ >> arch/powerpc/sysdev/ehv_pic.c:297:2: error: implicit declaration of function 'irq_set_default_host' [-Werror=implicit-function-declaration] 297 | irq_set_default_host(global_ehv_pic->irqhost); | ^~~~~~~~~~~~~~~~~~~~ arch/powerpc/sysdev/ehv_pic.c: At top level: >> arch/powerpc/sysdev/ehv_pic.c:248:36: error: storage size of 'ehv_pic_host_ops' isn't known 248 | static const struct irq_domain_ops ehv_pic_host_ops = { | ^~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors vim +184 arch/powerpc/sysdev/ehv_pic.c 3a93261f70c7b9 Ashish Kalra 2011-05-19 69 3a93261f70c7b9 Ashish Kalra 2011-05-19 @70 int ehv_pic_set_affinity(struct irq_data *d, const struct cpumask *dest, 3a93261f70c7b9 Ashish Kalra 2011-05-19 71 bool force) 3a93261f70c7b9 Ashish Kalra 2011-05-19 72 { 3a93261f70c7b9 Ashish Kalra 2011-05-19 73 unsigned int src = virq_to_hw(d->irq); 3a93261f70c7b9 Ashish Kalra 2011-05-19 74 unsigned int config, prio, cpu_dest; 3a93261f70c7b9 Ashish Kalra 2011-05-19 75 int cpuid = irq_choose_cpu(dest); 3a93261f70c7b9 Ashish Kalra 2011-05-19 76 unsigned long flags; 3a93261f70c7b9 Ashish Kalra 2011-05-19 77 3a93261f70c7b9 Ashish Kalra 2011-05-19 78 spin_lock_irqsave(&ehv_pic_lock, flags); 3a93261f70c7b9 Ashish Kalra 2011-05-19 79 ev_int_get_config(src, &config, &prio, &cpu_dest); 3a93261f70c7b9 Ashish Kalra 2011-05-19 80 ev_int_set_config(src, config, prio, cpuid); 3a93261f70c7b9 Ashish Kalra 2011-05-19 81 spin_unlock_irqrestore(&ehv_pic_lock, flags); 3a93261f70c7b9 Ashish Kalra 2011-05-19 82 dcb615aef988b5 Alexander Gordeev 2013-05-13 83 return IRQ_SET_MASK_OK; 3a93261f70c7b9 Ashish Kalra 2011-05-19 84 } 3a93261f70c7b9 Ashish Kalra 2011-05-19 85 3a93261f70c7b9 Ashish Kalra 2011-05-19 86 static unsigned int ehv_pic_type_to_vecpri(unsigned int type) 3a93261f70c7b9 Ashish Kalra 2011-05-19 87 { 3a93261f70c7b9 Ashish Kalra 2011-05-19 88 /* Now convert sense value */ 3a93261f70c7b9 Ashish Kalra 2011-05-19 89 3a93261f70c7b9 Ashish Kalra 2011-05-19 90 switch (type & IRQ_TYPE_SENSE_MASK) { 3a93261f70c7b9 Ashish Kalra 2011-05-19 91 case IRQ_TYPE_EDGE_RISING: 3a93261f70c7b9 Ashish Kalra 2011-05-19 92 return EHV_PIC_INFO(VECPRI_SENSE_EDGE) | 3a93261f70c7b9 Ashish Kalra 2011-05-19 93 EHV_PIC_INFO(VECPRI_POLARITY_POSITIVE); 3a93261f70c7b9 Ashish Kalra 2011-05-19 94 3a93261f70c7b9 Ashish Kalra 2011-05-19 95 case IRQ_TYPE_EDGE_FALLING: 3a93261f70c7b9 Ashish Kalra 2011-05-19 96 case IRQ_TYPE_EDGE_BOTH: 3a93261f70c7b9 Ashish Kalra 2011-05-19 97 return EHV_PIC_INFO(VECPRI_SENSE_EDGE) | 3a93261f70c7b9 Ashish Kalra 2011-05-19 98 EHV_PIC_INFO(VECPRI_POLARITY_NEGATIVE); 3a93261f70c7b9 Ashish Kalra 2011-05-19 99 3a93261f70c7b9 Ashish Kalra 2011-05-19 100 case IRQ_TYPE_LEVEL_HIGH: 3a93261f70c7b9 Ashish Kalra 2011-05-19 101 return EHV_PIC_INFO(VECPRI_SENSE_LEVEL) | 3a93261f70c7b9 Ashish Kalra 2011-05-19 102 EHV_PIC_INFO(VECPRI_POLARITY_POSITIVE); 3a93261f70c7b9 Ashish Kalra 2011-05-19 103 3a93261f70c7b9 Ashish Kalra 2011-05-19 104 case IRQ_TYPE_LEVEL_LOW: 3a93261f70c7b9 Ashish Kalra 2011-05-19 105 default: 3a93261f70c7b9 Ashish Kalra 2011-05-19 106 return EHV_PIC_INFO(VECPRI_SENSE_LEVEL) | 3a93261f70c7b9 Ashish Kalra 2011-05-19 107 EHV_PIC_INFO(VECPRI_POLARITY_NEGATIVE); 3a93261f70c7b9 Ashish Kalra 2011-05-19 108 } 3a93261f70c7b9 Ashish Kalra 2011-05-19 109 } 3a93261f70c7b9 Ashish Kalra 2011-05-19 110 3a93261f70c7b9 Ashish Kalra 2011-05-19 111 int ehv_pic_set_irq_type(struct irq_data *d, unsigned int flow_type) 3a93261f70c7b9 Ashish Kalra 2011-05-19 112 { 3a93261f70c7b9 Ashish Kalra 2011-05-19 113 unsigned int src = virq_to_hw(d->irq); 3a93261f70c7b9 Ashish Kalra 2011-05-19 114 unsigned int vecpri, vold, vnew, prio, cpu_dest; 3a93261f70c7b9 Ashish Kalra 2011-05-19 115 unsigned long flags; 3a93261f70c7b9 Ashish Kalra 2011-05-19 116 3a93261f70c7b9 Ashish Kalra 2011-05-19 117 if (flow_type == IRQ_TYPE_NONE) 3a93261f70c7b9 Ashish Kalra 2011-05-19 118 flow_type = IRQ_TYPE_LEVEL_LOW; 3a93261f70c7b9 Ashish Kalra 2011-05-19 119 c866cda47f2c6c Thomas Gleixner 2014-02-23 120 irqd_set_trigger_type(d, flow_type); 3a93261f70c7b9 Ashish Kalra 2011-05-19 121 3a93261f70c7b9 Ashish Kalra 2011-05-19 122 vecpri = ehv_pic_type_to_vecpri(flow_type); 3a93261f70c7b9 Ashish Kalra 2011-05-19 123 3a93261f70c7b9 Ashish Kalra 2011-05-19 124 spin_lock_irqsave(&ehv_pic_lock, flags); 3a93261f70c7b9 Ashish Kalra 2011-05-19 125 ev_int_get_config(src, &vold, &prio, &cpu_dest); 3a93261f70c7b9 Ashish Kalra 2011-05-19 126 vnew = vold & ~(EHV_PIC_INFO(VECPRI_POLARITY_MASK) | 3a93261f70c7b9 Ashish Kalra 2011-05-19 127 EHV_PIC_INFO(VECPRI_SENSE_MASK)); 3a93261f70c7b9 Ashish Kalra 2011-05-19 128 vnew |= vecpri; 3a93261f70c7b9 Ashish Kalra 2011-05-19 129 3a93261f70c7b9 Ashish Kalra 2011-05-19 130 /* 3a93261f70c7b9 Ashish Kalra 2011-05-19 131 * TODO : Add specific interface call for platform to set 3a93261f70c7b9 Ashish Kalra 2011-05-19 132 * individual interrupt priorities. 3a93261f70c7b9 Ashish Kalra 2011-05-19 133 * platform currently using static/default priority for all ints 3a93261f70c7b9 Ashish Kalra 2011-05-19 134 */ 3a93261f70c7b9 Ashish Kalra 2011-05-19 135 3a93261f70c7b9 Ashish Kalra 2011-05-19 136 prio = 8; 3a93261f70c7b9 Ashish Kalra 2011-05-19 137 3a93261f70c7b9 Ashish Kalra 2011-05-19 138 ev_int_set_config(src, vecpri, prio, cpu_dest); 3a93261f70c7b9 Ashish Kalra 2011-05-19 139 3a93261f70c7b9 Ashish Kalra 2011-05-19 140 spin_unlock_irqrestore(&ehv_pic_lock, flags); c866cda47f2c6c Thomas Gleixner 2014-02-23 141 return IRQ_SET_MASK_OK_NOCOPY; 3a93261f70c7b9 Ashish Kalra 2011-05-19 142 } 3a93261f70c7b9 Ashish Kalra 2011-05-19 143 3a93261f70c7b9 Ashish Kalra 2011-05-19 144 static struct irq_chip ehv_pic_irq_chip = { 3a93261f70c7b9 Ashish Kalra 2011-05-19 145 .irq_mask = ehv_pic_mask_irq, 3a93261f70c7b9 Ashish Kalra 2011-05-19 146 .irq_unmask = ehv_pic_unmask_irq, 3a93261f70c7b9 Ashish Kalra 2011-05-19 147 .irq_eoi = ehv_pic_end_irq, 3a93261f70c7b9 Ashish Kalra 2011-05-19 148 .irq_set_type = ehv_pic_set_irq_type, 3a93261f70c7b9 Ashish Kalra 2011-05-19 149 }; 3a93261f70c7b9 Ashish Kalra 2011-05-19 150 3a93261f70c7b9 Ashish Kalra 2011-05-19 151 static struct irq_chip ehv_pic_direct_eoi_irq_chip = { 3a93261f70c7b9 Ashish Kalra 2011-05-19 152 .irq_mask = ehv_pic_mask_irq, 3a93261f70c7b9 Ashish Kalra 2011-05-19 153 .irq_unmask = ehv_pic_unmask_irq, 3a93261f70c7b9 Ashish Kalra 2011-05-19 154 .irq_eoi = ehv_pic_direct_end_irq, 3a93261f70c7b9 Ashish Kalra 2011-05-19 155 .irq_set_type = ehv_pic_set_irq_type, 3a93261f70c7b9 Ashish Kalra 2011-05-19 156 }; 3a93261f70c7b9 Ashish Kalra 2011-05-19 157 ef24ba7091517d Michael Ellerman 2016-09-06 158 /* Return an interrupt vector or 0 if no interrupt is pending. */ 3a93261f70c7b9 Ashish Kalra 2011-05-19 159 unsigned int ehv_pic_get_irq(void) 3a93261f70c7b9 Ashish Kalra 2011-05-19 160 { 3a93261f70c7b9 Ashish Kalra 2011-05-19 161 int irq; 3a93261f70c7b9 Ashish Kalra 2011-05-19 162 3a93261f70c7b9 Ashish Kalra 2011-05-19 163 BUG_ON(global_ehv_pic == NULL); 3a93261f70c7b9 Ashish Kalra 2011-05-19 164 3a93261f70c7b9 Ashish Kalra 2011-05-19 165 if (global_ehv_pic->coreint_flag) 3a93261f70c7b9 Ashish Kalra 2011-05-19 166 irq = mfspr(SPRN_EPR); /* if core int mode */ 3a93261f70c7b9 Ashish Kalra 2011-05-19 167 else 3a93261f70c7b9 Ashish Kalra 2011-05-19 168 ev_int_iack(0, &irq); /* legacy mode */ 3a93261f70c7b9 Ashish Kalra 2011-05-19 169 3a93261f70c7b9 Ashish Kalra 2011-05-19 170 if (irq == 0xFFFF) /* 0xFFFF --> no irq is pending */ ef24ba7091517d Michael Ellerman 2016-09-06 171 return 0; 3a93261f70c7b9 Ashish Kalra 2011-05-19 172 3a93261f70c7b9 Ashish Kalra 2011-05-19 173 /* 3a93261f70c7b9 Ashish Kalra 2011-05-19 174 * this will also setup revmap[] in the slow path for the first 3a93261f70c7b9 Ashish Kalra 2011-05-19 175 * time, next calls will always use fast path by indexing revmap 3a93261f70c7b9 Ashish Kalra 2011-05-19 176 */ 3a93261f70c7b9 Ashish Kalra 2011-05-19 @177 return irq_linear_revmap(global_ehv_pic->irqhost, irq); 3a93261f70c7b9 Ashish Kalra 2011-05-19 178 } 3a93261f70c7b9 Ashish Kalra 2011-05-19 179 ad3aedfbb04b3a Marc Zyngier 2015-07-28 @180 static int ehv_pic_host_match(struct irq_domain *h, struct device_node *node, ad3aedfbb04b3a Marc Zyngier 2015-07-28 @181 enum irq_domain_bus_token bus_token) 3a93261f70c7b9 Ashish Kalra 2011-05-19 182 { 3a93261f70c7b9 Ashish Kalra 2011-05-19 183 /* Exact match, unless ehv_pic node is NULL */ 5d4c9bc7767bc8 Marc Zyngier 2015-10-13 @184 struct device_node *of_node = irq_domain_get_of_node(h); 5d4c9bc7767bc8 Marc Zyngier 2015-10-13 185 return of_node == NULL || of_node == node; 3a93261f70c7b9 Ashish Kalra 2011-05-19 186 } 3a93261f70c7b9 Ashish Kalra 2011-05-19 187 bae1d8f19983fb Grant Likely 2012-02-14 188 static int ehv_pic_host_map(struct irq_domain *h, unsigned int virq, 3a93261f70c7b9 Ashish Kalra 2011-05-19 189 irq_hw_number_t hw) 3a93261f70c7b9 Ashish Kalra 2011-05-19 190 { 3a93261f70c7b9 Ashish Kalra 2011-05-19 @191 struct ehv_pic *ehv_pic = h->host_data; 3a93261f70c7b9 Ashish Kalra 2011-05-19 192 struct irq_chip *chip; 3a93261f70c7b9 Ashish Kalra 2011-05-19 193 3a93261f70c7b9 Ashish Kalra 2011-05-19 194 /* Default chip */ 3a93261f70c7b9 Ashish Kalra 2011-05-19 195 chip = &ehv_pic->hc_irq; 3a93261f70c7b9 Ashish Kalra 2011-05-19 196 3a93261f70c7b9 Ashish Kalra 2011-05-19 197 if (mpic_percpu_base_vaddr) 3a93261f70c7b9 Ashish Kalra 2011-05-19 198 if (hwirq_intspec[hw] & IRQ_TYPE_MPIC_DIRECT) 3a93261f70c7b9 Ashish Kalra 2011-05-19 199 chip = &ehv_pic_direct_eoi_irq_chip; 3a93261f70c7b9 Ashish Kalra 2011-05-19 200 3a93261f70c7b9 Ashish Kalra 2011-05-19 201 irq_set_chip_data(virq, chip); 3a93261f70c7b9 Ashish Kalra 2011-05-19 202 /* 3a93261f70c7b9 Ashish Kalra 2011-05-19 203 * using handle_fasteoi_irq as our irq handler, this will 3a93261f70c7b9 Ashish Kalra 2011-05-19 204 * only call the eoi callback and suitable for the MPIC 3a93261f70c7b9 Ashish Kalra 2011-05-19 205 * controller which set ISR/IPR automatically and clear the 3a93261f70c7b9 Ashish Kalra 2011-05-19 206 * highest priority active interrupt in ISR/IPR when we do 3a93261f70c7b9 Ashish Kalra 2011-05-19 207 * a specific eoi 3a93261f70c7b9 Ashish Kalra 2011-05-19 208 */ 3a93261f70c7b9 Ashish Kalra 2011-05-19 209 irq_set_chip_and_handler(virq, chip, handle_fasteoi_irq); 3a93261f70c7b9 Ashish Kalra 2011-05-19 210 3a93261f70c7b9 Ashish Kalra 2011-05-19 211 /* Set default irq type */ 3a93261f70c7b9 Ashish Kalra 2011-05-19 212 irq_set_irq_type(virq, IRQ_TYPE_NONE); 3a93261f70c7b9 Ashish Kalra 2011-05-19 213 3a93261f70c7b9 Ashish Kalra 2011-05-19 214 return 0; 3a93261f70c7b9 Ashish Kalra 2011-05-19 215 } 3a93261f70c7b9 Ashish Kalra 2011-05-19 216 bae1d8f19983fb Grant Likely 2012-02-14 217 static int ehv_pic_host_xlate(struct irq_domain *h, struct device_node *ct, 3a93261f70c7b9 Ashish Kalra 2011-05-19 218 const u32 *intspec, unsigned int intsize, 3a93261f70c7b9 Ashish Kalra 2011-05-19 219 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 3a93261f70c7b9 Ashish Kalra 2011-05-19 220 3a93261f70c7b9 Ashish Kalra 2011-05-19 221 { 3a93261f70c7b9 Ashish Kalra 2011-05-19 222 /* 3a93261f70c7b9 Ashish Kalra 2011-05-19 223 * interrupt sense values coming from the guest device tree 3a93261f70c7b9 Ashish Kalra 2011-05-19 224 * interrupt specifiers can have four possible sense and 3a93261f70c7b9 Ashish Kalra 2011-05-19 225 * level encoding information and they need to 3a93261f70c7b9 Ashish Kalra 2011-05-19 226 * be translated between firmware type & linux type. 3a93261f70c7b9 Ashish Kalra 2011-05-19 227 */ 3a93261f70c7b9 Ashish Kalra 2011-05-19 228 3a93261f70c7b9 Ashish Kalra 2011-05-19 229 static unsigned char map_of_senses_to_linux_irqtype[4] = { 3a93261f70c7b9 Ashish Kalra 2011-05-19 230 IRQ_TYPE_EDGE_FALLING, 3a93261f70c7b9 Ashish Kalra 2011-05-19 231 IRQ_TYPE_EDGE_RISING, 3a93261f70c7b9 Ashish Kalra 2011-05-19 232 IRQ_TYPE_LEVEL_LOW, 3a93261f70c7b9 Ashish Kalra 2011-05-19 233 IRQ_TYPE_LEVEL_HIGH, 3a93261f70c7b9 Ashish Kalra 2011-05-19 234 }; 3a93261f70c7b9 Ashish Kalra 2011-05-19 235 3a93261f70c7b9 Ashish Kalra 2011-05-19 236 *out_hwirq = intspec[0]; 3a93261f70c7b9 Ashish Kalra 2011-05-19 237 if (intsize > 1) { 3a93261f70c7b9 Ashish Kalra 2011-05-19 238 hwirq_intspec[intspec[0]] = intspec[1]; 3a93261f70c7b9 Ashish Kalra 2011-05-19 239 *out_flags = map_of_senses_to_linux_irqtype[intspec[1] & 3a93261f70c7b9 Ashish Kalra 2011-05-19 240 ~IRQ_TYPE_MPIC_DIRECT]; 3a93261f70c7b9 Ashish Kalra 2011-05-19 241 } else { 3a93261f70c7b9 Ashish Kalra 2011-05-19 242 *out_flags = IRQ_TYPE_NONE; 3a93261f70c7b9 Ashish Kalra 2011-05-19 243 } 3a93261f70c7b9 Ashish Kalra 2011-05-19 244 3a93261f70c7b9 Ashish Kalra 2011-05-19 245 return 0; 3a93261f70c7b9 Ashish Kalra 2011-05-19 246 } 3a93261f70c7b9 Ashish Kalra 2011-05-19 247 9f70b8eb3cd37c Grant Likely 2012-01-26 @248 static const struct irq_domain_ops ehv_pic_host_ops = { 3a93261f70c7b9 Ashish Kalra 2011-05-19 @249 .match = ehv_pic_host_match, 3a93261f70c7b9 Ashish Kalra 2011-05-19 @250 .map = ehv_pic_host_map, 3a93261f70c7b9 Ashish Kalra 2011-05-19 @251 .xlate = ehv_pic_host_xlate, 3a93261f70c7b9 Ashish Kalra 2011-05-19 252 }; 3a93261f70c7b9 Ashish Kalra 2011-05-19 253 3a93261f70c7b9 Ashish Kalra 2011-05-19 254 void __init ehv_pic_init(void) 3a93261f70c7b9 Ashish Kalra 2011-05-19 255 { 3a93261f70c7b9 Ashish Kalra 2011-05-19 256 struct device_node *np, *np2; 3a93261f70c7b9 Ashish Kalra 2011-05-19 257 struct ehv_pic *ehv_pic; 3a93261f70c7b9 Ashish Kalra 2011-05-19 258 int coreint_flag = 1; 3a93261f70c7b9 Ashish Kalra 2011-05-19 259 3a93261f70c7b9 Ashish Kalra 2011-05-19 260 np = of_find_compatible_node(NULL, NULL, "epapr,hv-pic"); 3a93261f70c7b9 Ashish Kalra 2011-05-19 261 if (!np) { 3a93261f70c7b9 Ashish Kalra 2011-05-19 262 pr_err("ehv_pic_init: could not find epapr,hv-pic node\n"); 3a93261f70c7b9 Ashish Kalra 2011-05-19 263 return; 3a93261f70c7b9 Ashish Kalra 2011-05-19 264 } 3a93261f70c7b9 Ashish Kalra 2011-05-19 265 3a93261f70c7b9 Ashish Kalra 2011-05-19 266 if (!of_find_property(np, "has-external-proxy", NULL)) 3a93261f70c7b9 Ashish Kalra 2011-05-19 267 coreint_flag = 0; 3a93261f70c7b9 Ashish Kalra 2011-05-19 268 3a93261f70c7b9 Ashish Kalra 2011-05-19 269 ehv_pic = kzalloc(sizeof(struct ehv_pic), GFP_KERNEL); 3a93261f70c7b9 Ashish Kalra 2011-05-19 270 if (!ehv_pic) { 3a93261f70c7b9 Ashish Kalra 2011-05-19 271 of_node_put(np); 3a93261f70c7b9 Ashish Kalra 2011-05-19 272 return; 3a93261f70c7b9 Ashish Kalra 2011-05-19 273 } 3a93261f70c7b9 Ashish Kalra 2011-05-19 274 a8db8cf0d894df Grant Likely 2012-02-14 @275 ehv_pic->irqhost = irq_domain_add_linear(np, NR_EHV_PIC_INTS, a8db8cf0d894df Grant Likely 2012-02-14 276 &ehv_pic_host_ops, ehv_pic); 3a93261f70c7b9 Ashish Kalra 2011-05-19 277 if (!ehv_pic->irqhost) { 3a93261f70c7b9 Ashish Kalra 2011-05-19 278 of_node_put(np); e3854b6e25d1b0 Julia Lawall 2011-08-08 279 kfree(ehv_pic); 3a93261f70c7b9 Ashish Kalra 2011-05-19 280 return; 3a93261f70c7b9 Ashish Kalra 2011-05-19 281 } 3a93261f70c7b9 Ashish Kalra 2011-05-19 282 3a93261f70c7b9 Ashish Kalra 2011-05-19 283 np2 = of_find_compatible_node(NULL, NULL, "fsl,hv-mpic-per-cpu"); 3a93261f70c7b9 Ashish Kalra 2011-05-19 284 if (np2) { 3a93261f70c7b9 Ashish Kalra 2011-05-19 285 mpic_percpu_base_vaddr = of_iomap(np2, 0); 3a93261f70c7b9 Ashish Kalra 2011-05-19 286 if (!mpic_percpu_base_vaddr) 3a93261f70c7b9 Ashish Kalra 2011-05-19 287 pr_err("ehv_pic_init: of_iomap failed\n"); 3a93261f70c7b9 Ashish Kalra 2011-05-19 288 3a93261f70c7b9 Ashish Kalra 2011-05-19 289 of_node_put(np2); 3a93261f70c7b9 Ashish Kalra 2011-05-19 290 } 3a93261f70c7b9 Ashish Kalra 2011-05-19 291 3a93261f70c7b9 Ashish Kalra 2011-05-19 292 ehv_pic->hc_irq = ehv_pic_irq_chip; 3a93261f70c7b9 Ashish Kalra 2011-05-19 293 ehv_pic->hc_irq.irq_set_affinity = ehv_pic_set_affinity; 3a93261f70c7b9 Ashish Kalra 2011-05-19 294 ehv_pic->coreint_flag = coreint_flag; 3a93261f70c7b9 Ashish Kalra 2011-05-19 295 3a93261f70c7b9 Ashish Kalra 2011-05-19 296 global_ehv_pic = ehv_pic; 3a93261f70c7b9 Ashish Kalra 2011-05-19 @297 irq_set_default_host(global_ehv_pic->irqhost); :::::: The code at line 184 was first introduced by commit :::::: 5d4c9bc7767bc86eb9a0e66df783e3fbada7dc97 irqdomain: Use irq_domain_get_of_node() instead of direct field access :::::: TO: Marc Zyngier :::::: CC: Thomas Gleixner --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org