Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp461182rdb; Thu, 15 Feb 2024 05:45:06 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWq8wbU4NG5fvPUTKkC9lNeR4uIYdX4Qd0MHyD+BHCEED9oVQ4NEy852RB9his2OP7JzanqTHH0ry8P8ddSRo/Sabc5ZqanLhP6Zm6ebQ== X-Google-Smtp-Source: AGHT+IFP0TJfcrMvh0US8T4vnOmgSHy5YIoO9oxZTUzgiI4PKtfyxaHMNgXu7vurmIKMeL9IR3BG X-Received: by 2002:ac8:5814:0:b0:42c:60d4:312f with SMTP id g20-20020ac85814000000b0042c60d4312fmr2108051qtg.22.1708004705999; Thu, 15 Feb 2024 05:45:05 -0800 (PST) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ay14-20020a05622a228e00b0042c7cdc546asi1466511qtb.423.2024.02.15.05.45.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 05:45:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67006-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@redhat.com header.s=mimecast20190719 header.b=NA0Us0bD; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-67006-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67006-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 791651C21461 for ; Thu, 15 Feb 2024 13:45:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72CD2131738; Thu, 15 Feb 2024 13:44:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NA0Us0bD" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D96112B144 for ; Thu, 15 Feb 2024 13:44:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708004698; cv=none; b=XzVMXXBzqD/FyQQdamJq4kneLJzlts4/LksLC4wA1Naa5X9oi2adBahn/UMwRYvvonZlG2AHM7s+fV0A/8ESnzXh+nS6nX3QEKZyyTF8K5ZA5QPEWG1aXew25MNunnu4Z59yYWJzZGMykp6YtyFUYE+aY2hqughWsHsk1pIiiF4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708004698; c=relaxed/simple; bh=ov3VmXzDZCCLW/BZ7JwwFgcYShbcwFfP+oLLIIxjH7c=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=a3eVgcUH5qyy0hZOdlOlZ7xRLfK2VbJezXrJMa8mcpX4K5Ogrz46b/AVN/CNOKqeII/S5D4p205ABsR18Ry6tngU28WIwg1LD6Ep/tDwLL4/AYJgm5zFqMwowjSEF40Bn5tDzByhqCBM+aF6PhLpbjwqzgqh+NC1a8YIrIoIh4c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NA0Us0bD; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708004695; 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:autocrypt:autocrypt; bh=83HKxgolObBJ7E24ueW7SJzyGPOvjgws+//Qd73dSDc=; b=NA0Us0bDXLn1QhRcAXuxBvVueDvMDWGTIT/lMGkN4ZcvfnY46CKw/QLALXC09cy3T6bMfc geP2ArfGKKvUDW+TY9Xtkwxucnn/uJoEZDtfQHHoXGSu5GtsIcZG1NjYITg+jUkAFPa0U8 Rkthm/ItfGE/fUw025BFiajBjiPzbY0= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-9-CGIE52pzO4Oc9DVCll6Rvg-1; Thu, 15 Feb 2024 08:44:49 -0500 X-MC-Unique: CGIE52pzO4Oc9DVCll6Rvg-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-51197d1fcc2so673692e87.2 for ; Thu, 15 Feb 2024 05:44:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708004688; x=1708609488; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=83HKxgolObBJ7E24ueW7SJzyGPOvjgws+//Qd73dSDc=; b=Dy34E3/5LBQOKhN8QXML+91xqJ4QFOEEF0cfEWCffi8PsawiqMSTkTVbCeNoOENI/E YN+kQ4AQcZNEcrIiervCSI8xePqzeTZUlYCKGprLgTBIAcLKLe+2sBOhxfaJR3NEPNT6 SuufQvyacALuLywTj1Iw2ewE9eX9nSFhuGoCHz6KWtfJT64WOTxC/sV9tbtC/0p3YNoE pBqeeWyIyGQ3dBIpZNhwnY5ePwK+khStn1GUdjPR8pzc7W0T0LYGK8Db+YiWq8u7wkkz qNiVNnetaAxPy9OVWw4kIMPr4A9VPHvwsbB3VD/IIWZBADmEX+9lNorOiYJX2fJvrguV QJjQ== X-Gm-Message-State: AOJu0Ywy6PXeF5RJ07GqWdQr2otkDcTz5+IytjvMoA7Yy1pf0YsadK6o sUzYSMllbhgbcx6rh/1J5yOQpHWTNDrD4/fjYhBge52/QmS+0Q5Dl7nkjDVlXFuaXrliBHibwJb PxDP0YJL8voO8U4o3tKeXcjMGxar5WqyMS2rkueesp1IjNGIOuXGif6cAvpJ8uA== X-Received: by 2002:ac2:4114:0:b0:511:a4c9:a00f with SMTP id b20-20020ac24114000000b00511a4c9a00fmr1486901lfi.30.1708004688528; Thu, 15 Feb 2024 05:44:48 -0800 (PST) X-Received: by 2002:ac2:4114:0:b0:511:a4c9:a00f with SMTP id b20-20020ac24114000000b00511a4c9a00fmr1486889lfi.30.1708004688064; Thu, 15 Feb 2024 05:44:48 -0800 (PST) Received: from [192.168.1.174] ([151.64.123.201]) by smtp.googlemail.com with ESMTPSA id r11-20020a056402018b00b00563c3192f56sm215809edv.5.2024.02.15.05.44.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Feb 2024 05:44:47 -0800 (PST) Message-ID: Date: Thu, 15 Feb 2024 14:44:47 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 09/10] KVM: SEV: introduce KVM_SEV_INIT2 operation Content-Language: en-US To: Michael Roth Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, seanjc@google.com, aik@amd.com, isaku.yamahata@intel.com References: <20240209183743.22030-1-pbonzini@redhat.com> <20240209183743.22030-10-pbonzini@redhat.com> <20240215013415.bmlsmt7tmebmgtkh@amd.com> From: Paolo Bonzini Autocrypt: addr=pbonzini@redhat.com; keydata= xsEhBFRCcBIBDqDGsz4K0zZun3jh+U6Z9wNGLKQ0kSFyjN38gMqU1SfP+TUNQepFHb/Gc0E2 CxXPkIBTvYY+ZPkoTh5xF9oS1jqI8iRLzouzF8yXs3QjQIZ2SfuCxSVwlV65jotcjD2FTN04 hVopm9llFijNZpVIOGUTqzM4U55sdsCcZUluWM6x4HSOdw5F5Utxfp1wOjD/v92Lrax0hjiX DResHSt48q+8FrZzY+AUbkUS+Jm34qjswdrgsC5uxeVcLkBgWLmov2kMaMROT0YmFY6A3m1S P/kXmHDXxhe23gKb3dgwxUTpENDBGcfEzrzilWueOeUWiOcWuFOed/C3SyijBx3Av/lbCsHU Vx6pMycNTdzU1BuAroB+Y3mNEuW56Yd44jlInzG2UOwt9XjjdKkJZ1g0P9dwptwLEgTEd3Fo UdhAQyRXGYO8oROiuh+RZ1lXp6AQ4ZjoyH8WLfTLf5g1EKCTc4C1sy1vQSdzIRu3rBIjAvnC tGZADei1IExLqB3uzXKzZ1BZ+Z8hnt2og9hb7H0y8diYfEk2w3R7wEr+Ehk5NQsT2MPI2QBd wEv1/Aj1DgUHZAHzG1QN9S8wNWQ6K9DqHZTBnI1hUlkp22zCSHK/6FwUCuYp1zcAEQEAAc0j UGFvbG8gQm9uemluaSA8cGJvbnppbmlAcmVkaGF0LmNvbT7CwU0EEwECACMFAlRCcBICGwMH CwkIBwMCAQYVCAIJCgsEFgIDAQIeAQIXgAAKCRB+FRAMzTZpsbceDp9IIN6BIA0Ol7MoB15E 11kRz/ewzryFY54t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OeUlrFDTfnPYYSF/mPCxHttosyt8O5kabxnIPv2URuAxDByz+iVbL+RjKaGM GDph56ZTswlx75nZVtIukqzLAQ5fa8OALSGum0cFi4ptZUOhDNz1onz61klD6z3MODi0sBZN Aj6guB2L/+2ZwElZEeRBERRd/uommlYuToAXfNRdUwrwl9gRMiA0WSyTb190zneRRDfpSK5d usXnM/O+kr3Dm+Ui+UioPf6wgbn3T0o6I5BhVhs4h4hWmIW7iNhPjX1iybXfmb1gAFfjtHfL xRUr64svXpyfJMScIQtBAm0ihWPltXkyITA92ngCmPdHa6M1hMh4RDX+Jf1fiWubzp1voAg0 JBrdmNZSQDz0iKmSrx8xkoXYfA3bgtFN8WJH2xgFL28XnqY4M6dLhJwV3z08tPSRqYFm4NMP dRsn0/7oymhneL8RthIvjDDQ5ktUjMe8LtHr70OZE/TT88qvEdhiIVUogHdo4qBrk41+gGQh b906Dudw5YhTJFU3nC6bbF2nrLlB4C/XSiH76ZvqzV0Z/cAMBo5NF/w= In-Reply-To: <20240215013415.bmlsmt7tmebmgtkh@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/15/24 02:34, Michael Roth wrote: >> + struct struct kvm_sev_init { > Missing the vm_type param here. It can go away in the struct actually. Also, "struct struct". >> +If the ``KVM_X86_SEV_VMSA_FEATURES`` attribute does not exist, the hypervisor only >> +supports KVM_SEV_INIT and KVM_SEV_ES_INIT. In that case the set of VMSA features is >> +undefined. > > It's hard to imagine userspace implementation support for querying > KVM_X86_SEV_VMSA_FEATURES but still insisting on KVM_SEV_INIT. .. except for backwards compatibility with old kernels. For example, the VMM could first invoke HAS_DEVICE_ATTR, and then fall back to KVM_SEV_INIT after checking that the user did not explicitly request or forbid one or more VMSA features. > Maybe it > would be better to just lock in that VMSA_FEATURES at what is currently > supported: DEBUG_SWAP=on/off depending on the kvm_amd module param, and > then for all other features require opt-in via KVM_SEV_INIT2, and then > bake that into the documentation. That way way they could still reference > this documentation to properly calculate measurements for older/existing > VMM implementations. Thinking more about it, I think all features including debug_swap should be disabled with the old SEV_INIT/SEV_ES_INIT. Because the features need to match between the VMM and the measurement calculation, they need to be added explicitly on e.g. the QEMU command line. Paolo