All of lore.kernel.org
 help / color / mirror / Atom feed
From: gjoyce@linux.vnet.ibm.com
To: linux-block@vger.kernel.org
Cc: keyrings@vger.kernel.org, dhowells@redhat.com, jarkko@kernel.org,
	jonathan.derrick@linux.dev, brking@linux.vnet.ibm.com,
	greg@gilhooley.com, gjoyce@ibm.com
Subject: [PATCH 4/4] arch_vars: create arch specific permanent store
Date: Mon, 18 Jul 2022 16:01:56 -0500	[thread overview]
Message-ID: <20220718210156.1535955-5-gjoyce@linux.vnet.ibm.com> (raw)
In-Reply-To: <20220718210156.1535955-1-gjoyce@linux.vnet.ibm.com>

From: Greg Joyce <gjoyce@linux.vnet.ibm.com>

Platforms that have a permanent key store may provide unique
platform dependent functions to read/write variables. The
default (weak) functions return -EOPNOTSUPP unless overridden
by architecture/platform versions.

Signed-off-by: Greg Joyce <gjoyce@linux.vnet.ibm.com>
---
 include/linux/arch_vars.h | 23 +++++++++++++++++++++++
 lib/Makefile              |  2 +-
 lib/arch_vars.c           | 25 +++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 include/linux/arch_vars.h
 create mode 100644 lib/arch_vars.c

diff --git a/include/linux/arch_vars.h b/include/linux/arch_vars.h
new file mode 100644
index 000000000000..9c280ff9432e
--- /dev/null
+++ b/include/linux/arch_vars.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Platform variable opearations.
+ *
+ * Copyright (C) 2022 IBM Corporation
+ *
+ * These are the accessor functions (read/write) for architecture specific
+ * variables. Specific architectures can provide overrides.
+ *
+ */
+
+#include <linux/kernel.h>
+
+enum arch_variable_type {
+	ARCH_VAR_OPAL_KEY      = 0,     /* SED Opal Authentication Key */
+	ARCH_VAR_OTHER         = 1,     /* Other type of variable */
+	ARCH_VAR_MAX           = 1,     /* Maximum type value */
+};
+
+int arch_read_variable(enum arch_variable_type type, char *varname,
+		       void *varbuf, u_int *varlen);
+int arch_write_variable(enum arch_variable_type type, char *varname,
+			void *varbuf, u_int varlen);
diff --git a/lib/Makefile b/lib/Makefile
index f99bf61f8bbc..b90c4cb0dbbb 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -48,7 +48,7 @@ obj-y += bcd.o sort.o parser.o debug_locks.o random32.o \
 	 bsearch.o find_bit.o llist.o memweight.o kfifo.o \
 	 percpu-refcount.o rhashtable.o \
 	 once.o refcount.o usercopy.o errseq.o bucket_locks.o \
-	 generic-radix-tree.o
+	 generic-radix-tree.o arch_vars.o
 obj-$(CONFIG_STRING_SELFTEST) += test_string.o
 obj-y += string_helpers.o
 obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
diff --git a/lib/arch_vars.c b/lib/arch_vars.c
new file mode 100644
index 000000000000..e6f16d7d09c1
--- /dev/null
+++ b/lib/arch_vars.c
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Platform variable operations.
+ *
+ * Copyright (C) 2022 IBM Corporation
+ *
+ * These are the accessor functions (read/write) for architecture specific
+ * variables. Specific architectures can provide overrides.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/arch_vars.h>
+
+int __weak arch_read_variable(enum arch_variable_type type, char *varname,
+			      void *varbuf, u_int *varlen)
+{
+	return -EOPNOTSUPP;
+}
+
+int __weak arch_write_variable(enum arch_variable_type type, char *varname,
+			       void *varbuf, u_int varlen)
+{
+	return -EOPNOTSUPP;
+}
-- 
2.27.0


  parent reply	other threads:[~2022-07-18 21:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18 21:01 [PATCH 0/4] sed-opal: keyrings, discovery, revert and key store gjoyce
2022-07-18 21:01 ` [PATCH 1/4] block: sed-opal: Implement IOC_OPAL_DISCOVERY gjoyce
2022-07-20  7:42   ` Christoph Hellwig
2022-07-18 21:01 ` [PATCH 2/4] block: sed-opal: Implement IOC_OPAL_REVERT_LSP gjoyce
2022-07-20  7:44   ` Christoph Hellwig
2022-07-18 21:01 ` [PATCH 3/4] block: sed-opal: keyring support for SED Opal keys gjoyce
2022-07-19  6:49   ` Hannes Reinecke
2022-07-20  7:49   ` Christoph Hellwig
2022-07-18 21:01 ` gjoyce [this message]
2022-07-20  7:50   ` [PATCH 4/4] arch_vars: create arch specific permanent store Christoph Hellwig
2022-07-26 18:53     ` Greg Joyce
2022-07-28  7:43 ` [PATCH 0/4] sed-opal: keyrings, discovery, revert and key store Jarkko Sakkinen
  -- strict thread matches above, loose matches on Subject: below --
2022-07-06  2:39 gjoyce
2022-07-06  2:39 ` [PATCH 4/4] arch_vars: create arch specific permanent store gjoyce
2022-07-06  8:11   ` Christoph Hellwig
2022-07-06 14:28     ` Greg Joyce
2022-07-06 17:10   ` kernel test robot
2022-07-08  2:35   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220718210156.1535955-5-gjoyce@linux.vnet.ibm.com \
    --to=gjoyce@linux.vnet.ibm.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=dhowells@redhat.com \
    --cc=gjoyce@ibm.com \
    --cc=greg@gilhooley.com \
    --cc=jarkko@kernel.org \
    --cc=jonathan.derrick@linux.dev \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.