From patchwork Tue May 31 13:57:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Xu X-Patchwork-Id: 9144925 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 4D1AF60761 for ; Tue, 31 May 2016 14:06:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FB7F1FF27 for ; Tue, 31 May 2016 14:06:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 349E5208C2; Tue, 31 May 2016 14:06:26 +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 24D8F2040D for ; Tue, 31 May 2016 14:06:24 +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 1b7kGR-0000nT-8Y; Tue, 31 May 2016 14:03:23 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b7kGP-0000ly-Iy for xen-devel@lists.xen.org; Tue, 31 May 2016 14:03:21 +0000 Received: from [85.158.139.211] by server-10.bemta-5.messagelabs.com id 30/C6-11369-8A99D475; Tue, 31 May 2016 14:03:20 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDLMWRWlGSWpSXmKPExsXS1tYhobt8pm+ 4wb5vshZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa0bH+9/sBS9EK25fncvSwHhasIuRk0NIoFJi e/85RhBbQoBX4siyGaxdjBxAtr9E12c+iJIaiXWXXrKD2GwCKhIzmt+B2SIC0hLXPl8GauXiY BZYyCSxfE0XG0hCWCBJ4tfqu8wgc1gEVCX+HLUECfMKOEjs/HKSCWKVgsSyL2uZQWxOAUeJC/ 3nmCB2OUg8/PKTaQIj7wJGhlWMGsWpRWWpRbqGhnpJRZnpGSW5iZk5uoYGpnq5qcXFiempOYl JxXrJ+bmbGIGhwAAEOxhXtjsfYpTkYFIS5X2Y7RsuxJeUn1KZkVicEV9UmpNafIhRhoNDSYL3 5AygnGBRanpqRVpmDjAoYdISHDxKIryvpwOleYsLEnOLM9MhUqcYFaXEeZNA+gRAEhmleXBts Ei4xCgrJczLCHSIEE9BalFuZgmq/CtGcQ5GJWHeoyBTeDLzSuCmvwJazAS0OD7DB2RxSSJCSq qBsSVDS5f75yJ7fefy83+3r37L3PObxfSs9ELT9BrunbarLnyXNIjpszkS47BUVljSWHTHFLF 1z9quX/wtGtT81rU9LV5UWuymQ+WumaeYeM+2yBzoaPGfw25m4hV+Vc5wy7Pfdv4b9s9sexrO ZHijrlhr9fmdip2fo06onpumr11wf+fOftbTSizFGYmGWsxFxYkADZqeWX8CAAA= X-Env-Sender: quan.xu@intel.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1464703396!33277561!1 X-Originating-IP: [134.134.136.24] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTM0LjEzNC4xMzYuMjQgPT4gMzkwOTcx\n X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 52607 invoked from network); 31 May 2016 14:03:19 -0000 Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by server-13.tower-206.messagelabs.com with SMTP; 31 May 2016 14:03:19 -0000 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP; 31 May 2016 07:01:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,395,1459839600"; d="scan'208";a="113440107" Received: from xen-commits.sh.intel.com ([10.239.82.178]) by fmsmga004.fm.intel.com with ESMTP; 31 May 2016 07:01:56 -0700 From: "Xu, Quan" To: xen-devel@lists.xen.org Date: Tue, 31 May 2016 21:57:31 +0800 Message-Id: <1464703056-4741-7-git-send-email-quan.xu@intel.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1464703056-4741-1-git-send-email-quan.xu@intel.com> References: <1464703056-4741-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 v6 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 --- 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 ebb4343..dab3215 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);