<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/firmware/google, branch linux-4.9.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>firmware: google: Test spinlock on panic path to avoid lockups</title>
<updated>2022-10-26T11:15:43+00:00</updated>
<author>
<name>Guilherme G. Piccoli</name>
<email>gpiccoli@igalia.com</email>
</author>
<published>2022-09-09T20:07:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=55ced28cac85e2fda63f25d45641c95acbbd07b0'/>
<id>55ced28cac85e2fda63f25d45641c95acbbd07b0</id>
<content type='text'>
[ Upstream commit 3e081438b8e639cc76ef1a5ce0c1bd8a154082c7 ]

Currently the gsmi driver registers a panic notifier as well as
reboot and die notifiers. The callbacks registered are called in
atomic and very limited context - for instance, panic disables
preemption and local IRQs, also all secondary CPUs (not executing
the panic path) are shutdown.

With that said, taking a spinlock in this scenario is a dangerous
invitation for lockup scenarios. So, fix that by checking if the
spinlock is free to acquire in the panic notifier callback - if not,
bail-out and avoid a potential hang.

Fixes: 74c5b31c6618 ("driver: Google EFI SMI")
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Cc: David Gow &lt;davidgow@google.com&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Julius Werner &lt;jwerner@chromium.org&gt;
Cc: Petr Mladek &lt;pmladek@suse.com&gt;
Reviewed-by: Evan Green &lt;evgreen@chromium.org&gt;
Signed-off-by: Guilherme G. Piccoli &lt;gpiccoli@igalia.com&gt;
Link: https://lore.kernel.org/r/20220909200755.189679-1-gpiccoli@igalia.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 3e081438b8e639cc76ef1a5ce0c1bd8a154082c7 ]

Currently the gsmi driver registers a panic notifier as well as
reboot and die notifiers. The callbacks registered are called in
atomic and very limited context - for instance, panic disables
preemption and local IRQs, also all secondary CPUs (not executing
the panic path) are shutdown.

With that said, taking a spinlock in this scenario is a dangerous
invitation for lockup scenarios. So, fix that by checking if the
spinlock is free to acquire in the panic notifier callback - if not,
bail-out and avoid a potential hang.

Fixes: 74c5b31c6618 ("driver: Google EFI SMI")
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Cc: David Gow &lt;davidgow@google.com&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Julius Werner &lt;jwerner@chromium.org&gt;
Cc: Petr Mladek &lt;pmladek@suse.com&gt;
Reviewed-by: Evan Green &lt;evgreen@chromium.org&gt;
Signed-off-by: Guilherme G. Piccoli &lt;gpiccoli@igalia.com&gt;
Link: https://lore.kernel.org/r/20220909200755.189679-1-gpiccoli@igalia.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>gsmi: Fix bug in append_to_eventlog sysfs handler</title>
<updated>2019-11-28T17:28:21+00:00</updated>
<author>
<name>Duncan Laurie</name>
<email>dlaurie@chromium.org</email>
</author>
<published>2018-10-12T16:04:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=fb83018527ecb9a636ad5faf75d6a46cd7c9a4cc'/>
<id>fb83018527ecb9a636ad5faf75d6a46cd7c9a4cc</id>
<content type='text'>
[ Upstream commit 655603de68469adaff16842ac17a5aec9c9ce89b ]

The sysfs handler should return the number of bytes consumed, which in the
case of a successful write is the entire buffer.  Also fix a bug where
param.data_len was being set to (count - (2 * sizeof(u32))) instead of just
(count - sizeof(u32)).  The latter is correct because we skip over the
leading u32 which is our param.type, but we were also incorrectly
subtracting sizeof(u32) on the line where we were actually setting
param.data_len:

	param.data_len = count - sizeof(u32);

This meant that for our example event.kernel_software_watchdog with total
length 10 bytes, param.data_len was just 2 prior to this change.

To test, successfully append an event to the log with gsmi sysfs.
This sample event is for a "Kernel Software Watchdog"

&gt; xxd -g 1 event.kernel_software_watchdog
0000000: 01 00 00 00 ad de 06 00 00 00

