[RFC PATCH v2 0/3] vfio-pci: Allow to mmap sub-page MMIO BARs and MSI-X table on PPC64 platform

2015-12-31 Thread Yongji Xie
Current vfio-pci implementation disallows to mmap sub-page(size < PAGE_SIZE) MMIO BARs and MSI-X table. This is because sub-page BARs' mmio page may be shared with other BARs and MSI-X table should not be accessed directly from the guest for security reasons. But these will easily cause some perfo

[RFC PATCH v2 1/3] PCI: Add support for enforcing all MMIO BARs to be page aligned

2015-12-31 Thread Yongji Xie
When vfio passthrough a PCI device of which MMIO BARs are smaller than PAGE_SIZE, guest will not handle the mmio accesses to the BARs which leads to mmio emulations in host. This is because vfio will not allow to passthrough one BAR's mmio page which may be shared with other BARs. To solve this p

[RFC PATCH v2 3/3] vfio-pci: Allow to mmap MSI-X table if EEH is supported

2015-12-31 Thread Yongji Xie
Current vfio-pci implementation disallows to mmap MSI-X table in case that user get to touch this directly. However, EEH mechanism can ensure that a given pci device can only shoot the MSIs assigned for its PE. So we think it's safe to expose the MSI-X table to userspace because the exposed MSI-X

[RFC PATCH v2 2/3] vfio-pci: Allow to mmap sub-page MMIO BARs if all MMIO BARs are page aligned

2015-12-31 Thread Yongji Xie
Current vfio-pci implementation disallows to mmap sub-page(size < PAGE_SIZE) MMIO BARs because these BARs' mmio page may be shared with other BARs. But we should allow to mmap these sub-page MMIO BARs if PCI resource allocator enforces the alignment of all MMIO BARs to be at least PAGE_SIZE. Sign

[PATCH][v2] mpc85xx/lbc: modify suspend/resume entry sequence

2015-12-31 Thread Raghav Dogra
Modify platform driver suspend/resume to syscore suspend/resume. This is because p1022ds needs to use localbus when entering the PCIE resume. Signed-off-by: Raghav Dogra --- changes for v2: return type correction arch/powerpc/sysdev/Makefile | 2 +- arch/powerpc/sysdev/fsl_lbc.c | 49

[PATCH v2 00/34] arch: barrier cleanup + barriers for virt

2015-12-31 Thread Michael S. Tsirkin
Changes since v1: - replaced my asm-generic patch with an equivalent patch already in tip - add wrappers with virt_ prefix for better code annotation, as suggested by David Miller - dropped XXX in patch names as this makes vger choke, Cc all relevant mail

[PATCH v2 01/32] lcoking/barriers, arch: Use smp barriers in smp_store_release()

2015-12-31 Thread Michael S. Tsirkin
From: Davidlohr Bueso With commit b92b8b35a2e ("locking/arch: Rename set_mb() to smp_store_mb()") it was made clear that the context of this call (and thus set_mb) is strictly for CPU ordering, as opposed to IO. As such all archs should use the smp variant of mb(), respecting the semantics and sa

[PATCH v2 02/32] asm-generic: guard smp_store_release/load_acquire

2015-12-31 Thread Michael S. Tsirkin
Allow architectures to override smp_store_release and smp_load_acquire by guarding the defines in asm-generic/barrier.h with ifndef directives. This is in preparation to reusing asm-generic/barrier.h on architectures which have their own definition of these macros. Signed-off-by: Michael S. Tsirk

[PATCH v2 03/32] ia64: rename nop->iosapic_nop

2015-12-31 Thread Michael S. Tsirkin
asm-generic/barrier.h defines a nop() macro. To be able to use this header on ia64, we shouldn't call local functions/variables nop(). There's one instance where this breaks on ia64: rename the function to iosapic_nop to avoid the conflict. Signed-off-by: Michael S. Tsirkin Acked-by: Tony Luck

[PATCH v2 04/32] ia64: reuse asm-generic/barrier.h

2015-12-31 Thread Michael S. Tsirkin
On ia64 smp_rmb, smp_wmb, read_barrier_depends, smp_read_barrier_depends and smp_store_mb() match the asm-generic variants exactly. Drop the local definitions and pull in asm-generic/barrier.h instead. This is in preparation to refactoring this code area. Signed-off-by: Michael S. Tsirkin Acked-

[PATCH v2 05/32] powerpc: reuse asm-generic/barrier.h

2015-12-31 Thread Michael S. Tsirkin
On powerpc read_barrier_depends, smp_read_barrier_depends smp_store_mb(), smp_mb__before_atomic and smp_mb__after_atomic match the asm-generic variants exactly. Drop the local definitions and pull in asm-generic/barrier.h instead. This is in preparation to refactoring this code area. Signed-off-b

[PATCH v2 06/32] s390: reuse asm-generic/barrier.h

2015-12-31 Thread Michael S. Tsirkin
On s390 read_barrier_depends, smp_read_barrier_depends smp_store_mb(), smp_mb__before_atomic and smp_mb__after_atomic match the asm-generic variants exactly. Drop the local definitions and pull in asm-generic/barrier.h instead. This is in preparation to refactoring this code area. Signed-off-by:

[PATCH v2 07/32] sparc: reuse asm-generic/barrier.h

2015-12-31 Thread Michael S. Tsirkin
On sparc 64 bit dma_rmb, dma_wmb, smp_store_mb, smp_mb, smp_rmb, smp_wmb, read_barrier_depends and smp_read_barrier_depends match the asm-generic variants exactly. Drop the local definitions and pull in asm-generic/barrier.h instead. nop uses __asm__ __volatile but is otherwise identical to the ge

[PATCH v2 08/32] arm: reuse asm-generic/barrier.h

2015-12-31 Thread Michael S. Tsirkin
On arm smp_store_mb, read_barrier_depends, smp_read_barrier_depends, smp_store_release, smp_load_acquire, smp_mb__before_atomic and smp_mb__after_atomic match the asm-generic variants exactly. Drop the local definitions and pull in asm-generic/barrier.h instead. This is in preparation to refactori

[PATCH v2 09/32] arm64: reuse asm-generic/barrier.h

2015-12-31 Thread Michael S. Tsirkin
On arm64 nop, read_barrier_depends, smp_read_barrier_depends smp_store_mb(), smp_mb__before_atomic and smp_mb__after_atomic match the asm-generic variants exactly. Drop the local definitions and pull in asm-generic/barrier.h instead. This is in preparation to refactoring this code area. Signed-of

[PATCH v2 10/32] metag: reuse asm-generic/barrier.h

2015-12-31 Thread Michael S. Tsirkin
On metag dma_rmb, dma_wmb, smp_store_mb, read_barrier_depends, smp_read_barrier_depends, smp_store_release and smp_load_acquire match the asm-generic variants exactly. Drop the local definitions and pull in asm-generic/barrier.h instead. This is in preparation to refactoring this code area. Sign

[PATCH v2 11/32] mips: reuse asm-generic/barrier.h

2015-12-31 Thread Michael S. Tsirkin
On mips dma_rmb, dma_wmb, smp_store_mb, read_barrier_depends, smp_read_barrier_depends, smp_store_release and smp_load_acquire match the asm-generic variants exactly. Drop the local definitions and pull in asm-generic/barrier.h instead. This is in preparation to refactoring this code area. Signe

[PATCH v2 12/32] x86/um: reuse asm-generic/barrier.h

2015-12-31 Thread Michael S. Tsirkin
On x86/um CONFIG_SMP is never defined. As a result, several macros match the asm-generic variant exactly. Drop the local definitions and pull in asm-generic/barrier.h instead. This is in preparation to refactoring this code area. Signed-off-by: Michael S. Tsirkin Acked-by: Arnd Bergmann --- a

[PATCH v2 13/32] x86: reuse asm-generic/barrier.h

2015-12-31 Thread Michael S. Tsirkin
As on most architectures, on x86 read_barrier_depends and smp_read_barrier_depends are empty. Drop the local definitions and pull the generic ones from asm-generic/barrier.h instead: they are identical. This is in preparation to refactoring this code area. Signed-off-by: Michael S. Tsirkin Acke

[PATCH v2 14/32] asm-generic: add __smp_xxx wrappers

2015-12-31 Thread Michael S. Tsirkin
On !SMP, most architectures define their barriers as compiler barriers. On SMP, most need an actual barrier. Make it possible to remove the code duplication for !SMP by defining low-level __smp_xxx barriers which do not depend on the value of SMP, then use them from asm-generic conditionally. Bes

[PATCH v2 15/32] powerpc: define __smp_xxx

2015-12-31 Thread Michael S. Tsirkin
This defines __smp_xxx barriers for powerpc for use by virtualization. smp_xxx barriers are removed as they are defined correctly by asm-generic/barriers.h This reduces the amount of arch-specific boiler-plate code. Signed-off-by: Michael S. Tsirkin Acked-by: Arnd Bergmann --- arch/powerpc/in

[PATCH v2 16/32] arm64: define __smp_xxx

