From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) (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 28B9F384248 for ; Sat, 9 May 2026 23:21:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778368920; cv=none; b=B3zFTDBhAx1kI367pUD718B42qRyqV20lFmC0i8V73QiCAA/u0yzB70YkJ60iRirO8TOhSLLbBIh5lkZUOOvyD/UOUUfbVKbuegD546Bw2W564Incjv4m55rURD1kLMEXTSFSiyFe6e0Rh1er+CQ178MIHEcIUfs5CwlysTH+qo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778368920; c=relaxed/simple; bh=7jPMvL2ceRZm3p/Zo0nDr4G1J8k+ih3rnehwKSYIxvQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GGKYDHXBbSkbCqYDG3iU0uUqE436EZIYZjNpdUBpTPnRs1NZ6rlwePpYElMvsNb/Se/GozTuxVg7thjFN7esCo1aJtvR26zgHzfVy4wZzruyfv4//bDKzOjefn6ZihVtgBuHeJPVeVRGCMq37firknn0wMs3yrbwwvOuqaMuNWE= 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=Q38QoGF9; arc=none smtp.client-ip=209.85.219.49 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="Q38QoGF9" Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-8b4298d271fso54634896d6.3 for ; Sat, 09 May 2026 16:21:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1778368917; x=1778973717; darn=lists.linux.dev; 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=335DhOmKigacyWrLMRbFPigANHuPSLtNVBCr6CAA1o8=; b=Q38QoGF9pdldyvEwDSTlX735P0BUssM7b/IWB3fH09Cu8JrNAjwxeR4T70vDxRbqtM ynGDkXYl/hql7ondx0MdfUowpCQ2hki0P2TxKA/G/HPmn15qN94/QkedMYje0bskQljk 0yRk0l9A+f1kphY5hRZlYAGH9s6vpPJlVyvq0EPV46rqTpoKqIlCCrsH2SVWccnbvQpq AI0Cbvq1tNHdGAxSaVdat4iqxYyNw0VjPp7Ycg9L3BjaX83MSmb8HS/eIzXY4aPN+Hpj xeMINhLguhfgAkg2fes/JqQYX5sGOh1xu6rcyzk8tGM6EKiD3SZ1W7Dm62FvIKj2XEIZ 6s4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778368917; x=1778973717; 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=335DhOmKigacyWrLMRbFPigANHuPSLtNVBCr6CAA1o8=; b=KLOp9U+tbaD+r7PXYm2tG9oKKYWS5MzthS1JugKCpIPl6ABFwEZaosUBRfeGYgA1Ra Ga+lUQCyQ1+oocT1bqCrRP+tAD7MhokDRz6798skXovvkDzTYAlmdQKzU1NUIndby1So yj6yKeURAxFnpbVwp/+K4Mw5qFYJbofQZQ8mcjaLJVW4Gf8+A4gab5+JzkwjVvNzBe4Z KbxYmOJ4oh7qqzkCZ+xx9teZG0q87tnKYBxMLcmo9dKwU/BervsrQGhRCPNrmP8ydvNQ QCOMWA4GEDv9VmZFeBzmkLLV2znpYtuR5HU9k+QZlHS+zZpShsBsdDbqzC4MQM3tnkK9 vXWg== X-Forwarded-Encrypted: i=1; AFNElJ9tt8QxzLRU9OvnydDXy8+TFfGr7rEzoWbQjr1jHf+hmtmSop/bt1sTWYGrhVlBrmPzQ0+1yQ==@lists.linux.dev X-Gm-Message-State: AOJu0Yzov2DAivRfmpAx+s1YeCNtebkpPAOgY2pGIzpgCFAwfQGM58up iqpe43gUF1c7W3EYA89I6yy+nVtaqzeRI50QsU2MQlxzGjvThxvJsbAF0HT6X4/4SYo= X-Gm-Gg: Acq92OFxSPs9Yl/qvsfQOC2Edo2XjDSB2sOTJEyiUyXRgiu+couiR0LIzKKReIzvRNz VHWzklpf+/a+iXMpFMoZGO1SpLm8WMgTgVsUC56ClwYzHZ8UPB5tXqy3gCU2SOWWQSBP2mr1Y0h Zikc/oH8G2NtAxS/8VsTkwvHak9UQY4CL0fTg6VhQvAZL97Mliu2qajLEvze4YdJBPxrxB7KIPc FEhy8/XRyntTzh8xfW/iji3++zevFjVnKjVsOe/tEy036cvKufNUdSGrCWraWxNiLzneH3heS/5 F/dIC1d3ekhjsWz7KLtadEoudRtySZUkWkPdtSLy3zXark5VTOwjTNPXQKAuFdQERpy7aNVwFPo 1m5QYvEJ6nW3o/CZVkKGy0uVyq/MrOozaTnVADh934lhSg54w1+m9lar+JUs5hR8hOSiHm+N7HJ ka/cN5AOKyv/5LgY0v7TQbRn2fBKjPKh1pCIFezhYXM8CkomVhOAbrNhWbaLlsGSfDlEdprWtNY 1b0uvfAi+kgc5XU X-Received: by 2002:a05:6214:258c:b0:8a4:c1ef:d727 with SMTP id 6a1803df08f44-8bc422a6815mr269722106d6.10.1778368916771; Sat, 09 May 2026 16:21:56 -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 6a1803df08f44-8bf3b0c84d4sm54348816d6.0.2026.05.09.16.21.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 May 2026 16:21:56 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wLqzb-00000002N2n-20cg; Sat, 09 May 2026 20:21:55 -0300 Date: Sat, 9 May 2026 20:21:55 -0300 From: Jason Gunthorpe To: Mostafa Saleh 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: <20260509232155.GH9285@ziepe.ca> References: <20260501111928.259252-1-smostafa@google.com> <20260501111928.259252-7-smostafa@google.com> <20260501122424.GA6912@ziepe.ca> Precedence: bulk X-Mailing-List: iommu@lists.linux.dev 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 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.. Jason