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 8E205C433F5 for ; Thu, 14 Oct 2021 07:13:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B3FD611C1 for ; Thu, 14 Oct 2021 07:13:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230007AbhJNHPE (ORCPT ); Thu, 14 Oct 2021 03:15:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbhJNHPD (ORCPT ); Thu, 14 Oct 2021 03:15:03 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 478EFC061570 for ; Thu, 14 Oct 2021 00:12:59 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1634195577; 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=e8/ZKL3qCkam3RdoGxPa61NCBe3o5Hu4qxhl481QQ/M=; b=ipF4o0uExc9Rqq+SE/vKFPwl1naCTqnp+HGU0FRWVKaRVYh/WXJPslyRQLYwCo7JLuLg0v hR70l+nYTZ4XyzLUeYDYo8odxDf54oqfY37BI4v7CSXV2Ufcdd9qGm1bNUdRM7Vzo/pl5X zt8oQO86C5lKw+54itj+gdbBTM5ce3QL4v9syAsapKqBGxtHVoz0ysrgx+EfVVR8useIDm UyLhz6sXsnLM6tIXD3dDVuWXrlO35GHdHCp08KD+GFriu1g9LW+BLMvabFY2wGuU5s4XHE wJuLpDDXKXrO+4eNog/7REQko3wvACqEW8mVv8CFtdYKPveSwbPkvrZTcTtp3g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1634195577; 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=e8/ZKL3qCkam3RdoGxPa61NCBe3o5Hu4qxhl481QQ/M=; b=xJGPePf+dseKSZ1keePo7cT9sautatbPqJyNPmvNykHPQ+2EJ8a9HX0yRFtNgGeoMVdHzL 5tPhtgiXPufJhuCA== To: Kuppuswamy Sathyanarayanan , Ingo Molnar , Borislav Petkov , x86@kernel.org, Paolo Bonzini , David Hildenbrand , Andrea Arcangeli , Josh Poimboeuf , Juergen Gross , Deep Shah , VMware Inc , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel Cc: 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 v10 04/11] x86/tdx: Add TDX support to intel_cc_platform_has() In-Reply-To: <20211009053747.1694419-5-sathyanarayanan.kuppuswamy@linux.intel.com> References: <20211009053747.1694419-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20211009053747.1694419-5-sathyanarayanan.kuppuswamy@linux.intel.com> Date: Thu, 14 Oct 2021 09:12:56 +0200 Message-ID: <87tuhk6pvr.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 08 2021 at 22:37, Kuppuswamy Sathyanarayanan wrote: > > -static bool __maybe_unused intel_cc_platform_has(enum cc_attr attr) > +static bool intel_cc_platform_has(enum cc_attr attr) > { > #ifdef CONFIG_INTEL_TDX_GUEST > - return false; > + switch (attr) { > + case CC_ATTR_GUEST_TDX: > + return is_tdx_guest(); This function is only called when is_tdx_guest() is true. So is_tdx_guest() has to be called again to make sure? Also the ifdeffery can just go away simply because the compiler will discard this function when CONFIG_INTEL_TDX_GUEST=n due to: > +#ifdef CONFIG_INTEL_TDX_GUEST > + > +bool is_tdx_guest(void); > +void __init tdx_early_init(void); > + > +#else > + > +static inline bool is_tdx_guest(void) { return false; } > +static inline void tdx_early_init(void) { }; > + > +#endif /* CONFIG_INTEL_TDX_GUEST */ Thanks, tglx