Patch "powerpc/sstep: Fix VSX instruction emulation" has been added to the 5.11-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    powerpc/sstep: Fix VSX instruction emulation

to the 5.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     powerpc-sstep-fix-vsx-instruction-emulation.patch
and it can be found in the queue-5.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 22a7402d7e7b8ac89e752a91505da72ed52d29a1
Author: Jordan Niethe <jniethe5@xxxxxxxxx>
Date:   Thu Feb 25 14:19:46 2021 +1100

    powerpc/sstep: Fix VSX instruction emulation
    
    [ Upstream commit 5c88a17e15795226b56d83f579cbb9b7a4864f79 ]
    
    Commit af99da74333b ("powerpc/sstep: Support VSX vector paired storage
    access instructions") added loading and storing 32 word long data into
    adjacent VSRs. However the calculation used to determine if two VSRs
    needed to be loaded/stored inadvertently prevented the load/storing
    taking place for instructions with a data length less than 16 words.
    
    This causes the emulation to not function correctly, which can be seen
    by the alignment_handler selftest:
    
    $ ./alignment_handler
    [snip]
    test: test_alignment_handler_vsx_207
    tags: git_version:powerpc-5.12-1-0-g82d2c16b350f
    VSX: 2.07B
            Doing lxsspx:   PASSED
            Doing lxsiwax:  FAILED: Wrong Data
            Doing lxsiwzx:  PASSED
            Doing stxsspx:  PASSED
            Doing stxsiwx:  PASSED
    failure: test_alignment_handler_vsx_207
    test: test_alignment_handler_vsx_300
    tags: git_version:powerpc-5.12-1-0-g82d2c16b350f
    VSX: 3.00B
            Doing lxsd:     PASSED
            Doing lxsibzx:  PASSED
            Doing lxsihzx:  PASSED
            Doing lxssp:    FAILED: Wrong Data
            Doing lxv:      PASSED
            Doing lxvb16x:  PASSED
            Doing lxvh8x:   PASSED
            Doing lxvx:     PASSED
            Doing lxvwsx:   FAILED: Wrong Data
            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
    failure: test_alignment_handler_vsx_300
    [snip]
    
    Fix this by making sure all VSX instruction emulation correctly
    load/store from the VSRs.
    
    Fixes: af99da74333b ("powerpc/sstep: Support VSX vector paired storage access instructions")
    Signed-off-by: Jordan Niethe <jniethe5@xxxxxxxxx>
    Reviewed-by: Ravi Bangoria <ravi.bangoria@xxxxxxxxxxxxx>
    Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210225031946.1458206-1-jniethe5@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index bb5c20d4ca91..c6aebc149d14 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -904,7 +904,7 @@ static nokprobe_inline int do_vsx_load(struct instruction_op *op,
 	if (!address_ok(regs, ea, size) || copy_mem_in(mem, ea, size, regs))
 		return -EFAULT;
 
-	nr_vsx_regs = size / sizeof(__vector128);
+	nr_vsx_regs = max(1ul, size / sizeof(__vector128));
 	emulate_vsx_load(op, buf, mem, cross_endian);
 	preempt_disable();
 	if (reg < 32) {
@@ -951,7 +951,7 @@ static nokprobe_inline int do_vsx_store(struct instruction_op *op,
 	if (!address_ok(regs, ea, size))
 		return -EFAULT;
 
-	nr_vsx_regs = size / sizeof(__vector128);
+	nr_vsx_regs = max(1ul, size / sizeof(__vector128));
 	preempt_disable();
 	if (reg < 32) {
 		/* FP regs + extensions */



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux