From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web12.14708.1590159551359540920 for ; Fri, 22 May 2020 07:59:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AOSRw3z1; spf=pass (domain: redhat.com, ip: 205.139.110.61, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590159550; 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=vTJCeLi+Mu8Mh9G/0gBeWwuvHsRusa8LN7dqVmsWuwg=; b=AOSRw3z12UYEgPDYKgg/bg5vdad5DIHb98YCgTjoqDpfdGWsAdVXSTtxR3tKZqoQSypXgc 3i3UKRtkGkqFJKtvia5ss9QPWRoUKRm2tqBPWQfbO8BeX08c9URwWGKhYiRgNq1dT6H6jq HAwZ6tyDPQr/Ucf4CBMFFi+FWODd8Yc= 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-484-IngNnzkLN-ehrzP5kYI2Bw-1; Fri, 22 May 2020 10:59:06 -0400 X-MC-Unique: IngNnzkLN-ehrzP5kYI2Bw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D0952107ACCD; Fri, 22 May 2020 14:59:04 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-40.ams2.redhat.com [10.36.112.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id B80B660C20; Fri, 22 May 2020 14:59:02 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v8 26/46] OvmfPkg/VmgExitLib: Add support for DR7 Read/Write NAE events To: devel@edk2.groups.io, thomas.lendacky@amd.com Cc: Jordan Justen , Ard Biesheuvel , Michael D Kinney , Liming Gao , Eric Dong , Ray Ni , Brijesh Singh , Ard Biesheuvel References: <7015dcd00bb075c9875b3e4f5507a3281817cef4.1589925074.git.thomas.lendacky@amd.com> From: "Laszlo Ersek" Message-ID: <2ce20353-b9cf-c9a2-c9f1-13659f064ba1@redhat.com> Date: Fri, 22 May 2020 16:59:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <7015dcd00bb075c9875b3e4f5507a3281817cef4.1589925074.git.thomas.lendacky@amd.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 05/19/20 23:50, Lendacky, Thomas wrote: > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198 > > Under SEV-ES, a DR7 read or write intercept generates a #VC exception. > The #VC handler must provide special support to the guest for this. On > a DR7 write, the #VC handler must cache the value and issue a VMGEXIT > to notify the hypervisor of the write. However, the #VC handler must > not actually set the value of the DR7 register. On a DR7 read, the #VC > handler must return the cached value of the DR7 register to the guest. > VMGEXIT is not invoked for a DR7 register read. > > To avoid exception recursion, a #VC exception will not try to read and > push the actual debug registers into the EFI_SYSTEM_CONTEXT_X64 struct > and instead push zeroes. The #VC exception handler does not make use of > the debug registers from saved context. > > Cc: Eric Dong > Cc: Ray Ni > Cc: Jordan Justen > Cc: Laszlo Ersek > Cc: Ard Biesheuvel > Signed-off-by: Tom Lendacky > --- > .../Library/VmgExitLib/X64/VmgExitVcHandler.c | 105 ++++++++++++++++++ > .../X64/ExceptionHandlerAsm.nasm | 17 +++ > .../X64/Xcode5ExceptionHandlerAsm.nasm | 17 +++ > 3 files changed, 139 insertions(+) My brain is mush (the NPF/MMIO patch wasn't easy), so I'll pick up the review at this patch next week. Thanks! Laszlo