Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp586283rdb; Sat, 19 Aug 2023 14:41:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgifGPls/7U5wRZTezspfg+AbdPdDKP28NutKPQJJrlMt59XI+wdPX6oPYQYLd266Hf35h X-Received: by 2002:a17:902:8c93:b0:1b0:6038:2982 with SMTP id t19-20020a1709028c9300b001b060382982mr2296359plo.41.1692481276360; Sat, 19 Aug 2023 14:41:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692481276; cv=none; d=google.com; s=arc-20160816; b=TW0Cu3kVFO+tIu/xqoAYKkKL+lcN7fT5vvZ0CUaRQgc84KBoIMNQZ0ZnGstdcDKqd6 /O1JqacdicOY4cchbtEfLIYgOMLAMOXeR+jCg6QK8yoZSl3xdC5VQz0u23aybjhPB+yu XTrkn2jh5k0Rwy4zEHBHotSCO2MKRcpqp7BZMYZPyK4F/9qqqVoW4z3AM7flhX5z8Z7e mWRnrLm+sxWDHIuyFRK7TBzTCSPSTft5u6cpZCldz8oPrnloTrtxVeXpnRdCjBfHCTDG /Um5Zbm+iB5MNeyh+WYG98+QkcH09tzlgwz2dZ0G9L7hBmSdd5VgKwQ6OhdU/mgVoCS/ 9nhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version :in-reply-to:date:dkim-signature; bh=I7rXeOmhjPgxKDblBxPwExmctn5hjyWOkPZnPOO6tEA=; fh=bVI1Po6TAFdk7rrhneEtaC973qlZz8EMFqgT3KFN0Fc=; b=mnEw5ZuzS7j+2Ttk7X3cKEvvrAGDheOnh8RV84bXznCW36AwAkxhrsHT4JxCZlUDxn MZJ/bGs6Dwtd9Ndrny8Xb4cMnJd9C9RPZ5a/cGcmHNGXpVh/UfI/q4KawEykGThFrnYQ Im4QPKTmUdBIqoehqJ7z9XaYCUKJ5Hlfn8utRCtr0As6VhmP2vB+stgUZ/0dRmk2YcUF w/S7RyWp/mcttzMgAoCJ+DPdaFv7Vi5tIhsXSliqaCESPJFGk5GC29ukapFPK8HsqNHk Nkel41xgZrLriMMN0ItRX+55WJJOPNHaeyU0UUGxwbKMlpE7wl5gKoAixUP+GgTdHx+C Mwnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=QCg2g5rm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n8-20020a170902e54800b001b82da85c5asi4393200plf.336.2023.08.19.14.41.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 14:41:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=QCg2g5rm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 978B2E448E; Sat, 19 Aug 2023 01:47:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352359AbjHQQxw (ORCPT + 99 others); Thu, 17 Aug 2023 12:53:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352028AbjHQQxb (ORCPT ); Thu, 17 Aug 2023 12:53:31 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18DE61FFF for ; Thu, 17 Aug 2023 09:53:30 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d72e09f1263so92579276.1 for ; Thu, 17 Aug 2023 09:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1692291209; x=1692896009; h=cc:to:from:subject:message-id:mime-version:in-reply-to:date:from:to :cc:subject:date:message-id:reply-to; bh=I7rXeOmhjPgxKDblBxPwExmctn5hjyWOkPZnPOO6tEA=; b=QCg2g5rmwWj+zLcHzdHJ1+EJZ/K1e3el0bmzR4K6W+/DqLyCnaEB2jXi4RVnUxQ7HA zNntzNGgwdhZjtyukJHm343Kpt+depwFg3XKmq0qQTaH8fG6GomRgbFX7T3OaQ3kiejv 4cew6icSeaNsJFajQi2bq7r85j6lcf+8hvHK6vE3Hb82p6Zmf9kdx20OXvzC15Fw1r4t bZ4fZdpX8HJ/64uTMFZCCYNw9oliMO+ovSVkPZDFo0wr3ZDbhRXieruuCaXcrMBLr55E nqLc5YdgtvdoEvgz1FmuZQ36lahtcY0IiPDW2fRzLMJlOYKnkDtew0uJkPfCWNV+SxF5 Q7fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692291209; x=1692896009; h=cc:to:from:subject:message-id:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=I7rXeOmhjPgxKDblBxPwExmctn5hjyWOkPZnPOO6tEA=; b=cgLM+PvFgeYNog/bmlWfLxGJjQevzzND04nVn1oQC0pbCnQ9Jl0NWPhPynIYAsFejr S32xXCjRs+/ttAosOumKbOkAwMKTD88J6+01C+p9YEEI0fsPr6TorQ8rsPlVfzgs3tuH Fgg3iSknVmi+ww18NV/ayLbFX3y+pvJU6bj/LS90wkR3o6RMlLh1g1iN6bpai3q5QN9J nXono08npVRuyCjJX1i7t+iiTHtHl+LclWYte7A5mFvgJ1NZXZIYhlEvNZwEcDm+KUb5 SlYxK6P/RL9noYlXUo431vgAK05S/MbrhdR5T1ZAhQYkoem2P7PudvfzlMH3qJVm/HyF fD+Q== X-Gm-Message-State: AOJu0YwOmQPwpf+cFKsq8JfdnZACQZvPBnmUIUHtZZjMCDrXKfrio0SM 5HBCZl/u7IJl69Wxn37vfEKSAFA+l7FlsA0S0A== X-Received: from ackerleytng-ctop.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:13f8]) (user=ackerleytng job=sendgmr) by 2002:a25:bed0:0:b0:d4d:5407:3710 with SMTP id k16-20020a25bed0000000b00d4d54073710mr963ybm.4.1692291209254; Thu, 17 Aug 2023 09:53:29 -0700 (PDT) Date: Thu, 17 Aug 2023 16:53:27 +0000 In-Reply-To: (message from Paolo Bonzini on Thu, 10 Aug 2023 16:03:16 +0200) Mime-Version: 1.0 Message-ID: Subject: Re: [RFC PATCH 08/11] KVM: x86: Let moving encryption context be configurable From: Ackerley Tng To: Paolo Bonzini Cc: seanjc@google.com, tglx@linutronix.de, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, shuah@kernel.org, andrew.jones@linux.dev, ricarkol@google.com, chao.p.peng@linux.intel.com, tabba@google.com, jarkko@kernel.org, yu.c.zhang@linux.intel.com, vannapurve@google.com, erdemaktas@google.com, mail@maciej.szmigiero.name, vbabka@suse.cz, david@redhat.com, qperret@google.com, michael.roth@amd.com, wei.w.wang@intel.com, liam.merwick@oracle.com, isaku.yamahata@gmail.com, kirill.shutemov@linux.intel.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable 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-kernel@vger.kernel.org Paolo Bonzini writes: > On 8/8/23 01:01, Ackerley Tng wrote: >> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >> index 75d48379d94d..a1a28dd77b94 100644 >> --- a/arch/x86/kvm/x86.c >> +++ b/arch/x86/kvm/x86.c >> @@ -6351,7 +6351,14 @@ static int kvm_vm_move_enc_context_from(struct kvm *kvm, unsigned int source_fd) >> if (r) >> goto out_mark_migration_done; >> >> - r = static_call(kvm_x86_vm_move_enc_context_from)(kvm, source_kvm); >> + /* >> + * Different types of VMs will allow userspace to define if moving >> + * encryption context should be supported. >> + */ >> + if (kvm->arch.vm_move_enc_ctxt_supported && >> + kvm_x86_ops.vm_move_enc_context_from) { >> + r = static_call(kvm_x86_vm_move_enc_context_from)(kvm, source_kvm); >> + } > > Rather than "supported" this is more "required". So perhaps > kvm->arch.use_vm_enc_ctxt_op? > > Paolo Thanks, that is a great suggestion, I'll incorporate this in the next revision!