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 38A16CE7B0C for ; Fri, 6 Sep 2024 16:38:09 +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=K5icyrDiczvic4YVVTP1LVQTf7DuZx1H7MMJSeoohEU=; b=s16XM0dCmAQ2qdDT/ozdYg9VU5 sCQwF2bYk3FOnUQt8plBEmwEuOprUZJy00fiFM5c4SYqazs1cVQVx13X4fEdbegVEEw5tfSFPbazk awNUykTXN7JFHN5lvUtJDy+QtKy6YU8UywA29EC11l8kkyT5JKgEr3Qa0sGUCqI78xBjQFyiiKP89 fZwpBPO3gPbhtkxdWqo/s3QwstGMk1DRVOzAW2/O+hVLmt86lwNDM/vpdmONa8VgXB5prDcd3Af5w WWpiFc0FFFEJXlY9twSLGXz3GQMNy3cIn94WgayG+IV/Fd1uFgiK1UAaU5+FNQ82X4+i1omQhWTnZ MDmHoMRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smbyC-0000000D0BL-46uu; Fri, 06 Sep 2024 16:38:00 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smbwf-0000000CzwW-36V1 for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 16:36:26 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5A9655C5A2E; Fri, 6 Sep 2024 16:36:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 102BBC4CEC6; Fri, 6 Sep 2024 16:36:22 +0000 (UTC) Date: Fri, 6 Sep 2024 17:36:20 +0100 From: Catalin Marinas To: Steven Price Cc: Marc Zyngier , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Will Deacon , Suzuki K Poulose Subject: Re: [PATCH 1/2] irqchip/gic-v3-its: Share ITS tables with a non-trusted hypervisor Message-ID: References: <20240905091738.28544-1-steven.price@arm.com> <20240905091738.28544-2-steven.price@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240905091738.28544-2-steven.price@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_093625_850216_BC42717E X-CRM114-Status: GOOD ( 14.08 ) 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 Thu, Sep 05, 2024 at 10:17:37AM +0100, Steven Price wrote: > +static struct page *its_alloc_pages_node(int node, gfp_t gfp, > + unsigned int order) > +{ > + struct page *page; > + int ret = 0; > + > + page = alloc_pages_node(node, gfp, order); > + > + if (!page) > + return NULL; > + > + ret = set_memory_decrypted((unsigned long)page_address(page), > + 1 << order); > + if (WARN_ON(ret)) > + return NULL; I think we discussed this but forgot the details. If set_memory_decrypted() failed, I guess it's not safe to free the page back as we don't know the state it is in. It might be worth adding a comment if you respin for other reasons. > +static void *itt_alloc_pool(int node, int size) > +{ > + unsigned long addr; > + struct page *page; > + > + if (size >= PAGE_SIZE) { > + page = its_alloc_pages_node(node, > + GFP_KERNEL | __GFP_ZERO, > + get_order(size)); > + > + return page_address(page); > + } Since its_alloc_pages_node() can return NULL, we should check for this as page_address() would not be valid. Otherwise the patch looks fine: Reviewed-by: Catalin Marinas