Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp14064lqb; Tue, 16 Apr 2024 07:34:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW6YLp4Q7zwVf3Ijhk7D++jlDt/1YYhFUEWGqJDOH/khDpaUzLqhRwjOmKPk9R5hL8Il6ExhLfl7uvXMm09A3IwqHIo1APBNTto/PiN8Q== X-Google-Smtp-Source: AGHT+IGzgKj7WoXqU118kviNVm+c8Ro//XIRmLrEhPLc1qi/FI7AZ9e0OO4dLFoFAG15tLtKD1aS X-Received: by 2002:a17:903:1247:b0:1e7:b682:ec95 with SMTP id u7-20020a170903124700b001e7b682ec95mr4119741plh.3.1713278066603; Tue, 16 Apr 2024 07:34:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713278066; cv=pass; d=google.com; s=arc-20160816; b=U6pToWBK+nXzxQkQxyOgRXKnQ4+tyvtzbP6nEwIdPs+tXeWE6fvn796pGI99hltUnV w5hg9pAF+ls5vtiQCCwVnzccKjq6Q58sisWeTG8DKcB3sHbHlmpgSgoMwCaLQoYm2C30 j+/RI6IPKc0mt4DzB5/Sf/ttR9FolNvXHR3my5FSRPpSOdMP0wInXHXzydex2/0mziR9 fFrjHpXp9WkvjBd0yJz36HtxqomS3zA6UEJTB9aHIW62WwtMeUJuhC+EY6nyYHT0PQpL YR2ZO3wfsdW5y/L+pCSvnG8zkAnY8RqrOF3aqJNIT2am0oShxLv/RnnEYb15Luru6R67 bNkQ== 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=TP+/t8euC61p161de2PoTDpfBDtByEQHhqowS+DU4EY=; fh=TwTPcc4IF97eWd4232d5B16vUhSRy5HksANQcS1UD+o=; b=k7ctOPUtplNEL1CGbj58eRXLg0gKP+QZi55m1umWwyxUd7t+ujZupP/zVm/FyniV4o GyEbqP5NNJVKqwpkAxwJW6T4W89JjYapXBIilwkrsAFcWqtMSdq7UVlrZMeyID36NPnw kMEluWwz0BX3qDKioZCzjZHDpwoJhKz0mTsbOqm5/GnHBDq7Mfvn+R5OQ3lS7vTG5cgI /mXC7RVJOsJ+woKbAU0KThOGXf+SQUzZICE/cNR9R8rsWTA3XyYYzGFIMqxBBHqNZp7i 5i0wLI5isHeujKZ5ZZ1MGNzphoIGND4/gcRbdtlGdCYlC02dCoGCSkez9ZkodDn7BcuN yXZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0+DyPwlG; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-147027-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147027-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.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 b8-20020a170902d50800b001e49bce99fesi10128406plg.232.2024.04.16.07.34.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 07:34:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147027-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=@linuxfoundation.org header.s=korg header.b=0+DyPwlG; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-147027-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147027-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.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 3B876281C09 for ; Tue, 16 Apr 2024 14:34:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 73D6712E1C1; Tue, 16 Apr 2024 14:33:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="0+DyPwlG" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63B4912FF9E; Tue, 16 Apr 2024 14:33:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713278014; cv=none; b=Zr9bbXLeotnbOZfwsMUvPJtrfa0HWjlNrYsA8DD81FMMbKVbfCKLqCtB5xdlALCt1RUN3LGv/fiacbhxPJ/Jpm7MdmsIyLPhrGMziOh5IjhEZj7NwdXP44qcj9NxCC5q+Ie8WftD2DalCSBn1WppzEhV36uzAWa9pfNeBB0Ivmk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713278014; c=relaxed/simple; bh=S3+lG+Q4zz1vpzcDH9owuemE4fYStoaS86UMxk5U1J4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ny1QRV7hEUp66NA5ZGl9rLzwEnAz6GDsiZ5UjDc55nL63gv8TDhqY/o9pESgX1nzCJnM2f93MofwTlJ/DsTlcM7eR7XRu5XQP1jOunXOQ2lp62leAkaMeQSnH87JEe6To1gaiBR9vFGPrhcMvTKkXJzI5LJBMYt5cwDCFixWPSs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0+DyPwlG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70BAFC32783; Tue, 16 Apr 2024 14:33:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1713278013; bh=S3+lG+Q4zz1vpzcDH9owuemE4fYStoaS86UMxk5U1J4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=0+DyPwlGsaCyAcl74aQcZEoKNlafqD253vXe+at408/lTtSZFqY732I6veMUNTJiD kAw1rB3SW31dZCwayjZu08nsfjNu+yXxE400hAYlx+zyCxkrjHcdVRP11C3A4k+021 S9nMv/SR9Flg66ICCPZTkKKhhNi+j2aukCNTEIlk= Date: Tue, 16 Apr 2024 16:33:30 +0200 From: Greg KH To: Robin Murphy Cc: joro@8bytes.org, will@kernel.org, ewagner12@gmail.com, suravee.suthikulpanit@amd.com, vashegde@amd.com, jgg@ziepe.ca, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, regressions@lists.linux.dev Subject: Re: [PATCH] iommu: Fix def_domain_type interaction with untrusted devices Message-ID: <2024041620-brick-stack-6736@gregkh> References: 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: On Tue, Apr 16, 2024 at 02:00:43PM +0100, Robin Murphy wrote: > Previously, an untrusted device forcing IOMMU_DOMAIN_DMA always took > precedence over whatever a driver's def_domain_type may have wanted to > say. This was intentionally handled in core code since 3 years prior, > to avoid drivers poking at the details of what is essentially a policy > between the PCI core and the IOMMU core. Now, though, we go to the > length of evaluating both constraints to check for any conflict, and if > so throw our toys out of the pram and refuse to handle the device at > all. Regardless of any intent, in practice this leaves the device, and > potentially the rest of its group or even the whole IOMMU, in a largely > undetermined state, which at worst may render the whole system unusable. > Unfortunately it turns out that this is a realistic situation to run > into by connecting a PASID-capable device (e.g. a GPU) to an AMD-based > laptop via a Thunderbolt expansion box, since the AMD IOMMU driver needs > an identity default domain for PASIDs to be usable, and thus sets a > def_domain_type override based on PASID capability. > > In general, restoring the old behaviour of forcing translation will not > make that device's operation any more broken than leaving it potentially > blocked or subject to the rest of a group's translations would, nor will > it be any less safe than leaving it potentially bypassed or subject to > the rest of a group's translations would, so do that, and let eGPUs work > again. > > Reported-by: Eric Wagner > Link: https://lore.kernel.org/linux-iommu/CAHudX3zLH6CsRmLE-yb+gRjhh-v4bU5_1jW_xCcxOo_oUUZKYg@mail.gmail.com > Fixes: 59ddce4418da ("iommu: Reorganize iommu_get_default_domain_type() to respect def_domain_type()") > Signed-off-by: Robin Murphy > --- > drivers/iommu/iommu.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 996e79dc582d..90dbea14d4d6 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -1772,9 +1772,8 @@ static int iommu_get_default_domain_type(struct iommu_group *group, > if (driver_type && driver_type != IOMMU_DOMAIN_DMA) { > dev_err_ratelimited( > untrusted, > - "Device is not trusted, but driver is overriding group %u to %s, refusing to probe.\n", > + "IOMMU_DOMAIN_DMA for untrusted device overrides driver request of %s for group %u, expect issues...\n", > group->id, iommu_domain_type_str(driver_type)); > - return -1; > } > driver_type = IOMMU_DOMAIN_DMA; > } > -- > 2.39.2.101.g768bb238c484.dirty > > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot