Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp665871lqp; Fri, 5 Apr 2024 05:35:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXW5C8Lhzn1o4YSdYFGfAqS7lZAr6hvnw79dEZSf/GEyLtwzUg5biifS/f/MiehbEdxa73f6gGuKLx7QCRWE/pJ9Glm3vlPWJTzN2QULw== X-Google-Smtp-Source: AGHT+IGUoEDmUHWfQtw/0rPK4+sYeAydj5FLwrTNhZMUQPJuT7w6lVYDxYcIcnpiskIvRxF/grcu X-Received: by 2002:a50:d69e:0:b0:56b:ff5d:8bdc with SMTP id r30-20020a50d69e000000b0056bff5d8bdcmr786423edi.32.1712320526482; Fri, 05 Apr 2024 05:35:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712320526; cv=pass; d=google.com; s=arc-20160816; b=J+dBB0R0stWRCLk9GWIeTufBTd7DYhf81EIyetkFILUfjs0Asibr2hdopwt8OVtazC 5o41ycC7vuCTGwOMjnd+1hCGi5OYwTPobDm4YQT5TqcwOlazyts7PGHxx0NfyoA18Ru3 uFEYil6epJpeMLQ5DTGSu0jOmkKMC2qXwytclYyxERVNIk3M51IewsvwXd4OceZEuA9x s2V0Db/4cy0mapei+I8CfbwVLlkoWj1UVzN9zFGetQjlvRffHqfb+3ehgnLVc4234qsY WR9yKa5uMDgOTLmqUmw5YfxWzeYX+JQ6IFIb1FJtFTwGvdCMO88FknlFaqek5W6i0Upw h6WQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-signature; bh=c0jyNvKTHax+A0LD2eIp7A6uzmXI0s1Z7nkLE2AaG4I=; fh=xP7rPEwwmYjRFdY4LvohNByAc3I2TDa74iPJEEVDE0E=; b=NfdA9D+tpqa4dZsydBeRFTVj8TbLBdm/FyaK1tryRwk5QB5IPa4hXtXMmY9bXYR/I3 VCA73emmNKZngDD3b5i/UMeQWqwTmTvBWF7SkU6ysLYv1JZA9ZK5jAK3a6xOzTeZz0XQ tRZ+cMURKqcb8DD/ql56Q0RrD9J+I83oNaZkJ1L9CyUdGahZzqA4Uy+l2CWwpGckabdT Xvq9uymfvmg8RY577sV5yXkiDsA6lgOfIVdWi+CAkcz5kg0Ypp3STTuth4PafySQ+yn+ EHB9QAjIWruaNeXjR2FY2vvNcgAlDnKjOgbLOkFdk8UDVAJpSVWZvi4jWG19iWeIlk6X Wr7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=AubcmXMI; dkim=pass header.i=@suse.com header.s=susede1 header.b=AubcmXMI; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-133000-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133000-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id w2-20020a056402268200b0056bb595c196si705647edd.457.2024.04.05.05.35.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 05:35:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-133000-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=AubcmXMI; dkim=pass header.i=@suse.com header.s=susede1 header.b=AubcmXMI; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-133000-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133000-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 33D551F230EE for ; Fri, 5 Apr 2024 12:35:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AB48C16D321; Fri, 5 Apr 2024 12:34:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="AubcmXMI"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="AubcmXMI" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C1381649DF for ; Fri, 5 Apr 2024 12:34:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712320491; cv=none; b=ncMeE+MpYeJyhSCQNiab9FSdPvM2GQsdQ1WU/bNJ8ZWWQEMqGgu2ldsflfLYvNqXFPraF4pLC69zmHyPCPkGHUeWJnU1YOh67rBFgKRrBvHGJFjNZo4sponRAufuxCsNbgTl0OrDkSdgVuf63no9trFnmBT0DpF98YXHZsbOwCE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712320491; c=relaxed/simple; bh=BXQyPFPv0NM5RDtg/91lIFxeN5FaeuVD8cD23jfuqKs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=R8USK9+6O2UswinqWqLk2MKjsLB1Qqs6LG9xV/CFlj1h87oiGzrI904g/ioUlZLFFxlD35i6zhtbftUqvTrXHf3u3X1N3lCAsOjk7RVGlhgXc0BIl4fC30ywqZ29qgcBGhn87FIGaazDNtmgnhL1YfrF8XP1z8IlY6FQdP4GblE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=AubcmXMI; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=AubcmXMI; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 51D5821A42; Fri, 5 Apr 2024 12:34:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1712320488; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c0jyNvKTHax+A0LD2eIp7A6uzmXI0s1Z7nkLE2AaG4I=; b=AubcmXMIMx2JuozlxaVZ6aoO1vmLMUD9McUXagcomdrknSUs72w/jRG5+BoqixzGF0Ynsw cmF67Yy8MEYjggWpzTKsZzIbF3YbDaUtLurvHF8BAWTkjzVGze/+nrAloogUfDHSOItTDP iSROy7dI6S/oknWyfBY5jJI1PiOF/E4= Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1712320488; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c0jyNvKTHax+A0LD2eIp7A6uzmXI0s1Z7nkLE2AaG4I=; b=AubcmXMIMx2JuozlxaVZ6aoO1vmLMUD9McUXagcomdrknSUs72w/jRG5+BoqixzGF0Ynsw cmF67Yy8MEYjggWpzTKsZzIbF3YbDaUtLurvHF8BAWTkjzVGze/+nrAloogUfDHSOItTDP iSROy7dI6S/oknWyfBY5jJI1PiOF/E4= Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id E9EF1139E8; Fri, 5 Apr 2024 12:34:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap2.dmz-prg2.suse.org with ESMTPSA id VZuqN+fvD2adGgAAn2gu4w (envelope-from ); Fri, 05 Apr 2024 12:34:47 +0000 From: Juergen Gross To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Juergen Gross , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , xen-devel@lists.xenproject.org Subject: [PATCH 2/2] x86/xen: return a sane initial apic id when running as PV guest Date: Fri, 5 Apr 2024 14:34:34 +0200 Message-Id: <20240405123434.24822-3-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240405123434.24822-1-jgross@suse.com> References: <20240405123434.24822-1-jgross@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Flag: NO X-Spam-Score: -6.80 X-Spam-Level: X-Spamd-Result: default: False [-6.80 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_SEVEN(0.00)[10]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap2.dmz-prg2.suse.org:helo,imap2.dmz-prg2.suse.org:rdns,suse.com:email] With recent sanity checks for topology information added, there are now warnings issued for APs when running as a Xen PV guest: [Firmware Bug]: CPU 1: APIC ID mismatch. CPUID: 0x0000 APIC: 0x0001 This is due to the initial APIC ID obtained via CPUID for PV guests is always 0. Avoid the warnings by synthesizing the CPUID data to contain the same initial APIC ID as xen_pv_smp_config() is using for registering the APIC IDs of all CPUs. Fixes: 52128a7a21f7 ("86/cpu/topology: Make the APIC mismatch warnings complete") Signed-off-by: Juergen Gross --- arch/x86/xen/enlighten_pv.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index ace2eb054053..965e4ca36024 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -219,13 +219,20 @@ static __read_mostly unsigned int cpuid_leaf5_edx_val; static void xen_cpuid(unsigned int *ax, unsigned int *bx, unsigned int *cx, unsigned int *dx) { - unsigned maskebx = ~0; + unsigned int maskebx = ~0; + unsigned int or_ebx = 0; /* * Mask out inconvenient features, to try and disable as many * unsupported kernel subsystems as possible. */ switch (*ax) { + case 0x1: + /* Replace initial APIC ID in bits 24-31 of EBX. */ + maskebx = 0x00ffffff; + or_ebx = smp_processor_id() << 24; + break; + case CPUID_MWAIT_LEAF: /* Synthesize the values.. */ *ax = 0; @@ -248,6 +255,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, : "0" (*ax), "2" (*cx)); *bx &= maskebx; + *bx |= or_ebx; } static bool __init xen_check_mwait(void) -- 2.35.3