x86, efi: correct precedence of operators in setup_efi_pci

With the current code, the condition in the if() doesn't make much sense due to
precedence of operators.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Link: http://lkml.kernel.org/r/1356030701-16284-25-git-send-email-sasha.levin@oracle.com
Cc: Matt Fleming <matt.fleming@intel.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Ensure that kernel_init_freeable() is not inlined into non __init code

Commit d6b2123802d "make sure that we always have a return path from
kernel_execve()" reshuffled kernel_init()/init_post() to ensure that
kernel_execve() has a caller to return to.

It removed __init annotation for kernel_init() and introduced/calls a
new routine kernel_init_freeable(). Latter however is inlined by any
reasonable compiler (ARC gcc 4.4 in this case), causing slight code
bloat.

This patch forces kernel_init_freeable() as noinline reducing the .text

bloat-o-meter vmlinux vmlinux_new
add/remove: 1/0 grow/shrink: 0/1 up/down: 374/-334 (40)
function                        old     new   delta
kernel_init_freeable              -     374    +374 (.init.text)
kernel_init                     628     294    -334 (.text)

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
CONFIG_GENERIC_SIGALTSTACK build breakage with asm-generic/syscalls.h

Saner transition plan for GENERIC_SIGALTSTACK conversion - instead of
adding #define sys_sigaltstack sys_sigaltstack in asm/syscalls.h of
architecture if it's pulls asm-generic/syscalls.h, only to have those
defines removed once all architectures are converted, make the
declaration in said asm-generic/syscalls.h conditional on the lack
of GENERIC_SIGALTSTACK.  Less messy in intermediate stages that way...

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: james.hogan@imgtec.com
Cc: arnd@arndb.de
Cc: torvalds@linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
switch compat_sys_sigaltstack() to COMPAT_SYSCALL_DEFINE

Makes sigaltstack conversion easier to split into per-architecture
parts.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
switch compat_sys_wait4() and compat_sys_waitid() to COMPAT_SYSCALL_DEFINE

Strictly speaking, ppc64 needs it for C ABI compliance.  Realistically
I would be very surprised if e.g. passing 0xffffffff as 'options'
argument to waitid() from 32bit task would cause problems, but yes,
it puts us into undefined behaviour territory.  ppc64 expects int
argument to be passed in 64bit register with bits 31..63 containing
the same value.  SYSCALL_DEFINE on ppc provides a wrapper that normalizes
the value passed from userland; so does COMPAT_SYSCALL_DEFINE.  Plain
declaration of compat_sys_something() with an int argument obviously
doesn't.  Again, for wait4 and waitid I would be extremely surprised
if gcc started to produce code depending on that value having been
properly sign-extended - the argument(s) in question end up passed
blindly to sys_wait4 and sys_waitid resp. and normalization for native
syscalls takes care of their use there.  Still, better to use
COMPAT_SYSCALL_DEFINE here than worry about nasal daemons...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
x32: fix waitid()

It needs 64bit rusage and 32bit siginfo.  glibc never calls it with
non-NULL rusage pointer, or we would've seen breakage already...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
x32: fix sigtimedwait

It needs 64bit timespec.  As it is, we end up truncating the timeout
to whole seconds; usually it doesn't matter, but for having all
sub-second timeouts truncated to one jiffy is visibly wrong.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
virtio-blk: Don't free ida when disk is in use

When a file system is mounted on a virtio-blk disk, we then remove it
and then reattach it, the reattached disk gets the same disk name and
ids as the hot removed one.

This leads to very nasty effects - mostly rendering the newly attached
device completely unusable.

Trying what happens when I do the same thing with a USB device, I saw
that the sd node simply doesn't get free'd when a device gets forcefully
removed.

Imitate the same behavior for vd devices. This way broken vd devices
simply are never free'd and newly attached ones keep working just fine.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: stable@kernel.org
module: prevent warning when finit_module a 0 sized file

If we try to finit_module on a file sized 0 bytes vmalloc will
scream and spit out a warning.

Since modules have to be bigger than 0 bytes anyways we can just
check that beforehand and avoid the warning.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
m68knommu: add KMAP definitions for non-MMU definitions

To be consistent with the set of MMU definitions we should define KMAP_START
and KMAP_END. Future common m68k code will use their values.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
m68k: fix conditional use of init_pointer_table

Compiling 3.8-rc1 fails for some m68k targets (the non-mmu ones) with:

  CC      arch/m68k/mm/init.o
