Skip to content

Commit f3d8b0e

Browse files
committed
Merge tag 's390-6.14-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 fixes from Vasily Gorbik: - Fix isolated VFs handling by verifying that a VF’s parent PF is locally owned before registering it in an existing PCI domain - Disable arch_test_bit() optimization for PROFILE_ALL_BRANCHES to workaround gcc failure in handling __builtin_constant_p() in this case - Fix CHPID "configure" attribute caching in CIO by not updating the cache when SCLP returns no data, ensuring consistent sysfs output - Remove CONFIG_LSM from default configs and rely on defaults, which enables BPF LSM hook * tag 's390-6.14-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390/pci: Fix handling of isolated VFs s390/pci: Pull search for parent PF out of zpci_iov_setup_virtfn() s390/bitops: Disable arch_test_bit() optimization for PROFILE_ALL_BRANCHES s390/cio: Fix CHPID "configure" attribute caching s390/configs: Remove CONFIG_LSM
2 parents 2438990 + 2844ddb commit f3d8b0e

File tree

8 files changed

+76
-19
lines changed

8 files changed

+76
-19
lines changed

arch/s390/configs/debug_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,6 @@ CONFIG_IMA=y
740740
CONFIG_IMA_DEFAULT_HASH_SHA256=y
741741
CONFIG_IMA_WRITE_POLICY=y
742742
CONFIG_IMA_APPRAISE=y
743-
CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor"
744743
CONFIG_BUG_ON_DATA_CORRUPTION=y
745744
CONFIG_CRYPTO_USER=m
746745
# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set

arch/s390/configs/defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,6 @@ CONFIG_IMA=y
725725
CONFIG_IMA_DEFAULT_HASH_SHA256=y
726726
CONFIG_IMA_WRITE_POLICY=y
727727
CONFIG_IMA_APPRAISE=y
728-
CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor"
729728
CONFIG_BUG_ON_DATA_CORRUPTION=y
730729
CONFIG_CRYPTO_FIPS=y
731730
CONFIG_CRYPTO_USER=m

arch/s390/configs/zfcpdump_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ CONFIG_ZFCP=y
6262
# CONFIG_INOTIFY_USER is not set
6363
# CONFIG_MISC_FILESYSTEMS is not set
6464
# CONFIG_NETWORK_FILESYSTEMS is not set
65-
CONFIG_LSM="yama,loadpin,safesetid,integrity"
6665
# CONFIG_ZLIB_DFLTCC is not set
6766
CONFIG_XZ_DEC_MICROLZMA=y
6867
CONFIG_PRINTK_TIME=y

