]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/rtas: ensure 4KB alignment for rtas_data_buf
authorNathan Lynch <nathanl@linux.ibm.com>
Fri, 10 Feb 2023 18:41:54 +0000 (12:41 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 15:43:52 +0000 (16:43 +0100)
commitaf26d5d45a0be34e79a92e2f69a2d20356a9e60f
tree23b55de20c113788fe642671882a590576aae84c
parentc6acf8da1321f12da5a1ff72c7a0dd5787dc11f2
powerpc/rtas: ensure 4KB alignment for rtas_data_buf

[ Upstream commit 836b5b9fcc8e09cea7e8a59a070349a00e818308 ]

Some RTAS functions that have work area parameters impose alignment
requirements on the work area passed to them by the OS. Examples
include:

- ibm,configure-connector
- ibm,update-nodes
- ibm,update-properties

4KB is the greatest alignment required by PAPR for such
buffers. rtas_data_buf used to have a __page_aligned attribute in the
arch/ppc64 days, but that was changed to __cacheline_aligned for
unknown reasons by commit dbb3d2cc0533 ("powerpc: Merge rtas.c into
arch/powerpc/kernel"). That works out to 128-byte alignment
on ppc64, which isn't right.

This was found by inspection and I'm not aware of any real problems
caused by this. Either current RTAS implementations don't enforce the
alignment constraints, or rtas_data_buf is always being placed at a
4KB boundary by accident (or both, perhaps).

Use __aligned(SZ_4K) to ensure the rtas_data_buf has alignment
appropriate for all users.

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Fixes: dbb3d2cc0533 ("powerpc: Merge rtas.c into arch/powerpc/kernel")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230125-b4-powerpc-rtas-queue-v3-6-26929c8cce78@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/kernel/rtas.c