Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp520873lqb; Fri, 24 May 2024 05:54:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV/7XQZWf6Z7RfRhCKrJ/OhH3j41uwQU2GKRlAy7MarIBtWwBju6CvOS5U+Z8aSqF+8HYuwYx5Y7/wgpK6NspTbljOB/lQPTn9JZsq0Kw== X-Google-Smtp-Source: AGHT+IFQMxnrkE3bbEzHmEzklL31s3CA9CofzJhYdp0eLxw/4tpflj5g+nPILRASZ73dfKTjLLGT X-Received: by 2002:a17:906:e2d9:b0:a5a:c194:b53d with SMTP id a640c23a62f3a-a62645d6c0dmr155212366b.20.1716555283683; Fri, 24 May 2024 05:54:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716555283; cv=pass; d=google.com; s=arc-20160816; b=Q+MJ2W8b7CAHiEMpZP1aRD5YfaqV6Lxe68BHqsoVRA1al4P/7Tj2o4veRTK4kFe0OI N0BpjB1qtZJFk4s5x2PM+GvnhWSjvwRUbqRYO5rwXHiRU6vqk1Mj9m3cRRYLaEr+t+JI d5jY6C0yAyug24r+zpbtrRrlPXEzdyRlK0rNpQliuct+y55GiKg3bUUrNtKAuL6iDcHg 7IwRZHHMLvROVhkfBBW6Mur/flHjBxv9Rl8qFt39PdjP7fwAJXtamtu0uAghIU/UeCme FXBaiU777SdpF8DyZx8rgA23+fcGCeiYPnylaGyGgVCmNop/xHtURJmVW7nrCaXvF0Kn +ROA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=MxmDLiLsd5ua2H7Oam6e1zqnDQkQ25mJBA16oWnpxYY=; fh=w5jTp5pv2ib2BA2yjA51avOQ3uCNWB2/oTu3F7K37uY=; b=c93NsHJNveaBu7mDbGgtYMFdnVIjTtGvZumr9DLWm9LukPg6Tnej+HpjzduY3qqm7B RxsO44kZ0JW/v2jy7ZniruRTGSo7PyZ3H9gqvoMKjfj+2u/le84AjTVfp6sO/QLBYt8t X/4hAIE34pu0+y7IxnGZFvSeNR3jLqfjjFpT1XtdBW+ZfKpqNgANdPXsv7OEKMBJbXmQ +WFZzmEwvwcaTzkEAsysUcyjuYDxjQgahz0U1VDqxKa6FunV6Qg05m7XJHV2O+lHz3a4 maPoaLMd9lfyJFXXTNuNeBvVZg2tb0um7Yn3+TTKp9LQYpD/5OnZ29PhUDtN/VuF2FJ/ Tnbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@brainfault-org.20230601.gappssmtp.com header.s=20230601 header.b=u+FkYJZ+; arc=pass (i=1 dkim=pass dkdomain=brainfault-org.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-188704-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188704-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a626cc38b39si80647966b.377.2024.05.24.05.54.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 05:54:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188704-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=@brainfault-org.20230601.gappssmtp.com header.s=20230601 header.b=u+FkYJZ+; arc=pass (i=1 dkim=pass dkdomain=brainfault-org.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-188704-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188704-linux.lists.archive=gmail.com@vger.kernel.org" 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 41E491F218CF for ; Fri, 24 May 2024 12:54:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A19D48664A; Fri, 24 May 2024 12:54:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=brainfault-org.20230601.gappssmtp.com header.i=@brainfault-org.20230601.gappssmtp.com header.b="u+FkYJZ+" Received: from mail-il1-f170.google.com (mail-il1-f170.google.com [209.85.166.170]) (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 37A5484D30 for ; Fri, 24 May 2024 12:54:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716555274; cv=none; b=YPkkeKEk4zRz6hEKnA5EHYG5WSgtmJ2YJ8SeGEDSln0pi+txy3CboZhZU2MHkVPpoAmdTrjkKPGTf6W/fbbs9fnA78bCDmSeKYzv7MOen8QIjedt6nvUfAyyddX7d42zF6jkyWaXq47g8FV+1DPZq7Ffk02bmTyQFnB1+I/sfxo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716555274; c=relaxed/simple; bh=2Q87jTyD/yahS92t5urdkFnj9lWgA8pkg+6R0zo54pM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=XSfUfZVMNasjtQoZlgXOrJqZgGw4eubw1bw4PJCErXM6Q6k/DVIMaqETkFyPF1lFfv9r25qXvr6+ps2AVS8sfN+3I4qtDd3PYWmzIsupXb13n2bgp8uFH6J4WULR3kReIKDpjrHOAdVDuO8mVhYdi+8PHEve+aH0hi8nxiSWbNQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=brainfault.org; spf=none smtp.mailfrom=brainfault.org; dkim=pass (2048-bit key) header.d=brainfault-org.20230601.gappssmtp.com header.i=@brainfault-org.20230601.gappssmtp.com header.b=u+FkYJZ+; arc=none smtp.client-ip=209.85.166.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=brainfault.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=brainfault.org Received: by mail-il1-f170.google.com with SMTP id e9e14a558f8ab-3737b33270aso3671345ab.1 for ; Fri, 24 May 2024 05:54:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20230601.gappssmtp.com; s=20230601; t=1716555272; x=1717160072; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MxmDLiLsd5ua2H7Oam6e1zqnDQkQ25mJBA16oWnpxYY=; b=u+FkYJZ+VJyMo2mGe63D+Dp/95+eDIx/MnSo623ZuYzp8yzHNbzGjTt730HJYfRIln zHeNSLvLpgL+zaCFzTswgHStVvyP4goL6BSS9s0H29t8oCR2BqKEQIgUiqiZ9EdZrhVK +gM3xNR0JYKsubmaxrNWK7nxAei9amlxZQs5t+47XXVBMXy0oKKYhed/mWVoeX3PIY8A 6YcUGC19YbNjigXAGhGy7gHFjsDi4cvgPg3WHcvRCsQGpYeRhbHRvgnNtUoOGT1OUc+A gMcz+MByevlTbxxdw28feWsCF6Mha86G/izo3GWrM7TLbOaFPlGnt6m8KBOXUABrY2hQ ihrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716555272; x=1717160072; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MxmDLiLsd5ua2H7Oam6e1zqnDQkQ25mJBA16oWnpxYY=; b=IMZ/WrHoUqDi4pEtqEjwBe0VTuV7QgGtUjxKHJlEwqWk2d771euUDcyV9lkyL0QoqG hLf5IwZqxMfmse/Kw+c0DDuPiKSDedZNuKHkIwX3REFEWmOP2rJu/0hZUFRq4Qk+VQB5 PrrH5KAJIuLKOVLtdP5yCiByLBqsUzQBxyei8LehzwQ8d+LYdobe+xNlDrP/PhA8qVKa jqY7Tx91nDiTQA6h5sOOS3kLWd8Lgb1E4bj9bTMAP3G+7BWL2mQpwuYPXM8DISNwn4tC tR7fSCOqDp1B3Qcf1/qK//0rrLGDb/tt9N6tOarGPpvT904dNKk2mbLAQdh1iIiAAC5s 3lqA== X-Forwarded-Encrypted: i=1; AJvYcCXVcvBAte0NRApDGH3zsf1t57vJWl78ClddGKs6J0bu46LrZT+CWBvpKZUkpkSSoEqQZBY+n3LLlHwgzts8ATNd/1d8fXMaHnq6aWus X-Gm-Message-State: AOJu0Yw0BHtTWi5eCnoq8zMIdRipUpv94VIkvVkpAAv/mQBnjxhZtdbR JWncQa3e1Eqxa88i8VYRAYCB+7WXaILJdvfrMRhVCeIdegmFYmkhkR/jvL/9hBvgNCy+TSTPnEC dhk5TRPog4SqPQX4Raw4p0uP174CjOvlWqDxQKQ== X-Received: by 2002:a05:6e02:1a09:b0:36b:2731:83ce with SMTP id e9e14a558f8ab-3737b2c5874mr24957655ab.8.1716555272176; Fri, 24 May 2024 05:54:32 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240226065113.1690534-1-nick.hu@sifive.com> In-Reply-To: From: Anup Patel Date: Fri, 24 May 2024 18:24:20 +0530 Message-ID: Subject: Re: [PATCH] cpuidle: riscv-sbi: Add cluster_pm_enter()/exit() To: Ulf Hansson Cc: Anup Patel , Nick Hu , palmer@dabbelt.com, rafael@kernel.org, daniel.lezcano@linaro.org, paul.walmsley@sifive.com, linux-pm@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, zong.li@sifive.com, Cyan Yang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, May 24, 2024 at 4:11=E2=80=AFPM Ulf Hansson wrote: > > On Fri, 17 May 2024 at 06:39, Anup Patel wrote: > > > > On Thu, May 16, 2024 at 9:40=E2=80=AFAM Nick Hu wr= ote: > > > > > > Hi Anup > > > > > > On Wed, May 15, 2024 at 9:46=E2=80=AFPM Anup Patel wrote: > > > > > > > > Hi Nick, > > > > > > > > On Wed, May 15, 2024 at 5:45=E2=80=AFPM Nick Hu wrote: > > > > > > > > > > Hi Anup, > > > > > > > > > > Thank you for your guidance. > > > > > After enabling the debug message, we found a way to solve the pro= blem > > > > > by the following steps: > > > > > 1. Add a compatible string in 'power-domains' node otherwise it w= on't > > > > > be the supplier of the consumers. (See of_link_to_phandle()) > > > > > > > > Hmm, requiring a compatible string is odd. Where should we document > > > > this compatible string ? > > > > > > > Sorry, this is my fault. I didn't include some updates in > > > of_link_to_phandle(). This led some misunderstandings here. > > > You are right, we don't need it. > > > The supplier will be linked to the CLUSTER_PD node. > > > > > > > > 2. Move the 'power-domains' node outside the 'cpus' node otherwis= e it > > > > > won't be added to the device hierarchy by device_add(). > > > > > 3. Update the cpuidle-riscv-sbi driver to get the pds_node from > > > > > '/power-domains'. > > > > > > > > By adding a compatible string and moving the "power-domains" node > > > > outside, you are simply forcing the OF framework to populate device= s. > > > > > > > > How about manually creating platform_device for each power-domain > > > > DT node using of_platform_device_create() in sbi_pd_init() ? > > > > > > > Thanks for the suggestion! We have test the solution and it could wor= k. > > > We was wondering if it's feasible for us to relocate the > > > 'power-domains' node outside of the /cpus? The CLUSTER_PD might > > > encompass not only the CPUs but also other components within the > > > cluster. > > > > The cpuidle-riscv-sbi driver expects "power-domains" DT node > > under "/cpus" DT node because this driver only deals with power > > domains related to CPU cluster or CPU cache-hierarchy. It does > > make sense to define L2/L3 power domains under > > "/cpus/power-domain" since these are related to CPUs. > > > > Moving the CPU "power-domains" DT node directly under "/" or > > somewhere else would mean that it covers system-wide power > > domains which is not true. > > I understand your point, but I am not convinced that the power-domains > need to belong to the "cpus" node. Ideally, the power-domain describes > the power-rail and the interface to manage the CPUs, this can surely > be described outside the "cpus" node - even if there are only CPUs > that are using it. > > Moreover, moving forward, one should not be surprised if it turns out > that a platform has other devices than the CPUs, sharing the same > power-rail as the CPU cluster. At least, we have that for arm/psci > [1]. For non-CPU power domains, we are working on a messaging specification (RPMI) [1]. The supervisor software might have direct access to a RPMI transport or it can send RPMI messages via SBI MPXY extension [2]. If power-rails on a platform are shared between CPUs and devices then the platform can: 1) Use SBI HSM for CPUs and use RPMI for devices. The DT bindings for device power-domains based on RPMI are still work-in-progress. If there are multiple supervisor domains (aka system level partitions) created by SBI implementation or some partitioning hypervisor then the RPMI messages can be arbitraged by SBI implementation using SBI MPXY extension. The SBI MPXY extension also allows sharing the same RPMI transport between machine-mode (firmware) and supervisor-mode. 2) Use its own platform specific power-domain driver for both CPUs and devices (basically don't use the SBI HSM and RPMI). In this case, there won't be any controlled access (or arbitration) of power rails across supervisor domains. > > > > > I suggest we continue using "/cpus/power-domains" DT node > > only for power domains related to CPU clusters or CPU > > cache-hierarchy. > > > > For system wide power domains of SoC devices, we can either: > > 1) Use device power domains through the SBI MPXY extension > > via different driver > > 2) Use a platform specific driver > > > > > > > > We also look at cpuidle_psci_domain driver and it seems Arm doesn't > > > create the devices for each subnode of psci domain. > > > Is there any reason that they don't need it? > > We don't need it for arm as we have a separate node for PSCI and its > power-domains [2]. Moreover, we have a separate driver that manages > the power-domain (cpuidle-psci-domain). Unlike the ARM world, we don't have any DT node for SBI in the RISC-V world because the SBI is always there. Due to this, the SBI HSM CPU idle driver (this driver) currently looks for CPU "power-domains" under "/cpus" DT node because the SBI HSM extension only deals with CPU states. > > [...] > > [1] arch/arm64/boot/dts/qcom/sc7280.dtsi (search for "CLUSTER_PD") > [2] Documentation/devicetree/bindings/arm/psci.yaml > > Kind regards > Uffe [1] https://github.com/riscv-non-isa/riscv-rpmi [2] https://docs.google.com/document/d/1Ivej3u6uQgVdJHnjrbqgUwE1Juy75d4uYCj= WrdNjeAg/edit?usp=3Dsharing Best regards, Anup