From nobody Sun Sep 28 00:35:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561082757; cv=none; d=zoho.com; s=zohoarc; b=ZD8R15t5V++Flm9nnjvw+YWuZcg0+g/MI5fZ03b/H4torGVddNcTFJ9PZpygk47Ww7o0xAc4ISlWluFVgRHAXhcJtlgCMCCFx4OP+GNLuPSn9EJRTb9/vm4eXQ/BoiQ11jBYUNN7PB1yhC0yK8MLImzdyE3azluxSFhITRwXjxU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561082757; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=46R01TlppRnc8fuF4nJaB/BSCYQl7BxcBYUaCW1Ujrw=; b=BAnIRegj1+BvnMocdT3h7Fgjwa/ZT9OewZWlpqkPqN3Q0/UQNp94mwOeQpUgn5ARPjaBFPMYI5lIEmF5rs5a/ppAt9PFb+54M3RAkyiv+SFWHOPo/qSgwtxsdJzRa/XT63+mErXmEc+zVStgvVveF4o/Xb9mErCSroD8vOTgrok= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561082757827578.7580275852184; Thu, 20 Jun 2019 19:05:57 -0700 (PDT) Received: from localhost ([::1]:54122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1he8vr-0003pG-9k for importer@patchew.org; Thu, 20 Jun 2019 22:05:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41303) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1he8a6-0006ff-Ns for qemu-devel@nongnu.org; Thu, 20 Jun 2019 21:43:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1he8a3-0006ga-Rn for qemu-devel@nongnu.org; Thu, 20 Jun 2019 21:43:10 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:52852) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1he8a3-0006M9-2h for qemu-devel@nongnu.org; Thu, 20 Jun 2019 21:43:07 -0400 Received: by mail-wm1-x341.google.com with SMTP id s3so4799244wms.2 for ; Thu, 20 Jun 2019 18:42:51 -0700 (PDT) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id d1sm1123125wru.41.2019.06.20.18.42.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 18:42:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=46R01TlppRnc8fuF4nJaB/BSCYQl7BxcBYUaCW1Ujrw=; b=MENpUo6m/sczgfCCCcszpwTluR0UbTdC0PihwUoCoqOrXslTn/td3BTF7BkGsSLZub T5TMBs3u4KNfeSGopIs/Nu7/wi1TqfxHjxFxDyNsvL2IYBs0ZmOS3jOtGwJ8oREsq/dr bH4aP3+6WqbskLuUoxECVzvzDE+1b1OogY9sls72TpYFYWkZLIphxcmb8G8FndEZU1Rt T2xEkAMznTnU5mI70+bK3ZnD/+dWAqfttnUK1yHxhZp+2j4qW8fsOn2cZ2zjjh29zwuG Fto8R6VF6GYHF7q9Yxp4zFjCECRUQ2pA5qhh4MZOGbAH8a9BG7NxZQvt55iez+maftO3 642Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=46R01TlppRnc8fuF4nJaB/BSCYQl7BxcBYUaCW1Ujrw=; b=fIUiToMJaT9Z4bCxjLu8GPVaQrN/Eycz/lBJzsrsgIuFt4B+WyGfGbd1/gLhi1pkn6 euqu/dfSN9j5hXFDSt0rD7tHrvV1qc8sNlGkX8vdu3FPmIiTPLAzE/k3F7wbiLUS111+ HmKup+v0REAeXP/NeXt9zaWa9A6uaaJshS9cniZYCwaLzUbt6Ev/HOaEcyarFLJyp78h daEJ2YuMLZtgpIcvnAQ5zk1/sJLygX3l7oH/kAUst+UdVAZ080DiIUxRBjjkJP1WkSVS oc9iqzpVbrZED/NM1dctNNPb8A/4Nezm244GLCly9iZqhwqjSAwkShF0+7cHN3lGC8Kh 3Szg== X-Gm-Message-State: APjAAAWGSZuceH8fg1uwLwXnPLXJdIhoBQdm6yFzfM3CXjC21TRtnFa5 dhGsagH7y69LziAAOinIjGoVOlXD X-Google-Smtp-Source: APXvYqyx2FZeCbmS7/8zGl43YD1+arX4ZLYQwI+I89tAUJEaAdtcgR47EPUUD+IaX7/rDGs6US4vRg== X-Received: by 2002:a1c:b155:: with SMTP id a82mr1440682wmf.35.1561081370758; Thu, 20 Jun 2019 18:42:50 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 21 Jun 2019 03:42:23 +0200 Message-Id: <1561081350-3723-19-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1561081350-3723-1-git-send-email-pbonzini@redhat.com> References: <1561081350-3723-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PULL 18/25] linux-headers: sync with latest KVM headers from Linux 5.2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liran Alon Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Liran Alon Improve the KVM_{GET,SET}_NESTED_STATE structs by detailing the format of VMX nested state data in a struct. In order to avoid changing the ioctl values of KVM_{GET,SET}_NESTED_STATE, there is a need to preserve sizeof(struct kvm_nested_state). This is done by defining the data struct as "data.vmx[0]". It was the most elegant way I found to preserve struct size while still keeping struct readable and easy to maintain. It does have a misfortunate side-effect that now it has to be accessed as "data.vmx[0]" rather than just "data.vmx". Because we are already modifying these structs, I also modified the following: * Define the "format" field values as macros. * Rename vmcs_pa to vmcs12_pa for better readability. Signed-off-by: Liran Alon Reviewed-by: Maran Wilson Message-Id: <20190619162140.133674-7-liran.alon@oracle.com> Signed-off-by: Paolo Bonzini --- linux-headers/asm-x86/kvm.h | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h index 7a0e64c..6e7dd79 100644 --- a/linux-headers/asm-x86/kvm.h +++ b/linux-headers/asm-x86/kvm.h @@ -383,16 +383,26 @@ struct kvm_sync_regs { #define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2) #define KVM_X86_QUIRK_OUT_7E_INC_RIP (1 << 3) =20 +#define KVM_STATE_NESTED_FORMAT_VMX 0 +#define KVM_STATE_NESTED_FORMAT_SVM 1 + #define KVM_STATE_NESTED_GUEST_MODE 0x00000001 #define KVM_STATE_NESTED_RUN_PENDING 0x00000002 #define KVM_STATE_NESTED_EVMCS 0x00000004 =20 +#define KVM_STATE_NESTED_VMX_VMCS_SIZE 0x1000 + #define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001 #define KVM_STATE_NESTED_SMM_VMXON 0x00000002 =20 -struct kvm_vmx_nested_state { +struct kvm_vmx_nested_state_data { + __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; + __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; +}; + +struct kvm_vmx_nested_state_hdr { __u64 vmxon_pa; - __u64 vmcs_pa; + __u64 vmcs12_pa; =20 struct { __u16 flags; @@ -401,24 +411,25 @@ struct kvm_vmx_nested_state { =20 /* for KVM_CAP_NESTED_STATE */ struct kvm_nested_state { - /* KVM_STATE_* flags */ __u16 flags; - - /* 0 for VMX, 1 for SVM. */ __u16 format; - - /* 128 for SVM, 128 + VMCS size for VMX. */ __u32 size; =20 union { - /* VMXON, VMCS */ - struct kvm_vmx_nested_state vmx; + struct kvm_vmx_nested_state_hdr vmx; =20 /* Pad the header to 128 bytes. */ __u8 pad[120]; - }; + } hdr; =20 - __u8 data[0]; + /* + * Define data region as 0 bytes to preserve backwards-compatability + * to old definition of kvm_nested_state in order to avoid changing + * KVM_{GET,PUT}_NESTED_STATE ioctl values. + */ + union { + struct kvm_vmx_nested_state_data vmx[0]; + } data; }; =20 #endif /* _ASM_X86_KVM_H */ --=20 1.8.3.1