Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp588683pxb; Wed, 6 Oct 2021 11:04:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmFEi/cXiKNX0UmuxklJHWoEoDrLWRKrZtyrtPrEfG0afL+sSJ7P79pPt+BwHPjsvbXiEC X-Received: by 2002:a50:da48:: with SMTP id a8mr35546133edk.146.1633543468145; Wed, 06 Oct 2021 11:04:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633543468; cv=none; d=google.com; s=arc-20160816; b=Gx8k8Lxuc+WY4ISvgflOXnqrDOMFF7YgNEiPQiLfB/1RihthUip3TTPjffffO3MKst GlHdtNm0pWC69SltmnoqU6WdAEWMS+n22A67daLQ+q4F4EJHdn51bP3Egywl/0Tpjly0 bE/OqzgU5gSjcSoA4LUt5l1lHrnP4/+aDqLQauJ0Cfdkz+ME22uPkWt7sHeqLSmM8NQC CT+FX7lD5rkiCJXWTEeP8TuTN7z61DBxm9zgoIZ+RnvTxDtKN47ATCKdjZr0Z8s5mQ0U arnMIDy7Wbk96iKnCma7aalDrdzt5ySeNEnsQoH/tVYj+vaLOT7nzjJ8n/q/IgJipTHH 7nZA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=M9MBoxa57qBl8EbucXNm+6+CDpU5nKK5R74q/P2wZco=; b=a15ruA/s+X3FzQCTixvomqFzfbNiBYPDRQ6AMWqacWvV0vIc4wfBAwAeOt+Pf1q5Yz VLAIb1tERn6aoW6o5p3/3Gdq3KfBUAEZPuBt00DKWymW5W3UmOJ8kNII3y3yGSO9v4Il ymFYpmC5XHoSKlGPrLaTA9sjz50JUEzQ4fI6zAQkU1Ik6gApUgsUVbTUDUXKixDhNScU RQrqTkq9IE2pFfROifPdh9KSzf8e1eCj9ftLENaJggccAsjqWB3Wc+CKy+TV8FJsRSEZ peuzpQh+TDA7knPPi+aQJlraf5iXmxpmzLi7fZs6Smq9vSaVZaWqNjqe1KhlZEMs6zRV W2zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b="H7xG2/CZ"; 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=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kl9si24771565ejc.603.2021.10.06.11.04.00; Wed, 06 Oct 2021 11:04:28 -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=@alien8.de header.s=dkim header.b="H7xG2/CZ"; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239006AbhJFSEH (ORCPT + 99 others); Wed, 6 Oct 2021 14:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238855AbhJFSEB (ORCPT ); Wed, 6 Oct 2021 14:04:01 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD457C061746 for ; Wed, 6 Oct 2021 11:02:08 -0700 (PDT) Received: from zn.tnic (p200300ec2f0d3600a30656d48e985313.dip0.t-ipconnect.de [IPv6:2003:ec:2f0d:3600:a306:56d4:8e98:5313]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 566901EC0409; Wed, 6 Oct 2021 20:02:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1633543327; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M9MBoxa57qBl8EbucXNm+6+CDpU5nKK5R74q/P2wZco=; b=H7xG2/CZdsJ/MgTkVy02gONTaZR27/eEb8eziA0uR/iuTgre+5stpHsyVREuNjgrjHCp6g bmhYzQf0zzkQzASGHVERJdiYJk/VnFDTPONvN+LBMOC1RVRDEqFSYQJVczKo0HXgcqS+AO MuM0ddrmTX8mhkwyf433Av16nBJGp0I= Date: Wed, 6 Oct 2021 20:02:02 +0200 From: Borislav Petkov To: Josh Poimboeuf 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 04/11] x86/tdx: Add Intel ARCH support to cc_platform_has() Message-ID: References: <20211005025205.1784480-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20211005025205.1784480-5-sathyanarayanan.kuppuswamy@linux.intel.com> <20211005211611.ys42txybaed4ffpz@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211005211611.ys42txybaed4ffpz@treble> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 05, 2021 at 02:16:11PM -0700, Josh Poimboeuf wrote: > I assume this needs a rebase on -tip since cc_platform.c already has an > empty version of this function (and it's static so it doesn't need to be > declared in a header). Yes: arch/x86/kernel/cc_platform.c:16:28: error: static declaration of ‘intel_cc_platform_has’ follows non-static declaration 16 | static bool __maybe_unused intel_cc_platform_has(enum cc_attr attr) | ^~~~~~~~~~~~~~~~~~~~~ In file included from ./include/linux/mem_encrypt.h:17, from arch/x86/kernel/cc_platform.c:12: ./arch/x86/include/asm/mem_encrypt.h:105:6: note: previous declaration of ‘intel_cc_platform_has’ was here 105 | bool intel_cc_platform_has(enum cc_attr attr); | ^~~~~~~~~~~~~~~~~~~~~ make[2]: *** [scripts/Makefile.build:277: arch/x86/kernel/cc_platform.o] Error 1 make[1]: *** [scripts/Makefile.build:540: arch/x86/kernel] Error 2 make: *** [Makefile:1868: arch/x86] Error 2 make: *** Waiting for unfinished jobs.... I had already started that function there - please add all TDX logic in cc_platform.c. When you do your next set, you can use tip/master as a base. This should be used for all x86 patchsets anyway. > > + /** > > + * @CC_ATTR_GUEST_TDX: Trusted Domain Extension Support > > + * > > + * The platform/OS is running as a TDX guest/virtual machine. > > + * > > + * Examples include Intel TDX. > > + */ > > + CC_ATTR_GUEST_TDX, > > Examples of TDX include TDX? :-) Yeah, so whether we should be naming the actual conf. computing implementation came up during the cc_platform_has() review and looking forward in this patchset: + if (cc_platform_has(CC_ATTR_GUEST_TDX)) + return tdx_kvm_hypercall(nr, 0, 0, 0, 0); you really need to test for TDX because you're doing a TDX-specific hypercall. Which brings me back to the fastpath use of is_idx_guest(): this looks to me like a fastpath use - dunno how often one needs to do TDX hypercalls so I can imagine that for this, the is_tdx_guest() check should use a static branch. But only with numbers to show the need for it. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette