Skip to content

Commit c1e18c1

Browse files
niklas88Vasily Gorbik
authored andcommitted
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>
1 parent e2bc3e9 commit c1e18c1

File tree

2 files changed

+42
-11
lines changed

2 files changed

+42
-11
lines changed

arch/s390/include/asm/pci.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ struct zpci_dev {
133133
u8 has_resources : 1;
134134
u8 is_physfn : 1;
135135
u8 util_str_avail : 1;
136-
u8 reserved : 3;
136+
u8 irqs_registered : 1;
137+
u8 reserved : 2;
137138
unsigned int devfn; /* DEVFN part of the RID*/
138139

139140
struct mutex lock;
@@ -271,9 +272,13 @@ struct zpci_dev *get_zdev_by_fid(u32);
271272
int zpci_dma_init(void);
272273
void zpci_dma_exit(void);
273274

275+
/* IRQ */
274276
int __init zpci_irq_init(void);
275277
void __init zpci_irq_exit(void);
276278

279+
int zpci_set_irq(struct zpci_dev *zdev);
280+
int zpci_clear_irq(struct zpci_dev *zdev);
281+
277282
/* FMB */
278283
int zpci_fmb_enable_device(struct zpci_dev *);
279284
int zpci_fmb_disable_device(struct zpci_dev *);

arch/s390/pci/pci_irq.c

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static struct airq_iv *zpci_sbv;
3535
*/
3636
static struct airq_iv **zpci_ibv;
3737

38-
/* Modify PCI: Register adapter interruptions */
38+
/* Modify PCI: Register floating adapter interruptions */
3939
static int zpci_set_airq(struct zpci_dev *zdev)
4040
{
4141
u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, ZPCI_MOD_FC_REG_INT);
@@ -53,7 +53,7 @@ static int zpci_set_airq(struct zpci_dev *zdev)
5353
return zpci_mod_fc(req, &fib, &status) ? -EIO : 0;
5454
}
5555

56-
/* Modify PCI: Unregister adapter interruptions */
56+
/* Modify PCI: Unregister floating adapter interruptions */
5757
static int zpci_clear_airq(struct zpci_dev *zdev)
5858
{
5959
u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, ZPCI_MOD_FC_DEREG_INT);
@@ -98,6 +98,38 @@ static int zpci_clear_directed_irq(struct zpci_dev *zdev)
9898
return cc ? -EIO : 0;
9999
}
100100

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;
131+
}
132+
101133
static int zpci_set_irq_affinity(struct irq_data *data, const struct cpumask *dest,
102134
bool force)
103135
{
@@ -311,10 +343,7 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
311343
zdev->msi_first_bit = bit;
312344
zdev->msi_nr_irqs = msi_vecs;
313345

314-
if (irq_delivery == DIRECTED)
315-
rc = zpci_set_directed_irq(zdev);
316-
else
317-
rc = zpci_set_airq(zdev);
346+
rc = zpci_set_irq(zdev);
318347
if (rc)
319348
return rc;
320349

@@ -328,10 +357,7 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev)
328357
int rc;
329358

330359
/* Disable interrupts */
331-
if (irq_delivery == DIRECTED)
332-
rc = zpci_clear_directed_irq(zdev);
333-
else
334-
rc = zpci_clear_airq(zdev);
360+
rc = zpci_clear_irq(zdev);
335361
if (rc)
336362
return;
337363

0 commit comments

Comments
 (0)