[PATCH v5 4/7] vfio: platform: reset: calxedaxgmac: add reset function registration

2015-10-28 Thread Eric Auger
This patch adds the reset function registration/unregistration. This is handled through the module_vfio_reset_handler macro. This latter also defines a MODULE_ALIAS which simplifies the load from vfio-platform. Signed-off-by: Eric Auger Reviewed-by: Arnd Bergmann

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread Michael S. Tsirkin
On Wed, Oct 28, 2015 at 05:36:53PM +0900, Benjamin Herrenschmidt wrote: > On Wed, 2015-10-28 at 16:40 +0900, Christian Borntraeger wrote: > > We have discussed that at kernel summit. I will try to implement a dummy > > dma_ops for > > s390 that does 1:1 mapping and Ben will look into doing some

[PATCH v4] VFIO: platform: reset: AMD xgbe reset module

2015-10-28 Thread Eric Auger
This patch introduces a module that registers and implements a low-level reset function for the AMD XGBE device. it performs the following actions: - reset the PHY - disable auto-negotiation - disable & clear auto-negotiation IRQ - soft-reset the MAC Those tiny pieces of code are inherited from

[PATCH v5 2/7] vfio: platform: add capability to register a reset function

2015-10-28 Thread Eric Auger
In preparation for subsequent changes in reset function lookup, lets introduce a dynamic list of reset combos (compat string, reset module, reset function). The list can be populated/voided with vfio_platform_register/unregister_reset. Those are not yet used in this patch. Signed-off-by: Eric

[PATCH v5 3/7] vfio: platform: introduce module_vfio_reset_handler macro

2015-10-28 Thread Eric Auger
The module_vfio_reset_handler macro - define a module alias - implement module init/exit function which respectively registers and unregisters the reset function. Signed-off-by: Eric Auger Reviewed-by: Arnd Bergmann --- v4 -> v5: - add Arnd's R-b v3 ->

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread Michael S. Tsirkin
On Wed, Oct 28, 2015 at 05:09:47PM +0900, David Woodhouse wrote: > On Wed, 2015-10-28 at 16:40 +0900, Christian Borntraeger wrote: > > Am 28.10.2015 um 16:17 schrieb Michael S. Tsirkin: > > > On Tue, Oct 27, 2015 at 11:38:57PM -0700, Andy Lutomirski wrote: > > > > This switches virtio to use the

Re: [PATCH v1 2/2] dma-mapping-common: add DMA attribute - DMA_ATTR_IOMMU_BYPASS

2015-10-28 Thread David Woodhouse
On Wed, 2015-10-28 at 13:10 +0200, Shamir Rabinovitch wrote: > On Wed, Oct 28, 2015 at 03:30:01PM +0900, David Woodhouse wrote: > > > > +For systems with IOMMU it is assumed all DMA translations use the > > > > IOMMU. > > > > Not entirely true. We have per-device dma_ops on a most architectures

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread David Woodhouse
On Wed, 2015-10-28 at 13:35 +0200, Michael S. Tsirkin wrote: > E.g. on intel x86, there's an option iommu=pt which does the 1:1 > thing for devices when used by kernel, but enables > the iommu if used by userspace/VMs. That's none of your business. You call the DMA API when you do DMA. That's

Re: virtio assisted migration

2015-10-28 Thread Dave Young
On 10/28/15 at 10:27am, Stefan Hajnoczi wrote: > On Sat, Oct 24, 2015 at 05:21:01PM +0800, Dave Young wrote: > > * block device > > For block storage migration, the problem is similar as memory. The original > > migration does not consider storage usage ratio it just copy all the > > sectors. >

Re: [PATCH v1 2/2] dma-mapping-common: add DMA attribute - DMA_ATTR_IOMMU_BYPASS

2015-10-28 Thread David Miller
From: David Woodhouse Date: Wed, 28 Oct 2015 22:31:50 +0900 > On Wed, 2015-10-28 at 13:10 +0200, Shamir Rabinovitch wrote: >> On Wed, Oct 28, 2015 at 03:30:01PM +0900, David Woodhouse wrote: >> > > > +For systems with IOMMU it is assumed all DMA translations use the >> > >

[PATCH v5 1/7] vfio: platform: introduce vfio-platform-base module

2015-10-28 Thread Eric Auger
To prepare for vfio platform reset rework let's build vfio_platform_common.c and vfio_platform_irq.c in a separate module from vfio-platform and vfio-amba. This makes possible to have separate module inits and works around a race between platform driver init and vfio reset module init: that way we

[PATCH v5 0/7] VFIO platform reset module rework

2015-10-28 Thread Eric Auger
This series fixes the current implementation by getting rid of the usage of __symbol_get which caused a compilation issue with CONFIG_MODULES disabled. On top of this, the usage of MODULE_ALIAS makes possible to add a new reset module without being obliged to update the framework. The new

[RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-28 Thread Eric Auger
Current vfio_pgsize_bitmap code hides the supported IOMMU page sizes smaller than PAGE_SIZE. As a result, in case the IOMMU does not support PAGE_SIZE page, the alignment check on map/unmap is done with larger page sizes, if any. This can fail although mapping could be done with pages smaller than

Re: [PATCH v1 2/2] dma-mapping-common: add DMA attribute - DMA_ATTR_IOMMU_BYPASS

2015-10-28 Thread Shamir Rabinovitch
On Wed, Oct 28, 2015 at 03:30:01PM +0900, David Woodhouse wrote: > > > +For systems with IOMMU it is assumed all DMA translations use the IOMMU. > > Not entirely true. We have per-device dma_ops on a most architectures > already, and we were just talking about the need to add them to >

RE: [PATCH v5 0/7] KVM: arm64: Implement API for vGICv3 live migration

2015-10-28 Thread Pavel Fedin
Hello! > > v4 => v5: > > - Adapted to new API by Peter Maydell, Marc Zyngier and Christoffer Dall. > > Acked-by's on the documentation were dropped, just in case, because i > > slightly adjusted it. Additionally, i merged all doc updates into one > > patch. > > Could you tell us what you

[PATCH v5 5/7] vfio: platform: add compat in vfio_platform_device

2015-10-28 Thread Eric Auger
Let's retrieve the compatibility string on probe and store it in the vfio_platform_device struct Signed-off-by: Eric Auger --- v2 -> v3: - populate compat after vdev check --- drivers/vfio/platform/vfio_platform_common.c | 15 ---

[PATCH v5 7/7] vfio: platform: add dev_info on device reset

2015-10-28 Thread Eric Auger
It might be helpful for the end-user to check the device reset function was found by the vfio platform reset framework. Lets store a pointer to the struct device in vfio_platform_device and trace when the reset function is called or not found. Signed-off-by: Eric Auger

[PATCH v5 6/7] vfio: platform: use list of registered reset function

2015-10-28 Thread Eric Auger
Remove the static lookup table and use the dynamic list of registered reset functions instead. Also load the reset module through its alias. The reset struct module pointer is stored in vfio_platform_device. We also remove the useless struct device pointer parameter in vfio_platform_get_reset.

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread David Woodhouse
On Wed, 2015-10-28 at 13:23 +0200, Michael S. Tsirkin wrote: > On Wed, Oct 28, 2015 at 05:36:53PM +0900, Benjamin Herrenschmidt > wrote: > > On Wed, 2015-10-28 at 16:40 +0900, Christian Borntraeger wrote: > > > We have discussed that at kernel summit. I will try to implement > > > a dummy dma_ops

[PATCH v5 13/33] pc-dimm: make pc_existing_dimms_capacity static and rename it

2015-10-28 Thread Xiao Guangrong
pc_existing_dimms_capacity() can be static since it is not used out of pc-dimm.c and drop the pc_ prefix to prepare the work which abstracts dimm device type from pc-dimm Signed-off-by: Xiao Guangrong --- hw/mem/pc-dimm.c | 73

[PATCH v5 11/33] hostmem-file: use whole file size if possible

2015-10-28 Thread Xiao Guangrong
Use the whole file size if @size is not specified which is useful if we want to directly pass a file to guest Signed-off-by: Xiao Guangrong --- backends/hostmem-file.c | 48 1 file changed, 44 insertions(+), 4

[PATCH v5 30/33] nvdimm acpi: support Set Namespace Label Data function

2015-10-28 Thread Xiao Guangrong
Function 6 is used to set Namespace Label Data Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c | 41 + 1 file changed, 41 insertions(+) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index 5b621ed..5e72ca8 100644 ---

[PATCH v5 04/33] acpi: add aml_concatenate

2015-10-28 Thread Xiao Guangrong
Implement Concatenate term which is used by NVDIMM _DSM method in later patch Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 14 ++ include/hw/acpi/aml-build.h | 1 + 2 files changed, 15 insertions(+) diff --git

[PATCH v5 01/33] acpi: add aml_derefof

2015-10-28 Thread Xiao Guangrong
Implement DeRefOf term which is used by NVDIMM _DSM method in later patch Reviewed-by: Igor Mammedov Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 8 include/hw/acpi/aml-build.h | 1 + 2 files changed, 9

[PATCH v5 00/33] implement vNVDIMM

2015-10-28 Thread Xiao Guangrong
This patchset can be found at: https://github.com/xiaogr/qemu.git nvdimm-v5 It is based on pci branch on Michael's tree and the top commit is: commit 04040096 (tests: re-enable vhost-user-test). Changelog in v5: - changes from Michael's comments: 1) prefix nvdimm_ to everything in NVDIMM

[PATCH v5 27/33] nvdimm acpi: support function 0

2015-10-28 Thread Xiao Guangrong
__DSM is defined in ACPI 6.0: 9.14.1 _DSM (Device Specific Method) Function 0 is a query function. We do not support any function on root device and only 3 functions are support for NVDIMM device, Get Namespace Label Size, Get Namespace Label Data and Set Namespace Label Data, that means we

[PATCH v5 05/33] acpi: add aml_object_type

2015-10-28 Thread Xiao Guangrong
Implement ObjectType which is used by NVDIMM _DSM method in later patch Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 8 include/hw/acpi/aml-build.h | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/acpi/aml-build.c

[PATCH v5 20/33] dimm: introduce realize callback

2015-10-28 Thread Xiao Guangrong
nvdimm need check if the backend memory is large enough to contain label data and init its memory region when the device is realized, so introduce realize callback which is called after common dimm has been realize Signed-off-by: Xiao Guangrong --- hw/mem/dimm.c

[PATCH v5 06/33] acpi: add aml_method_serialized

2015-10-28 Thread Xiao Guangrong
It avoid explicit Mutex and will be used by NVDIMM ACPI Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 26 -- include/hw/acpi/aml-build.h | 1 + 2 files changed, 25 insertions(+), 2 deletions(-) diff --git

Re: [PATCH 3/3] x86: context_tracking: avoid irq_save/irq_restore on kernel entry and exit

2015-10-28 Thread Paolo Bonzini
On 28/10/2015 06:22, Andy Lutomirski wrote: >> > called by guest_enter and guest_exit. >> > >> > Use the previously introduced __context_tracking_entry and >> > __context_tracking_exit. > x86 isn't ready for this yet. We could do a quick-and-dirty fix with > explicit IRQs-on-and-off much

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread Michael S. Tsirkin
On Wed, Oct 28, 2015 at 10:37:56PM +0900, David Woodhouse wrote: > On Wed, 2015-10-28 at 13:23 +0200, Michael S. Tsirkin wrote: > > On Wed, Oct 28, 2015 at 05:36:53PM +0900, Benjamin Herrenschmidt > > wrote: > > > On Wed, 2015-10-28 at 16:40 +0900, Christian Borntraeger wrote: > > > > We have

[PATCH v5 07/33] util: introduce qemu_file_get_page_size()

2015-10-28 Thread Xiao Guangrong
There are three places use the some logic to get the page size on the file path or file fd This patch introduces qemu_file_get_page_size() to unify the code Signed-off-by: Xiao Guangrong --- include/qemu/osdep.h | 1 + target-ppc/kvm.c | 21

Re: [PATCH v1 2/2] dma-mapping-common: add DMA attribute - DMA_ATTR_IOMMU_BYPASS

2015-10-28 Thread David Woodhouse
On Wed, 2015-10-28 at 07:07 -0700, David Miller wrote: > In the sparc64 case, the 64-bit DMA address space is divided into > IOMMU translated and non-IOMMU translated. > > You just set the high bits differently depending upon what you want. Wait, does that mean a (rogue) device could *always*

[PATCH v5 22/33] docs: add NVDIMM ACPI documentation

2015-10-28 Thread Xiao Guangrong
It describes the basic concepts of NVDIMM ACPI and the interface between QEMU and the ACPI BIOS Signed-off-by: Xiao Guangrong --- docs/specs/acpi_nvdimm.txt | 179 + 1 file changed, 179 insertions(+) create mode 100644

Re: [PATCH v4 17/33] dimm: abstract dimm device from pc-dimm

2015-10-28 Thread Xiao Guangrong
On 10/24/2015 11:20 AM, Bharata B Rao wrote: CONFIG_ACPI_X86_ICH=y +CONFIG_DIMM=y Same change needs to be done in default-configs/ppc64-softmmu.mak too. I have fixed it in v5 which cat be found at: http://marc.info/?l=kvm=144604272221080=2 Bharata, thank you very much for your

[PATCH v5 14/33] pc-dimm: drop the prefix of pc-dimm

2015-10-28 Thread Xiao Guangrong
This patch is generated by this script: find ./ -name "*.[ch]" -o -name "*.json" -o -name "trace-events" -type f \ | xargs sed -i "s/PC_DIMM/DIMM/g" find ./ -name "*.[ch]" -o -name "*.json" -o -name "trace-events" -type f \ | xargs sed -i "s/PCDIMM/DIMM/g" find ./ -name "*.[ch]" -o -name

[PATCH v5 15/33] stubs: rename qmp_pc_dimm_device_list.c

2015-10-28 Thread Xiao Guangrong
Rename qmp_pc_dimm_device_list.c to qmp_dimm_device_list.c Signed-off-by: Xiao Guangrong --- stubs/Makefile.objs | 2 +- stubs/{qmp_pc_dimm_device_list.c => qmp_dimm_device_list.c} | 0 2 files changed, 1 insertion(+), 1

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread Michael S. Tsirkin
On Wed, Oct 28, 2015 at 11:13:29PM +0900, David Woodhouse wrote: > On Wed, 2015-10-28 at 16:05 +0200, Michael S. Tsirkin wrote: > > > > Short answer - platforms need a way to discover, and express different > > security requirements of different devices. > > Sure. PLATFORMS need that. Do not let

Re: [RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-28 Thread Will Deacon
On Wed, Oct 28, 2015 at 01:12:45PM +, Eric Auger wrote: > Current vfio_pgsize_bitmap code hides the supported IOMMU page > sizes smaller than PAGE_SIZE. As a result, in case the IOMMU > does not support PAGE_SIZE page, the alignment check on map/unmap > is done with larger page sizes, if any.

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread Michael S. Tsirkin
On Wed, Oct 28, 2015 at 10:35:27PM +0900, David Woodhouse wrote: > On Wed, 2015-10-28 at 13:35 +0200, Michael S. Tsirkin wrote: > > E.g. on intel x86, there's an option iommu=pt which does the 1:1 > > thing for devices when used by kernel, but enables > > the iommu if used by userspace/VMs. > >

[PATCH v5 28/33] nvdimm acpi: support Get Namespace Label Size function

2015-10-28 Thread Xiao Guangrong
Function 4 is used to get Namespace label size Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c | 87 +++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c

[PATCH v5 03/33] acpi: add aml_create_field

2015-10-28 Thread Xiao Guangrong
Implement CreateField term which is used by NVDIMM _DSM method in later patch Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 13 + include/hw/acpi/aml-build.h | 1 + 2 files changed, 14 insertions(+) diff --git a/hw/acpi/aml-build.c

[PATCH v5 26/33] nvdimm acpi: save arg3 for NVDIMM device _DSM method

2015-10-28 Thread Xiao Guangrong
Check if the input Arg3 is valid then store it into dsm_in if needed Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c | 27 ++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index

[PATCH v5 31/33] nvdimm: allow using whole backend memory as pmem

2015-10-28 Thread Xiao Guangrong
Introduce a parameter, named "reserve-label-data", if it is false which indicates that QEMU does not reserve any region on the backend memory to support label data. It is a 'label-less' NVDIMM device mode that linux will use whole memory on the device as a single namesapce This is useful for the

[PATCH v5 09/33] exec: allow file_ram_alloc to work on file

2015-10-28 Thread Xiao Guangrong
Currently, file_ram_alloc() only works on directory - it creates a file under @path and do mmap on it This patch tries to allow it to work on file directly, if @path is a directory it works as before, otherwise it treats @path as the target file then directly allocate memory from it

[PATCH v5 19/33] dimm: keep the state of the whole backend memory

2015-10-28 Thread Xiao Guangrong
QEMU keeps the state of memory of dimm device during live migration, however, it is not enough for nvdimm device as its memory does not contain its label data, so that we should protect the whole backend memory instead Signed-off-by: Xiao Guangrong ---

[PATCH v5 02/33] acpi: add aml_sizeof

2015-10-28 Thread Xiao Guangrong
Implement SizeOf term which is used by NVDIMM _DSM method in later patch Reviewed-by: Igor Mammedov Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 8 include/hw/acpi/aml-build.h | 1 + 2 files changed, 9

[PATCH v5 21/33] nvdimm: implement NVDIMM device abstract

2015-10-28 Thread Xiao Guangrong
Introduce "nvdimm" device which is based on dimm device type 128K memory region which is the minimum namespace label size required by NVDIMM Namespace Spec locates at the end of backend memory device is reserved for label data We can use "-m 1G,maxmem=100G,slots=10 -object memory-backend-file,

[PATCH v5 33/33] nvdimm: add maintain info

2015-10-28 Thread Xiao Guangrong
Add NVDIMM maintainer Signed-off-by: Xiao Guangrong --- MAINTAINERS | 7 +++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 9bd2b8f..a3c38cc 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -868,6 +868,13 @@ M: Jiri Pirko

[PATCH v5 23/33] nvdimm acpi: init the resource used by NVDIMM ACPI

2015-10-28 Thread Xiao Guangrong
A page staring from 0xFF0 and IO port 0x0a18 - 0xa1b in guest are reserved for NVDIMM ACPI emulation, refer to docs/specs/acpi_nvdimm.txt for detailed design A parameter, 'nvdimm-support', is introduced for PIIX4_PM and ICH9-LPC that controls if nvdimm support is enabled, it is true on

[PATCH v5 18/33] dimm: get mapped memory region from DIMMDeviceClass->get_memory_region

2015-10-28 Thread Xiao Guangrong
Curretly, the memory region of backed memory is directly mapped to guest's address space, however, it is not true for nvdimm device This patch let dimm device realize this fact and use DIMMDeviceClass->get_memory_region method to get the mapped memory region Signed-off-by: Xiao Guangrong

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread David Woodhouse
On Wed, 2015-10-28 at 16:05 +0200, Michael S. Tsirkin wrote: > > Short answer - platforms need a way to discover, and express different > security requirements of different devices. Sure. PLATFORMS need that. Do not let it go anywhere near your device drivers. Including the virtio drivers. > If

[PATCH v5 16/33] pc-dimm: rename pc-dimm.c and pc-dimm.h

2015-10-28 Thread Xiao Guangrong
Rename: pc-dimm.c => dimm.c pc-dimm.h => dimm.h It prepares the work which abstracts dimm device type for both pc-dimm and nvdimm Signed-off-by: Xiao Guangrong --- hw/Makefile.objs | 2 +- hw/acpi/ich9.c | 2 +-

[PATCH v5 32/33] nvdimm acpi: support _FIT method

2015-10-28 Thread Xiao Guangrong
FIT buffer is not completely mapped into guest address space, so a new function, Read FIT, function index 0x, is reserved by QEMU to read the piece of FIT buffer. The buffer is concatenated before _FIT return Refer to docs/specs/acpi-nvdimm.txt for detailed design Signed-off-by: Xiao

[PATCH v5 29/33] nvdimm acpi: support Get Namespace Label Data function

2015-10-28 Thread Xiao Guangrong
Function 5 is used to get Namespace Label Data Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c | 48 1 file changed, 48 insertions(+) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index 72203d2..5b621ed

[PATCH v5 12/33] pc-dimm: remove DEFAULT_PC_DIMMSIZE

2015-10-28 Thread Xiao Guangrong
It's not used any more Signed-off-by: Xiao Guangrong --- include/hw/mem/pc-dimm.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h index c1ee7b0..15590f1 100644 --- a/include/hw/mem/pc-dimm.h +++

[PATCH v5 10/33] hostmem-file: clean up memory allocation

2015-10-28 Thread Xiao Guangrong
- hostmem-file.c is compiled only if CONFIG_LINUX is enabled so that is unnecessary to do the same check in the source file - the interface, HostMemoryBackendClass->alloc(), is not called many times, do not need to check if the memory-region is initialized Signed-off-by: Xiao Guangrong

[PATCH v5 25/33] nvdimm acpi: build ACPI nvdimm devices

2015-10-28 Thread Xiao Guangrong
NVDIMM devices is defined in ACPI 6.0 9.20 NVDIMM Devices There is a root device under \_SB and specified NVDIMM devices are under the root device. Each NVDIMM device has _ADR which returns its handle used to associate MEMDEV structure in NFIT We reserve handle 0 for root device. In this patch,

[PATCH v5 08/33] exec: allow memory to be allocated from any kind of path

2015-10-28 Thread Xiao Guangrong
Currently file_ram_alloc() is designed for hugetlbfs, however, the memory of nvdimm can come from either raw pmem device eg, /dev/pmem, or the file locates at DAX enabled filesystem So this patch let it work on any kind of path Signed-off-by: Xiao Guangrong ---

[PATCH v5 24/33] nvdimm acpi: build ACPI NFIT table

2015-10-28 Thread Xiao Guangrong
NFIT is defined in ACPI 6.0: 5.2.25 NVDIMM Firmware Interface Table (NFIT) Currently, we only support PMEM mode. Each device has 3 structures: - SPA structure, defines the PMEM region info - MEM DEV structure, it has the @handle which is used to associate specified ACPI NVDIMM device we will

[PATCH v5 17/33] dimm: abstract dimm device from pc-dimm

2015-10-28 Thread Xiao Guangrong
A base device, dimm, is abstracted from pc-dimm, so that we can build nvdimm device based on dimm in the later patch Signed-off-by: Xiao Guangrong --- default-configs/i386-softmmu.mak | 1 + default-configs/ppc64-softmmu.mak | 1 +

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread David Woodhouse
On Wed, 2015-10-28 at 16:22 +0200, Michael S. Tsirkin wrote: > On Wed, Oct 28, 2015 at 11:13:29PM +0900, David Woodhouse wrote: > > On Wed, 2015-10-28 at 16:05 +0200, Michael S. Tsirkin wrote: > > > > > > Short answer - platforms need a way to discover, and express > > > different > > > security

Re: [PATCH] KVM: x86: fix eflags state following processor init/reset

2015-10-28 Thread Nadav Amit
Here are my 5 cents. Note that vmx_vcpu_reset calls: vmcs_writel(GUEST_RFLAGS, 0x02); (And the RFLAGS value is not cached by KVM, so no consistency problem should occur.) You may want to change the value into constant or call a wrapper function for setting RFLAGS, but I don’t see

Re: [PATCH v2 2/3] virtio_ring: Support DMA APIs

2015-10-28 Thread Christian Borntraeger
Am 28.10.2015 um 15:04 schrieb David Woodhouse: > On Wed, 2015-10-28 at 14:52 +0900, Christian Borntraeger wrote: >>0059b25a: e3201024 lg %r2,32(%r1) >> #0059b260: e310b0a4 lg %r1,160(%r11) >> >0059b266: 4810100c

Re: [PATCH 4/4] s390/virtio: use noop dma ops

2015-10-28 Thread Cornelia Huck
On Wed, 28 Oct 2015 09:43:34 +0900 Joerg Roedel wrote: > On Tue, Oct 27, 2015 at 11:48:51PM +0100, Christian Borntraeger wrote: > > @@ -1093,6 +1094,7 @@ static void virtio_ccw_auto_online(void *data, > > async_cookie_t cookie) > > struct ccw_device *cdev = data; > >

Re: [PATCH v1 2/2] dma-mapping-common: add DMA attribute - DMA_ATTR_IOMMU_BYPASS

2015-10-28 Thread David Woodhouse
On Sun, 2015-10-25 at 09:07 -0700, Shamir Rabinovitch wrote: > > + > +DMA_ATTR_IOMMU_BYPASS > +- > + > > +For systems with IOMMU it is assumed all DMA translations use the IOMMU. Not entirely true. We have per-device dma_ops on a most architectures already, and we were just

[PATCH v3 2/3] virtio_ring: Support DMA APIs

2015-10-28 Thread Andy Lutomirski
virtio_ring currently sends the device (usually a hypervisor) physical addresses of its I/O buffers. This is okay when DMA addresses and physical addresses are the same thing, but this isn't always the case. For example, this never works on Xen guests, and it is likely to fail if a physical

[PATCH v3 3/3] virtio_pci: Use the DMA API

2015-10-28 Thread Andy Lutomirski
This fixes virtio-pci on platforms and busses that have IOMMUs. This will break the experimental QEMU Q35 IOMMU support until QEMU is fixed. In exchange, it fixes physical virtio hardware as well as virtio-pci running under Xen. We should clean up the virtqueue API to do its own allocation and

[PATCH v3 1/3] virtio_net: Stop doing DMA from the stack

2015-10-28 Thread Andy Lutomirski
From: Andy Lutomirski Once virtio starts using the DMA API, we won't be able to safely DMA from the stack. virtio-net does a couple of config DMA requests from small stack buffers -- switch to using dynamically-allocated memory. This should have no effect on any

[PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread Andy Lutomirski
This switches virtio to use the DMA API unconditionally. I'm sure it breaks things, but it seems to work on x86 using virtio-pci, with and without Xen, and using both the modern 1.0 variant and the legacy variant. Changes from v2: - Fix really embarrassing bug. This version actually works.

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread David Woodhouse
On Tue, 2015-10-27 at 23:38 -0700, Andy Lutomirski wrote: > > Changes from v2: > - Fix really embarrassing bug. This version actually works. So embarrassing you didn't want to tell us what it was? ... --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -292,7 +292,7 @@

Re: [PATCH v2 1/3] virtio_net: Stop doing DMA from the stack

2015-10-28 Thread Michael S. Tsirkin
On Tue, Oct 27, 2015 at 10:30:19PM -0700, Andy Lutomirski wrote: > From: Andy Lutomirski > > Once virtio starts using the DMA API, we won't be able to safely DMA > from the stack. virtio-net does a couple of config DMA requests > from small stack buffers -- switch to using

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread Christian Borntraeger
Am 28.10.2015 um 16:17 schrieb Michael S. Tsirkin: > On Tue, Oct 27, 2015 at 11:38:57PM -0700, Andy Lutomirski wrote: >> This switches virtio to use the DMA API unconditionally. I'm sure >> it breaks things, but it seems to work on x86 using virtio-pci, with >> and without Xen, and using both the

Re: [PATCH v2 2/3] virtio_ring: Support DMA APIs

2015-10-28 Thread David Woodhouse
On Wed, 2015-10-28 at 14:52 +0900, Christian Borntraeger wrote: >0059b25a: e3201024 lg %r2,32(%r1) > #0059b260: e310b0a4 lg %r1,160(%r11) > >0059b266: 4810100c lh %r1,12(%r1) Precisely what is

Re: [PATCH v3 1/3] virtio_net: Stop doing DMA from the stack

2015-10-28 Thread Michael S. Tsirkin
On Tue, Oct 27, 2015 at 11:38:58PM -0700, Andy Lutomirski wrote: > From: Andy Lutomirski > > Once virtio starts using the DMA API, we won't be able to safely DMA > from the stack. virtio-net does a couple of config DMA requests > from small stack buffers -- switch to using

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread Andy Lutomirski
On Tue, Oct 27, 2015 at 11:53 PM, David Woodhouse wrote: > On Tue, 2015-10-27 at 23:38 -0700, Andy Lutomirski wrote: >> >> Changes from v2: >> - Fix really embarrassing bug. This version actually works. > > So embarrassing you didn't want to tell us what it was? ... Shhh,

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread Michael S. Tsirkin
On Tue, Oct 27, 2015 at 11:38:57PM -0700, Andy Lutomirski wrote: > This switches virtio to use the DMA API unconditionally. I'm sure > it breaks things, but it seems to work on x86 using virtio-pci, with > and without Xen, and using both the modern 1.0 variant and the > legacy variant. I'm very

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread David Woodhouse
On Wed, 2015-10-28 at 16:40 +0900, Christian Borntraeger wrote: > Am 28.10.2015 um 16:17 schrieb Michael S. Tsirkin: > > On Tue, Oct 27, 2015 at 11:38:57PM -0700, Andy Lutomirski wrote: > > > This switches virtio to use the DMA API unconditionally. I'm sure > > > it breaks things, but it seems to

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread Benjamin Herrenschmidt
On Wed, 2015-10-28 at 16:40 +0900, Christian Borntraeger wrote: > We have discussed that at kernel summit. I will try to implement a dummy > dma_ops for > s390 that does 1:1 mapping and Ben will look into doing some quirk to handle > "old" > code in addition to also make it possible to mark

Re: [RFC PATCH] VFIO: Add a parameter to force nonthread IRQ

2015-10-28 Thread Alex Williamson
On Wed, 2015-10-28 at 01:44 +0100, Paolo Bonzini wrote: > > On 27/10/2015 22:26, Yunhong Jiang wrote: > >> > On RT kernels however can you call eventfd_signal from interrupt > >> > context? You cannot call spin_lock_irqsave (which can sleep) from a > >> > non-threaded interrupt handler, can you?

Re: [PATCH v5 27/33] nvdimm acpi: support function 0

2015-10-28 Thread Stefan Hajnoczi
On Wed, Oct 28, 2015 at 10:26:25PM +, Xiao Guangrong wrote: > __DSM is defined in ACPI 6.0: 9.14.1 _DSM (Device Specific Method) > > Function 0 is a query function. We do not support any function on root > device and only 3 functions are support for NVDIMM device, Get Namespace > Label Size,

Re: [PATCH v5 30/33] nvdimm acpi: support Set Namespace Label Data function

2015-10-28 Thread Stefan Hajnoczi
On Wed, Oct 28, 2015 at 10:26:28PM +, Xiao Guangrong wrote: > +static void nvdimm_dsm_func_set_label_data(NVDIMMDevice *nvdimm, > + nvdimm_dsm_in *in, GArray *out) > +{ > +NVDIMMClass *nvc = NVDIMM_GET_CLASS(nvdimm); > +

Re: [RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-28 Thread Alex Williamson
On Wed, 2015-10-28 at 13:12 +, Eric Auger wrote: > Current vfio_pgsize_bitmap code hides the supported IOMMU page > sizes smaller than PAGE_SIZE. As a result, in case the IOMMU > does not support PAGE_SIZE page, the alignment check on map/unmap > is done with larger page sizes, if any. This

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-28 Thread Michael S. Tsirkin
On Wed, Oct 28, 2015 at 11:32:34PM +0900, David Woodhouse wrote: > > I don't have a problem with extending DMA API to address > > more usecases. > > No, this isn't an extension. This is fixing a bug, on certain platforms > where the DMA API has currently done the wrong thing. > > We have

Re: [PATCH v5 29/33] nvdimm acpi: support Get Namespace Label Data function

2015-10-28 Thread Stefan Hajnoczi
On Wed, Oct 28, 2015 at 10:26:27PM +, Xiao Guangrong wrote: > +static void nvdimm_dsm_func_get_label_data(NVDIMMDevice *nvdimm, > + nvdimm_dsm_in *in, GArray *out) > +{ > +NVDIMMClass *nvc = NVDIMM_GET_CLASS(nvdimm); > +

Re: [PATCH v5 28/33] nvdimm acpi: support Get Namespace Label Size function

2015-10-28 Thread Stefan Hajnoczi
On Wed, Oct 28, 2015 at 10:26:26PM +, Xiao Guangrong wrote: > +struct nvdimm_func_in_get_label_data { > +uint32_t offset; /* the offset in the namespace label data area. */ > +uint32_t length; /* the size of data is to be read via the function. */ > +} QEMU_PACKED; > +typedef struct

Re: [RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-28 Thread Eric Auger
Hi Alex, On 10/28/2015 05:27 PM, Alex Williamson wrote: > On Wed, 2015-10-28 at 13:12 +, Eric Auger wrote: >> Current vfio_pgsize_bitmap code hides the supported IOMMU page >> sizes smaller than PAGE_SIZE. As a result, in case the IOMMU >> does not support PAGE_SIZE page, the alignment check

Re: [RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-28 Thread Alex Williamson
On Wed, 2015-10-28 at 18:10 +0100, Eric Auger wrote: > Hi Alex, > On 10/28/2015 05:27 PM, Alex Williamson wrote: > > On Wed, 2015-10-28 at 13:12 +, Eric Auger wrote: > >> Current vfio_pgsize_bitmap code hides the supported IOMMU page > >> sizes smaller than PAGE_SIZE. As a result, in case the

Re: [RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-28 Thread Eric Auger
On 10/28/2015 06:37 PM, Alex Williamson wrote: > On Wed, 2015-10-28 at 18:10 +0100, Eric Auger wrote: >> Hi Alex, >> On 10/28/2015 05:27 PM, Alex Williamson wrote: >>> On Wed, 2015-10-28 at 13:12 +, Eric Auger wrote: Current vfio_pgsize_bitmap code hides the supported IOMMU page

Re: [RFC PATCH] VFIO: Add a parameter to force nonthread IRQ

2015-10-28 Thread Paolo Bonzini
On 28/10/2015 17:00, Alex Williamson wrote: > > Alex, would it make sense to use the IRQ bypass infrastructure always, > > not just for VT-d, to do the MSI injection directly from the VFIO > > interrupt handler and bypass the eventfd? Basically this would add an > > RCU-protected list of

Re: [RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-28 Thread Eric Auger
Hi Will, On 10/28/2015 06:14 PM, Will Deacon wrote: > On Wed, Oct 28, 2015 at 10:27:28AM -0600, Alex Williamson wrote: >> On Wed, 2015-10-28 at 13:12 +, Eric Auger wrote: >>> diff --git a/drivers/vfio/vfio_iommu_type1.c >>> b/drivers/vfio/vfio_iommu_type1.c >>> index 57d8c37..13fb974 100644

Re: [RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-28 Thread Eric Auger
On 10/28/2015 06:55 PM, Will Deacon wrote: > On Wed, Oct 28, 2015 at 06:48:41PM +0100, Eric Auger wrote: >> On 10/28/2015 06:37 PM, Alex Williamson wrote: >>> Ok, so with hopefully correcting my understand of what this does, isn't >>> this effectively the same: >>> >>> diff --git

Re: [PATCH v3 8/9] kvm/x86: Hyper-V synthetic interrupt controller

2015-10-28 Thread Paolo Bonzini
Hi Andrey, just one question. Is kvm_arch_set_irq actually needed? I think everything should work fine without it. Can you check? If so, I can remove it myself and revert the patch that introduced the hook. Paolo On 22/10/2015 18:09, Andrey Smetanin wrote: > SynIC (synthetic interrupt

Re: [RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-28 Thread Eric Auger
Alex, On 10/28/2015 06:28 PM, Alex Williamson wrote: > On Wed, 2015-10-28 at 17:14 +, Will Deacon wrote: >> On Wed, Oct 28, 2015 at 10:27:28AM -0600, Alex Williamson wrote: >>> On Wed, 2015-10-28 at 13:12 +, Eric Auger wrote: diff --git a/drivers/vfio/vfio_iommu_type1.c

Re: [RFC PATCH] VFIO: Add a parameter to force nonthread IRQ

2015-10-28 Thread Alex Williamson
On Wed, 2015-10-28 at 10:50 -0700, Yunhong Jiang wrote: > On Wed, Oct 28, 2015 at 01:44:55AM +0100, Paolo Bonzini wrote: > > > > > > On 27/10/2015 22:26, Yunhong Jiang wrote: > > >> > On RT kernels however can you call eventfd_signal from interrupt > > >> > context? You cannot call

Re: [RFC PATCH] VFIO: Add a parameter to force nonthread IRQ

2015-10-28 Thread Paolo Bonzini
On 28/10/2015 18:50, Yunhong Jiang wrote: > > No, I don't think you can use raw_spinlock there. The problem is not > > just eventfd_signal, it is especially wake_up_locked_poll. You cannot > > convert the whole workqueue infrastructure to use raw_spinlock. > > You mean the waitqueue, instead

Re: [RFC PATCH] VFIO: Add a parameter to force nonthread IRQ

2015-10-28 Thread Yunhong Jiang
On Wed, Oct 28, 2015 at 01:44:55AM +0100, Paolo Bonzini wrote: > > > On 27/10/2015 22:26, Yunhong Jiang wrote: > >> > On RT kernels however can you call eventfd_signal from interrupt > >> > context? You cannot call spin_lock_irqsave (which can sleep) from a > >> > non-threaded interrupt

Re: [RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-28 Thread Will Deacon
On Wed, Oct 28, 2015 at 10:27:28AM -0600, Alex Williamson wrote: > On Wed, 2015-10-28 at 13:12 +, Eric Auger wrote: > > diff --git a/drivers/vfio/vfio_iommu_type1.c > > b/drivers/vfio/vfio_iommu_type1.c > > index 57d8c37..13fb974 100644 > > --- a/drivers/vfio/vfio_iommu_type1.c > > +++

Re: [RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-28 Thread Alex Williamson
On Wed, 2015-10-28 at 17:14 +, Will Deacon wrote: > On Wed, Oct 28, 2015 at 10:27:28AM -0600, Alex Williamson wrote: > > On Wed, 2015-10-28 at 13:12 +, Eric Auger wrote: > > > diff --git a/drivers/vfio/vfio_iommu_type1.c > > > b/drivers/vfio/vfio_iommu_type1.c > > > index 57d8c37..13fb974

Re: [RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-28 Thread Will Deacon
On Wed, Oct 28, 2015 at 06:48:41PM +0100, Eric Auger wrote: > On 10/28/2015 06:37 PM, Alex Williamson wrote: > > Ok, so with hopefully correcting my understand of what this does, isn't > > this effectively the same: > > > > diff --git a/drivers/vfio/vfio_iommu_type1.c > >

  1   2   >