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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 's390-5.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull s390 fixes from Vasily Gorbik:

- a couple of fixes for storage key handling relevant for debugging

- add cond_resched into potentially slow subchannels scanning loop

- fixes for PF/VF linking and to ignore stale PCI configuration request
events

* tag 's390-5.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
s390/pci: fix PF/VF linking on hot plug
s390/pci: re-introduce zpci_remove_device()
s390/pci: fix zpci_bus_link_virtfn()
s390/ptrace: fix storage key handling
s390/runtime_instrumentation: fix storage key handling
s390/pci: ignore stale configuration request event
s390/cio: add cond_resched() in the slow_eval_known_fn() loop

+79 -41
+5 -2
arch/s390/kernel/ptrace.c
··· 1268 1268 cb->pc == 1 && 1269 1269 cb->qc == 0 && 1270 1270 cb->reserved2 == 0 && 1271 - cb->key == PAGE_DEFAULT_KEY && 1272 1271 cb->reserved3 == 0 && 1273 1272 cb->reserved4 == 0 && 1274 1273 cb->reserved5 == 0 && ··· 1329 1330 kfree(data); 1330 1331 return -EINVAL; 1331 1332 } 1332 - 1333 + /* 1334 + * Override access key in any case, since user space should 1335 + * not be able to set it, nor should it care about it. 1336 + */ 1337 + ri_cb.key = PAGE_DEFAULT_KEY >> 4; 1333 1338 preempt_disable(); 1334 1339 if (!target->thread.ri_cb) 1335 1340 target->thread.ri_cb = data;
+1 -1
arch/s390/kernel/runtime_instr.c
··· 57 57 cb->k = 1; 58 58 cb->ps = 1; 59 59 cb->pc = 1; 60 - cb->key = PAGE_DEFAULT_KEY; 60 + cb->key = PAGE_DEFAULT_KEY >> 4; 61 61 cb->v = 1; 62 62 } 63 63
+15 -7
arch/s390/pci/pci.c
··· 672 672 } 673 673 EXPORT_SYMBOL_GPL(zpci_disable_device); 674 674 675 + void zpci_remove_device(struct zpci_dev *zdev) 676 + { 677 + struct zpci_bus *zbus = zdev->zbus; 678 + struct pci_dev *pdev; 679 + 680 + pdev = pci_get_slot(zbus->bus, zdev->devfn); 681 + if (pdev) { 682 + if (pdev->is_virtfn) 683 + return zpci_remove_virtfn(pdev, zdev->vfn); 684 + pci_stop_and_remove_bus_device_locked(pdev); 685 + } 686 + } 687 + 675 688 int zpci_create_device(struct zpci_dev *zdev) 676 689 { 677 690 int rc; ··· 729 716 { 730 717 struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref); 731 718 732 - if (zdev->zbus->bus) { 733 - struct pci_dev *pdev; 734 - 735 - pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn); 736 - if (pdev) 737 - pci_stop_and_remove_bus_device_locked(pdev); 738 - } 719 + if (zdev->zbus->bus) 720 + zpci_remove_device(zdev); 739 721 740 722 switch (zdev->state) { 741 723 case ZPCI_FN_STATE_ONLINE:
+30 -22
arch/s390/pci/pci_bus.c
··· 132 132 { 133 133 int rc; 134 134 135 - virtfn->physfn = pci_dev_get(pdev); 136 135 rc = pci_iov_sysfs_link(pdev, virtfn, vfid); 137 - if (rc) { 138 - pci_dev_put(pdev); 139 - virtfn->physfn = NULL; 136 + if (rc) 140 137 return rc; 141 - } 138 + 139 + virtfn->is_virtfn = 1; 140 + virtfn->multifunction = 0; 141 + virtfn->physfn = pci_dev_get(pdev); 142 + 142 143 return 0; 143 144 } 144 145 ··· 152 151 int vfid = vfn - 1; /* Linux' vfid's start at 0 vfn at 1*/ 153 152 int rc = 0; 154 153 155 - virtfn->is_virtfn = 1; 156 - virtfn->multifunction = 0; 157 - WARN_ON(vfid < 0); 154 + if (!zbus->multifunction) 155 + return 0; 156 + 158 157 /* If the parent PF for the given VF is also configured in the 159 158 * instance, it must be on the same zbus. 160 159 * We can then identify the parent PF by checking what ··· 166 165 zdev = zbus->function[i]; 167 166 if (zdev && zdev->is_physfn) { 168 167 pdev = pci_get_slot(zbus->bus, zdev->devfn); 168 + if (!pdev) 169 + continue; 169 170 cand_devfn = pci_iov_virtfn_devfn(pdev, vfid); 170 171 if (cand_devfn == virtfn->devfn) { 171 172 rc = zpci_bus_link_virtfn(pdev, virtfn, vfid); 173 + /* balance pci_get_slot() */ 174 + pci_dev_put(pdev); 172 175 break; 173 176 } 177 + /* balance pci_get_slot() */ 178 + pci_dev_put(pdev); 174 179 } 175 180 } 176 181 return rc; ··· 185 178 static inline int zpci_bus_setup_virtfn(struct zpci_bus *zbus, 186 179 struct pci_dev *virtfn, int vfn) 187 180 { 188 - virtfn->is_virtfn = 1; 189 - virtfn->multifunction = 0; 190 181 return 0; 191 182 } 192 183 #endif 184 + 185 + void pcibios_bus_add_device(struct pci_dev *pdev) 186 + { 187 + struct zpci_dev *zdev = to_zpci(pdev); 188 + 189 + /* 190 + * With pdev->no_vf_scan the common PCI probing code does not 191 + * perform PF/VF linking. 192 + */ 193 + if (zdev->vfn) 194 + zpci_bus_setup_virtfn(zdev->zbus, pdev, zdev->vfn); 195 + 196 + } 193 197 194 198 static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev) 195 199 { ··· 232 214 } 233 215 234 216 pdev = pci_scan_single_device(bus, zdev->devfn); 235 - if (pdev) { 236 - if (!zdev->is_physfn) { 237 - rc = zpci_bus_setup_virtfn(zbus, pdev, zdev->vfn); 238 - if (rc) 239 - goto failed_with_pdev; 240 - } 217 + if (pdev) 241 218 pci_bus_add_device(pdev); 242 - } 243 - return 0; 244 219 245 - failed_with_pdev: 246 - pci_stop_and_remove_bus_device(pdev); 247 - pci_dev_put(pdev); 248 - return rc; 220 + return 0; 249 221 } 250 222 251 223 static void zpci_bus_add_devices(struct zpci_bus *zbus)
+13
arch/s390/pci/pci_bus.h
··· 29 29 30 30 return (devfn >= ZPCI_FUNCTIONS_PER_BUS) ? NULL : zbus->function[devfn]; 31 31 } 32 + 33 + #ifdef CONFIG_PCI_IOV 34 + static inline void zpci_remove_virtfn(struct pci_dev *pdev, int vfn) 35 + { 36 + 37 + pci_lock_rescan_remove(); 38 + /* Linux' vfid's start at 0 vfn at 1 */ 39 + pci_iov_remove_virtfn(pdev->physfn, vfn - 1); 40 + pci_unlock_rescan_remove(); 41 + } 42 + #else /* CONFIG_PCI_IOV */ 43 + static inline void zpci_remove_virtfn(struct pci_dev *pdev, int vfn) {} 44 + #endif /* CONFIG_PCI_IOV */
+5 -2
arch/s390/pci/pci_event.c
··· 92 92 ret = clp_add_pci_device(ccdf->fid, ccdf->fh, 1); 93 93 break; 94 94 } 95 + /* the configuration request may be stale */ 96 + if (zdev->state != ZPCI_FN_STATE_STANDBY) 97 + break; 95 98 zdev->fh = ccdf->fh; 96 99 zdev->state = ZPCI_FN_STATE_CONFIGURED; 97 100 ret = zpci_enable_device(zdev); ··· 121 118 if (!zdev) 122 119 break; 123 120 if (pdev) 124 - pci_stop_and_remove_bus_device_locked(pdev); 121 + zpci_remove_device(zdev); 125 122 126 123 ret = zpci_disable_device(zdev); 127 124 if (ret) ··· 140 137 /* Give the driver a hint that the function is 141 138 * already unusable. */ 142 139 pdev->error_state = pci_channel_io_perm_failure; 143 - pci_stop_and_remove_bus_device_locked(pdev); 140 + zpci_remove_device(zdev); 144 141 } 145 142 146 143 zdev->state = ZPCI_FN_STATE_STANDBY;
+5 -7
drivers/pci/hotplug/s390_pci_hpc.c
··· 83 83 struct zpci_dev *zdev = container_of(hotplug_slot, struct zpci_dev, 84 84 hotplug_slot); 85 85 struct pci_dev *pdev; 86 - struct zpci_bus *zbus = zdev->zbus; 87 86 int rc; 88 87 89 88 if (!zpci_fn_configured(zdev->state)) 90 89 return -EIO; 91 90 92 - pdev = pci_get_slot(zbus->bus, zdev->devfn); 93 - if (pdev) { 94 - if (pci_num_vf(pdev)) 95 - return -EBUSY; 96 - 97 - pci_stop_and_remove_bus_device_locked(pdev); 91 + pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn); 92 + if (pdev && pci_num_vf(pdev)) { 98 93 pci_dev_put(pdev); 94 + return -EBUSY; 99 95 } 96 + 97 + zpci_remove_device(zdev); 100 98 101 99 rc = zpci_disable_device(zdev); 102 100 if (rc)
+5
drivers/s390/cio/css.c
··· 677 677 rc = css_evaluate_known_subchannel(sch, 1); 678 678 if (rc == -EAGAIN) 679 679 css_schedule_eval(sch->schid); 680 + /* 681 + * The loop might take long time for platforms with lots of 682 + * known devices. Allow scheduling here. 683 + */ 684 + cond_resched(); 680 685 } 681 686 return 0; 682 687 }