Re: [Xen-devel] [PATCH] xen: privcmd: schedule() after private hypercall when non CONFIG_PREEMPT

2014-11-27 Thread Juergen Gross
On 11/27/2014 07:50 PM, Andrew Cooper wrote: On 27/11/14 18:36, Luis R. Rodriguez wrote: On Thu, Nov 27, 2014 at 07:36:31AM +0100, Juergen Gross wrote: On 11/26/2014 11:26 PM, Luis R. Rodriguez wrote: From: "Luis R. Rodriguez" Some folks had reported that some xen hypercalls take a long time

Re: [PATCH 5/5] arm/arm64: KVM: Turn off vcpus and flush stage-2 pgtables on sytem exit events

2014-11-27 Thread Peter Maydell
On 27 November 2014 at 18:41, Christoffer Dall wrote: > When a vcpu calls SYSTEM_OFF or SYSTEM_RESET with PSCI v0.2, the vcpus > should really be turned off for the VM adhering to the suggestions in > the PSCI spec, and it's the sane thing to do. > > Also, to ensure a coherent icache/dcache/ram si

Re: [PATCH 3/5] arm/arm64: KVM: Clarify KVM_ARM_VCPU_INIT ABI

2014-11-27 Thread Peter Maydell
On 27 November 2014 at 18:40, Christoffer Dall wrote: > It is not clear that this ioctl can be called multiple times for a given > vcpu. Userspace already does this, so clarify the ABI. > > Signed-off-by: Christoffer Dall > --- > Documentation/virtual/kvm/api.txt | 3 +++ > 1 file changed, 3 in

Re: [PATCH 1/5] arm/arm64: KVM: Correct KVM_ARM_VCPU_INIT power off option

2014-11-27 Thread Peter Maydell
On 27 November 2014 at 18:40, Christoffer Dall wrote: > The implementation of KVM_ARM_VCPU_INIT is currently not doing what > userspace expects, namely making sure that a vcpu which may have been > turned off using PSCI is returned to its initial state, which would be > powered on if userspace doe

[PATCH 5/4] KVM: x86: check bounds of APIC maps

2014-11-27 Thread Radim Krčmář
They can't be violated now, but we think against the infinite thing. Signed-off-by: Radim Krčmář --- I realized it could make a separate patch as well, which might be more convenient. arch/x86/kvm/lapic.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kv

Re: [PATCH 14/21] KVM: x86: Software disabled APIC should still deliver NMIs

2014-11-27 Thread Radim Krčmář
2014-11-27 23:45+0200, Nadav Amit: > Radim Krčmář wrote: > > 2014-11-26 19:01+0200, Nadav Amit: > >> Sorry for the late and long reply, but I got an issue with the new version > >> (and my previous version as well). Indeed, the SDM states that DFR should > >> be the same for enabled CPUs, and that

Re: [PATCH 14/21] KVM: x86: Software disabled APIC should still deliver NMIs

2014-11-27 Thread Nadav Amit
Radim Krčmář wrote: > 2014-11-26 19:01+0200, Nadav Amit: >> Sorry for the late and long reply, but I got an issue with the new version >> (and my previous version as well). Indeed, the SDM states that DFR should >> be the same for enabled CPUs, and that the BIOS should get all CPUs in >> either x

Re: [PATCH 3/4] KVM: x86: allow 256 logical x2APICs again

2014-11-27 Thread Radim Krčmář
2014-11-27 22:39+0200, Nadav Amit: > Radim Krčmář wrote: > > > 2014-11-27 21:53+0200, Nadav Amit: > >> Radim Krčmář wrote: > >>> - new->cid_mask = (1 << KVM_X2APIC_CID_BITS) - 1; > >>> - new->lid_mask = 0x; > >>> + new->cid_mask = new->lid_mask

Re: [PATCH 3/4] KVM: x86: allow 256 logical x2APICs again

2014-11-27 Thread Nadav Amit
Radim Krčmář wrote: > 2014-11-27 21:53+0200, Nadav Amit: >> Radim Krčmář wrote: >>> - new->cid_mask = (1 << KVM_X2APIC_CID_BITS) - 1; >>> - new->lid_mask = 0x; >>> + new->cid_mask = new->lid_mask = 0x; >> You set cid_mask to 0x, w

[PATCH v6 28/46] vhost: make features 64 bit

2014-11-27 Thread Michael S. Tsirkin
We need to use bit 32 for virtio 1.0 Signed-off-by: Michael S. Tsirkin --- drivers/vhost/vhost.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 3eda654..c624b09 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vho

[PATCH v6 29/46] vhost: add memory access wrappers

2014-11-27 Thread Michael S. Tsirkin
Add guest memory access wrappers to handle virtio endianness conversions. Signed-off-by: Michael S. Tsirkin --- drivers/vhost/vhost.h | 31 +++ 1 file changed, 31 insertions(+) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index c624b09..1f321fd 100644 -

[PATCH v6 31/46] vhost: virtio 1.0 endian-ness support

2014-11-27 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin --- drivers/vhost/vhost.c | 93 +++ 1 file changed, 56 insertions(+), 37 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c90f437..4d379ed 100644 --- a/drivers/vhost/vhost.c +++ b/drive

[PATCH v6 30/46] vhost/net: force len for TX to host endian

2014-11-27 Thread Michael S. Tsirkin
vhost/net keeps a copy of some used ring but (ab)uses length field for internal house-keeping. This works because for tx used length is always 0. Suppress sparse errors: we use native endian-ness internally but never expose it to guest. Signed-off-by: Michael S. Tsirkin --- drivers/vhost/net.c |

[PATCH v6 33/46] vhost/net: larger header for virtio 1.0

2014-11-27 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin --- drivers/vhost/net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index cae22f9..1ac58d0 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -1027,7 +1027,8 @@ static int vhost_net_se

[PATCH v6 35/46] vhost/net: enable virtio 1.0

2014-11-27 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin --- drivers/vhost/net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 1ac58d0..984242e 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -61,7 +61,8 @@ MODULE_PARM_DESC(experiment

[PATCH v6 32/46] vhost/net: virtio 1.0 byte swap

2014-11-27 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin --- drivers/vhost/net.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index dce5c58..cae22f9 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -416,7 +416,7 @@ static void ha

[PATCH v6 36/46] vhost/net: suppress compiler warning

2014-11-27 Thread Michael S. Tsirkin
len is always initialized since function is called with size > 0. Signed-off-by: Michael S. Tsirkin --- drivers/vhost/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 984242e..54ffbb0 100644 --- a/drivers/vhost/net.c +++ b/

Re: [PATCH 3/4] KVM: x86: allow 256 logical x2APICs again

2014-11-27 Thread Radim Krčmář
2014-11-27 21:53+0200, Nadav Amit: > Radim Krčmář wrote: > > - new->cid_mask = (1 << KVM_X2APIC_CID_BITS) - 1; > > - new->lid_mask = 0x; > > + new->cid_mask = new->lid_mask = 0x; > You set cid_mask to 0x, while there are only 16 clu

[PATCH v6 45/46] vhost/scsi: partial virtio 1.0 support

2014-11-27 Thread Michael S. Tsirkin
Include all endian conversions as required by virtio 1.0. Don't set virtio 1.0 yet, since that requires ANY_LAYOUT which we don't yet support. Signed-off-by: Michael S. Tsirkin Acked-by: Paolo Bonzini --- drivers/vhost/scsi.c | 22 -- 1 file changed, 12 insertions(+), 10 del

Re: [PATCH 3/4] KVM: x86: allow 256 logical x2APICs again

2014-11-27 Thread Nadav Amit
Radim Krčmář wrote: > While fixing an x2apic bug, > 17d68b7 KVM: x86: fix guest-initiated crash with x2apic (CVE-2013-6376) > we've made only one cluster available. This means that the amount of > logically addressible x2APICs was reduced to 16 and VCPUs kept > overwriting themselves in that reg

[PATCH 0/4] KVM: x86: APIC fixes

2014-11-27 Thread Radim Krčmář
The interesting one is [3/4], which improves upon a previous CVE fix; we also handle logical destination wrapping in it, so [2/4] does the same for physical; and to make it nicer, [1/4] removes a condition. [4/4] makes our fast path return true when the message was handled. Radim Krčmář (4): KV

[PATCH 1/4] KVM: x86: deliver phys lowest-prio

2014-11-27 Thread Radim Krčmář
Physical mode can't address more than one APIC, but lowest-prio is allowed, so we just reuse our paths. SDM 10.6.2.1 Physical Destination: Also, for any non-broadcast IPI or I/O subsystem initiated interrupt with lowest priority delivery mode, software must ensure that APICs defined in the i

[PATCH 2/4] KVM: x86: fix APIC physical destination wrapping

2014-11-27 Thread Radim Krčmář
x2apic allows destinations > 0xff and we don't want them delivered to lower APICs. They are correctly handled by doing nothing. Signed-off-by: Radim Krčmář --- arch/x86/kvm/lapic.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.

[PATCH 4/4] KVM: x86: don't retry hopeless APIC delivery

2014-11-27 Thread Radim Krčmář
False from kvm_irq_delivery_to_apic_fast() means that we don't handle it in the fast path, but we still return false in cases that were perfectly handled, fix that. Signed-off-by: Radim Krčmář --- arch/x86/kvm/lapic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x

[PATCH 3/4] KVM: x86: allow 256 logical x2APICs again

2014-11-27 Thread Radim Krčmář
While fixing an x2apic bug, 17d68b7 KVM: x86: fix guest-initiated crash with x2apic (CVE-2013-6376) we've made only one cluster available. This means that the amount of logically addressible x2APICs was reduced to 16 and VCPUs kept overwriting themselves in that region, so even the first cluster

Re: [Xen-devel] [PATCH] xen: privcmd: schedule() after private hypercall when non CONFIG_PREEMPT

2014-11-27 Thread Andrew Cooper
On 27/11/14 18:36, Luis R. Rodriguez wrote: > On Thu, Nov 27, 2014 at 07:36:31AM +0100, Juergen Gross wrote: >> On 11/26/2014 11:26 PM, Luis R. Rodriguez wrote: >>> From: "Luis R. Rodriguez" >>> >>> Some folks had reported that some xen hypercalls take a long time >>> to complete when issued from

Re: [PATCH] xen: privcmd: schedule() after private hypercall when non CONFIG_PREEMPT

2014-11-27 Thread Luis R. Rodriguez
On Thu, Nov 27, 2014 at 1:36 PM, Luis R. Rodriguez wrote: > I'm afraid we don't have much leg room. Let me be clear, I still think putting some hypercalls in process context *might help* but because of notes 1) and 2) I highlighted I think this is the best we can do, with more information we shou

