Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1607149pxy; Mon, 2 Aug 2021 06:06:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzzzk6zeyhIYYBeYUFOBzLFLFTQsM4lt4uAa3MYSmDDzr8EsHyYvmHUCgT3yi6NkZnBAkR X-Received: by 2002:a50:ab1c:: with SMTP id s28mr18634764edc.214.1627909585130; Mon, 02 Aug 2021 06:06:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627909585; cv=none; d=google.com; s=arc-20160816; b=MRYrWpSEU6tsKF1/RuiwwoMRLYAIheCO1IhgYocH3cVW3piO4Zloj5sQMcJKzR1ujp lRdimqZuzuOFiVO6O9YuE5hBsIsHZlTI/ef3VH9FwXvSxdC9b+KtWSstui0BVDK/3R3f dTj2q0P5oI8XPY0zrytScdtT7IWklew9tlMk9PihuGaW5KxqsKPgiDGWGGtiWWNlUvHV so//EQ7ntkqF/lOEbdibjo9/pn17IjwMMJDFg2SGZPYStMCt4A1Qk5XEmqhapT3sUHMj 9xfJZs2E+ebkbaQf61YqnQvA7SeEfMltyL7ttyxCDCVMZ4XNrrUxoqgQE3BoKLVN6qN9 Otyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=tzGUiRQzHqwdhawiRXD39jZz9uzLr7pENc0sZpyxZ8E=; b=HpYStYPqKl+BmTk1VCASUedY8ga1XHayaEb4qyCFuO2Se58BYoUXuPPrsyB+nsou9U AALGV6Bf34x08PwuKGkZA6CCZrZmbvoF+U3lc8SKcrUxjjvS45eLrplNtjZmjoyRLJII nouFjKHuPPUZRMRpkfG/SWyVXUrXNhIZwr4En4HKsJ8+GcF0OMJwtzbVfzOmPO0D75JD ufOweEZWXFvBiZLJsTWX7Y23h25izeUw6q3ErUkGhsr1GY1H0OTEA7JoffaDrdaxbBaV 9gBeSp25KlT9om3zGuqI4gaJyicMRr0vIYY8jX2b8vRt8JvWADWOlwAzMihN8hWTSaIm FNFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G4TMOdi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cm19si10054466edb.410.2021.08.02.06.06.00; Mon, 02 Aug 2021 06:06:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G4TMOdi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233737AbhHBNEy (ORCPT + 99 others); Mon, 2 Aug 2021 09:04:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:59256 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233645AbhHBNEx (ORCPT ); Mon, 2 Aug 2021 09:04:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 009E960FC1; Mon, 2 Aug 2021 13:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627909484; bh=ZgQ7QJgecBwwh1ArbvcKHFHcRL7o3t2ryIirvGXNdvM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=G4TMOdi7yTY1vtU//csNd7tLpkHXDpBr2WeQf5Sz1YbBTbSwc0T+ghVCoNWzvDZN6 no7Nsgwhy69t1Qu3BSB3o47J0eFDa10psaLhc2coaEy6ZMantZ6wxvA31lRNc5SQDK 0TW9oarNKxI+eciwapRPEgTF86NLI8z2Xy2ZAAyHFfUvOI890HlHt1wGwZ8dnfi9gv B6mz1p65fqDi4LbdkyXQzwL965aWMNANepCe6ASOtHFFMZ5e5DBDLqrfGG9sxj3djb 4JoNmbQTNzXDJOfX3EYDKmgQKuDHKVNXSTBMRi1oylaoo0Gm1zt+3x81KpbWep/m0R gnb6BTB8Qzgqg== Date: Mon, 2 Aug 2021 14:04:39 +0100 From: Will Deacon To: Robin Murphy Cc: joro@8bytes.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, suravee.suthikulpanit@amd.com, baolu.lu@linux.intel.com, john.garry@huawei.com, dianders@chromium.org Subject: Re: [PATCH v2 23/24] iommu/arm-smmu: Allow non-strict in pgtable_quirks interface Message-ID: <20210802130438.GA28547@willie-the-truck> References: <0fcd1f5225a6b435cbc697551a6247cd435c04db.1627468310.git.robin.murphy@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0fcd1f5225a6b435cbc697551a6247cd435c04db.1627468310.git.robin.murphy@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 28, 2021 at 04:58:44PM +0100, Robin Murphy wrote: > To make io-pgtable aware of a flush queue being dynamically enabled, > allow IO_PGTABLE_QUIRK_NON_STRICT to be set even after a domain has been > attached to, and hook up the final piece of the puzzle in iommu-dma. > > Signed-off-by: Robin Murphy > --- > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 15 +++++++++++++++ > drivers/iommu/arm/arm-smmu/arm-smmu.c | 11 +++++++++++ > drivers/iommu/dma-iommu.c | 3 +++ > 3 files changed, 29 insertions(+) > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > index 19400826eba7..40fa9cb382c3 100644 > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > @@ -2711,6 +2711,20 @@ static int arm_smmu_enable_nesting(struct iommu_domain *domain) > return ret; > } > > +static int arm_smmu_set_pgtable_quirks(struct iommu_domain *domain, > + unsigned long quirks) > +{ > + struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); > + > + if (quirks == IO_PGTABLE_QUIRK_NON_STRICT && smmu_domain->pgtbl_ops) { > + struct io_pgtable *iop = io_pgtable_ops_to_pgtable(smmu_domain->pgtbl_ops); > + > + iop->cfg.quirks |= IO_PGTABLE_QUIRK_NON_STRICT; > + return 0; > + } > + return -EINVAL; > +} I don't see anything serialising this against a concurrent iommu_unmap(), so the ordering and atomicity looks quite suspicious to me here. I don't think it's just the page-table quirks either, but also setting cookie->fq_domain. Will