Received: by 2002:a05:7412:8d08:b0:f9:2d0a:d759 with SMTP id bj8csp120728rdb; Sun, 17 Dec 2023 05:07:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHb7HlR+c2YXD1l58dY19NDLjd+mKqQLO5T4B5bnw0Gv5cD2bmudlg4jb7XPA+1ASbLZ9yS X-Received: by 2002:a05:6e02:12c8:b0:35d:768e:871e with SMTP id i8-20020a056e0212c800b0035d768e871emr22903231ilm.4.1702818429702; Sun, 17 Dec 2023 05:07:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702818429; cv=none; d=google.com; s=arc-20160816; b=gQ+5obPoMagiqCgmjCb0xJ5LY5Ppkia100yM771OfOfF/zrQ14ry4HKSK3MkTclLYP A5d5DQJckGrd3+iry0dgY86re6cOgG7j3amnsrfwbwus9JloW9Oc46C9O9E3pgRW1Dzg H4T60M9I9p5zOPXXvtSRPCchtcYRznmv/MCO/kCNn4ev0jwGbbYpeiApIuKxKGJlYWt8 TgA7wwtDT+4Fm0+7iVbmKlkd4h1FKDGkQSle9AuxD7PwlGwwLjGT7iZu5UX1me6aza35 ORiqtHmAp0SQIuB0QESVu+cM3KjS3LIfpDQXEQU32gEWmTH4cvzaZA2pFLz/wy6JSrDm ByLg== ARC-Message-Signature: i=1; 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=KImPZocudnA0Xid9bPae7bvgNXTlGpXerlYRqfFZmS0=; fh=mp9jmKmDqWSA8kLAJ8YM17JiAgOYjZ8jT9wZ0ztHIGw=; b=mvMelngMBGFTdMPPfRl/1820dhZMGEC+LKrNgmk5UiiZQhbwSCkmSE1Xigat+e+Fsm bSZUzbMNX0g/Vo2jq2aNi1pCds/2fAbDYPyGUuXS0DeJ5bcpe6hYe2vNCHAcr5SePMm3 aL5beGZXMCDvYsLo6GQ942IaFvJM0Tdnzbznqk5Oz+UVVlxTKyMy3/X+3QIenT4+PXnr EdVS0wWBejDf8RyX2jgLJ+QoJJ1aU62NkrUCvIXWwG/jykIGD20MkdDoqehCu3DxcXLo M6Cc9sT9TTnUDO4oQailKqZqP0fPT5Sd35t6AVEeAEFUXZAZu/ZcaD4zUPAIaqKJzgi0 J1Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=MfPHfxSX; spf=pass (google.com: domain of linux-kernel+bounces-2589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2589-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id f15-20020a65628f000000b005bdbf2ac2d2si16046595pgv.85.2023.12.17.05.07.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 05:07:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=MfPHfxSX; spf=pass (google.com: domain of linux-kernel+bounces-2589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2589-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 26563B219D3 for ; Sun, 17 Dec 2023 13:07:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 438ED43AC6; Sun, 17 Dec 2023 13:06:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="MfPHfxSX" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (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 614E24317A for ; Sun, 17 Dec 2023 13:06:54 +0000 (UTC) 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-qk1-f176.google.com with SMTP id af79cd13be357-77f552d4179so172978885a.1 for ; Sun, 17 Dec 2023 05:06:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1702818413; x=1703423213; 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=KImPZocudnA0Xid9bPae7bvgNXTlGpXerlYRqfFZmS0=; b=MfPHfxSXkor6ksyXCZguDaP3qwObFWL6B7+wc6rlY1NZWv0fWhwi1atdEEPevaQr10 EFq3D5aJYsnu1kqQ+SDxYhJN5lUtpSMeXffTI5KTgDacoxKi6KXhI+FSLB6zum9BiWwg RU+XRgwEyIgzGp5xz6MbBYaLq//fa/AFCfRn2nnwCvFvFvont9210vGskSXLTFcgwcul fuCzyz9ZnT0fE37m2zlEzswqlvXJt+GngC9O7H5GrxK+f1UHcbokfSwb04fy7AYRXmGx mWsVqWU1eM/Gg+ECLTAjaW/wcQ7V8GJYJ9qOyCSVyUUuEWJFARyXfGBCPIoYcXzaQ+qI GB6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702818413; x=1703423213; 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=KImPZocudnA0Xid9bPae7bvgNXTlGpXerlYRqfFZmS0=; b=KmY5lsgamE16vcI1xI2k+cH0FpOIwGedgm7QnbZFKMa4AAsaGcdzC8FXuHqyKQ/cXG V7Qv0JLRLCYACarAbBrONxme4lYebChWdH+pxW3hoq+L/Yz9zZO8XloCFCoOIcOrXZWT gp5+b/ksBY6aV68KeqszBoQoqqF0sNCfMDf27/DF+YMKGrTXbYS/KOMfnKW8yfQt0U5D bLHcfKFbRMgMOOxNekUUo5Q+0eCXuH0ld+H0+JSfgNIvWmIHz41zHlSD1bUXtzcty9D8 ipcItnAgzBSy9tGB7wRRgVX3E2q3BqeAuyvlag/1t/XZLYZQQVAubChWw8ADX4d99yrr OGpw== X-Gm-Message-State: AOJu0Yw2cAYa9ifJ/kIJgli1BVzibspZo7N0WhIT1YpgN5TnEcnw1D1P gdFNH6lkdQOfxGsBYJaeT5ekAA== X-Received: by 2002:a05:620a:24c2:b0:77f:849f:72a5 with SMTP id m2-20020a05620a24c200b0077f849f72a5mr12897578qkn.94.1702818413199; Sun, 17 Dec 2023 05:06:53 -0800 (PST) Received: from ziepe.ca ([208.169.72.58]) by smtp.gmail.com with ESMTPSA id a26-20020a05620a439a00b007788bb0ab8esm7536493qkp.19.2023.12.17.05.06.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 05:06:52 -0800 (PST) Received: from jgg by jggl with local (Exim 4.95) (envelope-from ) id 1rEqr5-00013m-DC; Sun, 17 Dec 2023 09:06:51 -0400 Date: Sun, 17 Dec 2023 09:06:51 -0400 From: Jason Gunthorpe To: Robin Murphy Cc: Jean-Philippe Brucker , Joerg Roedel , Christoph Hellwig , 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 , 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 v2 6/7] iommu/dma: Centralise iommu_setup_dma_ops() Message-ID: References: <5d89190b35720bf5b66621f46b6d3c85323d8eab.1702486837.git.robin.murphy@arm.com> <20231214165126.GA3726750@myrica> <2d87c1dc-cc95-4d92-968c-9d6e6e6439ff@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: <2d87c1dc-cc95-4d92-968c-9d6e6e6439ff@arm.com> On Thu, Dec 14, 2023 at 06:22:49PM +0000, Robin Murphy wrote: > Taking yet another look, there's not actually one single place we can do > this right now which will work in a manageable way for all cases. The dma ops should be set after changing the translation and there is only one place that attachs the domain? What prevents putting it there? > @@ -3217,18 +3220,9 @@ static ssize_t iommu_group_store_type(struct iommu_group *group, > if (ret) > goto out_unlock; > - /* > - * Release the mutex here because ops->probe_finalize() call-back of > - * some vendor IOMMU drivers calls arm_iommu_attach_device() which > - * in-turn might call back into IOMMU core code, where it tries to take > - * group->mutex, resulting in a deadlock. > - */ > - mutex_unlock(&group->mutex); > - > /* Make sure dma_ops is appropriatley set */ > for_each_group_device(group, gdev) > - iommu_group_do_probe_finalize(gdev->dev); > - return count; If we are turning this into something that only works for the ARM DMA then the remaining caller should be guarded by an IS_ENABLED Jason