All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: move cfg space size (256/4096) macros to pci_regs.h
@ 2016-09-22  1:05 Wang Sheng-Hui
  2016-11-11 20:51 ` Bjorn Helgaas
  0 siblings, 1 reply; 4+ messages in thread
From: Wang Sheng-Hui @ 2016-09-22  1:05 UTC (permalink / raw)
  To: yu.zhao, jbarnes, alex.williamson; +Cc: bhelgaas, linux-pci, kvm, linux-kernel

This is a cleanup that moves PCI configuration space size
macros (PCI_CFG_SPACE_SIZE and PCI_CFG_SPACE_EXP_SIZE) from
drivers/pci/pci.h to include/uapi/linux/pci_regs.h

So that the macros can be used by more drivers and eliminate
potential duplicate definition.

Signed-off-by: Wang Sheng-Hui <shhuiw@foxmail.com>
---
 drivers/pci/pci.h                  | 3 ---
 drivers/vfio/pci/vfio_pci_config.c | 2 --
 include/uapi/linux/pci_regs.h      | 7 +++++++
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 9730c47..12d651a 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -1,9 +1,6 @@
 #ifndef DRIVERS_PCI_H
 #define DRIVERS_PCI_H
 
-#define PCI_CFG_SPACE_SIZE	256
-#define PCI_CFG_SPACE_EXP_SIZE	4096
-
 #define PCI_FIND_CAP_TTL	48
 
 extern const unsigned char pcie_link_speed[];
diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
index 688691d..8dc8a5a 100644
--- a/drivers/vfio/pci/vfio_pci_config.c
+++ b/drivers/vfio/pci/vfio_pci_config.c
@@ -31,8 +31,6 @@
 
 #include "vfio_pci_private.h"
 
-#define PCI_CFG_SPACE_SIZE	256
-
 /* Fake capability ID for standard config space */
 #define PCI_CAP_ID_BASIC	0
 
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 4040951..a07c53c 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -23,6 +23,13 @@
 #define LINUX_PCI_REGS_H
 
 /*
+ * Under PCI, each device has 256 bytes of configuration address space.
+ * Under PCIe, each device has 4096 bytes of configuration address space.
+ */
+#define PCI_CFG_SPACE_SIZE	256
+#define PCI_CFG_SPACE_EXP_SIZE	4096
+
+/*
  * Under PCI, each device has 256 bytes of configuration address space,
  * of which the first 64 bytes are standardized as follows:
  */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: move cfg space size (256/4096) macros to pci_regs.h
  2016-09-22  1:05 [PATCH] PCI: move cfg space size (256/4096) macros to pci_regs.h Wang Sheng-Hui
@ 2016-11-11 20:51 ` Bjorn Helgaas
  2016-11-12  1:25     ` Wang Sheng-Hui
  0 siblings, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2016-11-11 20:51 UTC (permalink / raw)
  To: Wang Sheng-Hui
  Cc: yu.zhao, jbarnes, alex.williamson, bhelgaas, linux-pci, kvm,
	linux-kernel

On Thu, Sep 22, 2016 at 09:05:46AM +0800, Wang Sheng-Hui wrote:
> This is a cleanup that moves PCI configuration space size
> macros (PCI_CFG_SPACE_SIZE and PCI_CFG_SPACE_EXP_SIZE) from
> drivers/pci/pci.h to include/uapi/linux/pci_regs.h
> 
> So that the macros can be used by more drivers and eliminate
> potential duplicate definition.
> 
> Signed-off-by: Wang Sheng-Hui <shhuiw@foxmail.com>

Applied to pci/misc for v4.10, thanks!

I updated the comment to include PCI-X details, since the extended config
space applies to PCI-X Mode 2 devices as well as to PCIe devices:

+ * Conventional PCI and PCI-X Mode 1 devices have 256 bytes of
+ * configuration space.  PCI-X Mode 2 and PCIe devices have 4096 bytes of
+ * configuration space.

> ---
>  drivers/pci/pci.h                  | 3 ---
>  drivers/vfio/pci/vfio_pci_config.c | 2 --
>  include/uapi/linux/pci_regs.h      | 7 +++++++
>  3 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index 9730c47..12d651a 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -1,9 +1,6 @@
>  #ifndef DRIVERS_PCI_H
>  #define DRIVERS_PCI_H
>  
> -#define PCI_CFG_SPACE_SIZE	256
> -#define PCI_CFG_SPACE_EXP_SIZE	4096
> -
>  #define PCI_FIND_CAP_TTL	48
>  
>  extern const unsigned char pcie_link_speed[];
> diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
> index 688691d..8dc8a5a 100644
> --- a/drivers/vfio/pci/vfio_pci_config.c
> +++ b/drivers/vfio/pci/vfio_pci_config.c
> @@ -31,8 +31,6 @@
>  
>  #include "vfio_pci_private.h"
>  
> -#define PCI_CFG_SPACE_SIZE	256
> -
>  /* Fake capability ID for standard config space */
>  #define PCI_CAP_ID_BASIC	0
>  
> diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
> index 4040951..a07c53c 100644
> --- a/include/uapi/linux/pci_regs.h
> +++ b/include/uapi/linux/pci_regs.h
> @@ -23,6 +23,13 @@
>  #define LINUX_PCI_REGS_H
>  
>  /*
> + * Under PCI, each device has 256 bytes of configuration address space.
> + * Under PCIe, each device has 4096 bytes of configuration address space.
> + */
> +#define PCI_CFG_SPACE_SIZE	256
> +#define PCI_CFG_SPACE_EXP_SIZE	4096
> +
> +/*
>   * Under PCI, each device has 256 bytes of configuration address space,
>   * of which the first 64 bytes are standardized as follows:
>   */
> -- 
> 2.7.4
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re:  [PATCH] PCI: move cfg space size (256/4096) macros to pci_regs.h
  2016-11-11 20:51 ` Bjorn Helgaas
