Re: [Qemu-devel] [PATCH 0/3] Extend check callback usability for irq connect notifier

2015-04-28 Thread Peter Crosthwaite
On Tue, Apr 28, 2015 at 2:18 AM, Eric Auger wrote: > The VFIO platform device gets connected to the platform bus > on a machine init done notifier. Only at that point irqfd can be > setup. An irq connect notifier would be helpful to do that job. > Instead of adding a new callback at sysbus or qdev

[PATCH v13 03/12] hw/vfio/platform: add irq assignment

2015-04-28 Thread Eric Auger
This patch adds the code requested to assign interrupts to a guest. The interrupts are mediated through user handled eventfds only. Signed-off-by: Eric Auger --- v12 -> v13: - start user-side eventfd handling at realize time - remove start_irq_fn v10 -> v11: - use block declaration when possibl

[PATCH v13 08/12] intc: arm_gic_kvm: set the qemu_irq/gsi mapping

2015-04-28 Thread Eric Auger
The arm_gic_kvm now calls kvm_irqchip_set_qemuirq_gsi to build the hash table storing qemu_irq/gsi mappings. From that point on irqfd can be setup directly from the qemu_irq using kvm_irqchip_add_irqfd_notifier. Signed-off-by: Eric Auger --- v2 -> v3: - kvm_irqchip_add_qemuirq_irqfd_notifier re

[PATCH v13 06/12] kvm: rename kvm_irqchip_[add, remove]_irqfd_notifier with gsi suffix

2015-04-28 Thread Eric Auger
Anticipating for the introduction of new add/remove functions taking a qemu_irq parameter, let's rename existing ones with a gsi suffix. Signed-off-by: Eric Auger --- hw/s390x/virtio-ccw.c | 8 hw/vfio/pci.c | 6 +++--- hw/virtio/virtio-pci.c | 4 ++-- include/sysemu/kvm.h |

[PATCH v13 02/12] hw/vfio/platform: vfio-platform skeleton

2015-04-28 Thread Eric Auger
Minimal VFIO platform implementation supporting register space user mapping but not IRQ assignment. Signed-off-by: Kim Phillips Signed-off-by: Eric Auger --- v12 -> v13: - check device name does not contain any / - handle case where readlink fully fills the buffer - in vfio_map_region declare s

[PATCH v13 11/12] sysbus: add irq_set_hook

2015-04-28 Thread Eric Auger
Add a new callback in the SysBusDeviceClass. This callback now can be overriden by devices inheriting from sysbus. By default the callback is set to the dummy object_property_allow_set_link callback. Signed-off-by: Eric Auger --- v1 -> v2: - use new LinkPropertySetter type --- hw/core/sysbus.c

[PATCH v13 00/12] KVM platform device passthrough

2015-04-28 Thread Eric Auger
This series aims at enabling KVM platform device passthrough. Kernel dependencies were pulled for 4.1-rc0. This series now only relies on the following QEMU series [1] [PATCH v12 0/4] machvirt dynamic sysbus device instantiation http://comments.gmane.org/gmane.comp.emulators.kvm.arm.devel/886 Bo

[PATCH v13 01/12] linux-headers: update headers according to 4.1-rc0

2015-04-28 Thread Eric Auger
This includes, among other things, VFIO platform driver and irqfd/arm. Signed-off-by: Eric Auger --- v12 -> v13: - update for 4.1-rc0 headers v10 -> v11: - only includes header modifications related to vfio platform driver v14 and not those related to "vfio: type1: support for ARM SMMUS wi

[PATCH v13 10/12] qdev: check callback takes the property child as third argument

2015-04-28 Thread Eric Auger
Check callback now takes as third argument an Object * const*. In object_set_link_property, we pass the property child as argument. We also assign the *child before the check call so that enhanced check can be performed in the callback. In case the check fails, the old value is restored and ref cou

[PATCH v13 04/12] hw/vfio/platform: calxeda xgmac device

2015-04-28 Thread Eric Auger
The platform device class has become abstract. This patch introduces a calxeda xgmac device that derives from it. Signed-off-by: Eric Auger Reviewed-by: Alex Bennee --- v10 -> v11: - add Alex Reviewed-by - move virt modifications in a separate patch v8 -> v9: - renamed calxeda_xgmac.c into calx

[PATCH v13 05/12] hw/arm/sysbus-fdt: enable vfio-calxeda-xgmac dynamic instantiation

2015-04-28 Thread Eric Auger
This patch allows the instantiation of the vfio-calxeda-xgmac device from the QEMU command line (-device vfio-calxeda-xgmac,host=""). A specialized device tree node is created for the guest, containing compat, dma-coherent, reg and interrupts properties. Signed-off-by: Eric Auger --- v12 -> v13

[PATCH v13 07/12] kvm-all.c: add qemu_irq/gsi hash table and utility routines

2015-04-28 Thread Eric Auger
VFIO platform device needs to setup irqfd but it does not know the gsi corresponding to the device qemu_irq. This series proposes to store a hash table in kvm_state using the qemu_irq as key and the gsi as a value. kvm_irqchip_set_qemuirq_gsi allows to insert such a pair. The interrupt controller

[PATCH v13 09/12] qdev: pass the check callback to qdev_init_gpio_out_named

2015-04-28 Thread Eric Auger
qdev_init_gpio_out_named takes a new argument corresponding to the check callback passed to object_property_add_link. In qdev_init_gpio_out and sysbus_init_irq, this callback is currently set to the dummy object_property_allow_set_link. This will allow qdev_init_gpio_out_named callers to specializ

[PATCH v13 12/12] hw/vfio/platform: add irqfd support

2015-04-28 Thread Eric Auger
This patch aims at optimizing IRQ handling using irqfd framework. Instead of handling the eventfds on user-side they are handled on kernel side using - the KVM irqfd framework, - the VFIO driver virqfd framework. the virtual IRQ completion is trapped at interrupt controller This removes the need

Re: [PATCH v2 06/10] KVM: arm64: guest debug, add SW break point support

2015-04-28 Thread Alex Bennée
Christoffer Dall writes: > On Tue, Apr 28, 2015 at 10:34:12AM +0100, Peter Maydell wrote: >> On 28 April 2015 at 09:42, Alex Bennée wrote: >> > Peter Maydell writes: >> >> Does the kernel already have a conveniently implemented "inject >> >> exception into guest" lump of code? If so it might b

Re: [PATCH/RFC 2/2] KVM: push down irq_save from kvm_guest_exit

2015-04-28 Thread Paolo Bonzini
On 28/04/2015 16:10, Christian Borntraeger wrote: > > Alternatively, the irq-disabled versions could be called > > __kvm_guest_{enter,exit}. Then you can use those directly when it makes > > sense. > > ..having a special __kvm_guest_{enter,exit} without the WARN_ON might be even > the cheapest

Re: [PATCH/RFC 2/2] KVM: push down irq_save from kvm_guest_exit

2015-04-28 Thread Christian Borntraeger
Am 28.04.2015 um 13:37 schrieb Paolo Bonzini: >> --- a/arch/powerpc/kvm/book3s_pr.c >> +++ b/arch/powerpc/kvm/book3s_pr.c >> @@ -891,7 +891,9 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct >> kvm_vcpu *vcpu, >> >> /* We get here with MSR.EE=1 */ >> >> +local_irq_disable(); >

Re: [PATCH v2 06/10] KVM: arm64: guest debug, add SW break point support

2015-04-28 Thread Christoffer Dall
On Tue, Apr 28, 2015 at 10:34:12AM +0100, Peter Maydell wrote: > On 28 April 2015 at 09:42, Alex Bennée wrote: > > Peter Maydell writes: > >> Does the kernel already have a conveniently implemented "inject > >> exception into guest" lump of code? If so it might be less effort > >> to do it that w

Re: [PATCH 2/3] qdev: check callback takes Object **target as third argument

2015-04-28 Thread Paolo Bonzini
On 28/04/2015 11:18, Eric Auger wrote: > Check callback now takes as third argument an Object **. In > object_set_link_property, we pass the property child as argument. > We also assign the *child before the check call so that enhanced > check can be performed in the callback. In case the check f

Re: [PATCH/RFC 2/2] KVM: push down irq_save from kvm_guest_exit

2015-04-28 Thread Paolo Bonzini
On 28/04/2015 12:32, Christian Borntraeger wrote: > Some architectures already have irq disabled when calling > kvm_guest_exit. Push down the disabling into the architectures > to avoid double disabling. This also allows to replace > irq_save with irq_disable which might be cheaper. > arm and mip

[PATCH/RFC 0/2] KVM: micro-optimization and interrupt disabling

2015-04-28 Thread Christian Borntraeger
I was able to get rid of some nanoseconds for a guest exit loop on s390. I did my best to not break other architectures but review and comments on the general approach is welcome. Downside is that the existing irq_save things will just work no matter what the callers have done, the new code must do

[PATCH/RFC 1/2] KVM: Push down irq_save to architectures before kvm_guest_enter

2015-04-28 Thread Christian Borntraeger
local_irq_disable can be cheaper than local_irq_save, especially when done only once instead of twice. We can push down the local_irq_save (and replace it with local_irq_disable) to save some cycles. x86, mips and arm already disable the interrupts before calling kvm_guest_enter. Here we save one l

[PATCH/RFC 2/2] KVM: push down irq_save from kvm_guest_exit

2015-04-28 Thread Christian Borntraeger
Some architectures already have irq disabled when calling kvm_guest_exit. Push down the disabling into the architectures to avoid double disabling. This also allows to replace irq_save with irq_disable which might be cheaper. arm and mips already have interrupts disabled. s390/power/x86 need adopti

Re: [PATCH v2 06/10] KVM: arm64: guest debug, add SW break point support

2015-04-28 Thread Peter Maydell
On 28 April 2015 at 09:42, Alex Bennée wrote: > Peter Maydell writes: >> Does the kernel already have a conveniently implemented "inject >> exception into guest" lump of code? If so it might be less effort >> to do it that way round, maybe. > > So you pointed out we can't just re-inject the excep

[PATCH 0/3] Extend check callback usability for irq connect notifier

2015-04-28 Thread Eric Auger
The VFIO platform device gets connected to the platform bus on a machine init done notifier. Only at that point irqfd can be setup. An irq connect notifier would be helpful to do that job. Instead of adding a new callback at sysbus or qdev level, this series proposes to use the property check() cal

[PATCH 2/3] qdev: check callback takes Object **target as third argument

2015-04-28 Thread Eric Auger
Check callback now takes as third argument an Object **. In object_set_link_property, we pass the property child as argument. We also assign the *child before the check call so that enhanced check can be performed in the callback. In case the check fails, the old value is restored and ref count is

[PATCH 3/3] sysbus: add irq_set_hook

2015-04-28 Thread Eric Auger
Add a new callback in the SysBusDeviceClass. This callback now can be overriden by devices inheriting from sysbus. By default the callback is set to the dummy object_property_allow_set_link callback. Signed-off-by: Eric Auger --- hw/core/sysbus.c| 8 +++- include/hw/sysbus.h | 1 + 2 fil

[PATCH 1/3] qdev: pass the check callback to qdev_init_gpio_out_named

2015-04-28 Thread Eric Auger
qdev_init_gpio_out_named takes a new argument corresponding to the check callback passed to object_property_add_link. In qdev_init_gpio_out this callback is set to the dummy object_property_allow_set_link. This will allow qdev_init_gpio_out_named callers to specialize this callback, typically sysb

Re: [Qemu-devel] [PATCH v2] sysbus: add irq_routing_notifier

2015-04-28 Thread Paolo Bonzini
On 27/04/2015 19:43, Peter Crosthwaite wrote: > To reduce verbosity, I suggest making object_set_link_property() a > visible API, then RYO link setters can call it surrounded by custom > behavior e.g: > > foo_object_set_bar_property(...) > { > pre_set_link_side_effects(); > object_set_li

Re: [PATCH v2 06/10] KVM: arm64: guest debug, add SW break point support

2015-04-28 Thread Alex Bennée
Peter Maydell writes: > On 27 April 2015 at 21:04, Christoffer Dall > wrote: >> On Thu, Apr 23, 2015 at 03:26:53PM +0100, Alex Bennée wrote: >>> >>> Christoffer Dall writes: >>> >>> > On Tue, Mar 31, 2015 at 04:08:04PM +0100, Alex Bennée wrote: >>> >> + * just need to report the PC and the HS

Re: [Qemu-devel] [PATCH v2] sysbus: add irq_routing_notifier

2015-04-28 Thread Eric Auger
On 04/28/2015 08:57 AM, Peter Crosthwaite wrote: > On Mon, Apr 27, 2015 at 11:46 PM, Eric Auger wrote: >> Hi Peter, >> >> On 04/27/2015 07:43 PM, Peter Crosthwaite wrote: >>> On Mon, Apr 27, 2015 at 8:01 AM, Paolo Bonzini wrote: On 27/04/2015 16:56, Eric Auger wrote: > Peter, P