Commit dcf01a0a authored by Dan Handley's avatar Dan Handley
Browse files

Emit warnings when using deprecated GIC init



Emit runtime warnings when intializing the GIC drivers using the
deprecated method of defining integer interrupt arrays in the GIC driver
data structures; interrupt_prop_t arrays should be used instead. This
helps platforms detect that they have migration work to do. Previously,
no warning was emitted in this case. This affects both the GICv2 and GICv3
drivers.

Also use the __deprecated attribute to emit a build time warning if these
deprecated fields are used. These warnings are suppressed in the GIC
driver compatibility functions but will be visible if platforms use them.

Change-Id: I6b6b8f6c3b4920c448b6dcb82fc18442cfdf6c7a
Signed-off-by: default avatarDan Handley <dan.handley@arm.com>
parent bc1a03c7
...@@ -85,10 +85,17 @@ void gicv2_pcpu_distif_init(void) ...@@ -85,10 +85,17 @@ void gicv2_pcpu_distif_init(void)
driver_data->interrupt_props_num); driver_data->interrupt_props_num);
#if !ERROR_DEPRECATED #if !ERROR_DEPRECATED
} else { } else {
/*
* Suppress deprecated declaration warnings in compatibility
* function
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
assert(driver_data->g0_interrupt_array); assert(driver_data->g0_interrupt_array);
gicv2_secure_ppi_sgi_setup(driver_data->gicd_base, gicv2_secure_ppi_sgi_setup(driver_data->gicd_base,
driver_data->g0_interrupt_num, driver_data->g0_interrupt_num,
driver_data->g0_interrupt_array); driver_data->g0_interrupt_array);
#pragma GCC diagnostic pop
} }
#endif #endif
...@@ -128,12 +135,20 @@ void gicv2_distif_init(void) ...@@ -128,12 +135,20 @@ void gicv2_distif_init(void)
driver_data->interrupt_props_num); driver_data->interrupt_props_num);
#if !ERROR_DEPRECATED #if !ERROR_DEPRECATED
} else { } else {
/*
* Suppress deprecated declaration warnings in compatibility
* function
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
assert(driver_data->g0_interrupt_array); assert(driver_data->g0_interrupt_array);
/* Configure the G0 SPIs */ /* Configure the G0 SPIs */
gicv2_secure_spis_configure(driver_data->gicd_base, gicv2_secure_spis_configure(driver_data->gicd_base,
driver_data->g0_interrupt_num, driver_data->g0_interrupt_num,
driver_data->g0_interrupt_array); driver_data->g0_interrupt_array);
#pragma GCC diagnostic pop
} }
#endif #endif
...@@ -156,6 +171,13 @@ void gicv2_driver_init(const gicv2_driver_data_t *plat_driver_data) ...@@ -156,6 +171,13 @@ void gicv2_driver_init(const gicv2_driver_data_t *plat_driver_data)
/* Interrupt properties array size must be 0 */ /* Interrupt properties array size must be 0 */
assert(plat_driver_data->interrupt_props_num == 0); assert(plat_driver_data->interrupt_props_num == 0);
/*
* Suppress deprecated declaration warnings in compatibility
* function
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/* The platform should provide a list of secure interrupts */ /* The platform should provide a list of secure interrupts */
assert(plat_driver_data->g0_interrupt_array); assert(plat_driver_data->g0_interrupt_array);
...@@ -166,6 +188,11 @@ void gicv2_driver_init(const gicv2_driver_data_t *plat_driver_data) ...@@ -166,6 +188,11 @@ void gicv2_driver_init(const gicv2_driver_data_t *plat_driver_data)
assert(plat_driver_data->g0_interrupt_array ? assert(plat_driver_data->g0_interrupt_array ?
plat_driver_data->g0_interrupt_num : plat_driver_data->g0_interrupt_num :
plat_driver_data->g0_interrupt_num == 0); plat_driver_data->g0_interrupt_num == 0);
#pragma GCC diagnostic pop
WARN("Using deprecated integer interrupt array in "
"gicv2_driver_data_t\n");
WARN("Please migrate to using an interrupt_prop_t array\n");
} }
#else #else
assert(plat_driver_data->interrupt_props != NULL); assert(plat_driver_data->interrupt_props != NULL);
......
...@@ -72,6 +72,13 @@ void gicv3_driver_init(const gicv3_driver_data_t *plat_driver_data) ...@@ -72,6 +72,13 @@ void gicv3_driver_init(const gicv3_driver_data_t *plat_driver_data)
/* Interrupt properties array size must be 0 */ /* Interrupt properties array size must be 0 */
assert(plat_driver_data->interrupt_props_num == 0); assert(plat_driver_data->interrupt_props_num == 0);
/*
* Suppress deprecated declaration warnings in compatibility
* function
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/* /*
* The platform should provide a list of at least one type of * The platform should provide a list of at least one type of
* interrupt. * interrupt.
...@@ -89,6 +96,11 @@ void gicv3_driver_init(const gicv3_driver_data_t *plat_driver_data) ...@@ -89,6 +96,11 @@ void gicv3_driver_init(const gicv3_driver_data_t *plat_driver_data)
assert(plat_driver_data->g1s_interrupt_array ? assert(plat_driver_data->g1s_interrupt_array ?
plat_driver_data->g1s_interrupt_num : plat_driver_data->g1s_interrupt_num :
plat_driver_data->g1s_interrupt_num == 0); plat_driver_data->g1s_interrupt_num == 0);
#pragma GCC diagnostic pop
WARN("Using deprecated integer interrupt arrays in "
"gicv3_driver_data_t\n");
WARN("Please migrate to using interrupt_prop_t arrays\n");
} }
#else #else
assert(plat_driver_data->interrupt_props != NULL); assert(plat_driver_data->interrupt_props != NULL);
...@@ -189,6 +201,13 @@ void gicv3_distif_init(void) ...@@ -189,6 +201,13 @@ void gicv3_distif_init(void)
gicv3_driver_data->interrupt_props_num); gicv3_driver_data->interrupt_props_num);
#if !ERROR_DEPRECATED #if !ERROR_DEPRECATED
} else { } else {
/*
* Suppress deprecated declaration warnings in compatibility
* function
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
assert(gicv3_driver_data->g1s_interrupt_array || assert(gicv3_driver_data->g1s_interrupt_array ||
gicv3_driver_data->g0_interrupt_array); gicv3_driver_data->g0_interrupt_array);
...@@ -209,6 +228,7 @@ void gicv3_distif_init(void) ...@@ -209,6 +228,7 @@ void gicv3_distif_init(void)
INTR_GROUP0); INTR_GROUP0);
bitmap |= CTLR_ENABLE_G0_BIT; bitmap |= CTLR_ENABLE_G0_BIT;
} }
#pragma GCC diagnostic pop
} }
#endif #endif
...@@ -253,6 +273,13 @@ void gicv3_rdistif_init(unsigned int proc_num) ...@@ -253,6 +273,13 @@ void gicv3_rdistif_init(unsigned int proc_num)
gicv3_driver_data->interrupt_props_num); gicv3_driver_data->interrupt_props_num);
#if !ERROR_DEPRECATED #if !ERROR_DEPRECATED
} else { } else {
/*
* Suppress deprecated declaration warnings in compatibility
* function
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
assert(gicv3_driver_data->g1s_interrupt_array || assert(gicv3_driver_data->g1s_interrupt_array ||
gicv3_driver_data->g0_interrupt_array); gicv3_driver_data->g0_interrupt_array);
...@@ -273,6 +300,7 @@ void gicv3_rdistif_init(unsigned int proc_num) ...@@ -273,6 +300,7 @@ void gicv3_rdistif_init(unsigned int proc_num)
INTR_GROUP0); INTR_GROUP0);
bitmap |= CTLR_ENABLE_G0_BIT; bitmap |= CTLR_ENABLE_G0_BIT;
} }
#pragma GCC diagnostic pop
} }
#endif #endif
......
...@@ -155,8 +155,8 @@ typedef struct gicv2_driver_data { ...@@ -155,8 +155,8 @@ typedef struct gicv2_driver_data {
uintptr_t gicd_base; uintptr_t gicd_base;
uintptr_t gicc_base; uintptr_t gicc_base;
#if !ERROR_DEPRECATED #if !ERROR_DEPRECATED
unsigned int g0_interrupt_num; unsigned int g0_interrupt_num __deprecated;
const unsigned int *g0_interrupt_array; const unsigned int *g0_interrupt_array __deprecated;
#endif #endif
unsigned int *target_masks; unsigned int *target_masks;
unsigned int target_masks_num; unsigned int target_masks_num;
......
...@@ -310,10 +310,10 @@ typedef struct gicv3_driver_data { ...@@ -310,10 +310,10 @@ typedef struct gicv3_driver_data {
uintptr_t gicd_base; uintptr_t gicd_base;
uintptr_t gicr_base; uintptr_t gicr_base;
#if !ERROR_DEPRECATED #if !ERROR_DEPRECATED
unsigned int g0_interrupt_num; unsigned int g0_interrupt_num __deprecated;
unsigned int g1s_interrupt_num; unsigned int g1s_interrupt_num __deprecated;
const unsigned int *g0_interrupt_array; const unsigned int *g0_interrupt_array __deprecated;
const unsigned int *g1s_interrupt_array; const unsigned int *g1s_interrupt_array __deprecated;
#endif #endif
const interrupt_prop_t *interrupt_props; const interrupt_prop_t *interrupt_props;
unsigned int interrupt_props_num; unsigned int interrupt_props_num;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment