<feed xmlns='http://www.w3.org/2005/Atom'>
<title>pm24.git/arch/powerpc/lib, branch rust-6.10</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>https://git.kobert.dev/pm24.git/atom/arch/powerpc/lib?h=rust-6.10</id>
<link rel='self' href='https://git.kobert.dev/pm24.git/atom/arch/powerpc/lib?h=rust-6.10'/>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/'/>
<updated>2024-03-06T13:13:28Z</updated>
<entry>
<title>powerpc: xor_vmx: Add '-mhard-float' to CFLAGS</title>
<updated>2024-03-06T13:13:28Z</updated>
<author>
<name>Nathan Chancellor</name>
<email>nathan@kernel.org</email>
</author>
<published>2024-01-27T18:07:43Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=35f20786c481d5ced9283ff42de5c69b65e5ed13'/>
<id>urn:sha1:35f20786c481d5ced9283ff42de5c69b65e5ed13</id>
<content type='text'>
arch/powerpc/lib/xor_vmx.o is built with '-msoft-float' (from the main
powerpc Makefile) and '-maltivec' (from its CFLAGS), which causes an
error when building with clang after a recent change in main:

  error: option '-msoft-float' cannot be specified with '-maltivec'
  make[6]: *** [scripts/Makefile.build:243: arch/powerpc/lib/xor_vmx.o] Error 1

Explicitly add '-mhard-float' before '-maltivec' in xor_vmx.o's CFLAGS
to override the previous inclusion of '-msoft-float' (as the last option
wins), which matches how other areas of the kernel use '-maltivec', such
as AMDGPU.

Cc: stable@vger.kernel.org
Closes: https://github.com/ClangBuiltLinux/linux/issues/1986
Link: https://github.com/llvm/llvm-project/commit/4792f912b232141ecba4cbae538873be3c28556c
Signed-off-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://msgid.link/20240127-ppc-xor_vmx-drop-msoft-float-v1-1-f24140e81376@kernel.org

</content>
</entry>
<entry>
<title>powerpc/64s: Move dcbt/dcbtst sequence into a macro</title>
<updated>2024-03-03T12:05:21Z</updated>
<author>
<name>Michael Ellerman</name>
<email>mpe@ellerman.id.au</email>
</author>
<published>2024-02-29T12:25:17Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=8488cdcb00fd5f238754005a43a3a7445860d344'/>
<id>urn:sha1:8488cdcb00fd5f238754005a43a3a7445860d344</id>
<content type='text'>
There's an almost identical code sequence to specify load/store access
hints in __copy_tofrom_user_power7(), copypage_power7() and
memcpy_power7().

Move the sequence into a common macro, which is passed the registers to
use as they differ slightly.

There also needs to be a copy in the selftests, it could be shared in
future if the headers are cleaned up / refactored.

Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://msgid.link/20240229122521.762431-1-mpe@ellerman.id.au

</content>
</entry>
<entry>
<title>powerpc: Use user_mode() macro when possible</title>
<updated>2024-02-22T10:55:33Z</updated>
<author>
<name>Christophe Leroy</name>
<email>christophe.leroy@csgroup.eu</email>
</author>
<published>2024-02-16T10:10:36Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=d5835fb60bad641dbae64fe30c02f10857bf4647'/>
<id>urn:sha1:d5835fb60bad641dbae64fe30c02f10857bf4647</id>
<content type='text'>
There is a nice macro to check user mode.

Use it instead of open coding anding with MSR_PR to increase
readability and avoid having to comment what that anding is for.

Signed-off-by: Christophe Leroy &lt;christophe.leroy@csgroup.eu&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://msgid.link/fbf74887dcf1f1ba9e1680fc3247cbb581b00662.1708078228.git.christophe.leroy@csgroup.eu

</content>
</entry>
<entry>
<title>powerpc/lib: Validate size for vector operations</title>
<updated>2023-11-27T11:06:19Z</updated>
<author>
<name>Naveen N Rao</name>
<email>naveen@kernel.org</email>
</author>
<published>2023-11-23T07:17:05Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=8f9abaa6d7de0a70fc68acaedce290c1f96e2e59'/>
<id>urn:sha1:8f9abaa6d7de0a70fc68acaedce290c1f96e2e59</id>
<content type='text'>
Some of the fp/vmx code in sstep.c assume a certain maximum size for the
instructions being emulated. The size of those operations however is
determined separately in analyse_instr().

Add a check to validate the assumption on the maximum size of the
operations, so as to prevent any unintended kernel stack corruption.

Signed-off-by: Naveen N Rao &lt;naveen@kernel.org&gt;
Reviewed-by: Gustavo A. R. Silva &lt;gustavoars@kernel.org&gt;
Build-tested-by: Gustavo A. R. Silva &lt;gustavoars@kernel.org&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://msgid.link/20231123071705.397625-1-naveen@kernel.org
</content>
</entry>
<entry>
<title>powerpc/lib: Avoid array bounds warnings in vec ops</title>
<updated>2023-11-27T11:05:14Z</updated>
<author>
<name>Michael Ellerman</name>
<email>mpe@ellerman.id.au</email>
</author>
<published>2023-11-20T23:54:36Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=df99da19c6c24ab65052ae1bc0904f99069478d9'/>
<id>urn:sha1:df99da19c6c24ab65052ae1bc0904f99069478d9</id>
<content type='text'>
Building with GCC with -Warray-bounds enabled there are several warnings
in sstep.c along the lines of:

  In function ‘do_byte_reverse’,
      inlined from ‘do_vec_load’ at arch/powerpc/lib/sstep.c:691:3,
      inlined from ‘emulate_loadstore’ at arch/powerpc/lib/sstep.c:3439:9:
  arch/powerpc/lib/sstep.c:289:23: error: array subscript 2 is outside array bounds of ‘u8[16]’ {aka ‘unsigned char[16]’} [-Werror=array-bounds=]
    289 |                 up[2] = byterev_8(up[1]);
        |                 ~~~~~~^~~~~~~~~~~~~~~~~~
  arch/powerpc/lib/sstep.c: In function ‘emulate_loadstore’:
  arch/powerpc/lib/sstep.c:681:11: note: at offset 16 into object ‘u’ of size 16
    681 |         } u = {};
        |           ^

do_byte_reverse() supports a size up to 32 bytes, but in these cases the
caller is only passing a 16 byte buffer. In practice there is no bug,
do_vec_load() is only called from the LOAD_VMX case in emulate_loadstore().
That in turn is only reached when analyse_instr() recognises VMX ops,
and in all cases the size is no greater than 16:

  $ git grep -w LOAD_VMX arch/powerpc/lib/sstep.c
  arch/powerpc/lib/sstep.c:                        op-&gt;type = MKOP(LOAD_VMX, 0, 1);
  arch/powerpc/lib/sstep.c:                        op-&gt;type = MKOP(LOAD_VMX, 0, 2);
  arch/powerpc/lib/sstep.c:                        op-&gt;type = MKOP(LOAD_VMX, 0, 4);
  arch/powerpc/lib/sstep.c:                        op-&gt;type = MKOP(LOAD_VMX, 0, 16);

Similarly for do_vec_store().

Although the warning is incorrect, the code would be safer if it clamped
the size from the caller to the known size of the buffer. Do that using
min_t().

Reported-by: Bagas Sanjaya &lt;bagasdotme@gmail.com&gt;
Closes: https://lore.kernel.org/linuxppc-dev/YpbUcPrm61RLIiZF@debian.me/
Reported-by: Jan-Benedict Glaw &lt;jbglaw@lug-owl.de&gt;
Closes: https://lore.kernel.org/linuxppc-dev/20221212215117.aa7255t7qd6yefk4@lug-owl.de/
Reported-by: "Gustavo A. R. Silva" &lt;gustavo@embeddedor.com&gt;
Closes: https://lore.kernel.org/linuxppc-dev/6a8bf78c-aedb-4d5a-b0aa-82a51a17b884@embeddedor.com/
Reviewed-by: "Gustavo A. R. Silva" &lt;gustavoars@kernel.org&gt;
Build-tested-by: "Gustavo A. R. Silva" &lt;gustavoars@kernel.org&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://msgid.link/20231120235436.1569255-1-mpe@ellerman.id.au

