Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp680706ybk; Fri, 15 May 2020 10:44:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxshDvD7bPx+pXa4dY0S9QEA6pIi5ezidxcT8opkHmvm1sT/DaUvw6zee9cOGNEy7J+6khR X-Received: by 2002:a50:b586:: with SMTP id a6mr3854447ede.292.1589564641211; Fri, 15 May 2020 10:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589564641; cv=none; d=google.com; s=arc-20160816; b=vG+5/6qnBx+p5qquNkUcJ2uQpbGMQQW/axj4YY9aVXrmCFXaCld1Db2RoDcZb6djvA KMyPjm3npQSQOlWW/qVvL6ytCSWehM/KuEFs9Wh7TDyNoBepIlrDeUoKVJhnKWh7DUHb E7ii0Tr4ustJx5qxVrbr/v6lHxS0pr+4DesgG+VP1045QaHcm3AN/Iq6jJYp62GBUbzt BoOs30qslKuar6sdjl589i4yAkhtowGvAiYICsG/1h5jSwBUUOaNm7miwQFibVrmkhTD FgtkbVcXz2u8eFQgBtARdJ4+YlK80xpEtIOu05GKdwrm5T+T58T02qhgopWpBLPEt+gr SR9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=3QVWKpoXf+LG4l+3jzo+2GrQilylKP/gdKsYh3UzKn4=; b=NMhfBYr8yL/hrQ3BhaK08i9azGE8eLPnfdSnrsFQRpylXyzGF7rgFIafMn6WUy0J4V LGvVLk85pL5sifJOgpzJgFyudZX2geOiJw8yRrGyAmNZRKTKvtvqaKmNw7CUn3d7drhz AalcCHH14KDMeLNB6OqTKPWS6ZYGfSADvSGAxp8LdiHjvqa3x/fvSs6TphEg0dajVpea psNKUfOle0FnzY3xS8RPV7j/CscdDeADm5zGBhbfANYe0450HH7dnTdsC4z6TSFnOfMr MNd4mXBTqarV0iPdQrGm4jIB70DBpnTxUVxbeIi4fCgHN9wWjm+mdEPQR43DKnYK9OLP Xs4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HhVRG4w8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r11si1538938edq.390.2020.05.15.10.43.38; Fri, 15 May 2020 10:44:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HhVRG4w8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726714AbgEORmA (ORCPT + 99 others); Fri, 15 May 2020 13:42:00 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:59878 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726497AbgEORl4 (ORCPT ); Fri, 15 May 2020 13:41:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589564514; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=3QVWKpoXf+LG4l+3jzo+2GrQilylKP/gdKsYh3UzKn4=; b=HhVRG4w8fALs9g9a3yCkZ8Yri5TXPl+qzVfKAHa0tvoVEEnFw059jCWea8B9N6x1WR/yQN otVa8bK1dtOrCSMT2f6N5/FUroRz5de1pjQCgqHA/dpVSIgrgo0KQse7US2itaMGGO7Mii +CdMMCQrSRtiqF5L/4GhUHj8hUyfago= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-324-ZxHHY3L7Pla_4kbrpbIOhQ-1; Fri, 15 May 2020 13:41:53 -0400 X-MC-Unique: ZxHHY3L7Pla_4kbrpbIOhQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 09F61107ACCD; Fri, 15 May 2020 17:41:52 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 634D910002CD; Fri, 15 May 2020 17:41:51 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Cathy Avery , Liran Alon , Jim Mattson Subject: [PATCH 7/7] KVM: SVM: introduce data structures for nested virt state Date: Fri, 15 May 2020 13:41:44 -0400 Message-Id: <20200515174144.1727-8-pbonzini@redhat.com> In-Reply-To: <20200515174144.1727-1-pbonzini@redhat.com> References: <20200515174144.1727-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Paolo Bonzini --- arch/x86/include/uapi/asm/kvm.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h index 3f3f780c8c65..cdca0fd1b107 100644 --- a/arch/x86/include/uapi/asm/kvm.h +++ b/arch/x86/include/uapi/asm/kvm.h @@ -385,7 +385,7 @@ struct kvm_sync_regs { #define KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT (1 << 4) #define KVM_STATE_NESTED_FORMAT_VMX 0 -#define KVM_STATE_NESTED_FORMAT_SVM 1 /* unused */ +#define KVM_STATE_NESTED_FORMAT_SVM 1 #define KVM_STATE_NESTED_GUEST_MODE 0x00000001 #define KVM_STATE_NESTED_RUN_PENDING 0x00000002 @@ -395,8 +395,14 @@ struct kvm_sync_regs { #define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001 #define KVM_STATE_NESTED_SMM_VMXON 0x00000002 +#define KVM_STATE_NESTED_SVM_VMENTRY_IF 0x00000001 +#define KVM_STATE_NESTED_SVM_GIF 0x00000002 + #define KVM_STATE_NESTED_VMX_VMCS_SIZE 0x1000 +#define KVM_STATE_NESTED_SVM_VMCB_SIZE 0x1000 + + struct kvm_vmx_nested_state_data { __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; @@ -411,6 +417,17 @@ struct kvm_vmx_nested_state_hdr { } smm; }; +struct kvm_svm_nested_state_data { + /* Save area only used if KVM_STATE_NESTED_RUN_PENDING. */ + __u8 vmcb12[KVM_STATE_NESTED_SVM_VMCB_SIZE]; +}; + +struct kvm_svm_nested_state_hdr { + __u64 vmcb_pa; + + __u16 interrupt_flags; +}; + /* for KVM_CAP_NESTED_STATE */ struct kvm_nested_state { __u16 flags; @@ -419,6 +441,7 @@ struct kvm_nested_state { union { struct kvm_vmx_nested_state_hdr vmx; + struct kvm_svm_nested_state_hdr svm; /* Pad the header to 128 bytes. */ __u8 pad[120]; @@ -431,6 +454,7 @@ struct kvm_nested_state { */ union { struct kvm_vmx_nested_state_data vmx[0]; + struct kvm_svm_nested_state_data svm[0]; } data; }; -- 2.18.2