Hi,
On 15/04/2020 02:02, Stefano Stabellini wrote:
> To be uniform with the old vgic. Name uniformity will become immediately
> useful in the following patch.
Please no. Those fields are not meant to be exposed outside of the vGIC.
'cbase' is also much less obvious to read over vgic_cpu_base.
Instead please introduce an helper to retrieve the information you need.
> In vgic_v2_map_resources, use the fields in struct vgic_dist rather than
> local variables.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
> ---
> xen/arch/arm/vgic/vgic-init.c | 4 ++--
> xen/arch/arm/vgic/vgic-v2.c | 16 ++++++++--------
> xen/include/asm-arm/new_vgic.h | 4 ++--
> 3 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/xen/arch/arm/vgic/vgic-init.c b/xen/arch/arm/vgic/vgic-init.c
> index 62ae553699..ea739d081e 100644
> --- a/xen/arch/arm/vgic/vgic-init.c
> +++ b/xen/arch/arm/vgic/vgic-init.c
> @@ -112,8 +112,8 @@ int domain_vgic_register(struct domain *d, int *mmio_count)
> BUG();
> }
>
> - d->arch.vgic.vgic_dist_base = VGIC_ADDR_UNDEF;
> - d->arch.vgic.vgic_cpu_base = VGIC_ADDR_UNDEF;
> + d->arch.vgic.dbase = VGIC_ADDR_UNDEF;
> + d->arch.vgic.cbase = VGIC_ADDR_UNDEF;
> d->arch.vgic.vgic_redist_base = VGIC_ADDR_UNDEF;
>
> return 0;
> diff --git a/xen/arch/arm/vgic/vgic-v2.c b/xen/arch/arm/vgic/vgic-v2.c
> index b5ba4ace87..09cb92039a 100644
> --- a/xen/arch/arm/vgic/vgic-v2.c
> +++ b/xen/arch/arm/vgic/vgic-v2.c
> @@ -258,7 +258,7 @@ void vgic_v2_enable(struct vcpu *vcpu)
> int vgic_v2_map_resources(struct domain *d)
> {
> struct vgic_dist *dist = &d->arch.vgic;
> - paddr_t cbase, csize;
> + paddr_t csize;
> paddr_t vbase;
> int ret;
>
> @@ -268,7 +268,7 @@ int vgic_v2_map_resources(struct domain *d)
> */
> if ( is_hardware_domain(d) )
> {
> - d->arch.vgic.vgic_dist_base = gic_v2_hw_data.dbase;
> + d->arch.vgic.dbase = gic_v2_hw_data.dbase;
> /*
> * For the hardware domain, we always map the whole HW CPU
> * interface region in order to match the device tree (the "reg"
> @@ -276,13 +276,13 @@ int vgic_v2_map_resources(struct domain *d)
> * Note that we assume the size of the CPU interface is always
> * aligned to PAGE_SIZE.
> */
> - cbase = gic_v2_hw_data.cbase;
> + d->arch.vgic.cbase = gic_v2_hw_data.cbase;
> csize = gic_v2_hw_data.csize;
> vbase = gic_v2_hw_data.vbase;
> }
> else
> {
> - d->arch.vgic.vgic_dist_base = GUEST_GICD_BASE;
> + d->arch.vgic.dbase = GUEST_GICD_BASE;
> /*
> * The CPU interface exposed to the guest is always 8kB. We may
> * need to add an offset to the virtual CPU interface base
> @@ -290,13 +290,13 @@ int vgic_v2_map_resources(struct domain *d)
> * region.
> */
> BUILD_BUG_ON(GUEST_GICC_SIZE != SZ_8K);
> - cbase = GUEST_GICC_BASE;
> + d->arch.vgic.cbase = GUEST_GICC_BASE;
> csize = GUEST_GICC_SIZE;
> vbase = gic_v2_hw_data.vbase + gic_v2_hw_data.aliased_offset;
> }
>
>
> - ret = vgic_register_dist_iodev(d, gaddr_to_gfn(dist->vgic_dist_base),
> + ret = vgic_register_dist_iodev(d, gaddr_to_gfn(dist->dbase),
> VGIC_V2);
> if ( ret )
> {
> @@ -308,8 +308,8 @@ int vgic_v2_map_resources(struct domain *d)
> * Map the gic virtual cpu interface in the gic cpu interface
> * region of the guest.
> */
> - ret = map_mmio_regions(d, gaddr_to_gfn(cbase), csize / PAGE_SIZE,
> - maddr_to_mfn(vbase));
> + ret = map_mmio_regions(d, gaddr_to_gfn(d->arch.vgic.cbase),
> + csize / PAGE_SIZE, maddr_to_mfn(vbase));
> if ( ret )
> {
> gdprintk(XENLOG_ERR, "Unable to remap VGIC CPU to VCPU\n");
> diff --git a/xen/include/asm-arm/new_vgic.h b/xen/include/asm-arm/new_vgic.h
> index 97d622bff6..e3319900ab 100644
> --- a/xen/include/asm-arm/new_vgic.h
> +++ b/xen/include/asm-arm/new_vgic.h
> @@ -115,11 +115,11 @@ struct vgic_dist {
> unsigned int nr_spis;
>
> /* base addresses in guest physical address space: */
> - paddr_t vgic_dist_base; /* distributor */
> + paddr_t dbase; /* distributor */
> union
> {
> /* either a GICv2 CPU interface */
> - paddr_t vgic_cpu_base;
> + paddr_t cbase;
> /* or a number of GICv3 redistributor regions */
> struct
> {
>
--
Julien Grall