The mentioned commit from 5.7 does not simply apply to focal master-next:
cherry-pick says:
Auto-merging arch/s390/pci/pci.c
CONFLICT (content): Merge conflict in arch/s390/pci/pci.c
Auto-merging arch/s390/include/asm/pci.h
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your merge.renamelimit variable to at least 2342 and retry the command.
error: could not apply 969ae01bab2f... s390/pci: Fix zpci_alloc_domain() over allocation
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
with status:
On branch master-next
Your branch is ahead of 'origin/master-next' by 2 commits.
(use "git push" to publish your local commits)
You are currently cherry-picking commit 969ae01bab2f.
(fix conflicts and run "git cherry-pick --continue")
(use "git cherry-pick --skip" to skip this patch)
(use "git cherry-pick --abort" to cancel the cherry-pick operation)
Changes to be committed:
modified: arch/s390/include/asm/pci.h
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: arch/s390/pci/pci.c
The mentioned commit from 5.7 does not simply apply to focal master-next:
cherry-pick says:
Auto-merging arch/s390/pci/pci.c include/ asm/pci. h
CONFLICT (content): Merge conflict in arch/s390/pci/pci.c
Auto-merging arch/s390/
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your merge.renamelimit variable to at least 2342 and retry the command.
error: could not apply 969ae01bab2f... s390/pci: Fix zpci_alloc_domain() over allocation
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
with status:
On branch master-next master- next' by 2 commits.
Your branch is ahead of 'origin/
(use "git push" to publish your local commits)
You are currently cherry-picking commit 969ae01bab2f.
(fix conflicts and run "git cherry-pick --continue")
(use "git cherry-pick --skip" to skip this patch)
(use "git cherry-pick --abort" to cancel the cherry-pick operation)
Changes to be committed: include/ asm/pci. h
modified: arch/s390/
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: arch/s390/pci/pci.c
and the git diff is:
diff --cc arch/s390/pci/pci.c 2b90a90aa81d. .000000000000 s390/pci/ pci.c s390/pci/ pci.c zpci_list) ; SPINLOCK( zpci_list_ lock);
index 6105b1b6e49b,
--- a/arch/
+++ b/arch/
@@@ -39,11 -40,12 +39,12 @@@
static LIST_HEAD(
static DEFINE_
- static DECLARE_ BITMAP( zpci_domain, ZPCI_NR_DEVICES); BITMAP( zpci_domain, ZPCI_DOMAIN_ BITMAP_ SIZE); SPINLOCK( zpci_domain_ lock); domains_ allocated;
+ static DECLARE_
static DEFINE_
+ static unsigned int zpci_num_
#define ZPCI_IOMAP_ENTRIES \
ZPCI_ IOMAP_MAX_ ENTRIES)
- min(((unsigned long) ZPCI_NR_DEVICES * PCI_STD_NUM_BARS / 2), \
+ min(((unsigned long) ZPCI_NR_DEVICES * PCI_BAR_COUNT / 2), \
static DEFINE_ SPINLOCK( zpci_iomap_ lock); disable_ device( struct pci_
zpci_debug_ exit_device( zdev);
@@@ -606,59 -608,22 +607,63 @@@ void pcibios_
}
+#ifdef CONFIG_ HIBERNATE_ CALLBACKS STATE_ONLINE) DMA_SPACES) ; resources( pdev); ioat(zdev, 0, zdev->start_dma, zdev->end_dma, STATE_ONLINE) _ioat(zdev, 0); resources( pdev); fh(zdev) ; HIBERNATE_ CALLBACKS */ domain( struct zpci_dev *zdev) &zpci_domain_ lock); domains_ allocated > (ZPCI_NR_DEVICES - 1)) { &zpci_domain_ lock);
zdev- >domain = (u16) zdev->uid; &zpci_domain_ lock); zdev->domain, zpci_domain)) {
spin_ unlock( &zpci_domain_ lock);
return -EEXIST;
set_bit( zdev->domain, zpci_domain);
spin_ unlock( &zpci_domain_ lock);
return 0; &zpci_domain_ lock);
zdev-> domain = find_first_ zero_bit( zpci_domain, ZPCI_NR_DEVICES); &zpci_domain_ lock);
set_bit( zdev->domain, zpci_domain); domains_ allocated+ +;
spin_unlock( &zpci_domain_ lock);
+static int zpci_restore(struct device *dev)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ struct zpci_dev *zdev = to_zpci(pdev);
+ int ret = 0;
+
+ if (zdev->state != ZPCI_FN_
+ goto out;
+
+ ret = clp_enable_fh(zdev, ZPCI_NR_
+ if (ret)
+ goto out;
+
+ zpci_map_
+ zpci_register_
+ (u64) zdev->dma_table);
+
+out:
+ return ret;
+}
+
+static int zpci_freeze(struct device *dev)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ struct zpci_dev *zdev = to_zpci(pdev);
+
+ if (zdev->state != ZPCI_FN_
+ return 0;
+
+ zpci_unregister
+ zpci_unmap_
+ return clp_disable_
+}
+
+struct dev_pm_ops pcibios_pm_ops = {
+ .thaw_noirq = zpci_restore,
+ .freeze_noirq = zpci_freeze,
+ .restore_noirq = zpci_restore,
+ .poweroff_noirq = zpci_freeze,
+};
+#endif /* CONFIG_
+
static int zpci_alloc_
{
+ spin_lock(
+ if (zpci_num_
+ spin_unlock(
+ pr_err("Adding PCI function %08x failed because the configured limit of %d is reached\n",
+ zdev->fid, ZPCI_NR_DEVICES);
+ return -ENOSPC;
+ }
+
if (zpci_unique_uid) {
- if (zdev->domain >= ZPCI_NR_DEVICES)
- return 0;
-
- spin_lock(
if (test_bit(
- pr_err("Adding PCI function %08x failed because domain %04x is already assigned\n",
- zdev->fid, zdev->domain);
}
@@@ -665,14 -631,14 +671,21 @@@
}
-
- spin_lock(
+ /*
+ * We can always auto allocate domains below ZPCI_NR_DEVICES.
+ * There is either a free domain or we have reached the maximum in
+ * which case we would have bailed earlier.
+ */
++<<<<<<< HEAD
+ if (zdev->domain == ZPCI_NR_DEVICES) {
+ spin_unlock(
+ return -ENOSPC;
+ }
++=======
++>>>>>>> 969ae01bab2f... s390/pci: Fix zpci_alloc_domain() over allocation
+ zpci_num_
return 0;
}