diff mbox series

[Xen-devel,v3,02/39] ARM: GIC: add GIC_INVALID to enum gic_version

Message ID 20180321163235.12529-3-andre.przywara@linaro.org
State New
Headers show
Series New VGIC(-v2) implementation | expand

Commit Message

Andre Przywara March 21, 2018, 4:31 p.m. UTC
The enum gic_version at the moment just contains GIC_V2 and GIC_V3,
where GIC_V2 happens to map to 0. So without having initialised a
variable of that type, we will read back GIC_V2 (when allocated with zeroing
the memory).
To prevent ambiguities and to give an explicitly uninitialised state, add
a new first member: GIC_INVALID. Also make it obvious that this has a
"0" encoding.

Signed-off-by: Andre Przywara <andre.przywara@linaro.org>
---
 xen/include/asm-arm/gic.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Julien Grall March 22, 2018, 1:39 a.m. UTC | #1
Hi Andre,

On 03/21/2018 04:31 PM, Andre Przywara wrote:
> The enum gic_version at the moment just contains GIC_V2 and GIC_V3,
> where GIC_V2 happens to map to 0. So without having initialised a
> variable of that type, we will read back GIC_V2 (when allocated with zeroing
> the memory).
> To prevent ambiguities and to give an explicitly uninitialised state, add
> a new first member: GIC_INVALID. Also make it obvious that this has a
> "0" encoding.
> 
> Signed-off-by: Andre Przywara <andre.przywara@linaro.org>

Acked-by: Julien Grall <julien.grall@arm.com>

Cheers,

> ---
>   xen/include/asm-arm/gic.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
> index 565b0875ca..3079387e06 100644
> --- a/xen/include/asm-arm/gic.h
> +++ b/xen/include/asm-arm/gic.h
> @@ -227,6 +227,7 @@ struct gic_lr {
>   };
>   
>   enum gic_version {
> +    GIC_INVALID = 0,    /* the default until explicitly set up */
>       GIC_V2,
>       GIC_V3,
>   };
>
Stefano Stabellini March 26, 2018, 8:08 p.m. UTC | #2
On Wed, 21 Mar 2018, Andre Przywara wrote:
> The enum gic_version at the moment just contains GIC_V2 and GIC_V3,
> where GIC_V2 happens to map to 0. So without having initialised a
> variable of that type, we will read back GIC_V2 (when allocated with zeroing
> the memory).
> To prevent ambiguities and to give an explicitly uninitialised state, add
> a new first member: GIC_INVALID. Also make it obvious that this has a
> "0" encoding.
> 
> Signed-off-by: Andre Przywara <andre.przywara@linaro.org>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/include/asm-arm/gic.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
> index 565b0875ca..3079387e06 100644
> --- a/xen/include/asm-arm/gic.h
> +++ b/xen/include/asm-arm/gic.h
> @@ -227,6 +227,7 @@ struct gic_lr {
>  };
>  
>  enum gic_version {
> +    GIC_INVALID = 0,    /* the default until explicitly set up */
>      GIC_V2,
>      GIC_V3,
>  };
> -- 
> 2.14.1
>
diff mbox series

Patch

diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index 565b0875ca..3079387e06 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -227,6 +227,7 @@  struct gic_lr {
 };
 
 enum gic_version {
+    GIC_INVALID = 0,    /* the default until explicitly set up */
     GIC_V2,
     GIC_V3,
 };