From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=pbonzini@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A99DB202E60ED for ; Sun, 15 Oct 2017 08:22:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3123513AAC; Sun, 15 Oct 2017 15:26:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3123513AAC Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com Received: from [10.36.116.107] (ovpn-116-107.ams2.redhat.com [10.36.116.107]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 649CF60F85; Sun, 15 Oct 2017 15:26:07 +0000 (UTC) To: "Duran, Leo" , "edk2-devel@lists.01.org" Cc: Ruiyu Ni , Jordan Justen , Liming Gao , Jiewen Yao , Michael D Kinney References: <1507751131-32404-1-git-send-email-leo.duran@amd.com> <1507751131-32404-2-git-send-email-leo.duran@amd.com> <3d6feb63-0a4f-ed3f-b28e-8a88ed7a40af@redhat.com> From: Paolo Bonzini Message-ID: Date: Sun, 15 Oct 2017 17:26:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sun, 15 Oct 2017 15:26:09 +0000 (UTC) Subject: Re: [PATCH v5 1/2] UefiCpuPkg/SmmCpuFeaturesLib: Use global variables to replace macros X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Oct 2017 15:22:36 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 14/10/2017 17:51, Duran, Leo wrote: >>> + // Override PSD offset for AMD >>> + // >>> + if (SmmStandardSignatureIsAuthenticAMD ()) { >>> + gStmPsdOffset = AMD_SMM_PSD_OFFSET; } >>> + >> I think the right thing to do here would be to use the SMM state save map >> revision; in the case of AMD, the low 16 bits (IIRC) would be 0x0064. >> > Hi Paolo, > > In its current form, the patch merely replaces the macros with global > variables, and does not attempt to disrupt the existing execution > flow. But perhaps you can provide a bit more context (or an example) > so that may better understand your suggestion? The offsets don't really depend on Intel vs. AMD, but rather on the version of the state save map. QEMU and KVM for example always use the AMD format because it's documented better (Intel doesn't document the descriptor cache fields in the SDM), even if the CPUID vendor is GenuineIntel. I am not sure if you have the SMM state save map revision at this point of the code, and likewise for 2/2. But if you do, it would be much nicer for us virtualization folks if you used it instead of CPUID to pick the offsets. Paolo