From patchwork Fri Nov 4 20:16:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dionna Amalie Glaze X-Patchwork-Id: 15781 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp618512wru; Fri, 4 Nov 2022 13:19:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7K+HTT3xAzOxhMD3EhULW4MehorfsOzVfm+7KaXlvD5Rb5cPHNF5rfxwEWKrJ6YTILnZVO X-Received: by 2002:a17:907:a087:b0:7ae:45f2:bf2d with SMTP id hu7-20020a170907a08700b007ae45f2bf2dmr1014587ejc.456.1667593187194; Fri, 04 Nov 2022 13:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667593187; cv=none; d=google.com; s=arc-20160816; b=aN4+BA5pidFEaGf9tDTM6vhoKItYH408DcU9598LznNEk3p4rY3jYzWfVW0SM/k+25 GAZ8rvTz7lWsflVacQhi3vezxpl4jAhh2Bs7jWHs7bH7BdTHuUC9eA/1Cw1OHYrqj/6L ptMoPqHKEok8/6HfRUqCZLcKfIdLqRBYCPA+B4LKWB6QzjtFfOkx26dbR4RV1Ip1rxkO a76sry91CRQrmX8UNleOyO0xXwsUOUd/4aeYSSw8ddo+9qdI6C4pY2y4Eap1yypo+gih 2bvq91MqCiyQcX0Vl+sIQfhzqTJGUwjXBbepFp4t8DgQ98xjyBetnLrmpe53hbGGW3xk VDwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=vzksqxZzngSMnVq4LNIxjbY1eQuHqjVmZsqNyLkHpLQ=; b=MmP4eJ0MM80PCYvy/BR09L1psaJLvpWPD0ZjpQk1nKjAyEFhmwPFiBen3xt4ox2O6h x5AxGExIWzOvGTrdW8LH1GIaJr7q9iUusbIX34I+8TkXn0AslE9tx33eNzKuNLP7ajCp XOdOzI9Dqr3vM9ou5BBvShL4u9Aehk6unHV13sLVXs/AkN4YAG5QOxN/E/JfzrOSMXa2 SbhrmrLr4yObc1ImXY/505guBaFd5AN46pFDUT0zsr+HqBoPHNKdifsZ9stwOFgqPne4 xAh/HiXra4p/6jqBwiNURn+BnHYw91s8hDvOl3MocbHwwkvlxA1G0YvHee8F8NnLr1Bz tYuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=jhPIbPD5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb15-20020a170907960f00b0073dcb2ec4d2si5311613ejc.889.2022.11.04.13.19.23; Fri, 04 Nov 2022 13:19:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=jhPIbPD5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229909AbiKDUQc (ORCPT + 99 others); Fri, 4 Nov 2022 16:16:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbiKDUQb (ORCPT ); Fri, 4 Nov 2022 16:16:31 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A14D45ECA for ; Fri, 4 Nov 2022 13:16:30 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-3697bd55974so55304827b3.15 for ; Fri, 04 Nov 2022 13:16:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=vzksqxZzngSMnVq4LNIxjbY1eQuHqjVmZsqNyLkHpLQ=; b=jhPIbPD5BQTq81GOSTK237jTlF2fdO6oPYPy+cM2vMFS3sS/w17VHxLXqWaLre2baw Dg7vRG1TECmSbDjloLx5MYR0wTohEYRdFSI6Le9y/hLxMWYStbgHTcS/8BEY0Mye6mQM 5RcisHx3NbfpWxsqiQ73t9SFwtfVCqnRVuNd39fTiWo93R/G3mXGXiaoqMQS7qT7C49Z /RffMJbCcphU6MVtcGMdXHMCWzCx/6NfqoO7JfmYlrdAkYtyB7WlsWnIPM+KAVphsdCM +9Rbm6jEmHJa6iqME4PmT4m0vVBdJGcKfoL+JYMwGtFUikhaeAxiyeEr0rPSJSvn+bNu R+6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vzksqxZzngSMnVq4LNIxjbY1eQuHqjVmZsqNyLkHpLQ=; b=6bx/LiigbMv8R+oAgDzxAPgUAVPtRaf0sSTJD6E/l4GJCh2zEpvR3KHOvnxwAwQiVN qBfdXRV36QH5/NbXaL8ifv9QObe/jlxqluUum0CNkq5q6K/s6MTNCcMl9rwndeMhPsHF 4dFjDMRo7gizRLLDydULrECouafHGCePQCJcvr9twXfnueUxR5yV+szTyPOip/KIG8lD fBLKIdgOGg4xcpe1VK1MZWYhl8rbxvdMUb0lYFYcEzcmDrfHt5DSu0vGjGWXbsTYQs/W KfM07+vNSQu8v1CYkgf0ttEYDQQ3mS54VX6zhY2xjBCikcxoDiH6s6s0r9P96oHJ40sA NQRw== X-Gm-Message-State: ACrzQf1FYV5PiRchYe5NcQWN6UkQumtzOWCXWMMhANjkMashHGasGdem MfgkMHN390RanhculwZFRkPzNlEjCpe+iYYMtCcnk+uyRRUAWQl3Pv0tmwLx8GxQhgd5gqjTrHf 7VM3pBjoTn/yJ4Orc5PtHLIxtzoLn/jIYD2MpRt0OGIDJJ0PNlYd+kM9asWFiakSXBtmH/Xlgpm gl8kgsamg= X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a25:9d11:0:b0:66e:4fad:e153 with SMTP id i17-20020a259d11000000b0066e4fade153mr35592854ybp.484.1667592989294; Fri, 04 Nov 2022 13:16:29 -0700 (PDT) Date: Fri, 4 Nov 2022 20:16:13 +0000 In-Reply-To: <20221104201616.2268815-1-dionnaglaze@google.com> Mime-Version: 1.0 References: <20221104201616.2268815-1-dionnaglaze@google.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Message-ID: <20221104201616.2268815-2-dionnaglaze@google.com> Subject: [PATCH v7 1/4] crypto: ccp - Name -1 return value as SEV_RET_NO_FW_CALL From: Dionna Glaze To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Peter Gonda , Thomas Lendacky , Paolo Bonzini , Joerg Roedel , Ingo Molnar , Andy Lutomirsky , John Allen , Herbert Xu , "David S. Miller" , Dionna Glaze X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748598193537928910?= X-GMAIL-MSGID: =?utf-8?q?1748598193537928910?= From: Peter Gonda The PSP can return a "firmware error" code of -1 in circumstances where the PSP is not actually called. To make this protocol unambiguous, we add a constant naming the return value. Cc: Thomas Lendacky Cc: Paolo Bonzini Cc: Joerg Roedel Cc: Ingo Molnar Cc: Andy Lutomirsky Cc: John Allen Cc: Herbert Xu Cc: "David S. Miller" Signed-off-by: Peter Gonda Signed-off-by: Dionna Glaze --- drivers/crypto/ccp/sev-dev.c | 2 +- include/uapi/linux/psp-sev.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c index 06fc7156c04f..97eb3544ab36 100644 --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -444,7 +444,7 @@ static int __sev_platform_init_locked(int *error) { struct psp_device *psp = psp_master; struct sev_device *sev; - int rc = 0, psp_ret = -1; + int rc = 0, psp_ret = SEV_RET_NO_FW_CALL; int (*init_function)(int *error); if (!psp || !psp->sev_data) diff --git a/include/uapi/linux/psp-sev.h b/include/uapi/linux/psp-sev.h index 91b4c63d5cbf..1ad7f0a7e328 100644 --- a/include/uapi/linux/psp-sev.h +++ b/include/uapi/linux/psp-sev.h @@ -36,6 +36,13 @@ enum { * SEV Firmware status code */ typedef enum { + /* + * This error code is not in the SEV spec but is added to convey that + * there was an error that prevented the SEV Firmware from being called. + * This is (u32)-1 since the firmware error code is represented as a + * 32-bit integer. + */ + SEV_RET_NO_FW_CALL = 0xffffffff, SEV_RET_SUCCESS = 0, SEV_RET_INVALID_PLATFORM_STATE, SEV_RET_INVALID_GUEST_STATE,