Skip to content

Commit

Permalink
powerpc/powernv: Get L1D flush requirements from device-tree
Browse files Browse the repository at this point in the history
[ Upstream commit 2efee6a ]

The device-tree properties no-need-l1d-flush-msr-pr-1-to-0 and
no-need-l1d-flush-kernel-on-user-access are the equivalents of
H_CPU_BEHAV_NO_L1D_FLUSH_ENTRY and H_CPU_BEHAV_NO_L1D_FLUSH_UACCESS
from the H_GET_CPU_CHARACTERISTICS hcall on pseries respectively.

In commit d02fa40 ("powerpc/powernv: Remove POWER9 PVR version
check for entry and uaccess flushes") the condition for disabling the
L1D flush on kernel entry and user access was changed from any non-P9
CPU to only checking P7 and P8.  Without the appropriate device-tree
checks for newer processors on powernv, these flushes are unnecessarily
enabled on those systems.  This patch corrects this.

Fixes: d02fa40 ("powerpc/powernv: Remove POWER9 PVR version check for entry and uaccess flushes")
Reported-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220404101536.104794-1-ruscur@russell.cc
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
ruscur authored and gregkh committed Jun 9, 2022
1 parent 1de0c52 commit 0ae4398
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/powerpc/platforms/powernv/setup.c
Expand Up @@ -96,6 +96,12 @@ static void __init init_fw_feat_flags(struct device_node *np)

if (fw_feature_is("disabled", "needs-spec-barrier-for-bound-checks", np))
security_ftr_clear(SEC_FTR_BNDS_CHK_SPEC_BAR);

if (fw_feature_is("enabled", "no-need-l1d-flush-msr-pr-1-to-0", np))
security_ftr_clear(SEC_FTR_L1D_FLUSH_ENTRY);

if (fw_feature_is("enabled", "no-need-l1d-flush-kernel-on-user-access", np))
security_ftr_clear(SEC_FTR_L1D_FLUSH_UACCESS);
}

static void __init pnv_setup_security_mitigations(void)
Expand Down

0 comments on commit 0ae4398

Please sign in to comment.