Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3800C38142 for ; Tue, 31 Jan 2023 21:27:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232164AbjAaV1M (ORCPT ); Tue, 31 Jan 2023 16:27:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229962AbjAaV1L (ORCPT ); Tue, 31 Jan 2023 16:27:11 -0500 Received: from smtp-fw-6002.amazon.com (smtp-fw-6002.amazon.com [52.95.49.90]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C06B814226; Tue, 31 Jan 2023 13:27:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1675200431; x=1706736431; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=vYK2NpO+ExFxzqnG6ZjWnmzVegQDyJD3/VETJklLIPY=; b=ujo/dWQh0wEJfpGRNiseiydB5qh1/8c6XjjfeuqKubKFFdZzM7b8Uj+i 0DGHqJRTsuLqL+RauA+EW5tZjTVC1Bcfo7Et0/xiqUFzFpV6v53L+WLBU 1xhtfs0NAJ+dnTS5XEmEK0T/a5NDoRNmGDXsdx/zN5nt70PMWpi1nAqT0 w=; X-IronPort-AV: E=Sophos;i="5.97,261,1669075200"; d="scan'208";a="292221146" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-pdx-2b-m6i4x-32fb4f1a.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-6002.iad6.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2023 21:27:04 +0000 Received: from EX13MTAUWC002.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2b-m6i4x-32fb4f1a.us-west-2.amazon.com (Postfix) with ESMTPS id CE22BC3759; Tue, 31 Jan 2023 21:27:00 +0000 (UTC) Received: from EX19D020UWC004.ant.amazon.com (10.13.138.149) by EX13MTAUWC002.ant.amazon.com (10.43.162.240) with Microsoft SMTP Server (TLS) id 15.0.1497.45; Tue, 31 Jan 2023 21:26:58 +0000 Received: from [0.0.0.0] (10.43.162.56) by EX19D020UWC004.ant.amazon.com (10.13.138.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.24; Tue, 31 Jan 2023 21:26:50 +0000 Message-ID: <854a0caf-6940-8381-1e20-0ddb5ed94858@amazon.com> Date: Tue, 31 Jan 2023 22:26:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH RFC v7 16/64] x86/sev: Add helper functions for RMPUPDATE and PSMASH instruction Content-Language: en-US To: Michael Roth , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Brijesh Singh , "Rapan, Sabin" References: <20221214194056.161492-1-michael.roth@amd.com> <20221214194056.161492-17-michael.roth@amd.com> From: Alexander Graf In-Reply-To: <20221214194056.161492-17-michael.roth@amd.com> X-Originating-IP: [10.43.162.56] X-ClientProxiedBy: EX13D31UWA004.ant.amazon.com (10.43.160.217) To EX19D020UWC004.ant.amazon.com (10.13.138.149) Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: base64 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Ck9uIDE0LjEyLjIyIDIwOjQwLCBNaWNoYWVsIFJvdGggd3JvdGU6Cj4gRnJvbTogQnJpamVzaCBT aW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