powerpc/powernv: Query firmware for count cache flush settings
authorMichael Ellerman <mpe@ellerman.id.au>
Thu, 11 Apr 2019 11:46:17 +0000 (21:46 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Apr 2019 06:36:42 +0000 (08:36 +0200)
commit 99d54754d3d5f896a8f616b0b6520662bc99d66b upstream.

Look for fw-features properties to determine the appropriate settings
for the count cache flush, and then call the generic powerpc code to
set it up based on the security feature flags.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/platforms/powernv/setup.c

index 17203ab..365e2b6 100644 (file)
@@ -77,6 +77,12 @@ static void init_fw_feat_flags(struct device_node *np)
        if (fw_feature_is("enabled", "fw-count-cache-disabled", np))
                security_ftr_set(SEC_FTR_COUNT_CACHE_DISABLED);
 
+       if (fw_feature_is("enabled", "fw-count-cache-flush-bcctr2,0,0", np))
+               security_ftr_set(SEC_FTR_BCCTR_FLUSH_ASSIST);
+
+       if (fw_feature_is("enabled", "needs-count-cache-flush-on-context-switch", np))
+               security_ftr_set(SEC_FTR_FLUSH_COUNT_CACHE);
+
        /*
         * The features below are enabled by default, so we instead look to see
         * if firmware has *disabled* them, and clear them if so.
@@ -123,6 +129,7 @@ static void pnv_setup_rfi_flush(void)
                  security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV));
 
        setup_rfi_flush(type, enable);
+       setup_count_cache_flush();
 }
 
 static void __init pnv_setup_arch(void)