From mboxrd@z Thu Jan 1 00:00:00 1970 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 00D9122E3FF for ; Thu, 16 Jan 2025 19:14:57 +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=1737054899; cv=none; b=TT6S/bYE3dKh6rztH5YZ3/wRaARPeoTSVtLhlk3uR2Nic+Q0jPbWqvAg4J6/phUSplttHff+c2vTZ9b8b5lgeS9WknaMPiCO97Ug3JN1G4jt0UvrN9SYeo3cSCG0xj6d2hbM1Mtfnbe5L42IlN9cazxcxe5bNGAFx2DbFSHd1GA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737054899; c=relaxed/simple; bh=dup/sGyrKh9WqqpYdYZY3lMgQO3Ij2gIanBBEaZheHQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=t+GwOxLXrsm5rhTd3adJMXm85pzidds89gK09rvYwJ8yFBHwOXHqDCj1GhvTxpgIhLlbEr3DwfaBNPO1qY1WwETKM2kRRUMXO6T7lvA6/PW43mj1vAO7WTwBmM/BqNIeP3QqZF8wGEle/SJ1l7PL4p+atVFrztpSJHMG6Hn4PRo= 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=V9QuG/+W; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="V9QuG/+W" Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-6dccccd429eso13669706d6.3 for ; Thu, 16 Jan 2025 11:14:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1737054897; x=1737659697; 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=OQt/5kPLKfcR/r6Q+UjR/d/646J1fzUVQYSmfGNoAZM=; b=V9QuG/+W8LLj0ChNaEkwrE1Kwug00KL+OnNgRbPZS+4JrTiI7hwytN7i41I73gYXEY AqwABs3/0rJg6QNrKYwuw4E8JcVsQTIQf1m41U3gy5kjwD2MhVM730EzCxK59nPyWCZ1 CA8UMZqiXqSHa0PjLdtn2PgIYXQhiNzXBm2I/Tk1M5WgRafx9lLm5kS7JK+XGB8ye9l8 atKhAwhxb+2OTr5O8W2xjwbqUHX3XmAdT2twd+evQFzGuhGtqqTHiI/s0Mfv67SAj4xO FLTfN+srdsSqn4vw6Xs6PZEcjXRUqMX5/TXkcHKrAaR4vNrAkyWui8dtl76tSIvDnmgw 7u+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737054897; x=1737659697; h=in-reply-to:content-transfer-encoding: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=OQt/5kPLKfcR/r6Q+UjR/d/646J1fzUVQYSmfGNoAZM=; b=CUcvRVj8n7WciuFfhJ8gU6FBCXeed+Pu/1ok4itNMPkqkrtrMqTg6/DUXLxb+c02k2 5qmVtaCs+Id7ZvYtNcSEZYe8melaI/O1KhQkDXxJ1QDQzmVP+1s9JHDf6MhuSVxKorxH EuPS1k8INjB5YU+IBEzVfFoyILpuMkWLh9W+cDK1RgedajbGeq3AZLhsdnHvvjL6buAs nCrrrkExgQBn0w7FbTeRiNrbmoO6UWNYUGvs/+ReHqX8hHx2a//Vc9ouc0/gB98BiYY2 qw4+jw4ZNIMc3DeQ36HpUE+zmBQPdUATlIhMf+p+Sx9MqS6+l6Ew14fGIliHOwrTSpeT V7iQ== X-Forwarded-Encrypted: i=1; AJvYcCW1EEwjJJgWCj8pFTdEQSoYfOeYlBWUUBHjvY+QMAwuyfniGE56ZoVVHFtUez4egl64LDvfGZJI0AIkvlI=@vger.kernel.org X-Gm-Message-State: AOJu0YxNGidjBYIvnzzGymkzJ4rDn4pToBm1f7qgnBl+N9cH0waShum0 fJefG5VaZSRBImCIUGflqgGSftUUaA8LSX9ruRX4MuANwQ/wt4ze1Re+ldOujEQ= X-Gm-Gg: ASbGncs0U2I4BA5AN1oN4WA1jQjEZyu22revEVHNIEZKkB8b8bRDvPSqndsti43UvJS 59V/Rdjqkub1RXYxqdC93PvfeW++pPIYYClBcqufP2Hjob/z//I9CxLIiIhOo9WIfltSg+fcUTM wRABmsR03pbQM/LTAZxckNxD+gT0D95doBZgnyIddyfaabJzICu+aada0qvNJU0lRlQVcwA1WKp AYCKvIHK6f+2VHcQ00YuWjHBmsx1JrqZOJEugJwtb3bKlxxxMbHt/3uxwgWQitxWowExrCUROBa gzL2A8kUfxFPWlWNFl817YbX+VEgyw== X-Google-Smtp-Source: AGHT+IEKLQFb6+AOsWzFxspuNmlLzUNEaMEFSc/MnRiIlEENEcAmYeVJMdkM047M2a18YZcxnlS9VA== X-Received: by 2002:a05:6214:19c8:b0:6df:97a3:5e5a with SMTP id 6a1803df08f44-6df9b255d62mr623412166d6.28.1737054896839; Thu, 16 Jan 2025 11:14:56 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-68-128-5.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.128.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46e1030e8dbsm2636371cf.44.2025.01.16.11.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 11:14:55 -0800 (PST) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1tYVKR-00000002xdV-1jHj; Thu, 16 Jan 2025 15:14:55 -0400 Date: Thu, 16 Jan 2025 15:14:55 -0400 From: Jason Gunthorpe To: "Tian, Kevin" Cc: Mostafa Saleh , "iommu@lists.linux.dev" , "kvmarm@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "catalin.marinas@arm.com" , "will@kernel.org" , "maz@kernel.org" , "oliver.upton@linux.dev" , "joey.gouly@arm.com" , "suzuki.poulose@arm.com" , "yuzenghui@huawei.com" , "robdclark@gmail.com" , "joro@8bytes.org" , "robin.murphy@arm.com" , "jean-philippe@linaro.org" , "nicolinc@nvidia.com" , "vdonnefort@google.com" , "qperret@google.com" , "tabba@google.com" , "danielmentz@google.com" , "tzukui@google.com" Subject: Re: [RFC PATCH v2 00/58] KVM: Arm SMMUv3 driver for pKVM Message-ID: <20250116191455.GC674319@ziepe.ca> References: <20241212180423.1578358-1-smostafa@google.com> <20241212194119.GA4679@ziepe.ca> <20250102201614.GA26854@ziepe.ca> 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: On Thu, Jan 16, 2025 at 06:39:31AM +0000, Tian, Kevin wrote: > > From: Mostafa Saleh > > Sent: Wednesday, January 8, 2025 8:10 PM > > > > On Thu, Jan 02, 2025 at 04:16:14PM -0400, Jason Gunthorpe wrote: > > > On Fri, Dec 13, 2024 at 07:39:04PM +0000, Mostafa Saleh wrote: > > > > Yeah, SVA is tricky, I guess for that we would have to use nesting, > > > > but tbh, I don’t think it’s a deal breaker for now. > > > > > > Again, it depends what your actual use case for translation is inside > > > the host/guest environments. It would be good to clearly spell this out.. > > > There are few drivers that directly manpulate the iommu_domains of a > > > device. a few gpus, ath1x wireless, some tegra stuff, "venus". Which > > > of those are you targetting? > > > > > > > Not sure I understand this point about manipulating domains. > > AFAIK, SVA is not that common, including mobile spaces but I can be wrong, > > that’s why it’s not a priority here. > > Nested translation is required beyond SVA. A scenario which requires > a vIOMMU and multiple device domains within the guest would like to > embrace nesting. Especially for ARM vSMMU nesting is a must. Right, if you need an iommu domain in the guest there are only three mainstream ways to get this in Linux: 1) Use the DMA API and have the iommu group be translating. This is optional in that the DMA API usually supports identity as an option. 2) A driver directly calls iommu_paging_domain_alloc() and manually attaches it to some device, and does not use the DMA API. My list above of ath1x/etc are examples doing this 3) Use VFIO My remark to Mostafa is to be specific, which of the above do you want to do in your mobile guest (and what driver exactly if #2) and why. This will help inform what the performance profile looks like and guide if nesting/para virt is appropriate. > But I'm not sure that I got Jason's point about " there is no way to get > SVA support with para-virtualization." virtio-iommu is a para-virtualized > model and SVA support is in its plan. The main requirement is to pass > the base pointer of the guest CPU page table to backend and PRI faults/ > responses back forth. That's nesting, you have a full page table under the control of the guest, and the guest needs to have a level of HW-specific knowledge. It is just an alternative to using the native nesting vIOMMU. What I mean by "para-virtualization" is the guest does map/unmap calls to the hypervisor and has no page tbale. Jason