From patchwork Mon Jun 13 15:17:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Xu X-Patchwork-Id: 9173419 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 653286086B for ; Mon, 13 Jun 2016 15:24:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5658520410 for ; Mon, 13 Jun 2016 15:24:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B43126861; Mon, 13 Jun 2016 15:24:11 +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 BE6EC20855 for ; Mon, 13 Jun 2016 15:24:10 +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 1bCTgw-0004AV-GL; Mon, 13 Jun 2016 15:22:18 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bCTgv-000484-21 for xen-devel@lists.xen.org; Mon, 13 Jun 2016 15:22:17 +0000 Received: from [193.109.254.147] by server-13.bemta-14.messagelabs.com id EF/FE-30119-8AFCE575; Mon, 13 Jun 2016 15:22:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNLMWRWlGSWpSXmKPExsVywNwkQnf5+bh wg/6vJhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bBO5eZC16IVnT+FWlgPC3YxcjJISRQIXHt w2MWEFtCgFfiyLIZrBC2v8SpTW0sEDU1Evd/T2AGsdkEVCRmNL9jB7FFBKQlrn2+zNjFyMXBL LCQSWL5mi42kISwQJLEv20PgIo4OFgEVCWaVvCBhHkFHCVWz7nHBDFfQWLZl7VgMzkFnCQ2T2 1kgtjlKLHg9AT2CYy8CxgZVjGqF6cWlaUW6ZroJRVlpmeU5CZm5ugaGpro5aYWFyemp+YkJhX rJefnbmIEBgIDEOxgXLHQ+RCjJAeTkijvqcNx4UJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeE3P AeUEi1LTUyvSMnOAIQmTluDgURLhnXwWKM1bXJCYW5yZDpE6xagoJc4rDNInAJLIKM2Da4PFw SVGWSlhXkagQ4R4ClKLcjNLUOVfMYpzMCoJ83KBTOHJzCuBm/4KaDET0GKOfdEgi0sSEVJSDY ymJvOqfxyVvu/P9Wkj14GCY/ssdvnqWjtFXetnM9t1/K35muvCp6xF1h1QMH7t++2M4sz+Gvu dKz5aPyzf/iJ91vodU+awb83xOSw/R9RTxGr3243nDk9Sf3BqLffsSzxGnpc1mJn+fltWcq/j 5l3/v/v6y8pz7Mtygg/Ua/Vo3N69veDB6zxhJZbijERDLeai4kQAWNEp834CAAA= X-Env-Sender: quan.xu@intel.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1465831333!47407344!2 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: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57358 invoked from network); 13 Jun 2016 15:22:15 -0000 Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by server-16.tower-27.messagelabs.com with SMTP; 13 Jun 2016 15:22:15 -0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 13 Jun 2016 08:22:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,466,1459839600"; d="scan'208";a="996645048" Received: from xen-commits.sh.intel.com ([10.239.82.178]) by orsmga002.jf.intel.com with ESMTP; 13 Jun 2016 08:22:05 -0700 From: "Xu, Quan" To: xen-devel@lists.xen.org Date: Mon, 13 Jun 2016 23:17:13 +0800 Message-Id: <1465831038-43005-7-git-send-email-quan.xu@intel.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1465831038-43005-1-git-send-email-quan.xu@intel.com> References: <1465831038-43005-1-git-send-email-quan.xu@intel.com> Cc: Kevin Tian , Feng Wu , Jun Nakajima , George Dunlap , Andrew Cooper , dario.faggioli@citrix.com, Jan Beulich , Quan Xu Subject: [Xen-devel] [PATCH v8 06/11] propagate IOMMU Device-TLB flush error up to EPT update (top level ones) 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: Quan Xu Propagate the IOMMU Device-TLB flush error up to the ept_set_entry(), when VT-d shares EPT page table. Signed-off-by: Quan Xu Acked-by: Kevin Tian Reviewed-by: Jan Beulich CC: Jun Nakajima CC: Kevin Tian CC: George Dunlap CC: Jan Beulich CC: Andrew Cooper CC: Feng Wu Acked-by: George Dunlap --- xen/arch/x86/mm/p2m-ept.c | 2 +- xen/drivers/passthrough/vtd/iommu.c | 6 ++++-- xen/include/asm-x86/iommu.h | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index a233194..3098c33 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -832,7 +832,7 @@ out: need_modify_vtd_table ) { if ( iommu_hap_pt_share ) - iommu_pte_flush(d, gfn, &ept_entry->epte, order, vtd_pte_present); + rc = iommu_pte_flush(d, gfn, &ept_entry->epte, order, vtd_pte_present); else { if ( iommu_flags ) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index e900019..5366267 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1752,8 +1752,8 @@ static int __must_check intel_iommu_unmap_page(struct domain *d, return dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K); } -void iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte, - int order, int present) +int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte, + int order, int present) { struct acpi_drhd_unit *drhd; struct iommu *iommu = NULL; @@ -1778,6 +1778,8 @@ void iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte, order, !present, flush_dev_iotlb) ) iommu_flush_write_buffer(iommu); } + + return 0; } static int __init vtd_ept_page_compatible(struct iommu *iommu) diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h index e82a2f0..815d77e 100644 --- a/xen/include/asm-x86/iommu.h +++ b/xen/include/asm-x86/iommu.h @@ -27,7 +27,8 @@ int iommu_setup_hpet_msi(struct msi_desc *); /* While VT-d specific, this must get declared in a generic header. */ int adjust_vtd_irq_affinities(void); -void iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte, int order, int present); +int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte, + int order, int present); bool_t iommu_supports_eim(void); int iommu_enable_x2apic_IR(void); void iommu_disable_x2apic_IR(void);