From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) (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 AF5FA3211 for ; Wed, 3 Aug 2022 20:27:09 +0000 (UTC) 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: Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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