From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web11.8591.1592578124194170361 for ; Fri, 19 Jun 2020 07:48:44 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FA8Iuzfz; spf=pass (domain: redhat.com, ip: 207.211.31.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592578123; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q7G3NlxlEkpWTMUmAQjjaBhAU+Cj830c6EwOLypkDHc=; b=FA8Iuzfz3Ktatc8h0/abUMrV8SbiN//uMVE8wFlpVe05xTIPZUpsHtfqgbijh6yfgfzsNS g8Ro7wxosMWz5QOffVxR5tT7HXZoMZYfbV4YWaU//rk/UWAK4GcAF4+OCgnlLOiZC6jQOg LaZQk2FSbkHcHVri1T0t3W9ArIu7tFY= 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-485-Jx_ZXnKWMEiKP7VlipFDuQ-1; Fri, 19 Jun 2020 10:48:27 -0400 X-MC-Unique: Jx_ZXnKWMEiKP7VlipFDuQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A521E18FF661; Fri, 19 Jun 2020 14:48:26 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-115-60.ams2.redhat.com [10.36.115.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FA9171662; Fri, 19 Jun 2020 14:48:25 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v2 2/2] UefiCpuPkg: PiSmmCpuDxeSmm skip MSR_IA32_MISC_ENABLE manipulation on AMD To: devel@edk2.groups.io, garrett.kirkendall@amd.com Cc: Eric Dong , Ray Ni References: <20200618152245.6483-1-Garrett.Kirkendall@amd.com> <20200618152245.6483-3-Garrett.Kirkendall@amd.com> From: "Laszlo Ersek" Message-ID: <509e8366-8c57-f96d-8684-a548ef148831@redhat.com> Date: Fri, 19 Jun 2020 16:48:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200618152245.6483-3-Garrett.Kirkendall@amd.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 06/18/20 17:22, Kirkendall, Garrett wrote: > AMD does not support MSR_IA32_MISC_ENABLE. Accessing that register > causes and exception on AMD processors. If Execution Disable is > supported, but if the processor is an AMD processor, skip manipulating > MSR_IA32_MISC_ENABLE[34] XD Disable bit. > > Cc: Eric Dong > Cc: Ray Ni > Cc: Laszlo Ersek > Signed-off-by: Garrett Kirkendall > --- > > Notes: > Tested on Intel hardware with Laszlo Ersek's help > > (1) downloaded two Linux images from provided links. > (2) Test using a 32-bit guest on an Intel host (standing in your edk2 tree, with the patches applied): > > $ build -a IA32 -b DEBUG -p OvmfPkg/OvmfPkgIa32.dsc -t GCC5 -D SMM_REQUIRE > > $ qemu-system-i386 \ > -cpu coreduo,-nx \ > -machine q35,smm=on,accel=kvm \ > -m 4096 \ > -smp 4 \ > -global driver=cfi.pflash01,property=secure,value=on \ > -drive if=pflash,format=raw,unit=0,readonly=on,file=Build/OvmfIa32/DEBUG_GCC5/FV/OVMF_CODE.fd \ > -drive if=pflash,format=raw,unit=1,snapshot=on,file=Build/OvmfIa32/DEBUG_GCC5/FV/OVMF_VARS.fd \ > -drive id=hdd,if=none,format=qcow2,snapshot=on,file=fedora-30-efi-systemd-i686.qcow2 \ > -device virtio-scsi-pci,id=scsi0 \ > -device scsi-hd,drive=hdd,bus=scsi0.0,bootindex=1 > > (Once you get a login prompt, feel free to interrupt QEMU with Ctrl-C.) > > (3) Test using a 64-bit guest on an Intel host: > > $ build -a IA32 -a X64 -b DEBUG -p OvmfPkg/OvmfPkgIa32X64.dsc -t GCC5 -D SMM_REQUIRE > > $ qemu-system-x86_64 \ > -cpu host \ > -machine q35,smm=on,accel=kvm \ > -m 4096 \ > -smp 4 \ > -global driver=cfi.pflash01,property=secure,value=on \ > -drive if=pflash,format=raw,unit=0,readonly=on,file=Build/Ovmf3264/DEBUG_GCC5/FV/OVMF_CODE.fd \ > -drive if=pflash,format=raw,unit=1,snapshot=on,file=Build/Ovmf3264/DEBUG_GCC5/FV/OVMF_VARS.fd \ > -drive id=hdd,if=none,format=qcow2,snapshot=on,file=fedora-31-efi-grub2-x86_64.qcow2 \ > -device virtio-scsi-pci,id=scsi0 \ > -device scsi-hd,drive=hdd,bus=scsi0.0,bootindex=1 > > Tested on real AMD Hardware > > UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h | 3 +++ > UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c | 9 ++++++++- > UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm | 19 +++++++++++++++++-- > UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm | 20 ++++++++++++++++++-- > 4 files changed, 46 insertions(+), 5 deletions(-) For this patch: Reviewed-by: Laszlo Ersek However, can you please clarify one bit, with regard to testing: I understand the regression tests in a 32-bit guest on Intel, and in a 64-bit guests on Intel. I also understand the test on a physical AMD machine (in other words, you built a physical platform firmware for an AMD board, flashed it, and tested it.) However, your notes do not seem to mention test (4) that I requested: "(4) Test using a 64-bit guest on an AMD host -- just repeat step (3) on an AMD host." https://edk2.groups.io/g/devel/message/61344 (alternative link: ) That is also important. Test (3) intentionally uses "-cpu host", so the guest will see a different CPU model when run on an Intel host (3) vs. on an AMD host (4). I'd like to know that the patched 64-bit SMI entry code continues working in both guest environments (i.e. when seeing either an Intel CPU model or an AMD CPU model). I did not request the same "duality" with test (2) -- as you see, there I wrote "-cpu coreduo,-nx"; i.e., Intel only. The reason is that "-cpu coreduo,-nx" is more or less the only 32-bit SMM environment that I generally know about, and verify -- I simply do not have a 32-bit AMD CPU model "baseline" to test against. This is why I didn't request "-cpu host" in (2), and consequently, why I didn't request (2) to be run on both AMD and Intel hosts. So... Can you please run test (4) too -- i.e., 64-bit guest on an AMD host, with "-cpu host"? Thanks! Laszlo