From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754530AbbFKLFX (ORCPT ); Thu, 11 Jun 2015 07:05:23 -0400 Received: from mga11.intel.com ([192.55.52.93]:24475 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753174AbbFKLBt (ORCPT ); Thu, 11 Jun 2015 07:01:49 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,594,1427785200"; d="scan'208";a="741394251" From: Feng Wu To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: pbonzini@redhat.com, mtosatti@redhat.com, alex.williamson@redhat.com, eric.auger@linaro.org, feng.wu@intel.com Subject: [v4 11/16] KVM: kvm-vfio: User API for VT-d Posted-Interrupts Date: Thu, 11 Jun 2015 18:51:47 +0800 Message-Id: <1434019912-15423-12-git-send-email-feng.wu@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1434019912-15423-1-git-send-email-feng.wu@intel.com> References: <1434019912-15423-1-git-send-email-feng.wu@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds and documents two new attributes KVM_DEV_VFIO_DEVICE_POST_IRQ and KVM_DEV_VFIO_DEVICE_UNPOST_IRQ in KVM_DEV_VFIO_DEVICE group. The new attributes are used for VT-d Posted-Interrupts. When guest OS changes the interrupt configuration for an assigned device, such as, MSI/MSIx data/address fields, QEMU will use this IRQ attribute to tell KVM to update the related IRTE according the VT-d Posted-Interrrupts Specification, such as, the guest vector should be updated in the related IRTE. Signed-off-by: Feng Wu --- Documentation/virtual/kvm/devices/vfio.txt | 9 +++++++++ include/uapi/linux/kvm.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/Documentation/virtual/kvm/devices/vfio.txt b/Documentation/virtual/kvm/devices/vfio.txt index 6186e6d..34925e1 100644 --- a/Documentation/virtual/kvm/devices/vfio.txt +++ b/Documentation/virtual/kvm/devices/vfio.txt @@ -42,3 +42,12 @@ In such a situation, -EAGAIN is returned. It is advised to to set the forwarding before the VFIO signaling is set up, this avoids trial and errors. Unforwarding can happen at any time. + + KVM_DEV_VFIO_DEVICE_POST_IRQ: set a VFIO device IRQ as posted + KVM_DEV_VFIO_DEVICE_UNPOST_IRQ: set a VFIO device IRQ as remapped +For this attribute, kvm_device_attr.addr points to a kvm_vfio_dev_irq struct. + +When guest OS changes the interrupt configuration for an assigned device, +such as, MSI/MSIx data/address fields, QEMU will use this IRQ attribute +to tell KVM to update the related IRTE according the VT-d Posted-Interrrupts +Specification, such as, the guest vector should be updated in the related IRTE. diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 798f3e4..6e17596 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -1002,6 +1002,8 @@ struct kvm_device_attr { #define KVM_DEV_VFIO_DEVICE 2 #define KVM_DEV_VFIO_DEVICE_FORWARD_IRQ 1 #define KVM_DEV_VFIO_DEVICE_UNFORWARD_IRQ 2 +#define KVM_DEV_VFIO_DEVICE_POST_IRQ 3 +#define KVM_DEV_VFIO_DEVICE_UNPOST_IRQ 4 enum kvm_device_type { KVM_DEV_TYPE_FSL_MPIC_20 = 1, -- 2.1.0