Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp113250iof; Sun, 5 Jun 2022 22:46:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxP1PKr2O+YEeZRfV2l7tBi/nHUBsHS0yOjAhzrddIGdG2bstSHBcLYOuDmR08mSNans2pl X-Received: by 2002:a65:6499:0:b0:3fc:dcaa:ad62 with SMTP id e25-20020a656499000000b003fcdcaaad62mr18844815pgv.63.1654494410824; Sun, 05 Jun 2022 22:46:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654494410; cv=none; d=google.com; s=arc-20160816; b=A+C4kMkYJdT0Ua/zy95YOUiQW2GNh42mEs1p5uJwzi1f2o8SfHFlln62KFfvZO7alO sISlT5K5e666RSiY+5d9OPfPqBRxFz8BFaz5y+NBXv6qkDZfUDcQKR/SsS5ULVvJjK3Q sZaSUVKDe19SSC6QWZAYZYV15LtGijWYNupdkl7adZjz7FHF1Hp1SudGTcFWpfdVBYuj ty478SehPGFN+SHMEY6xNSMhBk9CIfppHUVgbOErmxZX33rB3zKiU46tuDYu4jzx4Aot RQmmax1RugOIZM6DDrt5OflDgG/iB61zZY57JuvCi9m5uN3UESErd6lbF1wfEYvlbY5s Hz1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NUqtccdmHpVOa+ywhrLDU/DEc/VQZ0bOnsbWDSLDOhE=; b=S74KGNRmXKkPTax5GepJ2XgilfhBE/ct0p8JlK9HR7hvMPbi82f1qnaF/8KCZrGZVo hk73DYUF4nHGub2m32vOMeMSLXF3Ri+6hO8Pu0LbSQE/QPehqb/BtV3Rayp2TH8woSJF 2KrGay61xnoihaGVu9j93HzrEYWEW4yW8VO2sPha7thLyHjQQFzVRvtYv9F+L1iN3MHt Z0WV98j3EniwHc9Q+S18QPVXBf7UOhfWKuNg+qjNXnrWuGEMOdGMzkmS5cHpU46jSara /SrEUOugFdicBJykKRThO70+9PpUw+WRCnZhcbnFV3w9Ko0sv5ytZ86KEyI8mIBk/TdE wsCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SWegMuBH; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n8-20020a170902d2c800b00153be6474c2si14695441plc.531.2022.06.05.22.46.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 22:46:50 -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=@gmail.com header.s=20210112 header.b=SWegMuBH; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DBD5A25D5D1; Sun, 5 Jun 2022 21:38:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350708AbiFEGeC (ORCPT + 99 others); Sun, 5 Jun 2022 02:34:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350702AbiFEGd5 (ORCPT ); Sun, 5 Jun 2022 02:33:57 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B42F139BA6; Sat, 4 Jun 2022 23:33:50 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id v5-20020a17090a7c0500b001df84fa82f8so10176705pjf.5; Sat, 04 Jun 2022 23:33:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NUqtccdmHpVOa+ywhrLDU/DEc/VQZ0bOnsbWDSLDOhE=; b=SWegMuBHwVm86rAMIdjeOqJQmSxdml17S0fO9qMiE26K9ALz8kNPDUz0JAT0JdA9tM lf9Vr9q0qeNGIvOh5U7I1HFsr7A6F7V5QCzMWzzwaf6uYuCpGEtWD4l7jbRAjEuXBLM4 WiPTxOkWkoI/bf66whbmr0lDQqE7pP3qw9czwuMWWr/blhoSvT57KsQDK7vQISNFvz1z AIfjiOQaOFVqo2CaNjbeID5tyr5L4qENYEw1lKrc3gAQ08+RTsCkFFaXHeEKSzutJMri Ji5rPZKyWj377D/1UBimDpIZ85LYAm3TK+Y6nWqYTGPWcpSItSzi2Wwn/N7EMN8VjW4k s+uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NUqtccdmHpVOa+ywhrLDU/DEc/VQZ0bOnsbWDSLDOhE=; b=56wEgLngi7aFEWqBeWHqWmq6vY+0c/ey/nv51+GM/Igyw3E2U9bNra1BOZLXySJDwD gU6fJ0IhT9ZNWUchP9uM1aKFOiyfjkO/5rtC7mm+3McQUXIkZ3t/z3tSLcW1jUHaVQlN i/gbunboUiB41NwOamrYHgc1/MHUDjZEhNEXbOKMv5ODEAARFCdkXkIWU5DDw0MbR52k dvxpxXkR7+OYXmhgMfw57WPr/aSSdwlVVF3q9wyA4yJ/AJ/ODUqZwqA7rhrM5G0UuX5A aAKL9VusJrJBkxfHOu4diUo4W7fOqvzP6PB2R1sPgmK1eA0T8X9UkbsfgNmR9aUkGynF pjCg== X-Gm-Message-State: AOAM531jVvtuYwv1gimYaYu1dM2QK6DbLFR3H8BsW1BE2erQ8OpTrvHw 874OMq7wkm7/VQvPwE8zBcV+Z1ihcP0= X-Received: by 2002:a17:902:f605:b0:14d:bd53:e2cd with SMTP id n5-20020a170902f60500b0014dbd53e2cdmr17930942plg.164.1654410830007; Sat, 04 Jun 2022 23:33:50 -0700 (PDT) Received: from localhost ([198.11.178.15]) by smtp.gmail.com with ESMTPSA id s21-20020a635255000000b003db072fd9adsm8113867pgl.74.2022.06.04.23.33.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Jun 2022 23:33:49 -0700 (PDT) From: Lai Jiangshan To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Maxim Levitsky , Lai Jiangshan Subject: [PATCH 6/6] KVM: X86/SVM: Use root_level in svm_load_mmu_pgd() Date: Sun, 5 Jun 2022 14:34:17 +0800 Message-Id: <20220605063417.308311-7-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20220605063417.308311-1-jiangshanlai@gmail.com> References: <20220605063417.308311-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Lai Jiangshan The caller always call it with root_level = vcpu->arch.mmu->root_role.level. Signed-off-by: Lai Jiangshan --- arch/x86/kvm/svm/svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 3b49337998ec..f45d11739314 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -3951,7 +3951,7 @@ static void svm_load_mmu_pgd(struct kvm_vcpu *vcpu, hpa_t root_hpa, hv_track_root_tdp(vcpu, root_hpa); cr3 = vcpu->arch.cr3; - } else if (vcpu->arch.mmu->root_role.level >= PT64_ROOT_4LEVEL) { + } else if (root_level >= PT64_ROOT_4LEVEL) { cr3 = __sme_set(root_hpa) | kvm_get_active_pcid(vcpu); } else { /* PCID in the guest should be impossible with a 32-bit MMU. */ -- 2.19.1.6.gb485710b