From patchwork Wed Oct 14 12:59:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Fedin X-Patchwork-Id: 530169 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 295F3141108 for ; Thu, 15 Oct 2015 00:03:27 +1100 (AEDT) Received: from localhost ([::1]:42215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmLiH-0006nb-0M for incoming@patchwork.ozlabs.org; Wed, 14 Oct 2015 09:03:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmLfE-0003T4-W4 for qemu-devel@nongnu.org; Wed, 14 Oct 2015 09:00:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmLf9-0004oN-3O for qemu-devel@nongnu.org; Wed, 14 Oct 2015 09:00:16 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:62802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmLf8-0004o0-V0 for qemu-devel@nongnu.org; Wed, 14 Oct 2015 09:00:11 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NW7000MEO48WM10@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Wed, 14 Oct 2015 14:00:08 +0100 (BST) X-AuditID: cbfec7f5-f794b6d000001495-38-561e51d8bc76 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 3D.61.05269.8D15E165; Wed, 14 Oct 2015 14:00:08 +0100 (BST) Received: from fedinw7x64.rnd.samsung.ru ([106.109.131.169]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NW700CU4O3ZGH10@eusync4.samsung.com>; Wed, 14 Oct 2015 14:00:08 +0100 (BST) From: Pavel Fedin To: qemu-devel@nongnu.org Date: Wed, 14 Oct 2015 15:59:57 +0300 Message-id: X-Mailer: git-send-email 2.4.4 In-reply-to: References: In-reply-to: References: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprELMWRmVeSWpSXmKPExsVy+t/xa7o3AuXCDH7NZbb4/+sVq8X+bf9Y LeacecBicbx3B4sDi8eda3vYPJ5c28zk8X7fVbYA5igum5TUnMyy1CJ9uwSujC+/pzAV/JSq eLE8q4HxuGgXIyeHhICJxKq7u5khbDGJC/fWs3UxcnEICSxllFi2ZB4ThNPGJDFv6icmkCo2 AXWJ018/sIDYIgKSEr+7ToN1MwtUSfy585gRxBYWcJc43L4RrIZFQFXixIV+9i5GDg5egWiJ X3dVIZbJSVy5Pp0NxOYUMJeYsG4VmC0kYCbxqeMfIy7xCYz8CxgZVjGKppYmFxQnpeca6RUn 5haX5qXrJefnbmKEhNTXHYxLj1kdYhTgYFTi4T2wVjZMiDWxrLgy9xCjBAezkgjvHwO5MCHe lMTKqtSi/Pii0pzU4kOM0hwsSuK8M3e9DxESSE8sSc1OTS1ILYLJMnFwSjUwivw8xhuuX7xe ZmrdwiM3anRCvRZxmQuESlfe47G8+fuN6szrm77ueHRQy3/Rsr+R9VHLfbxLDROuWHwq5Iwu yy0z3yp3SoYl5q3I8dex69Yt6I8UmHPpubUg5+6tP9bed22f0KJqfDEkoTfp47dJK/KF4veV v7uwdMlH9QOsC7xZ5HbmCla9UWIpzkg01GIuKk4EAJkP0QAlAgAA X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 210.118.77.14 Cc: Peter Maydell , Paolo Bonzini , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH v3 1/3] kvm: Make KVM_CAP_SIGNAL_MSI globally available X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This capability is useful to determine whether we can use KVM ITS emulation on ARM Signed-off-by: Pavel Fedin --- include/sysemu/kvm.h | 9 +++++++++ kvm-all.c | 10 +++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 2a58b4d..d42c464 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -52,6 +52,7 @@ extern bool kvm_msi_via_irqfd_allowed; extern bool kvm_gsi_routing_allowed; extern bool kvm_gsi_direct_mapping; extern bool kvm_readonly_mem_allowed; +extern bool kvm_direct_msi_allowed; #if defined CONFIG_KVM || !defined NEED_CPU_H #define kvm_enabled() (kvm_allowed) @@ -145,6 +146,13 @@ extern bool kvm_readonly_mem_allowed; */ #define kvm_readonly_mem_enabled() (kvm_readonly_mem_allowed) +/** + * kvm_direct_msi_enabled: + * + * Returns: true if KVM allows direct MSI injection. + */ +#define kvm_direct_msi_enabled() (kvm_direct_msi_allowed) + #else #define kvm_enabled() (0) #define kvm_irqchip_in_kernel() (false) @@ -157,6 +165,7 @@ extern bool kvm_readonly_mem_allowed; #define kvm_gsi_routing_allowed() (false) #define kvm_gsi_direct_mapping() (false) #define kvm_readonly_mem_enabled() (false) +#define kvm_direct_msi_enabled() (false) #endif struct kvm_run; diff --git a/kvm-all.c b/kvm-all.c index 0be4615..4931b27 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -93,7 +93,6 @@ struct KVMState uint32_t *used_gsi_bitmap; unsigned int gsi_count; QTAILQ_HEAD(msi_hashtab, KVMMSIRoute) msi_hashtab[KVM_MSI_HASHTAB_SIZE]; - bool direct_msi; #endif KVMMemoryListener memory_listener; }; @@ -111,6 +110,7 @@ bool kvm_gsi_direct_mapping; bool kvm_allowed; bool kvm_readonly_mem_allowed; bool kvm_vm_attributes_allowed; +bool kvm_direct_msi_allowed; static const KVMCapabilityInfo kvm_required_capabilites[] = { KVM_CAP_INFO(USER_MEMORY), @@ -979,7 +979,7 @@ void kvm_init_irq_routing(KVMState *s) s->irq_routes = g_malloc0(sizeof(*s->irq_routes)); s->nr_allocated_irq_routes = 0; - if (!s->direct_msi) { + if (!kvm_direct_msi_allowed) { for (i = 0; i < KVM_MSI_HASHTAB_SIZE; i++) { QTAILQ_INIT(&s->msi_hashtab[i]); } @@ -1113,7 +1113,7 @@ static int kvm_irqchip_get_virq(KVMState *s) * number can succeed even though a new route entry cannot be added. * When this happens, flush dynamic MSI entries to free IRQ route entries. */ - if (!s->direct_msi && s->irq_routes->nr == s->gsi_count) { + if (!kvm_direct_msi_allowed && s->irq_routes->nr == s->gsi_count) { kvm_flush_dynamic_msi_routes(s); } @@ -1150,7 +1150,7 @@ int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg) struct kvm_msi msi; KVMMSIRoute *route; - if (s->direct_msi) { + if (kvm_direct_msi_allowed) { msi.address_lo = (uint32_t)msg.address; msi.address_hi = msg.address >> 32; msi.data = le32_to_cpu(msg.data); @@ -1598,7 +1598,7 @@ static int kvm_init(MachineState *ms) #endif #ifdef KVM_CAP_IRQ_ROUTING - s->direct_msi = (kvm_check_extension(s, KVM_CAP_SIGNAL_MSI) > 0); + kvm_direct_msi_allowed = (kvm_check_extension(s, KVM_CAP_SIGNAL_MSI) > 0); #endif s->intx_set_mask = kvm_check_extension(s, KVM_CAP_PCI_2_3);