Re: [PATCH 12/15 v5] PCI: support the SR-IOV capability

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

 



On Tue, Oct 21, 2008 at 07:53:08PM +0800, Yu Zhao wrote:
> Support Single Root I/O Virtualization (SR-IOV) capability.
> 
> Cc: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx>
> Cc: Randy Dunlap <randy.dunlap@xxxxxxxxxx>
> Cc: Grant Grundler <grundler@xxxxxxxxxxxxxxxx>
> Cc: Alex Chiang <achiang@xxxxxx>
> Cc: Matthew Wilcox <matthew@xxxxxx>
> Cc: Roland Dreier <rdreier@xxxxxxxxx>
> Cc: Greg KH <greg@xxxxxxxxx>
> Signed-off-by: Yu Zhao <yu.zhao@xxxxxxxxx>
> 
> ---
>  drivers/pci/Kconfig      |   12 +
>  drivers/pci/Makefile     |    2 +
>  drivers/pci/iov.c        |  616 ++++++++++++++++++++++++++++++++++++++++++++++
>  drivers/pci/pci-sysfs.c  |    4 +
>  drivers/pci/pci.c        |   14 +
>  drivers/pci/pci.h        |   48 ++++
>  drivers/pci/probe.c      |    4 +
>  include/linux/pci.h      |   40 +++
>  include/linux/pci_regs.h |   21 ++
>  9 files changed, 761 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/pci/iov.c
> 
> diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
> index e1ca425..e7c0836 100644
> --- a/drivers/pci/Kconfig
> +++ b/drivers/pci/Kconfig
> @@ -50,3 +50,15 @@ config HT_IRQ
>  	   This allows native hypertransport devices to use interrupts.
>  
>  	   If unsure say Y.
> +
> +config PCI_IOV
> +	bool "PCI SR-IOV support"
> +	depends on PCI
> +	select PCI_MSI
> +	default n
> +	help
> +	  This option allows device drivers to enable Single Root I/O
> +	  Virtualization. Each Virtual Function's PCI configuration
> +	  space can be accessed using its own Bus, Device and Function
> +	  Number (Routing ID). Each Virtual Function also has PCI Memory
> +	  Space, which is used to map its own register set.
> diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
> index 4b47f4e..abbfcfa 100644
> --- a/drivers/pci/Makefile
> +++ b/drivers/pci/Makefile
> @@ -55,3 +55,5 @@ obj-$(CONFIG_PCI_SYSCALL) += syscall.o
>  ifeq ($(CONFIG_PCI_DEBUG),y)
>  EXTRA_CFLAGS += -DDEBUG
>  endif
> +
> +obj-$(CONFIG_PCI_IOV) += iov.o
> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> new file mode 100644
> index 0000000..571a46c
> --- /dev/null
> +++ b/drivers/pci/iov.c
> @@ -0,0 +1,616 @@
> +/*
> + * drivers/pci/iov.c
> + *
> + * Copyright (C) 2008 Intel Corporation
> + *
> + * PCI Express Single Root I/O Virtualization capability support.
> + */
> +
> +#include <linux/ctype.h>
> +#include <linux/string.h>
> +#include <linux/pci.h>
> +#include <linux/delay.h>
> +#include <asm/page.h>
> +#include "pci.h"
> +
> +
> +#define iov_config_attr(field)						\
> +static ssize_t field##_show(struct device *dev,				\
> +		struct device_attribute *attr, char *buf)		\
> +{									\
> +	struct pci_dev *pdev = to_pci_dev(dev);				\
> +	return sprintf(buf, "%d\n", pdev->iov->field);			\
> +}
> +
> +iov_config_attr(status);
> +iov_config_attr(totalvfs);
> +iov_config_attr(initialvfs);
> +iov_config_attr(numvfs);

As you are adding new sysfs entries, can you also create the proper
documentation in Documentation/ABI/ so that people can understand how to
use them?  Yes, I see you added a stand-alone document, but putting it
in the "standard" format is also necessary.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux