Re: [PATCH v2 rebased 3/3] kvm tools: Allow piping debug output to file descriptor

2011-10-17 Thread Pekka Enberg
On Sun, Oct 16, 2011 at 10:57 PM, Sasha Levin levinsasha...@gmail.com wrote: @@ -47,6 +47,7 @@ void kvm_debug_help(void)  static int do_debug(const char *name, int sock)  { +       char buff[100];        struct debug_cmd cmd = {KVM_IPC_DEBUG, 0};        int r; @@ -54,6 +55,14 @@ static

Re: [PATCH v3 1/6] iommu/core: split mapping to page sizes as supported by the hardware

2011-10-17 Thread Ohad Ben-Cohen
Hi Joerg, On Fri, Oct 14, 2011 at 7:03 PM, Ohad Ben-Cohen o...@wizery.com wrote: On Fri, Oct 14, 2011 at 3:35 PM, Roedel, Joerg joerg.roe...@amd.com wrote: Hmm, I'd like to constify the iommu_ops structures in the future. This wouldn't work then anymore. How about renaming it to io_page_size

Re: [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation

2011-10-17 Thread Lai Jiangshan
On 10/16/2011 05:39 PM, Avi Kivity wrote: On 10/14/2011 11:03 AM, Lai Jiangshan wrote: Currently, NMI interrupt is blindly sent to all the vCPUs when NMI button event happens. This doesn't properly emulate real hardware on which NMI button event triggers LINT1. Because of this, NMI is sent to

[PATCH RFC v1 0/2] Initial support for Microsoft Hyper-V.

2011-10-17 Thread Vadim Rozenfeld
With the following series of patches we are starting to implement some basic Microsoft Hyper-V Enlightenment functionality. This series is mostly about adding support for relaxed timing, spinlock, and virtual apic. For more Hyper-V related information please see: Hypervisor Functional

[PATCH RFC v1 2/2] hyper-v: initialize Hyper-V CPUID leafs.

2011-10-17 Thread Vadim Rozenfeld
--- target-i386/kvm.c | 64 +++- 1 files changed, 62 insertions(+), 2 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 3840255..30b3e85 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -29,6 +29,7 @@ #include

[PATCH RFC v1 1/2] hyper-v: introduce Hyper-V support infrastructure.

2011-10-17 Thread Vadim Rozenfeld
with the following series of patches we are starting to implement some basic Microsoft Hyper-V Enlightenment functionality, like relaxed timing, spinlock, and virtual apic support. For more Hyper-V related information please see: Hypervisor Functional Specification v2.0: For Windows Server 2008

Re: [Qemu-devel] [PATCH RFC v1 1/2] hyper-v: introduce Hyper-V support infrastructure.

2011-10-17 Thread Kevin Wolf
Am 17.10.2011 11:17, schrieb Vadim Rozenfeld: with the following series of patches we are starting to implement some basic Microsoft Hyper-V Enlightenment functionality, like relaxed timing, spinlock, and virtual apic support. For more Hyper-V related information please see: Hypervisor

[RFC][PATCH 01/45] msi: Guard msi/msix_write_config with msi_present

2011-10-17 Thread Jan Kiszka
Terminate msi/msix_write_config early if support is not enabled. This allows to remove checks at the caller site if MSI is optional. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msi.c |3 ++- hw/msix.c |2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git

[RFC][PATCH 03/45] msi: Use msi/msix_present more consistently

2011-10-17 Thread Jan Kiszka
Replace some open-coded msi/msix_present checks and drop redundant msix_supported tests (present implies supported). Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msi.c |2 +- hw/msix.c | 20 2 files changed, 9 insertions(+), 13 deletions(-) diff --git

[RFC][PATCH 14/45] qemu-kvm: Drop useless kvm_clear_gsi_routes

2011-10-17 Thread Jan Kiszka
There are no routes to clear at this point, we are just creating the VM. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- qemu-kvm-x86.c |1 - qemu-kvm.c | 10 -- qemu-kvm.h |9 - 3 files changed, 0 insertions(+), 20 deletions(-) diff --git a/qemu-kvm-x86.c

[RFC][PATCH 16/45] qemu-kvm: Use MSIMessage and MSIRoutingCache

2011-10-17 Thread Jan Kiszka
Start benefiting from the new abstractions and drop the KVM-specific vector tracking to generic MSIMessage and MSIRoutingCache data structures and helpers, also reducing the diff to upstream. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msi.c| 49

[RFC][PATCH 39/45] pci-assign: Use generic MSI support

2011-10-17 Thread Jan Kiszka
Implement MSI support of a assigned devices via the generic MSI layer of QEMU. Use config notifiers to update the vector route or switch back to INTx when MSI gets disabled again. Using the generic layer not only saves a bit code, it also fixes reset while legacy MSI is in use and adds 64 bit

[RFC][PATCH 38/45] msi: Implement config notifiers for legacy MSI

2011-10-17 Thread Jan Kiszka
Realize support for MSI config notifiers analogously to MSI-X. The logic is slightly more complex for legacy MSI as per-vector masking is option here. Device assignment will be the first user. Note that this change does not introduce per-vector masking support. This can to be added at some later

[RFC][PATCH 05/45] msi: Invoke msi/msix_write_config from PCI core

2011-10-17 Thread Jan Kiszka
Also this functions is better invoked by the core than by each and every device. This allows to drop the config_write callbacks from ich and intel-hda. CC: Alexander Graf ag...@suse.de CC: Gerd Hoffmann kra...@redhat.com CC: Isaku Yamahata yamah...@valinux.co.jp Signed-off-by: Jan Kiszka

[RFC][PATCH 04/45] msi: Invoke msi/msix_reset from PCI core

2011-10-17 Thread Jan Kiszka
There is no point in pushing this burden to the devices, they may rather forget to call them (like intel-hda and ahci ATM). Instead, reset functions are now called from pci_device_reset and pci_bridge_reset. They do nothing if the MSI/MSI-X is not in use. CC: Alexander Graf ag...@suse.de CC: Gerd

[RFC][PATCH 00/45] qemu-kvm: MSI layer rework for in-kernel irqchip support

2011-10-17 Thread Jan Kiszka
As previously indicated, I was working for quite a while on a major refactoring of the MSI additions we have in qemu-kvm to support in-kernel irqchip, vhost and device assignment. This is now the outcome. I'm quite happy with it, things are still working (apparently), and the invasiveness of KVM

[RFC][PATCH 41/45] msix: Drop unused msix_bar_size

2011-10-17 Thread Jan Kiszka
No use for it, even more after the upcoming API changes. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msix.c |8 hw/msix.h |2 -- hw/pci.h |2 -- 3 files changed, 0 insertions(+), 12 deletions(-) diff --git a/hw/msix.c b/hw/msix.c index 5f0fa6a..bccd8b1 100644

[RFC][PATCH 44/45] pci-assign: Use generic MSI-X support

2011-10-17 Thread Jan Kiszka
Switch MSI-X support of the device assignment core to the generic layer QEMU offers. As for legacy MSI, we use config notifiers to update IRQ assignment and routes on guest changes. Quite a bit code becomes obsolete in the device assigment core, e.g. the maintenance of the MSI-X vector masking

[RFC][PATCH 35/45] pci-assign: Polish assigned_dev_update_msix_mmio

2011-10-17 Thread Jan Kiszka
- rename to assigned_dev_set_msix_vectors - drop unused msg_ctrl - use pci_get_* accessors - rename variable va to msix_page - clarify comment on msg_data == 0 optimization - fix coding style Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/device-assignment.c | 53

[RFC][PATCH 40/45] qemu-kvm: msix: Drop check for preexisting cap from msix_add_config

2011-10-17 Thread Jan Kiszka
msix_add_config is called from msix_init which only supports init-once. Moreover, msix_add_config performed no check if the provided parameters were compatible with the existing capability entry, so was inconsistent anyway. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msix.c | 72

[RFC][PATCH 45/45] pci-assign: Fix coding style issues

2011-10-17 Thread Jan Kiszka
Also remove the dead get_assigned_device at this chance. No functional changes. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/device-assignment.c | 199 hw/device-assignment.h | 14 ++-- 2 files changed, 107 insertions(+), 106

[RFC][PATCH 10/45] msix: Factor out msix_message_from_vector

2011-10-17 Thread Jan Kiszka
This helper will also be used by the upcoming config notifier. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msix.c | 19 +-- 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/hw/msix.c b/hw/msix.c index 04e08e5..50fa504 100644 --- a/hw/msix.c +++

[RFC][PATCH 43/45] msix: Allow to customize capability on init

2011-10-17 Thread Jan Kiszka
This enables fully configurable MSI-X initialization by taking config space offset, independent table and PBA BARs and the offset inside them on msix_init. Table and PBA are now realized as two memory subregions, either of the passed BAR regions or the single page container msix_init_simple

[RFC][PATCH 36/45] qemu-kvm: Factor out kvm_device_msix_* services

2011-10-17 Thread Jan Kiszka
Create kvm_device_msix_{supported,init_vectors,set_vector,assign}, replacing the old kvm_assign_set_msix_{nr,entry} services. The new API no longer requires direct fiddling with the KVM API data structures and just takes the required parameters. kvm_device_msix_set_vector also combines MSI route

[RFC][PATCH 12/45] msi: Introduce MSIRoutingCache

2011-10-17 Thread Jan Kiszka
This cache will help us implementing KVM in-kernel irqchip support without spreading hooks all over the place. KVM requires us to register it first and then deliver it by raising a pseudo IRQ line returned on registration. While this could be changed for QEMU-originated MSI messages by adding

Re: [PATCH v3 1/6] iommu/core: split mapping to page sizes as supported by the hardware

2011-10-17 Thread Roedel, Joerg
Hi Ohad, On Mon, Oct 17, 2011 at 04:05:02AM -0400, Ohad Ben-Cohen wrote: This whole thing is quite marginal though and also very easy to change later, so we can start with the driver-provided io_page_size approach for now. Sorry, I just couldn't get myself to sign-off this as it really

[RFC][PATCH 08/45] Introduce MSIMessage structure

2011-10-17 Thread Jan Kiszka
Will be used for generating and distributing MSI messages, both in emulation mode and under KVM. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msi.h |5 + qemu-common.h |1 + 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/hw/msi.h b/hw/msi.h index

[RFC][PATCH 25/45] qemu-kvm: Update MSI cache on kvm_msi_irqfd_set

2011-10-17 Thread Jan Kiszka
Updating the MSI message registration on kvm_msi_irqfd_set will allow us to switch to a lazy mode and remove the need to track message changes in the device config space. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/virtio-pci.c | 10 ++ kvm.h |3 ++-

[RFC][PATCH 21/45] qemu-kvm: msix: Don't fire notifier spuriously on set/unset

2011-10-17 Thread Jan Kiszka
If MSI-X is disabled or the global mask is set, don't fire the notifier during registration or removal, reporting a wrong state. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msix.c | 22 ++ 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/hw/msix.c

[RFC][PATCH 42/45] msix: Introduce msix_init_simple

2011-10-17 Thread Jan Kiszka
Devices models are usually not interested in specifying MSI-X configuration details beyond the number of vectors to provide and the BAR number to use. Layout of an exclusively used BAR and its registration can also be handled centrally. This is the purpose of msix_init_simple. It provides handy

[RFC][PATCH 28/45] qemu-kvm: msix: Drop tracking of used vectors

2011-10-17 Thread Jan Kiszka
This optimization was only required to keep KVM route usage low. Now that we solve that problem via lazy updates, we can drop the field. We still need interfaces to clear pending vectors, though (and we have to make use of them more broadly - but that's unrelated to this patch). Signed-off-by:

[RFC][PATCH 37/45] qemu-kvm: Clean up irqrouting API

2011-10-17 Thread Jan Kiszka
Drop unused functions, privatize those which are only used internally now. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- kvm-stub.c | 10 -- kvm.h |1 - qemu-kvm.c | 37 ++--- qemu-kvm.h | 39 --- 4

[RFC][PATCH 31/45] qemu-kvm: Refactor kvm_deassign_irq to kvm_device_irq_deassign

2011-10-17 Thread Jan Kiszka
Don't pass kvm_assigned_irq struct, rather use the actually required fields in the interface. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/device-assignment.c | 42 -- qemu-kvm.c | 15 ++- qemu-kvm.h |

[RFC][PATCH 34/45] qemu-kvm: Factor out kvm_device_msi_assign

2011-10-17 Thread Jan Kiszka
This reuses the MSI routing infrastructure of the KVM core by folding both the routing setup and the IRQ assignment into a new function called kvm_device_msi_assign. It's also a good chance to clean up the IRQ deassignment before updates. Signed-off-by: Jan Kiszka jan.kis...@siemens.com ---

[RFC][PATCH 26/45] qemu-kvm: Use g_realloc for irq_routes extension

2011-10-17 Thread Jan Kiszka
Allows to drop checking for out-of-memory. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- qemu-kvm.c |7 +-- 1 files changed, 1 insertions(+), 6 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index 6bdd7b5..eb8f176 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -258,7 +258,6 @@

[RFC][PATCH 27/45] qemu-kvm: Lazily update MSI caches

2011-10-17 Thread Jan Kiszka
Instead of registering every possible MSI message that is prepared in some device's config space, this commit only registers those messages that are actually sent. Every message that runs through the delivery hook is first checked against its cached data. If there is a mismatch, then the

[RFC][PATCH 33/45] qemu-kvm: Factor out kvm_device_intx_assign

2011-10-17 Thread Jan Kiszka
Avoid passing kvm_assigned_irq on INTx assignment and separate this function from (to-be-refactored) MSI/MSI-X assignment. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/device-assignment.c | 21 ++--- qemu-kvm.c | 17 + qemu-kvm.h

[RFC][PATCH 32/45] pci-assign: Factor out deassign_irq

2011-10-17 Thread Jan Kiszka
Will have more users soon. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/device-assignment.c | 30 ++ 1 files changed, 18 insertions(+), 12 deletions(-) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index e0b9cfe..e5ac54c 100644 ---

[RFC][PATCH 29/45] pci-assign: Drop kvm_assigned_irq::host_irq initialization

2011-10-17 Thread Jan Kiszka
real_device.irq is never set explicitly, thus remains 0. So we can simply drop this line as assigned_irq_data is zero-initialized anyway. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/device-assignment.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git

[RFC][PATCH 17/45] qemu-kvm: Track MSIRoutingCache in KVM routing table

2011-10-17 Thread Jan Kiszka
Keep a link from the internal KVM routing table to potential MSI routing cache entries. The link is used so far whenever the entry is dropped to invalidate the cache content. It will allow us to build MSI routing entries on demand and flush existing ones on table overflow. Signed-off-by: Jan

[RFC][PATCH 22/45] qemu-kvm: msix: Fire mask notifier on global mask changes

2011-10-17 Thread Jan Kiszka
Also invoke the mask notifier if the global MSI-X mask is modified. For this purpose, we push the notifier call from the per-vector mask update to the central msix_handle_mask_update. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msix.c | 16 +--- 1 files changed, 9

[RFC][PATCH 20/45] qemu-kvm: msix: Only invoke msix_handle_mask_update on changes

2011-10-17 Thread Jan Kiszka
Reorganize msix_mmio_writel so that msix_handle_mask_update is only called on mask changes. Pass previous config space value to msix_write_config so that is can check if a mask change took place. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msix.c | 36

[RFC][PATCH 30/45] pci-assign: Rename assign_irq to assign_intx

2011-10-17 Thread Jan Kiszka
The previous name may incorrectly suggest that this function assigns all types of IRQs though it's only dealing with legacy interrupts. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/device-assignment.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git

[RFC][PATCH 23/45] qemu-kvm: Rework MSI-X mask notifier to generic MSI config notifiers

2011-10-17 Thread Jan Kiszka
MSI config notifiers are supposed to be triggered on every relevant configuration change of MSI vectors or if MSI is enabled/disabled. Two notifiers are established, one for vector changes and one for general enabling. The former notifier additionally passes the currently active MSI message. This

[RFC][PATCH 11/45] msi: Factor out delivery hook

2011-10-17 Thread Jan Kiszka
So far we deliver MSI messages by writing them into the target MMIO area. This reflects what happens on hardware, but imposes some limitations on the emulation when introducing KVM in-kernel irqchip models. For those we will need to track the message origin. Moreover, different architecture or

[RFC][PATCH 15/45] qemu-kvm: Drop unused kvm_del_irq_route

2011-10-17 Thread Jan Kiszka
kvm_add_irq_route only exists to create platform specific static routes. So there is no need for a corresponding delete. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- qemu-kvm.c | 16 qemu-kvm.h |8 2 files changed, 0 insertions(+), 24 deletions(-) diff

[RFC][PATCH 18/45] qemu-kvm: Hook into MSI delivery at APIC level

2011-10-17 Thread Jan Kiszka
Move the two hooks for MSI delivery to in-kernel irqchips from the MSI layer to a single place: the APIC. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/apic.c | 24 +++- hw/msi.c |5 - hw/msix.c |5 - 3 files changed, 15 insertions(+), 19

[RFC][PATCH 24/45] qemu-kvm: msix: Don't handle mask updated while disabled

2011-10-17 Thread Jan Kiszka
As long as MSI-X is disabled, it's incorrect to invoke msix_handle_mask_update on per-vector mask changes. That may misguide the config notifier callback or spuriously trigger an MSI event. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msix.c |2 +- 1 files changed, 1

[RFC][PATCH 09/45] msi: Factor out msi_message_from_vector

2011-10-17 Thread Jan Kiszka
This helper will also be used by the upcoming config notifier. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msi.c | 43 +-- 1 files changed, 25 insertions(+), 18 deletions(-) diff --git a/hw/msi.c b/hw/msi.c index 2b7b6e3..3c7ebc3 100644 ---

[RFC][PATCH 07/45] msi: Generalize msix_supported to msi_supported

2011-10-17 Thread Jan Kiszka
Rename msix_supported to msi_supported and control MSI and MSI-X activation this way. That was likely to original intention for this flag, but MSI support came after MSI-X. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msi.c |8 hw/msi.h |2 ++ hw/msix.c |8

[RFC][PATCH 13/45] hpet: Use msi_deliver

2011-10-17 Thread Jan Kiszka
Avoid the slow-path MSI delivery via stl_phys by switching to msi_deliver. This also allows to prepare these rarely changing messages in advance. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/hpet.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git

[RFC][PATCH 19/45] qemu-kvm: Factor out kvm_msi_irqfd_set

2011-10-17 Thread Jan Kiszka
This makes the KVM core layer aware of the irqfd associated with some MSI cache. kvm_msi_irqfd_set is defined for this purpose, which avoids that virtio needs to peek into the cache for extracting the GSI. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/virtio-pci.c |6 +++--- kvm.h

[RFC][PATCH 02/45] msi: Guard msi_reset with msi_present

2011-10-17 Thread Jan Kiszka
Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msi.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/hw/msi.c b/hw/msi.c index bbc9cd7..5db 100644 --- a/hw/msi.c +++ b/hw/msi.c @@ -288,6 +288,9 @@ void msi_reset(PCIDevice *dev) uint16_t flags;

[RFC][PATCH 06/45] msix: Prevent bogus mask updates on MMIO accesses

2011-10-17 Thread Jan Kiszka
Only accesses to the MSI-X table must trigger a call to msix_handle_mask_update or a notifier invocation. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- hw/msix.c | 16 ++-- 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/msix.c b/hw/msix.c index

Re: [PATCH RFC v1 1/2] hyper-v: introduce Hyper-V support infrastructure.

2011-10-17 Thread Jan Kiszka
On 2011-10-17 11:17, Vadim Rozenfeld wrote: with the following series of patches we are starting to implement some basic Microsoft Hyper-V Enlightenment functionality, like relaxed timing, spinlock, and virtual apic support. For more Hyper-V related information please see: Hypervisor

Re: [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation

2011-10-17 Thread Lai Jiangshan
On 10/16/2011 05:39 PM, Avi Kivity wrote: On 10/14/2011 11:03 AM, Lai Jiangshan wrote: Currently, NMI interrupt is blindly sent to all the vCPUs when NMI button event happens. This doesn't properly emulate real hardware on which NMI button event triggers LINT1. Because of this, NMI is sent to

Re: [PATCH RFC v1 2/2] hyper-v: initialize Hyper-V CPUID leafs.

2011-10-17 Thread Paolo Bonzini
On 10/17/2011 11:17 AM, Vadim Rozenfeld wrote: @@ -379,11 +380,16 @@ int kvm_arch_init_vcpu(CPUState *env) cpuid_i = 0; /* Paravirtualization CPUIDs */ -memcpy(signature, KVMKVMKVM\0\0\0, 12); c =cpuid_data.entries[cpuid_i++]; memset(c, 0, sizeof(*c));

Re: [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation

2011-10-17 Thread Avi Kivity
On 10/17/2011 11:40 AM, Lai Jiangshan wrote: LINT1 may have been programmed as a level -triggered interrupt instead of edge triggered (NMI or interrupt). We can use the ioctl argument for the level (and pressing the NMI button needs to pulse the level to 1 and back to 0). Hi,

Re: [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation

2011-10-17 Thread Avi Kivity
On 10/17/2011 11:17 AM, Lai Jiangshan wrote: On 10/16/2011 05:39 PM, Avi Kivity wrote: On 10/14/2011 11:03 AM, Lai Jiangshan wrote: Currently, NMI interrupt is blindly sent to all the vCPUs when NMI button event happens. This doesn't properly emulate real hardware on which NMI button

Re: [PATCH v3 1/6] iommu/core: split mapping to page sizes as supported by the hardware

2011-10-17 Thread Ohad Ben-Cohen
On Mon, Oct 17, 2011 at 11:28 AM, Roedel, Joerg joerg.roe...@amd.com wrote: The patch looks good now. Please implement option a) and it should be fine. Ok, will send in a few moments. I will test it on an AMD IOMMU platform. We still need someone to test it on VT-d. That could be great,

Re: Running KVM inside a chroot

2011-10-17 Thread Avi Kivity
On 10/17/2011 08:10 AM, Jorge Lucangeli Obes wrote: What do top/vmstat/kvm_stat say? I'm attaching the output of the three commands during a test run launched form inside the chroot, which was slow as usual. I didn't see anything too weird on top/vmstat, though I found it odd that once the

Re: [Qemu-devel] [PATCH v8 1/4] block: add the block queue support

2011-10-17 Thread Kevin Wolf
Am 26.09.2011 10:01, schrieb Zhi Yong Wu: On Fri, Sep 23, 2011 at 11:32 PM, Kevin Wolf kw...@redhat.com wrote: Am 08.09.2011 12:11, schrieb Zhi Yong Wu: Signed-off-by: Zhi Yong Wu wu...@linux.vnet.ibm.com --- Makefile.objs |2 +- block/blk-queue.c | 201

Re: [Qemu-devel] [PATCH v8 2/4] block: add the command line support

2011-10-17 Thread Kevin Wolf
Am 26.09.2011 08:15, schrieb Zhi Yong Wu: On Fri, Sep 23, 2011 at 11:54 PM, Kevin Wolf kw...@redhat.com wrote: +} + +static void bdrv_block_timer(void *opaque) +{ +BlockDriverState *bs = opaque; +BlockQueue *queue= bs-block_queue; + +qemu_block_queue_flush(queue); Hm,

Re: [Qemu-devel] [PATCH v8 1/4] block: add the block queue support

2011-10-17 Thread Paolo Bonzini
On 10/17/2011 12:17 PM, Kevin Wolf wrote: + +static int qemu_block_queue_handler(BlockQueueAIOCB *request) +{ +int ret; +BlockDriverAIOCB *res; + +res = request-handler(request-common.bs, request-sector_num, + request-qiov,

Re: [PATCH 1/1 V5] kernel/kvm: introduce KVM_SET_LINT1 and fix improper nmi emulation

2011-10-17 Thread Jan Kiszka
On 2011-10-17 11:54, Avi Kivity wrote: On 10/17/2011 11:17 AM, Lai Jiangshan wrote: On 10/16/2011 05:39 PM, Avi Kivity wrote: On 10/14/2011 11:03 AM, Lai Jiangshan wrote: Currently, NMI interrupt is blindly sent to all the vCPUs when NMI button event happens. This doesn't properly emulate

Re: [Qemu-devel] [PATCH v8 3/4] block: add block timer and throttling algorithm

2011-10-17 Thread Kevin Wolf
Am 26.09.2011 09:24, schrieb Zhi Yong Wu: On Sat, Sep 24, 2011 at 12:19 AM, Kevin Wolf kw...@redhat.com wrote: Am 08.09.2011 12:11, schrieb Zhi Yong Wu: Note: 1.) When bps/iops limits are specified to a small value such as 511 bytes/s, this VM will hang up. We are considering how to

Re: [PATCH RFC v1 2/2] hyper-v: initialize Hyper-V CPUID leafs.

2011-10-17 Thread Avi Kivity
On 10/17/2011 11:40 AM, Paolo Bonzini wrote: On 10/17/2011 11:17 AM, Vadim Rozenfeld wrote: @@ -379,11 +380,16 @@ int kvm_arch_init_vcpu(CPUState *env) cpuid_i = 0; /* Paravirtualization CPUIDs */ -memcpy(signature, KVMKVMKVM\0\0\0, 12); c

Re: [PATCH RFC v1 2/2] hyper-v: initialize Hyper-V CPUID leafs.

2011-10-17 Thread Paolo Bonzini
On 10/17/2011 12:41 PM, Avi Kivity wrote: Even not counting that hyper-v support should IMHO not be in KVM-specific code, I still think this shouldn't remove KVM leaves completely but rather move them to 0x4100. The KVM paravirtualization code then can similarly probe with 0x100

Re: [RFC][PATCH 11/45] msi: Factor out delivery hook

2011-10-17 Thread Avi Kivity
On 10/17/2011 11:27 AM, Jan Kiszka wrote: So far we deliver MSI messages by writing them into the target MMIO area. This reflects what happens on hardware, but imposes some limitations on the emulation when introducing KVM in-kernel irqchip models. For those we will need to track the message

Re: [PATCH RFC 2/2] kvm: set affinity hint for assigned device msi

2011-10-17 Thread Marcelo Tosatti
On Sun, Oct 16, 2011 at 03:12:23PM +0200, Michael S. Tsirkin wrote: On Thu, Oct 13, 2011 at 11:54:50AM -0300, Marcelo Tosatti wrote: On Tue, Oct 11, 2011 at 08:38:28PM +0200, Michael S. Tsirkin wrote: To forward an interrupt to a vcpu that runs on a host cpu different from the current

Re: [RFC][PATCH 12/45] msi: Introduce MSIRoutingCache

2011-10-17 Thread Avi Kivity
On 10/17/2011 11:27 AM, Jan Kiszka wrote: This cache will help us implementing KVM in-kernel irqchip support without spreading hooks all over the place. KVM requires us to register it first and then deliver it by raising a pseudo IRQ line returned on registration. While this could be changed

Re: [RFC][PATCH 06/45] msix: Prevent bogus mask updates on MMIO accesses

2011-10-17 Thread Michael S. Tsirkin
On Mon, Oct 17, 2011 at 11:27:40AM +0200, Jan Kiszka wrote: Only accesses to the MSI-X table must trigger a call to msix_handle_mask_update or a notifier invocation. Signed-off-by: Jan Kiszka jan.kis...@siemens.com Why would msix_mmio_write be called on an access outside the table? ---

Re: [PATCH RFC 2/2] kvm: set affinity hint for assigned device msi

2011-10-17 Thread Marcelo Tosatti
On Sun, Oct 16, 2011 at 03:12:23PM +0200, Michael S. Tsirkin wrote: On Thu, Oct 13, 2011 at 11:54:50AM -0300, Marcelo Tosatti wrote: On Tue, Oct 11, 2011 at 08:38:28PM +0200, Michael S. Tsirkin wrote: To forward an interrupt to a vcpu that runs on a host cpu different from the current

Re: [RFC][PATCH 17/45] qemu-kvm: Track MSIRoutingCache in KVM routing table

2011-10-17 Thread Avi Kivity
On 10/17/2011 11:27 AM, Jan Kiszka wrote: Keep a link from the internal KVM routing table to potential MSI routing cache entries. The link is used so far whenever the entry is dropped to invalidate the cache content. It will allow us to build MSI routing entries on demand and flush existing

Re: [RFC][PATCH 11/45] msi: Factor out delivery hook

2011-10-17 Thread Jan Kiszka
On 2011-10-17 12:56, Avi Kivity wrote: On 10/17/2011 11:27 AM, Jan Kiszka wrote: So far we deliver MSI messages by writing them into the target MMIO area. This reflects what happens on hardware, but imposes some limitations on the emulation when introducing KVM in-kernel irqchip models. For

Re: [RFC][PATCH 12/45] msi: Introduce MSIRoutingCache

2011-10-17 Thread Jan Kiszka
On 2011-10-17 13:06, Avi Kivity wrote: On 10/17/2011 11:27 AM, Jan Kiszka wrote: This cache will help us implementing KVM in-kernel irqchip support without spreading hooks all over the place. KVM requires us to register it first and then deliver it by raising a pseudo IRQ line returned on

Re: [RFC][PATCH 42/45] msix: Introduce msix_init_simple

2011-10-17 Thread Michael S. Tsirkin
On Mon, Oct 17, 2011 at 11:28:16AM +0200, Jan Kiszka wrote: Devices models are usually not interested in specifying MSI-X configuration details beyond the number of vectors to provide and the BAR number to use. Layout of an exclusively used BAR and its registration can also be handled

Re: [RFC][PATCH 11/45] msi: Factor out delivery hook

2011-10-17 Thread Avi Kivity
On 10/17/2011 01:15 PM, Jan Kiszka wrote: On 2011-10-17 12:56, Avi Kivity wrote: On 10/17/2011 11:27 AM, Jan Kiszka wrote: So far we deliver MSI messages by writing them into the target MMIO area. This reflects what happens on hardware, but imposes some limitations on the emulation when

Re: [RFC][PATCH 06/45] msix: Prevent bogus mask updates on MMIO accesses

2011-10-17 Thread Jan Kiszka
On 2011-10-17 13:10, Michael S. Tsirkin wrote: On Mon, Oct 17, 2011 at 11:27:40AM +0200, Jan Kiszka wrote: Only accesses to the MSI-X table must trigger a call to msix_handle_mask_update or a notifier invocation. Signed-off-by: Jan Kiszka jan.kis...@siemens.com Why would msix_mmio_write be

Re: [RFC][PATCH 12/45] msi: Introduce MSIRoutingCache

2011-10-17 Thread Avi Kivity
On 10/17/2011 01:19 PM, Jan Kiszka wrote: IMO this needlessly leaks kvm information into core qemu. The cache should be completely hidden in kvm code. I think msi_deliver() can hide the use of the cache completely. For pre-registered events like kvm's irqfd, you can use something like

Re: [RFC][PATCH 17/45] qemu-kvm: Track MSIRoutingCache in KVM routing table

2011-10-17 Thread Jan Kiszka
On 2011-10-17 13:13, Avi Kivity wrote: On 10/17/2011 11:27 AM, Jan Kiszka wrote: Keep a link from the internal KVM routing table to potential MSI routing cache entries. The link is used so far whenever the entry is dropped to invalidate the cache content. It will allow us to build MSI routing

Re: [RFC][PATCH 42/45] msix: Introduce msix_init_simple

2011-10-17 Thread Jan Kiszka
On 2011-10-17 13:22, Michael S. Tsirkin wrote: On Mon, Oct 17, 2011 at 11:28:16AM +0200, Jan Kiszka wrote: Devices models are usually not interested in specifying MSI-X configuration details beyond the number of vectors to provide and the BAR number to use. Layout of an exclusively used BAR

[PATCH v4 2/7] iommu/core: split mapping to page sizes as supported by the hardware

2011-10-17 Thread Ohad Ben-Cohen
When mapping a memory region, split it to page sizes as supported by the iommu hardware. Always prefer bigger pages, when possible, in order to reduce the TLB pressure. The logic to do that is now added to the IOMMU core, so neither the iommu drivers themselves nor users of the IOMMU API have to

Re: [RFC][PATCH 11/45] msi: Factor out delivery hook

2011-10-17 Thread Jan Kiszka
On 2011-10-17 13:22, Avi Kivity wrote: On 10/17/2011 01:15 PM, Jan Kiszka wrote: On 2011-10-17 12:56, Avi Kivity wrote: On 10/17/2011 11:27 AM, Jan Kiszka wrote: So far we deliver MSI messages by writing them into the target MMIO area. This reflects what happens on hardware, but imposes some

Re: [RFC][PATCH 12/45] msi: Introduce MSIRoutingCache

2011-10-17 Thread Jan Kiszka
On 2011-10-17 13:25, Avi Kivity wrote: On 10/17/2011 01:19 PM, Jan Kiszka wrote: IMO this needlessly leaks kvm information into core qemu. The cache should be completely hidden in kvm code. I think msi_deliver() can hide the use of the cache completely. For pre-registered events like kvm's

Re: [RFC][PATCH 23/45] qemu-kvm: Rework MSI-X mask notifier to generic MSI config notifiers

2011-10-17 Thread Michael S. Tsirkin
On Mon, Oct 17, 2011 at 11:27:57AM +0200, Jan Kiszka wrote: MSI config notifiers are supposed to be triggered on every relevant configuration change of MSI vectors or if MSI is enabled/disabled. Two notifiers are established, one for vector changes and one for general enabling. The former

Re: [RFC][PATCH 23/45] qemu-kvm: Rework MSI-X mask notifier to generic MSI config notifiers

2011-10-17 Thread Jan Kiszka
On 2011-10-17 13:40, Michael S. Tsirkin wrote: On Mon, Oct 17, 2011 at 11:27:57AM +0200, Jan Kiszka wrote: MSI config notifiers are supposed to be triggered on every relevant configuration change of MSI vectors or if MSI is enabled/disabled. Two notifiers are established, one for vector

Re: [RFC][PATCH 08/45] Introduce MSIMessage structure

2011-10-17 Thread Michael S. Tsirkin
On Mon, Oct 17, 2011 at 11:27:42AM +0200, Jan Kiszka wrote: Will be used for generating and distributing MSI messages, both in emulation mode and under KVM. Signed-off-by: Jan Kiszka jan.kis...@siemens.com I would add uint64_t msix_get_address(dev, vector) uint64_t msix_get_data(dev,

Re: [RFC][PATCH 08/45] Introduce MSIMessage structure

2011-10-17 Thread Jan Kiszka
On 2011-10-17 13:46, Michael S. Tsirkin wrote: On Mon, Oct 17, 2011 at 11:27:42AM +0200, Jan Kiszka wrote: Will be used for generating and distributing MSI messages, both in emulation mode and under KVM. Signed-off-by: Jan Kiszka jan.kis...@siemens.com I would add uint64_t

Re: [RFC][PATCH 06/45] msix: Prevent bogus mask updates on MMIO accesses

2011-10-17 Thread Michael S. Tsirkin
On Mon, Oct 17, 2011 at 01:23:46PM +0200, Jan Kiszka wrote: On 2011-10-17 13:10, Michael S. Tsirkin wrote: On Mon, Oct 17, 2011 at 11:27:40AM +0200, Jan Kiszka wrote: Only accesses to the MSI-X table must trigger a call to msix_handle_mask_update or a notifier invocation. Signed-off-by:

Re: [RFC][PATCH 08/45] Introduce MSIMessage structure

2011-10-17 Thread Michael S. Tsirkin
On Mon, Oct 17, 2011 at 01:51:00PM +0200, Jan Kiszka wrote: On 2011-10-17 13:46, Michael S. Tsirkin wrote: On Mon, Oct 17, 2011 at 11:27:42AM +0200, Jan Kiszka wrote: Will be used for generating and distributing MSI messages, both in emulation mode and under KVM. Signed-off-by: Jan

Re: [RFC][PATCH 06/45] msix: Prevent bogus mask updates on MMIO accesses

2011-10-17 Thread Jan Kiszka
On 2011-10-17 13:57, Michael S. Tsirkin wrote: On Mon, Oct 17, 2011 at 01:23:46PM +0200, Jan Kiszka wrote: On 2011-10-17 13:10, Michael S. Tsirkin wrote: On Mon, Oct 17, 2011 at 11:27:40AM +0200, Jan Kiszka wrote: Only accesses to the MSI-X table must trigger a call to msix_handle_mask_update

Re: [RFC][PATCH 08/45] Introduce MSIMessage structure

2011-10-17 Thread Jan Kiszka
On 2011-10-17 14:04, Michael S. Tsirkin wrote: On Mon, Oct 17, 2011 at 01:51:00PM +0200, Jan Kiszka wrote: On 2011-10-17 13:46, Michael S. Tsirkin wrote: On Mon, Oct 17, 2011 at 11:27:42AM +0200, Jan Kiszka wrote: Will be used for generating and distributing MSI messages, both in emulation

Re: [RFC][PATCH 11/45] msi: Factor out delivery hook

2011-10-17 Thread Avi Kivity
On 10/17/2011 01:29 PM, Jan Kiszka wrote: APIC is x86-specific, MSI is not. I think Xen will also want to make use of this hook. I originally though of using it for the KVM in-kernel models as well, but I will now establish a callback at APIC-level (upstream will look differently from

Re: [RFC][PATCH 22/45] qemu-kvm: msix: Fire mask notifier on global mask changes

2011-10-17 Thread Michael S. Tsirkin
On Mon, Oct 17, 2011 at 11:27:56AM +0200, Jan Kiszka wrote: Also invoke the mask notifier if the global MSI-X mask is modified. For this purpose, we push the notifier call from the per-vector mask update to the central msix_handle_mask_update. Signed-off-by: Jan Kiszka jan.kis...@siemens.com

Re: [RFC][PATCH 17/45] qemu-kvm: Track MSIRoutingCache in KVM routing table

2011-10-17 Thread Avi Kivity
On 10/17/2011 01:25 PM, Jan Kiszka wrote: On 2011-10-17 13:13, Avi Kivity wrote: On 10/17/2011 11:27 AM, Jan Kiszka wrote: Keep a link from the internal KVM routing table to potential MSI routing cache entries. The link is used so far whenever the entry is dropped to invalidate the cache

Re: [RFC][PATCH 12/45] msi: Introduce MSIRoutingCache

2011-10-17 Thread Avi Kivity
On 10/17/2011 01:31 PM, Jan Kiszka wrote: Just to make sure I understand this completely: a hash table indexed by MSIMessage in kvm code would avoid this? You'd just allocate on demand when seeing a new MSIMessage and free on an LRU basis, avoiding pinned entries. I'm not

Re: [RFC][PATCH 00/45] qemu-kvm: MSI layer rework for in-kernel irqchip support

2011-10-17 Thread Avi Kivity
On 10/17/2011 11:27 AM, Jan Kiszka wrote: As previously indicated, I was working for quite a while on a major refactoring of the MSI additions we have in qemu-kvm to support in-kernel irqchip, vhost and device assignment. This is now the outcome. I'm quite happy with it, things are still

Re: [RFC][PATCH 23/45] qemu-kvm: Rework MSI-X mask notifier to generic MSI config notifiers

2011-10-17 Thread Michael S. Tsirkin
On Mon, Oct 17, 2011 at 01:45:04PM +0200, Jan Kiszka wrote: On 2011-10-17 13:40, Michael S. Tsirkin wrote: On Mon, Oct 17, 2011 at 11:27:57AM +0200, Jan Kiszka wrote: MSI config notifiers are supposed to be triggered on every relevant configuration change of MSI vectors or if MSI is

Re: [RFC][PATCH 06/45] msix: Prevent bogus mask updates on MMIO accesses

2011-10-17 Thread Michael S. Tsirkin
On Mon, Oct 17, 2011 at 02:07:10PM +0200, Jan Kiszka wrote: On 2011-10-17 13:57, Michael S. Tsirkin wrote: On Mon, Oct 17, 2011 at 01:23:46PM +0200, Jan Kiszka wrote: On 2011-10-17 13:10, Michael S. Tsirkin wrote: On Mon, Oct 17, 2011 at 11:27:40AM +0200, Jan Kiszka wrote: Only accesses

  1   2   >