From patchwork Fri Jan 22 20:21:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 12040425 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=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 2060EC433E0 for ; Fri, 22 Jan 2021 20:29:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E98D423B01 for ; Fri, 22 Jan 2021 20:29:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730427AbhAVU3J (ORCPT ); Fri, 22 Jan 2021 15:29:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729851AbhAVU0Z (ORCPT ); Fri, 22 Jan 2021 15:26:25 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE298C061220 for ; Fri, 22 Jan 2021 12:22:14 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id l3so6606806ybl.17 for ; Fri, 22 Jan 2021 12:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=ut/T6G9w71CC8HxNYO0u5RfiusnblVieh7wlxdxSOrI=; b=ZtWeshgPgZFT5yQIvxcM8SgjVvKSYldmaFOWVPWpa7cHVfKH1Vif6eY40k2Y5/9f4O ljrfJkzqfwvROg9IjLCwTTabk8eO35wsFAsljC7ZijOOcj2LI4ITfI2RKNxwu26GbK+J CEw64JAKIanQZE5O9DA4kgHRinl8/thJ66tv8mtj6J6rePNXHvhIrvNjMDhOVTgII4V8 Wjy3gRo1RA2DLb3adHTd2KOaKhlc9a87qK3huJXbGsvZzTVfbKzMpf7+6RxADg7x3YUm WzNT7nYS5herjV4J3KXpLDxeNMKUzf8q8iFG8X0+OYpF52eFKqg6uw3NC9jFqoRTZQU0 NGTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=ut/T6G9w71CC8HxNYO0u5RfiusnblVieh7wlxdxSOrI=; b=Ale71Zpvo4uTg916o5HHBEz66ExCxyoWTYBt+aa1Hq9tqRjujUk7ydB32AwmueakZW TdapNyxaKnEeYmNLaLWZALL8UUvFaqgsTeG4cJm/FqXgPIs6Hx1pXAxu+j2pey1KGPmz XDPjwNf0BOpL7ugPltVwtBhhiJIq2oR3oZ1qEOqQ7LagWEoftWBvZ4uUZ0GjsjGW7LNd q2cKrHOz0TLC/szNy/+CstalYBzTSiCAI1LBHlcgzLNifEmnMr0rcf3zXmCdKwapAmv1 LzwGlmjNAvZgnHsmjamtd3nLxGlK0K5h3QY5ut68MVzAu6bfX+c2nyMisNZ82XN3HIoo +Apg== X-Gm-Message-State: AOAM533fZG4/N5jCS8eefs+2nhmrvQa8JTAIYDPVymFHTkmdTGZcEw0d i1TPvGKS8sG2QssAKT0N/HtJegAhj94= X-Google-Smtp-Source: ABdhPJzU0vWM6wYGFiAUoIChr7p55Yc7uqfLcyX3pxdBDck5MZeamqNODJnRxoFV+aaIRs66gnd9KswWCuo= Sender: "seanjc via sendgmr" X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:1ea0:b8ff:fe73:50f5]) (user=seanjc job=sendgmr) by 2002:a05:6902:701:: with SMTP id k1mr8686405ybt.342.1611346934044; Fri, 22 Jan 2021 12:22:14 -0800 (PST) Reply-To: Sean Christopherson Date: Fri, 22 Jan 2021 12:21:40 -0800 In-Reply-To: <20210122202144.2756381-1-seanjc@google.com> Message-Id: <20210122202144.2756381-10-seanjc@google.com> Mime-Version: 1.0 References: <20210122202144.2756381-1-seanjc@google.com> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH v3 09/13] KVM: SVM: Explicitly check max SEV ASID during sev_hardware_setup() From: Sean Christopherson To: Paolo Bonzini , Dave Hansen , Andy Lutomirski , Peter Zijlstra Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Borislav Petkov , Tom Lendacky , Brijesh Singh Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Query max_sev_asid directly after setting it instead of bouncing through its wrapper, svm_sev_enabled(). Using the wrapper is unnecessary obfuscation. No functional change intended. Reviewed by: Tom Lendacky Reviewed-by: Brijesh Singh Signed-off-by: Sean Christopherson --- arch/x86/kvm/svm/sev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 75a83e2a8a89..0c69de022614 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -1278,8 +1278,7 @@ void __init sev_hardware_setup(void) /* Maximum number of encrypted guests supported simultaneously */ max_sev_asid = ecx; - - if (!svm_sev_enabled()) + if (!max_sev_asid) goto out; /* Minimum ASID value that should be used for SEV guest */