From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) (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 28B0E32D0D8 for ; Sat, 9 May 2026 23:21:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778368920; cv=none; b=eHV9bC49eIBM21JpEyyfsENyIsF8eptACRbHUDK2WBdN8S7UMpgQLct7DhoyXwvof1VX44jSytTA0/kOetdf4F5QuRPgRHf6cjqmOiL6bWgZpgwWJc23efXvQivsMDsI3auUfH4vrizwbqNOoV6/vjGaLMbqvN4gS2EEvX3QU7w= 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=cglwuhZt; arc=none smtp.client-ip=209.85.219.48 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="cglwuhZt" Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-8b98482b253so43785496d6.1 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=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=335DhOmKigacyWrLMRbFPigANHuPSLtNVBCr6CAA1o8=; b=cglwuhZtpd42cqtgzRxL2+XxoTthQevrfji2BiQnE9ZPbe6Qdgq8hkrN8MT32dYq7N Qa0wB6zHdmg6qzwxxTseSp/HvOY1zBC6k3f/O89H2CImLcbftvRFSNWouYs5kIxVnErF Ks+DeRVY+7t4uPbR0qB1SX1FeTFxd+pCJMDfOFv0qHa2W7meARpVDU1RH9crN1KN7DJo TqwDhk5MbR0Xh5xvYaBiqYXfPSQMDyXaJbSmxgLx4AGivKbB7ihPAl+/ulw77c+OPfhI 1WOnnRVXxhcJzQKyShNBRFeGuq9DJuF9INm37q4T48oX9Lp+SypoQb0aPv/Orzhpxa2R tXgg== 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=G5pAzVbCFUfSHP/MpECr6YiPgyclF9q5RZspYlZgTGwtyyMjPdvsoU7eWZV8xQ/tgL 1mmU1ZIkCh6ERqVwVJDiHiefcjWmMds0KvjairFTjt+SW0v6RlLKtE7RkjzhGoMfIPEj Siqbx5J5KbaMtrZiFJ/n7V4/0JNucSe1HLhyTO/Gr3cji8HzUJSwTaBEvwtx+lIfIxYM Dhb1QxtDahR95T+LjGAcUjHYq+8esVOAJRBFyStjnp0CihKMiny+aJpkCaDWusbBl9V9 4/MSHcpmoG1bw8FzCW9hJ8bUI+tkcXcioLtqPqv376AcRw7GxxENxmi8NuPVz1qzyRtu hvMQ== X-Forwarded-Encrypted: i=1; AFNElJ9nCWUrGxDqHQEG6L5CnFzq8fSorbHZw73m1+iAhrZ6nCOq5XJ1Sd37ByNki5FiAZolxGE2nAxc6jJKvUo=@vger.kernel.org X-Gm-Message-State: AOJu0YzCbpP6sn74IvM+u8/QIkFoZLbxK3VYqVndTSmu8B0OWLYWH1rD rmdXTWQKCAmwjdlabxN1EjTwxG6Tw4z92iIyOrJqWIzrm5Bj8WrZbH+3gFqvDPZ/Te0= X-Gm-Gg: Acq92OFdHdg3ubZUX2IlBgsUatkig3sdqt84JxSr2gtLONuZAssEdGn8/vGgsuqRIiH 397N9AUa/igbgHeo+WqRuV/Qh8Tqf0RJzNGmMCxFUr21mHUecDGPLkr8UwArAYW8kpinwTl252W e2JAyX5Q8jAX+6HZOWCLIINVJGWQcOBs0uQZjTmKTGPfSLfLXwfGj5ToYdhUD3myZpYqI8llxaD DbJH5bc0ejJwoe87P0UBzYe3aQ8ykWj6MopsHB+3Yov0mSQjNtSr3a0EkYNoYFUquXQZztb7bLT f+4LbzPcdfmI1o3nQSe1lb5hYAUg1OSqJlxXWzyLc0weyyiEUSruaP6PVYQNCXBVLQxeZ7i014X i0cTygR/NZb0ApQ1br9/ncukZmqlVXgFv8WeWJlpcR2KKHVytszmn7Z5/pu3DCFA7D9fXeg6A3K djgRrdT0zQGp6JHiqOLrShKfgeJEU2WgUfHhjTLjxiaM89ycsJQKDiwonumwJXOLlGCDz8CfmdT LvUhuhxaRPbNNNf 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: 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 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