2015-12-31 Thread Michael S. Tsirkin
This defines __smp_xxx barriers for arm64, for use by virtualization. smp_xxx barriers are removed as they are defined correctly by asm-generic/barriers.h Note: arm64 does not support !SMP config, so smp_xxx and __smp_xxx are always equivalent. Signed-off-by: Michael S. Tsirkin Acked-by: Arnd B

[PATCH v2 17/32] arm: define __smp_xxx

2015-12-31 Thread Michael S. Tsirkin
This defines __smp_xxx barriers for arm, for use by virtualization. smp_xxx barriers are removed as they are defined correctly by asm-generic/barriers.h This reduces the amount of arch-specific boiler-plate code. Signed-off-by: Michael S. Tsirkin Acked-by: Arnd Bergmann --- arch/arm/include/a

[PATCH v2 18/32] blackfin: define __smp_xxx

2015-12-31 Thread Michael S. Tsirkin
This defines __smp_xxx barriers for blackfin, for use by virtualization. smp_xxx barriers are removed as they are defined correctly by asm-generic/barriers.h Signed-off-by: Michael S. Tsirkin Acked-by: Arnd Bergmann --- arch/blackfin/include/asm/barrier.h | 4 ++-- 1 file changed, 2 insertions

[PATCH v2 19/32] ia64: define __smp_xxx

2015-12-31 Thread Michael S. Tsirkin
This defines __smp_xxx barriers for ia64, for use by virtualization. smp_xxx barriers are removed as they are defined correctly by asm-generic/barriers.h This reduces the amount of arch-specific boiler-plate code. Signed-off-by: Michael S. Tsirkin Acked-by: Tony Luck Acked-by: Arnd Bergmann -

[PATCH v2 20/32] metag: define __smp_xxx

2015-12-31 Thread Michael S. Tsirkin
This defines __smp_xxx barriers for metag, for use by virtualization. smp_xxx barriers are removed as they are defined correctly by asm-generic/barriers.h Note: as __smp_XX macros should not depend on CONFIG_SMP, they can not use the existing fence() macro since that is defined differently betwee

[PATCH v2 21/32] mips: define __smp_xxx

