Skip to contentSkip to conversation

KVM: arm64: selftests: Clean up the GIC[D,R]_BASE_GPA

PATCH Superseded Shaoqin Huang 1 participant 2 messages Nov 15, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: arm64: selftests: Clean up the GIC[D,R]_BASE_GPA

The GIC[D,R]_BASE_GPA has been defined in multiple files with the same value, define it in one place to make the code clean.

---
 tools/testing/selftests/kvm/aarch64/arch_timer.c   | 3 ---
 tools/testing/selftests/kvm/aarch64/vgic_irq.c     | 3 ---
 tools/testing/selftests/kvm/dirty_log_perf_test.c  | 3 ---
 tools/testing/selftests/kvm/include/aarch64/vgic.h | 3 +++
 4 files changed, 3 insertions(+), 9 deletions(-)
tools/testing/selftests/kvm/aarch64/arch_timer.c +0 -3
index 274b8465b42a..818854007bfd 100644
@@ -59,9 +59,6 @@ static struct test_args test_args = {
 
 #define msecs_to_usecs(msec)		((msec) * 1000LL)
 
-#define GICD_BASE_GPA			0x8000000ULL
-#define GICR_BASE_GPA			0x80A0000ULL
-
 enum guest_stage {
 	GUEST_STAGE_VTIMER_CVAL = 1,
 	GUEST_STAGE_VTIMER_TVAL,
tools/testing/selftests/kvm/aarch64/vgic_irq.c +0 -3
index 2e64b4856e38..a48aff110fb6 100644
@@ -19,9 +19,6 @@
 #include "gic_v3.h"
 #include "vgic.h"
 
-#define GICD_BASE_GPA		0x08000000ULL
-#define GICR_BASE_GPA		0x080A0000ULL
-
 /*
  * Stores the user specified args; it's passed to the guest and to every test
  * function.
tools/testing/selftests/kvm/dirty_log_perf_test.c +0 -3
index d374dbcf9a53..4971e8f77a0a 100644
@@ -22,9 +22,6 @@
 #ifdef __aarch64__
 #include "aarch64/vgic.h"
 
-#define GICD_BASE_GPA			0x8000000ULL
-#define GICR_BASE_GPA			0x80A0000ULL
-
 static int gic_fd;
 
 static void arch_setup_vm(struct kvm_vm *vm, unsigned int nr_vcpus)
tools/testing/selftests/kvm/include/aarch64/vgic.h +3 -0
index 0ac6f05c63f9..9dbb342fd808 100644
@@ -33,4 +33,7 @@ void kvm_irq_write_isactiver(int gic_fd, uint32_t intid, struct kvm_vcpu *vcpu);
 
 #define KVM_IRQCHIP_NUM_PINS	(1020 - 32)
 
+#define GICD_BASE_GPA		0x08000000ULL
+#define GICR_BASE_GPA		0x080A0000ULL
+
 #endif // SELFTEST_KVM_VGIC_H
Signature · 1 line
2.40.1
#1 lore raw
Quoted 9 lines · Shaoqin Huang

The GIC[D,R]_BASE_GPA has been defined in multiple files with the same value, define it in one place to make the code clean.

---
  tools/testing/selftests/kvm/aarch64/arch_timer.c   | 3 ---
  tools/testing/selftests/kvm/aarch64/vgic_irq.c     | 3 ---
  tools/testing/selftests/kvm/dirty_log_perf_test.c  | 3 ---
  tools/testing/selftests/kvm/include/aarch64/vgic.h | 3 +++

Oops. Forget the kvm/aarch64/vpmu_counter_access.c. I will update a new one.

Quoted 56 lines
  4 files changed, 3 insertions(+), 9 deletions(-)
tools/testing/selftests/kvm/aarch64/arch_timer.c +0 -3
index 274b8465b42a..818854007bfd 100644
@@ -59,9 +59,6 @@ static struct test_args test_args = {
 
  #define msecs_to_usecs(msec)		((msec) * 1000LL)
 
-#define GICD_BASE_GPA			0x8000000ULL
-#define GICR_BASE_GPA			0x80A0000ULL
-
  enum guest_stage {
  	GUEST_STAGE_VTIMER_CVAL = 1,
  	GUEST_STAGE_VTIMER_TVAL,
tools/testing/selftests/kvm/aarch64/vgic_irq.c +0 -3
index 2e64b4856e38..a48aff110fb6 100644
@@ -19,9 +19,6 @@
  #include "gic_v3.h"
  #include "vgic.h"
 
-#define GICD_BASE_GPA		0x08000000ULL
-#define GICR_BASE_GPA		0x080A0000ULL
-
  /*
   * Stores the user specified args; it's passed to the guest and to every test
   * function.
tools/testing/selftests/kvm/dirty_log_perf_test.c +0 -3
index d374dbcf9a53..4971e8f77a0a 100644
@@ -22,9 +22,6 @@
  #ifdef __aarch64__
  #include "aarch64/vgic.h"
 
-#define GICD_BASE_GPA			0x8000000ULL
-#define GICR_BASE_GPA			0x80A0000ULL
-
  static int gic_fd;
 
  static void arch_setup_vm(struct kvm_vm *vm, unsigned int nr_vcpus)
tools/testing/selftests/kvm/include/aarch64/vgic.h +3 -0
index 0ac6f05c63f9..9dbb342fd808 100644
@@ -33,4 +33,7 @@ void kvm_irq_write_isactiver(int gic_fd, uint32_t intid, struct kvm_vcpu *vcpu);
 
  #define KVM_IRQCHIP_NUM_PINS	(1020 - 32)
 
+#define GICD_BASE_GPA		0x08000000ULL
+#define GICR_BASE_GPA		0x080A0000ULL
+
  #endif // SELFTEST_KVM_VGIC_H
Signature · 1 line
Shaoqin