diff mbox series

[XEN,1/4] arm/gicv3: Move guest dist base

Message ID becf4d912d32b6888e040edd0fda4eece6cab66b.1698225630.git.mykyta_poturai@epam.com (mailing list archive)
State Superseded
Headers show
Series arm: Add GICv3 support to the New VGIC | expand

Commit Message

Mykyta Poturai Oct. 25, 2023, 10:13 a.m. UTC
New vgic code relies on lower address bits to calculate intid from
the address offset. 0x03001000 as DIST_BASE overlaps with
VGIC_ADDR_IRQ_MASK when bits_per_irq >= 64, breaking the intid calculation.
Move DIST_BASE to a safer location to fix this.

Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
---
 xen/include/public/arch-arm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Julien Grall Oct. 25, 2023, 10:39 a.m. UTC | #1
Hi,

On 25/10/2023 11:13, Mykyta Poturai wrote:
> New vgic code relies on lower address bits to calculate intid from > the address offset. 0x03001000 as DIST_BASE overlaps with
> VGIC_ADDR_IRQ_MASK when bits_per_irq >= 64, breaking the intid calculation.
> Move DIST_BASE to a safer location to fix this.

I am a bit confused, you are referring to vGICv3 in the title but the 
commit message is generic enough and vGICv2 already seem to use the 
macro. In fact, the value for the distributor base is actualy the same 
as GICv3. So is this a bug for GICv2 as well? If not, can you provide 
more details why?

Lastly, we can control the address for a guest but not for dom0. So 
wouldn't it be a problem for dom0 as well? This would mean the code 
needs to be fixed rather than the guest GICv3 distributor base changed.

Cheers,

> 
> Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
> ---
>   xen/include/public/arch-arm.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
> index a25e87dbda..71fa25b1d4 100644
> --- a/xen/include/public/arch-arm.h
> +++ b/xen/include/public/arch-arm.h
> @@ -438,7 +438,7 @@ typedef uint64_t xen_callback_t;
>   #define GUEST_GICC_SIZE   xen_mk_ullong(0x00002000)
>   
>   /* vGIC v3 mappings */
> -#define GUEST_GICV3_GICD_BASE      xen_mk_ullong(0x03001000)
> +#define GUEST_GICV3_GICD_BASE      xen_mk_ullong(0x03000000)
>   #define GUEST_GICV3_GICD_SIZE      xen_mk_ullong(0x00010000)
>   
>   #define GUEST_GICV3_RDIST_REGIONS  1
diff mbox series

Patch

diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index a25e87dbda..71fa25b1d4 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -438,7 +438,7 @@  typedef uint64_t xen_callback_t;
 #define GUEST_GICC_SIZE   xen_mk_ullong(0x00002000)
 
 /* vGIC v3 mappings */
-#define GUEST_GICV3_GICD_BASE      xen_mk_ullong(0x03001000)
+#define GUEST_GICV3_GICD_BASE      xen_mk_ullong(0x03000000)
 #define GUEST_GICV3_GICD_SIZE      xen_mk_ullong(0x00010000)
 
 #define GUEST_GICV3_RDIST_REGIONS  1