Skip to contentSkip to conversation

kvm-unit-tests: arm/arm64: strip GIC headers

RFC PATCH In review Andre Przywara 2 participants 2 messages Nov 8, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 kvm-unit-tests: arm/arm64: strip GIC headers

Hi,

this is an illustrative patch which shows what can be removed from the kvm-unit-tests GIC headers. If this patch finds mercy, it should be squashed into the in-flight GIC patches, eventually.
The rationale for this patch is that while it seems like a good idea to copy the header files with the GIC definitions from Linux, we should avoid the danger of copying bugs on the way. This is especially true for those definitions that are used by the very emulation code that we are about to test. Beside this the headers contain much more definitions than we actually need.
So strip those header files, by first removing all definitions that are actually only useful for hypervisors. Also we remove definitions for registers that are not needed yet. The idea is to add them one by one as soon as we start to test functionality, so that review can be much easier and safer.
Applies on top of Drew's v3 GIC series (as in his github branch).

---
 lib/arm/asm/arch_gicv3.h   |  62 -------------
 lib/arm/asm/gic-v2.h       |  22 -----
 lib/arm/asm/gic-v3.h       | 227 ---------------------------------------------
 lib/arm64/asm/arch_gicv3.h |  43 ---------
 4 files changed, 354 deletions(-)
lib/arm/asm/arch_gicv3.h +0 -62
index d529a7e..333bf49 100644
@@ -16,7 +16,6 @@
 
 #define __stringify xstr
 
-
 #define __ACCESS_CP15(CRn, Op1, CRm, Op2)	p15, Op1, %0, CRn, CRm, Op2
 #define __ACCESS_CP15_64(Op1, CRm)		p15, Op1, %Q0, %R0, CRm
 
@@ -31,67 +30,6 @@
 
 #define ICC_HSRE			__ACCESS_CP15(c12, 4, c9, 5)
 
-#define ICH_VSEIR			__ACCESS_CP15(c12, 4, c9, 4)
-#define ICH_HCR				__ACCESS_CP15(c12, 4, c11, 0)
-#define ICH_VTR				__ACCESS_CP15(c12, 4, c11, 1)
-#define ICH_MISR			__ACCESS_CP15(c12, 4, c11, 2)
-#define ICH_EISR			__ACCESS_CP15(c12, 4, c11, 3)
-#define ICH_ELSR			__ACCESS_CP15(c12, 4, c11, 5)
-#define ICH_VMCR			__ACCESS_CP15(c12, 4, c11, 7)
-
-#define __LR0(x)			__ACCESS_CP15(c12, 4, c12, x)
-#define __LR8(x)			__ACCESS_CP15(c12, 4, c13, x)
-
-#define ICH_LR0				__LR0(0)
-#define ICH_LR1				__LR0(1)
-#define ICH_LR2				__LR0(2)
-#define ICH_LR3				__LR0(3)
-#define ICH_LR4				__LR0(4)
-#define ICH_LR5				__LR0(5)
-#define ICH_LR6				__LR0(6)
-#define ICH_LR7				__LR0(7)
-#define ICH_LR8				__LR8(0)
-#define ICH_LR9				__LR8(1)
-#define ICH_LR10			__LR8(2)
-#define ICH_LR11			__LR8(3)
-#define ICH_LR12			__LR8(4)
-#define ICH_LR13			__LR8(5)
-#define ICH_LR14			__LR8(6)
-#define ICH_LR15			__LR8(7)
-
-/* LR top half */
-#define __LRC0(x)			__ACCESS_CP15(c12, 4, c14, x)
-#define __LRC8(x)			__ACCESS_CP15(c12, 4, c15, x)
-
-#define ICH_LRC0			__LRC0(0)
-#define ICH_LRC1			__LRC0(1)
-#define ICH_LRC2			__LRC0(2)
-#define ICH_LRC3			__LRC0(3)
-#define ICH_LRC4			__LRC0(4)
-#define ICH_LRC5			__LRC0(5)
-#define ICH_LRC6			__LRC0(6)
-#define ICH_LRC7			__LRC0(7)
-#define ICH_LRC8			__LRC8(0)
-#define ICH_LRC9			__LRC8(1)
-#define ICH_LRC10			__LRC8(2)
-#define ICH_LRC11			__LRC8(3)
-#define ICH_LRC12			__LRC8(4)
-#define ICH_LRC13			__LRC8(5)
-#define ICH_LRC14			__LRC8(6)
-#define ICH_LRC15			__LRC8(7)
-
-#define __AP0Rx(x)			__ACCESS_CP15(c12, 4, c8, x)
-#define ICH_AP0R0			__AP0Rx(0)
-#define ICH_AP0R1			__AP0Rx(1)
-#define ICH_AP0R2			__AP0Rx(2)
-#define ICH_AP0R3			__AP0Rx(3)
-
-#define __AP1Rx(x)			__ACCESS_CP15(c12, 4, c9, x)
-#define ICH_AP1R0			__AP1Rx(0)
-#define ICH_AP1R1			__AP1Rx(1)
-#define ICH_AP1R2			__AP1Rx(2)
-#define ICH_AP1R3			__AP1Rx(3)
-
 /* Low-level accessors */
 
 static inline void gicv3_write_eoir(u32 irq)
lib/arm/asm/gic-v2.h +0 -22
index 973c2bf..019d553 100644
@@ -10,44 +10,22 @@
 
 #define GIC_CPU_CTRL			0x00
 #define GIC_CPU_PRIMASK			0x04
-#define GIC_CPU_BINPOINT		0x08
 #define GIC_CPU_INTACK			0x0c
 #define GIC_CPU_EOI			0x10
-#define GIC_CPU_RUNNINGPRI		0x14
-#define GIC_CPU_HIGHPRI			0x18
-#define GIC_CPU_ALIAS_BINPOINT		0x1c
-#define GIC_CPU_ACTIVEPRIO		0xd0
-#define GIC_CPU_IDENT			0xfc
-#define GIC_CPU_DEACTIVATE		0x1000
 
 #define GICC_ENABLE			0x1
 #define GICC_INT_PRI_THRESHOLD		0xf0
 
-#define GIC_CPU_CTRL_EOImodeNS		(1 << 9)
-
-#define GICC_IAR_INT_ID_MASK		0x3ff
 #define GICC_INT_SPURIOUS		1023
-#define GICC_DIS_BYPASS_MASK		0x1e0
 
 #define GIC_DIST_CTRL			0x000
-#define GIC_DIST_CTR			0x004
-#define GIC_DIST_IGROUP			0x080
 #define GIC_DIST_ENABLE_SET		0x100
 #define GIC_DIST_ENABLE_CLEAR		0x180
-#define GIC_DIST_PENDING_SET		0x200
-#define GIC_DIST_PENDING_CLEAR		0x280
-#define GIC_DIST_ACTIVE_SET		0x300
 #define GIC_DIST_ACTIVE_CLEAR		0x380
 #define GIC_DIST_PRI			0x400
-#define GIC_DIST_TARGET			0x800
-#define GIC_DIST_CONFIG			0xc00
 #define GIC_DIST_SOFTINT		0xf00
-#define GIC_DIST_SGI_PENDING_CLEAR	0xf10
-#define GIC_DIST_SGI_PENDING_SET	0xf20
 
 #define GICD_ENABLE			0x1
-#define GICD_DISABLE			0x0
-#define GICD_INT_ACTLOW_LVLTRIG		0x0
 #define GICD_INT_EN_CLR_X32		0xffffffff
 #define GICD_INT_EN_SET_SGI		0x0000ffff
 #define GICD_INT_EN_CLR_PPI		0xffff0000
lib/arm/asm/gic-v3.h +0 -227

249 lines not on this page · raw message

lib/arm64/asm/arch_gicv3.h +0 -43

49 lines not on this page · raw message

Signature · 1 line
2.9.0
#1 lore raw
Quoted 17 lines · Andre Przywara

Hi,

this is an illustrative patch which shows what can be removed from the kvm-unit-tests GIC headers. If this patch finds mercy, it should be squashed into the in-flight GIC patches, eventually.
The rationale for this patch is that while it seems like a good idea to copy the header files with the GIC definitions from Linux, we should avoid the danger of copying bugs on the way. This is especially true for those definitions that are used by the very emulation code that we are about to test. Beside this the headers contain much more definitions than we actually need.
So strip those header files, by first removing all definitions that are actually only useful for hypervisors. Also we remove definitions for registers that are not needed yet. The idea is to add them one by one as soon as we start to test functionality, so that review can be much easier and safer.
Applies on top of Drew's v3 GIC series (as in his github branch).

Thanks Andre!

I'll squash this into v4 (which I'll send today or tomorrow)

drew