&gt; cat event.kernel_software_watchdog &gt; /sys/firmware/gsmi/append_to_eventlog

&gt; mosys eventlog list | tail -1
14 | 2012-06-25 10:14:14 | Kernl Event | Software Watchdog

Signed-off-by: Duncan Laurie &lt;dlaurie@chromium.org&gt;
Reviewed-by: Vadim Bendebury &lt;vbendeb@chromium.org&gt;
Reviewed-by: Stefan Reinauer &lt;reinauer@chromium.org&gt;
Signed-off-by: Furquan Shaikh &lt;furquan@google.com&gt;
Tested-by: Furquan Shaikh &lt;furquan@chromium.org&gt;
Reviewed-by: Aaron Durbin &lt;adurbin@chromium.org&gt;
Reviewed-by: Justin TerAvest &lt;teravest@chromium.org&gt;
[zwisler: updated changelog for 2nd bug fix and upstream]
Signed-off-by: Ross Zwisler &lt;zwisler@google.com&gt;
Reviewed-by: Guenter Roeck &lt;groeck@chromium.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 655603de68469adaff16842ac17a5aec9c9ce89b ]

The sysfs handler should return the number of bytes consumed, which in the
case of a successful write is the entire buffer.  Also fix a bug where
param.data_len was being set to (count - (2 * sizeof(u32))) instead of just
(count - sizeof(u32)).  The latter is correct because we skip over the
leading u32 which is our param.type, but we were also incorrectly
subtracting sizeof(u32) on the line where we were actually setting
param.data_len:

	param.data_len = count - sizeof(u32);

This meant that for our example event.kernel_software_watchdog with total
length 10 bytes, param.data_len was just 2 prior to this change.

To test, successfully append an event to the log with gsmi sysfs.
This sample event is for a "Kernel Software Watchdog"

&gt; xxd -g 1 event.kernel_software_watchdog
0000000: 01 00 00 00 ad de 06 00 00 00

&gt; cat event.kernel_software_watchdog &gt; /sys/firmware/gsmi/append_to_eventlog

&gt; mosys eventlog list | tail -1
14 | 2012-06-25 10:14:14 | Kernl Event | Software Watchdog

Signed-off-by: Duncan Laurie &lt;dlaurie@chromium.org&gt;
Reviewed-by: Vadim Bendebury &lt;vbendeb@chromium.org&gt;
Reviewed-by: Stefan Reinauer &lt;reinauer@chromium.org&gt;
Signed-off-by: Furquan Shaikh &lt;furquan@google.com&gt;
Tested-by: Furquan Shaikh &lt;furquan@chromium.org&gt;
Reviewed-by: Aaron Durbin &lt;adurbin@chromium.org&gt;
Reviewed-by: Justin TerAvest &lt;teravest@chromium.org&gt;
[zwisler: updated changelog for 2nd bug fix and upstream]
Signed-off-by: Ross Zwisler &lt;zwisler@google.com&gt;
Reviewed-by: Guenter Roeck &lt;groeck@chromium.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>firmware-gsmi: Delete an unnecessary check before the function call "dma_pool_destroy"</title>
<updated>2016-09-09T15:08:45+00:00</updated>
<author>
<name>Markus Elfring</name>
<email>elfring@users.sourceforge.net</email>
</author>
<published>2016-07-24T08:16:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d520dd1f348dcaafcb8ce804b2a5ebb1be004719'/>
<id>d520dd1f348dcaafcb8ce804b2a5ebb1be004719</id>
<content type='text'>
The dma_pool_destroy() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring &lt;elfring@users.sourceforge.net&gt;
Cc: Greg KH &lt;gregkh@linuxfoundation.org&gt;
Cc: Julia Lawall &lt;julia.lawall@lip6.fr&gt;
Cc: Mike Waychison &lt;mikew@google.com&gt;
Cc: Michel Lespinasse &lt;walken@google.com&gt;
Signed-off-by: Matt Fleming &lt;matt@codeblueprint.co.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The dma_pool_destroy() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring &lt;elfring@users.sourceforge.net&gt;
Cc: Greg KH &lt;gregkh@linuxfoundation.org&gt;
Cc: Julia Lawall &lt;julia.lawall@lip6.fr&gt;
Cc: Mike Waychison &lt;mikew@google.com&gt;
Cc: Michel Lespinasse &lt;walken@google.com&gt;
Signed-off-by: Matt Fleming &lt;matt@codeblueprint.co.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>firmware: google memconsole driver fixes</title>
<updated>2014-02-15T19:30:28+00:00</updated>
<author>
<name>Michel Lespinasse</name>
<email>walken@google.com</email>
</author>
<published>2014-01-28T13:06:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=cb88759107292b4bf36d13c73129add580d4e26e'/>
<id>cb88759107292b4bf36d13c73129add580d4e26e</id>
<content type='text'>
The google memconsole driver is currently broken upstream, as it tries
to read memory that is described as reserved in /proc/iomem, by
dereferencing a pointer obtained through phys_to_virt(). This triggers
a kernel fault as such regions are unmapped after early boot.

