Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/pci: add zpci_set_irq()/zpci_clear_irq()

Pull the directed vs floating IRQ check into common
zpci_set_irq()/zpci_clear_irq() functions and expose them for the rest
of the zPCI subsystem. Furthermore we add a zdev flag bit to easily
check if IRQs are registered. This is needed for use in resetting a zPCI
function.

Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

authored by

Niklas Schnelle and committed by
Vasily Gorbik
c1e18c17 e2bc3e91

+42 -11
+6 -1
arch/s390/include/asm/pci.h
··· 133 133 u8 has_resources : 1; 134 134 u8 is_physfn : 1; 135 135 u8 util_str_avail : 1; 136 - u8 reserved : 3; 136 + u8 irqs_registered : 1; 137 + u8 reserved : 2; 137 138 unsigned int devfn; /* DEVFN part of the RID*/ 138 139 139 140 struct mutex lock; ··· 272 271 int zpci_dma_init(void); 273 272 void zpci_dma_exit(void); 274 273 274 + /* IRQ */ 275 275 int __init zpci_irq_init(void); 276 276 void __init zpci_irq_exit(void); 277 + 278 + int zpci_set_irq(struct zpci_dev *zdev); 279 + int zpci_clear_irq(struct zpci_dev *zdev); 277 280 278 281 /* FMB */ 279 282 int zpci_fmb_enable_device(struct zpci_dev *);
+36 -10
arch/s390/pci/pci_irq.c
··· 35 35 */ 36 36 static struct airq_iv **zpci_ibv; 37 37 38 - /* Modify PCI: Register adapter interruptions */ 38 + /* Modify PCI: Register floating adapter interruptions */ 39 39 static int zpci_set_airq(struct zpci_dev *zdev) 40 40 { 41 41 u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, ZPCI_MOD_FC_REG_INT); ··· 53 53 return zpci_mod_fc(req, &fib, &status) ? -EIO : 0; 54 54 } 55 55 56 - /* Modify PCI: Unregister adapter interruptions */ 56 + /* Modify PCI: Unregister floating adapter interruptions */ 57 57 static int zpci_clear_airq(struct zpci_dev *zdev) 58 58 { 59 59 u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, ZPCI_MOD_FC_DEREG_INT); ··· 96 96 cc = 0; 97 97 98 98 return cc ? -EIO : 0; 99 + } 100 + 101 + /* Register adapter interruptions */ 102 + int zpci_set_irq(struct zpci_dev *zdev) 103 + { 104 + int rc; 105 + 106 + if (irq_delivery == DIRECTED) 107 + rc = zpci_set_directed_irq(zdev); 108 + else 109 + rc = zpci_set_airq(zdev); 110 + 111 + if (!rc) 112 + zdev->irqs_registered = 1; 113 + 114 + return rc; 115 + } 116 + 117 + /* Clear adapter interruptions */ 118 + int zpci_clear_irq(struct zpci_dev *zdev) 119 + { 120 + int rc; 121 + 122 + if (irq_delivery == DIRECTED) 123 + rc = zpci_clear_directed_irq(zdev); 124 + else 125 + rc = zpci_clear_airq(zdev); 126 + 127 + if (!rc) 128 + zdev->irqs_registered = 0; 129 + 130 + return rc; 99 131 } 100 132 101 133 static int zpci_set_irq_affinity(struct irq_data *data, const struct cpumask *dest, ··· 343 311 zdev->msi_first_bit = bit; 344 312 zdev->msi_nr_irqs = msi_vecs; 345 313 346 - if (irq_delivery == DIRECTED) 347 - rc = zpci_set_directed_irq(zdev); 348 - else 349 - rc = zpci_set_airq(zdev); 314 + rc = zpci_set_irq(zdev); 350 315 if (rc) 351 316 return rc; 352 317 ··· 357 328 int rc; 358 329 359 330 /* Disable interrupts */ 360 - if (irq_delivery == DIRECTED) 361 - rc = zpci_clear_directed_irq(zdev); 362 - else 363 - rc = zpci_clear_airq(zdev); 331 + rc = zpci_clear_irq(zdev); 364 332 if (rc) 365 333 return; 366 334