Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2275413rwd; Fri, 19 May 2023 03:35:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5wAZwhdhthsdE3L/RO+2JcrdgVedm5uPjFyRaLkDntwwNd/WQNHrdffGGGiGvXbPodokq7 X-Received: by 2002:a17:902:e808:b0:1ac:8ad0:1703 with SMTP id u8-20020a170902e80800b001ac8ad01703mr2381780plg.35.1684492524271; Fri, 19 May 2023 03:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684492524; cv=none; d=google.com; s=arc-20160816; b=q2savY9oDkkjBiv8Q4fkRfhdX/5bbpZND0YcA1gDWKIoavjzhVfi0LVv4OhaGHrPrY zXSHJ1gpryVP/wgXVdDxhvrcaQr9XYhOLJZZwsFDuFsefcL1/8urj2HmKdFK/tPsWHrm JJJDng/+xUQ58J2mQF/1M1GSMdygjwo5JMOjwZBnIpr7iMxtFmeyRx4kEP1f5HQLuiG5 gKIlO4PxlK4vEy+Utue5Zjk3vXRbPisssLAbrAkDlWN4mbBcHdD1TF1ECDc00xktKfWR mNS2lRpR3+gJqR53rBOcehj0YKldK8WXQr3Q8QLJ7bsCPD6iGhq/ie1fBsBTOseDFliY otLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature:dkim-signature; bh=eusJfDMu4BSNTI2WSPt51cso8c3WEiCMloVC5l7E91A=; b=0yZN1BWajG7UAeKrt/Q3wUqb8ZTJE1vTqcQe/ccTEwzKXMyTW7tWqpFN8768z2nmpu 8THbZY8vTiQ6resC/NOZeW2Oiu/86G28v1n8iyIrEe5VzWn/++NEwn6TuC/grWPWl5qD wYEf6B/dyQisAJAN5ykQT41dkUfmFOtGCcRqzvdn6eCjd8cSOnW0TMzgvgN5gFObczL3 GWbxyVjS5v2uQ+KZa2le6g2U0wysKNLFEtQK3IyuL40UaNJPXwTX5+4ikoA4w+KcVhTR 8b/6vwcb0/lvmmwJLGBl/w4x6sogLD+5Tr3i3+OQeCijGFVu4EI2ytn3OrPmASZDq73n d6dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm2 header.b=blCqjsuO; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=dXyFgQH7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w9-20020a1709027b8900b001a2445dd0fasi3275543pll.381.2023.05.19.03.35.09; Fri, 19 May 2023 03:35:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm2 header.b=blCqjsuO; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=dXyFgQH7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231796AbjESKQx (ORCPT + 99 others); Fri, 19 May 2023 06:16:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231642AbjESKQs (ORCPT ); Fri, 19 May 2023 06:16:48 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A7881AD; Fri, 19 May 2023 03:16:46 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id EB00B5C018B; Fri, 19 May 2023 06:16:45 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 19 May 2023 06:16:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1684491405; x= 1684577805; bh=eusJfDMu4BSNTI2WSPt51cso8c3WEiCMloVC5l7E91A=; b=b lCqjsuOikslXbda5V6akg2UopLQgrMQlrMPxyvtjHo/yJUKUYsSrWvC17uuKr4vM O3Dv3fChZ0sWQT9o+pbsyKJ3oF0P8ce1LmE7hNzWgNvVHUD7m+qKqpW9b0Imw1Mo 88O454JJockUe2btHxFt99nIq3+F+eEfjeZciytpwoQhJLAVLBKvGCGFJNPVFgMQ HlxETu/Lumab7SYt93kWpZl2866CP9QND6VTMTK7Awv7LPawzIsV53d2kkASQlDX oSMEWGKm2uXhWPj4LjqqQ5cZ7a3VdzP3vpxAnrZqJ0cFQWRcyL69/8YB8JAmenk1 IrTT22X/qH2pzPy4QFwYg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1684491405; x=1684577805; bh=eusJfDMu4BSNT I2WSPt51cso8c3WEiCMloVC5l7E91A=; b=dXyFgQH7P6eiAYgSleRv/Gjqb280F ThmzxeXcsEdqsawOM/bakg1QLciiKGf86X0jkUAbdXki8U2advF5sTZKIilcju67 Oz0a4RkZ53yo8PRTDo9WfF8gEMuifyzzXRF3+qR1nhsdbtzwcDGuvhnof1nWAC9e w9T3mDF5ynVfAQf3bFdZfb+wusOfpyS4xdqSm3SHpqCkbnWNIn05qSrdfe/+gW+U h6pglTLWaR2rKFF9aEznZ0tseJSOR+otfGzLZTSdH535OpcEbLR4PogR0kMPWiX2 GiNV0jvqiazvZs01yOVjM03jQ4HHnsapOH+01jwn/uTa/ZFYiw4ySkGQg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeihedgvdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdttddttddtvdenucfhrhhomhepfdfmihhr ihhllhcutedrucfuhhhuthgvmhhovhdfuceokhhirhhilhhlsehshhhuthgvmhhovhdrnh grmhgvqeenucggtffrrghtthgvrhhnpefhieeghfdtfeehtdeftdehgfehuddtvdeuheet tddtheejueekjeegueeivdektdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehkihhrihhllhesshhhuhhtvghmohhvrdhnrghmvg X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 19 May 2023 06:16:44 -0400 (EDT) Received: by box.shutemov.name (Postfix, from userid 1000) id 4DA4210DFD2; Fri, 19 May 2023 13:16:41 +0300 (+03) Date: Fri, 19 May 2023 13:16:41 +0300 From: "Kirill A. Shutemov" To: "Kirill A. Shutemov" Cc: Borislav Petkov , Andy Lutomirski , Dave Hansen , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel , Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Dario Faggioli , Mike Rapoport , David Hildenbrand , Mel Gorman , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, aarcange@redhat.com, peterx@redhat.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Liam Merwick Subject: Re: [PATCHv12 4/9] x86/boot/compressed: Handle unaccepted memory Message-ID: <20230519101641.nka7ty3fttntymci@box.shutemov.name> References: <20230518231434.26080-1-kirill.shutemov@linux.intel.com> <20230518231434.26080-5-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230518231434.26080-5-kirill.shutemov@linux.intel.com> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 19, 2023 at 02:14:29AM +0300, Kirill A. Shutemov wrote: > diff --git a/arch/x86/boot/compressed/mem.c b/arch/x86/boot/compressed/mem.c > index 67594fcb11d9..87372b96d613 100644 > --- a/arch/x86/boot/compressed/mem.c > +++ b/arch/x86/boot/compressed/mem.c > @@ -1,9 +1,32 @@ > // SPDX-License-Identifier: GPL-2.0-only > > #include "error.h" > +#include "misc.h" > > void arch_accept_memory(phys_addr_t start, phys_addr_t end) > { > /* Platform-specific memory-acceptance call goes here */ > error("Cannot accept memory"); > } > + > +void init_unaccepted_memory(void) > +{ > + guid_t guid = LINUX_EFI_UNACCEPTED_MEM_TABLE_GUID; > + struct efi_unaccepted_memory *unaccepted_table; > + unsigned long cfg_table_pa; > + unsigned int cfg_table_len; > + int ret; > + > + ret = efi_get_conf_table(boot_params, &cfg_table_pa, &cfg_table_len); > + if (ret) > + error("EFI config table not found."); > + > + unaccepted_table = (void *)efi_find_vendor_table(boot_params, > + cfg_table_pa, > + cfg_table_len, > + guid); > + if (unaccepted_table->version != 1) > + error("Unknown version of unaccepted memory table\n"); > + > + set_unaccepted_table(unaccepted_table); > +} 0-day reported boot failure outdise TDX guest with CONFIG_INTEL_TDX_GUEST=y. The fixup: diff --git a/arch/x86/boot/compressed/mem.c b/arch/x86/boot/compressed/mem.c index 0108c97399a5..8df3d988ae69 100644 --- a/arch/x86/boot/compressed/mem.c +++ b/arch/x86/boot/compressed/mem.c @@ -56,6 +56,9 @@ void init_unaccepted_memory(void) cfg_table_pa, cfg_table_len, guid); + if (!unaccepted_table) + return; + if (unaccepted_table->version != 1) error("Unknown version of unaccepted memory table\n"); -- Kiryl Shutsemau / Kirill A. Shutemov