Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp510426imn; Wed, 3 Aug 2022 13:28:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR6AUZ7PU/oJm1h2VV/CTOUPCFsihmEm9q2DORMkkyy/j9yMHYHBmmVVP7FW6kEN+dut3v9k X-Received: by 2002:a05:6402:34c7:b0:43e:4237:e57c with SMTP id w7-20020a05640234c700b0043e4237e57cmr4496254edc.171.1659558519532; Wed, 03 Aug 2022 13:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659558519; cv=none; d=google.com; s=arc-20160816; b=UcgAfIOr3ULH14T7LTtU9x9O2cRq7KAX9Qgoj6AyW1fmwfZEr39CqAmlcIwBrkDgW+ hY5Td8qVOWRAlO/6szyRfxUd0x+ag1DGAeRFiMhkj0YtyPKknExNdRNCqs3LSZleLyXe hJ3i3FTsUnvEzwK3nz/dFoDNKsm1KEgY6tVHorkmmmc9a/Hmx5pydby47GndHqSXu/0m 24avvIueFZcUNlsi3huXMHPeuazyynMwQSTSZaVj30zv3oHGSgaaD8ReVd/0vgYkGX+U mvq1Gm4+rnzE9wN+6hjMXrqhUklxueWIFMLZ3uxMT1SDGguy4vO9+HDERjHEirujBK5L fKuA== 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=NGAAgwsFZOFiyuIqVIHwUIdtAY8mEvoIbdgSbGrefj4=; b=n5psv5beOM0RSF2oKs2NOU7Vgv6ozzDIxHFF4za/eLvps7Vt1adwYIl7puCaOR/C5G MuxJLZPVABZHzTxrM7QOTSiXn1PvELkLAz4fh44V6rtDWT9CkUtmrld/Y9M3rYi6tCdd yDSTQkqFFI6Zm77JHDwJRlY92ffjzNm6TkCRZXns+r6i5ZRpfI4vL+biYX7BI+4+cDiQ rdyQlnYhU3BvhSkMxAkIRByEmydB3eFwesNHrouJ6kzi6SNgETk7GRj1C8DEY2Fnca1j Jq0sD+IRpz0yUVGymr4V/O812E1r+Iqg2tXc21Puip32m8FrrTzbMThgm4L+upaC7COv gPcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=saUgyTZ9; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f22-20020a50fc96000000b0042dc61e68d0si13889861edq.137.2022.08.03.13.27.55; Wed, 03 Aug 2022 13:28:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=saUgyTZ9; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-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 S238566AbiHCU1H (ORCPT + 99 others); Wed, 3 Aug 2022 16:27:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236138AbiHCU1F (ORCPT ); Wed, 3 Aug 2022 16:27:05 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8310519012; Wed, 3 Aug 2022 13:27:03 -0700 (PDT) Received: from zn.tnic (p57969665.dip0.t-ipconnect.de [87.150.150.101]) (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 34EFF1EC00F8; Wed, 3 Aug 2022 22:26:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1659558417; 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=NGAAgwsFZOFiyuIqVIHwUIdtAY8mEvoIbdgSbGrefj4=; b=saUgyTZ9As3E+I3dXZj9mDddkTvaiqPubF7iHBiDAUHv1uqUQRvBQQaJmioU9Y/eeK0SV+ Fx8ZdZfliRxroJcFhwQbrI/BCmhC1w2JRF2SVcalW/Ebwhe6z9BvgQ/IUOs8cALByhrxpk oAoh7W7eorRu7ffIUUqRappMfT1v+d8= Date: Wed, 3 Aug 2022 22:26:51 +0200 From: Borislav Petkov To: "Kalra, Ashish" Cc: "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "linux-coco@lists.linux.dev" , "linux-mm@kvack.org" , "linux-crypto@vger.kernel.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "jroedel@suse.de" , "Lendacky, Thomas" , "hpa@zytor.com" , "ardb@kernel.org" , "pbonzini@redhat.com" , "seanjc@google.com" , "vkuznets@redhat.com" , "jmattson@google.com" , "luto@kernel.org" , "dave.hansen@linux.intel.com" , "slp@redhat.com" , "pgonda@google.com" , "peterz@infradead.org" , "srinivas.pandruvada@linux.intel.com" , "rientjes@google.com" , "dovmurik@linux.ibm.com" , "tobin@ibm.com" , "Roth, Michael" , "vbabka@suse.cz" , "kirill@shutemov.name" , "ak@linux.intel.com" , "tony.luck@intel.com" , "marcorr@google.com" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "alpergun@google.com" , "dgilbert@redhat.com" , "jarkko@kernel.org" Subject: Re: [PATCH Part2 v6 06/49] x86/sev: Add helper functions for RMPUPDATE and PSMASH instruction Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, Aug 01, 2022 at 10:31:26PM +0000, Kalra, Ashish wrote: > The struct rmpentry is the raw layout of the RMP table entry > while struct rmpupdate is the structure expected by the rmpupdate > instruction for programming the RMP table entries. > > Arguably, we can program a struct rmpupdate internally from a struct > rmpentry. > > But we will still need struct rmpupdate for issuing the rmpupdate > instruction, so it is probably cleaner to keep it this way, as it only > has two main callers - rmp_make_private() and rmp_make_shared(). Ok, but then call it struct rmp_state. The APM says in the RMPUPDATE blurb: "The RCX register provides the effective address of a 16-byte data structure which contains the new RMP state." so the function signature should be: static int rmpupdate(u64 pfn, struct rmp_state *new) and this is basically the description of that. It can't get any more user-friendly than this. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette