From patchwork Fri Nov 17 06:22:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Gao X-Patchwork-Id: 10062335 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 3AB306023A for ; Fri, 17 Nov 2017 06:27:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D7D32A539 for ; Fri, 17 Nov 2017 06:27:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 222232A990; Fri, 17 Nov 2017 06:27:28 +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=-4.2 required=2.0 tests=BAYES_00, 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 C2CAC2A539 for ; Fri, 17 Nov 2017 06:27:27 +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 1eFa5R-0000rs-4O; Fri, 17 Nov 2017 06:25:13 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFa5Q-0000j6-0z for xen-devel@lists.xen.org; Fri, 17 Nov 2017 06:25:12 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 51/26-05188-7C08E0A5; Fri, 17 Nov 2017 06:25:11 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHLMWRWlGSWpSXmKPExsVywNwkVvd4A1+ UwYUPAhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8baT9YF27krzk7czdzAeIKzi5GLQ0hgOqPE +uVdjF2MnBwSArwSR5bNYIWwAyT2zVzC0sXIAVRUJXFyZxZImE1AWeLi1142EFtEQFri2ufLj CBzmAWeM0ssWfcXbI6wQITEu+NdLCA2i4CqxPEfR8AaeAWcJdYuWsUOMV9BYsrD98wgNidQfP +bg0wgtpCAk8TBddOYJjDyLmBkWMWoXpxaVJZapGupl1SUmZ5RkpuYmaNraGCml5taXJyYnpq TmFSsl5yfu4kRGAoMQLCD8e6mgEOMkhxMSqK8POZ8UUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQk eL3qgXKCRanpqRVpmTnAoIRJS3DwKInwFoCkeYsLEnOLM9MhUqcYjTmezXzdwMwx7WprE7MQS 15+XqqUOG8xSKkASGlGaR7cIFi0XGKUlRLmZQQ6TYinILUoN7MEVf4VozgHo5IwbyXIFJ7MvB K4fa+ATmECOsXmBjfIKSWJCCmpBkYJuZnHLL10j6wUKfjU9odTTMtRxiYnVdpdqSjlzfNfq1l kps82DDMXW3ExSfo/53YllrxLmTMfmB/O/BIik9nPYMPcLmH8kWFXy/vNV9LSe2e1rNBZ/X/S y4pqm/tRHnVvBb9uUW1t+1xfFnu87cs25zfh+/gm+H3aZ6SxbFElB3N9zsO83UosxRmJhlrMR cWJAOC6ZjaRAgAA X-Env-Sender: chao.gao@intel.com X-Msg-Ref: server-12.tower-21.messagelabs.com!1510899867!82378134!14 X-Originating-IP: [192.55.52.93] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTkyLjU1LjUyLjkzID0+IDMyNDY2NQ==\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 58890 invoked from network); 17 Nov 2017 06:25:11 -0000 Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by server-12.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 17 Nov 2017 06:25:11 -0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Nov 2017 22:25:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.44,407,1505804400"; d="scan'208"; a="1245165145" Received: from skl-4s-chao.sh.intel.com ([10.239.48.9]) by fmsmga002.fm.intel.com with ESMTP; 16 Nov 2017 22:25:07 -0800 From: Chao Gao To: xen-devel@lists.xen.org Date: Fri, 17 Nov 2017 14:22:20 +0800 Message-Id: <1510899755-40237-14-git-send-email-chao.gao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1510899755-40237-1-git-send-email-chao.gao@intel.com> References: <1510899755-40237-1-git-send-email-chao.gao@intel.com> Cc: Lan Tianyu , Kevin Tian , Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Ian Jackson , Tim Deegan , Jan Beulich , Andrew Cooper , Chao Gao , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [Xen-devel] [PATCH v4 13/28] x86/vvtd: add a helper function to decide the interrupt format 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 Different platform may use different method to distinguish remapping format interrupt and normal format interrupt. Intel uses one bit in IOAPIC RTE or MSI address register to indicate the interrupt is remapping format. vvtd should handle all the interrupts when .check_irq_remapping() return true. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- v3: - new --- xen/drivers/passthrough/vtd/vvtd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xen/drivers/passthrough/vtd/vvtd.c b/xen/drivers/passthrough/vtd/vvtd.c index 9890cc2..d3dec01 100644 --- a/xen/drivers/passthrough/vtd/vvtd.c +++ b/xen/drivers/passthrough/vtd/vvtd.c @@ -565,6 +565,15 @@ static int vvtd_get_irq_info(const struct domain *d, return 0; } +/* check whether the interrupt request is remappable */ +static bool vvtd_is_remapping(const struct domain *d, + const struct arch_irq_remapping_request *irq) +{ + uint32_t idx; + + return !irq_remapping_request_index(irq, &idx); +} + static void vvtd_reset(struct vvtd *vvtd) { uint64_t cap = cap_set_num_fault_regs(VVTD_FRCD_NUM) @@ -628,6 +637,7 @@ static const struct viommu_ops vvtd_hvm_vmx_ops = { .destroy = vvtd_destroy, .handle_irq_request = vvtd_handle_irq_request, .get_irq_info = vvtd_get_irq_info, + .check_irq_remapping = vvtd_is_remapping, }; REGISTER_VIOMMU(vvtd_hvm_vmx_ops);