Oliver Upton <oliver.upton@xxxxxxxxx> writes:
On Fri, Nov 03, 2023 at 07:29:13PM +0000, Colton Lewis wrote:
Use default values during GIC initialization and setup to avoid
multiple tests needing to decide and declare base addresses for GICD
and GICR. Remove the repeated definitions of these addresses across
tests.
Signed-off-by: Colton Lewis <coltonlewis@xxxxxxxxxx>
<snip>
-void gic_init(enum gic_type type, unsigned int nr_cpus,
+void _gic_init(enum gic_type type, unsigned int nr_cpus,
void *dist_base, void *redist_base)
{
uint32_t cpu = guest_get_vcpuid();
@@ -63,6 +63,11 @@ void gic_init(enum gic_type type, unsigned int
nr_cpus,
gic_cpu_init(cpu, redist_base);
}
+void gic_init(enum gic_type type, unsigned int nr_cpus)
+{
+ _gic_init(type, nr_cpus, (void *)GICD_BASE_GPA, (void *)GICR_BASE_GPA);
+}
+
</snip>
-int vgic_v3_setup(struct kvm_vm *vm, unsigned int nr_vcpus, uint32_t
nr_irqs,
+int _vgic_v3_setup(struct kvm_vm *vm, uint32_t nr_vcpus, uint32_t
nr_irqs,
uint64_t gicd_base_gpa, uint64_t gicr_base_gpa)
{
int gic_fd;
@@ -79,6 +79,11 @@ int vgic_v3_setup(struct kvm_vm *vm, unsigned int
nr_vcpus, uint32_t nr_irqs,
return gic_fd;
}
+int vgic_v3_setup(struct kvm_vm *vm, uint32_t nr_vcpus, uint32_t
nr_irqs)
+{
+ return _vgic_v3_setup(vm, nr_vcpus, nr_irqs, GICD_BASE_GPA,
GICR_BASE_GPA);
+}
+
What's the point of having the internal implementations of these
functions that still take addresses? If we're standardizing GIC
placement then there's no need for allowing the caller to provide
different addresses.
I wasn't sure if there might be a reason for that allowance I was
unaware of since that's what the original interface was so I erred on
the side of flexibility. I'll delete it.