From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web11.7977.1602751959356328157 for ; Thu, 15 Oct 2020 01:52:39 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eXclD2B/; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602751958; 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=IaEYIGfi0MrwkvvZa2idbfDDULZ676OqVma/TIf49Z8=; b=eXclD2B/epnNjRRFma+IcvgJZUvoSJNYA2fM5ph3/5kfCNt+cXpEdNgQ4ESo+ZZB1U0rDO 8tv8QT1cNQIxxNGfAhCWN+u2v0cPre+m59g4aWCD9k6SvuDxvpoOBYdQ0bc4ZEWY6y9owf QfdNIEGemn5CR1VkND0nsYZo2FM3PJA= 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-253-x6uRY6i0NamK7dZmh4miaA-1; Thu, 15 Oct 2020 04:52:36 -0400 X-MC-Unique: x6uRY6i0NamK7dZmh4miaA-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 781088030BA; Thu, 15 Oct 2020 08:52:35 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-119.ams2.redhat.com [10.36.113.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3BA1676674; Thu, 15 Oct 2020 08:52:34 +0000 (UTC) Subject: Re: [PATCH 4/9] OvmfPkg/VmgExitLib: Set the SwScratch valid bit for MMIO events To: Tom Lendacky , devel@edk2.groups.io Cc: Brijesh Singh , Jordan Justen , Ard Biesheuvel References: <6c91fcb168d187ff21f753b59c67ed9af0f23f1e.1602346027.git.thomas.lendacky@amd.com> From: "Laszlo Ersek" Message-ID: <73f8336b-c4b3-ae95-95a4-cbf5151cea18@redhat.com> Date: Thu, 15 Oct 2020 10:52:33 +0200 MIME-Version: 1.0 In-Reply-To: <6c91fcb168d187ff21f753b59c67ed9af0f23f1e.1602346027.git.thomas.lendacky@amd.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 10/10/20 18:07, Tom Lendacky wrote: > From: Tom Lendacky > > All fields that are set in the GHCB should have their associated bit in > the GHCB ValidBitmap field set. Add support to set the bit for the scratch > area field (SwScratch). > > Fixes: c45f678a1ea2 ("OvmfPkg/VmgExitLib: Add support for NPF NAE events (MMIO)") > Cc: Jordan Justen > Cc: Laszlo Ersek > Cc: Ard Biesheuvel > Cc: Tom Lendacky > Cc: Brijesh Singh > Signed-off-by: Tom Lendacky > --- > OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c > index 40120e29af18..6d6fe6800031 100644 > --- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c > +++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c > @@ -720,6 +720,7 @@ MmioExit ( > CopyMem (Ghcb->SharedBuffer, &InstructionData->Ext.RegData, Bytes); > > Ghcb->SaveArea.SwScratch = (UINT64) Ghcb->SharedBuffer; > + GhcbSetRegValid (Ghcb, GhcbSwScratch); > Status = VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2); > if (Status != 0) { > return Status; > @@ -749,6 +750,7 @@ MmioExit ( > CopyMem (Ghcb->SharedBuffer, InstructionData->Immediate, Bytes); > > Ghcb->SaveArea.SwScratch = (UINT64) Ghcb->SharedBuffer; > + GhcbSetRegValid (Ghcb, GhcbSwScratch); > Status = VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2); > if (Status != 0) { > return Status; > @@ -781,6 +783,7 @@ MmioExit ( > ExitInfo2 = Bytes; > > Ghcb->SaveArea.SwScratch = (UINT64) Ghcb->SharedBuffer; > + GhcbSetRegValid (Ghcb, GhcbSwScratch); > Status = VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2); > if (Status != 0) { > return Status; > @@ -811,6 +814,7 @@ MmioExit ( > ExitInfo2 = Bytes; > > Ghcb->SaveArea.SwScratch = (UINT64) Ghcb->SharedBuffer; > + GhcbSetRegValid (Ghcb, GhcbSwScratch); > Status = VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2); > if (Status != 0) { > return Status; > @@ -836,6 +840,7 @@ MmioExit ( > ExitInfo2 = Bytes; > > Ghcb->SaveArea.SwScratch = (UINT64) Ghcb->SharedBuffer; > + GhcbSetRegValid (Ghcb, GhcbSwScratch); > Status = VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2); > if (Status != 0) { > return Status; > Reviewed-by: Laszlo Ersek