Hi all, As PowerNV moves towards secure boot, we need a place to put secure variables. One option that has been canvassed is to make our secure variables look like EFI variables. This is an early sketch of another approach where we create a generic firmware variable file system, fwvarfs, and an OPAL Secure Variable backend for it. In short, platforms provide a simple backend that can interface with the hardware, and fwvarfs deals with translating that into a filesystem that you can use. Almost all of the hard work is done by kernfs: fwvarfs provides a pretty thin layer on top of that to make backends a simple as possible. Behaviour and the API is documented in Documentation/filesystems/fwvarfs.txt To demonstrate the concept, a fully functional memory-based backend is provided, and a read-only but userspace-compatible EFI backend. For OPAL secure variables, I have taken Claudio's commit, tweaked it to apply to linux-next, replaced all the EFI support with a generic API, and then written a backend against that. There's a coming version from Claudio that moves the opal calls towards a simple key/value interface rather than (name, vendor) pairs - I haven't waited for that: this is really just to demonstrate that it could be done rather than an attempt to get mergable code. It is also compile tested only as I haven't yet set myself up with a test machine. The patches are a bit rough, and there are a number of outstanding TODOs sprinkled in everywhere. The idea is just to do a proof of concept to inform our discussions: - Is this the sort of approach you'd like (generic vs specific)? - Does the backend API make sense? - Is the use of kernfs the correct decision, or is it potentially too limiting? (e.g. no ability to do case-insensitivity like efivarfs) - Is assuming flat fwvars correct or is there a firmware with a hierarchical structure? Regards, Daniel Claudio Carvalho (1): powerpc/powernv: Add support for OPAL secure variables Daniel Axtens (5): kernfs: add create() and unlink() hooks fwvarfs: a generic firmware variable filesystem fwvarfs: efi backend powerpc/powernv: Remove EFI support for OPAL secure variables fwvarfs: Add opal_secvar backend Documentation/filesystems/fwvarfs.txt | 154 ++++++++++ arch/powerpc/include/asm/opal-api.h | 6 +- arch/powerpc/include/asm/opal-secvar.h | 58 ++++ arch/powerpc/include/asm/opal.h | 10 + arch/powerpc/platforms/powernv/Kconfig | 8 + arch/powerpc/platforms/powernv/Makefile | 1 + arch/powerpc/platforms/powernv/opal-call.c | 4 + arch/powerpc/platforms/powernv/opal-secvar.c | 121 ++++++++ fs/Kconfig | 1 + fs/Makefile | 1 + fs/fwvarfs/Kconfig | 47 +++ fs/fwvarfs/Makefile | 10 + fs/fwvarfs/efi.c | 177 +++++++++++ fs/fwvarfs/fwvarfs.c | 294 +++++++++++++++++++ fs/fwvarfs/fwvarfs.h | 124 ++++++++ fs/fwvarfs/mem.c | 113 +++++++ fs/fwvarfs/opal_secvar.c | 218 ++++++++++++++ fs/kernfs/dir.c | 54 ++++ include/linux/kernfs.h | 3 + include/uapi/linux/magic.h | 1 + 20 files changed, 1404 insertions(+), 1 deletion(-) create mode 100644 Documentation/filesystems/fwvarfs.txt create mode 100644 arch/powerpc/include/asm/opal-secvar.h create mode 100644 arch/powerpc/platforms/powernv/opal-secvar.c create mode 100644 fs/fwvarfs/Kconfig create mode 100644 fs/fwvarfs/Makefile create mode 100644 fs/fwvarfs/efi.c create mode 100644 fs/fwvarfs/fwvarfs.c create mode 100644 fs/fwvarfs/fwvarfs.h create mode 100644 fs/fwvarfs/mem.c create mode 100644 fs/fwvarfs/opal_secvar.c -- 2.19.1