Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3607989pxu; Mon, 30 Nov 2020 06:47:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyC8mos7f226aAP2L/1NVpHk5YONz9GF8yOb0xVOquiLeEUL6ubvD9hZp2v6CblVZWRmiIu X-Received: by 2002:a05:651c:207:: with SMTP id y7mr9715326ljn.428.1606747637856; Mon, 30 Nov 2020 06:47:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606747637; cv=none; d=google.com; s=arc-20160816; b=0RR/QYdQZjUWlMVCd/eJlPvw3Y7ZURk63mL0TSLQSTi/p8nT03WHeihauS2+1ZXZ+x PuWrMXelAdT/A2FNObPw+K36X7NUWVIGdnIu/aeE7wBZUldfKynl+IRvOZSSOEDJcY3c O92HPJIS/Wh08gkjDySVKqBFxrw56vtV+ihgRaN2rAwYeR0HeVrsbIu632PI/szHZnAf 0K3UVAno4Hg0OE1gjLfvY9P0Q4yDedhjoYQ/tkNDgp2McwHKRWBIQhYSd96NHEj40pH+ djUlWEx8/vkLajbRvLX7x0OXhUysciz4oDNO/bQ3gRxPdl6SpDFOF0b0z+B+OKjm7Poa 1viA== 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=n7FeUibbReJ1gM5EGPZRonIL/+Uv7TtKGQkvjaCTCcQ=; b=gXeWPwn47mXwH1GRoy6VjItoUW8S8OT1qS2DaezKF88H5GTUMOJ8yQgxTCGId7f9U/ upxwq0Y4wi8vcbjKGALfgCyx/BLDkOOfDE/pnzLSnYM8F2kZBY7cHQGNnFm45ibOwpCV yx7nTvOLyWbjtEOfgGQi9xr/g36zf+yPAJeT0X316pLjvxurX02srbX9lR36IIsWvCN0 KM+HBOn/Zphbq1OzCjp1zyb9T40QLAC6TJcCdSFX7K6zOJtV51s+9bPQV72uCXspUUMh OlOYllTdKCa8rHbxttR+vZpi4qcmV0Be9vzbTLP+6i3ALQykWFwHml4QgtELA0c5aMJ/ TSuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XMyQ1bzC; 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 x18si12042163ejd.397.2020.11.30.06.46.55; Mon, 30 Nov 2020 06:47:17 -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=XMyQ1bzC; 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 S1726467AbgK3OnO (ORCPT + 99 others); Mon, 30 Nov 2020 09:43:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:51434 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725898AbgK3OnN (ORCPT ); Mon, 30 Nov 2020 09:43:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606747307; 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=n7FeUibbReJ1gM5EGPZRonIL/+Uv7TtKGQkvjaCTCcQ=; b=XMyQ1bzCIr5KB9x8bl/y9R4xgwJa+cBYFiIGUPGNsr5rryrVD+yc+f5CBspu5T6C9EmIO/ z/Ij81pGbSrJ1nzF0PWXqEjZsvqcoDG+PdKE0PFbtj2Il0QxEYpBYBnahC2fDe9e9Kjc7a GJCwH1G5eM3Cr1K3CznL6qLr3fRUkJs= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-526-98V3-qVmMsy9IGehQxQSog-1; Mon, 30 Nov 2020 09:41:45 -0500 X-MC-Unique: 98V3-qVmMsy9IGehQxQSog-1 Received: by mail-ej1-f70.google.com with SMTP id t4so4175516eju.0 for ; Mon, 30 Nov 2020 06:41:44 -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=n7FeUibbReJ1gM5EGPZRonIL/+Uv7TtKGQkvjaCTCcQ=; b=i0KsNzIzJLYOqDxASlgjsW3JH7mPXlzq8rHMXXJdjo4RMCECF6C2bL/xD3JNKR9Ukd Z0DLn/2Ovm3SBF0a1yQz5nOZ40ZKXyh5WjERc/+TbXVbLYbUqkLL+cN37HGJgy0clhjE EBPtlxQ8ZTxbDUztYNSwxfmLMAoTF9AOBL9wtqLbGCOjuCQ3EHvWBDC5v0qfisvnO30+ jasj7SkAvKQpin1CCKXzjEt7Zl8VcrexipL5vfn+3U8rCXOU+VdjpRvkahSaTHfVKOow efIow03YGWvtuaaB3pQUsPNLCoPwCQmWEABm0f7RMffWVz/ANH68Xe3Pkyb1gGGU4uku 0d9w== X-Gm-Message-State: AOAM530JUz6P0Cb1//W7QnnIPo3l0aYT1LUb5XLsInL4qjNl9jXazERu 7IjtK+RFvsipSQ5Ya3SPJ4s8sNQGFY7AfFp0lkTAdwo9mzigLCjS695ePpcUjvORRroxmpfJcQH Ek5/1DvVPAjmOSPDgAIfD87tK X-Received: by 2002:a50:fa92:: with SMTP id w18mr21765486edr.44.1606747303795; Mon, 30 Nov 2020 06:41:43 -0800 (PST) X-Received: by 2002:a50:fa92:: with SMTP id w18mr21765476edr.44.1606747303629; Mon, 30 Nov 2020 06:41:43 -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 gt11sm5746859ejb.67.2020.11.30.06.41.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Nov 2020 06:41:42 -0800 (PST) Subject: Re: [PATCH v2 1/2] KVM: SVM: Move asid to vcpu_svm To: Ashish Kalra Cc: cavery@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, mlevitsk@redhat.com, vkuznets@redhat.com, wei.huang2@amd.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, jon.grimm@amd.com References: <20201129094109.32520-1-Ashish.Kalra@amd.com> From: Paolo Bonzini Message-ID: Date: Mon, 30 Nov 2020 15:41:41 +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: <20201129094109.32520-1-Ashish.Kalra@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 29/11/20 10:41, Ashish Kalra wrote: > From: Ashish Kalra > > This patch breaks SEV guests. > > The patch stores current ASID in struct vcpu_svm and only moves it to VMCB in > svm_vcpu_run(), but by doing so, the ASID allocated for SEV guests and setup > in vmcb->control.asid by pre_sev_run() gets over-written by this ASID > stored in struct vcpu_svm and hence, VMRUN fails as SEV guest is bound/activated > on a different ASID then the one overwritten in vmcb->control.asid at VMRUN. > > For example, asid#1 was activated for SEV guest and then vmcb->control.asid is > overwritten with asid#0 (svm->asid) as part of this patch in svm_vcpu_run() and > hence VMRUN fails. > Thanks Ashish, I've sent a patch to fix it. Would it be possible to add a minimal SEV test to tools/testing/selftests/kvm? It doesn't have to do full attestation etc., if you can just write an "out" instruction using SEV_DBG_ENCRYPT and check that you can run it that's enough. Paolo