From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.83]) by mx.groups.io with SMTP id smtpd.web10.6178.1631187629852654645 for ; Thu, 09 Sep 2021 04:40:30 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=ekkrNVnk; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.223.83, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lIchhwrCDNPpO584mF7qvweVdRHt3voWZB+oMCsUWOo/DKC+0K3IPImAB6Mj+9fgbnA2tz4tPGFw6DYextB0RAjHDw9Ke/SNOogz83/PF3UDt25Q2etgE2/qeybKCUTxVXziQzYZnLBCPC54aH0WajheW7HTnqbH7vmRPeBuATr6l9vHx+EJfPlwa5IhoMyjP7hyWc/ITZuLMp4nwPoUC3efk7uuoYohPuqVY7L5P9xOS91P263rF6Z7cva7jOHM5A0S+clpJ5qAu8mZu/VGyjXe94b7ZMvF6B0jHSbaSopshfIewoFHPuueTNncBPgMN5P5RAvsexhQppzieyy7KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=JuJJuMG9StqFaJDeW0xvKw7HzpQUysw3U2jAKX5Hjns=; b=k8Q1xiBhVgthQi84/ZL4TXaDaJbe3TQ9npO+lUDJckVPNPIXqybt0Jdv20eJMzue8j2TRRim3oDN2EZQx6wgw+0/U88RCXH8GRIQKCoCVkMdcT6ENkgDQNclyeJCTnANvR4MsrN6/DPKwZL3qaNEKrkufj1xbCzp2CEjrqIfnmgQ2LAMW/LQJ888FW+blNjwHpjbTTt6IJdG74JfjopAkni+9ISLnKGKXvUcW0p3FnafMJWW4sNXyvnDkjchupZa1jdz1cWBcmTU/apgLAjpmxve3KbUw/jGOavASFPskBBnxE2bwawnsNXSUO9eyd5dMnIofHAmovScQHXd3g7ywA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JuJJuMG9StqFaJDeW0xvKw7HzpQUysw3U2jAKX5Hjns=; b=ekkrNVnk7EmQi2+oix5XRHoVyBcrktwHZxatbW6x8nEN/6OjAKVg7PxGIuc5ZUN8khZl+hp57gEMWtD89t1uex8la6AQwW3FaXB67WbOdg4jIpuhn54ybk4uD06+ymO/uEYkbSy+fWxspjwMeGEFSdSetKz2Gj3xg5hyGqLRf/g= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SA0PR12MB4573.namprd12.prod.outlook.com (2603:10b6:806:9c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14; Thu, 9 Sep 2021 11:40:28 +0000 Received: from SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::78b7:7336:d363:9be3]) by SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::78b7:7336:d363:9be3%6]) with mapi id 15.20.4478.027; Thu, 9 Sep 2021 11:40:28 +0000 Subject: Re: [PATCH v6 00/29] Add AMD Secure Nested Paging (SEV-SNP) support To: Gerd Hoffmann Cc: "Xu, Min M" , "Yao, Jiewen" , "devel@edk2.groups.io" , James Bottomley , Tom Lendacky , "Justen, Jordan L" , Ard Biesheuvel , Erdem Aktas , Michael Roth References: <20210901161646.24763-1-brijesh.singh@amd.com> <4da448de-5e1c-85cf-9471-bf2d77281ac9@amd.com> <20210909112231.zorhh7bewwbweoe4@sirius.home.kraxel.org> From: "Brijesh Singh" Message-ID: <8d5af98d-dfe8-699b-381e-32161a5dd983@amd.com> Date: Thu, 9 Sep 2021 06:40:26 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: <20210909112231.zorhh7bewwbweoe4@sirius.home.kraxel.org> X-ClientProxiedBy: SN4PR0501CA0061.namprd05.prod.outlook.com (2603:10b6:803:41::38) To SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) Return-Path: brijesh.singh@amd.com MIME-Version: 1.0 Received: from Brijeshs-MacBook-Pro.local (70.112.153.56) by SN4PR0501CA0061.namprd05.prod.outlook.com (2603:10b6:803:41::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.8 via Frontend Transport; Thu, 9 Sep 2021 11:40:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 45dc39d6-063b-44f6-ca93-08d973869f06 X-MS-TrafficTypeDiagnostic: SA0PR12MB4573: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bgD28lHo7PBVcDyFfI0FE0T5wipEHh/Kg9du8khbv2EcVxW/noDbHhFDA4YW3SJsczBehLV5FA5SkO//WFKKXNNBYz3RlQ7HgLjlgYdAZ+4JZASQSwA9L5ccxXRHIvQhoJLXZBXWRLnwEwYWamNtCgRbhbVnPp6hD8EvDjcyeLBfCpbA6aG0I7JzECbCOQq6GLD4SBA0cfo2ewx5UUzmTqwsd6tV3VH5c1AhZGCjRU7RQc7jb40FUUYuImX35aTj9GvZB+0tI50dXL9rrWhS19qAtLaCXzfLNQOx0kM5o2Zp7O2Yo/a0Td6JfMLji5SW4REsHUbcuPQEFPm+iMzkMIPQrNVuTCbznqPEYvs+1dWGxhgGVjLz5HK66d9sBW3qu3idniVjIcbb5D0cXzWMeQ9Tx2NXX7mQbsLBJqDLwRUhQHxSXo8ch0hHaawjyQGj3oWBmph8PbO9i8fgxn9JREnAzTnYmr9s1Kz9txTYijMaT0HcAspdNO7ZPpOnAq5o+wk1ozjWnAz3BPDbGaHvkE+nYTAf0qKBFHWnqy6weQuVq5SV+88NhSvxQnovGfl3Hs8A67O4nx1/JrUL3hIDER+QXaq/oLnwXMuHPaBqViYAE19IeuluUMUZICIBSBBqYesGQO/qSPL5m9O/varN/NZv2Oa32pGCTYDOlhDxbKsMOhwXwrW6imuHzaz66LWRoWNrDhUS8eEvnnQtrZCxFhSsMInnnOOVGZpme3scwcplt93joPt5VJqJAcs05eVPIrjvWyF7l9vNfeA2QwZDmg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2718.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(376002)(396003)(346002)(366004)(136003)(8676002)(53546011)(36756003)(956004)(66946007)(6916009)(2616005)(31696002)(44832011)(86362001)(5660300002)(478600001)(8936002)(6506007)(31686004)(52116002)(316002)(54906003)(2906002)(26005)(66556008)(6486002)(6512007)(4744005)(66476007)(186003)(38100700002)(38350700002)(83380400001)(4326008)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VnhmRW85UlFCdU1TTzlWM21wRUtSSktXbHRzNlpYWDQ2aHh4WWdiYVFMaElB?= =?utf-8?B?VkxjcENkWlRJdWhHUzBZV3ZTUkw2cUdkMXViUzdEbEN6MGl2aFVybHVMczlT?=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DQyS2pZTU1uTUU2NmJ2RzNi?= =?utf-8?B?RXJVZEl5YlQyYnpNQWJWQmhNQU1sZjZiNWV2dFd4amhSQ294Y09VOHdUWHBY?= =?utf-8?B?Tm5vQWl5cjBqcXdjWVpTU3k5Uy9kVHg5QnNybk1hZ1ovb1pPZk9VSkNrSVAx?= =?utf-8?B?cWtVYllGZTNVSndXd1UyMkZRVkJYTFltekZGYWZyYTNEZDRtWFlGT0NyKzFw?= =?utf-8?B?TU52Z3J3NTZQRk9sM1BUeFBOYll0T3pvUVFzRVlncCtzZE9TZzNZemV5NGta?= =?utf-8?B?bTNsMGJycXJseU5zVmJRZVNoRkhLZUEzNGc0RllZL1Y1QkhkakJGQWV0Q1pZ?= =?utf-8?B?aExEbzhBWjVwT2pmTXMyTGU0d3ZCa0pLQUh1VlNwNnVoVmo5dnBzRGhNYVdS?= =?utf-8?B?SHRRbjREYWlTc3EzRUVqbmNuWXhpS2FTOUw1K0tqZFR1bm9VUU5acy9TTE04?= =?utf-8?B?dGlqaEpVV0k2b210NkJjNks2YzZvSndQbFExSGxxdjNsaEZJR2VkOGlrQUFP?= =?utf-8?B?bDRkOGhvN3FZK1dkdUFVemY2eks1QzBmRU9FYmo2SzBYWVE5c3BBaUk5SlhT?= =?utf-8?B?RlJidDNzZ2VTaUlrSzV6c0VnTG5wS25Uc2gwN3NvanhONHl3K3FQMHZZVyt2?= =?utf-8?B?SVlPekYwbC9tNUx2SEZuNmpoQzYyU0dLWER4NXdBOG0rL2lKaVR5QmUyK2Zy?= =?utf-8?B?ejNtZHhxOE42eHZ3ZXN6OUtVeWQzck1UOExLVnhOcXRTRHJVVDJtOHNJelEr?= =?utf-8?Q?V2ASMMxmjJ39MZLbsIf0PidLSK81PxrM6rsXyHK?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45dc39d6-063b-44f6-ca93-08d973869f06 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2021 11:40:28.1709 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: n8g4UcLHLFjlZtAIwArQsSJd+QobD7n+fdu4SldHqvD5LFPU7nixaBhu9hjCX71jA9qoPpP33Elp9OwXeWyNpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4573 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US On 9/9/21 6:22 AM, Gerd Hoffmann wrote: > 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. Yes, this also works fine. thanks