Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp357178lqs; Thu, 13 Jun 2024 12:02:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX3GX5geOCbS1lXTmA0ZiBLyRIWBUzTDyEvCrsj90iF9Zy5TRWEJMUhlwQF2N00yDXbpknMLLeFh8U7X+iHF8vAhSNlKTyqzET0QFnm6A== X-Google-Smtp-Source: AGHT+IFhi6xm5/XDLBcLJ7mywQLKV4FSGs2ABvPvyDEfAXsiykV7wln2m3hlzdGCd8Dl2XTqH18s X-Received: by 2002:a17:906:fa15:b0:a6f:48b2:aad4 with SMTP id a640c23a62f3a-a6f60dc89a5mr48259166b.50.1718305322290; Thu, 13 Jun 2024 12:02:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718305322; cv=pass; d=google.com; s=arc-20160816; b=DGnwWen5iEZdYqOLwvurnKARArwVAxW4Zb/OHo0leBvFu2TGbhwCh69hMKQFIVIgc0 vpte2IUjA6pJDIyoVU8XQ5BVb67h0S5XgWKbnnZJPTY4kB6RbhIJAN1fqjV9GRy3pjm1 WFJCcJ+Wc0E29C/A0RQLRQcq0dATNUzk91tUq8iwA3Oqa9KXAVi3kyIWFtLHU2Vh4jhj yVe+njzrY+LcVNCPWyeQGIvQTPIwO8cS7s+yZhYFrKrDTWDyDgBfA2l27uF5qGtkaf/N O+tth6kAiELbay4ZIkmO+aLN+WEH9faIQ2SHbXreOufrhW7Fi1R5fJM0X1Y1vZVVfiwX cYOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:reply-to:dkim-signature; bh=4scoAI3xWobVP6E+XRq1RKOC326O2un8fjhuaP6CeHI=; fh=p+C6IMvwzsI4CBLUN3CaqWddwaRTo4ZUElNTiJFammE=; b=yZSqco95cfoqyWnKsRGaN30sgo11+TgQmyG8DVENA8xIGfMVEghJ8J0bP9xgCSyEUJ 07JgLVhXPCXADqo+bleRx3VHN8s1URCB9TQ3fyjV6mZiouDUGy1edsawwyqwzhcqV+rW EKkfj6xWZWajvDF51va1hE2qRs19umxOrRXSlfMPTfGW0G3GsR/9x7KDPgkZtM+SLH1U IkUHzStjx+sM/tZsRj0WL9Ywak2oc6cckhnI+lZVrOOf/VTUnAywa0zu8IwS1LzXm7Av 49D+ciHlmTG0AexNxNwEUAwDf2Tt+ZeTJbaS74z+mEbs8/ndxHiCwOfynb+fervWdd5b OzEg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=qYca01sR; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-213879-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213879-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56dd69aesi99375266b.458.2024.06.13.12.02.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 12:02:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213879-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=qYca01sR; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-213879-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213879-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 000671F24353 for ; Thu, 13 Jun 2024 19:02:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69067153567; Thu, 13 Jun 2024 19:01:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="qYca01sR" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (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 1A95114E2E7 for ; Thu, 13 Jun 2024 19:01:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718305269; cv=none; b=dvrgRqRQuMOE3JjBFU/uf2k3KXTRz8iy5yqDv4HNMQW+kDsNVKexghrhgJNAJftAHniuxE4IW9ZzEnJiMgnnWnfSgGNPEbkfXhZjEyqQ0lD1o6DKD5tJOuKLc0VVL4mvGRVeaqfasGqDEq/2pgViy4fTQ6+NwP1XC+3HciyiSTc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718305269; c=relaxed/simple; bh=EdM3NFAHtqf7iO6j5P+sTJg6E55g7ZvNba3lzMdLcdE=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=IvOeean247zFzudNJNgd+HHAS38mdS2tarX0jz2Z7TYyKWi16/tqo9KS7TP0jiNVTmd39yM7RCXzxrof9kg4WUYqFw7xSMaevJuVcnyuZjAtHEUlJzpNSZ1NQzV09UWehBMXlP9KTE9LkCh9kuavgnqIL7gVmjH8ikWqw1eAu9I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=qYca01sR; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dfef7ac17f8so1729584276.1 for ; Thu, 13 Jun 2024 12:01:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718305266; x=1718910066; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:reply-to:from:to:cc :subject:date:message-id:reply-to; bh=4scoAI3xWobVP6E+XRq1RKOC326O2un8fjhuaP6CeHI=; b=qYca01sRmt9Aj9brAT+UPLIs7l0+oYKqRqCdLIFggseMPqFNIvCGdQKYzu3G6LkuRf /6IXUddcTmCvfrhLk+OKM7VPwHlga6pXoBhVev3J9CEn50qyZH9xA/OERr0AIXYu6eIQ HmN4mVEDGQ0om0bLFmUIQ+HOtvgfhTZIZXW4sqfy9LGH+TmTT/5zm5gZdAsMFzLFPb5N LgD1sRo3jvYXQCoQKfsuerzbTFNBITMNqF1S1cyT6Rec4SVBYlkdWiP1MuowViX/IV3b zjWyZzIlgbu0CeJqHuQXKILlTCfXw0sitpV+e2bA+HCL1XqxFyzeMx47UUnk3i2cf/S7 /XIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718305266; x=1718910066; h=cc:to:from:subject:message-id:mime-version:date:reply-to :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4scoAI3xWobVP6E+XRq1RKOC326O2un8fjhuaP6CeHI=; b=QqaXOQS0s3thypNHq9+/0aQ0Lf1UfYE6H3fZQkDnU56G6/E3rlDFH6S4Uo5hVfvKMB LlUo/HBEjNBIUuk/tCTS8UGeU3kiv5OX0qG38c/kEv7IAVuvYzErjTHndR8I/oc8kOYY zSYHr1cyY5+4g/A/kOLcqMkoSmjQRwg8BGEOwqmia/9FQUdeTMEIyjHS8p570U67SSGE xMM43Ve28MNOHkyZwU31xE2Jj1H/RXXRrBVVH2+dEWFu21ytFS5KPxdWFOXtIXiTDxI3 nhdX9vm0eDUQN1VuCvuF/y215bUPjS+GckynOIVxrH3T+9w3/qOlLpHvC9GNDgsXQOIS SJTg== X-Forwarded-Encrypted: i=1; AJvYcCUmoXHCaYomXCmdYYnMXDIbTasaaLYNW6B8ZCzLt4EIpS5/YAdGPJvC5rZszZnkh4p+qHHkH9z/xMGdJJmw+CYA6seiIn2UCk9ZOzZ+ X-Gm-Message-State: AOJu0Yx0Vg6gk1xN1nDa3k/O1Of7P/9rqvQU+CDVgCDPoEsndvmRTpV8 B9DeVxnqy8s/OmrarimZT25NRQ4EAmkJOetzvDfxkmFksyWw7OWJFyvyaTmiTSb0db/XV5M7WkD aDw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:bfc7:0:b0:dfa:ff74:f262 with SMTP id 3f1490d57ef6-dfefed12278mr647712276.2.1718305266142; Thu, 13 Jun 2024 12:01:06 -0700 (PDT) Reply-To: Sean Christopherson Date: Thu, 13 Jun 2024 12:01:03 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Message-ID: <20240613190103.1054877-1-seanjc@google.com> Subject: [PATCH] KVM: nVMX: Update VMCS12_REVISION comment to state it should never change From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Jim Mattson Content-Type: text/plain; charset="UTF-8" Rewrite the comment above VMCS12_REVISION to unequivocally state that the ID must never change. KVM_{G,S}ET_NESTED_STATE have been officially supported for some time now, i.e. changing VMCS12_REVISION would break userspace. Opportunistically add a blurb to the CHECK_OFFSET() comment to make it explicitly clear that new fields are allowed, i.e. that the restriction on the layout is all about backwards compatibility. No functional change intended. Cc: Jim Mattson Signed-off-by: Sean Christopherson --- arch/x86/kvm/vmx/vmcs12.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/vmx/vmcs12.h b/arch/x86/kvm/vmx/vmcs12.h index 01936013428b..56fd150a6f24 100644 --- a/arch/x86/kvm/vmx/vmcs12.h +++ b/arch/x86/kvm/vmx/vmcs12.h @@ -188,12 +188,13 @@ struct __packed vmcs12 { }; /* - * VMCS12_REVISION is an arbitrary id that should be changed if the content or - * layout of struct vmcs12 is changed. MSR_IA32_VMX_BASIC returns this id, and - * VMPTRLD verifies that the VMCS region that L1 is loading contains this id. + * VMCS12_REVISION is KVM's arbitrary ID for the layout of struct vmcs12. KVM + * enumerates this value to L1 via MSR_IA32_VMX_BASIC, and checks the revision + * ID during nested VMPTRLD to verify that L1 is loading a VMCS that adhere's + * to KVM's virtual CPU definition. * - * IMPORTANT: Changing this value will break save/restore compatibility with - * older kvm releases. + * DO NOT change this value, as it will break save/restore compatibility with + * older KVM releases. */ #define VMCS12_REVISION 0x11e57ed0 @@ -206,7 +207,8 @@ struct __packed vmcs12 { #define VMCS12_SIZE KVM_STATE_NESTED_VMX_VMCS_SIZE /* - * For save/restore compatibility, the vmcs12 field offsets must not change. + * For save/restore compatibility, the vmcs12 field offsets must not change, + * although appending fields and/or filling gaps is obviously allowed. */ #define CHECK_OFFSET(field, loc) \ ASSERT_STRUCT_OFFSET(struct vmcs12, field, loc) base-commit: e4e9e1067138e5620cf0500c3e5f6ebfb9d322c8 -- 2.45.2.627.g7a2c4fd464-goog