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.web08.5948.1631186559858341532 for ; Thu, 09 Sep 2021 04:22:40 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I8fB33kH; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631186559; 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=eV0ZqXB3j3RUXqtokdkfEuT/hZxnsV6/qduOnqP9UR0=; b=I8fB33kHZ+BMIgZJuOWA5xN7P1qP2eaK0YLi5cnxrcrFMYxg1kUuKmVWkXyu9c4lhOAcel IASd1FMrQHSpJNKn1ynWNeXqqeSzFlry+a1aK73II0taRDz3Sc2y1REhf3w08dlZvbQAUt PedfEgjwqlzP0wN37lw6aT+Lt+bOl4c= 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-527-uqexshQNOoK1uFtromT1EQ-1; Thu, 09 Sep 2021 07:22:35 -0400 X-MC-Unique: uqexshQNOoK1uFtromT1EQ-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 D3DDC100C609; Thu, 9 Sep 2021 11:22:33 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 839B31346F; Thu, 9 Sep 2021 11:22:33 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D68AF180038E; Thu, 9 Sep 2021 13:22:31 +0200 (CEST) Date: Thu, 9 Sep 2021 13:22:31 +0200 From: "Gerd Hoffmann" To: Brijesh Singh Cc: "Xu, Min M" , "Yao, Jiewen" , "devel@edk2.groups.io" , James Bottomley , Tom Lendacky , "Justen, Jordan L" , Ard Biesheuvel , Erdem Aktas , Michael Roth Subject: Re: [PATCH v6 00/29] Add AMD Secure Nested Paging (SEV-SNP) support Message-ID: <20210909112231.zorhh7bewwbweoe4@sirius.home.kraxel.org> References: <20210901161646.24763-1-brijesh.singh@amd.com> <4da448de-5e1c-85cf-9471-bf2d77281ac9@amd.com> MIME-Version: 1.0 In-Reply-To: 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, > I am not sure if its a good idea to pack a header like above in a 32-bit > PCD. The caller need to unpack the 32-bit number and perform a bitshit > etc. Additionally we also need to check for reserved bits being set to > zero etc. I am more inclined toward something like this: > > enum { Well, various places probably just need to know whenever they should call into the sev or the tdx library, so grouping stuff makes sense to me. We don't need bitfields for that though, could also be done this way: enum { NOT_ENCRYPTED = 0, AMD_SEV = 0x100, AMD_SEV_ES, [ ... ] INTEL_TDX = 0x200, [ ... ] } So if you need the exact mode you can compare values as-is, if you want figure which vendor library should be called you'll just mask out the least significant 8 bits. take care, Gerd