mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
s390/pci: deal with devices that have no support for MIO instructions
Unfortunately we have to handle a class of devices that don't support the new MIO instructions. Adjust resource assignment and mapping accordingly. Signed-off-by: Sebastian Ott <sebott@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
parent
05f31e3bf6
commit
c7ff0e918a
2 changed files with 13 additions and 7 deletions
|
@ -194,6 +194,11 @@ int zpci_init_iommu(struct zpci_dev *zdev);
|
||||||
void zpci_destroy_iommu(struct zpci_dev *zdev);
|
void zpci_destroy_iommu(struct zpci_dev *zdev);
|
||||||
|
|
||||||
#ifdef CONFIG_PCI
|
#ifdef CONFIG_PCI
|
||||||
|
static inline bool zpci_use_mio(struct zpci_dev *zdev)
|
||||||
|
{
|
||||||
|
return static_branch_likely(&have_mio) && zdev->mio_capable;
|
||||||
|
}
|
||||||
|
|
||||||
/* Error handling and recovery */
|
/* Error handling and recovery */
|
||||||
void zpci_event_error(void *);
|
void zpci_event_error(void *);
|
||||||
void zpci_event_availability(void *);
|
void zpci_event_availability(void *);
|
||||||
|
|
|
@ -421,12 +421,12 @@ static void zpci_map_resources(struct pci_dev *pdev)
|
||||||
if (!len)
|
if (!len)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (static_branch_likely(&have_mio))
|
if (zpci_use_mio(zdev))
|
||||||
pdev->resource[i].start =
|
pdev->resource[i].start =
|
||||||
(resource_size_t __force) zdev->bars[i].mio_wb;
|
(resource_size_t __force) zdev->bars[i].mio_wb;
|
||||||
else
|
else
|
||||||
pdev->resource[i].start =
|
pdev->resource[i].start = (resource_size_t __force)
|
||||||
(resource_size_t __force) pci_iomap(pdev, i, 0);
|
pci_iomap_range_fh(pdev, i, 0, 0);
|
||||||
pdev->resource[i].end = pdev->resource[i].start + len - 1;
|
pdev->resource[i].end = pdev->resource[i].start + len - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,18 +444,19 @@ static void zpci_map_resources(struct pci_dev *pdev)
|
||||||
|
|
||||||
static void zpci_unmap_resources(struct pci_dev *pdev)
|
static void zpci_unmap_resources(struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
|
struct zpci_dev *zdev = to_zpci(pdev);
|
||||||
resource_size_t len;
|
resource_size_t len;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (static_branch_likely(&have_mio))
|
if (zpci_use_mio(zdev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < PCI_BAR_COUNT; i++) {
|
for (i = 0; i < PCI_BAR_COUNT; i++) {
|
||||||
len = pci_resource_len(pdev, i);
|
len = pci_resource_len(pdev, i);
|
||||||
if (!len)
|
if (!len)
|
||||||
continue;
|
continue;
|
||||||
pci_iounmap(pdev, (void __iomem __force *)
|
pci_iounmap_fh(pdev, (void __iomem __force *)
|
||||||
pdev->resource[i].start);
|
pdev->resource[i].start);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,7 +529,7 @@ static int zpci_setup_bus_resources(struct zpci_dev *zdev,
|
||||||
if (zdev->bars[i].val & 4)
|
if (zdev->bars[i].val & 4)
|
||||||
flags |= IORESOURCE_MEM_64;
|
flags |= IORESOURCE_MEM_64;
|
||||||
|
|
||||||
if (static_branch_likely(&have_mio))
|
if (zpci_use_mio(zdev))
|
||||||
addr = (unsigned long) zdev->bars[i].mio_wb;
|
addr = (unsigned long) zdev->bars[i].mio_wb;
|
||||||
else
|
else
|
||||||
addr = ZPCI_ADDR(entry);
|
addr = ZPCI_ADDR(entry);
|
||||||
|
|
Loading…
Reference in a new issue