arch/s390/include/asm/bitops.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ static __always_inline bool arch_test_bit(unsigned long nr, const volatile unsig
5353
unsigned long mask;
5454
int cc;
5555

56-
if (__builtin_constant_p(nr)) {
56+
/*
57+
* With CONFIG_PROFILE_ALL_BRANCHES enabled gcc fails to
58+
* handle __builtin_constant_p() in some cases.
59+
*/
60+
if (!IS_ENABLED(CONFIG_PROFILE_ALL_BRANCHES) && __builtin_constant_p(nr)) {
5761
addr = (const volatile unsigned char *)ptr;
5862
addr += (nr ^ (BITS_PER_LONG - BITS_PER_BYTE)) / BITS_PER_BYTE;
5963
mask = 1UL << (nr & (BITS_PER_BYTE - 1));

arch/s390/pci/pci_bus.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,17 @@ static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev)
331331
return rc;
332332
}
333333

334+
static bool zpci_bus_is_isolated_vf(struct zpci_bus *zbus, struct zpci_dev *zdev)
335+
{
336+
struct pci_dev *pdev;
337+
338+
pdev = zpci_iov_find_parent_pf(zbus, zdev);
339+
if (!pdev)
340+
return true;
341+
pci_dev_put(pdev);
342+
return false;
343+
}
344+
334345
int zpci_bus_device_register(struct zpci_dev *zdev, struct pci_ops *ops)
335346
{
336347
bool topo_is_tid = zdev->tid_avail;
@@ -345,6 +356,15 @@ int zpci_bus_device_register(struct zpci_dev *zdev, struct pci_ops *ops)
345356

346357
topo = topo_is_tid ? zdev->tid : zdev->pchid;
347358
zbus = zpci_bus_get(topo, topo_is_tid);
359+
/*
360+
* An isolated VF gets its own domain/bus even if there exists
361+
* a matching domain/bus already
362+
*/
363+
if (zbus && zpci_bus_is_isolated_vf(zbus, zdev)) {
364+
zpci_bus_put(zbus);
365+
zbus = NULL;
366+
}
367+
348368
if (!zbus) {
349369
zbus = zpci_bus_alloc(topo, topo_is_tid);
350370
if (!zbus)

arch/s390/pci/pci_iov.c

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,35 @@ static int zpci_iov_link_virtfn(struct pci_dev *pdev, struct pci_dev *virtfn, in
6060
return 0;
6161
}
6262

63-
int zpci_iov_setup_virtfn(struct zpci_bus *zbus, struct pci_dev *virtfn, int vfn)
63+
/**
64+
* zpci_iov_find_parent_pf - Find the parent PF, if any, of the given function
65+
* @zbus: The bus that the PCI function is on, or would be added on
66+
* @zdev: The PCI function
67+
*
68+
* Finds the parent PF, if it exists and is configured, of the given PCI function
69+
* and increments its refcount. Th PF is searched for on the provided bus so the
70+
* caller has to ensure that this is the correct bus to search. This function may
71+
* be used before adding the PCI function to a zbus.
72+
*
73+
* Return: Pointer to the struct pci_dev of the parent PF or NULL if it not
74+
* found. If the function is not a VF or has no RequesterID information,
75+
* NULL is returned as well.
76+
*/
77+
struct pci_dev *zpci_iov_find_parent_pf(struct zpci_bus *zbus, struct zpci_dev *zdev)
6478
{
65-
int i, cand_devfn;
66-
struct zpci_dev *zdev;
79+
int i, vfid, devfn, cand_devfn;
6780
struct pci_dev *pdev;
68-
int vfid = vfn - 1; /* Linux' vfid's start at 0 vfn at 1*/
69-
int rc = 0;
7081

7182
if (!zbus->multifunction)
72-
return 0;
73-
74-
/* If the parent PF for the given VF is also configured in the
83+
return NULL;
84+
/* Non-VFs and VFs without RID available don't have a parent */
85+
if (!zdev->vfn || !zdev->rid_available)
86+
return NULL;
87+
/* Linux vfid starts at 0 vfn at 1 */
88+
vfid = zdev->vfn - 1;
89+
devfn = zdev->rid & ZPCI_RID_MASK_DEVFN;
90+
/*
91+
* If the parent PF for the given VF is also configured in the
7592
* instance, it must be on the same zbus.
7693
* We can then identify the parent PF by checking what
7794
* devfn the VF would have if it belonged to that PF using the PF's
@@ -85,15 +102,26 @@ int zpci_iov_setup_virtfn(struct zpci_bus *zbus, struct pci_dev *virtfn, int vfn
85102
if (!pdev)
86103
continue;
87104
cand_devfn = pci_iov_virtfn_devfn(pdev, vfid);
88-
if (cand_devfn == virtfn->devfn) {
89-
rc = zpci_iov_link_virtfn(pdev, virtfn, vfid);
90-
/* balance pci_get_slot() */
91-
pci_dev_put(pdev);
92-
break;
93-
}
105+
if (cand_devfn == devfn)
106+
return pdev;
94107
/* balance pci_get_slot() */
95108
pci_dev_put(pdev);
96109
}
97110
}
111+
return NULL;
112+
}
113+
114+
int zpci_iov_setup_virtfn(struct zpci_bus *zbus, struct pci_dev *virtfn, int vfn)
115+
{
116+
struct zpci_dev *zdev = to_zpci(virtfn);
117+
struct pci_dev *pdev_pf;
118+
int rc = 0;
119+
120+
pdev_pf = zpci_iov_find_parent_pf(zbus, zdev);
121+
if (pdev_pf) {
122+
/* Linux' vfids start at 0 while zdev->vfn starts at 1 */
123+
rc = zpci_iov_link_virtfn(pdev_pf, virtfn, zdev->vfn - 1);
124+
pci_dev_put(pdev_pf);
125+
}
98126
return rc;
99127
}

arch/s390/pci/pci_iov.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ void zpci_iov_map_resources(struct pci_dev *pdev);
1919

2020
int zpci_iov_setup_virtfn(struct zpci_bus *zbus, struct pci_dev *virtfn, int vfn);
2121

22+
struct pci_dev *zpci_iov_find_parent_pf(struct zpci_bus *zbus, struct zpci_dev *zdev);
23+
2224
#else /* CONFIG_PCI_IOV */
2325
static inline void zpci_iov_remove_virtfn(struct pci_dev *pdev, int vfn) {}
2426

@@ -28,5 +30,10 @@ static inline int zpci_iov_setup_virtfn(struct zpci_bus *zbus, struct pci_dev *v
2830
{
2931
return 0;
3032
}
33+
34+
static inline struct pci_dev *zpci_iov_find_parent_pf(struct zpci_bus *zbus, struct zpci_dev *zdev)
35+
{
36+
return NULL;
37+
}
3138
#endif /* CONFIG_PCI_IOV */
3239
#endif /* __S390_PCI_IOV_h */

drivers/s390/cio/chp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,8 @@ static int info_update(void)
695695
if (time_after(jiffies, chp_info_expires)) {
696696
/* Data is too old, update. */
697697
rc = sclp_chp_read_info(&chp_info);
698-
chp_info_expires = jiffies + CHP_INFO_UPDATE_INTERVAL ;
698+
if (!rc)
699+
chp_info_expires = jiffies + CHP_INFO_UPDATE_INTERVAL;
699700
}
700701
mutex_unlock(&info_lock);
701702

0 commit comments

Comments
 (0)