The proper workaround is to use ioremap_cache() / iounmap() around such
accesses.

As some unrelated changes, I also converted some printks to use pr_info()
and added some missing __init annotations.

Tested: booted dbg build, verified I could read /sys/firmware/log

Signed-off-by: Michel Lespinasse &lt;walken@google.com&gt;
Acked-by: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The google memconsole driver is currently broken upstream, as it tries
to read memory that is described as reserved in /proc/iomem, by
dereferencing a pointer obtained through phys_to_virt(). This triggers
a kernel fault as such regions are unmapped after early boot.

The proper workaround is to use ioremap_cache() / iounmap() around such
accesses.

As some unrelated changes, I also converted some printks to use pr_info()
and added some missing __init annotations.

Tested: booted dbg build, verified I could read /sys/firmware/log

Signed-off-by: Michel Lespinasse &lt;walken@google.com&gt;
Acked-by: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>firmware: fix google/gsmi duplicate efivars_sysfs_init()</title>
<updated>2014-02-15T19:29:56+00:00</updated>
<author>
<name>Michel Lespinasse</name>
<email>walken@google.com</email>
</author>
<published>2014-01-28T13:06:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=b12b73f1ca7763a94e0949a0d86eea40b5f69ea6'/>
<id>b12b73f1ca7763a94e0949a0d86eea40b5f69ea6</id>
<content type='text'>
Starting in commit e14ab23dde12b80db4c94b684a2e485b72b16af3,
efivars_sysfs_init() is called both by itself as an init function,
and by drivers/firmware/google/gsmi.c gsmi_init().

This results in runtime warnings such as the following:
[    5.651330] WARNING: at fs/sysfs/dir.c:530 sysfs_add_one+0xbd/0xe0()
[    5.657699] sysfs: cannot create duplicate filename '/firmware/gsmi/vars'

Fixing this by removing the redundant efivars_sysfs_init() call in
gsmi_init().

Tested: booted, checked that /firmware/gsmi/vars was still present and
showed the expected contents.

Signed-off-by: Michel Lespinasse &lt;walken@google.com&gt;
Acked-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
Acked-by: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Starting in commit e14ab23dde12b80db4c94b684a2e485b72b16af3,
efivars_sysfs_init() is called both by itself as an init function,
and by drivers/firmware/google/gsmi.c gsmi_init().

This results in runtime warnings such as the following:
[    5.651330] WARNING: at fs/sysfs/dir.c:530 sysfs_add_one+0xbd/0xe0()
[    5.657699] sysfs: cannot create duplicate filename '/firmware/gsmi/vars'

Fixing this by removing the redundant efivars_sysfs_init() call in
gsmi_init().

Tested: booted, checked that /firmware/gsmi/vars was still present and
showed the expected contents.

Signed-off-by: Michel Lespinasse &lt;walken@google.com&gt;
Acked-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
Acked-by: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>firmware/google: drop 'select EFI' to avoid recursive dependency</title>
<updated>2014-01-28T05:02:40+00:00</updated>
<author>
<name>Ard Biesheuvel</name>
<email>ard.biesheuvel@linaro.org</email>
</author>
<published>2014-01-28T01:07:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c2218e26c0d03c368fff825a6f15b7bb3418dbde'/>
<id>c2218e26c0d03c368fff825a6f15b7bb3418dbde</id>
<content type='text'>
The GOOGLE_SMI Kconfig symbol depends on DMI and selects EFI.  This
causes problems on other archs when introducing DMI support that depends
on EFI, as it results in a recursive dependency:

  arch/arm/Kconfig:1845:error: recursive dependency detected!
  arch/arm/Kconfig:1845:	symbol DMI depends on EFI

Fix by changing the 'select EFI' to a 'depends on EFI'.

Signed-off-by: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
Cc: David Rientjes &lt;rientjes@google.com&gt;
Acked-by: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The GOOGLE_SMI Kconfig symbol depends on DMI and selects EFI.  This
causes problems on other archs when introducing DMI support that depends
on EFI, as it results in a recursive dependency:

  arch/arm/Kconfig:1845:error: recursive dependency detected!
  arch/arm/Kconfig:1845:	symbol DMI depends on EFI

Fix by changing the 'select EFI' to a 'depends on EFI'.

Signed-off-by: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
Cc: David Rientjes &lt;rientjes@google.com&gt;
Acked-by: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>DMA-API: firmware/google/gsmi.c: avoid direct access to DMA masks</title>
<updated>2013-10-31T14:49:17+00:00</updated>
<author>
<name>Russell King</name>
<email>rmk+kernel@arm.linux.org.uk</email>
</author>
<published>2013-07-01T14:55:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=536dc1eb6bc36db6a03e002b421a0b473404b397'/>
<id>536dc1eb6bc36db6a03e002b421a0b473404b397</id>
<content type='text'>
This driver doesn't need to directly access DMA masks if it uses the
platform_device_register_full() API rather than
platform_device_register_simple() - the former function can initialize
the DMA mask appropriately.

Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This driver doesn't need to directly access DMA masks if it uses the
platform_device_register_full() API rather than
platform_device_register_simple() - the former function can initialize
the DMA mask appropriately.

Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drivers/firmware/google/gsmi.c: replace strict_strtoul() with kstrtoul()</title>
<updated>2013-09-11T22:58:16+00:00</updated>
<author>
<name>Jingoo Han</name>
<email>jg1.han@samsung.com</email>
</author>
<published>2013-09-11T21:23:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=20d0e57017b69e7e4ae7166c43f3a3f023ab9702'/>
<id>20d0e57017b69e7e4ae7166c43f3a3f023ab9702</id>
<content type='text'>
The use of strict_strtoul() is not preferred, because strict_strtoul() is
obsolete.  Thus, kstrtoul() should be used.

Signed-off-by: Jingoo Han &lt;jg1.han@samsung.com&gt;
Cc: Matt Fleming &lt;matt.fleming@intel.com&gt;
Cc: Tom Gundersen &lt;teg@jklm.no&gt;
Cc: Mike Waychison &lt;mikew@google.com&gt;
Acked-by: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The use of strict_strtoul() is not preferred, because strict_strtoul() is
obsolete.  Thus, kstrtoul() should be used.

Signed-off-by: Jingoo Han &lt;jg1.han@samsung.com&gt;
Cc: Matt Fleming &lt;matt.fleming@intel.com&gt;
Cc: Tom Gundersen &lt;teg@jklm.no&gt;
Cc: Mike Waychison &lt;mikew@google.com&gt;
Acked-by: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'v3.9' into efi-for-tip2</title>
<updated>2013-04-30T10:42:13+00:00</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2013-04-30T10:30:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a614e1923d5389d01f3545ee4a90e39a04d0c90d'/>
<id>a614e1923d5389d01f3545ee4a90e39a04d0c90d</id>
<content type='text'>
Resolve conflicts for Ingo.

Conflicts:
	drivers/firmware/Kconfig
	drivers/firmware/efivars.c

Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Resolve conflicts for Ingo.

