Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp525760lql; Mon, 11 Mar 2024 09:26:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCViOVkewflk+dFF0IKWJuJSvzqXaCmhYBSkM5nGIlylKp9u/lUziKbudQEtK3r1cgXyAMXV56RlJ1mSD7l9rOFu/ca45NMamNNXg3kj/g== X-Google-Smtp-Source: AGHT+IHlH7OnHP9xrX2/ucbu3f+bdmcLS/b891oVGYWvV/2UIMPihmyojwYpGGnQNMm2U/tSpYmO X-Received: by 2002:a17:906:b14e:b0:a45:c694:98ae with SMTP id bt14-20020a170906b14e00b00a45c69498aemr4585232ejb.20.1710174411284; Mon, 11 Mar 2024 09:26:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710174411; cv=pass; d=google.com; s=arc-20160816; b=rCsydz0pUob6o6nD2SGnOlF2+A5cu6XNjI5pBhNfSIhd8/CN6sz091WER84Peu0Ndd rRw/YUB5QAKhSCseKF4bXn4HuzX6eqeeP4F2YrGylokSGplRqJTZKq22lJclhXNkiZu6 i6KaAYIFfW75tNzvZmH6Wnl8LkM8Cq27mbFOciJyuF5hvww1MnCOkQPRRSKOIQxVJCy3 erBBX+PvpJGoLUHq+KqVigldLdksUQH7wv7IQmcMxYc3xwor5glAU/KzGjqFf2sFOkyA lXPl/LHE6ZWn4xtWY1wwne/w0orCoU5JZtXACJ3nz5L3M9BGwMAW6Gj7devDfTtA7BM6 hqtA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5lx7gS4QP7mPyluL8Zu2ZDhyswvsRIpNUouI6tZofm4=; fh=fHaClwaPPpPdr8uCUlki92DJPPWil0KbQ/MTJ5zbNBA=; b=MH9cHbakVzKQn7Xp65tt3KuKJRdkulbZ/yEbVwq07TZ1TXnYWJ0Y6aHsEpF4NjiMTY 2kVsLp1vA8dRzxBz+l8obfCpviU+0s0pdYd+ztoEmjCen2kN1OJV/Uv2sVkUPHl7qOo4 HBqlUlKZ/hlhkIjN/q2P/j6ixDxfFyf9jlwdx2ppjJoM6E8x+rtQj4YqQibeqz0WQ81A yw+kEdoLe0TraHH2vQBpcX/6FcydIt9rU488gAjdKTAQp9TYe+Mz4pFFOt7kNZB7zSfs UKv45gCBqq6ShZN/DjhhxazT5iYFj4PyjnUACLYtcVClaSyhgFyg+njoCM5Ev8T/LX+0 s38Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hu3x2ARb; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-99207-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99207-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id va26-20020a17090711da00b00a462cc1d339si839051ejb.79.2024.03.11.09.26.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 09:26:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99207-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hu3x2ARb; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-99207-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99207-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A32211F25487 for ; Mon, 11 Mar 2024 16:19:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 787E554BE4; Mon, 11 Mar 2024 16:17:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hu3x2ARb" Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5B0F4AEEB; Mon, 11 Mar 2024 16:17:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710173862; cv=none; b=sfN6d8wy0n2xiLoLjddo8QQCfsxt4cvEUzQFtwv+/fqHBqaJhsNZtfxvWwUxUUP9PNiYh6LgPFu81H4HO24G8fsViIwsI/amttNuryKp/9dC0YY4Lb0aGYSJndUIjdb3QWjfy1/UtkXIysT/sNkyW56GdV5WzokgvND1APAVFpk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710173862; c=relaxed/simple; bh=jc/74af7NZP+cpnNw9Qk/swCgD9N+vE+d+7fUoVN8BQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FC10n4G1PunPTd2CDY2S0Rb+HS8N8y894uAZ3iUcQrxqUJi+xBRR7D6bm59z5mfJyJFyuKGIRsVFowVRWTcObBx+oBjFqQea3r1xCr8pUIut9TSYrlmBieHN/TcT0Yt6IL7LamH4tvuwMLlLe/8ngEtvT8PKSLJ4i7Gz5mcoKu0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hu3x2ARb; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-41329b6286bso6405965e9.0; Mon, 11 Mar 2024 09:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710173857; x=1710778657; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5lx7gS4QP7mPyluL8Zu2ZDhyswvsRIpNUouI6tZofm4=; b=hu3x2ARbKuFk0x8qS0yhYQLDagcNnaR9uC2JiOONiZZGTXe1PiXPt27/PdwYKhjb55 ogq6GExPiOqx9fjo+jtQQHsiw0ldXBjGYt4Q6WEvqJ1iSrzYjqcwMJTtaihT2oSCQswi 6E7BxJzl1l5VfCRn9T+xagPzRRZpXLtmOOh59FLIpkSqTASaEgaiQ8Gw8EY4nqYW4HLt S4vJsDOQBMQUZdyTWR+P+0CqyWihHhvYYISjHvSUteG3ZSVFIm9JyM2VZWzEHPzzxE/k VzKklJLCMlwrWfTrvI9Hrz5bv0z+ReGJGaAi+Lfj0nehGheIbhy8AGNzeDfgXR6UiPZK 35Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710173857; x=1710778657; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5lx7gS4QP7mPyluL8Zu2ZDhyswvsRIpNUouI6tZofm4=; b=aKdydyQR7I6cdaUmZy6DaPrtw/xHO+EVWKIc7gYf+kT+F4mi10W5cJpYT/EJjzVoLg pke9vT3O+UxzND/u5jjBYP79rhh7gtellbAClJr28HbnV1tfWsGe7x8hUlobMXfk/ka/ CsLaV2LvfB5uNsA45DuE8FVHJwQtaGowRSZIcGBYcVyL05E6O3ifh78lzZXN6R09EoeN DGTEljoLFXUm92BIyA5ammWNdVG1Ff2uLUE0I2uIMF02psdvt391eULEcTuiH7Bz+dDU gPdO9g2YyHSMslYku5jlby0NrdpVOiqST/gWFhOE6a9NXdUikUDDvsGZgIUl0bvl9hal jVxQ== X-Forwarded-Encrypted: i=1; AJvYcCW4D22VGkaJrztZzfJJW5Yj8KDvcWKV2LrYbAEN0HbvyYERkj/IvdVkzfTOGmDSh5gIBbyh7XTE+Uhm35BFveU04fiW6BdE/zsjZz4hu9D/gf68tbQGLm6hO3/9dziM/XC+bxvaXkcTEKLi9xIRm0w9cViZJDjiZRlp X-Gm-Message-State: AOJu0YxcfQ9Ot6PQUG7PauIIiL1Gnnij2WqH4wlLjef50hSxoBtkurhH OauGbhTdURkA65cXXCNaogz3bRzsdUhWkYKmMuWenxajj32Yv3PU X-Received: by 2002:a05:600c:358c:b0:413:18e7:2388 with SMTP id p12-20020a05600c358c00b0041318e72388mr4922789wmq.27.1710173856688; Mon, 11 Mar 2024 09:17:36 -0700 (PDT) Received: from vasant-suse.suse.cz ([2001:9e8:ab47:8200:c3b9:43af:f8e1:76f9]) by smtp.gmail.com with ESMTPSA id ba14-20020a0560001c0e00b0033e96fe9479sm2823815wrb.89.2024.03.11.09.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 09:17:36 -0700 (PDT) From: Vasant Karasulli To: x86@kernel.org Cc: joro@8bytes.org, cfir@google.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, ebiederm@xmission.com, erdemaktas@google.com, hpa@zytor.com, jgross@suse.com, jslaby@suse.cz, keescook@chromium.org, kexec@lists.infradead.org, kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, luto@kernel.org, martin.b.radev@gmail.com, mhiramat@kernel.org, mstunes@vmware.com, nivedita@alum.mit.edu, peterz@infradead.org, rientjes@google.com, seanjc@google.com, stable@vger.kernel.org, thomas.lendacky@amd.com, virtualization@lists.linux-foundation.org, Joerg Roedel , Vasant Karasulli Subject: [PATCH v4 3/9] x86/sev: Set GHCB data structure version Date: Mon, 11 Mar 2024 17:17:21 +0100 Message-Id: <20240311161727.14916-4-vsntk18@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311161727.14916-1-vsntk18@gmail.com> References: <20240311161727.14916-1-vsntk18@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Joerg Roedel It turned out that the GHCB->protocol field does not declare the version of the guest-hypervisor communication protocol, but rather the version of the GHCB data structure. Reflect that in the define used to set the protocol field. Signed-off-by: Joerg Roedel Signed-off-by: Vasant Karasulli --- arch/x86/include/asm/sev.h | 3 +++ arch/x86/kernel/sev-shared.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/sev.h b/arch/x86/include/asm/sev.h index 5b4a1ce3d368..c48db0bfb707 100644 --- a/arch/x86/include/asm/sev.h +++ b/arch/x86/include/asm/sev.h @@ -20,6 +20,9 @@ #define GHCB_PROTOCOL_MAX 2ULL #define GHCB_DEFAULT_USAGE 0ULL +/* Version of the GHCB data structure */ +#define GHCB_VERSION 1 + #define VMGEXIT() { asm volatile("rep; vmmcall\n\r"); } enum es_result { diff --git a/arch/x86/kernel/sev-shared.c b/arch/x86/kernel/sev-shared.c index c02a087c7945..6adae48c501f 100644 --- a/arch/x86/kernel/sev-shared.c +++ b/arch/x86/kernel/sev-shared.c @@ -257,7 +257,7 @@ static enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb, u64 exit_info_2) { /* Fill in protocol and format specifiers */ - ghcb->protocol_version = ghcb_version; + ghcb->protocol_version = GHCB_VERSION; ghcb->ghcb_usage = GHCB_DEFAULT_USAGE; ghcb_set_sw_exit_code(ghcb, exit_code); -- 2.34.1