From patchwork Thu Jun 29 05:50:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 9816555 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 D1DAD603D7 for ; Thu, 29 Jun 2017 12:00:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AD802851A for ; Thu, 29 Jun 2017 12:00:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F2E2286E1; Thu, 29 Jun 2017 12:00:25 +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 CD7042851A for ; Thu, 29 Jun 2017 12:00:24 +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 1dQY5V-0006UQ-Eh; Thu, 29 Jun 2017 11:58:21 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQY5U-0006SI-FC for xen-devel@lists.xen.org; Thu, 29 Jun 2017 11:58:20 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id 8C/E2-03937-B5BE4595; Thu, 29 Jun 2017 11:58:19 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRWlGSWpSXmKPExsXS1tYhoRv9OiT S4MMBAYslHxezODB6HN39mymAMYo1My8pvyKBNWP/01aWgla+iokP+9gbGNdzdzFycQgJTGOU WLZlIXsXIyeHhACvxJFlM1gh7ACJ8+e2skMUtTNKvNvzF6yITUBd4sTiiYwgtoiAtMS1z5fBb GaBfYwSb56rgtjCAq4SzW++AA3i4GARUJVYdcsAJMwLFH7zdxfULgWJKQ/fM4PYnEDxhptb2E BsIQEXiU89O5knMPIuYGRYxahRnFpUllqka2Sql1SUmZ5RkpuYmaNraGCml5taXJyYnpqTmFS sl5yfu4kRGA4MQLCDcdWCwEOMkhxMSqK8hs9DIoX4kvJTKjMSizPii0pzUosPMcpwcChJ8Dq/ AsoJFqWmp1akZeYAAxMmLcHBoyTC2wfSyltckJhbnJkOkTrFqCglzlsD0icAksgozYNrg0XDJ UZZKWFeRqBDhHgKUotyM0tQ5V8xinMwKgnzyoNM4cnMK4Gb/gpoMRPQYuEZYItLEhFSUg2Mkg 1se5fYKOkfnd60Z3pXQU//GUX31TrGT2Zcv3NpbnRkQ/K3yRP0KpPbXHzeXGJn7Hj1Oned861 +w7YVWVqZprvT5nHx+J5ft6XZ8tRh2+TLoYJXdxXX7+p1vV65nNFw3u6P80tvcJl9a9w6z2/q 8syOo0n2Sw/sC5JQcPE0k9tY+Wj5sW1rlViKMxINtZiLihMBqspjQYECAAA= X-Env-Sender: tianyu.lan@intel.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1498737496!45219401!2 X-Originating-IP: [134.134.136.24] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTM0LjEzNC4xMzYuMjQgPT4gMzkwOTcx\n X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 46534 invoked from network); 29 Jun 2017 11:58:18 -0000 Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by server-2.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 29 Jun 2017 11:58:18 -0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jun 2017 04:58:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.40,280,1496127600"; d="scan'208"; a="1146053369" Received: from sky-ws.sh.intel.com (HELO localhost) ([10.239.48.74]) by orsmga001.jf.intel.com with ESMTP; 29 Jun 2017 04:58:16 -0700 From: Lan Tianyu To: xen-devel@lists.xen.org Date: Thu, 29 Jun 2017 01:50:47 -0400 Message-Id: <1498715457-16565-16-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1498715457-16565-1-git-send-email-tianyu.lan@intel.com> References: <1498715457-16565-1-git-send-email-tianyu.lan@intel.com> Cc: Lan Tianyu , kevin.tian@intel.com, wei.liu2@citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, jbeulich@suse.com, Chao Gao Subject: [Xen-devel] [PATCH 15/25] 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 Previously, 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. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- xen/drivers/passthrough/vtd/vvtd.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/vtd/vvtd.c b/xen/drivers/passthrough/vtd/vvtd.c index e8aeb60..c6d7014 100644 --- a/xen/drivers/passthrough/vtd/vvtd.c +++ b/xen/drivers/passthrough/vtd/vvtd.c @@ -533,6 +533,25 @@ static int vvtd_handle_irq_request(struct domain *d, return -EFAULT; } +static int vvtd_get_irq_info(struct domain *d, + struct irq_remapping_request *irq, + struct 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, ecap; @@ -610,7 +629,8 @@ struct viommu_ops vvtd_hvm_vmx_ops = { .query_caps = vvtd_query_caps, .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)