2015-12-31 Thread Michael S. Tsirkin
This defines __smp_xxx barriers for mips, for use by virtualization. smp_xxx barriers are removed as they are defined correctly by asm-generic/barriers.h Note: the only exception is smp_mb__before_llsc which is mips-specific. We define both the __smp_mb__before_llsc variant (for use in asm/barrie

[PATCH v2 22/32] s390: define __smp_xxx

2015-12-31 Thread Michael S. Tsirkin
This defines __smp_xxx barriers for s390, for use by virtualization. Some smp_xxx barriers are removed as they are defined correctly by asm-generic/barriers.h Note: smp_mb, smp_rmb and smp_wmb are defined as full barriers unconditionally on this architecture. Signed-off-by: Michael S. Tsirkin A

[PATCH v2 23/32] sh: define __smp_xxx, fix smp_store_mb for !SMP

2015-12-31 Thread Michael S. Tsirkin
sh variant of smp_store_mb() calls xchg() on !SMP which is stronger than implied by both the name and the documentation. define __smp_store_mb instead: code in asm-generic/barrier.h will then define smp_store_mb correctly depending on CONFIG_SMP. Signed-off-by: Michael S. Tsirkin Acked-by: Arnd

[PATCH v2 24/32] sparc: define __smp_xxx

2015-12-31 Thread Michael S. Tsirkin
This defines __smp_xxx barriers for sparc, for use by virtualization. smp_xxx barriers are removed as they are defined correctly by asm-generic/barriers.h Signed-off-by: Michael S. Tsirkin Acked-by: Arnd Bergmann --- arch/sparc/include/asm/barrier_64.h | 8 1 file changed, 4 insertion

[PATCH v2 25/32] tile: define __smp_xxx

2015-12-31 Thread Michael S. Tsirkin
This defines __smp_xxx barriers for tile, for use by virtualization. Some smp_xxx barriers are removed as they are defined correctly by asm-generic/barriers.h Note: for 32 bit, keep smp_mb__after_atomic around since it's faster than the generic implementation. Signed-off-by: Michael S. Tsirkin

[PATCH v2 26/32] xtensa: define __smp_xxx

2015-12-31 Thread Michael S. Tsirkin
This defines __smp_xxx barriers for xtensa, for use by virtualization. smp_xxx barriers are removed as they are defined correctly by asm-generic/barriers.h Signed-off-by: Michael S. Tsirkin Acked-by: Arnd Bergmann --- arch/xtensa/include/asm/barrier.h | 4 ++-- 1 file changed, 2 insertions(+),

[PATCH v2 27/32] x86: define __smp_xxx

2015-12-31 Thread Michael S. Tsirkin
This defines __smp_xxx barriers for x86, for use by virtualization. smp_xxx barriers are removed as they are defined correctly by asm-generic/barriers.h Signed-off-by: Michael S. Tsirkin Acked-by: Arnd Bergmann --- arch/x86/include/asm/barrier.h | 31 --- 1 file cha

[PATCH v2 28/32] asm-generic: implement virt_xxx memory barriers

2015-12-31 Thread Michael S. Tsirkin
Guests running within virtual machines might be affected by SMP effects even if the guest itself is compiled without SMP support. This is an artifact of interfacing with an SMP host while running an UP kernel. Using mandatory barriers for this use-case would be possible but is often suboptimal.

[PATCH v2 29/32] Revert "virtio_ring: Update weak barriers to use dma_wmb/rmb"

2015-12-31 Thread Michael S. Tsirkin
This reverts commit 9e1a27ea42691429e31f158cce6fc61bc79bb2e9. While that commit optimizes !CONFIG_SMP, it mixes up DMA and SMP concepts, making the code hard to figure out. A better way to optimize this is with the new __smp_XXX barriers. As a first step, go back to full rmb/wmb barriers for !SM

[PATCH v2 30/32] virtio_ring: update weak barriers to use __smp_XXX

2015-12-31 Thread Michael S. Tsirkin
virtio ring uses smp_wmb on SMP and wmb on !SMP, the reason for the later being that it might be talking to another kernel on the same SMP machine. This is exactly what __smp_XXX barriers do, so switch to these instead of homegrown ifdef hacks. Cc: Peter Zijlstra Cc: Alexander Duyck Signed-off-

[PATCH v2 31/32] sh: support a 2-byte smp_store_mb

2015-12-31 Thread Michael S. Tsirkin
At the moment, xchg on sh only supports 4 and 1 byte values, so using it from smp_store_mb means attempts to store a 2 byte value using this macro fail. And happens to be exactly what virtio drivers want to do. Check size and fall back to a slower, but safe, WRITE_ONCE+smp_mb. Signed-off-by: Mic

[PATCH v2 32/32] virtio_ring: use virt_store_mb

2015-12-31 Thread Michael S. Tsirkin
We need a full barrier after writing out event index, using virt_store_mb there seems better than open-coding. As usual, we need a wrapper to account for strong barriers. It's tempting to use this in vhost as well, for that, we'll need a variant of smp_store_mb that works on __user pointers. Sig

[PATCH v2 33/34] xenbus: use virt_xxx barriers

2015-12-31 Thread Michael S. Tsirkin
drivers/xen/xenbus/xenbus_comms.c uses full memory barriers to communicate with the other side. For guests compiled with CONFIG_SMP, smp_wmb and smp_mb would be sufficient, so mb() and wmb() here are only needed if a non-SMP guest runs on an SMP host. Switch to virt_xxx barriers which serve this

[PATCH v2 34/34] xen/io: use virt_xxx barriers

2015-12-31 Thread Michael S. Tsirkin
include/xen/interface/io/ring.h uses full memory barriers to communicate with the other side. For guests compiled with CONFIG_SMP, smp_wmb and smp_mb would be sufficient, so mb() and wmb() here are only needed if a non-SMP guest runs on an SMP host. Switch to virt_xxx barriers which serve this ex

Re: [PATCH v2 07/32] sparc: reuse asm-generic/barrier.h

2015-12-31 Thread David Miller
From: "Michael S. Tsirkin" Date: Thu, 31 Dec 2015 21:06:38 +0200 > On sparc 64 bit dma_rmb, dma_wmb, smp_store_mb, smp_mb, smp_rmb, > smp_wmb, read_barrier_depends and smp_read_barrier_depends match the > asm-generic variants exactly. Drop the local definitions and pull in > asm-generic/barrier.h

Re: [PATCH v2 24/32] sparc: define __smp_xxx

2015-12-31 Thread David Miller
From: "Michael S. Tsirkin" Date: Thu, 31 Dec 2015 21:08:53 +0200 > This defines __smp_xxx barriers for sparc, > for use by virtualization. > > smp_xxx barriers are removed as they are > defined correctly by asm-generic/barriers.h > > Signed-off-by: Michael S. Tsirkin > Acked-by: Arnd Bergmann

[PATCH] MAINTAINERS: Update Scott Wood's e-mail address

2015-12-31 Thread Scott Wood
Freescale is now NXP. I still work there, but I won't be using their mail system for Linux development. Signed-off-by: Scott Wood --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 8099527..124dd37 100644 --- a/MAINTAINERS +++ b/M