@ 2016-11-12  1:25     ` Wang Sheng-Hui
  0 siblings, 0 replies; 4+ messages in thread
From: Wang Sheng-Hui @ 2016-11-12  1:25 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: yu.zhao, jbarnes, alex.williamson, bhelgaas, linux-pci, kvm,
	linux-kernel

Thanks!

Regards,
Wang Sheng-Hui


------------------ Original ------------------
From:  "Bjorn Helgaas";<helgaas@kernel.org>;
Date:  Sat, Nov 12, 2016 04:51 AM
To:  "Wang Sheng-Hui"<shhuiw@foxmail.com>; 
Cc:  "yu.zhao"<yu.zhao@intel.com>; "jbarnes"<jbarnes@virtuousgeek.org>; "alex.williamson"<alex.williamson@redhat.com>; "bhelgaas"<bhelgaas@google.com>; "linux-pci"<linux-pci@vger.kernel.org>; "kvm"<kvm@vger.kernel.org>; "linux-kernel"<linux-kernel@vger.kernel.org>; 
Subject:  Re: [PATCH] PCI: move cfg space size (256/4096) macros to pci_regs.h



On Thu, Sep 22, 2016 at 09:05:46AM +0800, Wang Sheng-Hui wrote:
> This is a cleanup that moves PCI configuration space size
> macros (PCI_CFG_SPACE_SIZE and PCI_CFG_SPACE_EXP_SIZE) from
> drivers/pci/pci.h to include/uapi/linux/pci_regs.h
> 
> So that the macros can be used by more drivers and eliminate
> potential duplicate definition.
> 
> Signed-off-by: Wang Sheng-Hui <shhuiw@foxmail.com>

Applied to pci/misc for v4.10, thanks!

I updated the comment to include PCI-X details, since the extended config
space applies to PCI-X Mode 2 devices as well as to PCIe devices:

+ * Conventional PCI and PCI-X Mode 1 devices have 256 bytes of
+ * configuration space.  PCI-X Mode 2 and PCIe devices have 4096 bytes of
+ * configuration space.

> ---
>  drivers/pci/pci.h                  | 3 ---
>  drivers/vfio/pci/vfio_pci_config.c | 2 --
>  include/uapi/linux/pci_regs.h      | 7 +++++++
>  3 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index 9730c47..12d651a 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -1,9 +1,6 @@
>  #ifndef DRIVERS_PCI_H
>  #define DRIVERS_PCI_H
>  
> -#define PCI_CFG_SPACE_SIZE 256
> -#define PCI_CFG_SPACE_EXP_SIZE 4096
> -
>  #define PCI_FIND_CAP_TTL 48
>  
>  extern const unsigned char pcie_link_speed[];
> diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
> index 688691d..8dc8a5a 100644
> --- a/drivers/vfio/pci/vfio_pci_config.c
> +++ b/drivers/vfio/pci/vfio_pci_config.c
> @@ -31,8 +31,6 @@
>  
>  #include "vfio_pci_private.h"
>  
> -#define PCI_CFG_SPACE_SIZE 256
> -
>  /* Fake capability ID for standard config space */
>  #define PCI_CAP_ID_BASIC 0
>  
> diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
> index 4040951..a07c53c 100644
> --- a/include/uapi/linux/pci_regs.h
> +++ b/include/uapi/linux/pci_regs.h
> @@ -23,6 +23,13 @@
>  #define LINUX_PCI_REGS_H
>  
>  /*
> + * Under PCI, each device has 256 bytes of configuration address space.
> + * Under PCIe, each device has 4096 bytes of configuration address space.
> + */
> +#define PCI_CFG_SPACE_SIZE 256
> +#define PCI_CFG_SPACE_EXP_SIZE 4096
> +
> +/*
>   * Under PCI, each device has 256 bytes of configuration address space,
>   * of which the first 64 bytes are standardized as follows:
>   */
> -- 
> 2.7.4
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re:  [PATCH] PCI: move cfg space size (256/4096) macros to pci_regs.h
@ 2016-11-12  1:25     ` Wang Sheng-Hui
  0 siblings, 0 replies; 4+ messages in thread
From: Wang Sheng-Hui @ 2016-11-12  1:25 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: yu.zhao, jbarnes, alex.williamson, bhelgaas, linux-pci, kvm,
	linux-kernel

VGhhbmtzIQoKUmVnYXJkcywKV2FuZ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C | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22  1:05 [PATCH] PCI: move cfg space size (256/4096) macros to pci_regs.h Wang Sheng-Hui
2016-11-11 20:51 ` Bjorn Helgaas
2016-11-12  1:25   ` Wang Sheng-Hui
2016-11-12  1:25     ` Wang Sheng-Hui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.