powerpc/powernv: Shift VF resource with an offset
On PowerNV platform, resource position in M64 BAR implies the PE# the resource belongs to. In some cases, adjustment of a resource is necessary to locate it to a correct position in M64 BAR . This patch adds pnv_pci_vf_resource_shift() to shift the 'real' PF IOV BAR address according to an offset. Note: After doing so, there would be a "hole" in the /proc/iomem when offset is a positive value. It looks like the device return some mmio back to the system, which actually no one could use it. [bhelgaas: rework loops, rework overlap check, index resource[] conventionally, remove pci_regs.h include, squashed with next patch] Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:

committed by
Benjamin Herrenschmidt

parent
5350ab3fd7
commit
781a868f31
@@ -714,6 +714,24 @@ static void pnv_pci_dma_dev_setup(struct pci_dev *pdev)
|
||||
{
|
||||
struct pci_controller *hose = pci_bus_to_host(pdev->bus);
|
||||
struct pnv_phb *phb = hose->private_data;
|
||||
#ifdef CONFIG_PCI_IOV
|
||||
struct pnv_ioda_pe *pe;
|
||||
struct pci_dn *pdn;
|
||||
|
||||
/* Fix the VF pdn PE number */
|
||||
if (pdev->is_virtfn) {
|
||||
pdn = pci_get_pdn(pdev);
|
||||
WARN_ON(pdn->pe_number != IODA_INVALID_PE);
|
||||
list_for_each_entry(pe, &phb->ioda.pe_list, list) {
|
||||
if (pe->rid == ((pdev->bus->number << 8) |
|
||||
(pdev->devfn & 0xff))) {
|
||||
pdn->pe_number = pe->pe_number;
|
||||
pe->pdev = pdev;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_PCI_IOV */
|
||||
|
||||
/* If we have no phb structure, try to setup a fallback based on
|
||||
* the device-tree (RTAS PCI for example)
|
||||
|
Reference in New Issue
Block a user