From patchwork Wed Jun 8 08:58:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Xu X-Patchwork-Id: 9163737 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 7870560467 for ; Wed, 8 Jun 2016 09:05:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6871D28345 for ; Wed, 8 Jun 2016 09:05:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D53428392; Wed, 8 Jun 2016 09:05:44 +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 8F84128345 for ; Wed, 8 Jun 2016 09:05:42 +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 1bAZOk-00048j-Rk; Wed, 08 Jun 2016 09:03:38 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bAZOj-000470-1V for xen-devel@lists.xen.org; Wed, 08 Jun 2016 09:03:37 +0000 Received: from [193.109.254.147] by server-10.bemta-14.messagelabs.com id 4D/B1-31433-86FD7575; Wed, 08 Jun 2016 09:03:36 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDLMWRWlGSWpSXmKPExsVywNwkQjf9fni 4weqH0hZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8aqrmksBS9EK6YumcjSwHhasIuRk0NIoFJi +rapzCC2hACvxJFlM1ghbH+J7ddbGCFqaiSed/WwgNhsAioSM5rfsYPYIgLSEtc+Xwaq4eJgF ljIJLF8TRcbSEJYIEmi5d5csGYWAVWJ+X1PwIbyCjhKPOqZywaxQEFi2Ze1QIs5ODgFnCS2Hi uF2OUosW33E5YJjLwLGBlWMaoXpxaVpRbpmuklFWWmZ5TkJmbm6BoamujlphYXJ6an5iQmFes l5+duYgSGAgMQ7GD8O8H5EKMkB5OSKK+ie3i4EF9SfkplRmJxRnxRaU5q8SFGGQ4OJQne2ntA OcGi1PTUirTMHGBQwqQlOHiURHilQNK8xQWJucWZ6RCpU4yKUuK8oiAJAZBERmkeXBssEi4xy koJ8zICHSLEU5BalJtZgir/ilGcg1FJmDcMZApPZl4J3PRXQIuZgBYvPwK2uCQRISXVwKj29F ng/qXxuR0uD+3Tk9dqq+2ewcc+f5bGoul7hXVDT904n//oQpXp7GK5R1+mCUnIO++Zy5w0pXG +hcsRBvU2Zd7zDqHfLZZ1XHlrtXpNLm/V0xfbxDXja6Zx7QkI21iya/cHkyXtwsJX7mardwp4 tV14t7gieOL7bUcck0MDVodGL0n88UeJpTgj0VCLuag4EQCqt5M1fwIAAA== X-Env-Sender: quan.xu@intel.com X-Msg-Ref: server-9.tower-27.messagelabs.com!1465376607!46437496!5 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 28799 invoked from network); 8 Jun 2016 09:03:35 -0000 Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by server-9.tower-27.messagelabs.com with SMTP; 8 Jun 2016 09:03:35 -0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 08 Jun 2016 02:03:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,438,1459839600"; d="scan'208";a="983223945" Received: from xen-commits.sh.intel.com ([10.239.82.178]) by fmsmga001.fm.intel.com with ESMTP; 08 Jun 2016 02:03:33 -0700 From: "Xu, Quan" To: xen-devel@lists.xen.org Date: Wed, 8 Jun 2016 16:58:59 +0800 Message-Id: <1465376344-28290-7-git-send-email-quan.xu@intel.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1465376344-28290-1-git-send-email-quan.xu@intel.com> References: <1465376344-28290-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 v7 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 5aebc24..234d76a 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);