From nobody Mon Nov 25 04:49:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1715277083; cv=none; d=zohomail.com; s=zohoarc; b=iYGMtcoK16Lpq2hB/Etn1EkhVsMym6HAWbrE4gUo4CujellrKR4Jd9YBZCuqZuCHmn8vHJJyCNPXHK2CBovazvu/ICBKwZgkrs62UlQQHObz+dWNnkTgQm/MKmI2PuZdHa0LVsPrqSs+rBzgqq6fCyWrHchJ90fLKT//SB4Xe58= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715277083; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0pNAOzdrTXcAGJ1Ot2q3kGu92saKCNjFwk0wxdWZLiI=; b=k2SmlbCN9LHTNZdkHjVcXSIt6UIOEvF4Q2owm3QKF8N/hZXvOySWHXayI1d8CU2saSAdEiNEhzgnDvMlj40QR8O6wePIt8jkjPXmfYkm+Wwt6u7TwN/zOzKzRyK3+mydC3p1cWHfqcCP79xsaVuxeAYFAVnbDAP6AIeHGRCTbcE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1715277083263322.710964961234; Thu, 9 May 2024 10:51:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.719366.1122135 (Exim 4.92) (envelope-from ) id 1s57v4-0006YK-Rm; Thu, 09 May 2024 17:51:02 +0000 Received: by outflank-mailman (output) from mailman id 719366.1122135; Thu, 09 May 2024 17:51:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s57v4-0006YC-PJ; Thu, 09 May 2024 17:51:02 +0000 Received: by outflank-mailman (input) for mailman id 719366; Thu, 09 May 2024 17:51:01 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s57v3-0006Y5-7c for xen-devel@lists.xenproject.org; Thu, 09 May 2024 17:51:01 +0000 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [2a00:1450:4864:20::634]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b1f47f4d-0e2c-11ef-909c-e314d9c70b13; Thu, 09 May 2024 19:51:00 +0200 (CEST) Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a59a5f81af4so290850366b.3 for ; Thu, 09 May 2024 10:51:00 -0700 (PDT) Received: from andrewcoop.citrite.net (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a17b177fcsm96102066b.202.2024.05.09.10.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 10:50:58 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b1f47f4d-0e2c-11ef-909c-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1715277059; x=1715881859; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0pNAOzdrTXcAGJ1Ot2q3kGu92saKCNjFwk0wxdWZLiI=; b=Cd51WdbHqU5ZJ/jdqExPsi3tWEGu4dv91kx567rqg9I20f+Vgnx9RQOBA1HGhFABwu vU/U2UySXcIWTe49ijE+Ptz3kf9ohwLty45jUGpahW3ADELRK4U+ZhwSpmWHQZff53UL JEACzStF/7sOaKqrPrYJefRb6hgndf4E4LLcs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715277059; x=1715881859; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0pNAOzdrTXcAGJ1Ot2q3kGu92saKCNjFwk0wxdWZLiI=; b=cPQ2Z+ld6NAyne/Y0CanJ9f495v0SgPrivZqAxzeGV/WXN0kk57QWTghiIrp8yqLuM jW6Wicimd0xHGALuQJqXoro+5MIy/b4vrBp3kWJGgR8BER2m2DUraFRjvIZmCamWHbgO 9atKGXi5FKgDQsr88EZvWsh/MoTL0pY3jgWonGbhQcppt3POsa5/7S0BOtJzFGo2nllR 8+b7iqd2Z5YfjxaJRPoDF8LB1KBcEQ+suh1me3e7fbLjvBdjINKsfaBruqg6g8PMwmlO bIiX+XYOcu3ZrKbsPoaG0gQdzwUKbEvOqjHKpApisrzkHQ756XUpXkcEurlNrLJGUP9C KGeg== X-Gm-Message-State: AOJu0YyG4kTOFkUOtkEEZlkLszX8B8PpzLllEc0kFkBCTInLJJOwjqFr Bb+9eR4TUV1OQdWUanNZUm45VSJl0LVqbTuOyK5Vr6iliTngNq+EhLm+VRG0EncSdJlFBcJ6QV3 n X-Google-Smtp-Source: AGHT+IH5MZCYaDFzD4zge9TBvPnXZMBYvVb3Z8Al0dhmacUqE8oCSW6JhmyPzMctMLDfgx5W4ubDPA== X-Received: by 2002:a17:907:36c:b0:a59:c6fd:5160 with SMTP id a640c23a62f3a-a5a2d6bc140mr22992166b.76.1715277059271; Thu, 09 May 2024 10:50:59 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alejandro Vallejo Subject: [PATCH 4.5/8] tools/hvmloader: Further simplify SMP setup Date: Thu, 9 May 2024 18:50:57 +0100 Message-Id: <20240509175057.1921538-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1715277084202100001 Now that we're using hypercalls to start APs, we can replace the 'ap_cpuid' global with a regular function parameter. This requires telling the compil= er that we'd like the parameter in a register rather than on the stack. While adjusting, rename to cpu_setup(). It's always been used on the BSP, making the name ap_start() specifically misleading. Signed-off-by: Andrew Cooper Reviewed-by: Alejandro Vallejo Reviewed-by: Roger Pau Monn=C3=A9 --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Alejandro Vallejo This is a trick I found for XTF, not that I've completed the SMP support ye= t. I realise it's cheating slightly WRT 4.19, but it came out of the middle of= a series targetted for 4.19. --- tools/firmware/hvmloader/smp.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/firmware/hvmloader/smp.c b/tools/firmware/hvmloader/smp.c index 6ebf0b60faab..5d46eee1c5f4 100644 --- a/tools/firmware/hvmloader/smp.c +++ b/tools/firmware/hvmloader/smp.c @@ -29,15 +29,15 @@ =20 #include =20 -static int ap_callin, ap_cpuid; +static int ap_callin; =20 -static void ap_start(void) +static void __attribute__((regparm(1))) cpu_setup(unsigned int cpu) { - printf(" - CPU%d ... ", ap_cpuid); + printf(" - CPU%d ... ", cpu); cacheattr_init(); printf("done.\n"); =20 - if ( !ap_cpuid ) /* Used on the BSP too */ + if ( !cpu ) /* Used on the BSP too */ return; =20 wmb(); @@ -55,7 +55,6 @@ static void boot_cpu(unsigned int cpu) static struct vcpu_hvm_context ap; =20 /* Initialise shared variables. */ - ap_cpuid =3D cpu; ap_callin =3D 0; wmb(); =20 @@ -63,9 +62,11 @@ static void boot_cpu(unsigned int cpu) ap =3D (struct vcpu_hvm_context) { .mode =3D VCPU_HVM_MODE_32B, .cpu_regs.x86_32 =3D { - .eip =3D (unsigned long)ap_start, + .eip =3D (unsigned long)cpu_setup, .esp =3D (unsigned long)ap_stack + ARRAY_SIZE(ap_stack), =20 + .eax =3D cpu, + /* Protected Mode, no paging. */ .cr0 =3D X86_CR0_PE, =20 @@ -105,7 +106,7 @@ void smp_initialise(void) unsigned int i, nr_cpus =3D hvm_info->nr_vcpus; =20 printf("Multiprocessor initialisation:\n"); - ap_start(); + cpu_setup(0); for ( i =3D 1; i < nr_cpus; i++ ) boot_cpu(i); } base-commit: 53959cb8309919fc2f157a1c99e0af2ce280cb84 --=20 2.30.2