From patchwork Wed Sep 21 02:37:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, Feng" X-Patchwork-Id: 9342719 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 8ABF6607EE for ; Wed, 21 Sep 2016 03:10:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 906FA29651 for ; Wed, 21 Sep 2016 03:10:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8514F29689; Wed, 21 Sep 2016 03:10:27 +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 1B690296C1 for ; Wed, 21 Sep 2016 03:10: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 1bmXtC-0002h3-4b; Wed, 21 Sep 2016 03:08:02 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmXtA-0002gm-OQ for xen-devel@lists.xen.org; Wed, 21 Sep 2016 03:08:00 +0000 Received: from [85.158.143.35] by server-11.bemta-6.messagelabs.com id 6C/71-08498-099F1E75; Wed, 21 Sep 2016 03:08:00 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRWlGSWpSXmKPExsVywNwkVrf/58N wg4ObtS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oxrZ28zFSznqjh38CFzA+N9ji5GTg4hgQqJ Bds62EFsCQFeiSPLZrBC2AESP5Z9ZoOoqZe4/Os9E4jNJqAocfDiIbAaEQFpiWufLzN2MXJxM AssYJRovHiUGSQhDNQ87dRmRhCbRUBV4s21K2CDeAUcJJZ1fmeEWCAnsWH3fzCbU8BR4kbbJy aIZQ4SD79+ZJ/AyLuAkWEVo0ZxalFZapGuoYVeUlFmekZJbmJmjq6hgZlebmpxcWJ6ak5iUrF ecn7uJkZgODAAwQ7GmxsDDjFKcjApifLK8T0IF+JLyk+pzEgszogvKs1JLT7EKMPBoSTBu+3H w3AhwaLU9NSKtMwcYGDCpCU4eJREeIVA0rzFBYm5xZnpEKlTjIpS4rwVIAkBkERGaR5cGywaL jHKSgnzMgIdIsRTkFqUm1mCKv+KUZyDUUmY9x7IFJ7MvBK46a+AFjMBLd7y8wHI4pJEhJRUA6 NfzuzNGeanal9zWc5P++/Bv3iz0MYou+hcZ4sZ9TUWKpvtrffaLN9/XaNg5pfF0m9vHTALc8z entg5S71pruybffxF6pNOr8xu+/fMLnu7pJeC3FHJt5N3Lpd9OuGA08mVG2T924IcDs1aW/hO t3bX1NubbELuyJnpXtn7f3fHtZ/O/6ekiTgqsRRnJBpqMRcVJwIAWjkZ34ECAAA= X-Env-Sender: feng.wu@intel.com X-Msg-Ref: server-12.tower-21.messagelabs.com!1474427268!34296260!6 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: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 50275 invoked from network); 21 Sep 2016 03:07:59 -0000 Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by server-12.tower-21.messagelabs.com with DHE-RSA-CAMELLIA256-SHA encrypted SMTP; 21 Sep 2016 03:07:59 -0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 20 Sep 2016 20:07:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.30,371,1470726000"; d="scan'208"; a="1033977595" Received: from feng-bdw-de-pi.bj.intel.com ([10.238.154.76]) by orsmga001.jf.intel.com with ESMTP; 20 Sep 2016 20:07:56 -0700 From: Feng Wu To: xen-devel@lists.xen.org Date: Wed, 21 Sep 2016 10:37:49 +0800 Message-Id: <1474425470-3629-6-git-send-email-feng.wu@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1474425470-3629-1-git-send-email-feng.wu@intel.com> References: <1474425470-3629-1-git-send-email-feng.wu@intel.com> Cc: kevin.tian@intel.com, Feng Wu , george.dunlap@eu.citrix.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, jbeulich@suse.com Subject: [Xen-devel] [PATCH v4 5/6] VT-d: No need to set irq affinity for posted format 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 We don't set the affinity for posted format IRTE, since the destination of these interrupts is vCPU and the vCPU affinity is set during vCPU scheduling. Signed-off-by: Feng Wu --- v4: - Keep the construction of new_ire and only modify the hardware IRTE when it is not in posted mode. xen/drivers/passthrough/vtd/intremap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c index bfd468b..4537714 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -637,9 +637,12 @@ static int msi_msg_to_remap_entry( remap_rte->address_hi = 0; remap_rte->data = index - i; - memcpy(iremap_entry, &new_ire, sizeof(struct iremap_entry)); - iommu_flush_cache_entry(iremap_entry, sizeof(struct iremap_entry)); - iommu_flush_iec_index(iommu, 0, index); + if ( !iremap_entry->remap.p || !iremap_entry->remap.im ) + { + memcpy(iremap_entry, &new_ire, sizeof(struct iremap_entry)); + iommu_flush_cache_entry(iremap_entry, sizeof(struct iremap_entry)); + iommu_flush_iec_index(iommu, 0, index); + } unmap_vtd_domain_page(iremap_entries); spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags);