Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp393283pxb; Wed, 6 Oct 2021 07:13:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHRcA6ri+XOQMQJcdl/eMN8lXAHsSXNjlww1RCNG1g/wTPDPv9cmQxzFQqPrzPpsNlt2EU X-Received: by 2002:a63:6e48:: with SMTP id j69mr20751774pgc.460.1633529631881; Wed, 06 Oct 2021 07:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633529631; cv=none; d=google.com; s=arc-20160816; b=pLzOAguue4HK4v6bopyGibafnIV9WENmlKM/Ymaqft7edSbM1s3yErzvGTl0EaB9HL 20b6Q9Z79YzTYMYjmIOygns9V1KGS3VpjxnZ8+CSSj/E1E18kWuqXpmK51kEuv/BjJ3i 9rDlIy4C9pIvRYionHPK35IbxjV9sJAqrTsm0lHTKAENQ29cQzLuJPoxAkRSJGUQYmPO xJ9mBgiQPWwjAtlj48DwJxAmleFiHZolQwBeBKUlY900lbCRJLVJ2H60Ow4XAoZ2bSDZ B5RAfe3udwErziH1I8fwJxPX9uCF0fqonBDjPPPlAdGtMVNmHY534tw5USszMameIbl/ dV9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Xy5RlYEymjHYhlTWwEGYUp75qVXWvZYvAwlzU8nRwYE=; b=T/uuoaud70YSQuxICQVii/O6Tan6Xcq46pBcYly0tMRBDDU2iZWFmv5TJ16IWSZh+V b+vNaSgQlP+6x2VBb9e3IQOVWC/6J2mncRhuY2qV9OCZxEHjZThl+G4ytVCj9JYLpioZ KhkMLTY18V0LvKUidGBMbVcGsAkqfzH8btZJXW6MPUjgD61muC1wC2faAjrGMB5upw7H t9qEOXykrgW3lCwgY1pnF8Zry2r/B3dajnwVGyp1yDunHDebemd1Jp+BruTWELdXrVFD 00kx3l0sI+XYecdeqzx25rjQH8NcjqN6TyXSH6rtC1lJty1sbNig4qa1g7S5kkHJw4bb mv8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KaPSFrTP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 14si25665008pgo.462.2021.10.06.07.13.33; Wed, 06 Oct 2021 07:13:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KaPSFrTP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238218AbhJFONF (ORCPT + 99 others); Wed, 6 Oct 2021 10:13:05 -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-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