From patchwork Thu Nov 20 09:05:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, Feng" X-Patchwork-Id: 5346801 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B197BC11AD for ; Thu, 20 Nov 2014 09:31:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B28162021F for ; Thu, 20 Nov 2014 09:31:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE42E201BC for ; Thu, 20 Nov 2014 09:31:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756865AbaKTJbf (ORCPT ); Thu, 20 Nov 2014 04:31:35 -0500 Received: from mga11.intel.com ([192.55.52.93]:42287 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756791AbaKTJbb (ORCPT ); Thu, 20 Nov 2014 04:31:31 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 20 Nov 2014 01:31:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,422,1413270000"; d="scan'208";a="625421878" Received: from unknown (HELO wf-hsw-desktop.bj.intel.com) ([10.238.154.53]) by fmsmga001.fm.intel.com with ESMTP; 20 Nov 2014 01:14:30 -0800 From: Feng Wu To: alex.williamson@redhat.com, pbonzini@redhat.com Cc: kvm@vger.kernel.org, Feng Wu Subject: [RFC PATCH v1 1/2] vfio: Add new interrupt group for VFIO Date: Thu, 20 Nov 2014 17:05:15 +0800 Message-Id: <1416474316-32159-2-git-send-email-feng.wu@intel.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1416474316-32159-1-git-send-email-feng.wu@intel.com> References: <1416474316-32159-1-git-send-email-feng.wu@intel.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add new group KVM_DEV_VFIO_INTERRUPT and command KVM_DEV_VFIO_DEVIE_POSTING_IRQ related to it. This is used for VT-d Posted-Interrupts setup. Signed-off-by: Feng Wu --- Documentation/virtual/kvm/devices/vfio.txt | 8 ++++++++ include/uapi/linux/kvm.h | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/Documentation/virtual/kvm/devices/vfio.txt b/Documentation/virtual/kvm/devices/vfio.txt index ef51740..bd99176 100644 --- a/Documentation/virtual/kvm/devices/vfio.txt +++ b/Documentation/virtual/kvm/devices/vfio.txt @@ -13,6 +13,7 @@ VFIO-group is held by KVM. Groups: KVM_DEV_VFIO_GROUP + KVM_DEV_VFIO_INTERRUPT KVM_DEV_VFIO_GROUP attributes: KVM_DEV_VFIO_GROUP_ADD: Add a VFIO group to VFIO-KVM device tracking @@ -20,3 +21,10 @@ KVM_DEV_VFIO_GROUP attributes: For each, kvm_device_attr.addr points to an int32_t file descriptor for the VFIO group. + +KVM_DEV_VFIO_INTERRUPT attributes: + KVM_DEV_VFIO_INTERRUPT_POSTING_IRQ: Set up the interrupt configuration for +VT-d Posted-Interrrupts + +For each, kvm_device_attr.addr points to struct kvm_posted_intr, which +include the needed information for VT-d Posted-Interrupts setup. diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 6076882..5544fcc 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -943,9 +943,23 @@ struct kvm_device_attr { __u64 addr; /* userspace address of attr data */ }; +struct virq_info { + __u32 index; /* index of the msi/msix entry */ + int virq; /* virq of the interrupt */ +}; + +struct kvm_posted_intr { + __u32 fd; /* file descriptor of the VFIO device */ + __u32 count; + bool msix; + struct virq_info virq_info[0]; +}; + #define KVM_DEV_VFIO_GROUP 1 #define KVM_DEV_VFIO_GROUP_ADD 1 #define KVM_DEV_VFIO_GROUP_DEL 2 +#define KVM_DEV_VFIO_INTERRUPT 2 +#define KVM_DEV_VFIO_INTERRUPT_POSTING_IRQ 1 enum kvm_device_type { KVM_DEV_TYPE_FSL_MPIC_20 = 1,