From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 9FECF26C384 for ; Fri, 2 Jan 2026 18:22:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767378173; cv=none; b=sQcdxDNACY+5MNfAV5oTRRKMMBONgi/moii3tuoYLcpouealWHZigf0iHlOfABBKFkSKA7bei6aQ9ye38paonx5u1tf1CSQHq1lVIkWWWqIOUuVivtoypD+4obeYK56+0/c3CZkEtTRyspq6NQGleEP3lovadUWnqr1DOSrbUmo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767378173; c=relaxed/simple; bh=GdUd1J4V4UTi7y3zHeowygqgFqGp5+/iCY4ovYdkwZs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=I1y0Wzd3N2K+yF69/5x/GsAC6yKhQdcVaytMqTTN3JVA4oI+nukkGxCwlKjCyAhpRgRgAWX630On+JV352fGMlnR/9X2pLkYF5E8OemdIgreVKFpVZf614aO6E4ziCrtoTIRhkoTHjkPqRRhjPPiTixDVKe3DvRQ2RzVlOU7jzY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=fdhksOr6; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="fdhksOr6" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-477a1c8cc47so2425e9.0 for ; Fri, 02 Jan 2026 10:22:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767378170; x=1767982970; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=5IiIOdbgFZQ8/EhuBk+duA7uZTuVxCyFjJNieGC9yzc=; b=fdhksOr6UhXVu5Mw0sPEp1ttIE344kQaJRg32dQNZs+9pTpT9N4U7JIae/Gr0EDdtX WjlawENP2K2MGX3ro2vg//1RyWvjh4lfx1Wwhl+Hf03Ij3ZnMOWbImC47fRBjnFXVTKS 7N2iF/gAWGbagLZxJ0ttgJN/80ml+uF7LNwobU0KuwzM5cJtW6qrZ0GrTFejKTs0CZZB osX64kbtVPE93wAzFtoRnNopQiEGG653AbG6wOilLqXSTIA8x2VF0xM4VLX9DHibgvlu PR/RPR1uSaBc+MpHwGGJs/KQn+2yjyKUsW2ZaOreu1WoyOufVaGOeBVNWerjMzyAFQwP FZ6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767378170; x=1767982970; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5IiIOdbgFZQ8/EhuBk+duA7uZTuVxCyFjJNieGC9yzc=; b=KXZVi38Ef67v+ZN1AVxaRsTM8yk/PwLrb+T4G2boiQeK2dz8yzzAlyiTTc3Fdl0hdt mhvmd+z2LVupWkR8ovXfES0VDiXBtmUmNptanIXFKOL/aeb9vQFcvaolnezk3kRMz0jQ 314osyVStztH8cbu5cWjl9iU00fjHmcAPSneN5Vdd1JJ77O4fSYGVeQ06K+X0j0dnHDE HN4thPGKHzNjUUsOC25h5kjLTWdMFfadvfk8Gf+YQvfkp8p1DqhMHTZKw5eUYgr3/V+8 StEpehxzloqatfr64KD7pCKAzu21F28TMjI61d0rf9tMpJisLzduPebCdJgOiHFE/W33 oUIA== X-Forwarded-Encrypted: i=1; AJvYcCVjuff3mefLqk+0nP9ibYoI7TaddCzdEXtyJgVn/GefB22Kt98NTm+obpXUbWBzFRJBPuOjBZxS9gc27/g=@vger.kernel.org X-Gm-Message-State: AOJu0YyCHp2+3B66mCR9mOBVMhofz+cFaXR9I7vJTuCNzFmTMNju7TqJ uJXRX860y1XFJbIU83bd/XjQsqXe45kcVNCa23U3dLe/fycZvH59v1oJQbF9hh5EZA== X-Gm-Gg: AY/fxX56Jw8O2h9KquTvR+0sqhGzyISAyLBUsqHYIQ+PXJJMUbSqKZGKHzWt5+ttmVH UXHNoZSn5/V86jhPqANRi5r93u+gA/Sk4RNaPgut+hAqecE7c3sWBG5BpUwAqgJZ0X0eqcVKVxo lp4phJ1otCG4uYf7uJBPB8pmmSdLPcuL8C95TyJwHIohcZb4tUuZrLlHWQAPmdrGP4SZeU2brRn vrvzP1xBCvS2iH+z6mRco+RPsQRekFgkAX2Hra5OQkXwoQf22xwDl8f229/v6oCJU0LHeN+i/Kj AMExP8mIqxMUJAZJCqkq1O+QspDZ/RSKkSyoqh0sDCDUUEmFyHP0J4ClGqlNx0Zd3Ib8c55Gc/x JciArUe9k3m2X/ZKb7jFA5nmJQ8UZMJ8PlCduJhDAfG7+/O7RJ3RjuEKErNXB/VdS+qfj9cvqvF arcpyu+FqQ1B0vwtsyHCiGHed5s+a1SKwQj66YMak1jibUClMf4dnX X-Google-Smtp-Source: AGHT+IHPa9BfjetwRVFzisbfuQDu9u4VsHiovnCoNEmzQNdcrMb63MY4lDI/VvFuE8axHy+Gopltqw== X-Received: by 2002:a05:600c:6a90:b0:477:8282:6cca with SMTP id 5b1f17b1804b1-47d6c328fefmr5725e9.6.1767378169601; Fri, 02 Jan 2026 10:22:49 -0800 (PST) Received: from google.com (171.85.155.104.bc.googleusercontent.com. [104.155.85.171]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4324ea1aee5sm86915989f8f.4.2026.01.02.10.22.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jan 2026 10:22:49 -0800 (PST) Date: Fri, 2 Jan 2026 18:22:45 +0000 From: Mostafa Saleh To: Jason Gunthorpe Cc: Nicolin Chen , will@kernel.org, robin.murphy@arm.com, joro@8bytes.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, skolothumtho@nvidia.com, praan@google.com, xueshuai@linux.alibaba.com Subject: Re: [PATCH rc v4 3/4] iommu/arm-smmu-v3: Mark STE EATS safe when computing the update sequence Message-ID: References: <20251218180129.GA254720@nvidia.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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20251218180129.GA254720@nvidia.com> On Thu, Dec 18, 2025 at 02:01:29PM -0400, Jason Gunthorpe wrote: > On Thu, Dec 18, 2025 at 09:32:43AM -0800, Nicolin Chen wrote: > > > > 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 12a9669bcc83..a3b29ad20a82 100644 > > > > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > > > > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > > > > @@ -1095,6 +1095,15 @@ void arm_smmu_get_ste_update_safe(__le64 *safe_bits) > > > > * fault records even when MEV == 0. > > > > */ > > > > safe_bits[1] |= cpu_to_le64(STRTAB_STE_1_MEV); > > > > + > > > > + /* > > > > + * EATS is used to reject and control the ATS behavior of the device. If > > > > + * we are changing it away from 0 then we already trust the device to > > > > + * use ATS properly and we have sequenced the device's ATS enable in PCI > > > > + * config space to prevent it from issuing ATS while we are changing > > > > + * EATS. > > > > + */ > > > > > > I am not sure about this one, Is it only about trusting the device? > > Yes. The purpose of EATS=0 is to prevent the device from using ATS at > all - critically including using translated TLPs eg because it is an > untrusted device and the OS wants to prevent it from attacking the > system with direct access to physical memory. > > If the device is trusted then once we disable ATS it must stop issuing > ATS, so the EATS=0 should never trigger a fault. > > > > I’d be worried about cases where we switch domains, that means that > > > briefly the HW observers EATS=1 while it was not intended, especially > > > that EATS is in a different DWORD from S2TTB and CDptr. > > Well, no, it means EATS is enabled a little bit earlier or disabled a > little bit later, it doesn't mean it was not intended. > > The point is our rules for ATS say that the ATC is empty at this > moment and the device is not permitted to do any ATS fetches because > we won't issue any flushes. > > Thus there can be no concurrent ATS traffic and we don't need to > exactly sequence EATS with the translation. > > With virtualization the hypervisor is still the exclusive owner of ATS > and guarentees that EATS enable/disable is sequences correctly with > ATC invalidation. I see, thanks a lot for the explanation! I was mainly worried about the virtualization case as the VMM can influence ATS enable from the vSTE. Looking at the code in arm-smmu-v3-iommufd and iommufd/device.c, it seems ATS enable will only change at attach. Looking into arm_smmu_attach_commit(), I see the ATC is invalidated after the STE is installed, which means that userspace can transiently observe the old domain ATC. I think that's fine at the moment because when binding to a VFIO driver, it will attach to an empty domain. Thanks, Mostafa > > > I think the last line that driver controls pci_enable/disable_ats() > > should justify the whole thing? Are you worried about device still > > doing ATS after pci_disable_ats()? > > Exactly right, and we can't worry about that because it says the whole > ATC coherency system is broken. > > Jason