From 9d6d800d13fe18acf6a759c00ae981eb437eff1f Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Thu, 9 Nov 2017 12:07:53 -0600 Subject: [PATCH 1/2] gicv2: Fix support for systems without secure interrupts Accessing the interrupt_props array only happens inside a loop over interrupt_props_num, so the GICv2 driver can cope with no secure interrupts. As in fact we have already some asserts in place that respect that, lets change the final place where we insist on a non-NULL pointer to relax that. This enables GICv2 platforms which have no need for a secure interrupt. This only covers the non-deprecated code paths. Also we remove a now redundant assert(). Change-Id: Id100ea978643d8558335ad28649d55743fe9bd4c Signed-off-by: Samuel Holland Signed-off-by: Andre Przywara --- drivers/arm/gic/v2/gicv2_main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/arm/gic/v2/gicv2_main.c b/drivers/arm/gic/v2/gicv2_main.c index e25e501df..bbe73fb95 100644 --- a/drivers/arm/gic/v2/gicv2_main.c +++ b/drivers/arm/gic/v2/gicv2_main.c @@ -178,9 +178,6 @@ void gicv2_driver_init(const gicv2_driver_data_t *plat_driver_data) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - /* The platform should provide a list of secure interrupts */ - assert(plat_driver_data->g0_interrupt_array); - /* * If there are no interrupts of a particular type, then the * number of interrupts of that type should be 0 and vice-versa. @@ -195,8 +192,8 @@ void gicv2_driver_init(const gicv2_driver_data_t *plat_driver_data) WARN("Please migrate to using an interrupt_prop_t array\n"); } #else - assert(plat_driver_data->interrupt_props != NULL); - assert(plat_driver_data->interrupt_props_num > 0); + assert(plat_driver_data->interrupt_props_num > 0 ? + plat_driver_data->interrupt_props != NULL : 1); #endif /* Ensure that this is a GICv2 system */ From 205cf6e7a52bc006cb625060b1dafcbd3d2a0d76 Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Thu, 9 Nov 2017 12:08:00 -0600 Subject: [PATCH 2/2] gicv3: Fix support for systems without secure interrupts Accessing the interrupt_props array only happens inside a loop over interrupt_props_num, so the GICv3 driver can cope with no secure interrupts. This allows us to relax the asserts that insists on a non-NULL interrupt_props pointer and at least one secure interrupt. This enables GICv3 platforms which have no need for a secure interrupt. This only covers the non-deprecated code paths. Change-Id: I49db291906512f56af065772f69acb281dfbdcfb Signed-off-by: Andre Przywara --- drivers/arm/gic/v3/gicv3_helpers.c | 6 ++---- drivers/arm/gic/v3/gicv3_main.c | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/arm/gic/v3/gicv3_helpers.c b/drivers/arm/gic/v3/gicv3_helpers.c index 69c695128..020ec1b63 100644 --- a/drivers/arm/gic/v3/gicv3_helpers.c +++ b/drivers/arm/gic/v3/gicv3_helpers.c @@ -433,8 +433,7 @@ unsigned int gicv3_secure_spis_configure_props(uintptr_t gicd_base, unsigned int ctlr_enable = 0; /* Make sure there's a valid property array */ - assert(interrupt_props != NULL); - assert(interrupt_props_num > 0); + assert(interrupt_props_num > 0 ? interrupt_props != NULL : 1); for (i = 0; i < interrupt_props_num; i++) { current_prop = &interrupt_props[i]; @@ -556,8 +555,7 @@ unsigned int gicv3_secure_ppi_sgi_configure_props(uintptr_t gicr_base, unsigned int ctlr_enable = 0; /* Make sure there's a valid property array */ - assert(interrupt_props != NULL); - assert(interrupt_props_num > 0); + assert(interrupt_props_num > 0 ? interrupt_props != NULL : 1); for (i = 0; i < interrupt_props_num; i++) { current_prop = &interrupt_props[i]; diff --git a/drivers/arm/gic/v3/gicv3_main.c b/drivers/arm/gic/v3/gicv3_main.c index d8fc7d683..82f43d085 100644 --- a/drivers/arm/gic/v3/gicv3_main.c +++ b/drivers/arm/gic/v3/gicv3_main.c @@ -103,8 +103,8 @@ void gicv3_driver_init(const gicv3_driver_data_t *plat_driver_data) WARN("Please migrate to using interrupt_prop_t arrays\n"); } #else - assert(plat_driver_data->interrupt_props != NULL); - assert(plat_driver_data->interrupt_props_num > 0); + assert(plat_driver_data->interrupt_props_num > 0 ? + plat_driver_data->interrupt_props != NULL : 1); #endif /* Check for system register support */