Skip to content

Commit 447eb1d

Browse files
ssrish17maddy-kerneldev
authored andcommitted
pseries/plpks: expose PowerVM wrapping features via the sysfs
Starting with Power11, PowerVM supports a new feature called "Key Wrapping" that protects user secrets by wrapping them using a hypervisor generated wrapping key. The status of this feature can be read by the H_PKS_GET_CONFIG HCALL. Expose the Power LPAR Platform KeyStore (PLPKS) wrapping features config via the sysfs file /sys/firmware/plpks/config/wrapping_features. Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com> Tested-by: Nayna Jain <nayna@linux.ibm.com> Reviewed-by: Nayna Jain <nayna@linux.ibm.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20260127145228.48320-4-ssrish@linux.ibm.com
1 parent 40850c9 commit 447eb1d

5 files changed

Lines changed: 36 additions & 1 deletion

File tree

Documentation/ABI/testing/sysfs-firmware-plpks

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,11 @@ Description: Bitmask of flags indicating which algorithms the hypervisor
4848
supports for signed update of objects, represented as a 16 byte
4949
hexadecimal ASCII string. Consult the hypervisor documentation
5050
for what these flags mean.
51+
52+
What: /sys/firmware/plpks/config/wrapping_features
53+
Date: November 2025
54+
Contact: Srish Srinivasan <ssrish@linux.ibm.com>
55+
Description: Bitmask of the wrapping features indicating the wrapping
56+
algorithms that are supported for the H_PKS_WRAP_OBJECT requests
57+
, represented as a 8 byte hexadecimal ASCII string. Consult the
58+
hypervisor documentation for what these flags mean.

arch/powerpc/include/asm/hvcall.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,9 @@
360360
#define H_GUEST_RUN_VCPU 0x480
361361
#define H_GUEST_COPY_MEMORY 0x484
362362
#define H_GUEST_DELETE 0x488
363-
#define MAX_HCALL_OPCODE H_GUEST_DELETE
363+
#define H_PKS_WRAP_OBJECT 0x490
364+
#define H_PKS_UNWRAP_OBJECT 0x494
365+
#define MAX_HCALL_OPCODE H_PKS_UNWRAP_OBJECT
364366

365367
/* Scope args for H_SCM_UNBIND_ALL */
366368
#define H_UNBIND_SCOPE_ALL (0x1)

arch/powerpc/include/asm/plpks.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#define PLPKS_IMMUTABLE PPC_BIT32(5) // Once written, object cannot be removed
2424
#define PLPKS_TRANSIENT PPC_BIT32(6) // Object does not persist through reboot
2525
#define PLPKS_SIGNEDUPDATE PPC_BIT32(7) // Object can only be modified by signed updates
26+
#define PLPKS_WRAPPINGKEY PPC_BIT32(8) // Object contains a wrapping key
2627
#define PLPKS_HVPROVISIONED PPC_BIT32(28) // Hypervisor has provisioned this object
2728

2829
// Signature algorithm flags from signed_update_algorithms
@@ -103,6 +104,8 @@ u32 plpks_get_maxlargeobjectsize(void);
103104

104105
u64 plpks_get_signedupdatealgorithms(void);
105106

107+
u64 plpks_get_wrappingfeatures(void);
108+
106109
u16 plpks_get_passwordlen(void);
107110

108111
void plpks_early_init_devtree(void);

arch/powerpc/platforms/pseries/plpks-sysfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ PLPKS_CONFIG_ATTR(used_space, "%u\n", plpks_get_usedspace);
3030
PLPKS_CONFIG_ATTR(supported_policies, "%08x\n", plpks_get_supportedpolicies);
3131
PLPKS_CONFIG_ATTR(signed_update_algorithms, "%016llx\n",
3232
plpks_get_signedupdatealgorithms);
33+
PLPKS_CONFIG_ATTR(wrapping_features, "%016llx\n", plpks_get_wrappingfeatures);
3334

3435
static const struct attribute *config_attrs[] = {
3536
&attr_version.attr,
@@ -38,6 +39,7 @@ static const struct attribute *config_attrs[] = {
3839
&attr_used_space.attr,
3940
&attr_supported_policies.attr,
4041
&attr_signed_update_algorithms.attr,
42+
&attr_wrapping_features.attr,
4143
NULL,
4244
};
4345

arch/powerpc/platforms/pseries/plpks.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static u32 usedspace;
3838
static u32 supportedpolicies;
3939
static u32 maxlargeobjectsize;
4040
static u64 signedupdatealgorithms;
41+
static u64 wrappingfeatures;
4142

4243
struct plpks_auth {
4344
u8 version;
@@ -248,6 +249,7 @@ static int _plpks_get_config(void)
248249
__be32 supportedpolicies;
249250
__be32 maxlargeobjectsize;
250251
__be64 signedupdatealgorithms;
252+
__be64 wrappingfeatures;
251253
u8 rsvd1[476];
252254
} __packed * config;
253255
size_t size;
@@ -280,6 +282,7 @@ static int _plpks_get_config(void)
280282
supportedpolicies = be32_to_cpu(config->supportedpolicies);
281283
maxlargeobjectsize = be32_to_cpu(config->maxlargeobjectsize);
282284
signedupdatealgorithms = be64_to_cpu(config->signedupdatealgorithms);
285+
wrappingfeatures = be64_to_cpu(config->wrappingfeatures);
283286

284287
// Validate that the numbers we get back match the requirements of the spec
285288
if (maxpwsize < 32) {
@@ -472,6 +475,23 @@ u64 plpks_get_signedupdatealgorithms(void)
472475
return signedupdatealgorithms;
473476
}
474477

478+
/**
479+
* plpks_get_wrappingfeatures() - Returns a bitmask of the wrapping features
480+
* supported by the hypervisor.
481+
*
482+
* Successful execution of the H_PKS_GET_CONFIG HCALL during initialization
483+
* reads a bitmask of the wrapping features supported by the hypervisor into the
484+
* file local static wrappingfeatures variable. This is valid only when the
485+
* PLPKS config structure version >= 3.
486+
*
487+
* Return:
488+
* bitmask of the wrapping features supported by the hypervisor
489+
*/
490+
u64 plpks_get_wrappingfeatures(void)
491+
{
492+
return wrappingfeatures;
493+
}
494+
475495
/**
476496
* plpks_get_passwordlen() - Get the length of the PLPKS password in bytes.
477497
*

0 commit comments

Comments
 (0)