Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp407569lqg; Thu, 11 Apr 2024 06:47:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVnm/iGNbwvaxEq9/3qnt43lQOFPOsPXXO1dQAPRY+12sNom1fQo4io/ThaMT/okCAaOv0EJ5hlZ+41YNxUDGI8I3f1owyjErx6HLNNcQ== X-Google-Smtp-Source: AGHT+IF4De6WIMuKRunRAnZRjhNz/aVshl33iZYnDMNxXNkkkO9r+6swuhgSDhGI9/7yC4R46313 X-Received: by 2002:a17:90b:110d:b0:2a5:28e7:5818 with SMTP id gi13-20020a17090b110d00b002a528e75818mr5537819pjb.18.1712843244913; Thu, 11 Apr 2024 06:47:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712843244; cv=pass; d=google.com; s=arc-20160816; b=dT9NxzJsXWlym3UpmW5j8Y7vaKDjPMNEwlpRowquU3bMIFM5FjxWQu4v2BylFSolwV FQ7tzO0fMcGODsbKsIOk5Z6pAEkreIcnmNsGW5NpLAIGIvy/PrKx+Hh2TkUYxQdbiR27 BvepNdbJ5BXlZ/hxQLOIogg1YqrN0cz6Uk6iwnXH8t6HzR/vlvpzxyDZgyc4GF/lUilA 3MY8aPSkCCfHRhfSqlNejJWNe+E6Vx+4AyHXkwuSt7pNa4+5Isg9Slbwp51G1nev6+9y cHSkMg5itE1lpoCsKbKwsy02l4cXagg6ouKJqSQfi2tphtv9LUCVERJO9bYfi4KWLLRY L25w== 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=9v9IYMurW1GEHuOD/BlZrlZ0U0DSGWxEk7s+eTR4EGo=; fh=PObr657wfsZSxgK2hEb4RpTh24AhM5ZkssaIllXlSrY=; b=aqVBwU1VCzusImPXJK+v0u+RgHqGo2cd5cU0/Rtvdh6WkRcZ781+N7YyUfKL7e7TDy FhNeG+ESiGIHhU0CzP+bE6lS3Elk7zXU7YHm5zAgvRfONAhsScV0i+VTIJtOnDyfAzzA fznzuXZBkgJbPnJDAG4ZuzBk/7FagI752DqtwLnp8e43JLXn10TlNmZ5HqT+tSIgvXyF xzFiyFB1WDlysLm+7OuJzawELrfd8eFjEXySZNUlYwfl3JVc3QuPhOhNamy68lJB8w+Q jDNlByfwMcpFQvHQUZWIDaDYsb4GiCNxNBlPHizzEMowAhfhn8qpwBGuTkux/FJJ9dkL H2CQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=M1yl0uq6; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-140556-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140556-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id nv16-20020a17090b1b5000b002a22f4dba43si1489820pjb.17.2024.04.11.06.47.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 06:47:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140556-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=M1yl0uq6; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-140556-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140556-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8C98528226F for ; Thu, 11 Apr 2024 13:47:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D4EB61514EE; Thu, 11 Apr 2024 13:41:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="M1yl0uq6" Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) (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 A779B145FFA for ; Thu, 11 Apr 2024 13:41:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712842918; cv=none; b=k5tw+CbtSihzJlz6Pna6bh++TerqtBe6yi8U9pKpnjTkDKQ0+3a6no2eWBvF5doQ6kKZkIESX6ythWyrYt/porI4LUkOCjjI+PbGLajQpEERJ16qRFL0CAR9j4JLdzghx//nPavyJcIlfhBSq8ihmv3KAMIppmYiUidVH/yviSA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712842918; c=relaxed/simple; bh=3oGpsXWmc3HGA7rtUUVqBCocMMuUmgvht732EoPs5XY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jpTQdExcyJtUJiWBrILNKms/sdFSbeY7dKMoOB/rCATi4UphPPeV432lp5TMhBO1q+5SukQ1UugIDNCfb+GVytQcfgP/E5pGZ6xErP5dK7edsv5+pERjfhzvKCSMJQ6n8a6y/5pMiNatTGHcSGXX6JESi5e30qhDCmmGA7skCpM= 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=M1yl0uq6; arc=none smtp.client-ip=209.85.219.44 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-qv1-f44.google.com with SMTP id 6a1803df08f44-69b514d3cf4so1697286d6.0 for ; Thu, 11 Apr 2024 06:41:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1712842915; x=1713447715; 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=9v9IYMurW1GEHuOD/BlZrlZ0U0DSGWxEk7s+eTR4EGo=; b=M1yl0uq6xvQeiNSk/eeYGytWWdZ+UorMkIhKKM5Txo5iyPlmzqHu2QH8ai3ihIrXKk MXT6YTUiF6kD1GFVAN98htzhDQTrRjFUbF29EHZpajS/ItWQT+P84MkzC70GjwVX1AHU c9jkl87JQgajLc1nwxAIVPMb56Tw4qaVTwmoizapMTNx2nMMh6NDzmMo6j8GkB6kdD3Q YdKzjMQOV90NK9/udWX/f21dZhMcQBSf+RIMlMP9nGAN60fikImUj14RHIwM7SsxRDh4 Tzn8xWrqFW6ZwL0JfFyIxmUxpAiSCONMPvOhFWTOXlJncwHETA3Jp1BVVKtpsSpWa8g3 M4Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712842915; x=1713447715; 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=9v9IYMurW1GEHuOD/BlZrlZ0U0DSGWxEk7s+eTR4EGo=; b=bHbFsDcLuN/W866mGwre8ZDpT7ptAd595Fwju+zyAdoyM1FJOYdTBC8CorAsHe0zHZ i26+djhfgr6ADM/6S6/BP6JQS3SZrGnBS4vOUozRI3XabuvexE4Wm7ZwvE0N6AZSDAvG /8kvGtf4fRJmPc/w5/Lzacg9xAon7kP2agHPkvSrqFr3ezUh6Bo6haPVcQ4juzrWcyeG /lq1fLXb5kgRYfPG0j5MouPdNHi0UHKTStO6uHnTDHcoCnbgSKKjCV7sCCLqH3vP/48m EFSDeeuPKAko8xkGR+9tDPSDIcLK0kFVW6/vDTjJeHTFZpBJDp7DmjJyFmmUdfB5yvMQ gaXQ== X-Forwarded-Encrypted: i=1; AJvYcCUFGh5Gl987uMCcvkhtOAXv++nTISX546WeYoFCxvrqfl0cWDAVgwi6wBzHQ6DCMxYsTodgDAufsGU5kyDcORmmNxPvxuR9QocP+Hjb X-Gm-Message-State: AOJu0Yxi+yCV5ienJV1Rrs8/kxw9rjJueaG8gFBf/CavS2jskvPiiwLt NmOvJQwq+f0fMPJOyvy7Fp4G2qVq86JYf7WgDhzbQPQUSmLeN4PBzPBkYKQFnHw= X-Received: by 2002:a05:6214:5090:b0:69b:17b4:dbb with SMTP id kk16-20020a056214509000b0069b17b40dbbmr6353521qvb.13.1712842915668; Thu, 11 Apr 2024 06:41:55 -0700 (PDT) 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 r18-20020ad44052000000b00698e65cdfefsm944079qvp.87.2024.04.11.06.41.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 06:41:54 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1ruugc-00AkN5-Ab; Thu, 11 Apr 2024 10:41:54 -0300 Date: Thu, 11 Apr 2024 10:41:54 -0300 From: Jason Gunthorpe To: Robin Murphy Cc: Lu Baolu , Joerg Roedel , Will Deacon , Kevin Tian , Eric Badger , iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/5] iommu: Add static iommu_ops->release_domain Message-ID: <20240411134154.GK223006@ziepe.ca> References: <20240305013305.204605-1-baolu.lu@linux.intel.com> <20240305013305.204605-2-baolu.lu@linux.intel.com> <20240410152606.GF223006@ziepe.ca> <0dda6ce6-1b82-4168-93b7-a0e847ce9b08@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: <0dda6ce6-1b82-4168-93b7-a0e847ce9b08@arm.com> On Wed, Apr 10, 2024 at 05:37:06PM +0100, Robin Murphy wrote: > > We should probably be sensitive to the > > dev->iommu->require_direct flag - generally drivers should prefer the > > blocked for the release domain, but in case the FW ias asking for > > require_direct we need to switch to identity. > > At this point do we even need release_domain? Ultimately ideally not, but I feel better going through the exercise driver-by-driver before we just make the core code do it automatically. Maybe I'm being overly pessimistic about the drivers.. Have all the drivers setting identity/blocked domain set release domain before we switch to this unconditional method. Anyhow, I just noticed it went into -rc1 already, so may as well keep going. > static void iommu_set_release_domain(struct device *dev) > { > const struct iommu_ops *ops = dev_iommu_ops(dev); > struct iommu_domain *rd; > > /* > * Static domains are expected not to track any device state, > * and thus be tolerant of devices disappearing once "attached" > */ > if (ops->blocked_domain && !(dev->iommu->require_direct || > other_arch_or_platform_reason)) > rd = ops->blocked_domain; > else if (ops->identity_domain) > rd = ops->identity_domain; > else /* Hope release_device does the right thing! */ > return; > > if (!dev->iommu->attach_deferred && rd != dev->iommu_group->domain) > __iommu_attach_device(rd, dev); > } Yeah, this is a good end goal. Jason