From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (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 46C473E7173 for ; Mon, 11 May 2026 13:21:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778505693; cv=none; b=lAEviZeOmkV0Quowm6uKF7odCXYAqcUILIs5MWRC2jLtjix/MV6TuncQ5SLzBATpoWWOuH2uJG4Q+537UMjYcSILZPK57XiUT/4deTQ4Blt3HQUe20fqd1M3h5wT/Ig+3KH/dCJVVuht+74EQb67qezVMCzo60mdbfnoj43whgE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778505693; c=relaxed/simple; bh=l3tLAV/qbXxDAiEjZBHqF/EXhczrSOv3/Pf5ORcdo0Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=W5f+Oa5su9X095bX751nvFiTdYGE8sHEL71Zw+MoZpq0lipedT84U2lSZOQo4W/oHoznBHE+AuqKmUjxj4wj3RO9do0L9/scMNoQT0MTs6/Wl9fI6qpyNwTjHfId775O/xEQ9iLu61NMlAdOm9Suo6kRD/rCaPpEaB8wl1tKYIA= 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=iUJVTtUe; arc=none smtp.client-ip=209.85.222.170 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="iUJVTtUe" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-90b2fcf90a0so120367485a.1 for ; Mon, 11 May 2026 06:21:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1778505690; x=1779110490; 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=caLXAvpdnitODcaZa23G/qyjfJ3yi/42EdivUQYgIvU=; b=iUJVTtUeCwlCXe+rE7ma4m7Hornh5XYljqRhxWqAkTmPnknpEc9GcLz53lN7WapRmx 0MbswfRb+oLCrdlwv3T4Gpx1w7Q1lhzSxFqdZvrUENCY92Fxh3I6ECFdkAD40PcVbcr3 KIWxUlRYF5I48hSwF1QNSUGyqkliqhBM9tk5oGgDZUSf1CVSK8YKICZutfokEOheR2ZK 3e0aN8OFjDYJj0UZBzu91Vw20vKEDMUKS4oJYusF1QXlgUkMtYf+tpRi73HoCan7S/ld xq168Us7afPue5Y1Fofy/gPEfvEy4SLOq0eNNS8ySuT2W9xkiKe4frrRlVD29/ayU/sm F1WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778505690; x=1779110490; h=in-reply-to: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=caLXAvpdnitODcaZa23G/qyjfJ3yi/42EdivUQYgIvU=; b=keaxfioF8o9IAIMc5KKldBVt8i68wuRJoAWiWD0uUB3Sf+ncU9Iko9DxMRLNMhIlme S/p0rLNt6LdC8utkaovIMi1lJP28QKS/fk4sTbkvADNwSBU2lwKR/fk/D2j2Pto3Ga4y oyAXnDxXizd7o8VhQJ/1ClVDFAt45Md9FBpsH4HqHE2H7k69KjNrbdQyrCPegNGMrGw9 hceGZ6jVx+xfJkLy0mtMBP/dtcN/MSAZBnkvbEOEWj44z5ONI2mlTQ005oHdm4n4J65g cul01el4kPpNPdJburbwqkJk8NxTuExK4K0iuUdB7TZN6PrLKAhRn4mOW/Wy0eXs1NyL Mmhg== X-Forwarded-Encrypted: i=1; AFNElJ9aRnOjPTBjdfee/sFd4ZE1fXyLFdoMnSpnH11cLziAblA5TKl/NmUOIpxM3zswkL+LFrPNSK89UM3f3aQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw38+Ipg0nPNJi2agLIUHJES2Lyv6g1BdOj2UbcWTO+K+AWtmIH 9sRx/VbMhlFRrVb/n1bEtxTOkmYPBFvrF8x3rVLUHi7Upa7jr02juOj7oOpDbm0g/3c= X-Gm-Gg: Acq92OHx4gaYLSLIh/TlCXUSUVRhRcaoopSrVeRGBELwuAzt1h/v54e4wsQKvRfL4eB Ohj7JY1TRj4YzuycH+NCY8TgqNKzxNyjTEFCLw8dFYbdBGlib76ePG83hneS9U/2ATObwIVmMxz NmZlEcecjXaNUgg0/UM5iET6prwUkYNl05xII10SJE6qtXesco5i+orqI6dbeB/T7X6HJB6ndFz kKdYsFqVVXwkpvwvrpyahyUY4kez2189xAIAGFG456JCI095gvpXCHOH8Zh7AKZTOimn6SnrqUv OvKlC2S/Dcs9UOaALhc1Fjqna2iuUNl1sBHeQlqlk1MoC8hOwk8PZUs/sEozBxL0HKMHFr1bsSS u2blEu8+5eHA4DUHuQ//kPAjyilXyMhVWH+7NhrJufMeDtWmRpwfXREtqwMaRzCeqnyoN8FZZlF jG1KC8nGLGSLx0u2r4XhhJMtH3VAYZCKAB0CDYoflpGieseS87AQK0G5iZMJ0p+stlI6HdtBEg4 HBipg== X-Received: by 2002:a05:620a:4494:b0:8d8:ed00:5a91 with SMTP id af79cd13be357-90653151c6emr2455764285a.22.1778505689836; Mon, 11 May 2026 06:21:29 -0700 (PDT) Received: from ziepe.ca (crbknf0213w-47-54-130-67.pppoe-dynamic.high-speed.nl.bellaliant.net. [47.54.130.67]) by smtp.gmail.com with ESMTPSA id af79cd13be357-907b8e9b24asm1066226385a.18.2026.05.11.06.21.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2026 06:21:29 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wMQZc-00000004njt-1WnC; Mon, 11 May 2026 10:21:28 -0300 Date: Mon, 11 May 2026 10:21:28 -0300 From: Jason Gunthorpe To: Robin Murphy Cc: Joonwon Kang , Alexander.Grest@microsoft.com, amhetre@nvidia.com, baolu.lu@linux.intel.com, iommu@lists.linux.dev, joro@8bytes.org, jpb@kernel.org, kees@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, nicolinc@nvidia.com, praan@google.com, smostafa@google.com, will@kernel.org, jacob.jun.pan@linux.intel.com, easwar.hariharan@linux.microsoft.com, kevin.tian@intel.com Subject: Re: [PATCH RFC] iommu: Enable per-device SSID space for SVA Message-ID: <20260511132128.GM9285@ziepe.ca> References: <20260424133953.GY3611611@ziepe.ca> <20260507095851.3220765-1-joonwonkang@google.com> <20260509171013.GF9285@ziepe.ca> <30eefd04-1d0f-45d8-b55d-e3e8d41a57ef@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: <30eefd04-1d0f-45d8-b55d-e3e8d41a57ef@arm.com> On Mon, May 11, 2026 at 01:39:06PM +0100, Robin Murphy wrote: > On 2026-05-09 6:10 pm, Jason Gunthorpe wrote: > > On Thu, May 07, 2026 at 09:58:51AM +0000, Joonwon Kang wrote: > > > > > By "similar instruction" on ARM, I guess you mean ST64BV0, which fetches > > > the bottom 32 bits data from ACCDATA_EL1. Please let me know if you meant > > > others as it will matter. If ST64BV0 is supported on ARM, however, it > > > would mean that ST64B and ST64BV are also supported already according to > > > the ID_AA64ISAR1_EL1's LS64 field. The latter 2 instructions are just to > > > atomically store whatever user wants to a memory location without > > > referring to ACCDATA_EL1 and all the 3 instructions can be run at EL0. So, > > > the userspace driver would have enough capability to designate arbitrary > > > PASID as it wants via the latter 2 instructions when communicating with > > > multiple devices. > > > > IDK exactly what ARM did. IIRC on Intel ENQCMD forms a special > > non-posted write TLP and the device can tell the TLP came from ENQCMD > > and so it trusts the encoded PASID. ARM has to have done the same > > thing - allowing anyone to forge the PASID by using a different > > instruction misses the point of the Intel design. > > Yes, ACCDATA_EL1 is a privileged register neither writeable nor readable by > userspace[1], so it should be functionally equivalent from an SVA point of > view. There is a bit more going on though, I think that is what Joonwon is mentioning by asking about ST64B and ST64BV. I *think* the answer is: - ST64B uses a posted write - ST64BV can be restricted so EL0 cannot execute it, it uses a non-posted write (AI tells me via EnASR) - ST64BV0 can be used by EL0, always uses a non-posted write, and always uses ACCDATA_EL1 Which is similar to Intel. The device only processes the PASID from a non-posted write, and the CPU prevents userspace from forming non-posted writes except through ST64BV0 > > Honestly, I'm not sure why they even implemented it. SMMUv3 can't do > > the translation scheme required to use ENQCMD from a VM anyhow, so it > > is pretty useless. > > Not sure what you mean there - indeed you can't do the SIOV thing of > assigning individual ADIs to _different_ VMs, but there's still no reason > you couldn't give the whole accelerator device to one VM, and run the "full" > kernel driver in that VM to hand out ADIs to processes, same as for > non-virtualised ST64BV0/ENQCMD usage. It's entirely usable, just not so > "scalable". Well yes, technically, but I'm not sure this is attractive in practice. The value of ENQCMD on Intel was it can eliminate any HW side per-context state for simple HW like DMA engines, including for virtualization. You pay for that value with some performance loss, but it can be attractive because of the universal scalability. However complex devices don't seem to want to use it, once you have to have per-context state for any other reason the performance downsides of ENQCMD make it unappealing. So, IDK, maybe some embedded on-chip device will find a way to make good use of it, but also I'm not aware of any adoption on x86.. Jason