Skip to content

Commit dfbf357

Browse files
committed
s390/pci: Ignore RID for isolated VFs
jira LE-2349 Rebuild_History Non-Buildable kernel-4.18.0-553.40.1.el8_10 commit-author Niklas Schnelle <schnelle@linux.ibm.com> commit 25f39d3 Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-4.18.0-553.40.1.el8_10/25f39d3d.failed Ensure that VFs used in isolation, that is with their parent PF not visible to the configuration but with their RID exposed, are treated compatibly with existing isolated VF use cases without exposed RID including RoCE Express VFs. This allows creating configurations where one LPAR manages PFs while their child VFs are used by other LPARs. This gives the LPAR managing the PFs a role analogous to that of the hypervisor in a typical use case of passing child VFs to guests. Instead of creating a multifunction struct zpci_bus whenever a PCI function with RID exposed is discovered only create such a bus for configured physical functions and only consider multifunction busses when searching for an existing bus. Additionally only set zdev->devfn to the devfn part of the RID once the function is added to a multifunction bus. This also fixes probing of more than 7 such isolated VFs from the same physical bus. This is because common PCI code in pci_scan_slot() only looks for more functions when pdev->multifunction is set which somewhat counter intutively is not the case for VFs. Note that PFs are looked at before their child VFs is guaranteed because we sort the zpci_list by RID ascending. Reviewed-by: Gerd Bayer <gbayer@linux.ibm.com> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> (cherry picked from commit 25f39d3) Signed-off-by: Jonathan Maple <jmaple@ciq.com> # Conflicts: # arch/s390/pci/pci_bus.c # arch/s390/pci/pci_clp.c
1 parent 6a873e0 commit dfbf357

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
s390/pci: Ignore RID for isolated VFs
2+
3+
jira LE-2349
4+
Rebuild_History Non-Buildable kernel-4.18.0-553.40.1.el8_10
5+
commit-author Niklas Schnelle <schnelle@linux.ibm.com>
6+
commit 25f39d3dcb48bbc824a77d16b3d977f0f3713cfe
7+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
8+
Will be included in final tarball splat. Ref for failed cherry-pick at:
9+
ciq/ciq_backports/kernel-4.18.0-553.40.1.el8_10/25f39d3d.failed
10+
11+
Ensure that VFs used in isolation, that is with their parent PF not
12+
visible to the configuration but with their RID exposed, are treated
13+
compatibly with existing isolated VF use cases without exposed RID
14+
including RoCE Express VFs. This allows creating configurations where
15+
one LPAR manages PFs while their child VFs are used by other LPARs. This
16+
gives the LPAR managing the PFs a role analogous to that of the
17+
hypervisor in a typical use case of passing child VFs to guests.
18+
19+
Instead of creating a multifunction struct zpci_bus whenever a PCI
20+
function with RID exposed is discovered only create such a bus for
21+
configured physical functions and only consider multifunction busses
22+
when searching for an existing bus. Additionally only set zdev->devfn to
23+
the devfn part of the RID once the function is added to a multifunction
24+
bus.
25+
26+
This also fixes probing of more than 7 such isolated VFs from the same
27+
physical bus. This is because common PCI code in pci_scan_slot() only
28+
looks for more functions when pdev->multifunction is set which somewhat
29+
counter intutively is not the case for VFs.
30+
31+
Note that PFs are looked at before their child VFs is guaranteed because
32+
we sort the zpci_list by RID ascending.
33+
34+
Reviewed-by: Gerd Bayer <gbayer@linux.ibm.com>
35+
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
36+
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
37+
(cherry picked from commit 25f39d3dcb48bbc824a77d16b3d977f0f3713cfe)
38+
Signed-off-by: Jonathan Maple <jmaple@ciq.com>
39+
40+
# Conflicts:
41+
# arch/s390/pci/pci_bus.c
42+
# arch/s390/pci/pci_clp.c
43+
diff --cc arch/s390/pci/pci_bus.c
44+
index 32245b970a0c,1b74a000ff64..000000000000
45+
--- a/arch/s390/pci/pci_bus.c
46+
+++ b/arch/s390/pci/pci_bus.c
47+
@@@ -243,7 -245,9 +250,13 @@@ static struct zpci_bus *zpci_bus_get(in
48+
49+
mutex_lock(&zbus_list_lock);
50+
list_for_each_entry(zbus, &zbus_list, bus_next) {
51+
++<<<<<<< HEAD
52+
+ if (pchid == zbus->pchid) {
53+
++=======
54+
+ if (!zbus->multifunction)
55+
+ continue;
56+
+ if (topo_is_tid == zbus->topo_is_tid && topo == zbus->topo) {
57+
++>>>>>>> 25f39d3dcb48 (s390/pci: Ignore RID for isolated VFs)
58+
kref_get(&zbus->kref);
59+
goto out_unlock;
60+
}
61+
@@@ -335,14 -344,10 +351,19 @@@ int zpci_bus_device_register(struct zpc
62+
return -ENOSPC;
63+
}
64+
65+
++<<<<<<< HEAD
66+
+ if (zdev->devfn >= ZPCI_FUNCTIONS_PER_BUS)
67+
+ return -EINVAL;
68+
+
69+
+ if (!s390_pci_no_rid && zdev->rid_available)
70+
+ zbus = zpci_bus_get(zdev->pchid);
71+
+
72+
++=======
73+
+ topo = topo_is_tid ? zdev->tid : zdev->pchid;
74+
+ zbus = zpci_bus_get(topo, topo_is_tid);
75+
++>>>>>>> 25f39d3dcb48 (s390/pci: Ignore RID for isolated VFs)
76+
if (!zbus) {
77+
- zbus = zpci_bus_alloc(topo, topo_is_tid);
78+
+ zbus = zpci_bus_alloc(zdev->pchid);
79+
if (!zbus)
80+
return -ENOMEM;
81+
}
82+
diff --cc arch/s390/pci/pci_clp.c
83+
index 34759316747b,74dac6da03d5..000000000000
84+
--- a/arch/s390/pci/pci_clp.c
85+
+++ b/arch/s390/pci/pci_clp.c
86+
@@@ -163,10 -164,13 +163,18 @@@ static int clp_store_query_pci_fn(struc
87+
zdev->port = response->port;
88+
zdev->uid = response->uid;
89+
zdev->fmb_length = sizeof(u32) * response->fmb_len;
90+
- zdev->is_physfn = response->is_physfn;
91+
zdev->rid_available = response->rid_avail;
92+
++<<<<<<< HEAD
93+
+ zdev->is_physfn = response->is_physfn;
94+
+ if (!s390_pci_no_rid && zdev->rid_available)
95+
+ zdev->devfn = response->rid & ZPCI_RID_MASK_DEVFN;
96+
++=======
97+
+ if (zdev->rid_available)
98+
+ zdev->rid = response->rid;
99+
+ zdev->tid_avail = response->tid_avail;
100+
+ if (zdev->tid_avail)
101+
+ zdev->tid = response->tid;
102+
++>>>>>>> 25f39d3dcb48 (s390/pci: Ignore RID for isolated VFs)
103+
104+
memcpy(zdev->pfip, response->pfip, sizeof(zdev->pfip));
105+
if (response->util_str_avail) {
106+
* Unmerged path arch/s390/pci/pci_bus.c
107+
* Unmerged path arch/s390/pci/pci_clp.c

0 commit comments

Comments
 (0)