From patchwork Wed Mar 29 05:11:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Gao X-Patchwork-Id: 9651449 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 8C7D56034B for ; Wed, 29 Mar 2017 12:17:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B12028354 for ; Wed, 29 Mar 2017 12:17:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FE1F28478; Wed, 29 Mar 2017 12:17:04 +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.0 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 4B42E28354 for ; Wed, 29 Mar 2017 12:17:03 +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 1ctCUy-000449-PQ; Wed, 29 Mar 2017 12:14:48 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctCUx-000431-IQ for xen-devel@lists.xen.org; Wed, 29 Mar 2017 12:14:47 +0000 Received: from [193.109.254.147] by server-5.bemta-6.messagelabs.com id D2/32-27545-635ABD85; Wed, 29 Mar 2017 12:14:46 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRWlGSWpSXmKPExsVywNwkQtds6e0 Ig3NTZS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oy2jQ/YCnZxV7zY/py9gfEJRxcjFweLwC0m iZmdN1lAHCGBaYwS/ceWM3UxcnJICPBKHFk2gxXC9pO4tLwNzBYSKJe4uKwfrIZNQFni4tdeN hBbREBa4trny4wgNrNAusSO5YfAbGGBZInrt2aA1bAIqErMO7YKLM4r4CjxZ807Foj5ChJTHr 5nBrE5BZwkzu86wwyxy1Fi3YqHLBMY+RYwMqxi1ChOLSpLLdI1stBLKspMzyjJTczM0TU0MNP LTS0uTkxPzUlMKtZLzs/dxAgMFAYg2MF4fm3gIUZJDiYlUd4ThrcjhPiS8lMqMxKLM+KLSnNS iw8xynBwKEnwqiwBygkWpaanVqRl5gBDFiYtwcGjJMJrsRgozVtckJhbnJkOkTrFqCglzvsbJ CEAksgozYNrg8XJJUZZKWFeRqBDhHgKUotyM0tQ5V8xinMwKgnz/gWZwpOZVwI3/RXQYiagxe I2t0AWlyQipKQaGNlVnnpNymgQ+rt5hW1m77cmo8Ycs6y75edSMhoOR5fZ6am/u8vx8NrJhrz Ii2YcTFWyJxP+Ghz+o7Jl+2mm4AfCX8smmEn37fl0W8HHwcjhSX5GaYZxPt+74Jtdxh2/mf/q V0s57900S+Xzib+mpze2fjpe43TfKuiB2LOduveYb7SGz7xiqcRSnJFoqMVcVJwIAITbB2uOA gAA X-Env-Sender: chao.gao@intel.com X-Msg-Ref: server-9.tower-27.messagelabs.com!1490789671!94414712!7 X-Originating-IP: [192.55.52.88] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTkyLjU1LjUyLjg4ID0+IDM3NDcyNQ==\n X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21890 invoked from network); 29 Mar 2017 12:14:46 -0000 Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by server-9.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 29 Mar 2017 12:14:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490789686; x=1522325686; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=P5A93TNpcJxbOmDh296D15JzF9xy6J7/NmNm/1jLQRw=; b=rYmiG0G5u3hOBSxTzxdDHlJe85wzco4JStcwsTJivEEsgLzePVnw3ikb OcjMt13Oodm5kVCOFDwSmH0Y1Oz+0w==; Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2017 05:14:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,241,1486454400"; d="scan'208";a="80557069" Received: from skl-2s3.sh.intel.com ([10.239.48.35]) by orsmga005.jf.intel.com with ESMTP; 29 Mar 2017 05:14:44 -0700 From: Chao Gao To: xen-devel@lists.xen.org Date: Wed, 29 Mar 2017 13:11:55 +0800 Message-Id: <1490764315-7162-7-git-send-email-chao.gao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1490764315-7162-1-git-send-email-chao.gao@intel.com> References: <1490764315-7162-1-git-send-email-chao.gao@intel.com> Cc: Kevin Tian , Jan Beulich , Chao Gao Subject: [Xen-devel] [PATCH v11 6/6] passthrough/io: Fall back to remapping interrupt when we can't use VT-d PI 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 The current logic of using VT-d pi is when guest configurates the pirq's destination vcpu to a single vcpu, the according IRTE is updated to posted format. If the destination of the pirq is multiple vcpus, we will stay in posted format. Obviously, we should fall back to remapping interrupt when guest wrongly configurate destination of pirq or makes it have multi-destination vcpus. Signed-off-by: Chao Gao Reviewed-by: Jan Beulich Reviewed-by: Kevin Tian --- v11: - move the code (one line) that allow the parameter 'vcpu' of pi_update_irte() can be NULL to Patch [2/6]. v10: - Newly added xen/drivers/passthrough/io.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c index 5dbfe53..93de0c2 100644 --- a/xen/drivers/passthrough/io.c +++ b/xen/drivers/passthrough/io.c @@ -412,14 +412,7 @@ int pt_irq_create_bind( /* Use interrupt posting if it is supported. */ if ( iommu_intpost ) - { - if ( vcpu ) - pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec); - else - dprintk(XENLOG_G_INFO, - "%pv: deliver interrupt in remapping mode,gvec:%02x\n", - vcpu, pirq_dpci->gmsi.gvec); - } + pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec); break; }