Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3807428pxy; Tue, 4 May 2021 10:19:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNMnR4GO8/YBcjYWz5C00TeaFn8cGxkUMAtLYyoqUebPBIeeVhxsDry97YQsg5cUmuYNaG X-Received: by 2002:a05:6a00:230b:b029:28e:bdea:9b12 with SMTP id h11-20020a056a00230bb029028ebdea9b12mr7392331pfh.7.1620148747960; Tue, 04 May 2021 10:19:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620148747; cv=none; d=google.com; s=arc-20160816; b=VUdMgLbrZDelTLzjtZOa5QsDLyYaQBaNVWE8zdACEtRA1D5kSxDAz6+gNYQjy6d7BC R0G/cXClc0Dv4A5kngutc1a4SFUyWPc4N3WPmcsN7XCvXzMAJKoppzEHt1JuX4z656zB rnn1DnhJ/qw7CxmJ2fGRyFGcMEkMQjLB6fmqmLWgQg9del/d0SWXb0KPnBC9P3gjLB4Z K8yZz0Eqk66xGfhi/szCLMpgrCPTkHQOVRoo3byFMQB0k1mciJjqWI5tuFsGhOYwBNOV YLIHQMyAekH8gCZIwNx/Lb16mbbArp3vbGEIPH7UPXoks/EpvJTUl+vNFRVOoD9HbF0Z SO+Q== 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=Apx1mPPo9jw/DJuFJCfp1cuIUyNCtJscROEa9WeUops=; b=ny2KnMTpxSGF7WLCFvOPBr0eHvd54zrfJ2bW6zoMDyBJVeEH1tgP0JCYW47H4oXNja M6C4woYslPzCwm30dqboGMu22iPqZGaPRj4uVrRDSQHRL2K+QHUTjTeNo94xjtKH/0p+ g7rty9qn0s+Mg4XFfEn0XCx8L+U0oktKDTDGqVZgH/IeqB/rueCc/I1LtO8QY+RWcQoy xMm7QRYvXAST+bZAiiUZikG9OH5y7Pm76yzaU6VnBQ/9qMu5neQorLoiM9EjnIPfFZ90 yO0z9g7kyXhwhX1V3rYx9NVedt73h1L562FTJBwuu/DCbvtu6y5BUVJXu+R3qingoOX1 i0Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=iG8yuyjj; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c1si793067pfv.164.2021.05.04.10.18.49; Tue, 04 May 2021 10:19:07 -0700 (PDT) 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=@google.com header.s=20161025 header.b=iG8yuyjj; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231970AbhEDRKu (ORCPT + 99 others); Tue, 4 May 2021 13:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231928AbhEDRKt (ORCPT ); Tue, 4 May 2021 13:10:49 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1578C06174A for ; Tue, 4 May 2021 10:09:54 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id y2so5423920plr.5 for ; Tue, 04 May 2021 10:09:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Apx1mPPo9jw/DJuFJCfp1cuIUyNCtJscROEa9WeUops=; b=iG8yuyjj3NEBh1SqCU8M9JffkR8pCwPcnuH0m7vDo3ondigxJXorbh1Pi91xJDWadu Y/76aELlhAnKrGShMNapHEYxB31edsVGsdbLRnkKy+bhOCkuOe8fy0UT+Qm+qMHGmFd0 LkcLkT2tdsMFXazYapkFLgX+sAZlCRRQr101i4syKA8Lmnq7Dv5Td2FWjYf0A/GJ+M6I yK5bYbMqdZ0JWup+yR2XJPGcDWi5JGRldJDr5MbtOrmISmJf94KM+1Ym00gjKi/yA90M NRiv2oveh8iBy0Q7xx0OcTU1hPDdVJUJMFVx2KIX4Wv9g69TRejkyA7ugYspstU8sAF7 Aocg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Apx1mPPo9jw/DJuFJCfp1cuIUyNCtJscROEa9WeUops=; b=qJWLBSOolTJ5KVIRqXh5sDwjrdoh3J1a5E6/ryoo+Z0p+y7QtR9aZVZNO9Lnpqlaht EZPsBjjI/fwA9dLdtjhbcV7GTkXTlHwA45XQ9lMSv/ll6DQSXs0qvhH8COw+W6cqGa0h gUp7GW8mgLdJl6ptGkkhxe/mnZC5JKj+uQsGajoy2qAq6ndOGfC2E4Xx+4T5f8I+5Jtc fjCQ5jFZR5eZChtZwAtgmXeZA1mBASGTBEjpX1TTEP1dQGfBN6UWDGYEaIBpLrNu2pfp 9VEhZNFBY8Pl4HkPqXO9Oq7ROQ0/osGQHfWrID2Wr5nZsdq4j5kSlISzEKwuITw3CpoD 05IA== X-Gm-Message-State: AOAM531R7DrNFtnp12KtIQZqh7O9DmFgm3JwHdA5e87ePQF363lMBcbc TNVXMi6eiFR+t1u96RE7pieY8Q== X-Received: by 2002:a17:902:9893:b029:ee:e8a8:688c with SMTP id s19-20020a1709029893b02900eee8a8688cmr6335873plp.84.1620148193646; Tue, 04 May 2021 10:09:53 -0700 (PDT) Received: from google.com (240.111.247.35.bc.googleusercontent.com. [35.247.111.240]) by smtp.gmail.com with ESMTPSA id w1sm6648874pfj.46.2021.05.04.10.09.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 May 2021 10:09:53 -0700 (PDT) Date: Tue, 4 May 2021 17:09:49 +0000 From: Sean Christopherson To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, srutherford@google.com, joro@8bytes.org, brijesh.singh@amd.com, thomas.lendacky@amd.com, ashish.kalra@amd.com, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Borislav Petkov , x86@kernel.org Subject: Re: [PATCH v3 2/2] KVM: X86: Introduce KVM_HC_PAGE_ENC_STATUS hypercall Message-ID: References: <20210429104707.203055-1-pbonzini@redhat.com> <20210429104707.203055-3-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 01, 2021, Paolo Bonzini wrote: > - make it completely independent from migration, i.e. it's just a facet of > MSR_KVM_PAGE_ENC_STATUS saying whether the bitmap is up-to-date. It would > use CPUID bit as the encryption status bitmap and have no code at all in KVM > (userspace needs to set up the filter and implement everything). If the bit is purely a "page encryption status is up-to-date", what about overloading KVM_HC_PAGE_ENC_STATUS to handle that status update as well? That would eliminate my biggest complaint about having what is effectively a single paravirt feature split into two separate, but intertwined chunks of ABI. #define KVM_HC_PAGE_ENC_UPDATE 12 #define KVM_HC_PAGE_ENC_REGION_UPDATE 0 /* encrypted vs. plain text */ #define KVM_HC_PAGE_ENC_STATUS_UPDATE 1 /* up-to-date vs. stale */ ret = -KVM_ENOSYS; if (!vcpu->kvm->arch.hypercall_exit_enabled) break; ret = -EINVAL; if (a0 == KVM_HC_PAGE_ENC_REGION_UPDATE) { u64 gpa = a1, npages = a2; if (!PAGE_ALIGNED(gpa) || !npages || gpa_to_gfn(gpa) + npages <= gpa_to_gfn(gpa)) break; } else if (a0 != KVM_HC_PAGE_ENC_STATUS_UPDATE) { break; } vcpu->run->exit_reason = KVM_EXIT_HYPERCALL; vcpu->run->hypercall.nr = KVM_HC_PAGE_ENC_STATUS; vcpu->run->hypercall.args[0] = a0; vcpu->run->hypercall.args[1] = a1; vcpu->run->hypercall.args[2] = a2; vcpu->run->hypercall.args[3] = a3; vcpu->run->hypercall.longmode = op_64_bit; vcpu->arch.complete_userspace_io = complete_hypercall_exit; return 0;