Skip to content

xen: arm: cleanup traps.c

Ian Campbell xen-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest19 patches 19 repliesIn review
  2. v119 patches 42 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19xen: arm: constify union hsr and struct hsr_* where possible.xen/arch/arm/traps.c+21 -200 replies
2/19xen: arm: Fix handling of ICC_{SGI1R, SGI0R, ASGI1R}_EL1xen/arch/arm/traps.c+2 -20 replies
3/19xen: arm: call inject_undef_exception directlyxen/arch/arm/traps.c+26 -300 replies
4/19xen: arm: provide and use a handle_raz_wi helperxen/arch/arm/traps.c+26 -251 reply
5/19xen: arm: Add and use r/o+raz and w/o+wi helpersxen/arch/arm/traps.c+33 -193 replies
6/19xen: arm: add minimum exception level argument to trap handler helpersxen/arch/arm/traps.c+39 -341 reply
7/19xen: arm: Annotate trap handler for HSR_EL2.{TWI, TWE, TSC}xen/arch/arm/traps.c+17 -01 reply
8/19xen: arm: implement handling of ACTLR_EL1 trapxen/arch/arm/traps.c xen/include/asm-arm/sysregs.h+21 -01 reply
9/19xen: arm: Annotate registers trapped by HCR_EL1.TIDCPxen/arch/arm/traps.c+16 -00 replies
10/19xen: arm: implement handling of registers trapped by CPTR_EL2.TTAxen/arch/arm/traps.c xen/include/asm-arm/perfc_defn.h+45 -11 reply
11/19xen: arm: Annotate handlers for CPTR_EL2.Txxen/arch/arm/traps.c+21 -21 reply
12/19xen: arm: Annotate the handlers for HSTR_EL2.T15xen/arch/arm/traps.c+10 -03 replies
13/19xen: arm: Annotate registers trapped by MDCR_EL2.TDRAxen/arch/arm/traps.c xen/include/asm-arm/cpregs.h xen/include/asm-arm/sysregs.h+33 -01 reply
14/19xen: arm: Annotate registers trapped by MDCR_EL2.TDOSAxen/arch/arm/traps.c xen/include/asm-arm/cpregs.h xen/include/asm-arm/sysregs.h+45 -101 reply
15/19xen: arm: Annotate registers trapped by MDCR_EL2.TDAxen/arch/arm/traps.c+49 -111 reply
16/19xen: arm: Annotate registers trapped by MDCR_EL2.TPM and TPMCRxen/arch/arm/traps.c+34 -51 reply
17/19xen: arm: Remove CNTPCT_EL0 trap handling.xen/arch/arm/traps.c xen/arch/arm/vtimer.c+0 -310 replies
18/19xen: arm: Annotate registers trapped when CNTHCTL_EL2.EL1PCEN == 0xen/arch/arm/traps.c+18 -01 reply
19/19xen: arm: Annotate source of ICC SGI register trappingxen/arch/arm/traps.c+6 -00 replies

Reviews trailers per patch

18 of 19 patches have a Reviewed-by or Acked-by.

PatchJulien Grall
1/19R-b
2/19R-b
3/19R-b
4/19R-b
5/19R-b
6/19R-b
7/19R-b
8/19R-b
9/19R-b
10/19R-b
11/19R-b
12/19R-b
13/19R-b
14/19R-b
15/19R-b
16/19
17/19R-b
18/19R-b
19/19R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/19] xen: arm: cleanup traps.c

While working on reenabling 32-bit user space on arm63 I concluded that the trap handling in traps.c had grown into a twisty confusing mess. Lets try and sort that out.

This series contains two halves (after a couple of preparatory cleanups).

First clean up the goto maze which we've found ourselves in, by providing a selection of handle_* helpers e.g. for raz/ro etc and by calling those and the existing inject_* helpers directly instead of trying to have only one call to each of the latter by using goto. The handle_* helpers can also deal with the minimum allowable exception level, which simplifies things further.

To keep things simpler I've used "return handle_..." when the caller and callee both return void, since that avoids the need for 3 more lines (2 braces and the return), I think this improves clarity.

Second go through init_traps and for each bit there consolidate the handling for each type of trap (e.g. do_cp15_32, do_cp15_64, do_sysreg etc) such that all the registers whose traps are associated with that bit are kept together beneath a comment which documents why those bits are trapped, references the appropriate section of the ARMv7 and ARMv8 ARM (the v8 one in particular has a series of very useful tables per bit) and notes which registers are not explicitly handled (and therefore take the default case).

For traps which have no explicit handling (i.e. those which trap implementation defined registers) and which always hit the default case add the comment above that instead.

Do the same for the GICv3 ICC traps and timer traps.

There is probably scope for doing more, i.e. refactoring related functionality into subsystem helpers (like we do for vtimer) and even moving into separate files, but I think this is a good start.

This is a lot of patches, sorry, because I wanted to mostly go through the trap bits one at a time per patch to keep each one manageable, although I did end up compressing some of the more obvious ones.

Since last time I've addressed all (I hope!) of Julien's comments.

(R)eviewed

R xen: arm: constify union hsr and struct hsr_* where possible.
R xen: arm: Fix handling of ICC_{SGI1R,SGI0R,ASGI1R}_EL1
R xen: arm: call inject_undef_exception directly
M xen: arm: provide and use a handle_raz_wi helper
M xen: arm: Add and use r/o+raz and w/o+wi helpers
M xen: arm: add minimum exception level argument to trap handler helpers
M xen: arm: Annotate trap handler for HSR_EL2.{TWI,TWE,TSC}
M xen: arm: implement handling of ACTLR_EL1 trap
RM xen: arm: Annotate registers trapped by HCR_EL1.TIDCP
M xen: arm: implement handling of registers trapped by CPTR_EL2.TTA
M xen: arm: Annotate handlers for CPTR_EL2.Tx
M xen: arm: Annotate the handlers for HSTR_EL2.T15
M xen: arm: Annotate registers trapped by MDCR_EL2.TDRA
M xen: arm: Annotate registers trapped by MDCR_EL2.TDOSA
xen: arm: Annotate registers trapped by MDCR_EL2.TDA
xen: arm: Annotate registers trapped by MDCR_EL2.TPM and TPMCR
R xen: arm: Remove CNTPCT_EL0 trap handling.

	xen: arm: Annotate registers trapped when CNTHCTL_EL2.EL1PCEN == 0

R xen: arm: Annotate source of ICC SGI register trapping

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel