From nobody Thu May 9 05:02:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613757697935460.1365842477129; Fri, 19 Feb 2021 10:01:37 -0800 (PST) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-107-f2Wjbj_pMDCWZcUkcRReIw-1; Fri, 19 Feb 2021 13:01:35 -0500 Received: by mail-wr1-f69.google.com with SMTP id r5so2814540wrw.10 for ; Fri, 19 Feb 2021 10:01:34 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id b2sm14228211wrv.73.2021.02.19.10.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 10:01:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613757696; 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: content-transfer-encoding:content-transfer-encoding; bh=jUKNG8Djdou3sGVcUuI9zKgMd4UMFqzDXK1u676GNx4=; b=DJm35r+OGMJbEs66kHWuyOOYuzT60NQI/AeB72OJsxiY7qCqzzBnPAHm99hzbtw9kruq43 id14N6dBmeuiJxDY7jabB/HnEz3hiod6LNd4V4EBNxQ8CD2FC7BYOdTdhVM1u/c3A7BppN IJy6AhOwoM0KWxyRwFKiF8aVNdBzQY0= X-MC-Unique: f2Wjbj_pMDCWZcUkcRReIw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jUKNG8Djdou3sGVcUuI9zKgMd4UMFqzDXK1u676GNx4=; b=rMIY0ZXt/cBvBSRn4TOstYdqPSkCv3ZD9JRMd/1ndYYoEaMRy8AHoSoQfLSRFttCIj YUm4MWg/GznVweloPwqVgFKtkeRVeNl2Xi69jPLL1wXgSraOtjce+GUZrYyNmoQC7nTy jwkEjIwmecMPpwFDbteyCv20+LW1cttsdXn4ieAwP08pyJxZR2RN4IUMxscEN1rQoau5 4ShlM3RQPp6Ut0aE9ycW+UYW7vTAyXulesjlZNJSuMnHgTK98+bW3daD/Q4lc0qBnFqo FYN0GvOPMxo90t9PnMzE0R3bdLCHkyKXzh9SqWcJSHhX3ttbTrPkjDlVUvwLGaqnyZd1 Lang== X-Gm-Message-State: AOAM532wavX2MiVise/R25ZRo/lZNZmOnEk1pDTh8blRvXTY7/P3mXs1 ynY5YkvXhimJsKK8g4mt9sOOxmnBnPhqoyEAaUr1LVX36F1HPlC7noO3nys/p1MXlBSLq2S/pGN HIWyiSlPmGmVzCg== X-Received: by 2002:a1c:f604:: with SMTP id w4mr9397086wmc.39.1613757694026; Fri, 19 Feb 2021 10:01:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvN2ze111U1eV6JmmN6UZGpITIuk+56fAWPDeubnOR5xpasEP0qzj1szQwohw+Abp1nBPTbQ== X-Received: by 2002:a1c:f604:: with SMTP id w4mr9397063wmc.39.1613757693848; Fri, 19 Feb 2021 10:01:33 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Connor Kuehl , Brijesh Singh , Tom Lendacky , Eduardo Habkost , Richard Henderson , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH] target/i386/sev: Ensure sev_fw_errlist is sync with update-linux-headers Date: Fri, 19 Feb 2021 19:01:31 +0100 Message-Id: <20210219180131.2061072-1-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Ensure sev_fw_errlist[] is updated after running the update-linux-headers.sh script. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Brijesh Singh Reviewed-by: Connor Kuehl --- Based-on: <20210218151633.215374-1-ckuehl@redhat.com> --- target/i386/sev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 37690ae809c..92c69a23769 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -87,7 +87,7 @@ typedef struct __attribute__((__packed__)) SevInfoBlock { static SevGuestState *sev_guest; static Error *sev_mig_blocker; =20 -static const char *const sev_fw_errlist[] =3D { +static const char *const sev_fw_errlist[SEV_RET_MAX] =3D { [SEV_RET_SUCCESS] =3D "", [SEV_RET_INVALID_PLATFORM_STATE] =3D "Platform state is invalid", [SEV_RET_INVALID_GUEST_STATE] =3D "Guest state is invalid", @@ -114,6 +114,8 @@ static const char *const sev_fw_errlist[] =3D { [SEV_RET_RESOURCE_LIMIT] =3D "Required firmware resource deple= ted", [SEV_RET_SECURE_DATA_INVALID] =3D "Part-specific integrity check fa= ilure", }; +/* Ensure sev_fw_errlist[] is updated after running update-linux-headers.s= h */ +QEMU_BUILD_BUG_ON(SEV_RET_SECURE_DATA_INVALID + 1 !=3D SEV_RET_MAX); =20 #define SEV_FW_MAX_ERROR ARRAY_SIZE(sev_fw_errlist) =20 @@ -160,6 +162,7 @@ fw_error_to_str(int code) if (code < 0 || code >=3D SEV_FW_MAX_ERROR) { return "unknown error"; } + assert(sev_fw_errlist[code]); =20 return sev_fw_errlist[code]; } --=20 2.26.2