From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 53EAA3C060C for ; Thu, 7 May 2026 09:40:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778146809; cv=none; b=fneuW5DLGDuNPHTHVv72I98omuEHcSgoHstxXoHSlietLdEvFlCfU25246NEuOUxaCSFiR81L6HDlxH+d3hEsHoZrBjKz2DgxxeuNccjAlQL+b6ufrA271Ov8CVXQuNOPFAqyDi6j13jQJ5PuME9ZDt1/h+uzkLX8aqsBYdYhMg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778146809; c=relaxed/simple; bh=//T+uUZKVsScMqNPuY2uDzqT14OVSZxoXfFh1I1LXYk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aASgg5X9dNKCNknwAQiHbxEiUwv41sEq0oiSlQsJHQ4ymZgTHqsZtparO2mxh4FDEGHxP1d7jFqrMRME/vGWc7SolOokd/GctmnIcnjAegyd7CouKyP1xOX82hngiSqy87C0hiM5MD0WX/JkZuK6QXDrOlb7CvFzPed3lNI039Q= 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=kHkT7d4x; arc=none smtp.client-ip=209.85.128.47 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="kHkT7d4x" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-488940ccfa6so66175e9.1 for ; Thu, 07 May 2026 02:40:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1778146807; x=1778751607; 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=iO2qxGV2Dz72sotDpa6WZEWx9OFKl0tlRmAkWtejDhY=; b=kHkT7d4xDTJUpQLf3NXNwbFB66yrHWzpmM2EAA7f3JGzhXMV9W3DoVXu2Z3wuZwgsB Npx+YO9NUBZReq1z5XkSm3QZF8AINcSIoTveKEFSKpCQ4hxZiWcUZkeedKDc38CAmpWX kgCkw15cvKCiC6jeMbzy0k8d9xB9usJ3PZBLlG9iA0Ik71YKaujrQcYIY5VaPAl3aXeA 6YvyQWCFzOc4eOMXJAY/GZzNoHSM0xGJoOLGwY2GQM6NH4yxu49P77Hpe2ZoVB0OrP4i i1m7bHaorFYEm8QL+LNaeYzbyYM1U9htLMR2pZaCd2/Iv1zTdVQAfLYzng9uSCzM6WR+ LHWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778146807; x=1778751607; 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=iO2qxGV2Dz72sotDpa6WZEWx9OFKl0tlRmAkWtejDhY=; b=UWu2ONGAy5bbS2AR0Rzmp4zVqEhmUS/I9AUBrkkM4gA51KWyMQe16aSRexZrX54PkT Mjn+UHLuxP8vlVoNzIVC+GcDgE+M1I1jQSeDMIVg+g0Tjg/QJr9AeIAZI95tpWaj/V40 Sja+ufyhdkObBpCp+KKSKQk8Y34x6HjDpRBubmofuhxafdHGyM/1iZ3IRfyABvYiCPeF lYaL/7CCbD/B7OeVkW3QCd0TqPcuUcwYheyB3W3NhtZqKNZe1hvjQt/p2gzI8a4D9xTS SU3JBkjQffMiEcaMPGL9VQ//z7oK6ERwiqI/IDkA6JCk8iObsvIuNrZLj+qVuL+IS09k wcwg== X-Forwarded-Encrypted: i=1; AFNElJ+bmup0xSI7qfzqKKHtsevEVd3Mbfnyy9aQujnWaNUaD9taQbPrXo9f7NZ/IMmQdGenmmUcAokIvoQQWcY=@vger.kernel.org X-Gm-Message-State: AOJu0YyCRxDd3AfP+JMqf+zalpSJU8s8wcUVsANQqjASlW9sM7/w/zTh EqqKXQI5+/m/nQA7X5U+c2Yz4jUbdlcNljVmNNjhI3ApxkzMC0pNCrRLOymANIHBDA== X-Gm-Gg: AeBDiesj1RSgzdpLh49rBGCfSWz0YQDQ1tVTA8xHVe+Khdb8cYwFre18EYj9kiLlcjz 6sYyE5lyMUaq4PaBzlzBZ4UYd13cv3LHccRuO7JcqAKbqfnZSftQjL1Cnbyl6qIiVxDgJpf/AxU vPGCIkSMHCgNk41blszu1iphxR3n1NOeykACto/b8TVuHdlEA0SGYhNhqx+FEy8B0Mn1kXvBJ0m s9aSKbU4ZJJSS4O90zaNqHZm+3zhS573dJJEfVPUUUNjWrZ0cFRa7XyThpKJ1vxM5G19M5tGW3M 2gb8vvpQIIs1W/zJZDqrCwnX7m8mTtr5yO+lrDf57MSM//cFsdxketkeDL048NZ+E/Nnuo7VxSd xhIAZsnmKx8jos+dmX4hEYK7vYr1Vd9O/aERNLQnPL0ggbNMKv0J7FqfOCLNavDFrVtQ0B02P48 TwsBBMU2t4dAEmM4gL5nvcXQ33SToEiz5DDvIsxem2CYbgIHqIvjA3FtRXugXbBP2COqqdTarEj vzBRQ== X-Received: by 2002:a7b:c314:0:b0:48a:5f32:62d0 with SMTP id 5b1f17b1804b1-48e5d650751mr703025e9.12.1778146806189; Thu, 07 May 2026 02:40:06 -0700 (PDT) Received: from google.com (8.181.38.34.bc.googleusercontent.com. [34.38.181.8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e531578c8sm38996315e9.34.2026.05.07.02.40.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2026 02:40:05 -0700 (PDT) Date: Thu, 7 May 2026 09:40:00 +0000 From: Mostafa Saleh To: Jason Gunthorpe Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, iommu@lists.linux.dev, 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, joro@8bytes.org, jean-philippe@linaro.org, mark.rutland@arm.com, qperret@google.com, tabba@google.com, vdonnefort@google.com, sebastianene@google.com, keirf@google.com Subject: Re: [PATCH v6 04/25] iommu/arm-smmu-v3: Move TLB range invalidation into common code Message-ID: References: <20260501111928.259252-1-smostafa@google.com> <20260501111928.259252-5-smostafa@google.com> <20260501124143.GB6912@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 Wed, May 06, 2026 at 06:53:00AM -0300, Jason Gunthorpe wrote: > On Tue, May 05, 2026 at 04:43:13PM +0000, Mostafa Saleh wrote: > > On Tue, May 05, 2026 at 01:17:09PM -0300, Jason Gunthorpe wrote: > > > On Mon, May 04, 2026 at 12:15:17PM +0000, Mostafa Saleh wrote: > > > > > > > I am not sure if it’s worth it, the hypervisor is much simpler, there > > > > is a single page table, it’s locked (also identity mapped), it’s > > > > updated on VM boot/teardown only, we don’t even use iotlb_gather at > > > > the moment, although possible but I wanted to keep this series as > > > > simple as I can then we can add more features later. > > > > So this patch is the least intrusive change, as whatever the main SMMUv3 > > > > driver does, the range tlb invalidation logic is the same. > > > > But I am happy to experiment with that when posted. > > > > > > Okay, then maybe just always push a full invalidation? > > > > Like full address space invalidation? that will not be optimal and > > will affect every device on the system, why would we do that if we > > know the address? > > Not every device, just wipe the VMID. If you say it is rare then keep > it simple. If you need to be narrow then use the proper infastructure > with a gather. No reason to make something boutique for pkvm here. But all devices share the same VMID, which impacts all devices on the system, and is not that rare to ignore. I can add gather support, it’s not that complicated, it is currently supported in Android. But that doesn’t solve the problem, which is: At some point, whether eagerly from the page table code, through gather sync or a fancy invalidation array, the driver will need to populate a range invalidation command (tg, ttl, scale...) and this logic is better shared with the main driver which is this patch does. Thanks, Mostafa > > Jason