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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A13E6C433EF for ; Wed, 6 Oct 2021 14:11:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7CC37610A5 for ; Wed, 6 Oct 2021 14:11:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238818AbhJFONG (ORCPT ); Wed, 6 Oct 2021 10:13:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30339 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231540AbhJFONE (ORCPT ); Wed, 6 Oct 2021 10:13:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633529472; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Xy5RlYEymjHYhlTWwEGYUp75qVXWvZYvAwlzU8nRwYE=; b=KaPSFrTPLvzhSPpPW/cDlHijUZc8+hlt0Al9I4B/604f7dmhXKAu7KKIqVoMf2yKpWhf4O YoKm+lJT4fbhoCgY4mAKg9DA4ISwjm1t6H76QqZDoB7HTI9207Z/JnQHjhNA20of8KShHZ JrY4hJL8wiTLqKU15NaMOYIdOP14z2A= Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-237-HmvIHqUtP76eSo49qhIr5Q-1; Wed, 06 Oct 2021 10:11:11 -0400 X-MC-Unique: HmvIHqUtP76eSo49qhIr5Q-1 Received: by mail-ot1-f72.google.com with SMTP id b7-20020a0568301de700b0054e351e751aso71838otj.11 for ; Wed, 06 Oct 2021 07:11:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Xy5RlYEymjHYhlTWwEGYUp75qVXWvZYvAwlzU8nRwYE=; b=7+yicqRTd+wEVX04wvzOKZ1cCa3S0zWA56icziWCO+Ge37vJWCW5CIEQNjsO/vtDBL xRMCAUiK6UoHg8vg0R5In0oYNvavWa9i+S9ODyjkuAQR9ayKehzg1TleWJwlRZMnO+i5 /HUyhE3MYEaExZpoPEaggdyHFNEqUXsVprVAPJoIYrHTxVywNY5pfSZmGhbgNp2Vk9As 5p5mD6WH5QRHPPZRVCDTEvBEG/CqaTJE6YlENYSldhO6tkOCQmb00B/f7wKyk3Qrib4d eJeHVM4P8z0iRVa4xHp3Ybkt2k8Cg2u3lLuIu74nkSai4XAb99PVIA1aK2/+jW39cc8P MQ2A== X-Gm-Message-State: AOAM530jZUFtPAx9UANHPLs/HmO8Tec7w/XHl0RYrRWpF+TOu1EQIw39 KQVLitkCfOdD+Qrcw7fNZ9QZf6ANMNjvVmGRIAd2bw8FZlz0OSLLqDBpW98yJ7SvPtOZysxpqcw hud0T4sCnW9gUigBh+ST99M4y X-Received: by 2002:a54:4799:: with SMTP id o25mr7399253oic.90.1633529470331; Wed, 06 Oct 2021 07:11:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynhZ1smlMQdEfQrCtrXOQZRjyieymRWXcbQ4mnTNDnk2g1VaYvZkd2FcoTkv0m6/3IlBFQxg== X-Received: by 2002:a54:4799:: with SMTP id o25mr7399215oic.90.1633529470068; Wed, 06 Oct 2021 07:11:10 -0700 (PDT) Received: from treble ([2600:1700:6e32:6c00::49]) by smtp.gmail.com with ESMTPSA id e2sm4289367otk.46.2021.10.06.07.11.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 07:11:09 -0700 (PDT) Date: Wed, 6 Oct 2021 07:11:05 -0700 From: Josh Poimboeuf To: Borislav Petkov Cc: "Kuppuswamy, Sathyanarayanan" , Thomas Gleixner , Ingo Molnar , x86@kernel.org, Paolo Bonzini , David Hildenbrand , Andrea Arcangeli , Juergen Gross , Deep Shah , VMware Inc , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Peter H Anvin , Dave Hansen , Tony Luck , Dan Williams , Andi Kleen , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 03/11] x86/cpufeatures: Add TDX Guest CPU feature Message-ID: <20211006141105.offh3fqhyupzqs7v@treble> References: <20211005025205.1784480-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20211005025205.1784480-4-sathyanarayanan.kuppuswamy@linux.intel.com> <20211005210423.yfftpxxmj3cjprtv@treble> <15a07997-2659-6be1-b8a3-da57e72562b5@linux.intel.com> <20211006034218.ynamwigsvpgad7sr@treble> <20211006050309.ldn5myznmpurnomm@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 06, 2021 at 02:47:42PM +0200, Borislav Petkov wrote: > On Tue, Oct 05, 2021 at 10:03:09PM -0700, Josh Poimboeuf wrote: > > I'm not suggesting getting rid of the feature flag. I'm suggesting > > getting rid of the global variable. Is there a reason you can't check > > the feature flag instead of checking the global variable? > > The reason is that cc_platform_has() is used too early, even before > get_cpu_cap(). So you need to have TDX guest detected even before > feature flags. Ok. At least it sounds like cc_platform_has() needs a comment stating that caps can't be relied on, and why. -- Josh