arch/m68k/mm/init.c: In function ‘mem_init’:
arch/m68k/mm/init.c:191:2: error: implicit declaration of function ‘init_pointer_table’
arch/m68k/mm/init.c:191:36: error: ‘kernel_pg_dir’ undeclared (first use in this function)
arch/m68k/mm/init.c:191:36: note: each undeclared identifier is reported only once for each function it appears in
arch/m68k/mm/init.c:192:18: error: ‘PTRS_PER_PGD’ undeclared (first use in this function)
arch/m68k/mm/init.c:194:4: error: implicit declaration of function ‘__pgd_page’
arch/m68k/mm/init.c:198:6: error: ‘zero_pgtable’ undeclared (first use in this function)
make[2]: *** [arch/m68k/mm/init.o] Error 1
make[1]: *** [arch/m68k/mm] Error 2
make[1]: Leaving directory `/home/gerg/new-wave.git/linux-3.x'
make: *** [linux] Error 1

Change the conditions that define init_pointer_table so that it matches what
actually uses it.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
target: use correct sense code for LUN communication failure

The ASC/ASCQ code for 'Logical Unit Communication failure' is
0x08/0x00; 0x80/0x00 is vendor specific.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Nicholas Bellinger <nab@risingtidesystems.com>
Cc: stable@vger.kernel.org
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
iio: mxs-lradc: indexes are unsigned

Fix the following warning when building with W=1 option:

drivers/staging/iio/adc/mxs-lradc.c: In function 'mxs_lradc_trigger_handler':
drivers/staging/iio/adc/mxs-lradc.c:244:2: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging:iio:adis16080: Perform sign extension

The adis16080 reports sample values in twos complement. So we need to perform a
sign extension on the result, otherwise negative values will be reported
incorrectly as large positive values.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
arm64: vdso: remove broken, redundant sequence counting for timezones

This patch is an arm64 version of ce73ec6db47a ("powerpc/vdso: Remove
redundant locking in update_vsyscall_tz()").

Timezone data is not protected, so the sequence counter is not required
to ensure consistency. Furthermore, having multiple paths updating the
counter leads to a race between update_vsyscall and update_vsyscall_tz,
so remove the timezone sequence counting from both the kernel and the
vdso.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arm64: mm: only wrprotect clean ptes if they are present

Marking non-present ptes as read-only can corrupt file ptes, breaking
things like swap and file mappings.

This patch ensures that we only manipulate user pte bits when the pte
is marked present.

Cc: <stable@vger.kernel.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arm64: mm: introduce present, faulting entries for PAGE_NONE

This is mostly a port of dbf62d50067e ("ARM: mm: introduce L_PTE_VALID
for page table entries") and 26ffd0d43b18 ("ARM: mm: introduce present,
faulting entries for PAGE_NONE") from ARM, which makes use of present,
faulting page table entries for page table entries mapped as PROT_NONE.

The main difference with this implementation is that we can make use of
the two pte type bits in order to avoid allocating a software bit for
identifying PROT_NONE pages, instead reserving the 10b suffix for these
types of mappings.

This is required to prevent users from accessing such pages via syscalls
such as read/write over a pipe.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
s390/kvm: Fix BUG in include/linux/kvm_host.h:745

commit b080935c8638e08134629d0a9ebdf35669bec14d
    kvm: Directly account vtime to system on guest switch

also removed the irq_disable/enable around kvm guest switch, which
is correct in itself. Unfortunately, there is a BUG ON that (correctly)
checks for preemptible to cover the call to rcu later on.
(Introduced with commit 8fa2206821953a50a3a02ea33fcfb3ced2fd9997
    KVM: make guest mode entry to be rcu quiescent state)

This check might trigger depending on the kernel config.
Lets make sure that no preemption happens during kvm_guest_enter.
We can enable preemption again after the call to
rcu_virt_note_context_switch returns.

Please note that we continue to run s390 guests with interrupts
enabled.

Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
CC: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
target: Introduce TCM_NO_SENSE

Introduce TCM_NO_SENSE, mapping to sense code
'Not ready, no additional sense information'.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Nicholas Bellinger <nab@risingtidesystems.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
target: Use TCM_NO_SENSE for initialisation

The compiler complained about uninitialized variables, so
use TCM_NO_SENSE here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Nicholas Bellinger <nab@risingtidesystems.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>