mirror of https://gitee.com/openkylin/linux.git
powerpc/book3s64/pkeys: Simplify pkey disable branch
Make the default value FALSE (pkey enabled) and set to TRUE when we find the total number of keys supported to be zero. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200709032946.881753-10-aneesh.kumar@linux.ibm.com
This commit is contained in:
parent
a24204c307
commit
a4678d4b47
|
@ -11,7 +11,7 @@
|
||||||
#include <linux/jump_label.h>
|
#include <linux/jump_label.h>
|
||||||
#include <asm/firmware.h>
|
#include <asm/firmware.h>
|
||||||
|
|
||||||
DECLARE_STATIC_KEY_TRUE(pkey_disabled);
|
DECLARE_STATIC_KEY_FALSE(pkey_disabled);
|
||||||
extern int pkeys_total; /* total pkeys as per device tree */
|
extern int pkeys_total; /* total pkeys as per device tree */
|
||||||
extern u32 initial_allocation_mask; /* bits set for the initially allocated keys */
|
extern u32 initial_allocation_mask; /* bits set for the initially allocated keys */
|
||||||
extern u32 reserved_allocation_mask; /* bits set for reserved keys */
|
extern u32 reserved_allocation_mask; /* bits set for reserved keys */
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <linux/pkeys.h>
|
#include <linux/pkeys.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
|
|
||||||
DEFINE_STATIC_KEY_TRUE(pkey_disabled);
|
DEFINE_STATIC_KEY_FALSE(pkey_disabled);
|
||||||
int pkeys_total; /* Total pkeys as per device tree */
|
int pkeys_total; /* Total pkeys as per device tree */
|
||||||
u32 initial_allocation_mask; /* Bits set for the initially allocated keys */
|
u32 initial_allocation_mask; /* Bits set for the initially allocated keys */
|
||||||
/*
|
/*
|
||||||
|
@ -113,9 +113,8 @@ static int pkey_initialize(void)
|
||||||
|
|
||||||
/* scan the device tree for pkey feature */
|
/* scan the device tree for pkey feature */
|
||||||
pkeys_total = scan_pkey_feature();
|
pkeys_total = scan_pkey_feature();
|
||||||
if (pkeys_total)
|
if (!pkeys_total) {
|
||||||
static_branch_disable(&pkey_disabled);
|
/* No support for pkey. Mark it disabled */
|
||||||
else {
|
|
||||||
static_branch_enable(&pkey_disabled);
|
static_branch_enable(&pkey_disabled);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue