Re: [PATCH kvm-unit-tests v2 09/17] x86/vmexit: leverage pci_scan_bars()

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

 



On Thu, Nov 10, 2016 at 08:27:58PM +0100, Andrew Jones wrote:

[...]

> > @@ -389,17 +389,12 @@ int main(int ac, char **av)
> >  	ret = pci_find_dev(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_TEST);
> >  	if (ret != PCIDEVADDR_INVALID) {
> >  		pci_dev_init(&pcidev, ret);
> > -		for (i = 0; i < PCI_TESTDEV_NUM_BARS; i++) {
> > -			if (!pci_bar_is_valid(&pcidev, i)) {
> > -				continue;
> > -			}
> > -			if (pci_bar_is_memory(&pcidev, i)) {
> > -				membar = pci_bar_get_addr(&pcidev, i);
> > -				pci_test.memaddr = ioremap(membar, PAGE_SIZE);
> > -			} else {
> > -				pci_test.iobar = pci_bar_get_addr(&pcidev, i);
> > -			}
> > -		}
> > +		pci_scan_bars(&pcidev);
> > +		assert(pci_bar_is_memory(&pcidev, PCI_TESTDEV_BAR_MEM));
> > +		assert(!pci_bar_is_memory(&pcidev, PCI_TESTDEV_BAR_IO));
> > +		membar = pcidev.bar[PCI_TESTDEV_BAR_MEM];
> 
> nit: I'd drop 'membar' and just pass pcidev.bar to ioremap

Below printf() is using it as well. I kept it in case anyone is using
the below printf for any reason.

> 
> > +		pci_test.memaddr = ioremap(membar, PAGE_SIZE);
> > +		pci_test.iobar = pcidev.bar[PCI_TESTDEV_BAR_IO];
> >  		printf("pci-testdev at 0x%x membar %lx iobar %x\n",
> >  		       pcidev.bdf, membar, pci_test.iobar);
> >  	}
> > -- 
> > 2.7.4
> >

Thanks,

-- peterx
--
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