From nobody Sun Feb 8 23:26:58 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1579670093; cv=none; d=zohomail.com; s=zohoarc; b=Fpw2UA4fnqtUmjB69O//2EP9tyxDfVWvh/P+tbfZ26rklFd7kU8m1RpDvsh+owtAMVDd61cuy5aUSgbH0BJTHIjsonYNcWWXWqhcbDuHA/RuQBUI5Ub1StJ4imGfWNKRVWHtNyw7hJyfvvG7R1vDjYlUd6Z48JiJH8BnqmpxHI8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579670093; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rXtCEFEwdbXxxheULG7UuQkcOAqFwpmcdX62XI/PESE=; b=NMbVlwPYe4pGDihZBP1wnFU3yb8aDK/r+JNhCtBf2KyRmp3OScwjacCmS1F6CpdFaaJv1I5IsU4kaGyFUa6CtnQ5FKA+Qtx64s34vH4X7MtPYHQLq+8J/S/J6BBatdXjhJxLmcGEfMqDz2Wna1Al0+phDh4QO8BskOpqpVfWo38= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1579670093653547.0838731646237; Tue, 21 Jan 2020 21:14:53 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iu8LE-0005GN-4t; Wed, 22 Jan 2020 05:14:12 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iu5LM-0006Bs-7A for xen-devel@lists.xenproject.org; Wed, 22 Jan 2020 02:02:08 +0000 Received: from mail-yw1-xc42.google.com (unknown [2607:f8b0:4864:20::c42]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0ae3b8ac-3cbb-11ea-9fd7-bc764e2007e4; Wed, 22 Jan 2020 02:01:02 +0000 (UTC) Received: by mail-yw1-xc42.google.com with SMTP id n184so2501153ywc.3 for ; Tue, 21 Jan 2020 18:01:02 -0800 (PST) Received: from bobbye-pc.knology.net ([216.186.244.35]) by smtp.gmail.com with ESMTPSA id q185sm17504248ywh.61.2020.01.21.18.01.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2020 18:01:01 -0800 (PST) X-Inumbo-ID: 0ae3b8ac-3cbb-11ea-9fd7-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c+peo1lNWpi8ay2FPpKP+1+5l21PnbXHs4DF9skrc64=; b=oRP3L/aelcF4tFkz0CMIRBrm2HlIEpmOVLczmta75UDs/rtMRw2G30h57Zn6Fq3my6 +xeKZvZgEKoSru1pXuRrIDqgfpCEZzTicSTxauS1Ay7WfbK7U8QXv7TMGM4bSb2+mlwF xlIATscjyH5x82kDgHzuXt6Q9iUWf/PrvmXgU6TwhsCodyBodfaxAgR/AUrcdj14QSby d7xLAEk/X+sUnDc9p5pCSfwtPDaKOjrWEmkd4QskksMrOnR6HJP+qQCI3aChEHvu/mwJ +4nJuj7hAl0JiG42n99hffwDOtdNXicMhFRfPJ/uqTdPU7SfZTFQYvxE2ivfKpFOOy6p 51Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c+peo1lNWpi8ay2FPpKP+1+5l21PnbXHs4DF9skrc64=; b=qPGHXttJJNUxhr8zT5/nd8WS0PtW48qybWfs4GwGC+CigGuCC6SubERTB64TsMu/y0 MIBTWVPnpz7pU7XPDW/buruJLS7cadK1HVF99M/FkENhnJskoxRBv3rFfxP/ALqYZsZs brcJtZQfuVVGD7ibSMrkoNh050IlM7J83WrGCgiUPFfXTzyHuXPKU7Tbjt18PrPypjzY 0uTbDhlGu5U0vVZmNBwvlXGEUKJ7g4DT7U6UZgKF60Fz8ydPz5UDFIUy3Wl+JfzU8v0B uOet3RI4NjzP6wNIYGoQowHb8/0Qj2oIYreXQDgWxwoyLIDLvrv3TpiouQ88KajQ6mgP fPlg== X-Gm-Message-State: APjAAAV/dQLB9akbHYPQRs86mgBUVXjd6eQ7qarHeP93N/Q0a3C+nTe4 eA5ZtkJnqz15qeZKYm+Fw+vii7SLpJDwMQ== X-Google-Smtp-Source: APXvYqx2r1H43IY+7X3aOHEgvtbRX+Vb4XbeqgOWzkZ1D0QjticLeKguljW5ZRjLMx7EBRI5lokZlQ== X-Received: by 2002:a81:758a:: with SMTP id q132mr5634978ywc.162.1579658462108; Tue, 21 Jan 2020 18:01:02 -0800 (PST) From: Bobby Eshleman To: xen-devel@lists.xenproject.org Date: Tue, 21 Jan 2020 19:58:59 -0600 Message-Id: X-Mailer: git-send-email 2.25.0 In-Reply-To: References: MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 22 Jan 2020 05:14:01 +0000 Subject: [Xen-devel] [RFC XEN PATCH 20/23] riscv: Add smpboot.c X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Bobby Eshleman , Stefano Stabellini , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Bobby Eshleman , Dan Robertson , Alistair Francis Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Alistair Francis Signed-off-by: Alistair Francis --- xen/arch/riscv/smpboot.c | 114 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 xen/arch/riscv/smpboot.c diff --git a/xen/arch/riscv/smpboot.c b/xen/arch/riscv/smpboot.c new file mode 100644 index 0000000000..f125179a3e --- /dev/null +++ b/xen/arch/riscv/smpboot.c @@ -0,0 +1,114 @@ +/* + * Dummy smpboot support + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +cpumask_t cpu_online_map; +cpumask_t cpu_present_map; +cpumask_t cpu_possible_map; + +/* Fake one node for now. See also include/asm-arm/numa.h */ +nodemask_t __read_mostly node_online_map =3D { { [0] =3D 1UL } }; + +/* Boot cpu data */ +struct init_info init_data =3D +{ +}; + +/* Shared state for coordinating CPU teardown */ +static bool cpu_is_dead; + +/* 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); +/* representing HT and core siblings of each logical CPU */ +DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_mask); + +/* + * By default non-boot CPUs not identical to the boot CPU will be + * parked. + */ +static bool __read_mostly opt_hmp_unsafe =3D false; +boolean_param("hmp-unsafe", opt_hmp_unsafe); + +int __cpu_up(unsigned int cpu) +{ + printk("Bringing up CPU%d\n", cpu); + + console_start_sync(); /* Secondary may use early_printk */ + + /* TODO */ + + return 0; +} + +/* Shut down the current CPU */ +void __cpu_disable(void) +{ + unsigned int cpu =3D get_processor_id(); + + /* TODO */ + + /* It's now safe to remove this processor from the online map */ + cpumask_clear_cpu(cpu, &cpu_online_map); + + smp_mb(); + + /* Return to caller; eventually the IPI mechanism will unwind and the=20 + * scheduler will drop to the idle loop, which will call stop_cpu(). */ +} + +void __cpu_die(unsigned int cpu) +{ + unsigned int i =3D 0; + + while ( !cpu_is_dead ) + { + mdelay(100); + cpu_relax(); + process_pending_softirqs(); + if ( (++i % 10) =3D=3D 0 ) + printk(KERN_ERR "CPU %u still not dead...\n", cpu); + smp_mb(); + } + cpu_is_dead =3D false; + smp_mb(); +} + +void stop_cpu(void) +{ + local_irq_disable(); + cpu_is_dead =3D true; + + /* TODO */ + + while ( 1 ) + wait_for_interrupt(); +} --=20 2.25.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel