<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/firmware, branch v3.4.96</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers/firmware?h=v3.4.96</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers/firmware?h=v3.4.96'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2014-06-07T23:02:10Z</updated>
<entry>
<title>x86, efivars: firmware bug workarounds should be in platform code</title>
<updated>2014-06-07T23:02:10Z</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2013-03-25T09:14:30Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=0b94d72798ba9f2e93891033107af49486650c22'/>
<id>urn:sha1:0b94d72798ba9f2e93891033107af49486650c22</id>
<content type='text'>
commit a6e4d5a03e9e3587e88aba687d8f225f4f04c792 upstream.

Let's not burden ia64 with checks in the common efivars code that we're not
writing too much data to the variable store. That kind of thing is an x86
firmware bug, plain and simple.

efi_query_variable_store() provides platforms with a wrapper in which they can
perform checks and workarounds for EFI variable storage bugs.

Cc: H. Peter Anvin &lt;hpa@zytor.com&gt;
Cc: Matthew Garrett &lt;mjg59@srcf.ucam.org&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
[xr: Backported to 3.4: adjust context]
Signed-off-by: Rui Xiang &lt;rui.xiang@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>efi_pstore: Introducing workqueue updating sysfs</title>
<updated>2014-06-07T23:02:10Z</updated>
<author>
<name>Seiji Aguchi</name>
<email>seiji.aguchi@hds.com</email>
</author>
<published>2013-02-12T21:04:41Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=b28299b42d3fb210fc0a6af6da435041e048fa39'/>
<id>urn:sha1:b28299b42d3fb210fc0a6af6da435041e048fa39</id>
<content type='text'>
commit a93bc0c6e07ed9bac44700280e65e2945d864fd4 upstream.

[Problem]
efi_pstore creates sysfs entries, which enable users to access to NVRAM,
in a write callback. If a kernel panic happens in an interrupt context,
it may fail because it could sleep due to dynamic memory allocations during
creating sysfs entries.

[Patch Description]
This patch removes sysfs operations from a write callback by introducing
a workqueue updating sysfs entries which is scheduled after the write
callback is called.

Also, the workqueue is kicked in a just oops case.
A system will go down in other cases such as panic, clean shutdown and emergency
restart. And we don't need to create sysfs entries because there is no chance for
users to access to them.

efi_pstore will be robust against a kernel panic in an interrupt context with this patch.

Signed-off-by: Seiji Aguchi &lt;seiji.aguchi@hds.com&gt;
Acked-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
[xr: Backported to 3.4:
  - Adjust contest
  - Remove repeated definition of helper function variable_is_present]
Signed-off-by: Rui Xiang &lt;rui.xiang@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>efivars: Fix check for CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE</title>
<updated>2014-06-07T23:02:10Z</updated>
<author>
<name>Ben Hutchings</name>
<email>ben@decadent.org.uk</email>
</author>
<published>2013-03-22T19:56:51Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9001ccbda1be58798d1bd221c3e2a2443133b8bb'/>
<id>urn:sha1:9001ccbda1be58798d1bd221c3e2a2443133b8bb</id>
<content type='text'>
commit ca0ba26fbbd2d81c43085df49ce0abfe34535a90 upstream.

The 'CONFIG_' prefix is not implicit in IS_ENABLED().

Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: Seth Forshee &lt;seth.forshee@canonical.com&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
Cc: Rui Xiang &lt;rui.xiang@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>efivars: Add module parameter to disable use as a pstore backend</title>
<updated>2014-06-07T23:02:09Z</updated>
<author>
<name>Seth Forshee</name>
<email>seth.forshee@canonical.com</email>
</author>
<published>2013-03-11T21:17:50Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=026f0287cdb6154517a7c7e23c6541a8ba30979b'/>
<id>urn:sha1:026f0287cdb6154517a7c7e23c6541a8ba30979b</id>
<content type='text'>
commit ec0971ba5372a4dfa753f232449d23a8fd98490e upstream.

We know that with some firmware implementations writing too much data to
UEFI variables can lead to bricking machines. Recent changes attempt to
address this issue, but for some it may still be prudent to avoid
writing large amounts of data until the solution has been proven on a
wide variety of hardware.

Crash dumps or other data from pstore can potentially be a large data
source. Add a pstore_module parameter to efivars to allow disabling its
use as a backend for pstore. Also add a config option,
CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE, to allow setting the default
value of this paramter to true (i.e. disabled by default).

