<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/firmware, branch v3.18</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v3.18</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.18'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2014-10-23T21:45:09Z</updated>
<entry>
<title>Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2014-10-23T21:45:09Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2014-10-23T21:45:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8c81f48e16fbe103e682d7ee7b2f16d065c42954'/>
<id>urn:sha1:8c81f48e16fbe103e682d7ee7b2f16d065c42954</id>
<content type='text'>
Pull x86 EFI updates from Peter Anvin:
 "This patchset falls under the "maintainers that grovel" clause in the
  v3.18-rc1 announcement.  We had intended to push it late in the merge
  window since we got it into the -tip tree relatively late.

  Many of these are relatively simple things, but there are a couple of
  key bits, especially Ard's and Matt's patches"

* 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits)
  rtc: Disable EFI rtc for x86
  efi: rtc-efi: Export platform:rtc-efi as module alias
  efi: Delete the in_nmi() conditional runtime locking
  efi: Provide a non-blocking SetVariable() operation
  x86/efi: Adding efi_printks on memory allocationa and pci.reads
  x86/efi: Mark initialization code as such
  x86/efi: Update comment regarding required phys mapped EFI services
  x86/efi: Unexport add_efi_memmap variable
  x86/efi: Remove unused efi_call* macros
  efi: Resolve some shadow warnings
  arm64: efi: Format EFI memory type &amp; attrs with efi_md_typeattr_format()
  ia64: efi: Format EFI memory type &amp; attrs with efi_md_typeattr_format()
  x86: efi: Format EFI memory type &amp; attrs with efi_md_typeattr_format()
  efi: Introduce efi_md_typeattr_format()
  efi: Add macro for EFI_MEMORY_UCE memory attribute
  x86/efi: Clear EFI_RUNTIME_SERVICES if failing to enter virtual mode
  arm64/efi: Do not enter virtual mode if booting with efi=noruntime or noefi
  arm64/efi: uefi_init error handling fix
  efi: Add kernel param efi=noruntime
  lib: Add a generic cmdline parse function parse_option_str
  ...
</content>
</entry>
<entry>
<title>drivers/firmware/memmap.c: don't create memmap sysfs of same firmware_map_entry</title>
<updated>2014-10-10T02:26:00Z</updated>
<author>
<name>Yasuaki Ishimatsu</name>
<email>isimatu.yasuaki@jp.fujitsu.com</email>
</author>
<published>2014-10-09T22:29:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=22880ebe76be421a572b6f004604467c63f281f5'/>
<id>urn:sha1:22880ebe76be421a572b6f004604467c63f281f5</id>
<content type='text'>
By the following commits, we prevented from allocating firmware_map_entry
of same memory range:
  f0093ede: drivers/firmware/memmap.c: don't allocate firmware_map_entry
            of same memory range
  49c8b24d: drivers/firmware/memmap.c: pass the correct argument to
            firmware_map_find_entry_bootmem()

But it's not enough. When PNP0C80 device is added by acpi_scan_init(),
memmap sysfses of same firmware_map_entry are created twice as follows:

  # cat /sys/firmware/memmap/*/start
  0x40000000000
  0x60000000000
  0x4a837000
  0x4a83a000
  0x4a8b5000
  ...
  0x40000000000
  0x60000000000
  ...

The flows of the issues are as follows:

  1. e820_reserve_resources() allocates firmware_map_entrys of all
     memory ranges defined in e820. And, these firmware_map_entrys
     are linked with map_entries list.

     map_entries -&gt; entry 1 -&gt; ... -&gt; entry N

  2. When PNP0C80 device is limited by mem= boot option, acpi_scan_init()
     added the memory device. In this case, firmware_map_add_hotplug()
     allocates firmware_map_entry and creates memmap sysfs.

     map_entries -&gt; entry 1 -&gt; ... -&gt; entry N -&gt; entry N+1
                                                 |
                                                 memmap 1

  3. firmware_memmap_init() creates memmap sysfses of firmware_map_entrys
     linked with map_entries.

     map_entries -&gt; entry 1 -&gt; ... -&gt; entry N -&gt; entry N+1
                     |                 |             |
                     memmap 2          memmap N+1    memmap 1
                                                     memmap N+2

So while hot removing the PNP0C80 device, kernel panic occurs as follows:

     BUG: unable to handle kernel paging request at 00000001003e000b
      IP: sysfs_open_file+0x46/0x2b0
      PGD 203a89fe067 PUD 0
      Oops: 0000 [#1] SMP
      ...
      Call Trace:
        do_dentry_open+0x1ef/0x2a0
        finish_open+0x31/0x40
        do_last+0x57c/0x1220
        path_openat+0xc2/0x4c0
        do_filp_open+0x4b/0xb0
        do_sys_open+0xf3/0x1f0
        SyS_open+0x1e/0x20
        system_call_fastpath+0x16/0x1b

The patch adds a check of confirming whether memmap sysfs of
firmware_map_entry has been created, and does not create memmap
sysfs of same firmware_map_entry.

Signed-off-by: Yasuaki Ishimatsu &lt;isimatu.yasuaki@jp.fujitsu.com&gt;
Cc: Santosh Shilimkar &lt;santosh.shilimkar@ti.com&gt;
Cc: Toshi Kani &lt;toshi.kani@hp.com&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'next' into efi-next-merge</title>
<updated>2014-10-03T21:15:56Z</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2014-10-03T21:15:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=75b128573b275d5a5a7210b98c4b8cb3b39c12e7'/>
<id>urn:sha1:75b128573b275d5a5a7210b98c4b8cb3b39c12e7</id>
<content type='text'>
Conflicts:
	arch/x86/boot/compressed/eboot.c
</content>
</entry>
<entry>
<title>efi: Delete the in_nmi() conditional runtime locking</title>
<updated>2014-10-03T17:41:03Z</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2014-09-30T14:03:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=60b4dc7720a5251f5dbda69ad404e0bcb3cb6bfb'/>
<id>urn:sha1:60b4dc7720a5251f5dbda69ad404e0bcb3cb6bfb</id>
<content type='text'>
commit 5dc3826d9f08 ("efi: Implement mandatory locking for UEFI Runtime
Services") implemented some conditional locking when accessing variable
runtime services that Ingo described as "pretty disgusting".

The intention with the !efi_in_nmi() checks was to avoid live-locks when
trying to write pstore crash data into an EFI variable. Such lockless
accesses are allowed according to the UEFI specification when we're in a
"non-recoverable" state, but whether or not things are implemented
correctly in actual firmware implementations remains an unanswered
question, and so it would seem sensible to avoid doing any kind of
unsynchronized variable accesses.

Furthermore, the efi_in_nmi() tests are inadequate because they don't
account for the case where we call EFI variable services from panic or
oops callbacks and aren't executing in NMI context. In other words,
live-locking is still possible.

Let's just remove the conditional locking altogether. Now we've got the
-&gt;set_variable_nonblocking() EFI variable operation we can abort if the
runtime lock is already held. Aborting is by far the safest option.

Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
Cc: Matthew Garrett &lt;mjg59@srcf.ucam.org&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
</entry>
<entry>
<title>efi: Provide a non-blocking SetVariable() operation</title>
<updated>2014-10-03T17:41:03Z</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2014-09-30T20:58:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6d80dba1c9fe4316ef626980102b92fa30c7845a'/>
<id>urn:sha1:6d80dba1c9fe4316ef626980102b92fa30c7845a</id>
<content type='text'>
There are some circumstances that call for trying to write an EFI
variable in a non-blocking way. One such scenario is when writing pstore
data in efi_pstore_write() via the pstore_dump() kdump callback.

Now that we have an EFI runtime spinlock we need a way of aborting if
there is contention instead of spinning, since when writing pstore data
from the kdump callback, the runtime lock may already be held by the CPU
that's running the callback if we crashed in the middle of an EFI
variable operation.

The situation is sufficiently special that a new EFI variable operation
is warranted.

Introduce -&gt;set_variable_nonblocking() for this use case. It is an
optional EFI backend operation, and need only be implemented by those
backends that usually acquire locks to serialize access to EFI
variables, as is the case for virt_efi_set_variable() where we now grab
the EFI runtime spinlock.

Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
Cc: Matthew Garrett &lt;mjg59@srcf.ucam.org&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
</entry>
<entry>
<title>efi: Resolve some shadow warnings</title>
<updated>2014-10-03T17:41:01Z</updated>
<author>
<name>Mark Rustad</name>
<email>mark.d.rustad@intel.com</email>
</author>
<published>2014-09-06T13:02:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b2fce819a841eed21034c10a6fe3a8f43532dfb2'/>
<id>urn:sha1:b2fce819a841eed21034c10a6fe3a8f43532dfb2</id>
<content type='text'>
It is a really bad idea to declare variables or parameters that
have the same name as common types. It is valid C, but it gets
surprising if a macro expansion attempts to declare an inner
local with that type. Change the local names to eliminate the
hazard.

Change s16 =&gt; str16, s8 =&gt; str8.

This resolves warnings seen when using W=2 during make, for instance:

drivers/firmware/efi/vars.c: In function ‘dup_variable_bug’:
drivers/firmware/efi/vars.c:324:44: warning: declaration of ‘s16’ shadows a global declaration [-Wshadow]
 static void dup_variable_bug(efi_char16_t *s16, efi_guid_t *vendor_guid,

drivers/firmware/efi/vars.c:328:8: warning: declaration of ‘s8’ shadows a global declaration [-Wshadow]
  char *s8;

Signed-off-by: Mark Rustad &lt;mark.d.rustad@intel.com&gt;
Signed-off-by: Jeff Kirsher &lt;jeffrey.t.kirsher@intel.com&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
</entry>
<entry>
<title>efi: Introduce efi_md_typeattr_format()</title>
<updated>2014-10-03T17:41:00Z</updated>
<author>
<name>Laszlo Ersek</name>
<email>lersek@redhat.com</email>
</author>
<published>2014-09-03T11:32:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=98d2a6ca14520904a47c46258d3bad02ffcd3f96'/>
<id>urn:sha1:98d2a6ca14520904a47c46258d3bad02ffcd3f96</id>
<content type='text'>
At the moment, there are three architectures debug-printing the EFI memory
map at initialization: x86, ia64, and arm64. They all use different format
strings, plus the EFI memory type and the EFI memory attributes are
similarly hard to decode for a human reader.

Introduce a helper __init function that formats the memory type and the
memory attributes in a unified way, to a user-provided character buffer.

The array "memory_type_name" is copied from the arm64 code, temporarily
duplicating it. The (otherwise optional) braces around each string literal
in the initializer list are dropped in order to match the kernel coding
style more closely. The element size is tightened from 32 to 20 bytes
(maximum actual string length + 1) so that we can derive the field width
from the element size.

Signed-off-by: Laszlo Ersek &lt;lersek@redhat.com&gt;
Tested-by: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
Acked-by: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
[ Dropped useless 'register' keyword, which compiler will ignore ]
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
</entry>
<entry>
<title>efi: Add kernel param efi=noruntime</title>
<updated>2014-10-03T17:40:59Z</updated>
<author>
<name>Dave Young</name>
<email>dyoung@redhat.com</email>
</author>
<published>2014-08-14T09:15:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5ae3683c380e78aebc60d710617ba2c0dccc9e84'/>
<id>urn:sha1:5ae3683c380e78aebc60d710617ba2c0dccc9e84</id>
<content type='text'>
noefi kernel param means actually disabling efi runtime, Per suggestion
from Leif Lindholm efi=noruntime should be better. But since noefi is
already used in X86 thus just adding another param efi=noruntime for
same purpose.

Signed-off-by: Dave Young &lt;dyoung@redhat.com&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
</entry>
<entry>
<title>efi: Move noefi early param code out of x86 arch code</title>
<updated>2014-10-03T17:40:58Z</updated>
<author>
<name>Dave Young</name>
<email>dyoung@redhat.com</email>
</author>
<published>2014-08-14T09:15:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b2e0a54a1296a91b800f316df7bef7d1905e4fd0'/>
<id>urn:sha1:b2e0a54a1296a91b800f316df7bef7d1905e4fd0</id>
<content type='text'>
noefi param can be used for arches other than X86 later, thus move it
out of x86 platform code.

Signed-off-by: Dave Young &lt;dyoung@redhat.com&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
</entry>
<entry>
<title>efi: Add efi= parameter parsing to the EFI boot stub</title>
<updated>2014-10-03T17:40:57Z</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2014-08-05T10:52:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5a17dae422d7de4b776a9753cd4673a343a25b4b'/>
<id>urn:sha1:5a17dae422d7de4b776a9753cd4673a343a25b4b</id>
<content type='text'>
We need a way to customize the behaviour of the EFI boot stub, in
particular, we need a way to disable the "chunking" workaround, used
when reading files from the EFI System Partition.

One of my machines doesn't cope well when reading files in 1MB chunks to
a buffer above the 4GB mark - it appears that the "chunking" bug
workaround triggers another firmware bug. This was only discovered with
commit 4bf7111f5016 ("x86/efi: Support initrd loaded above 4G"), and
that commit is perfectly valid. The symptom I observed was a corrupt
initrd rather than any kind of crash.

efi= is now used to specify EFI parameters in two very different
execution environments, the EFI boot stub and during kernel boot.

There is also a slight performance optimization by enabling efi=nochunk,
but that's offset by the fact that you're more likely to run into
firmware issues, at least on x86. This is the rationale behind leaving
the workaround enabled by default.

Also provide some documentation for EFI_READ_CHUNK_SIZE and why we're
using the current value of 1MB.

Tested-by: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
Cc: Roy Franz &lt;roy.franz@linaro.org&gt;
Cc: Maarten Lankhorst &lt;m.b.lankhorst@gmail.com&gt;
Cc: Leif Lindholm &lt;leif.lindholm@linaro.org&gt;
Cc: Borislav Petkov &lt;bp@suse.de&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
</entry>
</feed>
