Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp820147lqc; Fri, 8 Mar 2024 12:37:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXSRj9qUZrxy4717Zg4go/HVHeoOJf+zXay6LKzMdwa7ouLcED51eH7tjZeKcB/6kw4eyHUF6OZTVWj64CrdIlbI51966J4P9MdtjBcgA== X-Google-Smtp-Source: AGHT+IGxSijQfsKAxLVDhoGNnSOhyVT7kKQQezbcrmxseNpxap1QlMp92llDL+yR7qDwvJ11L376 X-Received: by 2002:a17:907:a801:b0:a45:f257:5439 with SMTP id vo1-20020a170907a80100b00a45f2575439mr332173ejc.3.1709930249387; Fri, 08 Mar 2024 12:37:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709930249; cv=pass; d=google.com; s=arc-20160816; b=O9uvH+dJJrZ1SqWULZ/T548EIhPb8V56sh+TYuNcauFPmOO1pdAXuT/7C+juDHyDqr MGux3VJz217me4Uv+U1nmNGEY4E4LojSpOMKtJiaGhtyqR8hqOEuQEYBfCYl0s7DZQSn 054ARbKL7L43WotFVnR4Pql+OgVC/KLiJZp45Qr3F/FK13JqcxBqazrQ86xReKPvZlAc WFHCmYQOxj5iPfD39XKWoawmzpkFTmXsOZ+GS/pqbCR+Ot49T0Lo5rxYgEj+VCZDA2BM PxGL83mpwM4qgWaXgUOaxN0DzKxC6VSlFGBWnheERpEeb5aKrhfNo/jVj4BnAwf5Jtso g2xg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jjWpdrEe1CBSB6fUsA969odLMNfAGSgF6jvNlFE06WQ=; fh=Cl0ZGOHaEI5yZNvGjEi8f7YNazyLp5Ll64EePiytdqc=; b=gaGj26FroYSc6Od71ZuqukvDZ+86brZf21KJPrBIMwu91iR6OVUq7wcxPRzrwcOQxV pgu6po8HBJtawRhFfI7EkI0WrYPo1wcbXoc7iVEmTLe7hhD4G+342yA+lRdVP7DwCnXk XzNpjgThNetNJKV9vMWvBQQ2gNr2TlF60YxCLkEA6sO3UPN1Cr5slfCGcnvKR4yV26Vt ig6HD31AfO76MjlRoBaLRpOqHZOXfY7TdJtBZLdD5Wmu7qVk3ZQsBC32kvnq4UirwHjB wci7W1AV2TiON3q95XIYLBEMD4fuzWILcjB1g/EEFbMO9ESw8eQRiuj3tWVfrv2JN+KA Q9HA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=HLshlY0J; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-97559-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97559-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p15-20020a170906228f00b00a448d903c02si111862eja.735.2024.03.08.12.37.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 12:37:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97559-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=HLshlY0J; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-97559-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97559-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D4CA21F223B0 for ; Fri, 8 Mar 2024 20:37:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 899C05E089; Fri, 8 Mar 2024 20:37:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="HLshlY0J" Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3E6A5D90F for ; Fri, 8 Mar 2024 20:37:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709930240; cv=none; b=MjnIXNb6J77ibXFB9g8A+IC7l3bln1hgGHo9BKxJvQRev2DfnwTwIbC5bm0r9wK7ud6kWPYTH1+v84ktNfUUQvgNcnRe14YSDV6fohuLlEAl7c4yrEbTuahA9pwga79iZQTIpdxy5Dfo2FywMtWztVFArIXYNgzhyz8GrS6SQdc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709930240; c=relaxed/simple; bh=Bi3P4E1LMVNI9ICHZizJgPWFi1cAG6MJcwmbCUE+tB0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dB4nARsuQ2dt7OS7L3ifEz8YZf3EctJg0A51fMXYpAJMELcm51LfTTzuOuxH+K1P23griY9DgUtz6yXsQAdTRw9xSHcJX3Qvll8fvh6YvXzghPsLQG4736S3bcudpajko3IcztVELiVxZBpFXYtqoP4ANxdYJXHYMYjEFA2eV28= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=HLshlY0J; arc=none smtp.client-ip=209.85.161.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5a1cba5d46fso426623eaf.0 for ; Fri, 08 Mar 2024 12:37:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1709930237; x=1710535037; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=jjWpdrEe1CBSB6fUsA969odLMNfAGSgF6jvNlFE06WQ=; b=HLshlY0JdEldHta3JUKzPHooseYZMDrj2DHryLYDs5peuYjAuXzdIHxf1El6VBnEzY ksY0Rv2pL6VWtrierriq21rd9UsObnawXA4p4AIgBlizBDnz9aN1Vh/qFXOdoilqfmdl 2Msr1y8zrAmn+ef3dwTz7cREbJzefJTqGBtl0lcciyj0SoinX7jsRrdF+1eBzX5YjImP lj65zjhX8XvLydEBSxgTC0EZyrS7BlRIo9qZVM1T2PbyOJ3DUyJDTxQMaUlsRBWWeQGO R4A1v7dzeGxbht847VPfHRQHWbUApaKkCZJcU9B6aNAtLgR36Z1fZ1yNTw+AOPWOkl7S ddug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709930237; x=1710535037; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jjWpdrEe1CBSB6fUsA969odLMNfAGSgF6jvNlFE06WQ=; b=R+rgN4Eqc+oBGMj0+AqhWz8LDa28H1q2StvxVPwEh02DeE830OOwV8GfPgAdk8zyAj 924zZzorfZ/kO0CCNoFsXFqwlLiV+FOIqQ5Q9mW138IU0u3fnr+WfnSJqoY+Fj7SzxFP hSLEr2bg+C8uBATypNwyXpniJsgEHk7uXXNLy2VNb8CE5s8itsZ0lZU4bfs8jYG3qLhn fooB1R2IEUdqblNXNT3PjdKI9hNmF7GdxfdhdCmv3pXgI2L2Wz+h/Xe/mx9P7S+PgsLc z9G+FVGlpAGmoPbcHOdnecfHOh1tYJ7RRq+XRokmS72ukdyVFxECmlJ2k1Ld/lIhc4wU +o2Q== X-Forwarded-Encrypted: i=1; AJvYcCVT8q8njBUA4SxWA3+L3SUuRyLnNKpQlorae8BwFq7KQC2+E74M7g/a1vPevbMcOR56caWjrB2EQ65Q/s2UK+4BljlYE9XO3Oh9fFOY X-Gm-Message-State: AOJu0YwaIARuZvbPNaOnRWj3nc5qRzPFQ3c04uackC0+L3+VdmbIeIpH 4edl8mnch9CddMJWdI4Vw0gnYt3V5LDpZKSnPoWZJVUM3KweXaWXEGMi1oHpqiI= X-Received: by 2002:a4a:2b11:0:b0:5a1:25fc:7be0 with SMTP id i17-20020a4a2b11000000b005a125fc7be0mr413338ooa.3.1709930236902; Fri, 08 Mar 2024 12:37:16 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-68-80-239.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.80.239]) by smtp.gmail.com with ESMTPSA id bi3-20020a05682008c300b005a0859a4a01sm19059oob.36.2024.03.08.12.37.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 12:37:16 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1rigxv-007xzf-Er; Fri, 08 Mar 2024 16:37:15 -0400 Date: Fri, 8 Mar 2024 16:37:15 -0400 From: Jason Gunthorpe To: Robin Murphy Cc: Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , Paul Walmsley , Palmer Dabbelt , Albert Ou , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Suravee Suthikulpanit , David Woodhouse , Lu Baolu , Niklas Schnelle , Matthew Rosato , Gerald Schaefer , Jean-Philippe Brucker , Rob Herring , Frank Rowand , Marek Szyprowski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, iommu@lists.linux.dev, devicetree@vger.kernel.org Subject: Re: [PATCH v3 6/7] iommu/dma: Centralise iommu_setup_dma_ops() Message-ID: <20240308203715.GA9225@ziepe.ca> References: <202fcca3269201bc9c4a8198253f195433d0c4ff.1707493264.git.robin.murphy@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202fcca3269201bc9c4a8198253f195433d0c4ff.1707493264.git.robin.murphy@arm.com> On Fri, Feb 09, 2024 at 04:50:03PM +0000, Robin Murphy wrote: > It's somewhat hard to see, but arm64's arch_setup_dma_ops() should only > ever call iommu_setup_dma_ops() after a successful iommu_probe_device(), > which means there should be no harm in achieving the same order of > operations by running it off the back of iommu_probe_device() itself. > This then puts it in line with the x86 and s390 .probe_finalize bodges, > letting us pull it all into the main flow properly. As a bonus this lets > us fold in and de-scope the PCI workaround setup as well. > > At this point we can also then pull the call up inside the group mutex, > and avoid having to think about whether iommu_group_store_type() could > theoretically race and free the domain if iommu_setup_dma_ops() ran just > *before* iommu_device_use_default_domain() claims it... Furthermore we > replace one .probe_finalize call completely, since the only remaining > implementations are now one which only needs to run once for the initial > boot-time probe, and two which themselves render that path unreachable. > > This leaves us a big step closer to realistically being able to unpick > the variety of different things that iommu_setup_dma_ops() has been > muddling together, and further streamline iommu-dma into core API flows > in future. > > Signed-off-by: Robin Murphy > --- > v2: Shuffle around to make sure the iommu_group_do_probe_finalize() case > is covered as well, with bonus side-effects as above. > v3: *Really* do that, remembering the other two probe_finalize sites too. > --- > arch/arm64/mm/dma-mapping.c | 2 -- > drivers/iommu/amd/iommu.c | 8 -------- > drivers/iommu/dma-iommu.c | 18 ++++++------------ > drivers/iommu/dma-iommu.h | 14 ++++++-------- > drivers/iommu/intel/iommu.c | 7 ------- > drivers/iommu/iommu.c | 20 +++++++------------- > drivers/iommu/s390-iommu.c | 6 ------ > drivers/iommu/virtio-iommu.c | 10 ---------- > include/linux/iommu.h | 7 ------- > 9 files changed, 19 insertions(+), 73 deletions(-) Reviewed-by: Jason Gunthorpe Jason