From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 1742F36D9EB for ; Mon, 11 May 2026 11:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778498214; cv=none; b=sIvPDh3MV9tEfcLifC7ZpPNgUJ7zVfdc5G7XDLN44ISzZBBRoDY9sesNJ78kdBEjXr9MQHH+ijJ+4KnWj13Nb5fVRJPjSXMf3Z1MWo5Wuf6AtTQBVcD7ru6nOSzPFuXLvW6N88xmww3/xtem9L7yReJ4dfEEtuQNZ2wEAWSYFYI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778498214; c=relaxed/simple; bh=aWrmuPCEUpNW6pyyMCyT3Ev0vO66QbU8APlpujnwPUQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PyECEdV57cPn2UjqgBlvdr8EcRccQtUY0LrfgFzxTvps410IWEC9OKSSP8fT9vy7RLeaQThnenfLVcZ/tF562M6Es3VBC9XpitgepmrCgCIlAZuYyype7XhS6ByTKHJmAwIB/iGZkdp5IUgfYGlufvEkuF0hhFQiSpXKslarqxo= 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=h7FywPvo; arc=none smtp.client-ip=209.85.128.52 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="h7FywPvo" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-488940ccfa6so275e9.1 for ; Mon, 11 May 2026 04:16:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1778498211; x=1779103011; 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=mjFxAsYJ767LfglQAiic8pmf/v4fVUq2j4oVrXIto5c=; b=h7FywPvoWW2hBNicIrIzhrr5q2aNbZttfzlVePCISraRqZQVsnRi5u+xlBj7JdH0jd 1jsIBD0fI+oS3OYlyhkxEz81MPPsjA/3pLiAtth2ic/CnfJGUGFiMI6OhVQYtPAx3srd 2m/sQP0PP3wvgNj/kNUY2ehrHzD+y81VTKLYIIqPo1vXnXO9twb+ipxGILLcnvoPXtr4 7EpHGnGoZRK3N6j7UkhrPZzADBqHvmbIVZXYpKVzmfLA7ZZluUwp0qGJBpCLofXQHG0g Gmc9eViEJn+I6X4PlY7pkXNYXhQLP3FLfqSaTPRHk64htKav78Pi9YM7MwEZ+ScJiA3h Avfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778498211; x=1779103011; 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=mjFxAsYJ767LfglQAiic8pmf/v4fVUq2j4oVrXIto5c=; b=FwK+p4fWyIfiOYpFeslVmobCDuEhybXaOBeAOD928gTinFg4yHtiOcyQdS3nDfHrda rWD7XEDju1HZJoasEEJRGoWxUuikzCvERySCq/m6+kYuA4VIHAKYbD0QYUmr1jWVueY6 5c/fRVjFhM+FMENFMsQzzaCO98x2ni1Tu9KHzwBkQuUDWvrTFc0i2kAd4J0WxHhLDijO CfAKLENGH+x5vzzJK5NkYnvVvWRuR9uruSowsFW/z82i59/IWClyNsmGIrL1wWQCM/u+ HszUuf0rOAi0Fz2M8De3UgqXuvaB2fn+s144PrHx9q9M/A8BPHi4SYM5VlGfkvu9BrET +rcg== X-Forwarded-Encrypted: i=1; AFNElJ/aMLacmwOWuurBqMyc0rdOMyxAX3zk4AB+BbAsCWkygC+gBFxjz56Fg1CmbnZTfDrEpG0blTPYxoK4hlI=@vger.kernel.org X-Gm-Message-State: AOJu0YwSiDVgx97PCFQ4vlG8M8sLwchjXwBsEcAiTeAUKANnI0o8crUb 89+OF5WceidVmNr3YyPadtI8f2r0JdBZMRejxF6yBTLerWN5GwMD/ohqFD6GTEM+oA== X-Gm-Gg: Acq92OFLl99F9mdC7MuV7Mfpg5eE0zYHEMoC2B/+ggjIcrkTJDN9ISf73k/KwkXTZ// srcMiCf4q60/zYcQcldgBRZrindyt7Pfuk/URRV5Dc2i0EP10MzFnFpDf4rRK77OTK/rFD+u1q1 6Xpg8hIgfbMzDpRRSAPV74ywfk+u3Uv94+OOXTHBnrp6wYgUPxV4W4TCgAjjXtcJGwrmLEN5X0t dDcQyw/QJKoqSxbKYI5Towp/HakCPwKH8Cfi0JmF/JkS5dkxA7bp3AV5uDewW0oTvmbZAToBcPw QzH82Yc/dE5UAfTQIGzSHtJarwCUttFHooFBCrQIRgXk+xI6QTCsZ/MXrZ0vv8dPXJN5b6U7jl2 cvLzTBRZlYCs7ngfrZn3i8lMkJt55we095DEe7vB6AkqfpuDV8iK1HJjmyVsqu3T/+AaNyv7A2w y2JRaeo5mXXbKCoup4CdKuPTnDE3tfbkr/XcdSea24MeX8Rx3cHbzptaaMh0WUHW5TrqE= X-Received: by 2002:a05:600c:c3db:10b0:48a:5d55:c194 with SMTP id 5b1f17b1804b1-48e6f507bc1mr1377065e9.7.1778498211122; Mon, 11 May 2026 04:16:51 -0700 (PDT) Received: from google.com (8.181.38.34.bc.googleusercontent.com. [34.38.181.8]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4548eb75c29sm24522316f8f.9.2026.05.11.04.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2026 04:16:50 -0700 (PDT) Date: Mon, 11 May 2026 11:16:47 +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 06/25] iommu/io-pgtable-arm: Rework to use the iommu-pages API Message-ID: References: <20260501111928.259252-1-smostafa@google.com> <20260501111928.259252-7-smostafa@google.com> <20260501122424.GA6912@ziepe.ca> <20260509232155.GH9285@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: <20260509232155.GH9285@ziepe.ca> On Sat, May 09, 2026 at 08:21:55PM -0300, Jason Gunthorpe wrote: > On Mon, May 04, 2026 at 12:19:37PM +0000, Mostafa Saleh wrote: > > > So.. I suggest you update it to use the iommu_pages API, #ifdef out > > > the allocator so the pkvm pkvm doesn't need to deal with it. Then > > > compile a special iommu-pages for the pkvm side presenting the same > > > API. > > > > I see, we still need to leave the DMA-API calls for the custom config, > > as I am not sure if it can use pages not backed by the vmemmap, I > > pushed that into a separate function so it’s easily compiled out. > > Yeah.. > > > Without this patch, now it looks like: > > Seems reasonable, and then i'd probably just put something like > #define dma_map(...) > #define dma_umap(...) > > To effectively take it out of the pkvm build > > Then have a pkvm compile of iommu-pages to provide the functions in a > pkvm compatible way. I guess you can't actually fully do this, but > can do enough to support this file at least. > > > > You should have a pkvm shim header that provides > > > kmalloc/kfree/virt_to_phys in the normal way and just #include that in > > > io-pgtable when doing a pkvm build instead of hacking up all the code. > > > > Ok, I can do that in another change, but I believe it's better to > > change the usage in this file to arm_lpae_*(virt_to_phys...) so it's > > clear which parts are intended for that. > > IDK, why? virt_to_phys() is part of the iommu-pages API, I'd just > leave it.. If you want to narrow it then #define it for pkvm when > compiling this file.. It is not going to be part of the iommu-pages API, I meant in io-pgtable-arm, we will use something arm_lpae_virt_to_phys()... which is then implemented differently for pkvm. Thanks, Mostafa > > Jason