Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5501869pxb; Wed, 26 Jan 2022 13:33:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxM3chwP/MEtRV36TyMd3u3ochBMM5u8HTzsz1w393/JuBUBICEwm7T27EgY6wkO9x/rFXi X-Received: by 2002:a17:907:728b:: with SMTP id dt11mr588852ejc.70.1643232780415; Wed, 26 Jan 2022 13:33:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643232780; cv=none; d=google.com; s=arc-20160816; b=NmQRSDcQ6RAyUPP2PEirbgNA4PZ0Y2XSgPLKeAsekPd4xO51Qmip1JBY/vQqPTCDGd 33WwRfBvQULzE3pwQXoLLEMCzOPmDpN4e0fLIwaU5rxS2kF/rRS9ufk+GQXR8ttWQ8DK W6m/T7ET3+818nuKnXFovnYsq9zhDAJNNTi5QCQT0EFJ1J+Gfck9s/7QrDg40FKhL88/ iJXrj9GkpzsuGh+Sjs/n8fifRQH+BSB5NmAYBeOq8uF/Qxm95sc4J0f5OH17zi2w69gx cFWvCjhrvUhMDO9veMlbNW3VA4MOc4K0+wElbxqtFcIG80vf59y8JjcpgmxbdxdkpaaE WPYg== 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:dkim-signature; bh=WLyKhfXHS44+Znkmdw5Wkn13IOJ7HmCc2bqdYmRAEVg=; b=U1JnSLxby2PorfzmwoVc+hIFtlRIziEO3aJZPyPe/PMUcde4wimssqe6z1JuGF19Ih h92EeUQeMTnU3hQo42VH3IWZYXm2Jj6/hcv1/mGG2NqFfMLKN4pCdQWotc+o6eNkjFlK efQcSH/zvabPJbQkVqKtHmK23aa16MA90jHBpvbIDQ+xmfAJNwmbd9sDjMlWwcOiDadf e1ZCeuZCpDFyWLoqJ1oYSZcSQugcjinER95JPWNj3Atyt99rgBG88x3l+aL2sh9rJvCk oAXE+s9fm9/bEcrdm61dErpoZhiCl+62gxtCiF54iW/syt9fwisAkkTLuorZqfrCUrmZ XK+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=oxNzeR3E; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sb4si144671ejc.267.2022.01.26.13.32.35; Wed, 26 Jan 2022 13:33:00 -0800 (PST) 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=@suse.de header.s=susede2_rsa header.b=oxNzeR3E; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242111AbiAZO0L (ORCPT + 99 others); Wed, 26 Jan 2022 09:26:11 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:34450 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235227AbiAZO0F (ORCPT ); Wed, 26 Jan 2022 09:26:05 -0500 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3E8002113B; Wed, 26 Jan 2022 14:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1643207164; h=from:from:reply-to: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=WLyKhfXHS44+Znkmdw5Wkn13IOJ7HmCc2bqdYmRAEVg=; b=oxNzeR3EjZyJqfzhIUshnheJ0INLWf66MfyocLgT8F2bMmX9rDhOpeOucc8uVnXkZnlwrL N6DmoMYW3MhH5LkEKjNETbnhojlh6h7S2PMJeLFWEUdQHmfizHlU7tRzGWjzCoobQEbKJf Ig3Kn6r6NxAW9MfIjTmTj8hdFAJj694= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1643207164; h=from:from:reply-to: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=WLyKhfXHS44+Znkmdw5Wkn13IOJ7HmCc2bqdYmRAEVg=; b=Zf9Zim80aCa4MDEXnNy318W3kpCJ/XdcZx5iwGuSF2NMAz3RXI1cSFR9dyB9uSO5TpCLIW +YTW2Lzh1DdMS1CA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5A9AA13E1A; Wed, 26 Jan 2022 14:26:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oZl4FPtZ8WHxegAAMHmgww (envelope-from ); Wed, 26 Jan 2022 14:26:03 +0000 Date: Wed, 26 Jan 2022 15:26:01 +0100 From: Joerg Roedel To: Borislav Petkov Cc: Joerg Roedel , x86@kernel.org, Eric Biederman , kexec@lists.infradead.org, hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Sean Christopherson , Martin Radev , Arvind Sankar , linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v2 07/12] x86/sev: Setup code to park APs in the AP Jump Table Message-ID: References: <20210913155603.28383-1-joro@8bytes.org> <20210913155603.28383-8-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 10, 2021 at 05:37:32PM +0100, Borislav Petkov wrote: > On Mon, Sep 13, 2021 at 05:55:58PM +0200, Joerg Roedel wrote: > > extern unsigned char real_mode_blob[]; > > diff --git a/arch/x86/include/asm/sev-ap-jumptable.h b/arch/x86/include/asm/sev-ap-jumptable.h > > new file mode 100644 > > index 000000000000..1c8b2ce779e2 > > --- /dev/null > > +++ b/arch/x86/include/asm/sev-ap-jumptable.h > > Why a separate header? arch/x86/include/asm/sev.h looks small enough. The header is included in assembly, so I made a separate one. > > +void __init sev_es_setup_ap_jump_table_data(void *base, u32 pa) > > Why is this a separate function? > > It is all part of the jump table setup. Right, but the sev_es_setup_ap_jump_table_blob() function is already pretty big and I wanted to keep things readable. > > > + return 0; > > Why are you returning 0 here and below? This is in an initcall and it returns just 0 when the environment is not ready to setup the ap jump table. Returning non-zero would create a warning message in the caller for something that is not a bug in the kernel. > > + * This file contains the source code for the binary blob which gets copied to > > + * the SEV-ES AP Jumptable to park APs while offlining CPUs or booting a new > > I've seen "Jumptable", "Jump Table" and "jump table" at least. I'd say, do > the last one everywhere pls. Fair, sorry for my english being too german :) I changed everything to 'jump table'. > > + /* Reset remaining registers */ > > + movl $0, %esp > > + movl $0, %eax > > + movl $0, %ebx > > + movl $0, %edx > > All 4: use xor XOR changes EFLAGS, can not use them here. > > + > > + /* Reset CR0 to get out of protected mode */ > > + movl $0x60000010, %ecx > > Another magic naked number. This is the CR0 reset value. I have updated the comment to make this more clear. Thanks, -- J?rg R?del jroedel@suse.de SUSE Software Solutions Germany GmbH Maxfeldstr. 5 90409 N?rnberg Germany (HRB 36809, AG N?rnberg) Gesch?ftsf?hrer: Ivo Totev