[PATCH v3 00/17] powerpc: Do alignment fixups using analyse_instr etc.

Michael Neuling mikey at neuling.org
Thu Aug 31 10:49:58 AEST 2017


Tested-by: Michael Neuling <mikey at neuling.org>

FWIW I've written a test case for alignment faults (which I'll convert to a
selftest and upstream). It tests all load stores supported by POWER9 (results
below).

VSX: 2.06B
	Doing lxvd2x:	PASSED
	Doing lxvw4x:	PASSED
	Doing lxsdx:	PASSED
	Doing lxvdsx:	PASSED
	Doing stxvd2x:	PASSED
	Doing stxvw4x:	PASSED
	Doing stxsdx:	PASSED
VSX: 2.07B
	Doing lxsspx:	PASSED
	Doing lxsiwax:	PASSED
	Doing lxsiwzx:	PASSED
	Doing stxsspx:	PASSED
	Doing stxsiwx:	PASSED
VSX: 3.00B
	Doing lxsd:	PASSED
	Doing lxsibzx:	PASSED
	Doing lxsihzx:	PASSED
	Doing lxssp:	PASSED
	Doing lxv:	PASSED
	Doing lxvb16x:	PASSED
	Doing lxvh8x:	PASSED
	Doing lxvx:	PASSED
	Doing lxvwsx:	PASSED
	Doing lxvl:	PASSED
	Doing lxvll:	PASSED
	Doing stxsd:	PASSED
	Doing stxsibx:	PASSED
	Doing stxsihx:	PASSED
	Doing stxssp:	PASSED
	Doing stxv:	PASSED
	Doing stxvb16x:	PASSED
	Doing stxvh8x:	PASSED
	Doing stxvx:	PASSED
	Doing stxvl:	PASSED
	Doing stxvll:	PASSED
Integer
	Doing lbz:	PASSED
	Doing lbzu:	PASSED
	Doing lbzx:	PASSED
	Doing lbzux:	PASSED
	Doing lhz:	PASSED
	Doing lhzu:	PASSED
	Doing lhzx:	PASSED
	Doing lhzux:	PASSED
	Doing lha:	PASSED
	Doing lhau:	PASSED
	Doing lhax:	PASSED
	Doing lhaux:	PASSED
	Doing lhbrx:	PASSED
	Doing lwz:	PASSED
	Doing lwzu:	PASSED
	Doing lwzx:	PASSED
	Doing lwzux:	PASSED
	Doing lwa:	PASSED
	Doing lwax:	PASSED
	Doing lwaux:	PASSED
	Doing lwbrx:	PASSED
	Doing ld:	PASSED
	Doing ldu:	PASSED
	Doing ldx:	PASSED
	Doing ldux:	PASSED
	Doing ldbrx:	PASSED
	Doing lmw:	PASSED
	Doing stb:	PASSED
	Doing stbx:	PASSED
	Doing stbu:	PASSED
	Doing stbux:	PASSED
	Doing sth:	PASSED
	Doing sthx:	PASSED
	Doing sthu:	PASSED
	Doing sthux:	PASSED
	Doing sthbrx:	PASSED
	Doing stw:	PASSED
	Doing stwx:	PASSED
	Doing stwu:	PASSED
	Doing stwux:	PASSED
	Doing stwbrx:	PASSED
	Doing std:	PASSED
	Doing stdx:	PASSED
	Doing stdu:	PASSED
	Doing stdux:	PASSED
	Doing stdbrx:	PASSED
	Doing stmw:	PASSED
VMX
	Doing stvx:	PASSED
	Doing stvebx:	PASSED
	Doing stvehx:	PASSED
	Doing stvewx:	PASSED
	Doing stvxl:	PASSED
Floating point
	Doing lfd:	PASSED
	Doing lfdx:	PASSED
	Doing lfdp:	PASSED
	Doing lfdpx:	PASSED
	Doing lfdu:	PASSED
	Doing lfdux:	PASSED
	Doing lfs:	PASSED
	Doing lfsx:	PASSED
	Doing lfsu:	PASSED
	Doing lfsux:	PASSED
	Doing lfiwzx:	PASSED
	Doing lfiwax:	PASSED
	Doing stfd:	PASSED
	Doing stfdx:	PASSED
	Doing stfdp:	PASSED
	Doing stfdpx:	PASSED
	Doing stfdu:	PASSED
	Doing stfdux:	PASSED
	Doing stfs:	PASSED
	Doing stfsx:	PASSED
	Doing stfsu:	PASSED
	Doing stfsux:	PASSED
	Doing stfiwx:	PASSED


On Wed, 2017-08-30 at 14:12 +1000, Paul Mackerras wrote:
> This series extends the instruction emulation infrastructure in
> arch/powerpc/lib/sstep.c and uses it for emulating instructions when
> we get an alignment interrupt.  The advantage of this is that we only
> have to add the new POWER9 instructions in one place, and it fixes
> several bugs in alignment interrupt handling that have been identified
> recently.
> 
> With this, analyse_instr() and emulate_step() handle almost all load
> and store instructions in Power ISA v3.00 -- all except the atomic
> memory operations (lwat, stwat, etc.).  We now always use the largest
> possible aligned memory accesses (up to 8 bytes) to emulate unaligned
> accesses.  If we get a fault, the faulting address is accurately
> recorded in regs->dar.  We also can now access FP/VMX/VSX registers
> directly if they are live, without having to spill them all to the
> thread_struct and the reload them all later.  There are also various
> other fixes in the series.
> 
> This version is based on the current powerpc next branch.
> 
> Paul.
> 
>  arch/powerpc/Kconfig                  |    4 -
>  arch/powerpc/include/asm/ppc-opcode.h |   10 +-
>  arch/powerpc/include/asm/sstep.h      |   90 +-
>  arch/powerpc/kernel/align.c           |  774 +-----------
>  arch/powerpc/lib/Makefile             |    3 +-
>  arch/powerpc/lib/ldstfp.S             |  307 ++---
>  arch/powerpc/lib/quad.S               |   62 +
>  arch/powerpc/lib/sstep.c              | 2139 +++++++++++++++++++++++---------
> -
>  8 files changed, 1802 insertions(+), 1587 deletions(-)
> 


More information about the Linuxppc-dev mailing list