Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3562718pxu; Tue, 15 Dec 2020 09:48:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2yhkh8sHxoLDTMHHkmJDgJ76iAI2mHvPoKAR326BGc9THLT4r3x/ChP16F802UD+JXOMY X-Received: by 2002:a17:906:94c5:: with SMTP id d5mr14122118ejy.427.1608054512124; Tue, 15 Dec 2020 09:48:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608054512; cv=none; d=google.com; s=arc-20160816; b=VfjYGbOVHR7bUBeSEe8U8BlsyI4vLXj7C8zpquOVo+NpK2fRAKtsV6/xSKk+APSUTe nXKaCseIBfyJHiHSreLPZcxUbbjH8EXsSpGBvMgvfS5e3piycY45WViQe1VIpVggm2zE jD7Zp/Y4rXJ9KzXhWSCXlcARw5EaW7frXh9+0/wuB4CkKVUDFq72SQaxMA64Vz/jTtG0 KC8DJPRvH2tC2zrQqMGSX6dxXnuAq5Jk36EWKhfYJKct6NDT8O+nSw+W0R0FNiTo8pfn O/HsfgP4FmAUs/XD0ThGwOUKwlXi5gNOFHOnFBrB461RNEbSrqMj50UGIzyRxHuRijEn 4ElA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=6oD5/g/hpM8z9CKoFeIqYcXTfR0jHLooq+8MkZg5Z1w=; b=xZNRGcgxM5HpRHmqRx87V1S6nAxBlf4EKSjIG44N3Op6SR0rfC/TTD/kP+9N5ymM5y XRG1KNepJPwvpguVwkdTt8IZgyrOdevMnb3DoTmZOnJLNEAhJfeDf8roF3I9TwPQJmA4 AcOqnfihixA11UJByyr1kSrFDs4G5RnAT/QZ7WKcrntp19GdJLXiu/2T2IGp1vdp3JH3 xojQXaFaWkAxSTBGbVS10yWZ/DISh76YEci58/+Z58uypqjcJNv4bVnL4BJyUvJd3nES 6SJS2TaO3tBfEG7v/HU2fE3cri++ixDpYCPcMC/rFPohvtIYu1684fwEJlpd/SkNl5E0 SUmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ReVcxgSV; 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 y26si1209405edo.273.2020.12.15.09.48.07; Tue, 15 Dec 2020 09:48:32 -0800 (PST) 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=ReVcxgSV; 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 S1731149AbgLORn7 (ORCPT + 99 others); Tue, 15 Dec 2020 12:43:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50746 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730742AbgLORnl (ORCPT ); Tue, 15 Dec 2020 12:43:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608054134; 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: in-reply-to:in-reply-to:references:references; bh=6oD5/g/hpM8z9CKoFeIqYcXTfR0jHLooq+8MkZg5Z1w=; b=ReVcxgSV8mezBiJCtLv+cFbBXoOrLKVUldZxa7NAiEpDO6pEzyve9JSHoVSHxRsQQxl8y3 /J3dd0ta2+ZzZpt2AxPAQszCHTZcGVQEsCEtr+Myhv38ZFOOAI0DCiJnOBwd8PuElxr+m6 lCEJeLig5zh9G4VhuJQBA/P71ZJE/JU= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-421-WFEN1ddVO4uUJ5pxouiv6w-1; Tue, 15 Dec 2020 12:42:13 -0500 X-MC-Unique: WFEN1ddVO4uUJ5pxouiv6w-1 Received: by mail-ed1-f69.google.com with SMTP id y19so8681454edw.16 for ; Tue, 15 Dec 2020 09:42:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6oD5/g/hpM8z9CKoFeIqYcXTfR0jHLooq+8MkZg5Z1w=; b=hrQ50o6JqOGrAqlZqguHNRZzqdp9+Ut04r4GGjzQIj6P/1o6LcogfU48T9ACdf/EEJ jCfONkcXpRaChcvCZjXadthw99Zp6FBp9STIcaYsXlXDn6Edll3A8qp+gkQafuHU39/I q1XKIX1Xf0nPrnjhqJxLtwR37fyGtwvaYqinaLFyuSFuHoxU0/H7FRiTvsSs2oN/ttKB ftYS6SylYud6Q8CvQwrldsRmcKMxW+OkEhpnVapI/oGXShJuE6sWCVYkYDu0OfZUPl0V 8L2vd8xbhwsud5G4zyFBZg4V2XJ5n9ge8iJN6pX7DfUgbUdxGquM5/2J3qnOSRJsbXas 6BVg== X-Gm-Message-State: AOAM5305UVu4xY9nCe3C+ecus4+GpbwrPewc21BABCbondfzbT0s3JRr PbCXnXszJ6iHo6j7DlCy7xukrguuWDBUWf1iSFJyptrbfedi78v7rtN+kuHEiFRzfhlMvk0Iuz4 jd1mZYsXgI8JoalmItwxd3317 X-Received: by 2002:a05:6402:14c5:: with SMTP id f5mr29738440edx.232.1608054132092; Tue, 15 Dec 2020 09:42:12 -0800 (PST) X-Received: by 2002:a05:6402:14c5:: with SMTP id f5mr29738429edx.232.1608054131937; Tue, 15 Dec 2020 09:42:11 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id f13sm1767590ejf.42.2020.12.15.09.42.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Dec 2020 09:42:11 -0800 (PST) Subject: Re: [PATCH v5 00/34] SEV-ES hypervisor support To: Tom Lendacky , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org Cc: Jim Mattson , Joerg Roedel , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Borislav Petkov , Ingo Molnar , Thomas Gleixner , Brijesh Singh References: <2fac329e-8e4a-7966-c2c0-05ac0bce8e08@amd.com> From: Paolo Bonzini Message-ID: Date: Tue, 15 Dec 2020 18:42:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <2fac329e-8e4a-7966-c2c0-05ac0bce8e08@amd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/12/20 17:46, Tom Lendacky wrote: > KVM: SVM: Add AP_JUMP_TABLE support in prep for AP booting Great, thanks! Paolo > From: Tom Lendacky > > The GHCB specification requires the hypervisor to save the address of an > AP Jump Table so that, for example, vCPUs that have been parked by UEFI > can be started by the OS. Provide support for the AP Jump Table set/get > exit code. > > Signed-off-by: Tom Lendacky > --- > arch/x86/kvm/svm/sev.c | 28 ++++++++++++++++++++++++++++ > arch/x86/kvm/svm/svm.h | 1 + > 2 files changed, 29 insertions(+) > > diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c > index 6eb097714d43..8b5ef0fe4490 100644 > --- a/arch/x86/kvm/svm/sev.c > +++ b/arch/x86/kvm/svm/sev.c > @@ -18,6 +18,8 @@ > #include > #include > > +#include > + > #include "x86.h" > #include "svm.h" > #include "cpuid.h" > @@ -1559,6 +1561,7 @@ static int sev_es_validate_vmgexit(struct vcpu_svm *svm) > goto vmgexit_err; > break; > case SVM_VMGEXIT_NMI_COMPLETE: > + case SVM_VMGEXIT_AP_JUMP_TABLE: > case SVM_VMGEXIT_UNSUPPORTED_EVENT: > break; > default: > @@ -1883,6 +1886,31 @@ int sev_handle_vmgexit(struct vcpu_svm *svm) > case SVM_VMGEXIT_NMI_COMPLETE: > ret = svm_invoke_exit_handler(svm, SVM_EXIT_IRET); > break; > + case SVM_VMGEXIT_AP_JUMP_TABLE: { > + struct kvm_sev_info *sev = &to_kvm_svm(svm->vcpu.kvm)->sev_info; > + > + switch (control->exit_info_1) { > + case 0: > + /* Set AP jump table address */ > + sev->ap_jump_table = control->exit_info_2; > + break; > + case 1: > + /* Get AP jump table address */ > + ghcb_set_sw_exit_info_2(ghcb, sev->ap_jump_table); > + break; > + default: > + pr_err("svm: vmgexit: unsupported AP jump table request - exit_info_1=%#llx\n", > + control->exit_info_1); > + ghcb_set_sw_exit_info_1(ghcb, 1); > + ghcb_set_sw_exit_info_2(ghcb, > + X86_TRAP_UD | > + SVM_EVTINJ_TYPE_EXEPT | > + SVM_EVTINJ_VALID); > + } > + > + ret = 1; > + break; > + } > case SVM_VMGEXIT_UNSUPPORTED_EVENT: > vcpu_unimpl(&svm->vcpu, > "vmgexit: unsupported event - exit_info_1=%#llx, exit_info_2=%#llx\n", > diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h > index a5067f776ce0..5431e6335e2e 100644 > --- a/arch/x86/kvm/svm/svm.h > +++ b/arch/x86/kvm/svm/svm.h > @@ -78,6 +78,7 @@ struct kvm_sev_info { > int fd; /* SEV device fd */ > unsigned long pages_locked; /* Number of pages locked */ > struct list_head regions_list; /* List of registered regions */ > + u64 ap_jump_table; /* SEV-ES AP Jump Table address */ > }; > > struct kvm_svm { >