Signed-off-by: Seth Forshee &lt;seth.forshee@canonical.com&gt;
Cc: Josh Boyer &lt;jwboyer@redhat.com&gt;
Cc: Matthew Garrett &lt;mjg59@srcf.ucam.org&gt;
Cc: Seiji Aguchi &lt;seiji.aguchi@hds.com&gt;
Cc: Tony Luck &lt;tony.luck@intel.com&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: Rui Xiang &lt;rui.xiang@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>efivars: Allow disabling use as a pstore backend</title>
<updated>2014-06-07T23:02:09Z</updated>
<author>
<name>Seth Forshee</name>
<email>seth.forshee@canonical.com</email>
</author>
<published>2013-03-07T17:40:17Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f6a087af822a54e098fd7934d1498256e8627254'/>
<id>urn:sha1:f6a087af822a54e098fd7934d1498256e8627254</id>
<content type='text'>
commit ed9dc8ce7a1c8115dba9483a9b51df8b63a2e0ef upstream.

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 &lt;seth.forshee@canonical.com&gt;
Cc: Josh Boyer &lt;jwboyer@redhat.com&gt;
Cc: Matthew Garrett &lt;mjg59@srcf.ucam.org&gt;
Cc: Seiji Aguchi &lt;seiji.aguchi@hds.com&gt;
Cc: Tony Luck &lt;tony.luck@intel.com&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
[xr: Backported to 3.4: adjust context]
Signed-off-by: Rui Xiang &lt;rui.xiang@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>efivars: pstore: Do not check size when erasing variable</title>
<updated>2014-06-07T23:02:09Z</updated>
<author>
<name>Ben Hutchings</name>
<email>ben@decadent.org.uk</email>
</author>
<published>2013-03-23T03:49:53Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1c4e6e91fec88f6a544259d5d536991e0a41f5e3'/>
<id>urn:sha1:1c4e6e91fec88f6a544259d5d536991e0a41f5e3</id>
<content type='text'>
commit 80a19debc2f2d398cfa57fae97bc99826748a602 upstream.

In 3.2, unlike mainline, efi_pstore_erase() calls efi_pstore_write()
with a size of 0, as the underlying EFI interface treats a size of 0
as meaning deletion.

This was not taken into account in my backport of commit d80a361d779a
'efi_pstore: Check remaining space with QueryVariableInfo() before
writing data'.  The size check should be omitted when erasing.

Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: Rui Xiang &lt;rui.xiang@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>efi: be more paranoid about available space when creating variables</title>
<updated>2014-06-07T23:02:09Z</updated>
<author>
<name>Josh Boyer</name>
<email>jwboyer@redhat.com</email>
</author>
<published>2013-03-11T21:48:53Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e887bb41a177d6c6f245d80ad427f1b91fbed91e'/>
<id>urn:sha1:e887bb41a177d6c6f245d80ad427f1b91fbed91e</id>
<content type='text'>
commit 68d929862e29a8b52a7f2f2f86a0600423b093cd upstream.

UEFI variables are typically stored in flash. For various reasons, avaiable
space is typically not reclaimed immediately upon the deletion of a
variable - instead, the system will garbage collect during initialisation
after a reboot.

Some systems appear to handle this garbage collection extremely poorly,
failing if more than 50% of the system flash is in use. This can result in
the machine refusing to boot. The safest thing to do for the moment is to
forbid writes if they'd end up using more than half of the storage space.
We can make this more finegrained later if we come up with a method for
identifying the broken machines.

Signed-off-by: Matthew Garrett &lt;matthew.garrett@nebula.com&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
[bwh: Backported to 3.2:
 - Drop efivarfs changes and unused check_var_size()
 - Add error codes to include/linux/efi.h, added upstream by
   commit 5d9db883761a ('efi: Add support for a UEFI variable filesystem')
 - Add efi_status_to_err(), added upstream by commit 7253eaba7b17
   ('efivarfs: Return an error if we fail to read a variable')]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: Rui Xiang &lt;rui.xiang@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>efivars: Disable external interrupt while holding efivars-&gt;lock</title>
<updated>2014-06-07T23:02:09Z</updated>
<author>
<name>Josh Boyer</name>
<email>jwboyer@redhat.com</email>
</author>
<published>2013-03-11T21:47:42Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ff534f031ab3192952fc6403bb8618feda758a38'/>
<id>urn:sha1:ff534f031ab3192952fc6403bb8618feda758a38</id>
<content type='text'>
commit 81fa4e581d9283f7992a0d8c534bb141eb840a14 upstream.

