From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 91CBC94132C for ; Thu, 25 Apr 2024 06:58:56 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=GipMvCT2+zTHh4CoKF33MHLoZJbUirpJ4As5exQ8VTI=; c=relaxed/simple; d=groups.io; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Disposition; s=20240206; t=1714028335; v=1; b=Fiql/72BC5HpXrMOJ80Ubj2JLXkbmztBfKsyAoeD9jKVKBj+kEYUd6bbrG2LPfVaWHwJ4ZN+ ANobaLhoSGuPGRHABKr9iUYJyWoyWnmrvC5FZDvFyLO+dnyjGCj8zEJrx7LXXYgDNsKtq6xgqVy clC3pXz3JvRHGrB0QsGt906napfSFMNn2yZpUmr4HfLLR3cwRHEr8JbYgL0pDtw0nbXQHrVBe7g TCBXGTo7905F42uOEj3Db0lzsXmT9x3hxOSwPtGHPQXTgPuX+e6ARgyCrL0yjPMIopiioHMa3xO SoJri0WzSMa1+i7zKpDDIYvSREfljFDii9JkOngq5Of9g== X-Received: by 127.0.0.2 with SMTP id amdKYY7687511x9mesPfO31j; Wed, 24 Apr 2024 23:58:55 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.11210.1714028334477141379 for ; Wed, 24 Apr 2024 23:58:54 -0700 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-324-D9yNc_gNM8idW1cH_bBrJw-1; Thu, 25 Apr 2024 02:58:51 -0400 X-MC-Unique: D9yNc_gNM8idW1cH_bBrJw-1 X-Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 81ACF3820EAF; Thu, 25 Apr 2024 06:58:50 +0000 (UTC) X-Received: from dobby.home.kraxel.org (unknown [10.39.192.160]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0373C5C5CC9; Thu, 25 Apr 2024 06:58:50 +0000 (UTC) X-Received: by dobby.home.kraxel.org (Postfix, from userid 1000) id CB756F6B08; Thu, 25 Apr 2024 08:58:47 +0200 (CEST) Date: Thu, 25 Apr 2024 08:58:47 +0200 From: "Gerd Hoffmann" To: "Ni, Ray" Cc: "Wu, Jiaxin" , "devel@edk2.groups.io" , "Zeng, Star" , "Kumar, Rahul R" , "Dong, Guo" , "Rhodes, Sean" , "Lu, James" , "Guo, Gua" , Ard Biesheuvel , "Yao, Jiewen" , Abdul Lateef Attar , Abner Chang , Tom Lendacky Subject: Re: [edk2-devel] [PATCH v3 00/13] Add SmmRelocationLib Message-ID: <4fngcjpmyqnzyp6bh3ycylan2a3k4s4sy2tktankxor4eqnjth@txcoonsfhsmt> References: <17C74D78B0B952AD.15491@groups.io> <3v4gqem2libtqyxyw6gzuqrifjxurj7lahdbrfn4474fvgkit2@kojgaroebe3o> <4p5no7tieltk7n2p4mzkuy2ypd2kkxdwxs6lsfnwlrlucosmba@zs5cfcjhfz5y> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Wed, 24 Apr 2024 23:58:54 -0700 Resent-From: kraxel@redhat.com Reply-To: devel@edk2.groups.io,kraxel@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: sT6ub0WZixZgMy7JlAdJeeY9x7686176AA= Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="Fiql/72B"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io Hi, > That means the SMMRevId is 0_xx64h for AMD64 processor. But I am not > sure what the value is for AMD32 processor. Maybe 0 according to the > OVMF logic. The smm emulation in the linux kernel uses 0 and 0x64. > But, I am very suspicious about the logic in AMD's version as below: > --- AMD's version > SmmSaveStateRegisterLma = (UINT8)EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT; > > LMAValue = (UINT32)AsmReadMsr64 (EFER_ADDRESS) & LMA; > if (LMAValue) { > SmmSaveStateRegisterLma = (UINT8)EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT; > } > --- > The above logic detects the current CPU mode and 64bit save state area layout is used if it's running in 64bit. > But if a AMD64 CPU runs in 32bit mode, the above logic causes the > 32bit save state area layout is used. It's not right! The save state > area layout does not depend on the CPU running mode, but whether it's > a legacy CPU or a 64-capable CPU. Well, that is not entirely clear to me. Could it be 64-bit processors support both 32-bit and 64-bit format, for backward compatibility reasons? So OvmfPkgIa32 builds could use the 32-bit format, OvmfPkgX64 builds use the 64-bit format, everything works fine? The tricky corner case is OvmfPkgIa32X64, where (after applying this series) 32-bit PEI should setup things for 64-bit SMM/DXE, and checking the current processor mode will not give use the result we need. > Jiaxin, I agree that the confusion should be cleaned up by AMD > experts. Let's not change any existing behavior. Agree. Tom? take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118272): https://edk2.groups.io/g/devel/message/118272 Mute This Topic: https://groups.io/mt/105593568/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-