kup.h (715a1284d89a740b197b3bad5eb20d36a397382f) kup.h (7613f5a66becfd0e43a0f34de8518695888f5458)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_POWERPC_BOOK3S_64_KUP_H
3#define _ASM_POWERPC_BOOK3S_64_KUP_H
4
5#include <linux/const.h>
6#include <asm/reg.h>
7
8#define AMR_KUAP_BLOCK_READ UL(0x5455555555555555)

--- 319 unchanged lines hidden (view full) ---

328 /*
329 * We return AMR_KUAP_BLOCKED when we don't support KUAP because
330 * prevent_user_access_return needs to return AMR_KUAP_BLOCKED to
331 * cause restore_user_access to do a flush.
332 *
333 * This has no effect in terms of actually blocking things on hash,
334 * so it doesn't break anything.
335 */
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_POWERPC_BOOK3S_64_KUP_H
3#define _ASM_POWERPC_BOOK3S_64_KUP_H
4
5#include <linux/const.h>
6#include <asm/reg.h>
7
8#define AMR_KUAP_BLOCK_READ UL(0x5455555555555555)

--- 319 unchanged lines hidden (view full) ---

328 /*
329 * We return AMR_KUAP_BLOCKED when we don't support KUAP because
330 * prevent_user_access_return needs to return AMR_KUAP_BLOCKED to
331 * cause restore_user_access to do a flush.
332 *
333 * This has no effect in terms of actually blocking things on hash,
334 * so it doesn't break anything.
335 */
336 if (!early_mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
336 if (!mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
337 return AMR_KUAP_BLOCKED;
338
339 return mfspr(SPRN_AMR);
340}
341
342static inline void set_kuap(unsigned long value)
343{
337 return AMR_KUAP_BLOCKED;
338
339 return mfspr(SPRN_AMR);
340}
341
342static inline void set_kuap(unsigned long value)
343{
344 if (!early_mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
344 if (!mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
345 return;
346
347 /*
348 * ISA v3.0B says we need a CSI (Context Synchronising Instruction) both
349 * before and after the move to AMR. See table 6 on page 1134.
350 */
351 isync();
352 mtspr(SPRN_AMR, value);

--- 90 unchanged lines hidden ---
345 return;
346
347 /*
348 * ISA v3.0B says we need a CSI (Context Synchronising Instruction) both
349 * before and after the move to AMR. See table 6 on page 1134.
350 */
351 isync();
352 mtspr(SPRN_AMR, value);

--- 90 unchanged lines hidden ---