[Problem]
There is a scenario which efi_pstore fails to log messages in a panic case.

 - CPUA holds an efi_var-&gt;lock in either efivarfs parts
   or efi_pstore with interrupt enabled.
 - CPUB panics and sends IPI to CPUA in smp_send_stop().
 - CPUA stops with holding the lock.
 - CPUB kicks efi_pstore_write() via kmsg_dump(KSMG_DUMP_PANIC)
   but it returns without logging messages.

[Patch Description]
This patch disables an external interruption while holding efivars-&gt;lock
as follows.

In efi_pstore_write() and get_var_data(), spin_lock/spin_unlock is
replaced by spin_lock_irqsave/spin_unlock_irqrestore because they may
be called in an interrupt context.

In other functions, they are replaced by spin_lock_irq/spin_unlock_irq.
because they are all called from a process context.

By applying this patch, we can avoid the problem above with
a following senario.

 - CPUA holds an efi_var-&gt;lock with interrupt disabled.
 - CPUB panics and sends IPI to CPUA in smp_send_stop().
 - CPUA receives the IPI after releasing the lock because it is
   disabling interrupt while holding the lock.
 - CPUB waits for one sec until CPUA releases the lock.
 - CPUB kicks efi_pstore_write() via kmsg_dump(KSMG_DUMP_PANIC)
   And it can hold the lock successfully.

Signed-off-by: Seiji Aguchi &lt;seiji.aguchi@hds.com&gt;
Acked-by: Mike Waychison &lt;mikew@google.com&gt;
Acked-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
[bwh: Backported to 3.2:
 - Drop efivarfs changes
 - Adjust context
 - Drop change to efi_pstore_erase(), which is implemented using
   efi_pstore_write() here]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: Rui Xiang &lt;rui.xiang@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>efi_pstore: Check remaining space with QueryVariableInfo() before writing data</title>
<updated>2014-06-07T23:02:09Z</updated>
<author>
<name>Seiji Aguchi</name>
<email>seiji.aguchi@hds.com</email>
</author>
<published>2012-11-14T20:25:37Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=8e74ecf7da0e7a9d0ef4e2474f87a5cba86b4347'/>
<id>urn:sha1:8e74ecf7da0e7a9d0ef4e2474f87a5cba86b4347</id>
<content type='text'>
commit d80a361d779a9f19498943d1ca84243209cd5647 upstream.

[Issue]

As discussed in a thread below, Running out of space in EFI isn't a well-tested scenario.
And we wouldn't expect all firmware to handle it gracefully.
http://marc.info/?l=linux-kernel&amp;m=134305325801789&amp;w=2

On the other hand, current efi_pstore doesn't check a remaining space of storage at writing time.
Therefore, efi_pstore may not work if it tries to write a large amount of data.

[Patch Description]

To avoid handling the situation above, this patch checks if there is a space enough to log with
QueryVariableInfo() before writing data.

Signed-off-by: Seiji Aguchi &lt;seiji.aguchi@hds.com&gt;
Acked-by: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Tony Luck &lt;tony.luck@intel.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: Rui Xiang &lt;rui.xiang@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>efivars: Handle duplicate names from get_next_variable()</title>
<updated>2013-04-05T17:04:36Z</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2013-03-07T11:59:14Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=4025b05599996ca2866ceec0606c77d2ce2b4830'/>
<id>urn:sha1:4025b05599996ca2866ceec0606c77d2ce2b4830</id>
<content type='text'>
commit e971318bbed610e28bb3fde9d548e6aaf0a6b02e upstream.

Some firmware exhibits a bug where the same VariableName and
VendorGuid values are returned on multiple invocations of
GetNextVariableName(). See,

    https://bugzilla.kernel.org/show_bug.cgi?id=47631

As a consequence of such a bug, Andre reports hitting the following
WARN_ON() in the sysfs code after updating the BIOS on his, "Gigabyte
Technology Co., Ltd. To be filled by O.E.M./Z77X-UD3H, BIOS F19e
11/21/2012)" machine,

