]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.8.5/efivars-allow-disabling-use-as-a-pstore-backend.patch
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 3.8.5 / efivars-allow-disabling-use-as-a-pstore-backend.patch
CommitLineData
40f90573
GKH
1From ed9dc8ce7a1c8115dba9483a9b51df8b63a2e0ef Mon Sep 17 00:00:00 2001
2From: Seth Forshee <seth.forshee@canonical.com>
3Date: Thu, 7 Mar 2013 11:40:17 -0600
4Subject: efivars: Allow disabling use as a pstore backend
5
6From: Seth Forshee <seth.forshee@canonical.com>
7
8commit ed9dc8ce7a1c8115dba9483a9b51df8b63a2e0ef upstream.
9
10Add a new option, CONFIG_EFI_VARS_PSTORE, which can be set to N to
11avoid using efivars as a backend to pstore, as some users may want to
12compile out the code completely.
13
14Set the default to Y to maintain backwards compatability, since this
15feature has always been enabled until now.
16
17Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
18Cc: Josh Boyer <jwboyer@redhat.com>
19Cc: Matthew Garrett <mjg59@srcf.ucam.org>
20Cc: Seiji Aguchi <seiji.aguchi@hds.com>
21Cc: Tony Luck <tony.luck@intel.com>
22Signed-off-by: Matt Fleming <matt.fleming@intel.com>
23Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25---
26 drivers/firmware/Kconfig | 9 ++++++
27 drivers/firmware/efivars.c | 64 ++++++++++++++-------------------------------
28 2 files changed, 29 insertions(+), 44 deletions(-)
29
30--- a/drivers/firmware/Kconfig
31+++ b/drivers/firmware/Kconfig
32@@ -53,6 +53,15 @@ config EFI_VARS
33 Subsequent efibootmgr releases may be found at:
34 <http://linux.dell.com/efibootmgr>
35
36+config EFI_VARS_PSTORE
37+ bool "Register efivars backend for pstore"
38+ depends on EFI_VARS && PSTORE
39+ default y
40+ help
41+ Say Y here to enable use efivars as a backend to pstore. This
42+ will allow writing console messages, crash dumps, or anything
43+ else supported by pstore to EFI variables.
44+
45 config EFI_PCDP
46 bool "Console device selection via EFI PCDP or HCDP table"
47 depends on ACPI && EFI && IA64
48--- a/drivers/firmware/efivars.c
49+++ b/drivers/firmware/efivars.c
50@@ -1301,9 +1301,7 @@ static const struct inode_operations efi
51 .create = efivarfs_create,
52 };
53
54-static struct pstore_info efi_pstore_info;
55-
56-#ifdef CONFIG_PSTORE
57+#ifdef CONFIG_EFI_VARS_PSTORE
58
59 static int efi_pstore_open(struct pstore_info *psi)
60 {
61@@ -1500,38 +1498,6 @@ static int efi_pstore_erase(enum pstore_
62
63 return 0;
64 }
65-#else
66-static int efi_pstore_open(struct pstore_info *psi)
67-{
68- return 0;
69-}
70-
71-static int efi_pstore_close(struct pstore_info *psi)
72-{
73- return 0;
74-}
75-
76-static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, int *count,
77- struct timespec *timespec,
78- char **buf, struct pstore_info *psi)
79-{
80- return -1;
81-}
82-
83-static int efi_pstore_write(enum pstore_type_id type,
84- enum kmsg_dump_reason reason, u64 *id,
85- unsigned int part, int count, size_t size,
86- struct pstore_info *psi)
87-{
88- return 0;
89-}
90-
91-static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count,
92- struct timespec time, struct pstore_info *psi)
93-{
94- return 0;
95-}
96-#endif
97
98 static struct pstore_info efi_pstore_info = {
99 .owner = THIS_MODULE,
100@@ -1543,6 +1509,24 @@ static struct pstore_info efi_pstore_inf
101 .erase = efi_pstore_erase,
102 };
103
104+static void efivar_pstore_register(struct efivars *efivars)
105+{
106+ efivars->efi_pstore_info = efi_pstore_info;
107+ efivars->efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL);
108+ if (efivars->efi_pstore_info.buf) {
109+ efivars->efi_pstore_info.bufsize = 1024;
110+ efivars->efi_pstore_info.data = efivars;
111+ spin_lock_init(&efivars->efi_pstore_info.buf_lock);
112+ pstore_register(&efivars->efi_pstore_info);
113+ }
114+}
115+#else
116+static void efivar_pstore_register(struct efivars *efivars)
117+{
118+ return;
119+}
120+#endif
121+
122 static ssize_t efivar_create(struct file *filp, struct kobject *kobj,
123 struct bin_attribute *bin_attr,
124 char *buf, loff_t pos, size_t count)
125@@ -1942,15 +1926,7 @@ int register_efivars(struct efivars *efi
126 if (error)
127 unregister_efivars(efivars);
128
129- efivars->efi_pstore_info = efi_pstore_info;
130-
131- efivars->efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL);
132- if (efivars->efi_pstore_info.buf) {
133- efivars->efi_pstore_info.bufsize = 1024;
134- efivars->efi_pstore_info.data = efivars;
135- spin_lock_init(&efivars->efi_pstore_info.buf_lock);
136- pstore_register(&efivars->efi_pstore_info);
137- }
138+ efivar_pstore_register(efivars);
139
140 register_filesystem(&efivarfs_type);
141