From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A56A9CA0ED3 for ; Mon, 2 Sep 2024 19:10:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bCYUHzswCDNCJAggSgVUdJ6tEue4FBMKroInnuWytWc=; b=4pDpTvHEEykioP0zebCb4h/pb4 iPPF8+DSpmFgvmsPa9WKF+MvSnrsUfWD5pDuvZJUiz69r8BN3TTYzB64TINx2mTDA9T/uB2VvhX+H 7vrrZv1oI1032ebPrxI7qi3P7Zux5B2TyZQP5enseUK9HpiQzFtZHWQYuqWfdFbcrqlKzTcTyj2cd 9MaaWage3v3Op4pt1j3YE90ObG/rTARli75gIARQm9w1lunpLv9+ILXbP94AwjmlGE/m9jihxTZio tX1cmyZlGOz3FdRcUOlU/ubYXUQViYKRCiSpadZcKuIYo2gW2Kl4r08gUDFNSRPfXp7fK924S5sak VRlRWWbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slCRH-0000000FN3u-33Cv; Mon, 02 Sep 2024 19:10:11 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slCPx-0000000FMap-2OG9 for linux-arm-kernel@lists.infradead.org; Mon, 02 Sep 2024 19:08:51 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 82A2A5C593D; Mon, 2 Sep 2024 19:08:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 224DFC4CEC2; Mon, 2 Sep 2024 19:08:46 +0000 (UTC) Date: Mon, 2 Sep 2024 20:08:45 +0100 From: Catalin Marinas To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, Sudeep Holla , Lorenzo Pieralisi , Suzuki Poulose , Steven Price , Oliver Upton , Marc Zyngier , linux-coco@lists.linux.dev Subject: Re: [PATCH v2 5/7] arm64: mm: Add confidential computing hook to ioremap_prot() Message-ID: References: <20240830130150.8568-1-will@kernel.org> <20240830130150.8568-6-will@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240830130150.8568-6-will@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240902_120849_719715_846AE67E X-CRM114-Status: GOOD ( 12.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Aug 30, 2024 at 02:01:48PM +0100, Will Deacon wrote: > @@ -16,7 +28,16 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size, > if (WARN_ON(pfn_is_map_memory(__phys_to_pfn(phys_addr)))) > return NULL; > > - return generic_ioremap_prot(phys_addr, size, __pgprot(prot)); > + /* > + * If a hook is registered (e.g. for confidential computing > + * purposes), call that now and barf if it fails. > + */ > + if (unlikely(ioremap_prot_hook) && > + WARN_ON(ioremap_prot_hook(phys_addr, size, &pgprot))) { > + return NULL; > + } > + > + return generic_ioremap_prot(phys_addr, size, pgprot); > } > EXPORT_SYMBOL(ioremap_prot); I mentioned on the CCA series, the patch is all good but we may need something similar for io_remap_pfn_range() which uses pgprot_decrypted() (I think it mostly matters for the pKVM case). -- Catalin