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.142.1594830334388450139 for ; Wed, 15 Jul 2020 09:25:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CW/wd78g; 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=1594830333; 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=2rRP+Q9ukVmgQi7c4OfMARxdf5ZpfgX6qlI8jT7Krds=; b=CW/wd78gEHEbjru86T2LHZtn5w14I0KqxWNPW4G5qhqmfctAU+gtqBcEoWC6vVSRlma2aL f3whxcR78DKts0s4PESYuWikTdvffuMQl5BmunSCZ/kKbeDBybPj9DFqQOZ4v7YxfQGXpr PiJXjk6Q2IUnPpXXJ8V9Z5CYWFl93Oc= 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-63-xA0b9dl5Nm2hB_Qn4-3Z2w-1; Wed, 15 Jul 2020 12:25:31 -0400 X-MC-Unique: xA0b9dl5Nm2hB_Qn4-3Z2w-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 80AE719200C0; Wed, 15 Jul 2020 16:25:29 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-114-3.ams2.redhat.com [10.36.114.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0FD579D04; Wed, 15 Jul 2020 16:25:27 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v10 26/46] OvmfPkg/VmgExitLib: Add support for DR7 Read/Write NAE events To: devel@edk2.groups.io, thomas.lendacky@amd.com Cc: Brijesh Singh , Ard Biesheuvel , Eric Dong , Jordan Justen , Liming Gao , Michael D Kinney , Ray Ni References: From: "Laszlo Ersek" Message-ID: Date: Wed, 15 Jul 2020 18:25:26 +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: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com 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 07/14/20 16:37, Lendacky, Thomas wrote: > From: Tom Lendacky > > 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. > > The caching of the DR7 values will make use of the per-CPU data pages > that are allocated along with the GHCB pages. The per-CPU page for a > vCPU is the page that immediately follows the vCPU's GHCB page. Since > each GHCB page is unique for a vCPU, the page that follows becomes > unique for that vCPU. The SEC phase will reserves an area of memory for > a single GHCB and per-CPU page for use by the BSP. After transitioning > to the PEI phase, new GHCB and per-CPU pages are allocated for the BSP > and all APs. > > Cc: Jordan Justen > Cc: Laszlo Ersek > Cc: Ard Biesheuvel > Acked-by: Laszlo Ersek > Signed-off-by: Tom Lendacky > --- > OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 114 ++++++++++++++++++ > 1 file changed, 114 insertions(+) Thanks for the comment style fixes, my ACK stands. Laszlo