Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1698827pxb; Thu, 4 Nov 2021 07:01:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEuME/p9odvyySpBQFpTEnalDaJd3aqst4rgM+Ib4PhvREwoTlitlhq/9jkw6Un4/JUCgv X-Received: by 2002:a02:9688:: with SMTP id w8mr3970913jai.37.1636034477989; Thu, 04 Nov 2021 07:01:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636034477; cv=none; d=google.com; s=arc-20160816; b=N2dr5/kw6UBItPey1JsCPrF5eDeGDaIkP8vem4aREuqy6sF2CMBAur9Ir932/IGhDF x+vnn2bxIe02AS354BnQjkWqsYHs8oQyjxiETwMnidr1/pQzwjccb8apSh7i4RO15SE2 y9kGRAYbenPyBC1/DMRre31Flfhd4p75FBWpm/l5c+G18ELDo032+nKoegrKf0GVr2lB Ii5/pHD4LZ3rRezM+CapVuIKOmkpjLqyZAsbufticmX1UXjvRLvCBBCff6nvwd8wjKAz 0QT3q+MBL1Apo04grbwKjSVhQtyId05XKwWzfBLODli9nNePHZPfL2/bwv2Lu1E3JO8z vfCg== 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=7LX03mAYK04otWZOoY71ALabwci0dk1MWKslK4zWu2I=; b=D3l5iBLuJa6bevYnua8Mz071Q61dWFL8yP0+ol/e8Pyq+/xxILCqR4zNG2d5UX/RvY FJCYsYabrH4FxYitzXXDkcLAWi6aa0u4T4mLT+SPVIqijZ+ygCOb4O1UvhQGYV08+gBF mv/diaUG3uEPM+47IFrhGZNpBIO1k3CJQmq25KkK0JT62DtbzfxFabMIvWZzF3O6Crww QVhNwn05laRffxAC+CSQFxMpiUo/7lozJCP0raff2cj3eOLhIbrSW67zsvjfp6x/3Lih cWSP3aPJbEZATgiX12kaieGuSHB+I/t/ygdGyB+lT9LO/Wk7rxO4b9G/uJCHLrcGmfNN t/5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=KR+lLKKL; 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 g3si9649538ile.19.2021.11.04.07.00.25; Thu, 04 Nov 2021 07:01:17 -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=KR+lLKKL; 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 S231252AbhKDOBl (ORCPT + 99 others); Thu, 4 Nov 2021 10:01:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230511AbhKDOBk (ORCPT ); Thu, 4 Nov 2021 10:01:40 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFD1EC061714; Thu, 4 Nov 2021 06:59:02 -0700 (PDT) Received: from zn.tnic (p200300ec2f0f2b00292987ac0c06fcda.dip0.t-ipconnect.de [IPv6:2003:ec:2f0f:2b00:2929:87ac:c06:fcda]) (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 07B031EC0570; Thu, 4 Nov 2021 14:59:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1636034341; 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:in-reply-to:in-reply-to: references:references; bh=7LX03mAYK04otWZOoY71ALabwci0dk1MWKslK4zWu2I=; b=KR+lLKKLVG+OimGX0G+TVfeAzPp3+DAiK71o99+TN8MKguX6+YMASSnyMiA33sWx6z9RXk PtVWl2Hv+ntT4D5AF+ZUH0n29RNRaoDCwwzmVLEOIeXtzSFlfK82CoRS/vUfvkp7K/I00A cmZCFAiEROjuNQ7+z/kvpv4vyBBOcTY= Date: Thu, 4 Nov 2021 14:58:49 +0100 From: Borislav Petkov To: Brijesh Singh Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Michael Roth , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , "Dr . David Alan Gilbert" , tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH v6 14/42] x86/sev: Register GHCB memory when SEV-SNP is active Message-ID: References: <20211008180453.462291-1-brijesh.singh@amd.com> <20211008180453.462291-15-brijesh.singh@amd.com> 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, Nov 03, 2021 at 03:10:16PM -0500, Brijesh Singh wrote: > Looking at the secondary CPU bring up path it seems that we will not be > getting #VC until the early_setup_idt() is called. I am thinking to add > function to register the GHCB from the early_setup_idt() > > early_setup_idt() > { > ... > if (IS_ENABLED(CONFIG_MEM_ENCRYPT)) > sev_snp_register_ghcb() > ... > } > > The above will cover the APs That will cover the APs during early boot as that is being called from asm. > and for BSP case I can call the same function just after the final IDT > is loaded Why after and not before? > cpu_init_exception_handling() > { > ... > ... > /* Finally load the IDT */ > load_current_idt(); > > if (IS_ENABLED(CONFIG_MEM_ENCRYPT)) > sev_snp_register_ghcb() > > } That is also called on the APs - not only the BSP. trap_init() calls it from start_kernel() which is the BSP and cpu_init_secondary() calls it too, which is ofc the APs. I guess that should be ok since you're calling the same function from both but WTH do I know... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette