Russell Currey
e024079440
powerpc/secvar: Handle max object size in the consumer
...
Currently the max object size is handled in the core secvar code with an
entirely OPAL-specific implementation, so create a new max_size() op and
move the existing implementation into the powernv platform. Should be
no functional change.
Signed-off-by: Russell Currey <ruscur@russell.cc >
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com >
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com >
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au >
Link: https://lore.kernel.org/r/20230210080401.345462-9-ajd@linux.ibm.com
2023-02-12 22:12:37 +11:00
Russell Currey
ec2f40bd00
powerpc/secvar: Handle format string in the consumer
...
The code that handles the format string in secvar-sysfs.c is entirely
OPAL specific, so create a new "format" op in secvar_operations to make
the secvar code more generic. No functional change.
Signed-off-by: Russell Currey <ruscur@russell.cc >
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com >
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com >
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au >
Link: https://lore.kernel.org/r/20230210080401.345462-8-ajd@linux.ibm.com
2023-02-12 22:12:37 +11:00
Russell Currey
26149b0202
powerpc/secvar: Warn and error if multiple secvar ops are set
...
The secvar code only supports one consumer at a time.
Multiple consumers aren't possible at this point in time, but we'd want
it to be obvious if it ever could happen.
Signed-off-by: Russell Currey <ruscur@russell.cc >
Co-developed-by: Andrew Donnellan <ajd@linux.ibm.com >
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com >
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au >
Link: https://lore.kernel.org/r/20230210080401.345462-6-ajd@linux.ibm.com
2023-02-12 22:12:36 +11:00
Michael Ellerman
53cea34b0a
powerpc/secvar: Use u64 in secvar_operations
...
There's no reason for secvar_operations to use uint64_t vs the more
common kernel type u64.
The types are compatible, but they require different printk format
strings which can lead to confusion.
Change all the secvar related routines to use u64.
Reviewed-by: Russell Currey <ruscur@russell.cc >
Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com >
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com >
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au >
Link: https://lore.kernel.org/r/20230210080401.345462-5-ajd@linux.ibm.com
2023-02-12 22:12:36 +11:00
Nayna Jain
9155e2341a
powerpc/powernv: Add OPAL API interface to access secure variable
...
The X.509 certificates trusted by the platform and required to secure
boot the OS kernel are wrapped in secure variables, which are
controlled by OPAL.
This patch adds firmware/kernel interface to read and write OPAL
secure variables based on the unique key.
This support can be enabled using CONFIG_OPAL_SECVAR.
Signed-off-by: Claudio Carvalho <cclaudio@linux.ibm.com >
Signed-off-by: Nayna Jain <nayna@linux.ibm.com >
Signed-off-by: Eric Richter <erichte@linux.ibm.com >
[mpe: Make secvar_ops __ro_after_init, only build opal-secvar.c if PPC_SECURE_BOOT=y]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au >
Link: https://lore.kernel.org/r/1573441836-3632-2-git-send-email-nayna@linux.ibm.com
2019-11-13 00:33:22 +11:00