12832a81dSGeoff Levand /* 22832a81dSGeoff Levand * PS3 interrupt routines. 32832a81dSGeoff Levand * 42832a81dSGeoff Levand * Copyright (C) 2006 Sony Computer Entertainment Inc. 52832a81dSGeoff Levand * Copyright 2006 Sony Corp. 62832a81dSGeoff Levand * 72832a81dSGeoff Levand * This program is free software; you can redistribute it and/or modify 82832a81dSGeoff Levand * it under the terms of the GNU General Public License as published by 92832a81dSGeoff Levand * the Free Software Foundation; version 2 of the License. 102832a81dSGeoff Levand * 112832a81dSGeoff Levand * This program is distributed in the hope that it will be useful, 122832a81dSGeoff Levand * but WITHOUT ANY WARRANTY; without even the implied warranty of 132832a81dSGeoff Levand * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 142832a81dSGeoff Levand * GNU General Public License for more details. 152832a81dSGeoff Levand * 162832a81dSGeoff Levand * You should have received a copy of the GNU General Public License 172832a81dSGeoff Levand * along with this program; if not, write to the Free Software 182832a81dSGeoff Levand * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 192832a81dSGeoff Levand */ 202832a81dSGeoff Levand 212832a81dSGeoff Levand #include <linux/kernel.h> 222832a81dSGeoff Levand #include <linux/module.h> 232832a81dSGeoff Levand #include <linux/irq.h> 242832a81dSGeoff Levand 252832a81dSGeoff Levand #include <asm/machdep.h> 262832a81dSGeoff Levand #include <asm/udbg.h> 272832a81dSGeoff Levand #include <asm/lv1call.h> 2842d284bcSStephen Rothwell #include <asm/smp.h> 292832a81dSGeoff Levand 302832a81dSGeoff Levand #include "platform.h" 312832a81dSGeoff Levand 322832a81dSGeoff Levand #if defined(DEBUG) 3383bb643dSGeert Uytterhoeven #define DBG udbg_printf 342832a81dSGeoff Levand #else 3583bb643dSGeert Uytterhoeven #define DBG pr_debug 362832a81dSGeoff Levand #endif 372832a81dSGeoff Levand 382832a81dSGeoff Levand /** 39861be32cSGeoff Levand * struct ps3_bmp - a per cpu irq status and mask bitmap structure 40861be32cSGeoff Levand * @status: 256 bit status bitmap indexed by plug 41861be32cSGeoff Levand * @unused_1: 42861be32cSGeoff Levand * @mask: 256 bit mask bitmap indexed by plug 43861be32cSGeoff Levand * @unused_2: 44861be32cSGeoff Levand * @lock: 45861be32cSGeoff Levand * @ipi_debug_brk_mask: 46861be32cSGeoff Levand * 47861be32cSGeoff Levand * The HV mantains per SMT thread mappings of HV outlet to HV plug on 48861be32cSGeoff Levand * behalf of the guest. These mappings are implemented as 256 bit guest 49861be32cSGeoff Levand * supplied bitmaps indexed by plug number. The addresses of the bitmaps 50861be32cSGeoff Levand * are registered with the HV through lv1_configure_irq_state_bitmap(). 5157715765SGeoff Levand * The HV requires that the 512 bits of status + mask not cross a page 5257715765SGeoff Levand * boundary. PS3_BMP_MINALIGN is used to define this minimal 64 byte 5357715765SGeoff Levand * alignment. 54861be32cSGeoff Levand * 55861be32cSGeoff Levand * The HV supports 256 plugs per thread, assigned as {0..255}, for a total 56861be32cSGeoff Levand * of 512 plugs supported on a processor. To simplify the logic this 57861be32cSGeoff Levand * implementation equates HV plug value to Linux virq value, constrains each 58861be32cSGeoff Levand * interrupt to have a system wide unique plug number, and limits the range 59861be32cSGeoff Levand * of the plug values to map into the first dword of the bitmaps. This 60861be32cSGeoff Levand * gives a usable range of plug values of {NUM_ISA_INTERRUPTS..63}. Note 61861be32cSGeoff Levand * that there is no constraint on how many in this set an individual thread 62861be32cSGeoff Levand * can acquire. 63861be32cSGeoff Levand */ 64861be32cSGeoff Levand 6557715765SGeoff Levand #define PS3_BMP_MINALIGN 64 6657715765SGeoff Levand 67861be32cSGeoff Levand struct ps3_bmp { 68861be32cSGeoff Levand struct { 69861be32cSGeoff Levand u64 status; 70861be32cSGeoff Levand u64 unused_1[3]; 71861be32cSGeoff Levand u64 mask; 72861be32cSGeoff Levand u64 unused_2[3]; 73861be32cSGeoff Levand }; 74861be32cSGeoff Levand u64 ipi_debug_brk_mask; 75861be32cSGeoff Levand spinlock_t lock; 76861be32cSGeoff Levand }; 77861be32cSGeoff Levand 78861be32cSGeoff Levand /** 79861be32cSGeoff Levand * struct ps3_private - a per cpu data structure 80861be32cSGeoff Levand * @bmp: ps3_bmp structure 81aab83500SGeoff Levand * @ppe_id: HV logical_ppe_id 82aab83500SGeoff Levand * @thread_id: HV thread_id 83861be32cSGeoff Levand */ 84861be32cSGeoff Levand 85861be32cSGeoff Levand struct ps3_private { 8657715765SGeoff Levand struct ps3_bmp bmp __attribute__ ((aligned (PS3_BMP_MINALIGN))); 87aab83500SGeoff Levand u64 ppe_id; 88aab83500SGeoff Levand u64 thread_id; 89861be32cSGeoff Levand }; 90861be32cSGeoff Levand 91861be32cSGeoff Levand static DEFINE_PER_CPU(struct ps3_private, ps3_private); 92861be32cSGeoff Levand 93dc4f60c2SGeoff Levand /** 94743c1bb0SGeoff Levand * ps3_chip_mask - Set an interrupt mask bit in ps3_bmp. 95743c1bb0SGeoff Levand * @virq: The assigned Linux virq. 96743c1bb0SGeoff Levand * 97743c1bb0SGeoff Levand * Sets ps3_bmp.mask and calls lv1_did_update_interrupt_mask(). 98743c1bb0SGeoff Levand */ 99743c1bb0SGeoff Levand 100743c1bb0SGeoff Levand static void ps3_chip_mask(unsigned int virq) 101743c1bb0SGeoff Levand { 102743c1bb0SGeoff Levand struct ps3_private *pd = get_irq_chip_data(virq); 103743c1bb0SGeoff Levand unsigned long flags; 104743c1bb0SGeoff Levand 105aab83500SGeoff Levand pr_debug("%s:%d: thread_id %lu, virq %d\n", __func__, __LINE__, 106aab83500SGeoff Levand pd->thread_id, virq); 107743c1bb0SGeoff Levand 108743c1bb0SGeoff Levand local_irq_save(flags); 109a354ab85SGeoff Levand clear_bit(63 - virq, &pd->bmp.mask); 110aab83500SGeoff Levand lv1_did_update_interrupt_mask(pd->ppe_id, pd->thread_id); 111743c1bb0SGeoff Levand local_irq_restore(flags); 112743c1bb0SGeoff Levand } 113743c1bb0SGeoff Levand 114743c1bb0SGeoff Levand /** 115743c1bb0SGeoff Levand * ps3_chip_unmask - Clear an interrupt mask bit in ps3_bmp. 116743c1bb0SGeoff Levand * @virq: The assigned Linux virq. 117743c1bb0SGeoff Levand * 118743c1bb0SGeoff Levand * Clears ps3_bmp.mask and calls lv1_did_update_interrupt_mask(). 119743c1bb0SGeoff Levand */ 120743c1bb0SGeoff Levand 121743c1bb0SGeoff Levand static void ps3_chip_unmask(unsigned int virq) 122743c1bb0SGeoff Levand { 123743c1bb0SGeoff Levand struct ps3_private *pd = get_irq_chip_data(virq); 124743c1bb0SGeoff Levand unsigned long flags; 125743c1bb0SGeoff Levand 126aab83500SGeoff Levand pr_debug("%s:%d: thread_id %lu, virq %d\n", __func__, __LINE__, 127aab83500SGeoff Levand pd->thread_id, virq); 128743c1bb0SGeoff Levand 129743c1bb0SGeoff Levand local_irq_save(flags); 130a354ab85SGeoff Levand set_bit(63 - virq, &pd->bmp.mask); 131aab83500SGeoff Levand lv1_did_update_interrupt_mask(pd->ppe_id, pd->thread_id); 132743c1bb0SGeoff Levand local_irq_restore(flags); 133743c1bb0SGeoff Levand } 134743c1bb0SGeoff Levand 135743c1bb0SGeoff Levand /** 136743c1bb0SGeoff Levand * ps3_chip_eoi - HV end-of-interrupt. 137743c1bb0SGeoff Levand * @virq: The assigned Linux virq. 138743c1bb0SGeoff Levand * 139743c1bb0SGeoff Levand * Calls lv1_end_of_interrupt_ext(). 140743c1bb0SGeoff Levand */ 141743c1bb0SGeoff Levand 142743c1bb0SGeoff Levand static void ps3_chip_eoi(unsigned int virq) 143743c1bb0SGeoff Levand { 144743c1bb0SGeoff Levand const struct ps3_private *pd = get_irq_chip_data(virq); 145aab83500SGeoff Levand lv1_end_of_interrupt_ext(pd->ppe_id, pd->thread_id, virq); 146743c1bb0SGeoff Levand } 147743c1bb0SGeoff Levand 148743c1bb0SGeoff Levand /** 149743c1bb0SGeoff Levand * ps3_irq_chip - Represents the ps3_bmp as a Linux struct irq_chip. 150743c1bb0SGeoff Levand */ 151743c1bb0SGeoff Levand 152743c1bb0SGeoff Levand static struct irq_chip ps3_irq_chip = { 153743c1bb0SGeoff Levand .typename = "ps3", 154743c1bb0SGeoff Levand .mask = ps3_chip_mask, 155743c1bb0SGeoff Levand .unmask = ps3_chip_unmask, 156743c1bb0SGeoff Levand .eoi = ps3_chip_eoi, 157743c1bb0SGeoff Levand }; 158743c1bb0SGeoff Levand 159743c1bb0SGeoff Levand /** 160dc4f60c2SGeoff Levand * ps3_virq_setup - virq related setup. 161dc4f60c2SGeoff Levand * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be 162dc4f60c2SGeoff Levand * serviced on. 163dc4f60c2SGeoff Levand * @outlet: The HV outlet from the various create outlet routines. 164dc4f60c2SGeoff Levand * @virq: The assigned Linux virq. 165dc4f60c2SGeoff Levand * 166dc4f60c2SGeoff Levand * Calls irq_create_mapping() to get a virq and sets the chip data to 167dc4f60c2SGeoff Levand * ps3_private data. 168dc4f60c2SGeoff Levand */ 169dc4f60c2SGeoff Levand 170dc4f60c2SGeoff Levand int ps3_virq_setup(enum ps3_cpu_binding cpu, unsigned long outlet, 171861be32cSGeoff Levand unsigned int *virq) 172861be32cSGeoff Levand { 173861be32cSGeoff Levand int result; 174861be32cSGeoff Levand struct ps3_private *pd; 175861be32cSGeoff Levand 176861be32cSGeoff Levand /* This defines the default interrupt distribution policy. */ 177861be32cSGeoff Levand 178861be32cSGeoff Levand if (cpu == PS3_BINDING_CPU_ANY) 179861be32cSGeoff Levand cpu = 0; 180861be32cSGeoff Levand 181861be32cSGeoff Levand pd = &per_cpu(ps3_private, cpu); 182861be32cSGeoff Levand 183861be32cSGeoff Levand *virq = irq_create_mapping(NULL, outlet); 184861be32cSGeoff Levand 185861be32cSGeoff Levand if (*virq == NO_IRQ) { 186861be32cSGeoff Levand pr_debug("%s:%d: irq_create_mapping failed: outlet %lu\n", 187861be32cSGeoff Levand __func__, __LINE__, outlet); 188861be32cSGeoff Levand result = -ENOMEM; 189861be32cSGeoff Levand goto fail_create; 190861be32cSGeoff Levand } 191861be32cSGeoff Levand 192861be32cSGeoff Levand pr_debug("%s:%d: outlet %lu => cpu %u, virq %u\n", __func__, __LINE__, 193861be32cSGeoff Levand outlet, cpu, *virq); 194861be32cSGeoff Levand 195861be32cSGeoff Levand result = set_irq_chip_data(*virq, pd); 196861be32cSGeoff Levand 197861be32cSGeoff Levand if (result) { 198861be32cSGeoff Levand pr_debug("%s:%d: set_irq_chip_data failed\n", 199861be32cSGeoff Levand __func__, __LINE__); 200861be32cSGeoff Levand goto fail_set; 201861be32cSGeoff Levand } 202861be32cSGeoff Levand 2039263e85aSGeoff Levand ps3_chip_mask(*virq); 2049263e85aSGeoff Levand 205861be32cSGeoff Levand return result; 206861be32cSGeoff Levand 207861be32cSGeoff Levand fail_set: 208861be32cSGeoff Levand irq_dispose_mapping(*virq); 209861be32cSGeoff Levand fail_create: 210861be32cSGeoff Levand return result; 211861be32cSGeoff Levand } 212861be32cSGeoff Levand 213dc4f60c2SGeoff Levand /** 214dc4f60c2SGeoff Levand * ps3_virq_destroy - virq related teardown. 215dc4f60c2SGeoff Levand * @virq: The assigned Linux virq. 216dc4f60c2SGeoff Levand * 217dc4f60c2SGeoff Levand * Clears chip data and calls irq_dispose_mapping() for the virq. 218dc4f60c2SGeoff Levand */ 219dc4f60c2SGeoff Levand 220dc4f60c2SGeoff Levand int ps3_virq_destroy(unsigned int virq) 221dc4f60c2SGeoff Levand { 222dc4f60c2SGeoff Levand const struct ps3_private *pd = get_irq_chip_data(virq); 223dc4f60c2SGeoff Levand 224aab83500SGeoff Levand pr_debug("%s:%d: ppe_id %lu, thread_id %lu, virq %u\n", __func__, 225aab83500SGeoff Levand __LINE__, pd->ppe_id, pd->thread_id, virq); 226dc4f60c2SGeoff Levand 227dc4f60c2SGeoff Levand set_irq_chip_data(virq, NULL); 228dc4f60c2SGeoff Levand irq_dispose_mapping(virq); 229dc4f60c2SGeoff Levand 230dc4f60c2SGeoff Levand pr_debug("%s:%d <-\n", __func__, __LINE__); 231dc4f60c2SGeoff Levand return 0; 232dc4f60c2SGeoff Levand } 233dc4f60c2SGeoff Levand 234dc4f60c2SGeoff Levand /** 235dc4f60c2SGeoff Levand * ps3_irq_plug_setup - Generic outlet and virq related setup. 236dc4f60c2SGeoff Levand * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be 237dc4f60c2SGeoff Levand * serviced on. 238dc4f60c2SGeoff Levand * @outlet: The HV outlet from the various create outlet routines. 239dc4f60c2SGeoff Levand * @virq: The assigned Linux virq. 240dc4f60c2SGeoff Levand * 241dc4f60c2SGeoff Levand * Sets up virq and connects the irq plug. 242dc4f60c2SGeoff Levand */ 243dc4f60c2SGeoff Levand 244dc4f60c2SGeoff Levand int ps3_irq_plug_setup(enum ps3_cpu_binding cpu, unsigned long outlet, 245dc4f60c2SGeoff Levand unsigned int *virq) 246dc4f60c2SGeoff Levand { 247dc4f60c2SGeoff Levand int result; 248dc4f60c2SGeoff Levand struct ps3_private *pd; 249dc4f60c2SGeoff Levand 250dc4f60c2SGeoff Levand result = ps3_virq_setup(cpu, outlet, virq); 251dc4f60c2SGeoff Levand 252dc4f60c2SGeoff Levand if (result) { 253dc4f60c2SGeoff Levand pr_debug("%s:%d: ps3_virq_setup failed\n", __func__, __LINE__); 254dc4f60c2SGeoff Levand goto fail_setup; 255dc4f60c2SGeoff Levand } 256dc4f60c2SGeoff Levand 257dc4f60c2SGeoff Levand pd = get_irq_chip_data(*virq); 258dc4f60c2SGeoff Levand 259dc4f60c2SGeoff Levand /* Binds outlet to cpu + virq. */ 260dc4f60c2SGeoff Levand 261aab83500SGeoff Levand result = lv1_connect_irq_plug_ext(pd->ppe_id, pd->thread_id, *virq, 262aab83500SGeoff Levand outlet, 0); 263dc4f60c2SGeoff Levand 264dc4f60c2SGeoff Levand if (result) { 265dc4f60c2SGeoff Levand pr_info("%s:%d: lv1_connect_irq_plug_ext failed: %s\n", 266dc4f60c2SGeoff Levand __func__, __LINE__, ps3_result(result)); 267dc4f60c2SGeoff Levand result = -EPERM; 268dc4f60c2SGeoff Levand goto fail_connect; 269dc4f60c2SGeoff Levand } 270dc4f60c2SGeoff Levand 271dc4f60c2SGeoff Levand return result; 272dc4f60c2SGeoff Levand 273dc4f60c2SGeoff Levand fail_connect: 274dc4f60c2SGeoff Levand ps3_virq_destroy(*virq); 275dc4f60c2SGeoff Levand fail_setup: 276dc4f60c2SGeoff Levand return result; 277dc4f60c2SGeoff Levand } 278dc4f60c2SGeoff Levand EXPORT_SYMBOL_GPL(ps3_irq_plug_setup); 279dc4f60c2SGeoff Levand 280dc4f60c2SGeoff Levand /** 281dc4f60c2SGeoff Levand * ps3_irq_plug_destroy - Generic outlet and virq related teardown. 282dc4f60c2SGeoff Levand * @virq: The assigned Linux virq. 283dc4f60c2SGeoff Levand * 284dc4f60c2SGeoff Levand * Disconnects the irq plug and tears down virq. 285dc4f60c2SGeoff Levand * Do not call for system bus event interrupts setup with 286dc4f60c2SGeoff Levand * ps3_sb_event_receive_port_setup(). 287dc4f60c2SGeoff Levand */ 288dc4f60c2SGeoff Levand 289dc4f60c2SGeoff Levand int ps3_irq_plug_destroy(unsigned int virq) 290861be32cSGeoff Levand { 291861be32cSGeoff Levand int result; 292861be32cSGeoff Levand const struct ps3_private *pd = get_irq_chip_data(virq); 293861be32cSGeoff Levand 294aab83500SGeoff Levand pr_debug("%s:%d: ppe_id %lu, thread_id %lu, virq %u\n", __func__, 295aab83500SGeoff Levand __LINE__, pd->ppe_id, pd->thread_id, virq); 296861be32cSGeoff Levand 2979263e85aSGeoff Levand ps3_chip_mask(virq); 2989263e85aSGeoff Levand 299aab83500SGeoff Levand result = lv1_disconnect_irq_plug_ext(pd->ppe_id, pd->thread_id, virq); 300861be32cSGeoff Levand 301861be32cSGeoff Levand if (result) 302861be32cSGeoff Levand pr_info("%s:%d: lv1_disconnect_irq_plug_ext failed: %s\n", 303861be32cSGeoff Levand __func__, __LINE__, ps3_result(result)); 304861be32cSGeoff Levand 305dc4f60c2SGeoff Levand ps3_virq_destroy(virq); 306dc4f60c2SGeoff Levand 307b1eeb38eSGeert Uytterhoeven return result; 308861be32cSGeoff Levand } 309dc4f60c2SGeoff Levand EXPORT_SYMBOL_GPL(ps3_irq_plug_destroy); 310861be32cSGeoff Levand 311861be32cSGeoff Levand /** 312dc4f60c2SGeoff Levand * ps3_event_receive_port_setup - Setup an event receive port. 313861be32cSGeoff Levand * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be 314861be32cSGeoff Levand * serviced on. 3152832a81dSGeoff Levand * @virq: The assigned Linux virq. 3162832a81dSGeoff Levand * 3172832a81dSGeoff Levand * The virq can be used with lv1_connect_interrupt_event_receive_port() to 318dc4f60c2SGeoff Levand * arrange to receive interrupts from system-bus devices, or with 319dc4f60c2SGeoff Levand * ps3_send_event_locally() to signal events. 3202832a81dSGeoff Levand */ 3212832a81dSGeoff Levand 322dc4f60c2SGeoff Levand int ps3_event_receive_port_setup(enum ps3_cpu_binding cpu, unsigned int *virq) 3232832a81dSGeoff Levand { 3242832a81dSGeoff Levand int result; 3252832a81dSGeoff Levand unsigned long outlet; 3262832a81dSGeoff Levand 3272832a81dSGeoff Levand result = lv1_construct_event_receive_port(&outlet); 3282832a81dSGeoff Levand 3292832a81dSGeoff Levand if (result) { 3302832a81dSGeoff Levand pr_debug("%s:%d: lv1_construct_event_receive_port failed: %s\n", 3312832a81dSGeoff Levand __func__, __LINE__, ps3_result(result)); 3322832a81dSGeoff Levand *virq = NO_IRQ; 3332832a81dSGeoff Levand return result; 3342832a81dSGeoff Levand } 3352832a81dSGeoff Levand 336dc4f60c2SGeoff Levand result = ps3_irq_plug_setup(cpu, outlet, virq); 337861be32cSGeoff Levand BUG_ON(result); 3382832a81dSGeoff Levand 339861be32cSGeoff Levand return result; 3402832a81dSGeoff Levand } 341dc4f60c2SGeoff Levand EXPORT_SYMBOL_GPL(ps3_event_receive_port_setup); 3422832a81dSGeoff Levand 343dc4f60c2SGeoff Levand /** 344dc4f60c2SGeoff Levand * ps3_event_receive_port_destroy - Destroy an event receive port. 345dc4f60c2SGeoff Levand * @virq: The assigned Linux virq. 346dc4f60c2SGeoff Levand * 347dc4f60c2SGeoff Levand * Since ps3_event_receive_port_destroy destroys the receive port outlet, 348dc4f60c2SGeoff Levand * SB devices need to call disconnect_interrupt_event_receive_port() before 349dc4f60c2SGeoff Levand * this. 350dc4f60c2SGeoff Levand */ 351dc4f60c2SGeoff Levand 352dc4f60c2SGeoff Levand int ps3_event_receive_port_destroy(unsigned int virq) 3532832a81dSGeoff Levand { 3542832a81dSGeoff Levand int result; 3552832a81dSGeoff Levand 3569263e85aSGeoff Levand pr_debug(" -> %s:%d virq %u\n", __func__, __LINE__, virq); 3579263e85aSGeoff Levand 3589263e85aSGeoff Levand ps3_chip_mask(virq); 3592832a81dSGeoff Levand 3602832a81dSGeoff Levand result = lv1_destruct_event_receive_port(virq_to_hw(virq)); 3612832a81dSGeoff Levand 3622832a81dSGeoff Levand if (result) 3632832a81dSGeoff Levand pr_debug("%s:%d: lv1_destruct_event_receive_port failed: %s\n", 3642832a81dSGeoff Levand __func__, __LINE__, ps3_result(result)); 3652832a81dSGeoff Levand 3669263e85aSGeoff Levand /* 3679263e85aSGeoff Levand * Don't call ps3_virq_destroy() here since ps3_smp_cleanup_cpu() 3689263e85aSGeoff Levand * calls from interrupt context (smp_call_function) when kexecing. 369dc4f60c2SGeoff Levand */ 370dc4f60c2SGeoff Levand 3712832a81dSGeoff Levand pr_debug(" <- %s:%d\n", __func__, __LINE__); 3722832a81dSGeoff Levand return result; 3732832a81dSGeoff Levand } 3742832a81dSGeoff Levand 3752832a81dSGeoff Levand int ps3_send_event_locally(unsigned int virq) 3762832a81dSGeoff Levand { 3772832a81dSGeoff Levand return lv1_send_event_locally(virq_to_hw(virq)); 3782832a81dSGeoff Levand } 3792832a81dSGeoff Levand 3802832a81dSGeoff Levand /** 381dc4f60c2SGeoff Levand * ps3_sb_event_receive_port_setup - Setup a system bus event receive port. 382861be32cSGeoff Levand * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be 383861be32cSGeoff Levand * serviced on. 3846bb5cf10SGeoff Levand * @dev: The system bus device instance. 3852832a81dSGeoff Levand * @virq: The assigned Linux virq. 3862832a81dSGeoff Levand * 3872832a81dSGeoff Levand * An event irq represents a virtual device interrupt. The interrupt_id 3882832a81dSGeoff Levand * coresponds to the software interrupt number. 3892832a81dSGeoff Levand */ 3902832a81dSGeoff Levand 3916bb5cf10SGeoff Levand int ps3_sb_event_receive_port_setup(struct ps3_system_bus_device *dev, 3926bb5cf10SGeoff Levand enum ps3_cpu_binding cpu, unsigned int *virq) 3932832a81dSGeoff Levand { 394dc4f60c2SGeoff Levand /* this should go in system-bus.c */ 395dc4f60c2SGeoff Levand 3962832a81dSGeoff Levand int result; 3972832a81dSGeoff Levand 398dc4f60c2SGeoff Levand result = ps3_event_receive_port_setup(cpu, virq); 3992832a81dSGeoff Levand 4002832a81dSGeoff Levand if (result) 4012832a81dSGeoff Levand return result; 4022832a81dSGeoff Levand 4036bb5cf10SGeoff Levand result = lv1_connect_interrupt_event_receive_port(dev->bus_id, 4046bb5cf10SGeoff Levand dev->dev_id, virq_to_hw(*virq), dev->interrupt_id); 4052832a81dSGeoff Levand 4062832a81dSGeoff Levand if (result) { 4072832a81dSGeoff Levand pr_debug("%s:%d: lv1_connect_interrupt_event_receive_port" 4082832a81dSGeoff Levand " failed: %s\n", __func__, __LINE__, 4092832a81dSGeoff Levand ps3_result(result)); 410dc4f60c2SGeoff Levand ps3_event_receive_port_destroy(*virq); 4112832a81dSGeoff Levand *virq = NO_IRQ; 4122832a81dSGeoff Levand return result; 4132832a81dSGeoff Levand } 4142832a81dSGeoff Levand 4152832a81dSGeoff Levand pr_debug("%s:%d: interrupt_id %u, virq %u\n", __func__, __LINE__, 4166bb5cf10SGeoff Levand dev->interrupt_id, *virq); 4172832a81dSGeoff Levand 4182832a81dSGeoff Levand return 0; 4192832a81dSGeoff Levand } 420dc4f60c2SGeoff Levand EXPORT_SYMBOL(ps3_sb_event_receive_port_setup); 4212832a81dSGeoff Levand 4226bb5cf10SGeoff Levand int ps3_sb_event_receive_port_destroy(struct ps3_system_bus_device *dev, 4236bb5cf10SGeoff Levand unsigned int virq) 4242832a81dSGeoff Levand { 425dc4f60c2SGeoff Levand /* this should go in system-bus.c */ 426dc4f60c2SGeoff Levand 4272832a81dSGeoff Levand int result; 4282832a81dSGeoff Levand 4292832a81dSGeoff Levand pr_debug(" -> %s:%d: interrupt_id %u, virq %u\n", __func__, __LINE__, 4306bb5cf10SGeoff Levand dev->interrupt_id, virq); 4312832a81dSGeoff Levand 4326bb5cf10SGeoff Levand result = lv1_disconnect_interrupt_event_receive_port(dev->bus_id, 4336bb5cf10SGeoff Levand dev->dev_id, virq_to_hw(virq), dev->interrupt_id); 4342832a81dSGeoff Levand 4352832a81dSGeoff Levand if (result) 4362832a81dSGeoff Levand pr_debug("%s:%d: lv1_disconnect_interrupt_event_receive_port" 4372832a81dSGeoff Levand " failed: %s\n", __func__, __LINE__, 4382832a81dSGeoff Levand ps3_result(result)); 4392832a81dSGeoff Levand 440dc4f60c2SGeoff Levand result = ps3_event_receive_port_destroy(virq); 441dc4f60c2SGeoff Levand BUG_ON(result); 4422832a81dSGeoff Levand 4439263e85aSGeoff Levand /* 4449263e85aSGeoff Levand * ps3_event_receive_port_destroy() destroys the IRQ plug, 4459263e85aSGeoff Levand * so don't call ps3_irq_plug_destroy() here. 4469263e85aSGeoff Levand */ 4479263e85aSGeoff Levand 4489263e85aSGeoff Levand result = ps3_virq_destroy(virq); 4499263e85aSGeoff Levand BUG_ON(result); 4509263e85aSGeoff Levand 4512832a81dSGeoff Levand pr_debug(" <- %s:%d\n", __func__, __LINE__); 4522832a81dSGeoff Levand return result; 4532832a81dSGeoff Levand } 454dc4f60c2SGeoff Levand EXPORT_SYMBOL(ps3_sb_event_receive_port_destroy); 4552832a81dSGeoff Levand 4562832a81dSGeoff Levand /** 457dc4f60c2SGeoff Levand * ps3_io_irq_setup - Setup a system bus io irq. 458dc4f60c2SGeoff Levand * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be 459dc4f60c2SGeoff Levand * serviced on. 460dc4f60c2SGeoff Levand * @interrupt_id: The device interrupt id read from the system repository. 461dc4f60c2SGeoff Levand * @virq: The assigned Linux virq. 462dc4f60c2SGeoff Levand * 463dc4f60c2SGeoff Levand * An io irq represents a non-virtualized device interrupt. interrupt_id 464dc4f60c2SGeoff Levand * coresponds to the interrupt number of the interrupt controller. 465dc4f60c2SGeoff Levand */ 466dc4f60c2SGeoff Levand 467dc4f60c2SGeoff Levand int ps3_io_irq_setup(enum ps3_cpu_binding cpu, unsigned int interrupt_id, 468dc4f60c2SGeoff Levand unsigned int *virq) 469dc4f60c2SGeoff Levand { 470dc4f60c2SGeoff Levand int result; 471dc4f60c2SGeoff Levand unsigned long outlet; 472dc4f60c2SGeoff Levand 473dc4f60c2SGeoff Levand result = lv1_construct_io_irq_outlet(interrupt_id, &outlet); 474dc4f60c2SGeoff Levand 475dc4f60c2SGeoff Levand if (result) { 476dc4f60c2SGeoff Levand pr_debug("%s:%d: lv1_construct_io_irq_outlet failed: %s\n", 477dc4f60c2SGeoff Levand __func__, __LINE__, ps3_result(result)); 478dc4f60c2SGeoff Levand return result; 479dc4f60c2SGeoff Levand } 480dc4f60c2SGeoff Levand 481dc4f60c2SGeoff Levand result = ps3_irq_plug_setup(cpu, outlet, virq); 482dc4f60c2SGeoff Levand BUG_ON(result); 483dc4f60c2SGeoff Levand 484dc4f60c2SGeoff Levand return result; 485dc4f60c2SGeoff Levand } 486dc4f60c2SGeoff Levand EXPORT_SYMBOL_GPL(ps3_io_irq_setup); 487dc4f60c2SGeoff Levand 488dc4f60c2SGeoff Levand int ps3_io_irq_destroy(unsigned int virq) 489dc4f60c2SGeoff Levand { 490dc4f60c2SGeoff Levand int result; 4919263e85aSGeoff Levand unsigned long outlet = virq_to_hw(virq); 492dc4f60c2SGeoff Levand 4939263e85aSGeoff Levand ps3_chip_mask(virq); 4949263e85aSGeoff Levand 4959263e85aSGeoff Levand /* 4969263e85aSGeoff Levand * lv1_destruct_io_irq_outlet() will destroy the IRQ plug, 4979263e85aSGeoff Levand * so call ps3_irq_plug_destroy() first. 4989263e85aSGeoff Levand */ 4999263e85aSGeoff Levand 5009263e85aSGeoff Levand result = ps3_irq_plug_destroy(virq); 5019263e85aSGeoff Levand BUG_ON(result); 5029263e85aSGeoff Levand 5039263e85aSGeoff Levand result = lv1_destruct_io_irq_outlet(outlet); 504dc4f60c2SGeoff Levand 505dc4f60c2SGeoff Levand if (result) 506dc4f60c2SGeoff Levand pr_debug("%s:%d: lv1_destruct_io_irq_outlet failed: %s\n", 507dc4f60c2SGeoff Levand __func__, __LINE__, ps3_result(result)); 508dc4f60c2SGeoff Levand 509dc4f60c2SGeoff Levand return result; 510dc4f60c2SGeoff Levand } 511dc4f60c2SGeoff Levand EXPORT_SYMBOL_GPL(ps3_io_irq_destroy); 512dc4f60c2SGeoff Levand 513dc4f60c2SGeoff Levand /** 514dc4f60c2SGeoff Levand * ps3_vuart_irq_setup - Setup the system virtual uart virq. 515861be32cSGeoff Levand * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be 516861be32cSGeoff Levand * serviced on. 5172832a81dSGeoff Levand * @virt_addr_bmp: The caller supplied virtual uart interrupt bitmap. 5182832a81dSGeoff Levand * @virq: The assigned Linux virq. 5192832a81dSGeoff Levand * 5202832a81dSGeoff Levand * The system supports only a single virtual uart, so multiple calls without 5212832a81dSGeoff Levand * freeing the interrupt will return a wrong state error. 5222832a81dSGeoff Levand */ 5232832a81dSGeoff Levand 524dc4f60c2SGeoff Levand int ps3_vuart_irq_setup(enum ps3_cpu_binding cpu, void* virt_addr_bmp, 525861be32cSGeoff Levand unsigned int *virq) 5262832a81dSGeoff Levand { 5272832a81dSGeoff Levand int result; 5282832a81dSGeoff Levand unsigned long outlet; 529861be32cSGeoff Levand u64 lpar_addr; 5302832a81dSGeoff Levand 531861be32cSGeoff Levand BUG_ON(!is_kernel_addr((u64)virt_addr_bmp)); 5322832a81dSGeoff Levand 5332832a81dSGeoff Levand lpar_addr = ps3_mm_phys_to_lpar(__pa(virt_addr_bmp)); 5342832a81dSGeoff Levand 5352832a81dSGeoff Levand result = lv1_configure_virtual_uart_irq(lpar_addr, &outlet); 5362832a81dSGeoff Levand 5372832a81dSGeoff Levand if (result) { 5382832a81dSGeoff Levand pr_debug("%s:%d: lv1_configure_virtual_uart_irq failed: %s\n", 5392832a81dSGeoff Levand __func__, __LINE__, ps3_result(result)); 5402832a81dSGeoff Levand return result; 5412832a81dSGeoff Levand } 5422832a81dSGeoff Levand 543dc4f60c2SGeoff Levand result = ps3_irq_plug_setup(cpu, outlet, virq); 544861be32cSGeoff Levand BUG_ON(result); 5452832a81dSGeoff Levand 546861be32cSGeoff Levand return result; 5472832a81dSGeoff Levand } 5487626e78dSGeoff Levand EXPORT_SYMBOL_GPL(ps3_vuart_irq_setup); 5492832a81dSGeoff Levand 550dc4f60c2SGeoff Levand int ps3_vuart_irq_destroy(unsigned int virq) 5512832a81dSGeoff Levand { 5522832a81dSGeoff Levand int result; 5532832a81dSGeoff Levand 5549263e85aSGeoff Levand ps3_chip_mask(virq); 5552832a81dSGeoff Levand result = lv1_deconfigure_virtual_uart_irq(); 5562832a81dSGeoff Levand 5572832a81dSGeoff Levand if (result) { 5582832a81dSGeoff Levand pr_debug("%s:%d: lv1_configure_virtual_uart_irq failed: %s\n", 5592832a81dSGeoff Levand __func__, __LINE__, ps3_result(result)); 5602832a81dSGeoff Levand return result; 5612832a81dSGeoff Levand } 5622832a81dSGeoff Levand 563dc4f60c2SGeoff Levand result = ps3_irq_plug_destroy(virq); 564dc4f60c2SGeoff Levand BUG_ON(result); 5652832a81dSGeoff Levand 5662832a81dSGeoff Levand return result; 5672832a81dSGeoff Levand } 5687626e78dSGeoff Levand EXPORT_SYMBOL_GPL(ps3_vuart_irq_destroy); 5692832a81dSGeoff Levand 5702832a81dSGeoff Levand /** 571dc4f60c2SGeoff Levand * ps3_spe_irq_setup - Setup an spe virq. 572861be32cSGeoff Levand * @cpu: enum ps3_cpu_binding indicating the cpu the interrupt should be 573861be32cSGeoff Levand * serviced on. 5742832a81dSGeoff Levand * @spe_id: The spe_id returned from lv1_construct_logical_spe(). 5752832a81dSGeoff Levand * @class: The spe interrupt class {0,1,2}. 5762832a81dSGeoff Levand * @virq: The assigned Linux virq. 5772832a81dSGeoff Levand * 5782832a81dSGeoff Levand */ 5792832a81dSGeoff Levand 580dc4f60c2SGeoff Levand int ps3_spe_irq_setup(enum ps3_cpu_binding cpu, unsigned long spe_id, 581861be32cSGeoff Levand unsigned int class, unsigned int *virq) 5822832a81dSGeoff Levand { 5832832a81dSGeoff Levand int result; 5842832a81dSGeoff Levand unsigned long outlet; 5852832a81dSGeoff Levand 5862832a81dSGeoff Levand BUG_ON(class > 2); 5872832a81dSGeoff Levand 5882832a81dSGeoff Levand result = lv1_get_spe_irq_outlet(spe_id, class, &outlet); 5892832a81dSGeoff Levand 5902832a81dSGeoff Levand if (result) { 5912832a81dSGeoff Levand pr_debug("%s:%d: lv1_get_spe_irq_outlet failed: %s\n", 5922832a81dSGeoff Levand __func__, __LINE__, ps3_result(result)); 5932832a81dSGeoff Levand return result; 5942832a81dSGeoff Levand } 5952832a81dSGeoff Levand 596dc4f60c2SGeoff Levand result = ps3_irq_plug_setup(cpu, outlet, virq); 597861be32cSGeoff Levand BUG_ON(result); 5982832a81dSGeoff Levand 599861be32cSGeoff Levand return result; 6002832a81dSGeoff Levand } 6012832a81dSGeoff Levand 602dc4f60c2SGeoff Levand int ps3_spe_irq_destroy(unsigned int virq) 6032832a81dSGeoff Levand { 6049263e85aSGeoff Levand int result; 6059263e85aSGeoff Levand 6069263e85aSGeoff Levand ps3_chip_mask(virq); 6079263e85aSGeoff Levand 6089263e85aSGeoff Levand result = ps3_irq_plug_destroy(virq); 609dc4f60c2SGeoff Levand BUG_ON(result); 6109263e85aSGeoff Levand 6119263e85aSGeoff Levand return result; 6122832a81dSGeoff Levand } 6132832a81dSGeoff Levand 614b1eeb38eSGeert Uytterhoeven 6152832a81dSGeoff Levand #define PS3_INVALID_OUTLET ((irq_hw_number_t)-1) 6162832a81dSGeoff Levand #define PS3_PLUG_MAX 63 6172832a81dSGeoff Levand 6182832a81dSGeoff Levand #if defined(DEBUG) 619861be32cSGeoff Levand static void _dump_64_bmp(const char *header, const u64 *p, unsigned cpu, 6202832a81dSGeoff Levand const char* func, int line) 6212832a81dSGeoff Levand { 6222832a81dSGeoff Levand pr_debug("%s:%d: %s %u {%04lx_%04lx_%04lx_%04lx}\n", 6232832a81dSGeoff Levand func, line, header, cpu, 6242832a81dSGeoff Levand *p >> 48, (*p >> 32) & 0xffff, (*p >> 16) & 0xffff, 6252832a81dSGeoff Levand *p & 0xffff); 6262832a81dSGeoff Levand } 6272832a81dSGeoff Levand 628848cfdc5SGeoff Levand static void __maybe_unused _dump_256_bmp(const char *header, 629861be32cSGeoff Levand const u64 *p, unsigned cpu, const char* func, int line) 6302832a81dSGeoff Levand { 6312832a81dSGeoff Levand pr_debug("%s:%d: %s %u {%016lx:%016lx:%016lx:%016lx}\n", 6322832a81dSGeoff Levand func, line, header, cpu, p[0], p[1], p[2], p[3]); 6332832a81dSGeoff Levand } 6342832a81dSGeoff Levand 6352832a81dSGeoff Levand #define dump_bmp(_x) _dump_bmp(_x, __func__, __LINE__) 6369633ac8dSGeoff Levand static void _dump_bmp(struct ps3_private* pd, const char* func, int line) 6372832a81dSGeoff Levand { 6382832a81dSGeoff Levand unsigned long flags; 6392832a81dSGeoff Levand 6402832a81dSGeoff Levand spin_lock_irqsave(&pd->bmp.lock, flags); 641aab83500SGeoff Levand _dump_64_bmp("stat", &pd->bmp.status, pd->thread_id, func, line); 642aab83500SGeoff Levand _dump_64_bmp("mask", &pd->bmp.mask, pd->thread_id, func, line); 6432832a81dSGeoff Levand spin_unlock_irqrestore(&pd->bmp.lock, flags); 6442832a81dSGeoff Levand } 6452832a81dSGeoff Levand 6462832a81dSGeoff Levand #define dump_mask(_x) _dump_mask(_x, __func__, __LINE__) 647848cfdc5SGeoff Levand static void __maybe_unused _dump_mask(struct ps3_private *pd, 6482832a81dSGeoff Levand const char* func, int line) 6492832a81dSGeoff Levand { 6502832a81dSGeoff Levand unsigned long flags; 6512832a81dSGeoff Levand 6522832a81dSGeoff Levand spin_lock_irqsave(&pd->bmp.lock, flags); 653aab83500SGeoff Levand _dump_64_bmp("mask", &pd->bmp.mask, pd->thread_id, func, line); 6542832a81dSGeoff Levand spin_unlock_irqrestore(&pd->bmp.lock, flags); 6552832a81dSGeoff Levand } 6562832a81dSGeoff Levand #else 6579633ac8dSGeoff Levand static void dump_bmp(struct ps3_private* pd) {}; 6582832a81dSGeoff Levand #endif /* defined(DEBUG) */ 6592832a81dSGeoff Levand 6609633ac8dSGeoff Levand static void ps3_host_unmap(struct irq_host *h, unsigned int virq) 6612832a81dSGeoff Levand { 662861be32cSGeoff Levand set_irq_chip_data(virq, NULL); 6632832a81dSGeoff Levand } 6642832a81dSGeoff Levand 6659633ac8dSGeoff Levand static int ps3_host_map(struct irq_host *h, unsigned int virq, 6662832a81dSGeoff Levand irq_hw_number_t hwirq) 6672832a81dSGeoff Levand { 668861be32cSGeoff Levand pr_debug("%s:%d: hwirq %lu, virq %u\n", __func__, __LINE__, hwirq, 669861be32cSGeoff Levand virq); 6702832a81dSGeoff Levand 6719263e85aSGeoff Levand set_irq_chip_and_handler(virq, &ps3_irq_chip, handle_fasteoi_irq); 6722832a81dSGeoff Levand 673861be32cSGeoff Levand return 0; 6742832a81dSGeoff Levand } 6752832a81dSGeoff Levand 676*8528ab84SMichael Ellerman static int ps3_host_match(struct irq_host *h, struct device_node *np) 677*8528ab84SMichael Ellerman { 678*8528ab84SMichael Ellerman /* Match all */ 679*8528ab84SMichael Ellerman return 1; 680*8528ab84SMichael Ellerman } 681*8528ab84SMichael Ellerman 6829633ac8dSGeoff Levand static struct irq_host_ops ps3_host_ops = { 6839633ac8dSGeoff Levand .map = ps3_host_map, 6849633ac8dSGeoff Levand .unmap = ps3_host_unmap, 685*8528ab84SMichael Ellerman .match = ps3_host_match, 6862832a81dSGeoff Levand }; 6872832a81dSGeoff Levand 6882832a81dSGeoff Levand void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq) 6892832a81dSGeoff Levand { 6909633ac8dSGeoff Levand struct ps3_private *pd = &per_cpu(ps3_private, cpu); 6912832a81dSGeoff Levand 6922832a81dSGeoff Levand pd->bmp.ipi_debug_brk_mask = 0x8000000000000000UL >> virq; 6932832a81dSGeoff Levand 6942832a81dSGeoff Levand pr_debug("%s:%d: cpu %u, virq %u, mask %lxh\n", __func__, __LINE__, 6952832a81dSGeoff Levand cpu, virq, pd->bmp.ipi_debug_brk_mask); 6962832a81dSGeoff Levand } 6972832a81dSGeoff Levand 6989263e85aSGeoff Levand static unsigned int ps3_get_irq(void) 6992832a81dSGeoff Levand { 7009cf9e196SBenjamin Herrenschmidt struct ps3_private *pd = &__get_cpu_var(ps3_private); 701861be32cSGeoff Levand u64 x = (pd->bmp.status & pd->bmp.mask); 7029cf9e196SBenjamin Herrenschmidt unsigned int plug; 7032832a81dSGeoff Levand 7042832a81dSGeoff Levand /* check for ipi break first to stop this cpu ASAP */ 7052832a81dSGeoff Levand 7069cf9e196SBenjamin Herrenschmidt if (x & pd->bmp.ipi_debug_brk_mask) 7079cf9e196SBenjamin Herrenschmidt x &= pd->bmp.ipi_debug_brk_mask; 7082832a81dSGeoff Levand 7099cf9e196SBenjamin Herrenschmidt asm volatile("cntlzd %0,%1" : "=r" (plug) : "r" (x)); 7109cf9e196SBenjamin Herrenschmidt plug &= 0x3f; 7112832a81dSGeoff Levand 7129cf9e196SBenjamin Herrenschmidt if (unlikely(plug) == NO_IRQ) { 713aab83500SGeoff Levand pr_debug("%s:%d: no plug found: thread_id %lu\n", __func__, 714aab83500SGeoff Levand __LINE__, pd->thread_id); 7159633ac8dSGeoff Levand dump_bmp(&per_cpu(ps3_private, 0)); 7169633ac8dSGeoff Levand dump_bmp(&per_cpu(ps3_private, 1)); 7172832a81dSGeoff Levand return NO_IRQ; 7182832a81dSGeoff Levand } 7192832a81dSGeoff Levand 7202832a81dSGeoff Levand #if defined(DEBUG) 7219cf9e196SBenjamin Herrenschmidt if (unlikely(plug < NUM_ISA_INTERRUPTS || plug > PS3_PLUG_MAX)) { 7229633ac8dSGeoff Levand dump_bmp(&per_cpu(ps3_private, 0)); 7239633ac8dSGeoff Levand dump_bmp(&per_cpu(ps3_private, 1)); 7242832a81dSGeoff Levand BUG(); 7252832a81dSGeoff Levand } 7262832a81dSGeoff Levand #endif 7272832a81dSGeoff Levand return plug; 7282832a81dSGeoff Levand } 7292832a81dSGeoff Levand 7302832a81dSGeoff Levand void __init ps3_init_IRQ(void) 7312832a81dSGeoff Levand { 7322832a81dSGeoff Levand int result; 7332832a81dSGeoff Levand unsigned cpu; 7342832a81dSGeoff Levand struct irq_host *host; 7352832a81dSGeoff Levand 73652964f87SMichael Ellerman host = irq_alloc_host(NULL, IRQ_HOST_MAP_NOMAP, 0, &ps3_host_ops, 7372832a81dSGeoff Levand PS3_INVALID_OUTLET); 7382832a81dSGeoff Levand irq_set_default_host(host); 7392832a81dSGeoff Levand irq_set_virq_count(PS3_PLUG_MAX + 1); 7402832a81dSGeoff Levand 7412832a81dSGeoff Levand for_each_possible_cpu(cpu) { 7429633ac8dSGeoff Levand struct ps3_private *pd = &per_cpu(ps3_private, cpu); 7432832a81dSGeoff Levand 744aab83500SGeoff Levand lv1_get_logical_ppe_id(&pd->ppe_id); 745aab83500SGeoff Levand pd->thread_id = get_hard_smp_processor_id(cpu); 7462832a81dSGeoff Levand spin_lock_init(&pd->bmp.lock); 7472832a81dSGeoff Levand 748aab83500SGeoff Levand pr_debug("%s:%d: ppe_id %lu, thread_id %lu, bmp %lxh\n", 749aab83500SGeoff Levand __func__, __LINE__, pd->ppe_id, pd->thread_id, 750407e24a0SGeoff Levand ps3_mm_phys_to_lpar(__pa(&pd->bmp))); 751407e24a0SGeoff Levand 752aab83500SGeoff Levand result = lv1_configure_irq_state_bitmap(pd->ppe_id, 753aab83500SGeoff Levand pd->thread_id, ps3_mm_phys_to_lpar(__pa(&pd->bmp))); 7542832a81dSGeoff Levand 7552832a81dSGeoff Levand if (result) 7562832a81dSGeoff Levand pr_debug("%s:%d: lv1_configure_irq_state_bitmap failed:" 7572832a81dSGeoff Levand " %s\n", __func__, __LINE__, 7582832a81dSGeoff Levand ps3_result(result)); 7592832a81dSGeoff Levand } 7602832a81dSGeoff Levand 7612832a81dSGeoff Levand ppc_md.get_irq = ps3_get_irq; 7622832a81dSGeoff Levand } 7639263e85aSGeoff Levand 7649263e85aSGeoff Levand void ps3_shutdown_IRQ(int cpu) 7659263e85aSGeoff Levand { 7669263e85aSGeoff Levand int result; 7679263e85aSGeoff Levand u64 ppe_id; 7689263e85aSGeoff Levand u64 thread_id = get_hard_smp_processor_id(cpu); 7699263e85aSGeoff Levand 7709263e85aSGeoff Levand lv1_get_logical_ppe_id(&ppe_id); 7719263e85aSGeoff Levand result = lv1_configure_irq_state_bitmap(ppe_id, thread_id, 0); 7729263e85aSGeoff Levand 7739263e85aSGeoff Levand DBG("%s:%d: lv1_configure_irq_state_bitmap (%lu:%lu/%d) %s\n", __func__, 7749263e85aSGeoff Levand __LINE__, ppe_id, thread_id, cpu, ps3_result(result)); 7759263e85aSGeoff Levand } 776