Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1512796lqp; Mon, 15 Apr 2024 08:31:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXIy8h5sT9WihsptSL4s1w5EfYnsqTGmMEhyAbM0fZTNG9CraLVULsTXjKCuOAOhJFGPnn8Mcqj70pDzy6miIzUE+6Otkhu+oKI+WurMg== X-Google-Smtp-Source: AGHT+IE1fxk51+ef0kcS+s2ACEWTqDmwpMW29TV1tBSCYHYD/Y+Mf6F0V605jjZHPoLYE/6dfA3v X-Received: by 2002:a17:907:934c:b0:a52:5a6c:a359 with SMTP id bv12-20020a170907934c00b00a525a6ca359mr3385122ejc.63.1713195069794; Mon, 15 Apr 2024 08:31:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713195069; cv=pass; d=google.com; s=arc-20160816; b=yL9oBU+xa0UzHU8v8f3g9heHcrfNeVerChCr5ip5CfbOd6R5USfMZ6V+JaS8smH3sx BGAAxpDbO4J5SuAxWGN9gCsxs2CzmcEV8JpjX2KsdfzGk5Aoan7wS4mLhLtL4HFeSLDK U9Z16VDbAm5Hw6ZYJBfS+z9chdh87FXl/nu0siL9NVIgtdnkR0I5z9t9djGK6cFwHd4j WcXPYayOTrFZ6Lc7pUIdCUbtyf68ZHOe9HzTCPJ/hSkaUt/nOBNxwqCOtf8Eox4ngLeP 1RiqgXoe82agzffW6g2uu17vdx44G5J13NUqwCGfM7lVEKsARsl09n5pOOQ66AFL/ywA WZFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=uejkFuVJ7S+uU6TPaZslbYYiwuH4wYboz0/NG64qH38=; fh=MQ1m4F5B970d54tjc+B7J3RY+4iIvtWqjRkYAIU4aa8=; b=A8ksUZD980/RBHZe8WhxZGuoH5Nu9i7yC20ZiS1or/9f9z0OuGdaktUNRHPK0PAS6o rLEaKvYNjpBAAWk3hM7ie2FLeR7BQPMTJJFe7nRjcmL9hoNB0S4bljCR+alvzKUrHya1 5wKyNSROIzHdfEOUghvRfphyhGtzdDXgIaH0qVJvZZKTKhwzaDO3lgCZ6CAefzkjDJ9D uvsO1XMzIxtqfKF1dCFKx+aDXe76oIhLck3SJnK4zocHNj+K6r2rYsNYJQT6D1fkkZvy eES5qYomWE0GODuAPSu3zlBsX6fLhpVbqzMsVly0wDY/3C0KLFghmmEHp7nb4wlhqVY9 2DOQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=TsZXhxB0; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=cpiQFj7B; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-145460-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145460-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id g27-20020a17090613db00b00a5536dc1108si79393ejc.598.2024.04.15.08.31.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 08:31:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145460-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=TsZXhxB0; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=cpiQFj7B; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-145460-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145460-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de 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 877881F21660 for ; Mon, 15 Apr 2024 15:31:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4380079B8E; Mon, 15 Apr 2024 15:30:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="TsZXhxB0"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="cpiQFj7B" Received: from fhigh1-smtp.messagingengine.com (fhigh1-smtp.messagingengine.com [103.168.172.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63ACE60EF9; Mon, 15 Apr 2024 15:30:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.152 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713195056; cv=none; b=LQcWKaQKgVWeigwLyhA+9vHcP3+ijh5lreTIvmDz5j3BqEb8xQnpP+pLv7mYTG2OAKvcah3U4T3R5YRW6o444oWAYe6Bskl/euUWq2i/VY+NH75whMo4dCdsN43JM49kri+HEktMCrqIPfPAJiBuzaHZ1MnuIY9rjno4MLFS9uk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713195056; c=relaxed/simple; bh=ysPz6mY/TRewOJKQOKl7aqCeiD9oIAf/7WjUQ5bJ3KM=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=qGW/8IDj0B8v5mchzvLatRzj/6tcS19AsR5oOcrELeihN8FhWzbmlW3FseiViwGpi2tgl8McO4TUqlDcdSijordSnzuTQfzdwe5T5+jZlrBW5lS5ARDnTT90Le7jjUAPdAmQ39efuXyKNWxbfwy7zBVxj2/hO5riyNFk6iBS72s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b=TsZXhxB0; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=cpiQFj7B; arc=none smtp.client-ip=103.168.172.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 502EF1140133; Mon, 15 Apr 2024 11:30:53 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Mon, 15 Apr 2024 11:30:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1713195053; x=1713281453; bh=uejkFuVJ7S +uU6TPaZslbYYiwuH4wYboz0/NG64qH38=; b=TsZXhxB0sdEZtHCFU2Yk5LG6Z8 uPF+TwzaqPoUtKbWauOxtH4+C7Akzgsx5QnzHO/kv0LKj/qSf8bih/c+pcQNFDjw wYSMWkh72PrhmvqCilDplOB9y/696LFvk3cp+KwxEEgGWcn9qCuVJDhDcfnzP2yz q14czIgEWk0oTA4zx5+9zLTYqcF0sjID3GFHuYhAkuF4h2GHgK+MPTKxir/85HEn WHEG5bFm9/lH+PJjJk1fI8XDea3tgoTFjjzKVwZVKXNsMipQEzvBh5+oXs8vk6Mt KpSEKav49DHZqvbTztdSQwJSWU7ycEMRmkyQSkhdlfGzvD2kU2RHFTRsBjRw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1713195053; x=1713281453; bh=uejkFuVJ7S+uU6TPaZslbYYiwuH4 wYboz0/NG64qH38=; b=cpiQFj7BzVcn52N5NdGS8x9v4da+p4jMDv0g89gle0uu lLhcb20aCQDPV044IkxkklRJHovV3p0CUwOo0vRYTvf9b9qgxYIAGKWKYCLpBzWL PHMTmxA7TJa4kEdePJeLSKYAE34f6ROAIRh/R3fMeLpTS8peztpPOhNqgdPG4RG8 nExko+KcbxV1Vz/B1x7L4ODsWTyeOgRxcyDOv4ynZXdRILc+nmt5GCHB1PyRzD/d +/IUBY+tm+0xlewekvLJKCNgZTFSKW1Qf4gaZtCaUzGK7Cia0c66WgXg50615dw5 U9wm3yoNYhZIqLnCD5Ip5yLn07zrQK4UiBErvEMzRQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudejvddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id B461EB6008D; Mon, 15 Apr 2024 11:30:51 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-379-gabd37849b7-fm-20240408.001-gabd37849 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <61d0584f-dfe4-4d8c-a178-78f000d477d4@app.fastmail.com> In-Reply-To: References: <20230120141002.2442-1-ysionneau@kalray.eu> <20230120141002.2442-31-ysionneau@kalray.eu> Date: Mon, 15 Apr 2024 17:30:31 +0200 From: "Arnd Bergmann" To: "Yann Sionneau" , "Krzysztof Kozlowski" , "Yann Sionneau" , "Jonathan Corbet" , "Thomas Gleixner" , "Marc Zyngier" , "Rob Herring" , "Krzysztof Kozlowski" , "Will Deacon" , "Peter Zijlstra" , "Boqun Feng" , "Mark Rutland" , "Eric W. Biederman" , "Kees Cook" , "Oleg Nesterov" , "Ingo Molnar" , "Waiman Long" , "Aneesh Kumar" , "Andrew Morton" , "Nicholas Piggin" , "Paul Moore" , "Eric Paris" , "Christian Brauner" , "Paul Walmsley" , "Palmer Dabbelt" , "Albert Ou" , "Jules Maselbas" , "Guillaume Thouvenin" , "Clement Leger" , "Vincent Chardon" , =?UTF-8?Q?Marc_Poulhi=C3=A8s?= , "Julian Vetter" , "Samuel Jones" , "Ashley Lesdalons" , "Thomas Costis" , "Marius Gligor" , "Jonathan Borne" , "Julien Villette" , "Luc Michel" , "Louis Morhet" , "Julien Hascoet" , "Jean-Christophe Pince" , "Guillaume Missonnier" , "Alex Michon" , "Huacai Chen" , "WANG Xuerui" , "Shaokun Zhang" , "John Garry" , "Guangbin Huang" , "Bharat Bhushan" , "Bibo Mao" , "Atish Patra" , "Jason A . Donenfeld" , "Qi Liu" , "Jiaxun Yang" , "Catalin Marinas" , "Mark Brown" , "Janosch Frank" , "Alexey Dobriyan" Cc: "Benjamin Mugnier" , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mm@kvack.org, Linux-Arch , linux-audit@redhat.com, linux-riscv@lists.infradead.org, bpf@vger.kernel.org Subject: Re: [RFC PATCH v2 30/31] kvx: Add power controller driver Content-Type: text/plain On Mon, Apr 15, 2024, at 16:08, Yann Sionneau wrote: > On 1/22/23 12:54, Krzysztof Kozlowski wrote: >> On 20/01/2023 15:10, Yann Sionneau wrote: >>> From: Jules Maselbas >>> >>> The Power Controller (pwr-ctrl) control cores reset and wake-up >>> procedure. >>> + >>> +int __init kvx_pwr_ctrl_probe(void) >>> +{ >>> + struct device_node *ctrl; >>> + >>> + ctrl = get_pwr_ctrl_node(); >>> + if (!ctrl) { >>> + pr_err("Failed to get power controller node\n"); >>> + return -EINVAL; >>> + } >>> + >>> + if (!of_device_is_compatible(ctrl, "kalray,kvx-pwr-ctrl")) { >>> + pr_err("Failed to get power controller node\n"); >> No. Drivers go to drivers, not to arch directory. This should be a >> proper driver instead of some fake stub doing its own driver matching. >> You need to rework this. > > I am working on a v3 patchset, therefore I am working on a solution for > this "pwr-ctrl" driver that needs to go somewhere else than arch/kvx/. > > The purpose of this "driver" is just to expose a void > kvx_pwr_ctrl_cpu_poweron(unsigned int cpu) function, used by > kernel/smpboot.c function __cpu_up() in order to start secondary CPUs in > SMP config. > > Doing this, on our SoC, requires writing 3 registers in a memory-mapped > device named "power controller". > > I made some researches in drivers/ but I am not sure yet what's a good > place that fits what our device is doing (booting secondary CPUs). > > * drivers/power/reset seems to be for resetting the entire SoC > > * drivers/power/supply seems to be to control power supplies ICs/periph. > > * drivers/reset seems to be for device reset > > * drivers/pmdomain maybe ? Right, I don't think any of the above are appropriate > * drivers/soc ? > > * drivers/platform ? > > * drivers/misc ? Not drivers/misc, that is mainly for things with a user-space interface. drivers/soc is mainly for drivers used by other drivers, but this would work, especially if you expect to have multiple SoC variants that all use the same architecture code but incompatible register layouts drivers/platform is really for things outside of the SoC that are used for managing the system, especially across architectures, so I don't think that is a good fit. Traditionally we had this code in arch/{arm,mips,powerpc,sh,x86} and we never created a drier subsystem for it since newer targets (arm64, riscv, newer arm, most x86) all use a method that is specified as part of the ISA or firmware interface. The question what you expect to see with future hardware iterations: if you think all arch/kvx/ hardware will use the same code for maybe at least the next five years, I would suggest you keep it in arch/kvx/kernel/smp.c, but if you know or expect other implementations to be needed, I can merge it as a driver through drivers/soc/. Arnd