From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web12.6275.1634197651039269031 for ; Thu, 14 Oct 2021 00:47:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bkll3WpO; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634197650; 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: in-reply-to:in-reply-to:references:references; bh=1BotY/KjahwGKBF5WnhXqzHZSBjEcECUdqwtnMOfMMQ=; b=bkll3WpOoOpdDVZHx/IjxP1h7QMhQ5vAX0qF2bVu+ZFXat+3BM8BMGwYAp5iLw1USEpJ4a oKF3jVhwL1/ci2tyHviDsaS7ToVZIdVUY2xd7W+/c5CCz80gAQogRel+dVxb/YezbHDd3y h6EmbloCoP5A8Dmry0nRYAsFZ0ivSAU= 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-502-kqpEJpnnMIqt3D2Dg4ckGA-1; Thu, 14 Oct 2021 03:47:27 -0400 X-MC-Unique: kqpEJpnnMIqt3D2Dg4ckGA-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 67AB218D6A25; Thu, 14 Oct 2021 07:47:26 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F9901B42C; Thu, 14 Oct 2021 07:47:26 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B9C5B18007AC; Thu, 14 Oct 2021 09:47:24 +0200 (CEST) Date: Thu, 14 Oct 2021 09:47:24 +0200 From: "Gerd Hoffmann" To: Brijesh Singh Cc: devel@edk2.groups.io, James Bottomley , Min Xu , Jiewen Yao , Tom Lendacky , Jordan Justen , Ard Biesheuvel , Erdem Aktas , Michael Roth Subject: Re: [PATCH v9 11/32] OvmfPkg/VmgExitLib: use SEV-SNP-validated CPUID values Message-ID: <20211014074724.ndb37nhpwhcf23ru@sirius.home.kraxel.org> References: <20211013165713.727815-1-brijesh.singh@amd.com> <20211013165713.727815-12-brijesh.singh@amd.com> MIME-Version: 1.0 In-Reply-To: <20211013165713.727815-12-brijesh.singh@amd.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Oct 13, 2021 at 11:56:52AM -0500, Brijesh Singh wrote: > From: Michael Roth > > SEV-SNP firmware allows a special guest page to be populated with > guest CPUID values so that they can be validated against supported > host features before being loaded into encrypted guest memory to be > used instead of hypervisor-provided values [1]. > > Add handling for this in the CPUID #VC handler and use it whenever > SEV-SNP is enabled. To do so, existing CPUID handling via VmgExit is > moved to a helper, GetCpuidHyp(), and a new helper that uses the CPUID > page to do the lookup, GetCpuidFw(), is used instead when SNP is > enabled. For cases where SNP CPUID lookups still rely on fetching > specific CPUID fields from hypervisor, GetCpuidHyp() is used there as > well. > > [1]: SEV SNP Firmware ABI Specification, Rev. 0.8, 8.13.2.6 Acked-by: Gerd Hoffmann