From patchwork Fri Feb 18 08:53:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yang X-Patchwork-Id: 573671 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1I8pPa0016668 for ; Fri, 18 Feb 2011 08:51:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756624Ab1BRIvU (ORCPT ); Fri, 18 Feb 2011 03:51:20 -0500 Received: from mga11.intel.com ([192.55.52.93]:22618 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756580Ab1BRIvS (ORCPT ); Fri, 18 Feb 2011 03:51:18 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 18 Feb 2011 00:51:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.62,186,1297065600"; d="scan'208";a="659038109" Received: from syang10-desktop.sh.intel.com (HELO syang10-desktop) ([10.239.13.17]) by fmsmga002.fm.intel.com with ESMTP; 18 Feb 2011 00:51:11 -0800 Received: from yasker by syang10-desktop with local (Exim 4.72) (envelope-from ) id 1PqM5S-0003KA-Dr; Fri, 18 Feb 2011 16:53:14 +0800 From: Sheng Yang To: Avi Kivity , Marcelo Tosatti Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" , Sheng Yang Subject: [PATCH 4/4] KVM: Add documents for MSI-X MMIO API Date: Fri, 18 Feb 2011 16:53:13 +0800 Message-Id: <1298019193-12742-5-git-send-email-sheng@linux.intel.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1298019193-12742-1-git-send-email-sheng@linux.intel.com> References: <1298019193-12742-1-git-send-email-sheng@linux.intel.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 18 Feb 2011 08:51:26 +0000 (UTC) diff --git a/Documentation/kvm/api.txt b/Documentation/kvm/api.txt index e1a9297..dd10c3b 100644 --- a/Documentation/kvm/api.txt +++ b/Documentation/kvm/api.txt @@ -1263,6 +1263,53 @@ struct kvm_assigned_msix_entry { __u16 padding[3]; }; +4.54 KVM_REGISTER_MSIX_MMIO + +Capability: KVM_CAP_MSIX_MMIO +Architectures: x86 +Type: vm ioctl +Parameters: struct kvm_msix_mmio_user (in) +Returns: 0 on success, -1 on error + +This API indicates an MSI-X MMIO address of a guest device. Then all MMIO +operation would be handled by kernel. When necessary(e.g. MSI data/address +changed), KVM would exit to userspace using KVM_EXIT_MSIX_ROUTING_UPDATE to +indicate the MMIO modification and require userspace to update IRQ routing +table. + +NOTICE: Writing the MSI-X MMIO page after it was registered with this API may +be dangerous for userspace program. The writing during VM running may result +in synchronization issue therefore the assigned device can't work properly. +The writing is allowed when VM is not running and can be used as save/restore +mechanism. + +struct kvm_msix_mmio_user { + __u32 dev_id; + __u16 type; /* Device type and MMIO address type */ + __u16 max_entries_nr; /* Maximum entries supported */ + __u64 base_addr; /* Guest physical address of MMIO */ + __u64 base_va; /* Host virtual address of MMIO mapping */ + __u64 flags; /* Reserved for now */ + __u64 reserved[4]; +}; + +Current device type can be: +#define KVM_MSIX_MMIO_TYPE_ASSIGNED_DEV (1 << 0) + +Current MMIO type can be: +#define KVM_MSIX_MMIO_TYPE_BASE_TABLE (1 << 8) + +4.55 KVM_UNREGISTER_MSIX_MMIO + +Capability: KVM_CAP_MSIX_MMIO +Architectures: x86 +Type: vm ioctl +Parameters: struct kvm_msix_mmio_user (in) +Returns: 0 on success, -1 on error + +This API would unregister the specific MSI-X MMIO, indicated by dev_id and +type fields of struct kvm_msix_mmio_user. + 5. The kvm_run structure Application code obtains a pointer to the kvm_run structure by @@ -1445,6 +1492,17 @@ Userspace can now handle the hypercall and when it's done modify the gprs as necessary. Upon guest entry all guest GPRs will then be replaced by the values in this struct. + /* KVM_EXIT_MSIX_ROUTING_UPDATE*/ + struct { + __u32 dev_id; + __u16 type; + __u16 entry_idx; + __u64 flags; + } msix_routing; + +KVM_EXIT_MSIX_ROUTING_UPDATE indicates one MSI-X entry has been modified, and +userspace need to update the correlated routing table. + /* Fix the size of the union. */ char padding[256]; };