Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1196777ybb; Fri, 20 Mar 2020 15:22:26 -0700 (PDT) X-Google-Smtp-Source: ADFU+vubpK9MFts4pMvPrf6rbKCdJqsnbIgUoju0BTdLocDftJ++cX641MocHQok3wgzDCjOC+4s X-Received: by 2002:a9d:a68:: with SMTP id 95mr8369099otg.87.1584742946755; Fri, 20 Mar 2020 15:22:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584742946; cv=none; d=google.com; s=arc-20160816; b=0YwLTiLCIX4G6L9uVnfSPpgH+0tMpbHUdFnldYkC/Nr0EDkey6WR2F02K4+jHzSuIs vFPfVJv+jkcRiMnihnKl+hn59mI3A+xSoUVt4Xlm8aG6K+5w4VdAr42MpWPSoj2/YIeW bB//wx7UXrQOSYdjDgHButqXCKyv7GBn4rLDRCWBxIloR01V1iL3J/IxyQFVfjvgqkr2 TCLQuLpz7j3qoCNMyESF7Up5PvqhYOUhXT/LvPe8YT9g/IvFkc16jOKNwyzUoL/Fa4dh oe+oVi0b89N4pUTt7jck1AFAGtQdZoh9gT2+CNnno/Q7iVAOWLZkJai6LAnq/FY+Imy1 RLYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=lAEfQvcIaMECJqdKdRf1fAm+r3q/A1J55LUaMzm0RcM=; b=UwJDzPnKsvmFQLa6eJHz6QZbf289wl70MdQeLiOGyi4UYcBEIEWvigJCf7+/F8CtGv ZkFWqbr44IaNbTiCIE8PjDQPbcLL7/ByXYJN9YdHAsmoxs8Aj9PgGdqATZjCPglsZsW4 j+qfF609xOq+9bWsxsYHPkOz6tZVN6e1Zn6I2hQhIA6IRsC51bEMhFNWkzkdiEFq4ssX Bty0oNsvnvH6GmLcb+xp3RQZoZnCHPWoEKB8o0P3heqnXCpNr1v+xAw93/ykmIbEp3FK H0OD0PxxwF2+zHAP/8erxrYcpMcRNlGAk7fr0OUGVaOeaYdF/YDLrWJIpFAp9s1jwkbI uRyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x9si3609596oia.194.2020.03.20.15.22.14; Fri, 20 Mar 2020 15:22:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727190AbgCTWVF (ORCPT + 99 others); Fri, 20 Mar 2020 18:21:05 -0400 Received: from 8bytes.org ([81.169.241.247]:54746 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726986AbgCTWVF (ORCPT ); Fri, 20 Mar 2020 18:21:05 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id 923B24CA; Fri, 20 Mar 2020 23:21:03 +0100 (CET) Date: Fri, 20 Mar 2020 23:21:02 +0100 From: Joerg Roedel To: David Rientjes Cc: erdemaktas@google.com, x86@kernel.org, hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Thomas Hellstrom , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, Joerg Roedel Subject: Re: [PATCH 62/70] x86/kvm: Add KVM specific VMMCALL handling under SEV-ES Message-ID: <20200320222102.GM5122@8bytes.org> References: <20200319091407.1481-1-joro@8bytes.org> <20200319091407.1481-63-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 20, 2020 at 02:23:58PM -0700, David Rientjes wrote: > On Thu, 19 Mar 2020, Joerg Roedel wrote: > > +#if defined(CONFIG_AMD_MEM_ENCRYPT) > > +static void kvm_sev_es_hcall_prepare(struct ghcb *ghcb, struct pt_regs *regs) > > +{ > > + /* RAX and CPL are already in the GHCB */ > > + ghcb_set_rbx(ghcb, regs->bx); > > + ghcb_set_rcx(ghcb, regs->cx); > > + ghcb_set_rdx(ghcb, regs->dx); > > + ghcb_set_rsi(ghcb, regs->si); > > Is it possible to check the hypercall from RAX and only copy the needed > regs or is there a requirement that they must all be copied > unconditionally? No, there is no such requirement. This could be optimized with hypercall specific knowledge as it is in the KVM code anyway. Regards, Joerg