From patchwork Thu Jun 29 05:50:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 9816549 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 EEC66603D7 for ; Thu, 29 Jun 2017 12:00:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4309C2853A for ; Thu, 29 Jun 2017 12:00:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37BDB286E1; Thu, 29 Jun 2017 12:00:18 +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.2 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM 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 D2F2A2853A for ; Thu, 29 Jun 2017 12:00:17 +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 1dQY58-00061F-6q; Thu, 29 Jun 2017 11:57:58 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQY57-00060O-0F for xen-devel@lists.xen.org; Thu, 29 Jun 2017 11:57:57 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 79/CD-03032-44BE4595; Thu, 29 Jun 2017 11:57:56 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRWlGSWpSXmKPExsVywNykWNf5dUi kwYQzuhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa0bTnessBa8lK67OdGlg/CfcxcjFISQwjVGi o6eDtYuRk0NCgFfiyLIZULa/xP9Je9khitoZJV7s+8UIkmATUJc4sXgimC0iIC1x7fNlRpAiZ oHNjBKzvq1gB0kIC0RIXPp/GMxmEVCV6D02Ccjm4OAVcJHofy4BsUBBYsrD98wgNqeAq0TDzS 1sILYQUMmnnp3MExh5FzAyrGLUKE4tKkst0jW00EsqykzPKMlNzMzRNTQw08tNLS5OTE/NSUw q1kvOz93ECAwHBiDYwXhzY8AhRkkOJiVRXsPnIZFCfEn5KZUZicUZ8UWlOanFhxhlODiUJHhP vwTKCRalpqdWpGXmAAMTJi3BwaMkwtsH0spbXJCYW5yZDpE6xagoJc7L9QooIQCSyCjNg2uDR cMlRlkpYV5GoEOEeApSi3IzS1DlXzGKczAqCfM+BdnOk5lXAjf9FdBiJqDFwjPAFpckIqSkGh inFLN9v5Cwf8f6tArDf+z8W/+9UdQ4MkdyyTex1oDJSneuzZv/P1/5NpeW9/Tks5qhctWTa1l 1/3UxeCQ67th3W9IsZcuXoMLaIsuXf6fdSXe9Yug973zXs9KK2DOiT5q4Jgq2zopqL/1aJJuU 5SFa/eA9m0LUrNeXNn1i36rnY3Rs+vFGr49KLMUZiYZazEXFiQD1xXC7gQIAAA== X-Env-Sender: tianyu.lan@intel.com X-Msg-Ref: server-6.tower-21.messagelabs.com!1498737473!47847778!1 X-Originating-IP: [192.55.52.115] X-SpamReason: No, hits=0.8 required=7.0 tests=DATE_IN_PAST_06_12 X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57014 invoked from network); 29 Jun 2017 11:57:55 -0000 Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by server-6.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 29 Jun 2017 11:57:55 -0000 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jun 2017 04:57:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,280,1496127600"; d="scan'208";a="986650209" Received: from sky-ws.sh.intel.com (HELO localhost) ([10.239.48.74]) by orsmga003.jf.intel.com with ESMTP; 29 Jun 2017 04:57:51 -0700 From: Lan Tianyu To: xen-devel@lists.xen.org Date: Thu, 29 Jun 2017 01:50:36 -0400 Message-Id: <1498715457-16565-5-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@intel.com Subject: [Xen-devel] [PATCH 4/25] VIOMMU: Add get irq info callback to convert irq remapping request 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 This patch is to add get_irq_info callback for platform implementation to convert irq remapping request to irq info (E,G vector, dest, dest_mode and so on). Signed-off-by: Lan Tianyu --- xen/common/viommu.c | 16 ++++++++++++++++ xen/include/asm-x86/viommu.h | 8 ++++++++ xen/include/xen/viommu.h | 9 +++++++++ 3 files changed, 33 insertions(+) diff --git a/xen/common/viommu.c b/xen/common/viommu.c index 93a0176..a66237f 100644 --- a/xen/common/viommu.c +++ b/xen/common/viommu.c @@ -211,6 +211,22 @@ int viommu_handle_irq_request(struct domain *d, u32 viommu_id, return info->viommu[viommu_id]->ops->handle_irq_request(d, request); } +int viommu_get_irq_info(struct domain *d, u32 viommu_id, + struct irq_remapping_request *request, + struct irq_remapping_info *irq_info) +{ + struct viommu_info *info = &d->viommu; + + if ( viommu_id >= info->nr_viommu + || !info->viommu[viommu_id] ) + return -EINVAL; + + if ( !info->viommu[viommu_id]->ops->get_irq_info ) + return -EINVAL; + + return info->viommu[viommu_id]->ops->get_irq_info(d, request, irq_info); +} + /* * Local variables: * mode: C diff --git a/xen/include/asm-x86/viommu.h b/xen/include/asm-x86/viommu.h index 51bda72..1e8d4be 100644 --- a/xen/include/asm-x86/viommu.h +++ b/xen/include/asm-x86/viommu.h @@ -27,6 +27,14 @@ #define VIOMMU_REQUEST_IRQ_MSI 0 #define VIOMMU_REQUEST_IRQ_APIC 1 +struct irq_remapping_info +{ + u8 vector; + u32 dest; + u32 dest_mode:1; + u32 delivery_mode:3; +}; + struct irq_remapping_request { union { diff --git a/xen/include/xen/viommu.h b/xen/include/xen/viommu.h index 83eb69b..6cfcafd 100644 --- a/xen/include/xen/viommu.h +++ b/xen/include/xen/viommu.h @@ -32,6 +32,8 @@ struct viommu_ops { int (*destroy)(struct viommu *viommu); int (*handle_irq_request)(struct domain *d, struct irq_remapping_request *request); + int (*get_irq_info)(struct domain *d, struct irq_remapping_request *request, + struct irq_remapping_info *info); }; struct viommu { @@ -58,6 +60,9 @@ int viommu_domctl(struct domain *d, struct xen_domctl_viommu_op *op, int viommu_setup(void); int viommu_handle_irq_request(struct domain *d, u32 viommu_id, struct irq_remapping_request *request); +int viommu_get_irq_info(struct domain *d, u32 viommu_id, + struct irq_remapping_request *request, + struct irq_remapping_info *irq_info); #else static inline int viommu_init_domain(struct domain *d) { return 0; } static inline int viommu_register_type(u64 type, struct viommu_ops * ops) @@ -71,6 +76,10 @@ static inline int viommu_domctl(struct domain *d, static inline int viommu_handle_irq_request(struct domain *d, u32 viommu_id, struct irq_remapping_request *request) { return 0 }; +static inline int viommu_get_irq_info(struct domain *d, u32 viommu_id, + struct irq_remapping_request *request, + struct irq_remapping_info *irq_info) +{ return 0 }; #endif #endif /* __XEN_VIOMMU_H__ */