From nobody Mon Dec 15 21:30:03 2025 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1744127868; cv=none; d=zohomail.com; s=zohoarc; b=e/LnlcYCVsGsQFUAQKIf7xTr+mdEAKBWodsJRdOGY1eBU59nXg+bEE/GFaKy/X6SVxrEA7Q9wi5ql3lWvnCsi4JbTnqr/MMsDeFHlrLIhZ4+xp3PGgiFOt2YIxH1lDmy8zH7z8qjhiTKrB4f3pBoOaAqxWUHOLmI+sALMJZORC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744127868; h=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=4hi1xjODCV/sXPERE+O05f5Q95fvnC5BVyDMZVpi670=; b=OWtHnDehfFHTVc5NF9xYRd/O1zLj867/yMzfjLnjg8obtwSOTpHg01WNm85WAUMmlrtsxGU7RanEmXPWXMmgaEUj9HL6xaXebBFadyCJQBMlyCyRC8Xbz7zkBKtCHB9LEcv3NPVvTt4bvYex/z/P+9Rd4gYrvmvrcUNFjv1aMh8= 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=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1744127867679613.8748697274204; Tue, 8 Apr 2025 08:57:47 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.942502.1341658 (Exim 4.92) (envelope-from ) id 1u2BKL-00054s-05; Tue, 08 Apr 2025 15:57:29 +0000 Received: by outflank-mailman (output) from mailman id 942502.1341658; Tue, 08 Apr 2025 15:57:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u2BKK-00054C-Oe; Tue, 08 Apr 2025 15:57:28 +0000 Received: by outflank-mailman (input) for mailman id 942502; Tue, 08 Apr 2025 15:57:28 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u2BKK-0004Yq-2s for xen-devel@lists.xenproject.org; Tue, 08 Apr 2025 15:57:28 +0000 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [2a00:1450:4864:20::633]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2abb371a-1492-11f0-9ffb-bf95429c2676; Tue, 08 Apr 2025 17:57:26 +0200 (CEST) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-abbd96bef64so1115126066b.3 for ; Tue, 08 Apr 2025 08:57:26 -0700 (PDT) Received: from fedora.. (user-109-243-64-225.play-internet.pl. [109.243.64.225]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac7c018556bsm929934566b.156.2025.04.08.08.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Apr 2025 08:57:24 -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: 2abb371a-1492-11f0-9ffb-bf95429c2676 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744127846; x=1744732646; 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=4hi1xjODCV/sXPERE+O05f5Q95fvnC5BVyDMZVpi670=; b=X/Pk5RkKEXtsxMOxRQrqB/hhe2XGq7K5S6nOokSU4rNfzYgH3lNUvC7uZbsFQ8MniX H8Gd9gjKhPWhCZDydOV5tfT7AYmsMiCCXwcRByo4uexz7I7W6ntqIKilbUQ1DcS6OTXy xX3bBxYm4eJf2I3Hw1B1zEb0w0Mm8sB/WJ7rxrHja5Sa3q55UIr0CzHhtmOo46M8Q3D5 pGj8zEaUvea5MUPoVLRns3Mu5jHVjKcJxZAo4sPoep5aPSKPq59BcFYa9eMNZ6EisnZK zjHQnptWgbPHcxSROGP9AZZRQMi7PwhzkezCPBwHZ6BmLxqxBpzKG/FVJLbeaoF9A1pc nuIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744127846; x=1744732646; 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=4hi1xjODCV/sXPERE+O05f5Q95fvnC5BVyDMZVpi670=; b=K5Dq8RpMjdHSkrwPWsCFt9OB+mWgwlB3G8GETyacMqCdorlHnrDtD3RSCkIyhzWy0w 9+ZBH3MhNj+iFEheDxfdBJoxVp1gp6+pVnB/LCQEPltfthAMnTMODFwQCscxMHPqCCFJ r2ZjDgMNST4S0OcWCpplKRl+sg5V+BgMPCSWrmGn25YYNcDghJGAQQxM8KBOVyC0sJn0 ww+UiLLHUuebzWyV8iyp/tNgMk2WonLtze/VMbj4r2SaPliIV1cQDNGXWWCnLG2v0nqB I4+vXzNTYryfT8fefVoVJJLt/7BTSNDczrpEegPN6WjBxXZHmZFfRUF8C/EtFLdBbO1L G5KQ== X-Gm-Message-State: AOJu0Yyhe1U2+gbxjZI85+pKZf7d5hndaqKcpz4GKWziMz+QDP04J1KE ncLqzS6+CNcwoImBVFEuBKsfMkWT9Ng5JMnaatU+B4yDXmSJ8AILU+fgJA== X-Gm-Gg: ASbGncvx1+FvwLShhn6V1J97guv8p4IPgRbp7h2PPXQj4KbN259JBF9mxl9E+1FYVKZ nInMPEp4/C2hVYHU022rVwa8FXu9oNPvwV+YYcGc3KQtQEf4MiUJDnODFfP+0ap5cRP5PmXtt3x uQftVtf08Hj8k7gtWnICN83QapJoGDOEhRg/C77EGn2+wQszZECorVEZ1O82g2DrMoiRCBckHbX bvWn6/yI6og6r9PkDq6bOAhwnQP3iryrWQuFbn3TlcsMVokJVRbKOfMv+s7HwgewgvZ/aQcPKSx mtl3vnBm7PfQ6L1dFfREF5VwZQTzMznxMMfvWZCXQwSWuqqFDptgiXBoAx0usoL7cafd05PZINi QGKmMnHXZKIzJTg== X-Google-Smtp-Source: AGHT+IGPZLQUmzRVvlQPHpMLUPk5BR/JAj1Ppc1lOSe7dGvIQ+x4G3kqQ5tkLmaV6Dmf0Dg7h9DOjQ== X-Received: by 2002:a17:907:7e88:b0:ac6:bf3d:bf45 with SMTP id a640c23a62f3a-ac7d19671efmr1737640366b.36.1744127845398; Tue, 08 Apr 2025 08:57:25 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Alistair Francis , Bob Eshleman , Connor Davis , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini Subject: [PATCH v1 02/14] xen/riscv: introduce smp_clear_cpu_maps() Date: Tue, 8 Apr 2025 17:57:06 +0200 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1744127870766019100 Content-Type: text/plain; charset="utf-8" Initialize cpu_{possible, online, present}_map by using smp_clear_cpu_maps(= ). Drop DEFINE_PER_CPU(unsigned int, cpu_id) from stubs.c as this variable isn= 't expected to be used in RISC-V at all. Move declaration of cpu_{possible,online,present}_map from stubs.c to smpbo= ot.c as now smpboot.c is now introduced. Other defintions keep in stubs.c as they are not initialized and not needed= , at the moment. Signed-off-by: Oleksii Kurochko --- xen/arch/riscv/Makefile | 1 + xen/arch/riscv/include/asm/smp.h | 2 ++ xen/arch/riscv/setup.c | 2 ++ xen/arch/riscv/smpboot.c | 15 +++++++++++++++ xen/arch/riscv/stubs.c | 6 ------ 5 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 xen/arch/riscv/smpboot.c diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile index 0c6c4a38a3..f551bf32a2 100644 --- a/xen/arch/riscv/Makefile +++ b/xen/arch/riscv/Makefile @@ -10,6 +10,7 @@ obj-y +=3D sbi.o obj-y +=3D setup.o obj-y +=3D shutdown.o obj-y +=3D smp.o +obj-y +=3D smpboot.o obj-y +=3D stubs.o obj-y +=3D time.o obj-y +=3D traps.o diff --git a/xen/arch/riscv/include/asm/smp.h b/xen/arch/riscv/include/asm/= smp.h index 5e170b57b3..188c033718 100644 --- a/xen/arch/riscv/include/asm/smp.h +++ b/xen/arch/riscv/include/asm/smp.h @@ -26,6 +26,8 @@ static inline void set_cpuid_to_hartid(unsigned long cpui= d, =20 void setup_tp(unsigned int cpuid); =20 +void smp_clear_cpu_maps(void); + #endif =20 /* diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index 4e416f6e44..7f68f3f5b7 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -72,6 +72,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id, =20 remove_identity_mapping(); =20 + smp_clear_cpu_maps(); + set_processor_id(0); =20 set_cpuid_to_hartid(0, bootcpu_id); diff --git a/xen/arch/riscv/smpboot.c b/xen/arch/riscv/smpboot.c new file mode 100644 index 0000000000..0f4dcc28e1 --- /dev/null +++ b/xen/arch/riscv/smpboot.c @@ -0,0 +1,15 @@ +#include +#include + +cpumask_t cpu_online_map; +cpumask_t cpu_present_map; +cpumask_t cpu_possible_map; + +void __init smp_clear_cpu_maps(void) +{ + cpumask_clear(&cpu_possible_map); + cpumask_clear(&cpu_online_map); + cpumask_set_cpu(0, &cpu_possible_map); + cpumask_set_cpu(0, &cpu_online_map); + cpumask_copy(&cpu_present_map, &cpu_possible_map); +} diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c index 83416d3350..fdcf91054e 100644 --- a/xen/arch/riscv/stubs.c +++ b/xen/arch/riscv/stubs.c @@ -11,12 +11,6 @@ =20 /* smpboot.c */ =20 -cpumask_t cpu_online_map; -cpumask_t cpu_present_map; -cpumask_t cpu_possible_map; - -/* ID of the PCPU we're running on */ -DEFINE_PER_CPU(unsigned int, cpu_id); /* XXX these seem awfully x86ish... */ /* representing HT siblings of each logical CPU */ DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_mask); --=20 2.49.0