[PATCH 3/5] arm/arm64: KVM: Clarify KVM_ARM_VCPU_INIT ABI

2014-11-27 Thread Christoffer Dall
It is not clear that this ioctl can be called multiple times for a given vcpu. Userspace already does this, so clarify the ABI. Signed-off-by: Christoffer Dall --- Documentation/virtual/kvm/api.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/virtual/kvm/api.txt b/Docum

[PATCH 4/5] arm/arm64: KVM: Introduce stage2_unmap_vm

2014-11-27 Thread Christoffer Dall
Introduce a new function to unmap user RAM regions in the stage2 page tables. This is needed on reboot (or when the guest turns off the MMU) to ensure we fault in pages again and make the dcache, RAM, and icache coherent. Using unmap_stage2_range for the whole guest physical range does not work,

[PATCH 5/5] arm/arm64: KVM: Turn off vcpus and flush stage-2 pgtables on sytem exit events

2014-11-27 Thread Christoffer Dall
When a vcpu calls SYSTEM_OFF or SYSTEM_RESET with PSCI v0.2, the vcpus should really be turned off for the VM adhering to the suggestions in the PSCI spec, and it's the sane thing to do. Also, to ensure a coherent icache/dcache/ram situation when restarting with the guest MMU off, flush all stage-

[PATCH 0/5] Improve PSCI system events and fix reboot bugs

2014-11-27 Thread Christoffer Dall
Several people have reported problems with rebooting ARM VMs, especially on 32-bit ARM. This is mainly due to the same reason we were seeing boot errors in the past, namely that the ram, dcache, and icache weren't coherent on guest boot with the guest (stage-1) MMU disabled. We solved this by ens

[PATCH 2/5] arm/arm64: KVM: Reset the HCR on each vcpu when resetting the vcpu

2014-11-27 Thread Christoffer Dall
When userspace resets the vcpu using KVM_ARM_VCPU_INIT, we should also reset the HCR, because we now modify the HCR dynamically to enable/disable trapping of guest accesses to the VM registers. This is crucial for reboot of VMs working since otherwise we will not be doing the necessary cache maint

[PATCH 1/5] arm/arm64: KVM: Correct KVM_ARM_VCPU_INIT power off option

2014-11-27 Thread Christoffer Dall
The implementation of KVM_ARM_VCPU_INIT is currently not doing what userspace expects, namely making sure that a vcpu which may have been turned off using PSCI is returned to its initial state, which would be powered on if userspace does not set the KVM_ARM_VCPU_POWER_OFF flag. Implment the expect

Re: [PATCH] xen: privcmd: schedule() after private hypercall when non CONFIG_PREEMPT

2014-11-27 Thread Luis R. Rodriguez
On Thu, Nov 27, 2014 at 07:36:31AM +0100, Juergen Gross wrote: > On 11/26/2014 11:26 PM, Luis R. Rodriguez wrote: >> From: "Luis R. Rodriguez" >> >> Some folks had reported that some xen hypercalls take a long time >> to complete when issued from the userspace private ioctl mechanism, >> this can

[PATCH v10 02/20] vfio: platform: probe to devices on the platform bus

2014-11-27 Thread Antonios Motakis
Driver to bind to Linux platform devices, and callbacks to discover their resources to be used by the main VFIO PLATFORM code. Signed-off-by: Antonios Motakis --- drivers/vfio/platform/vfio_platform.c | 103 ++ include/uapi/linux/vfio.h | 1 + 2 file

[PATCH v10 03/20] vfio: platform: add the VFIO PLATFORM module to Kconfig

2014-11-27 Thread Antonios Motakis
Enable building the VFIO PLATFORM driver that allows to use Linux platform devices with VFIO. Signed-off-by: Antonios Motakis --- drivers/vfio/Kconfig | 1 + drivers/vfio/Makefile | 1 + drivers/vfio/platform/Kconfig | 9 + drivers/vfio/platform/Makefile | 4 4 f

[PATCH v10 07/20] vfio/platform: return info for device memory mapped IO regions

2014-11-27 Thread Antonios Motakis
This patch enables the IOCTLs VFIO_DEVICE_GET_REGION_INFO ioctl call, which allows the user to learn about the available MMIO resources of a device. Signed-off-by: Antonios Motakis --- drivers/vfio/platform/vfio_platform_common.c | 106 +- drivers/vfio/platform/vfio_plat

