Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
43 lines
817 B
C
43 lines
817 B
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* Copyright 2016-17 IBM Corp.
|
|
*/
|
|
#include <asm/ppc-opcode.h>
|
|
#include <asm/reg.h>
|
|
|
|
/*
|
|
* Copy/paste instructions:
|
|
*
|
|
* copy RA,RB
|
|
* Copy contents of address (RA) + effective_address(RB)
|
|
* to internal copy-buffer.
|
|
*
|
|
* paste RA,RB
|
|
* Paste contents of internal copy-buffer to the address
|
|
* (RA) + effective_address(RB)
|
|
*/
|
|
static inline int vas_copy(void *crb, int offset)
|
|
{
|
|
asm volatile(PPC_COPY(%0, %1)";"
|
|
:
|
|
: "b" (offset), "b" (crb)
|
|
: "memory");
|
|
|
|
return 0;
|
|
}
|
|
|
|
static inline int vas_paste(void *paste_address, int offset)
|
|
{
|
|
u32 cr;
|
|
|
|
cr = 0;
|
|
asm volatile(PPC_PASTE(%1, %2)";"
|
|
"mfocrf %0, 0x80;"
|
|
: "=r" (cr)
|
|
: "b" (offset), "b" (paste_address)
|
|
: "memory", "cr0");
|
|
|
|
/* We mask with 0xE to ignore SO */
|
|
return (cr >> CR0_SHIFT) & 0xE;
|
|
}
|