From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-21.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C61D7C433EF for ; Tue, 14 Sep 2021 21:09:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F19561214 for ; Tue, 14 Sep 2021 21:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234140AbhINVLM (ORCPT ); Tue, 14 Sep 2021 17:11:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233952AbhINVLM (ORCPT ); Tue, 14 Sep 2021 17:11:12 -0400 Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58C3CC061574 for ; Tue, 14 Sep 2021 14:09:54 -0700 (PDT) Received: by mail-qk1-x749.google.com with SMTP id u19-20020a05620a121300b0042665527c3bso933279qkj.14 for ; Tue, 14 Sep 2021 14:09:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:message-id:mime-version:subject:from:to:cc; bh=HhHNmLA8REYhOuJC0vm+kLsXG9Lm4OVd0gPHkFDirGM=; b=ASzMBsbFpGlJZqzWOdC5SUxoMXAlyvJRp8FbaLIMuV502E/Q7YekTlQ+f7iwGWtn+z SPF2fxGJezxjqet+dT6wetnZ7hivPXGnp2gRobk23SKS1eQ6VGlwTVzqcOKOWHi3tm0y gP8klhn+OU3WGkxJyZ1cKb5bLRLUxciSbfeQ1Nh9C8YdRdrGC8UYP45oFQ4yArnXAsTY LJY0zINSyJMMEIRTiGdy0JEt6F//FCfrKP5YRXRSy+Efh28Sr0MFqhjU/RQNTUa8yTmc TfcbbTrjGf94fblvPm/igZ/Mn7bhMq9Rev4oCxS2eIES1yJDzrEIE1d84QJ+5AtC5ryr 8+5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:reply-to:date:message-id:mime-version:subject :from:to:cc; bh=HhHNmLA8REYhOuJC0vm+kLsXG9Lm4OVd0gPHkFDirGM=; b=wDjaCkUYQneMWNmLjtT6zabw+l8AfI/uh61wnI/7MSjZo6doHV6FFktnT4hM8sNiY3 dgpxrMbfans4Thsfxc2yXeet0DmkjcChAgkmCKgsWG2SLp8rjIxnrb7xUD9GRLxixvhk jXGlodke3AzwV5szLo9i1bEpQN3QHYSgIixJlghtbvlTD7+oSXHY90vg3aArxjYpuNwy RoPOtJKSfVmqgNQc0kGv6tkkGcDF+hW+hYsmpw6jmZOfjyImnyog5Moh394P13mJro52 KnHJOdHzEkoGl14wXO1Qu+F0yx57NqZrdfI+7QsCNTcAemF+fzndC3l6cemQkQLVBAZZ OSmA== X-Gm-Message-State: AOAM530p53N11Roz23GXnrr1qBVapygopW3rb9ug4YbRBv//8H59ZW0B BXXXH67bHGtmZi1eyE17LN1na0TNWCg= X-Google-Smtp-Source: ABdhPJxQb7i85ReJWIRX0FdV+KhiHX4rLNlCDJmuoKaPcmEH8RszN2ZHmNP1ue42Iz/KsKbpy7jGR+6MuJ0= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:90:200:d59f:9874:e5e5:256b]) (user=seanjc job=sendgmr) by 2002:a05:6214:11f0:: with SMTP id e16mr7611919qvu.30.1631653793581; Tue, 14 Sep 2021 14:09:53 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 14 Sep 2021 14:09:49 -0700 Message-Id: <20210914210951.2994260-1-seanjc@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.33.0.309.g3052b89438-goog Subject: [PATCH 0/2] KVM: SEV: RECEIVE_UPDATE_DATA bug fixes From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Gonda , Marc Orr , Tom Lendacky , Brijesh Singh , Masahiro Kozuka Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Patch 1 pins the target of RECEIVE_UPDATE_DATA for write instead of read. The SEV API clearly states that the PSP writes guest memory, which makes sense given that the guest is receiving data. Patch 2 adds a CLFLUSH of the guest memory as there is no requirement that the page already be in an encrypted state before RECEIVE_UPDATE_DATA, i.e. the cache may have dirty, unencrypted data. On my end, these patches are compile-tested only as I don't have a userspace VMM that supports SEV live migration, nor are there tests for any of this stuff. Masahiro Kozuka (1): KVM: SEV: Flush cache on non-coherent systems before RECEIVE_UPDATE_DATA Sean Christopherson (1): KVM: SEV: Pin guest memory for write for RECEIVE_UPDATE_DATA arch/x86/kvm/svm/sev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.33.0.309.g3052b89438-goog