From patchwork Mon Oct 5 09:49:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11816411 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 052BC92C for ; Mon, 5 Oct 2020 09:50:05 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C562520776 for ; Mon, 5 Oct 2020 09:50:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xen.org header.i=@xen.org header.b="daBGQ6wW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C562520776 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.2947.8436 (Exim 4.92) (envelope-from ) id 1kPN7N-0000cr-Rq; Mon, 05 Oct 2020 09:49:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 2947.8436; Mon, 05 Oct 2020 09:49:17 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kPN7N-0000cj-O6; Mon, 05 Oct 2020 09:49:17 +0000 Received: by outflank-mailman (input) for mailman id 2947; Mon, 05 Oct 2020 09:49:17 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kPN7N-0000a2-4g for xen-devel@lists.xenproject.org; Mon, 05 Oct 2020 09:49:17 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id cc291b9a-82d7-464d-b8ff-200c3d85c9aa; Mon, 05 Oct 2020 09:49:13 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kPN7J-00018j-D5; Mon, 05 Oct 2020 09:49:13 +0000 Received: from host109-146-187-185.range109-146.btcentralplus.com ([109.146.187.185] helo=u2f063a87eabd5f.home) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPN7J-0007gW-5k; Mon, 05 Oct 2020 09:49:13 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kPN7N-0000a2-4g for xen-devel@lists.xenproject.org; Mon, 05 Oct 2020 09:49:17 +0000 X-Inumbo-ID: cc291b9a-82d7-464d-b8ff-200c3d85c9aa Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id cc291b9a-82d7-464d-b8ff-200c3d85c9aa; Mon, 05 Oct 2020 09:49:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=0/TvnggoZgnvE3hOxtGaw8lHv49nlACtJLzfHJVFPDg=; b=daBGQ6wW7PKyicNrzxKeGW/4xr JsNo/tu6Lto8STSfVzRNs3wrlqCf6RgM9URkBR0sk+ytSsYT7z+u38waeP6sT0LGWMON6encXeLRU sTbJgN48uiUrZaprjjzECD/WIaQpuNxGHpPGeWuDoOTBF5Ag+iDqmhSfdz0HjcRaLMys=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kPN7J-00018j-D5; Mon, 05 Oct 2020 09:49:13 +0000 Received: from host109-146-187-185.range109-146.btcentralplus.com ([109.146.187.185] helo=u2f063a87eabd5f.home) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPN7J-0007gW-5k; Mon, 05 Oct 2020 09:49:13 +0000 From: Paul Durrant To: xen-devel@lists.xenproject.org Cc: Paul Durrant , Jan Beulich Subject: [PATCH 4/5] iommu: set 'hap_pt_share' and 'need_sync' flags earlier in iommu_domain_init() Date: Mon, 5 Oct 2020 10:49:04 +0100 Message-Id: <20201005094905.2929-5-paul@xen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201005094905.2929-1-paul@xen.org> References: <20201005094905.2929-1-paul@xen.org> MIME-Version: 1.0 From: Paul Durrant Set these flags prior to the calls to arch_iommu_domain_init() and the implementation init() method. There is no reason to hide this information from those functions and the value of 'hap_pt_share' will be needed by a modification to arch_iommu_domain_init() made in a subsequent patch. Signed-off-by: Paul Durrant Reviewed-by: Julien Grall --- Cc: Jan Beulich --- xen/drivers/passthrough/iommu.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 642d5c8331..fd9705b3a9 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -174,15 +174,6 @@ int iommu_domain_init(struct domain *d, unsigned int opts) hd->node = NUMA_NO_NODE; #endif - ret = arch_iommu_domain_init(d); - if ( ret ) - return ret; - - hd->platform_ops = iommu_get_ops(); - ret = hd->platform_ops->init(d); - if ( ret || is_system_domain(d) ) - return ret; - /* * Use shared page tables for HAP and IOMMU if the global option * is enabled (from which we can infer the h/w is capable) and @@ -202,7 +193,12 @@ int iommu_domain_init(struct domain *d, unsigned int opts) ASSERT(!(hd->need_sync && hd->hap_pt_share)); - return 0; + ret = arch_iommu_domain_init(d); + if ( ret ) + return ret; + + hd->platform_ops = iommu_get_ops(); + return hd->platform_ops->init(d); } void __hwdom_init iommu_hwdom_init(struct domain *d)