From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web10.576.1592326879415462597 for ; Tue, 16 Jun 2020 10:01:19 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UgEp6hXP; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592326878; 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=YweimEqyzK229/8178qFdp3ASttp6WkA0YIsW3BawaE=; b=UgEp6hXPguAIi5ia6HEZlviy0y98+Q91Df9MfEt9JQYoLoucwEdWz3jeh7EJu8fr9jCnxw pr93e8y9gJldsAwC/l1tqK0breQqSoIpHV86riad1h36ssC3SXDlGi+quL2XD9MX8cRL6b yZLu8Vvk6PO7qmpqkeJgtWQDh4kF/O4= 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-483-ZcDTHGBcNFyCiM9h7S_hJw-1; Tue, 16 Jun 2020 13:01:04 -0400 X-MC-Unique: ZcDTHGBcNFyCiM9h7S_hJw-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 057C05AED1; Tue, 16 Jun 2020 17:01:03 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-248.ams2.redhat.com [10.36.113.248]) by smtp.corp.redhat.com (Postfix) with ESMTP id 060A77890A; Tue, 16 Jun 2020 17:01:01 +0000 (UTC) Subject: Re: [PATCH v1 0/2] UefiCpuPkg: AMD procesor MSR_IA32_MISC_ENABLE To: Garrett Kirkendall , devel@edk2.groups.io Cc: Eric Dong , Ray Ni References: <20200615183029.4577-1-Garrett.Kirkendall@amd.com> From: "Laszlo Ersek" Message-ID: <5f2fd5a9-2107-503a-406b-de08529dcb56@redhat.com> Date: Tue, 16 Jun 2020 19:01:01 +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: <20200615183029.4577-1-Garrett.Kirkendall@amd.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 Hi Garrett, On 06/15/20 20:30, Garrett Kirkendall wrote: > AMD processor does not support MSR_IA32_MISC_ENABLE register. Accessing > this register on AMD causes an unhandled exception in SmmEntry.nasm and > a subsequent failure to boot since this is too early in SMM path for the > exception handler to be loaded. > > First, to distinguish between AMD and other processors, refactor > StandardSignatureIsAuthenticAMD into BaseUefiCpuLib. So there is only > one copy in the source. All changed modules already include UefiCpuLib > either directly or indirectly so could not easly split first patch. > > Second, Skip manipulation of MSR_IA32_MISC_ENABLE register if running > on an AMD processor. > > Tested on AMD X64 processor. > > Modified source patching in 2/2 for FALSE > and TRUE to test failure and passing case when AMD processor detected. > Did not have a way to test UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm. Please test the series as follows: (1) Download https://www.kraxel.org/repos/images/fedora-30-efi-systemd-i686.qcow2.xz https://www.kraxel.org/repos/images/fedora-31-efi-grub2-x86_64.qcow2.xz and decompress both files. (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 (4) Test using a 64-bit guest on an AMD host -- just repeat step (3) on an AMD host. Thanks! Laszlo