[    0.581554] EFI Variables Facility v0.08 2004-May-17
[    0.584914] ------------[ cut here ]------------
[    0.585639] WARNING: at /home/andre/linux/fs/sysfs/dir.c:536 sysfs_add_one+0xd4/0x100()
[    0.586381] Hardware name: To be filled by O.E.M.
[    0.587123] sysfs: cannot create duplicate filename '/firmware/efi/vars/SbAslBufferPtrVar-01f33c25-764d-43ea-aeea-6b5a41f3f3e8'
[    0.588694] Modules linked in:
[    0.589484] Pid: 1, comm: swapper/0 Not tainted 3.8.0+ #7
[    0.590280] Call Trace:
[    0.591066]  [&lt;ffffffff81208954&gt;] ? sysfs_add_one+0xd4/0x100
[    0.591861]  [&lt;ffffffff810587bf&gt;] warn_slowpath_common+0x7f/0xc0
[    0.592650]  [&lt;ffffffff810588bc&gt;] warn_slowpath_fmt+0x4c/0x50
[    0.593429]  [&lt;ffffffff8134dd85&gt;] ? strlcat+0x65/0x80
[    0.594203]  [&lt;ffffffff81208954&gt;] sysfs_add_one+0xd4/0x100
[    0.594979]  [&lt;ffffffff81208b78&gt;] create_dir+0x78/0xd0
[    0.595753]  [&lt;ffffffff81208ec6&gt;] sysfs_create_dir+0x86/0xe0
[    0.596532]  [&lt;ffffffff81347e4c&gt;] kobject_add_internal+0x9c/0x220
[    0.597310]  [&lt;ffffffff81348307&gt;] kobject_init_and_add+0x67/0x90
[    0.598083]  [&lt;ffffffff81584a71&gt;] ? efivar_create_sysfs_entry+0x61/0x1c0
[    0.598859]  [&lt;ffffffff81584b2b&gt;] efivar_create_sysfs_entry+0x11b/0x1c0
[    0.599631]  [&lt;ffffffff8158517e&gt;] register_efivars+0xde/0x420
[    0.600395]  [&lt;ffffffff81d430a7&gt;] ? edd_init+0x2f5/0x2f5
[    0.601150]  [&lt;ffffffff81d4315f&gt;] efivars_init+0xb8/0x104
[    0.601903]  [&lt;ffffffff8100215a&gt;] do_one_initcall+0x12a/0x180
[    0.602659]  [&lt;ffffffff81d05d80&gt;] kernel_init_freeable+0x13e/0x1c6
[    0.603418]  [&lt;ffffffff81d05586&gt;] ? loglevel+0x31/0x31
[    0.604183]  [&lt;ffffffff816a6530&gt;] ? rest_init+0x80/0x80
[    0.604936]  [&lt;ffffffff816a653e&gt;] kernel_init+0xe/0xf0
[    0.605681]  [&lt;ffffffff816ce7ec&gt;] ret_from_fork+0x7c/0xb0
[    0.606414]  [&lt;ffffffff816a6530&gt;] ? rest_init+0x80/0x80
[    0.607143] ---[ end trace 1609741ab737eb29 ]---

There's not much we can do to work around and keep traversing the
variable list once we hit this firmware bug. Our only solution is to
terminate the loop because, as Lingzhu reports, some machines get
stuck when they encounter duplicate names,

  &gt; I had an IBM System x3100 M4 and x3850 X5 on which kernel would
  &gt; get stuck in infinite loop creating duplicate sysfs files because,
  &gt; for some reason, there are several duplicate boot entries in nvram
  &gt; getting GetNextVariableName into a circle of iteration (with
  &gt; period &gt; 2).

Also disable the workqueue, as efivar_update_sysfs_entries() uses
GetNextVariableName() to figure out which variables have been created
since the last iteration. That algorithm isn't going to work if
GetNextVariableName() returns duplicates. Note that we don't disable
EFI variable creation completely on the affected machines, it's just
that any pstore dump-* files won't appear in sysfs until the next
boot.

[Backported for 3.4-stable. Removed code related to pstore
workqueue but pulled in helper function variable_is_present
from a93bc0c; Moved the definition of __efivars to the top
for being referenced in variable_is_present.]

Reported-by: Andre Heider &lt;a.heider@gmail.com&gt;
Reported-by: Lingzhu Xiang &lt;lxiang@redhat.com&gt;
Tested-by: Lingzhu Xiang &lt;lxiang@redhat.com&gt;
Cc: Seiji Aguchi &lt;seiji.aguchi@hds.com&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
Signed-off-by: Lingzhu Xiang &lt;lxiang@redhat.com&gt;
Reviewed-by: CAI Qian &lt;caiqian@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;


</content>
</entry>
</feed>
