Port the spapr_pci implementation for ppc64le. Based on suggestions by Alexey Kardashevskiy <aik@xxxxxxxxx> We should have always used phys_hi and 64 bit addr and size. Cc: Alexey Kardashevskiy <aik@xxxxxxxxx> Signed-off-by: Balbir Singh <bsingharora@xxxxxxxxx> Acked-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx> --- powerpc/spapr_pci.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/powerpc/spapr_pci.c b/powerpc/spapr_pci.c index 768e3f2..a15f7d8 100644 --- a/powerpc/spapr_pci.c +++ b/powerpc/spapr_pci.c @@ -234,8 +234,11 @@ int spapr_populate_pci_devices(struct kvm *kvm, int bus_off, node_off = 0, devid, fn, i, n, devices; struct device_header *dev_hdr; char nodename[256]; - struct of_pci_unit_address reg[PCI_NUM_REGIONS + 1], - assigned_addresses[PCI_NUM_REGIONS]; + struct of_pci_unit64_address { + u32 phys_hi; + u64 addr; + u64 size; + } __attribute((packed)) reg[PCI_NUM_REGIONS + 1], assigned_addresses[PCI_NUM_REGIONS]; uint32_t bus_range[] = { cpu_to_be32(0), cpu_to_be32(0xff) }; struct of_pci_ranges_entry ranges[] = { { @@ -339,7 +342,7 @@ int spapr_populate_pci_devices(struct kvm *kvm, le16_to_cpu(hdr->subsys_vendor_id))); /* Config space region comes first */ - reg[0].hi = cpu_to_be32( + reg[0].phys_hi = cpu_to_be32( of_pci_b_n(0) | of_pci_b_p(0) | of_pci_b_t(0) | @@ -347,8 +350,8 @@ int spapr_populate_pci_devices(struct kvm *kvm, of_pci_b_bbbbbbbb(0) | of_pci_b_ddddd(devid) | of_pci_b_fff(fn)); - reg[0].mid = 0; - reg[0].lo = 0; + reg[0].addr = 0; + reg[0].size = 0; n = 0; /* Six BARs, no ROM supported, addresses are 32bit */ @@ -357,7 +360,7 @@ int spapr_populate_pci_devices(struct kvm *kvm, continue; } - reg[n+1].hi = cpu_to_be32( + reg[n+1].phys_hi = cpu_to_be32( of_pci_b_n(0) | of_pci_b_p(0) | of_pci_b_t(0) | @@ -366,10 +369,10 @@ int spapr_populate_pci_devices(struct kvm *kvm, of_pci_b_ddddd(devid) | of_pci_b_fff(fn) | of_pci_b_rrrrrrrr(bars[i])); - reg[n+1].mid = 0; - reg[n+1].lo = cpu_to_be64(hdr->bar_size[i]); + reg[n+1].size = cpu_to_be64(hdr->bar_size[i]); + reg[n+1].addr = 0; - assigned_addresses[n].hi = cpu_to_be32( + assigned_addresses[n].phys_hi = cpu_to_be32( of_pci_b_n(1) | of_pci_b_p(0) | of_pci_b_t(0) | @@ -383,8 +386,8 @@ int spapr_populate_pci_devices(struct kvm *kvm, * Writing zeroes to assigned_addresses causes the guest kernel to * reassign BARs */ - assigned_addresses[n].mid = cpu_to_be64(bar_to_addr(le32_to_cpu(hdr->bar[i]))); - assigned_addresses[n].lo = reg[n+1].lo; + assigned_addresses[n].addr = cpu_to_be64(bar_to_addr(le32_to_cpu(hdr->bar[i]))); + assigned_addresses[n].size = reg[n+1].size; ++n; } -- 2.5.5 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html