[PATCH v10 08/20] vfio/platform: read and write support for the device fd

2014-11-27 Thread Antonios Motakis
VFIO returns a file descriptor which we can use to manipulate the memory regions of the device. Usually, the user will mmap memory regions that are addressable on page boundaries, however for memory regions where this is not the case we cannot provide mmap functionality due to security concerns. Fo

[PATCH v10 04/20] vfio: amba: VFIO support for AMBA devices

2014-11-27 Thread Antonios Motakis
Add support for discovering AMBA devices with VFIO and handle them similarly to Linux platform devices. Signed-off-by: Antonios Motakis --- drivers/vfio/platform/vfio_amba.c | 110 ++ include/uapi/linux/vfio.h | 1 + 2 files changed, 111 insertions(+

[PATCH v10 05/20] vfio: amba: add the VFIO for AMBA devices module to Kconfig

2014-11-27 Thread Antonios Motakis
Enable building the VFIO AMBA driver. VFIO_AMBA depends on VFIO_PLATFORM, since it is sharing a portion of the code, and it is essentially implemented as a platform device whose resources are discovered via AMBA specific APIs in the kernel. Signed-off-by: Antonios Motakis --- drivers/vfio/platfo

[PATCH v10 06/20] vfio/platform: return info for bound device

2014-11-27 Thread Antonios Motakis
A VFIO userspace driver will start by opening the VFIO device that corresponds to an IOMMU group, and will use the ioctl interface to get the basic device info, such as number of memory regions and interrupts, and their properties. This patch enables the VFIO_DEVICE_GET_INFO ioctl call. Signed-off

[PATCH v10 11/20] vfio/platform: initial interrupts support code

2014-11-27 Thread Antonios Motakis
This patch is a skeleton for the VFIO_DEVICE_SET_IRQS IOCTL, around which most IRQ functionality is implemented in VFIO. Signed-off-by: Antonios Motakis --- drivers/vfio/platform/vfio_platform_common.c | 52 +-- drivers/vfio/platform/vfio_platform_irq.c | 59

[PATCH v10 10/20] vfio/platform: return IRQ info

2014-11-27 Thread Antonios Motakis
Return information for the interrupts exposed by the device. This patch extends VFIO_DEVICE_GET_INFO with the number of IRQs and enables VFIO_DEVICE_GET_IRQ_INFO. Signed-off-by: Antonios Motakis --- drivers/vfio/platform/Makefile| 2 +- drivers/vfio/platform/vfio_platform_common

[PATCH v10 14/20] vfio: add a vfio_ prefix to virqfd_enable and virqfd_disable and export

2014-11-27 Thread Antonios Motakis
We want to reuse virqfd functionality in multiple VFIO drivers; before moving these functions to core VFIO, add the vfio_ prefix to the virqfd_enable and virqfd_disable functions, and export them so they can be used from other modules. Signed-off-by: Antonios Motakis --- drivers/vfio/pci/vfio_pc

[PATCH v10 15/20] vfio: virqfd: rename vfio_pci_virqfd_init and vfio_pci_virqfd_exit

2014-11-27 Thread Antonios Motakis
The functions vfio_pci_virqfd_init and vfio_pci_virqfd_exit are not really PCI specific, since we plan to reuse the virqfd code with more VFIO drivers in addition to VFIO_PCI. Signed-off-by: Antonios Motakis --- drivers/vfio/pci/vfio_pci.c | 6 +++--- drivers/vfio/pci/vfio_pci_intrs.c | 4

[PATCH v10 16/20] vfio: add local lock for virqfd instead of depending on VFIO PCI

2014-11-27 Thread Antonios Motakis
The Virqfd code needs to keep accesses to any struct *virqfd safe, but this comes into play only when creating or destroying eventfds, so sharing the same spinlock with the VFIO bus driver is not necessary. Signed-off-by: Antonios Motakis --- drivers/vfio/pci/vfio_pci_intrs.c | 31 ++

[PATCH v10 19/20] vfio: initialize the virqfd workqueue in VFIO generic code

2014-11-27 Thread Antonios Motakis
Now we have finally completely decoupled virqfd from VFIO_PCI. We can initialize it from the VFIO generic code, in order to safely use it from multiple independent VFIO bus drivers. Signed-off-by: Antonios Motakis --- drivers/vfio/Makefile | 4 +++- drivers/vfio/pci/Makefile | 3 +-- dri

[PATCH v10 17/20] vfio: pass an opaque pointer on virqfd initialization

2014-11-27 Thread Antonios Motakis
VFIO_PCI passes the VFIO device structure *vdev via eventfd to the handler that implements masking/unmasking of IRQs via an eventfd. We can replace it in the virqfd infrastructure with an opaque type so we can make use of the mechanism from other VFIO bus drivers. Signed-off-by: Antonios Motakis

[PATCH v10 20/20] vfio/platform: implement IRQ masking/unmasking via an eventfd

2014-11-27 Thread Antonios Motakis
With this patch the VFIO user will be able to set an eventfd that can be used in order to mask and unmask IRQs of platform devices. Signed-off-by: Antonios Motakis --- drivers/vfio/platform/vfio_platform_irq.c | 47 --- drivers/vfio/platform/vfio_platform_private.h |

[PATCH v10 18/20] vfio: move eventfd support code for VFIO_PCI to a separate file

2014-11-27 Thread Antonios Motakis
The virqfd functionality that is used by VFIO_PCI to implement interrupt masking and unmasking via an eventfd, is generic enough and can be reused by another driver. Move it to a separate file in order to allow the code to be shared. Signed-off-by: Antonios Motakis --- drivers/vfio/pci/Makefile

[PATCH v10 13/20] vfio/platform: support for level sensitive interrupts

2014-11-27 Thread Antonios Motakis
Level sensitive interrupts are exposed as maskable and automasked interrupts and are masked and disabled automatically when they fire. Signed-off-by: Antonios Motakis --- drivers/vfio/platform/vfio_platform_irq.c | 99 ++- drivers/vfio/platform/vfio_platform_private.h

[PATCH v10 12/20] vfio/platform: trigger an interrupt via eventfd

2014-11-27 Thread Antonios Motakis
This patch allows to set an eventfd for a platform device's interrupt, and also to trigger the interrupt eventfd from userspace for testing. Level sensitive interrupts are marked as maskable and are handled in a later patch. Edge triggered interrupts are not advertised as maskable and are implement

[PATCH v10 09/20] vfio/platform: support MMAP of MMIO regions

2014-11-27 Thread Antonios Motakis
Allow to memory map the MMIO regions of the device so userspace can directly access them. PIO regions are not being handled at this point. Signed-off-by: Antonios Motakis --- drivers/vfio/platform/vfio_platform_common.c | 65 1 file changed, 65 insertions(+) diff --

[PATCH v10 01/20] vfio/platform: initial skeleton of VFIO support for platform devices

2014-11-27 Thread Antonios Motakis
This patch forms the common skeleton code for platform devices support with VFIO. This will include the core functionality of VFIO_PLATFORM, however binding to the device and discovering the device resources will be done with the help of a separate file where any Linux platform bus specific code wi

[PATCH v3 2/6] vfio: type1: support for ARM SMMUs

2014-11-27 Thread Antonios Motakis
This allows to make use of the VFIO_IOMMU_TYPE1 driver with devices behind an IOMMU on ARM platforms. The driver can then be used with an Exynos SMMU, or ARM SMMU driver. Signed-off-by: Antonios Motakis --- drivers/vfio/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/

[PATCH v3 5/6] vfio: type1: replace vfio_domains_have_iommu_cache with generic function

2014-11-27 Thread Antonios Motakis
Replace the function vfio_domains_have_iommu_cache() with a more generic function vfio_domains_have_iommu_cap() which allows to check all domains of an vfio_iommu structure for a given cached capability. Signed-off-by: Antonios Motakis --- drivers/vfio/vfio_iommu_type1.c | 37 +++

[PATCH v3 6/6] vfio: type1: implement the VFIO_DMA_MAP_FLAG_NOEXEC flag

2014-11-27 Thread Antonios Motakis
Some IOMMU drivers, such as the ARM SMMU driver, make available the IOMMU_NOEXEC flag to set the page tables for a device as XN (execute never). This affects devices such as the ARM PL330 DMA Controller, which respects this flag and will refuse to fetch DMA instructions from memory where the XN fla

[PATCH v3 4/6] vfio: type1: replace domain wide protection flags with supported capabilities

2014-11-27 Thread Antonios Motakis
VFIO_IOMMU_TYPE1 keeps track for each domain it knows a list of protection flags it always applies to all mappings in the domain. This is used for domains that support IOMMU_CAP_CACHE_COHERENCY. Refactor this slightly, by keeping track instead that a given domain supports the capability, and apply

[PATCH v3 3/6] vfio: introduce the VFIO_DMA_MAP_FLAG_NOEXEC flag

2014-11-27 Thread Antonios Motakis
We introduce the VFIO_DMA_MAP_FLAG_NOEXEC flag to the VFIO dma map call, and expose its availability via the capability VFIO_DMA_NOEXEC_IOMMU. This way the user can control whether the XN flag will be set on the requested mappings. The IOMMU_NOEXEC flag needs to be available for all the IOMMUs of t

[PATCH v3 1/6] vfio: implement iommu driver capabilities with an enum

2014-11-27 Thread Antonios Motakis
Currently a VFIO driver's IOMMU capabilities are encoded as a series of numerical defines. Replace this with an enum for future maintainability. Signed-off-by: Antonios Motakis --- include/uapi/linux/vfio.h | 24 +++- 1 file changed, 11 insertions(+), 13 deletions(-) diff --

Re: [PATCH v2] KVM: x86: Fix reserved x2apic registers

2014-11-27 Thread Paolo Bonzini
On 26/11/2014 16:56, Nadav Amit wrote: > x2APIC has no registers for DFR and ICR2 (see Intel SDM 10.12.1.2 "x2APIC > Register Address Space"). KVM needs to cause #GP on such accesses. > > Fix it (DFR and ICR2 on read, ICR2 on write, DFR already handled on writes). > > Signed-off-by: Nadav Amit

Re: [PATCH] KVM: x86: use MSR_ICR instead of a number

2014-11-27 Thread Paolo Bonzini
On 26/11/2014 17:07, Radim Krčmář wrote: > 0x830 MSR is 0x300 xAPIC MMIO, which is MSR_ICR. > > Signed-off-by: Radim Krčmář > --- > This applies on top of Amit's >[PATCH v2] KVM: x86: Fix reserved x2apic registers > in which I noticed this minor deficit. > > arch/x86/kvm/lapic.c | 4 ++-

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 05:28:42PM +0100, Cornelia Huck wrote: > On Thu, 27 Nov 2014 18:18:25 +0200 > "Michael S. Tsirkin" wrote: > > > On Thu, Nov 27, 2014 at 05:06:51PM +0100, Cornelia Huck wrote: > > > > So we should have a per-device callback into the transport layer, say > > > check_legacy(

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 05:28:42PM +0100, Cornelia Huck wrote: > On Thu, 27 Nov 2014 18:18:25 +0200 > "Michael S. Tsirkin" wrote: > > > On Thu, Nov 27, 2014 at 05:06:51PM +0100, Cornelia Huck wrote: > > > > So we should have a per-device callback into the transport layer, say > > > check_legacy(

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Cornelia Huck
On Thu, 27 Nov 2014 18:18:25 +0200 "Michael S. Tsirkin" wrote: > On Thu, Nov 27, 2014 at 05:06:51PM +0100, Cornelia Huck wrote: > > So we should have a per-device callback into the transport layer, say > > check_legacy()? > > I would just have 2 masks: legacy_features and features. But these b

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 05:06:51PM +0100, Cornelia Huck wrote: > On Thu, 27 Nov 2014 17:42:11 +0200 > "Michael S. Tsirkin" wrote: > > > On Thu, Nov 27, 2014 at 04:31:39PM +0100, Cornelia Huck wrote: > > > On Thu, 27 Nov 2014 17:24:22 +0200 > > > "Michael S. Tsirkin" wrote: > > > > > > > On Thu,

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Cornelia Huck
On Thu, 27 Nov 2014 17:42:11 +0200 "Michael S. Tsirkin" wrote: > On Thu, Nov 27, 2014 at 04:31:39PM +0100, Cornelia Huck wrote: > > On Thu, 27 Nov 2014 17:24:22 +0200 > > "Michael S. Tsirkin" wrote: > > > > > On Thu, Nov 27, 2014 at 04:16:33PM +0100, Cornelia Huck wrote: > > > > Yet another ver

Re: [PATCH RFC v4 03/16] virtio: support more feature bits

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 04:40:29PM +0100, Cornelia Huck wrote: > On Thu, 27 Nov 2014 17:34:19 +0200 > "Michael S. Tsirkin" wrote: > > > On Thu, Nov 27, 2014 at 04:16:36PM +0100, Cornelia Huck wrote: > > > With virtio-1, we support more than 32 feature bits. Let's make > > > vdev->guest_features d

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 04:31:39PM +0100, Cornelia Huck wrote: > On Thu, 27 Nov 2014 17:24:22 +0200 > "Michael S. Tsirkin" wrote: > > > On Thu, Nov 27, 2014 at 04:16:33PM +0100, Cornelia Huck wrote: > > > Yet another version of the virtio-1 support patches. > > > > > > This one has seen some (ve

Re: [PATCH RFC v4 03/16] virtio: support more feature bits

2014-11-27 Thread Cornelia Huck
On Thu, 27 Nov 2014 17:34:19 +0200 "Michael S. Tsirkin" wrote: > On Thu, Nov 27, 2014 at 04:16:36PM +0100, Cornelia Huck wrote: > > With virtio-1, we support more than 32 feature bits. Let's make > > vdev->guest_features depend on the number of supported feature bits, > > allowing us to grow the

Re: [PATCH RFC v4 03/16] virtio: support more feature bits

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 04:16:36PM +0100, Cornelia Huck wrote: > With virtio-1, we support more than 32 feature bits. Let's make > vdev->guest_features depend on the number of supported feature bits, > allowing us to grow the feature bits automatically. > > We also need to enhance the internal fun

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Cornelia Huck
On Thu, 27 Nov 2014 17:24:22 +0200 "Michael S. Tsirkin" wrote: > On Thu, Nov 27, 2014 at 04:16:33PM +0100, Cornelia Huck wrote: > > Yet another version of the virtio-1 support patches. > > > > This one has seen some (very) light testing with the virtio-1 guest > > support patches currently on vh

Re: [PATCH] KVM: Introduce dynamically registered hypercall capability

2014-11-27 Thread Radim Krčmář
2014-11-27 05:30-0800, Phil White: > This introduces a list of entries which associate a function pointer of > kvm_hc_type to a hypercall number and allows the ability to register and > unregister entries. In addition, it also allows the ability to retrieve a > function pointer of kvm_hc_type for

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 04:16:33PM +0100, Cornelia Huck wrote: > Yet another version of the virtio-1 support patches. > > This one has seen some (very) light testing with the virtio-1 guest > support patches currently on vhost-next. > > Changes from v3: > > - Add support for FEATURES_OK. We refu

[PATCH RFC v4 08/16] s390x/css: Add a callback for when subchannel gets disabled

2014-11-27 Thread Cornelia Huck
From: Thomas Huth We need a possibility to run code when a subchannel gets disabled. This patch adds the necessary infrastructure. Signed-off-by: Thomas Huth Signed-off-by: Cornelia Huck --- hw/s390x/css.c | 12 hw/s390x/css.h |1 + 2 files changed, 13 insertions(+) diff -

[PATCH RFC v4 05/16] virtio: introduce legacy virtio devices

2014-11-27 Thread Cornelia Huck
Introduce a helper function to indicate whether a virtio device is operating in legacy or virtio standard mode. It may be used to make decisions about the endianess of virtio accesses and other virtio-1 specific changes, enabling us to support transitional devices. Reviewed-by: Thomas Huth Sign

[PATCH RFC v4 02/16] virtio: cull virtio_bus_set_vdev_features

2014-11-27 Thread Cornelia Huck
The only user of this function was virtio-ccw, and it should use virtio_set_features() like everybody else: We need to make sure that bad features are masked out properly, which this function did not do. Reviewed-by: Thomas Huth Signed-off-by: Cornelia Huck --- hw/s390x/virtio-ccw.c |

[PATCH RFC v4 09/16] s390x/virtio-ccw: add virtio set-revision call

2014-11-27 Thread Cornelia Huck
From: Thomas Huth Handle the virtio-ccw revision according to what the guest sets. When revision 1 is selected, we have a virtio-1 standard device with byteswapping for the virtio rings. When a channel gets disabled, we have to revert to the legacy behavior in case the next user of the device do

[PATCH RFC v4 12/16] virtio: allow to fail setting status

2014-11-27 Thread Cornelia Huck
virtio-1 allow setting of the FEATURES_OK status bit to fail if the negotiated feature bits are inconsistent: let's fail virtio_set_status() in that case and update virtio-ccw to post an error to the guest. Signed-off-by: Cornelia Huck --- hw/s390x/virtio-ccw.c | 20

[PATCH RFC v4 11/16] virtio: disallow late feature changes for virtio-1

2014-11-27 Thread Cornelia Huck
For virtio-1 devices, the driver must not attempt to set feature bits after it set FEATURES_OK in the device status. Simply reject it in that case. Signed-off-by: Cornelia Huck --- hw/virtio/virtio.c | 17 +++-- include/hw/virtio/virtio.h |2 ++ 2 files changed, 17 inse

[PATCH RFC v4 10/16] s390x/virtio-ccw: support virtio-1 set_vq format

2014-11-27 Thread Cornelia Huck
Support the new CCW_CMD_SET_VQ format for virtio-1 devices. While we're at it, refactor the code a bit and enforce big endian fields (which had always been required, even for legacy). Reviewed-by: Thomas Huth Signed-off-by: Cornelia Huck --- hw/s390x/virtio-ccw.c | 114 +++

[PATCH RFC v4 16/16] virtio-net: enable virtio 1.0

2014-11-27 Thread Cornelia Huck
virtio-net (non-vhost) now should have everything in place to support virtio 1.0: let's enable the feature bit for it. Note that VIRTIO_F_VERSION_1 is technically a transport feature; once every device is ready for virtio 1.0, we can move setting this feature bit out of the individual devices. Si

[PATCH RFC v4 15/16] virtio-net: support longer header

2014-11-27 Thread Cornelia Huck
virtio-1 devices always use num_buffers in the header, even if mergeable rx buffers have not been negotiated. Signed-off-by: Cornelia Huck --- hw/net/virtio-net.c |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index ad477

[PATCH RFC v4 06/16] virtio: allow virtio-1 queue layout

2014-11-27 Thread Cornelia Huck
For virtio-1 devices, we allow a more complex queue layout that doesn't require descriptor table and rings on a physically-contigous memory area: add virtio_queue_set_rings() to allow transports to set this up. Signed-off-by: Cornelia Huck --- hw/virtio/virtio.c | 16

[PATCH RFC v4 14/16] virtio-net: no writeable mac for virtio-1

2014-11-27 Thread Cornelia Huck
Devices operating as virtio 1.0 may not allow writes to the mac address in config space. Signed-off-by: Cornelia Huck --- hw/net/virtio-net.c |1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 1e214b5..ad477bf 100644 --- a/hw/net/virtio-net.c +

[PATCH RFC v4 01/16] linux-headers/virtio_config: Update with VIRTIO_F_VERSION_1

2014-11-27 Thread Cornelia Huck
From: Thomas Huth Add the new VIRTIO_F_VERSION_1 definition to the virtio_config.h linux header. Signed-off-by: Thomas Huth Signed-off-by: Cornelia Huck --- linux-headers/linux/virtio_config.h |3 +++ 1 file changed, 3 insertions(+) diff --git a/linux-headers/linux/virtio_config.h b/lin

[PATCH RFC v4 04/16] s390x/virtio-ccw: fix check for WRITE_FEAT

2014-11-27 Thread Cornelia Huck
We need to check guest feature size, not host feature size to find out whether we should call virtio_set_features(). This check is possible now that vdev->guest_features is an array. Reviewed-by: Thomas Huth Signed-off-by: Cornelia Huck --- hw/s390x/virtio-ccw.c |2 +- 1 file changed, 1 ins

[PATCH RFC v4 03/16] virtio: support more feature bits

2014-11-27 Thread Cornelia Huck
With virtio-1, we support more than 32 feature bits. Let's make vdev->guest_features depend on the number of supported feature bits, allowing us to grow the feature bits automatically. We also need to enhance the internal functions dealing with getting and setting features with an additional index

[PATCH RFC v4 13/16] s390x/virtio-ccw: enable virtio 1.0

2014-11-27 Thread Cornelia Huck
virtio-ccw should now have everything in place to operate virtio 1.0 devices, so let's enable revision 1. Signed-off-by: Cornelia Huck --- hw/s390x/virtio-ccw.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h index 03d5955..08e

[PATCH RFC v4 07/16] dataplane: allow virtio-1 devices

2014-11-27 Thread Cornelia Huck
Handle endianness conversion for virtio-1 virtqueues correctly. Note that dataplane now needs to be built per-target. Signed-off-by: Cornelia Huck --- hw/block/dataplane/virtio-blk.c |4 +- hw/scsi/virtio-scsi-dataplane.c |2 +- hw/virtio/Makefile.objs

[PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Cornelia Huck
Yet another version of the virtio-1 support patches. This one has seen some (very) light testing with the virtio-1 guest support patches currently on vhost-next. Changes from v3: - Add support for FEATURES_OK. We refuse to set features after the driver has set this in the status field, and we

Re: [PATCH] KVM: x86: Generate #UD when memory operand is required

2014-11-27 Thread Radim Krčmář
2014-11-26 15:47+0200, Nadav Amit: > Certain x86 instructions that use modrm operands only allow memory operand > (i.e., mod012), and cause a #UD exception otherwise. KVM ignores this fact. > Currently, the instructions that are such and are emulated by KVM are MOVBE, > MOVNTPS, MOVNTPD and MOVNTI.

Re: [PATCH] KVM: Introduce dynamically registered hypercall capability

2014-11-27 Thread Jan Kiszka
On 2014-11-27 14:30, Phil White wrote: > This introduces a list of entries which associate a function pointer of > kvm_hc_type to a hypercall number and allows the ability to register and > unregister entries. In addition, it also allows the ability to retrieve a > function pointer of kvm_hc_type

Re: [PATCH 14/21] KVM: x86: Software disabled APIC should still deliver NMIs

2014-11-27 Thread Radim Krčmář
2014-11-26 19:01+0200, Nadav Amit: > Sorry for the late and long reply, but I got an issue with the new version > (and my previous version as well). Indeed, the SDM states that DFR should > be the same for enabled CPUs, and that the BIOS should get all CPUs in > either xAPIC or x2APIC. Yet, there i

[PATCH] KVM: Introduce dynamically registered hypercall capability

2014-11-27 Thread Phil White
This introduces a list of entries which associate a function pointer of kvm_hc_type to a hypercall number and allows the ability to register and unregister entries. In addition, it also allows the ability to retrieve a function pointer of kvm_hc_type for a given hypercall number which is meant to

[PATCH v5 27/45] vhost: make features 64 bit

2014-11-27 Thread Michael S. Tsirkin
We need to use bit 32 for virtio 1.0 Signed-off-by: Michael S. Tsirkin --- drivers/vhost/vhost.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 3eda654..c624b09 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vho

[PATCH v5 29/45] vhost/net: force len for TX to host endian

2014-11-27 Thread Michael S. Tsirkin
vhost/net keeps a copy of some used ring but (ab)uses length field for internal house-keeping. This works because for tx used length is always 0. Suppress sparse errors: we use native endian-ness internally but never expose it to guest. Signed-off-by: Michael S. Tsirkin --- drivers/vhost/net.c |

[PATCH v5 30/45] vhost: virtio 1.0 endian-ness support

2014-11-27 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin --- drivers/vhost/vhost.c | 93 +++ 1 file changed, 56 insertions(+), 37 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c90f437..4d379ed 100644 --- a/drivers/vhost/vhost.c +++ b/drive

[PATCH v5 34/45] vhost/net: enable virtio 1.0

2014-11-27 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin --- drivers/vhost/net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 1ac58d0..984242e 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -61,7 +61,8 @@ MODULE_PARM_DESC(experiment

[PATCH v5 31/45] vhost/net: virtio 1.0 byte swap

2014-11-27 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin --- drivers/vhost/net.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index dce5c58..cae22f9 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -416,7 +416,7 @@ static void ha

  1   2   >