Re: [PATCH kvm-unit-tests 11/17] pci: provide pci_enable_defaults()

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

 



On Wed, Oct 26, 2016 at 03:47:14PM +0800, Peter Xu wrote:
> Provide a function to do most of the common PCI init work.
> 
> Suggested-by: Andrew Jones <drjones@xxxxxxxxxx>
> Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>
> ---
>  lib/pci.c | 7 +++++++
>  lib/pci.h | 1 +
>  2 files changed, 8 insertions(+)
> 
> diff --git a/lib/pci.c b/lib/pci.c
> index 1495f61..d78472f 100644
> --- a/lib/pci.c
> +++ b/lib/pci.c
> @@ -56,6 +56,13 @@ void pci_scan_bars(struct pci_dev *dev)
>  	}
>  }
>  
> +int pci_enable_defaults(struct pci_dev *dev)
> +{
> +	pci_scan_bars(dev);
> +	pci_set_master(dev, 1);
> +	return 0;
> +}
> +
>  uint32_t pci_bar_mask(uint32_t bar)
>  {
>  	return (bar & PCI_BASE_ADDRESS_SPACE_IO) ?
> diff --git a/lib/pci.h b/lib/pci.h
> index 46657f4..0336455 100644
> --- a/lib/pci.h
> +++ b/lib/pci.h
> @@ -26,6 +26,7 @@ struct pci_dev {
>  void pci_dev_init(struct pci_dev *dev, pcidevaddr_t bdf);
>  void pci_scan_bars(struct pci_dev *dev);
>  void pci_set_master(struct pci_dev *dev, int master);
> +int pci_enable_defaults(struct pci_dev *dev);
>  
>  extern bool pci_probe(void);
>  extern void pci_print(void);
> -- 
> 2.7.4
>

Reviewed-by: Andrew Jones <drjones@xxxxxxxxxx> 
--
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