ARM/vgic: Clean up vgic_v2_setup_hw()
PATCH 1/1 ARM/vgic: Clean up vgic_v2_setup_hw()
vgic_v2_setup_hw()'s callers are __init, so it should be too. vgic_v2_hw is written once during init and unmodified thereafter, so make it __ro_after_init. Reposition 'bool enabled' to fit in the tail padding, removing 8 bytes from the structure.
No functional change.
---
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
Found when looking at the code while reviewing something else. Only compile tested.
--- xen/arch/arm/vgic-v2.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
xen/arch/arm/vgic-v2.c +5 -4
@@ -25,7 +25,6 @@#include <asm/vreg.h> static struct { - bool enabled; /* Distributor interface address */ paddr_t dbase; /* CPU interface address & size */
@@ -36,10 +35,12 @@ static struct {/* Offset to add to get an 8kB contiguous region if GIC is aliased */ uint32_t aliased_offset; -} vgic_v2_hw; +bool enabled; +} vgic_v2_hw__ro_after_init ; -void vgic_v2_setup_hw (paddr_t dbase,paddr_t cbase,paddr_t csize, -paddr_t vbase,uint32_t aliased_offset) +void __init vgic_v2_setup_hw ( +paddr_t dbase,paddr_t cbase,paddr_t csize,paddr_t vbase, +uint32_t aliased_offset) { vgic_v2_hw.enabled = true; vgic_v2_hw.dbase = dbase;
base-commit: ebc00c30c65023bd1498ae20dc511c4e39f6c0f7
Signature · 1 line
2.39.5
Quoted 8 lines · Andrew Cooper
vgic_v2_setup_hw()'s callers are
__init, so it should be too.vgic_v2_hwis written once during init and unmodified thereafter, so make it__ro_after_init. Reposition 'bool enabled' to fit in the tail padding, removing 8 bytes from the structure.No functional change.
Signed-off-by Andrew Cooper <[email protected]>
The patch is good but exactly the same cleanup should be done for new vGICv2's gic_v2_hw_data + vgic_v2_setup_hw() and vGICv3's vgic_v3_hw + vgic_v3_setup_hw(). I can do the follow-up in which case for this patch:
or you can bundle everything in one patch. Let me know.
~Michal
Quoted 43 lines
---
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>Found when looking at the code while reviewing something else. Only compile tested.
--- xen/arch/arm/vgic-v2.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)xen/arch/arm/vgic-v2.c +5
-4@@ -25,7 +25,6 @@#include <asm/vreg.h> static struct { - bool enabled; /* Distributor interface address */ paddr_t dbase; /* CPU interface address & size */@@ -36,10 +35,12 @@ static struct {/* Offset to add to get an 8kB contiguous region if GIC is aliased */ uint32_t aliased_offset; -} vgic_v2_hw; +bool enabled; +} vgic_v2_hw__ro_after_init ; -void vgic_v2_setup_hw (paddr_t dbase,paddr_t cbase,paddr_t csize, -paddr_t vbase,uint32_t aliased_offset) +void __init vgic_v2_setup_hw ( +paddr_t dbase,paddr_t cbase,paddr_t csize,paddr_t vbase, +uint32_t aliased_offset) { vgic_v2_hw.enabled = true; vgic_v2_hw.dbase = dbase;base-commit:
ebc00c30c65023bd1498ae20dc511c4e39f6c0f7