|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [RFC PATCH] xen: gic-v3: Introduce CONFIG_GICV3_NR_LRS
Hi Ayan, On 05/03/2026 19:43, Ayan Kumar Halder wrote: Set GICV3_NR_LRS as per the number of list registers in the supported hardware. This ensures: 1. In gicv3_save_lrs()/gicv3_restore_lrs(), use the number of list registers from GICV3_NR_LRS (if defined) instead of gicv3_info.nr_lrs. This ensures that if the hardware does not support more than 4 LRs (for example), the code accessing LR 4-15 is never reached. The compiler can eliminate the unsupported cases as the switch case uses a constant conditional. 2. Similarly In gicv3_ich_read_lr()/gicv3_ich_write_lr() , we can justify that the unsupported LRs (4-15) will never be reached as Xen will panic if the runtime value (lr) exceeds GICV3_NR_LRS. Some compiler can eliminate the code accessing LR 4-15. In this situation, using panic() is better than accessing a list register which is not present in the hardware 3. Whenever GICV3_NR_LRS is defined, the default condition and the related BUG() cannot be reached at all. I am not sure how this is better. You will still crash Xen is 'lr' >= GICV3_NR_LRS. Can you provide some details? > > As part of functional safety effort, we are trying to enable system integrator to configure Xen for a specific platform with a predefind set of GICv3 list registers. So that we can minimize the chance of runtime issues and reduce the codesize that will execute. Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx> --- xen/arch/arm/Kconfig | 9 +++++++++ xen/arch/arm/gic-v3.c | 12 ++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 2f2b501fda..6540013f97 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -276,6 +276,15 @@ config PCI_PASSTHROUGHendmenu +config GICV3_NR_LRS We should avoid lowercase define, in particular with generic names like 'lrs'. I think in this case, I would rather update gicv3_info.nr_lrs: gicv3_info.nr_lrs = min(gv3_info.nr_lrs, CONFIG_GICV3_NR_LRS);This would solve another problem where you don't sanity check that the system effectively support CONFIG_GICV3_NR_LRS.
Do we really have to panic in production build? Wouldn't it be better to return '0' and maybe use ASSERT for a crash in debug build? Same below.
Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |