Re: [kvm-unit-tests PATCH 2/4] pci: Assert when PCI bus address can not be translated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 29, 2016 at 03:48:51PM +0100, Alexander Gordeev wrote:
> Cc: Thomas Huth <thuth@xxxxxxxxxx>
> Cc: Andrew Jones <drjones@xxxxxxxxxx>
> Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx>
> ---
>  lib/pci.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/pci.c b/lib/pci.c
> index 6bd54cbac1bb..fdd88296f0ae 100644
> --- a/lib/pci.c
> +++ b/lib/pci.c
> @@ -43,11 +43,15 @@ phys_addr_t pci_bar_get_addr(pcidevaddr_t dev, int bar_num)
>  	uint32_t bar = pci_bar_get(dev, bar_num);
>  	uint32_t mask = pci_bar_mask(bar);
>  	uint64_t addr = bar & mask;
> +	phys_addr_t phys_addr;
>  
>  	if (pci_bar_is64(dev, bar_num))
>  		addr |= (uint64_t)pci_bar_get(dev, bar_num + 1) << 32;
>  
> -	return pci_translate_addr(dev, addr);
> +	phys_addr = pci_translate_addr(dev, addr);
> +	assert(phys_addr != INVALID_PHYS_ADDR);
> +
> +	return phys_addr;
>  }
>  
>  void pci_bar_set_addr(pcidevaddr_t dev, int bar_num, phys_addr_t addr)
> -- 
> 1.8.3.1
>

This patch needs a commit message with the justification for the assert.
I'll add

 Failing to translate the PCI address obtained from the bar means
 something isn't right with the PCI setup. As this should never
 happen, assert when it does.

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



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux