On Fri, Nov 25, 2016 at 03:56:04PM +0100, Alexander Gordeev wrote: > Cc: Thomas Huth <thuth@xxxxxxxxxx> > Cc: Andrew Jones <drjones@xxxxxxxxxx> > > Alexander Gordeev (2): > pci: Make all ones invalid translate address > pci: pci_host_bridge_get_paddr() can not fail > > lib/pci-host-generic.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > -- > 1.8.3.1 I applied the first to arm/next, but not the other. I think returning ~0 makes more sense here, and that callers (even callers that are part of the API) should consider asserting on receiving it. As we discussed, low-level API should return whatever it finds/doesn't find (no asserts). Higher-level API can assert on invalid inputs and unexpected results from the low-level API. Additionally, this series doesn't solve the problem I reported, which is, if you do pci_bar_get_addr(any_device, invalid_bar_num) you get back the base address of the PIO region. That happens because pci_bar_get(any_device, invalid_bar_num) returns zero and then that zero gets translated correctly by pci_translate_addr to the PIO region's physical base address. I think we should look into adding asserts to pci_bar_get/set_addr and the other higher-level API calls instead. We should add assert(pci_bar_is_valid(bar_num)) many places, and pci_bar_get_addr should have phys_addr = pci_translate_addr(dev, pci_addr) assert(phys_addr != ~0) Thanks, drew -- 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