</content>
</entry>
<entry>
<title>powerpc: add crtsavres.o to always-y instead of extra-y</title>
<updated>2023-11-27T11:01:15Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2023-11-20T23:23:32Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=1b1e38002648819c04773647d5242990e2824264'/>
<id>urn:sha1:1b1e38002648819c04773647d5242990e2824264</id>
<content type='text'>
crtsavres.o is linked to modules. However, as explained in commit
d0e628cd817f ("kbuild: doc: clarify the difference between extra-y
and always-y"), 'make modules' does not build extra-y.

For example, the following command fails:

  $ make ARCH=powerpc LLVM=1 KBUILD_MODPOST_WARN=1 mrproper ps3_defconfig modules
    [snip]
    LD [M]  arch/powerpc/platforms/cell/spufs/spufs.ko
  ld.lld: error: cannot open arch/powerpc/lib/crtsavres.o: No such file or directory
  make[3]: *** [scripts/Makefile.modfinal:56: arch/powerpc/platforms/cell/spufs/spufs.ko] Error 1
  make[2]: *** [Makefile:1844: modules] Error 2
  make[1]: *** [/home/masahiro/workspace/linux-kbuild/Makefile:350: __build_one_by_one] Error 2
  make: *** [Makefile:234: __sub-make] Error 2

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Fixes: baa25b571a16 ("powerpc/64: Do not link crtsavres.o in vmlinux")
Reviewed-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://msgid.link/20231120232332.4100288-1-masahiroy@kernel.org

</content>
</entry>
<entry>
<title>powerpc/code-patching: introduce patch_instructions()</title>
<updated>2023-10-23T09:33:19Z</updated>
<author>
<name>Hari Bathini</name>
<email>hbathini@linux.ibm.com</email>
</author>
<published>2023-10-20T14:13:54Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=465cabc97b42405eb89380ea6ba8d8b03e4ae1a2'/>
<id>urn:sha1:465cabc97b42405eb89380ea6ba8d8b03e4ae1a2</id>
<content type='text'>
patch_instruction() entails setting up pte, patching the instruction,
clearing the pte and flushing the tlb. If multiple instructions need
to be patched, every instruction would have to go through the above
drill unnecessarily. Instead, introduce patch_instructions() function
that sets up the pte, clears the pte and flushes the tlb only once
per page range of instructions to be patched. Duplicate most of the
patch_instruction() code instead of merging with it, to avoid the
performance degradation observed on ppc32, for patch_instruction(),
with the code path merged. Also, setup poking_init() always as BPF
expects poking_init() to be setup even when STRICT_KERNEL_RWX is off.

Signed-off-by: Hari Bathini &lt;hbathini@linux.ibm.com&gt;
Acked-by: Song Liu &lt;song@kernel.org&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://msgid.link/20231020141358.643575-2-hbathini@linux.ibm.com

</content>
</entry>
<entry>
<title>powerpc/code-patching: Perform hwsync in __patch_instruction() in case of failure</title>
<updated>2023-10-20T12:19:13Z</updated>
<author>
<name>Christophe Leroy</name>
<email>christophe.leroy@csgroup.eu</email>
</author>
<published>2023-10-07T10:46:19Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=74726fda9fe306f848088ef73ec266cae0470d5b'/>
<id>urn:sha1:74726fda9fe306f848088ef73ec266cae0470d5b</id>
<content type='text'>
Commit c28c15b6d28a ("powerpc/code-patching: Use temporary mm for
Radix MMU") added a hwsync for when __patch_instruction() fails,
we results in a quite odd unbalanced logic.

Instead of calling mb() when __patch_instruction() returns an error,
call mb() in the __patch_instruction()'s error path directly.

Signed-off-by: Christophe Leroy &lt;christophe.leroy@csgroup.eu&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://msgid.link/e88b154eaf2efd9ff177d472d3411dcdec8ff4f5.1696675567.git.christophe.leroy@csgroup.eu

</content>
</entry>
<entry>
<title>powerpc/qspinlock: Rename yield_propagate_owner tunable</title>
<updated>2023-10-20T11:43:34Z</updated>
<author>
<name>Nicholas Piggin</name>
<email>npiggin@gmail.com</email>
</author>
<published>2023-10-16T12:43:05Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=b629b541702b082d161c307c9d7d9867911fc933'/>
<id>urn:sha1:b629b541702b082d161c307c9d7d9867911fc933</id>
<content type='text'>
Rename yield_propagate_owner to yield_sleepy_owner, which better
describes what it does (what, not how).

Signed-off-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
Tested-by: Shrikanth Hegde &lt;sshegde@linux.vnet.ibm.com&gt;
Reviewed-by: "Nysal Jan K.A" &lt;nysal@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://msgid.link/20231016124305.139923-7-npiggin@gmail.com

</content>
</entry>
<entry>
<title>powerpc/qspinlock: Propagate sleepy if previous waiter is preempted</title>
<updated>2023-10-20T11:43:34Z</updated>
<author>
<name>Nicholas Piggin</name>
<email>npiggin@gmail.com</email>
</author>
<published>2023-10-16T12:43:04Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=1e6d5f725738fff83e1c3cbdb8547142eb8820c2'/>
<id>urn:sha1:1e6d5f725738fff83e1c3cbdb8547142eb8820c2</id>
<content type='text'>
The sleepy (aka lock-owner-is-preempted) condition is propagated down
the queue by each waiter. If a waiter becomes preempted, it can no
longer propagate sleepy. To allow subsequent waiters to yield to the
lock owner, also check the lock owner in this case.

Signed-off-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
Tested-by: Shrikanth Hegde &lt;sshegde@linux.vnet.ibm.com&gt;
Reviewed-by: "Nysal Jan K.A" &lt;nysal@linux.ibm.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://msgid.link/20231016124305.139923-6-npiggin@gmail.com

</content>
</entry>
</feed>
