Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

efivars: Allow disabling use as a pstore backend

Add a new option, CONFIG_EFI_VARS_PSTORE, which can be set to N to
avoid using efivars as a backend to pstore, as some users may want to
compile out the code completely.

Set the default to Y to maintain backwards compatability, since this
feature has always been enabled until now.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Cc: Josh Boyer <jwboyer@redhat.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Seiji Aguchi <seiji.aguchi@hds.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>

authored by

Seth Forshee and committed by
Matt Fleming
ed9dc8ce f6161aa1

+29 -44
+9
drivers/firmware/Kconfig
··· 53 53 Subsequent efibootmgr releases may be found at: 54 54 <http://linux.dell.com/efibootmgr> 55 55 56 + config EFI_VARS_PSTORE 57 + bool "Register efivars backend for pstore" 58 + depends on EFI_VARS && PSTORE 59 + default y 60 + help 61 + Say Y here to enable use efivars as a backend to pstore. This 62 + will allow writing console messages, crash dumps, or anything 63 + else supported by pstore to EFI variables. 64 + 56 65 config EFI_PCDP 57 66 bool "Console device selection via EFI PCDP or HCDP table" 58 67 depends on ACPI && EFI && IA64
+20 -44
drivers/firmware/efivars.c
··· 1309 1309 .create = efivarfs_create, 1310 1310 }; 1311 1311 1312 - static struct pstore_info efi_pstore_info; 1313 - 1314 - #ifdef CONFIG_PSTORE 1312 + #ifdef CONFIG_EFI_VARS_PSTORE 1315 1313 1316 1314 static int efi_pstore_open(struct pstore_info *psi) 1317 1315 { ··· 1512 1514 1513 1515 return 0; 1514 1516 } 1515 - #else 1516 - static int efi_pstore_open(struct pstore_info *psi) 1517 - { 1518 - return 0; 1519 - } 1520 - 1521 - static int efi_pstore_close(struct pstore_info *psi) 1522 - { 1523 - return 0; 1524 - } 1525 - 1526 - static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, int *count, 1527 - struct timespec *timespec, 1528 - char **buf, struct pstore_info *psi) 1529 - { 1530 - return -1; 1531 - } 1532 - 1533 - static int efi_pstore_write(enum pstore_type_id type, 1534 - enum kmsg_dump_reason reason, u64 *id, 1535 - unsigned int part, int count, size_t size, 1536 - struct pstore_info *psi) 1537 - { 1538 - return 0; 1539 - } 1540 - 1541 - static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, 1542 - struct timespec time, struct pstore_info *psi) 1543 - { 1544 - return 0; 1545 - } 1546 - #endif 1547 1517 1548 1518 static struct pstore_info efi_pstore_info = { 1549 1519 .owner = THIS_MODULE, ··· 1522 1556 .write = efi_pstore_write, 1523 1557 .erase = efi_pstore_erase, 1524 1558 }; 1559 + 1560 + static void efivar_pstore_register(struct efivars *efivars) 1561 + { 1562 + efivars->efi_pstore_info = efi_pstore_info; 1563 + efivars->efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL); 1564 + if (efivars->efi_pstore_info.buf) { 1565 + efivars->efi_pstore_info.bufsize = 1024; 1566 + efivars->efi_pstore_info.data = efivars; 1567 + spin_lock_init(&efivars->efi_pstore_info.buf_lock); 1568 + pstore_register(&efivars->efi_pstore_info); 1569 + } 1570 + } 1571 + #else 1572 + static void efivar_pstore_register(struct efivars *efivars) 1573 + { 1574 + return; 1575 + } 1576 + #endif 1525 1577 1526 1578 static ssize_t efivar_create(struct file *filp, struct kobject *kobj, 1527 1579 struct bin_attribute *bin_attr, ··· 2009 2025 if (error) 2010 2026 unregister_efivars(efivars); 2011 2027 2012 - efivars->efi_pstore_info = efi_pstore_info; 2013 - 2014 - efivars->efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL); 2015 - if (efivars->efi_pstore_info.buf) { 2016 - efivars->efi_pstore_info.bufsize = 1024; 2017 - efivars->efi_pstore_info.data = efivars; 2018 - spin_lock_init(&efivars->efi_pstore_info.buf_lock); 2019 - pstore_register(&efivars->efi_pstore_info); 2020 - } 2028 + efivar_pstore_register(efivars); 2021 2029 2022 2030 register_filesystem(&efivarfs_type); 2023 2031