From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web12.5603.1634275616562660774 for ; Thu, 14 Oct 2021 22:26:57 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=coRtWdgI; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634275615; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=x17hxpInh6f9YcnBzYN1Gupm3eYWD13EdtcSwQ6cmnM=; b=coRtWdgImZyH6V9TfAHozViI9+TtbOw5zAFnPvRUY0NHLChwnRp5FYxyd7fZjp+BAmV1q4 oN2xS8zC7ij7Azenqcx6f8m79snUDcLhNI2Tt8jZo4EgZox1qmPhvuF4f/O8lxKZy7BxYs wEs0kWNQUBJ+vm9NuOqSuC2MpSXGeok= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-377-UHntLyRAPtSbwVD_9UECFg-1; Fri, 15 Oct 2021 01:26:52 -0400 X-MC-Unique: UHntLyRAPtSbwVD_9UECFg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8930A1080865; Fri, 15 Oct 2021 05:26:50 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EB1375D740; Fri, 15 Oct 2021 05:26:49 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3F2D91800393; Fri, 15 Oct 2021 07:26:48 +0200 (CEST) Date: Fri, 15 Oct 2021 07:26:48 +0200 From: "Gerd Hoffmann" To: Brijesh Singh Cc: devel@edk2.groups.io, James Bottomley , Min Xu , Jiewen Yao , Tom Lendacky , Jordan Justen , Ard Biesheuvel , Erdem Aktas , Michael Roth Subject: Re: [PATCH v9 30/32] OvmfPkg/PlatformPei: mark cpuid and secrets memory reserved in EFI map Message-ID: <20211015052648.rcr55juuhoit4efh@sirius.home.kraxel.org> References: <20211013165713.727815-1-brijesh.singh@amd.com> <20211013165713.727815-31-brijesh.singh@amd.com> <20211014085851.e5xtspfcyz75lgog@sirius.home.kraxel.org> <6bb1abde-3795-1917-92b1-6659ac98846d@amd.com> MIME-Version: 1.0 In-Reply-To: <6bb1abde-3795-1917-92b1-6659ac98846d@amd.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Oct 14, 2021 at 05:11:22PM -0500, Brijesh Singh wrote: > > On 10/14/21 1:58 AM, Gerd Hoffmann wrote: > > On Wed, Oct 13, 2021 at 11:57:11AM -0500, Brijesh Singh wrote: > >> When SEV-SNP is active, the CPUID and Secrets memory range contains the > >> information that is used during the VM boot. The content need to be persist > >> across the kexec boot. Mark the memory range as Reserved in the EFI map > >> so that guest OS or firmware does not use the range as a system RAM. > > Why is this needed? Isn't the complete firmware memory tagged as > > reserved anyway? > > PlatformPei detects all the guest memory and marks it as a SYSTEM_RAM > unless its an MMIO or added as reserved in e820 map file. Since the > Secrets and CPUID pages are part of system RAM so we need to explicitly > exclude these region. secret and cpuid are in memfd which in turn is part of the firmware image mapping which is reserved in the e820 map: kraxel@rhel8 ~# dmesg | grep -i e820 [ ... some lines snipped ... ] [ 0.000000] BIOS-e820: [mem 0x000000007ff7c000-0x000000007fffffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000b0000000-0x00000000bfffffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000ffc00000-0x00000000ffffffff] reserved <= here [ 0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000027fffffff] usable I think they should be covered already ... take care, Gerd