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.web11.11840.1643198770993660724 for ; Wed, 26 Jan 2022 04:06:11 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XrJoF65/; 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=1643198770; 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=6LW2bkLXfaudrx4yKfk5W2r8mH9ZxtYrto33S9e0J5c=; b=XrJoF65/xy4KlohlJacN3rO85m+5PJ84gYLHdpGzHaRwhu4PeFS1CvsDUlfQsL4WzJzIWN VXJX2AYg5vjfcVTVaqQTrKPX3r5dugo/5j8din2Z9Bj5oSI00X6hdvLFAB+f2EsOJh9KkI QgzalDhLk5/3lbBmpULvZHFsZxdn/h4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-656-10YzqbPhOJWrsaPKz4Q9FQ-1; Wed, 26 Jan 2022 07:06:05 -0500 X-MC-Unique: 10YzqbPhOJWrsaPKz4Q9FQ-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 7F96318C89DA; Wed, 26 Jan 2022 12:06:03 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 171D76E1E4; Wed, 26 Jan 2022 12:06:03 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 5649918000AA; Wed, 26 Jan 2022 13:06:01 +0100 (CET) Date: Wed, 26 Jan 2022 13:06:01 +0100 From: "Gerd Hoffmann" To: Min Xu Cc: devel@edk2.groups.io, Ard Biesheuvel , Jordan Justen , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky Subject: Re: [PATCH V5 18/33] OvmfPkg: Check Tdx in QemuFwCfgPei to avoid DMA operation Message-ID: <20220126120601.bcrv4zajivhbbggv@sirius.home.kraxel.org> References: <37a90fcfe15738c0b6e0edba59b6db48dc36681c.1642899774.git.min.m.xu@intel.com> MIME-Version: 1.0 In-Reply-To: <37a90fcfe15738c0b6e0edba59b6db48dc36681c.1642899774.git.min.m.xu@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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 Hi, > +BOOLEAN > +QemuFwCfgIsTdxGuest ( > + VOID > + ) > +{ > + CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER *CcWorkAreaHeader; > + > + CcWorkAreaHeader = (CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER *)FixedPcdGet32 (PcdOvmfWorkAreaBase); > + return (CcWorkAreaHeader != NULL && CcWorkAreaHeader->GuestType == GUEST_TYPE_INTEL_TDX); > +} I think once the "SEV BaseMemEncryptLib cleanup" series by Brijesh is merged it should be possible to use CcWorkAreaHeader->GuestType to detect both sev and tdx and simplify the code here a bit. take care, Gerd