From patchwork Fri Sep 22 03:01:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 9965573 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1A2BD600C5 for ; Fri, 22 Sep 2017 09:12:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1462429701 for ; Fri, 22 Sep 2017 09:12:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08B3F29806; Fri, 22 Sep 2017 09:12:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B0D8429701 for ; Fri, 22 Sep 2017 09:12:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJyf-0004OV-Ao; Fri, 22 Sep 2017 09:10:29 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJye-0004Mu-Qi for xen-devel@lists.xen.org; Fri, 22 Sep 2017 09:10:28 +0000 Received: from [85.158.143.35] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-2.bemta-6.messagelabs.com id 55/22-20972-383D4C95; Fri, 22 Sep 2017 09:10:27 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRWlGSWpSXmKPExsXS1tYhott0+Ui kwdp+cYslHxezODB6HN39mymAMYo1My8pvyKBNWPC00aWgk0CFRP/TmZpYFzA28XIxSEkMI1R 4s2p/axdjJwcEgK8EkeWzQCyOYDsAIkVd61AwkICHYwSSyYGgthsAuoSJxZPZASxRQSkJa59v swIModZYDOTxNw1s1hAEsICHhJ/WhvAilgEVCX2/1oHFucVcJX4PHk2I8QuBYkpD98zg9icQP FffduZIJa5SLQu3c80gZF3ASPDKkaN4tSistQiXUMjvaSizPSMktzEzBxdQwMzvdzU4uLE9NS cxKRiveT83E2MwHBgAIIdjJc3BhxilORgUhLlfX/+SKQQX1J+SmVGYnFGfFFpTmrxIUYZDg4l CV6/S0A5waLU9NSKtMwcYGDCpCU4eJREeNVA0rzFBYm5xZnpEKlTjLocHTfv/mESYsnLz0uVE ufVAykSACnKKM2DGwGLkkuMslLCvIxARwnxFKQW5WaWoMq/YhTnYFQS5jUAmcKTmVcCt+kV0B FMQEeUrwY7oiQRISXVwKiUvV1O5QPL+aR0jz9bD9rMs1TsrF5t8WS289f+xjj/VfoJ7BoJH74 flpcv45c0P/M/P2hd9Z24li+O2uUGz7+Lr15XksGxfdnFWGe2uw6KHW17PeQuHNv15O2+nc37 eFtPnDKIK32R0/VXas2U6hm+wcptd7f8XuIdpbz9Qr1izPolhpyrbyqxFGckGmoxFxUnAgCVF dhFjQIAAA== X-Env-Sender: tianyu.lan@intel.com X-Msg-Ref: server-12.tower-21.messagelabs.com!1506071424!84085981!1 X-Originating-IP: [134.134.136.20] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTM0LjEzNC4xMzYuMjAgPT4gMzU1MzU4\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 58584 invoked from network); 22 Sep 2017 09:10:26 -0000 Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by server-12.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 22 Sep 2017 09:10:26 -0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Sep 2017 02:10:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.42,427,1500966000"; d="scan'208"; a="1174772945" Received: from sky-ws.sh.intel.com (HELO localhost) ([10.239.48.141]) by orsmga001.jf.intel.com with ESMTP; 22 Sep 2017 02:10:20 -0700 From: Lan Tianyu To: xen-devel@lists.xen.org Date: Thu, 21 Sep 2017 23:01:57 -0400 Message-Id: <1506049330-11196-17-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1506049330-11196-1-git-send-email-tianyu.lan@intel.com> References: <1506049330-11196-1-git-send-email-tianyu.lan@intel.com> Cc: Lan Tianyu , kevin.tian@intel.com, sstabellini@kernel.org, wei.liu2@citrix.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, tim@xen.org, jbeulich@suse.com, roger.pau@citrix.com, Chao Gao Subject: [Xen-devel] [PATCH V3 16/29] x86/vvtd: decode interrupt attribute from IRTE X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Chao Gao Without interrupt remapping, interrupt attributes can be extracted from msi message or IOAPIC RTE. However, with interrupt remapping enabled, the attributes are enclosed in the associated IRTE. This callback is for cases in which the caller wants to acquire interrupt attributes, for example: 1. vioapic_get_vector(). With vIOMMU, the RTE may don't contain vector. 2. perform EOI which is always based on the interrupt vector. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v3: - add example cases in which we will use this function. --- xen/drivers/passthrough/vtd/vvtd.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/vtd/vvtd.c b/xen/drivers/passthrough/vtd/vvtd.c index 90c00f5..5e22ace 100644 --- a/xen/drivers/passthrough/vtd/vvtd.c +++ b/xen/drivers/passthrough/vtd/vvtd.c @@ -516,6 +516,26 @@ static int vvtd_handle_irq_request(struct domain *d, irte.remap.tm); } +static int vvtd_get_irq_info(struct domain *d, + struct arch_irq_remapping_request *irq, + struct arch_irq_remapping_info *info) +{ + int ret; + struct iremap_entry irte; + struct vvtd *vvtd = domain_vvtd(d); + + ret = vvtd_get_entry(vvtd, irq, &irte, false); + if ( ret ) + return ret; + + info->vector = irte.remap.vector; + info->dest = irte_dest(vvtd, irte.remap.dst); + info->dest_mode = irte.remap.dm; + info->delivery_mode = irte.remap.dlm; + + return 0; +} + static void vvtd_reset(struct vvtd *vvtd, uint64_t capability) { uint64_t cap = cap_set_num_fault_regs(1ULL) | @@ -586,7 +606,8 @@ static int vvtd_destroy(struct viommu *viommu) struct viommu_ops vvtd_hvm_vmx_ops = { .create = vvtd_create, .destroy = vvtd_destroy, - .handle_irq_request = vvtd_handle_irq_request + .handle_irq_request = vvtd_handle_irq_request, + .get_irq_info = vvtd_get_irq_info }; static int vvtd_register(void)