Conflicts:
	drivers/firmware/Kconfig
	drivers/firmware/efivars.c

Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>efivars: efivar_entry API</title>
<updated>2013-04-17T12:23:59+00:00</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2013-02-03T20:16:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e14ab23dde12b80db4c94b684a2e485b72b16af3'/>
<id>e14ab23dde12b80db4c94b684a2e485b72b16af3</id>
<content type='text'>
There isn't really a formal interface for dealing with EFI variables
or struct efivar_entry. Historically, this has led to various bits of
code directly accessing the generic EFI variable ops, which inherently
ties it to specific EFI variable operations instead of indirectly
using whatever ops were registered with register_efivars(). This lead
to the efivarfs code only working with the generic EFI variable ops
and not CONFIG_GOOGLE_SMI.

Encapsulate everything that needs to access '__efivars' inside an
efivar_entry_* API and use the new API in the pstore, sysfs and
efivarfs code.

Much of the efivars code had to be rewritten to use this new API. For
instance, it is now up to the users of the API to build the initial
list of EFI variables in their efivar_init() callback function. The
variable list needs to be passed to efivar_init() which allows us to
keep work arounds for things like implementation bugs in
GetNextVariable() in a central location.

Allowing users of the API to use a callback function to build the list
greatly benefits the efivarfs code which needs to allocate inodes and
dentries for every variable.  It previously did this in a racy way
because the code ran without holding the variable spinlock. Both the
sysfs and efivarfs code maintain their own lists which means the two
interfaces can be running simultaneously without interference, though
it should be noted that because no synchronisation is performed it is
very easy to create inconsistencies. efibootmgr doesn't currently use
efivarfs and users are likely to also require the old sysfs interface,
so it makes sense to allow both to be built.

Reviewed-by: Tom Gundersen &lt;teg@jklm.no&gt;
Tested-by: Tom Gundersen &lt;teg@jklm.no&gt;
Cc: Seiji Aguchi &lt;seiji.aguchi@hds.com&gt;
Cc: Matthew Garrett &lt;mjg59@srcf.ucam.org&gt;
Cc: Jeremy Kerr &lt;jk@ozlabs.org&gt;
Cc: Tony Luck &lt;tony.luck@intel.com&gt;
Cc: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There isn't really a formal interface for dealing with EFI variables
or struct efivar_entry. Historically, this has led to various bits of
code directly accessing the generic EFI variable ops, which inherently
ties it to specific EFI variable operations instead of indirectly
using whatever ops were registered with register_efivars(). This lead
to the efivarfs code only working with the generic EFI variable ops
and not CONFIG_GOOGLE_SMI.

Encapsulate everything that needs to access '__efivars' inside an
efivar_entry_* API and use the new API in the pstore, sysfs and
efivarfs code.

Much of the efivars code had to be rewritten to use this new API. For
instance, it is now up to the users of the API to build the initial
list of EFI variables in their efivar_init() callback function. The
variable list needs to be passed to efivar_init() which allows us to
keep work arounds for things like implementation bugs in
GetNextVariable() in a central location.

Allowing users of the API to use a callback function to build the list
greatly benefits the efivarfs code which needs to allocate inodes and
dentries for every variable.  It previously did this in a racy way
because the code ran without holding the variable spinlock. Both the
sysfs and efivarfs code maintain their own lists which means the two
interfaces can be running simultaneously without interference, though
it should be noted that because no synchronisation is performed it is
very easy to create inconsistencies. efibootmgr doesn't currently use
efivarfs and users are likely to also require the old sysfs interface,
so it makes sense to allow both to be built.

Reviewed-by: Tom Gundersen &lt;teg@jklm.no&gt;
Tested-by: Tom Gundersen &lt;teg@jklm.no&gt;
Cc: Seiji Aguchi &lt;seiji.aguchi@hds.com&gt;
Cc: Matthew Garrett &lt;mjg59@srcf.ucam.org&gt;
Cc: Jeremy Kerr &lt;jk@ozlabs.org&gt;
Cc: Tony Luck &lt;tony.luck@intel.com&gt;
Cc: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
