Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp153201pxb; Mon, 31 Jan 2022 18:01:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJziT0UzDdgDtVTV9M9stWV1nIS8DGhQp3S4yPY9wZEYcm/K0IGqHBuyczHiDpg+tzcUi4je X-Received: by 2002:a63:8949:: with SMTP id v70mr19033283pgd.496.1643680874039; Mon, 31 Jan 2022 18:01:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643680874; cv=none; d=google.com; s=arc-20160816; b=Lr9Z3CJDP9IywfeyE/aaftjJ8SiSXDVQZgnq5HasjwiIL5Jns23ykTIPPttWGdercT HCUNxVQ1Ghit+eecXrxpD3EqM6l2Oandehi7YNEA7yzpJK/00qDv4oXwIL39BOsVHsVp blS7ZW3NZSxErih0hT+/rC/K5AZ4N1n+VRxAxQE3el1L5QBuGQ3uZeouGMH1q7u2LCk1 MZ2puCU8rdzNoKPWavYI3HXaDQiyYai31qFheGEwjxeGQiMyFtnFdieflYqx5gJM8bOs ojxdlqjMocVL3sv959cuNXB6s80tyDJfJ03rPD5r7oKlISODH/G2/ahREXhd66Sxn7mD vUsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1SqI9kGrSv75+nJPwZYKxkcTL83Vduz6X2Q74CD9Idc=; b=K1+3Au42WW75l2qElNLGFJb4wNXHHbftjpm48ZXxGKU8bdg9ePaFKcZLEP4KQSFFyJ bHHpKU2FXwNxafCriFNfXmDOBR/bhFCjYr7xFvwdc6k2BIh31c7VJj5KNym+/8VdqBYK nLemromJ8aiTpmuGdou8gDr0XyQqXwBsnkB0YSlgSVzrpNgXvdyN2usV8dA75082j4MI b0t2s7OAKYpYlncYdBzOla5ZOoSomO3KhOL8jLZ5OCpRYvCCGJOlQeXCO1fMh/SvODx9 epbENaU7H22i8CXTTDxZosiFpdWaSOSYrZnfKwRxkn1uvfoBP5JNE/V/y4KGUYXPQS3t NAwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=cpPOiblw; 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=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n9si13886623plk.379.2022.01.31.18.01.01; Mon, 31 Jan 2022 18:01:14 -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=@alien8.de header.s=dkim header.b=cpPOiblw; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243277AbiA2MC2 (ORCPT + 99 others); Sat, 29 Jan 2022 07:02:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229989AbiA2MC1 (ORCPT ); Sat, 29 Jan 2022 07:02:27 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA1DCC061714; Sat, 29 Jan 2022 04:02:26 -0800 (PST) Received: from zn.tnic (dslb-088-067-221-104.088.067.pools.vodafone-ip.de [88.67.221.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 2BF4B1EC01B7; Sat, 29 Jan 2022 13:02:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1643457741; 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:in-reply-to:in-reply-to: references:references; bh=1SqI9kGrSv75+nJPwZYKxkcTL83Vduz6X2Q74CD9Idc=; b=cpPOiblw8z2FwDfVV+8Cx0gJBEZNMWEIsqxMvsZI45g70BBWrD1cdgvk7WcuViGnXEW3Zt w2dBeSBqEsUj1PwAVsBYj3Ix9UfYnGw4OVtjeo9/YFKg83b4EBpejQM5Gk0DJD94L1MujC KQyEa3QGcWGmbyjQjsI3rua5JaZbDeo= Date: Sat, 29 Jan 2022 13:02:18 +0100 From: Borislav Petkov To: Brijesh Singh Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Michael Roth , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , "Dr . David Alan Gilbert" , tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH v8 36/40] x86/sev: Provide support for SNP guest request NAEs Message-ID: References: <20211210154332.11526-1-brijesh.singh@amd.com> <20211210154332.11526-37-brijesh.singh@amd.com> <87d4999a-14cc-5070-4f03-001dd5f1d2b1@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 29, 2022 at 05:49:06AM -0600, Brijesh Singh wrote: > The hypervisor must validate that the guest has supplied enough pages to > hold the certificates that will be returned before performing the SNP > guest request. If there are not enough guest pages to hold the > certificate table and certificate data, the hypervisor will return the > required number of pages needed to hold the certificate table and > certificate data in the RBX register and set the SW_EXITINFO2 field to > 0x0000000100000000. Then you could call that one: #define SNP_GUEST_REQ_ERR_NUM_PAGES BIT_ULL(32) or so, to mean what exactly that error is. Because when you read the code, it is more "self-descriptive" this way: ... ghcb->save.sw_exit_info_2 == SNP_GUEST_REQ_ERR_NUM_PAGES) input->data_npages = ghcb_get_rbx(ghcb); > It does not spell it as invalid length. However, for *similar* failure, > the SEV-SNP spec spells out it as INVALID_LENGTH, so, I choose macro > name as INVALID_LENGTH. You can simply define a separate one here called ...INVALID_LENGTH. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette