diff mbox series

[kvmtool,07/16] arm: Remove redundant define ARM_PCI_CFG_SIZE

Message ID 1569245722-23375-8-git-send-email-alexandru.elisei@arm.com (mailing list archive)
State New, archived
Headers show
Series arm: Allow the user to define the memory layout | expand

Commit Message

Alexandru Elisei Sept. 23, 2019, 1:35 p.m. UTC
ARM_PCI_CFG_SIZE has the same value as PCI_CFG_SIZE. The pci driver uses
PCI_CFG_SIZE and arm uses ARM_PCI_CFG_SIZE when generating the pci DT node.
Having two defines with the same value is confusing, and can lead to bugs
if one define is changed and the other isn't. So replace all instances of
ARM_PCI_CFG_SIZE with PCI_CFG_SIZE.

Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
---
 arm/include/arm-common/kvm-arch.h | 7 ++++---
 arm/pci.c                         | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

Comments

Andre Przywara Nov. 6, 2019, 4:49 p.m. UTC | #1
On Mon, 23 Sep 2019 14:35:13 +0100
Alexandru Elisei <alexandru.elisei@arm.com> wrote:

Hi,

> ARM_PCI_CFG_SIZE has the same value as PCI_CFG_SIZE. The pci driver uses
> PCI_CFG_SIZE and arm uses ARM_PCI_CFG_SIZE when generating the pci DT node.
> Having two defines with the same value is confusing, and can lead to bugs
> if one define is changed and the other isn't. So replace all instances of
> ARM_PCI_CFG_SIZE with PCI_CFG_SIZE.
> 
> Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre.

> ---
>  arm/include/arm-common/kvm-arch.h | 7 ++++---
>  arm/pci.c                         | 2 +-
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/arm/include/arm-common/kvm-arch.h b/arm/include/arm-common/kvm-arch.h
> index 965978d7cfb5..f8f6b8f98c96 100644
> --- a/arm/include/arm-common/kvm-arch.h
> +++ b/arm/include/arm-common/kvm-arch.h
> @@ -5,6 +5,8 @@
>  #include <linux/const.h>
>  #include <linux/types.h>
>  
> +#include "kvm/pci.h"
> +
>  #include "arm-common/gic.h"
>  
>  #define ARM_IOPORT_AREA		_AC(0x0000000000000000, UL)
> @@ -23,13 +25,12 @@
>  
>  #define ARM_IOPORT_SIZE		(ARM_MMIO_AREA - ARM_IOPORT_AREA)
>  #define ARM_VIRTIO_MMIO_SIZE	(ARM_AXI_AREA - (ARM_MMIO_AREA + ARM_GIC_SIZE))
> -#define ARM_PCI_CFG_SIZE	(1ULL << 24)
>  #define ARM_PCI_MMIO_SIZE	(ARM_MEMORY_AREA - \
> -				(ARM_AXI_AREA + ARM_PCI_CFG_SIZE))
> +				(ARM_AXI_AREA + PCI_CFG_SIZE))
>  
>  #define KVM_IOPORT_AREA		ARM_IOPORT_AREA
>  #define KVM_PCI_CFG_AREA	ARM_AXI_AREA
> -#define KVM_PCI_MMIO_AREA	(KVM_PCI_CFG_AREA + ARM_PCI_CFG_SIZE)
> +#define KVM_PCI_MMIO_AREA	(KVM_PCI_CFG_AREA + PCI_CFG_SIZE)
>  #define KVM_VIRTIO_MMIO_AREA	ARM_MMIO_AREA
>  
>  #define KVM_IOEVENTFD_HAS_PIO	0
> diff --git a/arm/pci.c b/arm/pci.c
> index 557cfa98938d..1a2fc2688c9e 100644
> --- a/arm/pci.c
> +++ b/arm/pci.c
> @@ -33,7 +33,7 @@ void pci__generate_fdt_nodes(void *fdt)
>  	u32 bus_range[] = { cpu_to_fdt32(0), cpu_to_fdt32(1), };
>  	/* Configuration Space */
>  	u64 cfg_reg_prop[] = { cpu_to_fdt64(KVM_PCI_CFG_AREA),
> -			       cpu_to_fdt64(ARM_PCI_CFG_SIZE), };
> +			       cpu_to_fdt64(PCI_CFG_SIZE), };
>  	/* Describe the memory ranges */
>  	struct of_pci_ranges_entry ranges[] = {
>  		{
Suzuki K Poulose Feb. 6, 2020, 11:49 a.m. UTC | #2
On 23/09/2019 14:35, Alexandru Elisei wrote:
> ARM_PCI_CFG_SIZE has the same value as PCI_CFG_SIZE. The pci driver uses
> PCI_CFG_SIZE and arm uses ARM_PCI_CFG_SIZE when generating the pci DT node.
> Having two defines with the same value is confusing, and can lead to bugs
> if one define is changed and the other isn't. So replace all instances of
> ARM_PCI_CFG_SIZE with PCI_CFG_SIZE.
> 
> Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>

Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
diff mbox series

Patch

diff --git a/arm/include/arm-common/kvm-arch.h b/arm/include/arm-common/kvm-arch.h
index 965978d7cfb5..f8f6b8f98c96 100644
--- a/arm/include/arm-common/kvm-arch.h
+++ b/arm/include/arm-common/kvm-arch.h
@@ -5,6 +5,8 @@ 
 #include <linux/const.h>
 #include <linux/types.h>
 
+#include "kvm/pci.h"
+
 #include "arm-common/gic.h"
 
 #define ARM_IOPORT_AREA		_AC(0x0000000000000000, UL)
@@ -23,13 +25,12 @@ 
 
 #define ARM_IOPORT_SIZE		(ARM_MMIO_AREA - ARM_IOPORT_AREA)
 #define ARM_VIRTIO_MMIO_SIZE	(ARM_AXI_AREA - (ARM_MMIO_AREA + ARM_GIC_SIZE))
-#define ARM_PCI_CFG_SIZE	(1ULL << 24)
 #define ARM_PCI_MMIO_SIZE	(ARM_MEMORY_AREA - \
-				(ARM_AXI_AREA + ARM_PCI_CFG_SIZE))
+				(ARM_AXI_AREA + PCI_CFG_SIZE))
 
 #define KVM_IOPORT_AREA		ARM_IOPORT_AREA
 #define KVM_PCI_CFG_AREA	ARM_AXI_AREA
-#define KVM_PCI_MMIO_AREA	(KVM_PCI_CFG_AREA + ARM_PCI_CFG_SIZE)
+#define KVM_PCI_MMIO_AREA	(KVM_PCI_CFG_AREA + PCI_CFG_SIZE)
 #define KVM_VIRTIO_MMIO_AREA	ARM_MMIO_AREA
 
 #define KVM_IOEVENTFD_HAS_PIO	0
diff --git a/arm/pci.c b/arm/pci.c
index 557cfa98938d..1a2fc2688c9e 100644
--- a/arm/pci.c
+++ b/arm/pci.c
@@ -33,7 +33,7 @@  void pci__generate_fdt_nodes(void *fdt)
 	u32 bus_range[] = { cpu_to_fdt32(0), cpu_to_fdt32(1), };
 	/* Configuration Space */
 	u64 cfg_reg_prop[] = { cpu_to_fdt64(KVM_PCI_CFG_AREA),
-			       cpu_to_fdt64(ARM_PCI_CFG_SIZE), };
+			       cpu_to_fdt64(PCI_CFG_SIZE), };
 	/* Describe the memory ranges */
 	struct of_pci_ranges_entry ranges[] = {
 		{