xics-common.c (b6aa39228966e0d3f0bc3306be1892f87792903a) | xics-common.c (880a3d6afd068682d6386a0528be1217541d3d8e) |
---|---|
1/* 2 * Copyright 2011 IBM Corporation. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 7 * 2 of the License, or (at your option) any later version. 8 * --- 314 unchanged lines hidden (view full) --- 323 324static int xics_host_map(struct irq_domain *h, unsigned int virq, 325 irq_hw_number_t hw) 326{ 327 struct ics *ics; 328 329 pr_devel("xics: map virq %d, hwirq 0x%lx\n", virq, hw); 330 | 1/* 2 * Copyright 2011 IBM Corporation. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 7 * 2 of the License, or (at your option) any later version. 8 * --- 314 unchanged lines hidden (view full) --- 323 324static int xics_host_map(struct irq_domain *h, unsigned int virq, 325 irq_hw_number_t hw) 326{ 327 struct ics *ics; 328 329 pr_devel("xics: map virq %d, hwirq 0x%lx\n", virq, hw); 330 |
331 /* They aren't all level sensitive but we just don't really know */ 332 irq_set_status_flags(virq, IRQ_LEVEL); | 331 /* 332 * Mark interrupts as edge sensitive by default so that resend 333 * actually works. The device-tree parsing will turn the LSIs 334 * back to level. 335 */ 336 irq_clear_status_flags(virq, IRQ_LEVEL); |
333 334 /* Don't call into ICS for IPIs */ 335 if (hw == XICS_IPI) { 336 irq_set_chip_and_handler(virq, &xics_ipi_chip, 337 handle_percpu_irq); 338 return 0; 339 } 340 --- 5 unchanged lines hidden (view full) --- 346 return -EINVAL; 347} 348 349static int xics_host_xlate(struct irq_domain *h, struct device_node *ct, 350 const u32 *intspec, unsigned int intsize, 351 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 352 353{ | 337 338 /* Don't call into ICS for IPIs */ 339 if (hw == XICS_IPI) { 340 irq_set_chip_and_handler(virq, &xics_ipi_chip, 341 handle_percpu_irq); 342 return 0; 343 } 344 --- 5 unchanged lines hidden (view full) --- 350 return -EINVAL; 351} 352 353static int xics_host_xlate(struct irq_domain *h, struct device_node *ct, 354 const u32 *intspec, unsigned int intsize, 355 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 356 357{ |
354 /* Current xics implementation translates everything 355 * to level. It is not technically right for MSIs but this 356 * is irrelevant at this point. We might get smarter in the future 357 */ | |
358 *out_hwirq = intspec[0]; | 358 *out_hwirq = intspec[0]; |
359 *out_flags = IRQ_TYPE_LEVEL_LOW; | |
360 | 359 |
360 /* 361 * If intsize is at least 2, we look for the type in the second cell, 362 * we assume the LSB indicates a level interrupt. 363 */ 364 if (intsize > 1) { 365 if (intspec[1] & 1) 366 *out_flags = IRQ_TYPE_LEVEL_LOW; 367 else 368 *out_flags = IRQ_TYPE_EDGE_RISING; 369 } else 370 *out_flags = IRQ_TYPE_LEVEL_LOW; 371 |
|
361 return 0; 362} 363 | 372 return 0; 373} 374 |
375int xics_set_irq_type(struct irq_data *d, unsigned int flow_type) 376{ 377 /* 378 * We only support these. This has really no effect other than setting 379 * the corresponding descriptor bits mind you but those will in turn 380 * affect the resend function when re-enabling an edge interrupt. 381 * 382 * Set set the default to edge as explained in map(). 383 */ 384 if (flow_type == IRQ_TYPE_DEFAULT || flow_type == IRQ_TYPE_NONE) 385 flow_type = IRQ_TYPE_EDGE_RISING; 386 387 if (flow_type != IRQ_TYPE_EDGE_RISING && 388 flow_type != IRQ_TYPE_LEVEL_LOW) 389 return -EINVAL; 390 391 irqd_set_trigger_type(d, flow_type); 392 393 return IRQ_SET_MASK_OK_NOCOPY; 394} 395 396int xics_retrigger(struct irq_data *data) 397{ 398 /* 399 * We need to push a dummy CPPR when retriggering, since the subsequent 400 * EOI will try to pop it. Passing 0 works, as the function hard codes 401 * the priority value anyway. 402 */ 403 xics_push_cppr(0); 404 405 /* Tell the core to do a soft retrigger */ 406 return 0; 407} 408 |
|
364static const struct irq_domain_ops xics_host_ops = { 365 .match = xics_host_match, 366 .map = xics_host_map, 367 .xlate = xics_host_xlate, 368}; 369 370static void __init xics_init_host(void) 371{ --- 64 unchanged lines hidden --- | 409static const struct irq_domain_ops xics_host_ops = { 410 .match = xics_host_match, 411 .map = xics_host_map, 412 .xlate = xics_host_xlate, 413}; 414 415static void __init xics_init_host(void) 416{ --- 64 unchanged lines hidden --- |