Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1180325pxb; Tue, 8 Feb 2022 11:01:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEyrwZD2Qv1LlFy2NFwdJMF7q0wo5Y2YFeOF+wn7tD5JkJ6/6H1VaY6muW9I5Obbp4djMQ X-Received: by 2002:a17:90b:4d05:: with SMTP id mw5mr2919222pjb.34.1644346879668; Tue, 08 Feb 2022 11:01:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644346879; cv=none; d=google.com; s=arc-20160816; b=lU0Sr+jVYrk0rSPE0mP/iY7HrbPMWWh1o5rnaxw15uaXJhV9cCQDFRsFNGQ9EwsYj3 wnCI4QPdwul1GmeSRo0HUf+Tt5mONTa0KJAH+nsVxDUEA8M4YpT+AsOQ+vkB7fM4tQXH kM0w7L+c1IGBv/NbF3ndSGoMnDewX8iZ2Rnx6KpqbTDfYw4q+1xdkKipDHI4lBzKIt0Z AjFKqBEKBruUuJhTadJwnPEnpYmnhOil0QKHjUN8AhJAfSw6ak2vsqX8AcmW8hV+zMoi X3euWPLk4d7Eg7XTlTz9y662KufHJ5VuYVLMUJp7xel7pI1BP0R7N4jYer2dQPz3EJsF eHzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ad/AIeKw/gggP6Br2uoykBbNKFVMSxSNAtQyiBt1RW0=; b=yA887Hbb5Y2GF7Pc/FYg/pbux9EE3RBIoTET+HxyP3+khzzSLfS+otSCmMj4QLUDVj TVp1GH5QRNoxR7Z8OavZlgdFTPDihMDWt/4nnbcczKZa+eouo5njvo4w2DLkQq0Xfisn 28keVehPjLZ+pCJzh8j73+BVtPNeER7h+0HP0Wzeltk/2J+i2i6QUneCXhbUHxH3ekou +BVm4qwtfEPYrUQG4az+5G5Y6Uzk5pUUw+4HjjwF4tgEHpOj+2qQX68F/PP4MHILcLy2 MYDEc/Az+CKIBeWM/RQxoBKwukyy8wVmhWINl0BwAlSF+/4WsIHPuD1y2NNrcQKI+FI+ 0m9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=5KxMGJIr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e14si8884733plo.107.2022.02.08.11.01.05; Tue, 08 Feb 2022 11:01:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=5KxMGJIr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352306AbiBHIyU (ORCPT + 99 others); Tue, 8 Feb 2022 03:54:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231657AbiBHIyS (ORCPT ); Tue, 8 Feb 2022 03:54:18 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C245AC03FEC5 for ; Tue, 8 Feb 2022 00:54:17 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id k18so29362197wrg.11 for ; Tue, 08 Feb 2022 00:54:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ad/AIeKw/gggP6Br2uoykBbNKFVMSxSNAtQyiBt1RW0=; b=5KxMGJIrZxz0UdJJ4KFG3h5rV0PZviBM1D2ZlImvgl2AYSR7uVDIp9FOmugYxXR0jd /uG/+J603tKg3P37pGqHHlbr3fFTWLeZiT1w6+erAhedOqoJk8L3BOwALYuFUkgt9rFv jQiGMsXhV5QujyODOTCAMmYW8e/ggOnHL5d6jTVn1If8szV5+b8LHzdFdowkrSUMEWah jPTmEQXdKOuovazsDjAlCKdIyJVrK45UjaRmuw4mwTheKA34Yrm9QDVifKZ9hcVLF1Go vZJYetHiq9fRPxQVsdpQnn9p5KE/Ol1buMRKZZWhAVmq4hbRovF1sdC/5fDZhn2tpOSm 5hLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ad/AIeKw/gggP6Br2uoykBbNKFVMSxSNAtQyiBt1RW0=; b=zvIScZptmZCLpLfdBN5kUdKy6kelj1Gs2T/HXPIyz75LkTMv0NCCWUy4w1dmBHVKl5 0ykP+T/XMa2CNFJg2hm+Ixyj5Wy6vyDVqaNusLyq6dGYNiCYallLRXMnv9uGfT5cJ6rr Q/L3q79dpSQ+Q9O0JVufz2xBBzU5sIsV+M6N8e7tpX7zad08TWuBgcXVq5UFZAOCXNq7 WFkE7YbcOqLYLRNsVYE4Jcid38+3283LYFzAsaIYyMXeX3SUnEq4Qq2D/vEYXSxqUbiP o3bb1gnwLaPZ9pvI3efM0numFsyUGP3ipZM+zkO2Sq5ghD0iqfzb49ebHDhWX/y0fFtF ygGA== X-Gm-Message-State: AOAM530OjegXAcNP4tRkOw1aNZHtTFxkR7S6Z21v8V9CNLpwUs2hysJn uq/sXVl0Mdp/Mm1bvkZdYaFHMEs4rkVBEhenWem8+Q== X-Received: by 2002:adf:bc44:: with SMTP id a4mr2655518wrh.346.1644310456139; Tue, 08 Feb 2022 00:54:16 -0800 (PST) MIME-Version: 1.0 References: <20220126114452.692512-1-apatel@ventanamicro.com> <20220126114452.692512-9-apatel@ventanamicro.com> In-Reply-To: From: Anup Patel Date: Tue, 8 Feb 2022 14:24:04 +0530 Message-ID: Subject: Re: [PATCH v10 8/8] RISC-V: Enable RISC-V SBI CPU Idle driver for QEMU virt machine To: Guo Ren Cc: Anup Patel , Palmer Dabbelt , Paul Walmsley , Albert Ou , Daniel Lezcano , Ulf Hansson , "Rafael J . Wysocki" , Pavel Machek , Rob Herring , Sandeep Tripathy , Atish Patra , Alistair Francis , Liush , devicetree , linux-riscv , Linux Kernel Mailing List , "open list:THERMAL" , Linux ARM , kvm-riscv@lists.infradead.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 8, 2022 at 12:16 PM Guo Ren wrote: > > Another question: > > Have you put "idle-states {" in qemu's DTS? or how do you test your patches? I usually do the following: 1) Dump QEMU virt machine DTB 2) Convert QEMU virt machine DTB into DTS 3) Add "idle-states" in QEMU virt machine DTS 4) Create QEMU virt machine DTB with "idle-states" 5) Use the new QEMU virt machine DTB for testing this series. Here's one of the DTS files which I used for testing on QEMU virt machine: /dts-v1/; / { #address-cells = <0x02>; #size-cells = <0x02>; compatible = "riscv-virtio"; model = "riscv-virtio,qemu"; chosen { linux,initrd-end = <0x8855d200>; linux,initrd-start = <0x88200000>; bootargs = "root=/dev/ram rw console=ttyS0 earlycon"; stdout-path = "/soc/uart@10000000"; }; memory@80000000 { device_type = "memory"; reg = <0x00 0x80000000 0x00 0x10000000>; }; cpus { #address-cells = <0x01>; #size-cells = <0x00>; timebase-frequency = <0x989680>; cpu@0 { phandle = <0x07>; device_type = "cpu"; reg = <0x00>; status = "okay"; compatible = "riscv"; riscv,isa = "rv64imafdcsu"; mmu-type = "riscv,sv48"; cpu-idle-states = <&CPU_NONRET_DEF>; interrupt-controller { #interrupt-cells = <0x01>; interrupt-controller; compatible = "riscv,cpu-intc"; phandle = <0x08>; }; }; cpu@1 { phandle = <0x05>; device_type = "cpu"; reg = <0x01>; status = "okay"; compatible = "riscv"; riscv,isa = "rv64imafdcsu"; mmu-type = "riscv,sv48"; cpu-idle-states = <&CPU_RET_DEF>; interrupt-controller { #interrupt-cells = <0x01>; interrupt-controller; compatible = "riscv,cpu-intc"; phandle = <0x06>; }; }; cpu@2 { phandle = <0x03>; device_type = "cpu"; reg = <0x02>; status = "okay"; compatible = "riscv"; riscv,isa = "rv64imafdcsu"; mmu-type = "riscv,sv48"; cpu-idle-states = <&CPU_NONRET_DEF>; interrupt-controller { #interrupt-cells = <0x01>; interrupt-controller; compatible = "riscv,cpu-intc"; phandle = <0x04>; }; }; cpu@3 { phandle = <0x01>; device_type = "cpu"; reg = <0x03>; status = "okay"; compatible = "riscv"; riscv,isa = "rv64imafdcsu"; mmu-type = "riscv,sv48"; cpu-idle-states = <&CPU_RET_DEF>; interrupt-controller { #interrupt-cells = <0x01>; interrupt-controller; compatible = "riscv,cpu-intc"; phandle = <0x02>; }; }; cpu-map { cluster0 { core0 { cpu = <0x07>; }; core1 { cpu = <0x05>; }; core2 { cpu = <0x03>; }; core3 { cpu = <0x01>; }; }; }; idle-states { CPU_RET_DEF: cpu-retentive-default { compatible = "riscv,idle-state"; riscv,sbi-suspend-param = <0x00000000>; entry-latency-us = <10>; exit-latency-us = <10>; min-residency-us = <100>; }; CPU_NONRET_DEF: cpu-nonretentive-default { compatible = "riscv,idle-state"; riscv,sbi-suspend-param = <0x80000000>; entry-latency-us = <100>; exit-latency-us = <100>; min-residency-us = <1000>; }; }; }; soc { #address-cells = <0x02>; #size-cells = <0x02>; compatible = "simple-bus"; ranges; flash@20000000 { bank-width = <0x04>; reg = <0x00 0x20000000 0x00 0x2000000 0x00 0x22000000 0x00 0x2000000>; compatible = "cfi-flash"; }; rtc@101000 { interrupts = <0x0b>; interrupt-parent = <0x09>; reg = <0x00 0x101000 0x00 0x1000>; compatible = "google,goldfish-rtc"; }; uart@10000000 { interrupts = <0x0a>; interrupt-parent = <0x09>; clock-frequency = <0x384000>; reg = <0x00 0x10000000 0x00 0x100>; compatible = "ns16550a"; }; poweroff { value = <0x5555>; offset = <0x00>; regmap = <0x0a>; compatible = "syscon-poweroff"; }; reboot { value = <0x7777>; offset = <0x00>; regmap = <0x0a>; compatible = "syscon-reboot"; }; test@100000 { phandle = <0x0a>; reg = <0x00 0x100000 0x00 0x1000>; compatible = "sifive,test1\0sifive,test0\0syscon"; }; pci@30000000 { interrupt-map-mask = <0x1800 0x00 0x00 0x07>; interrupt-map = <0x00 0x00 0x00 0x01 0x09 0x20 0x00 0x00 0x00 0x02 0x09 0x21 0x00 0x00 0x00 0x03 0x09 0x22 0x00 0x00 0x00 0x04 0x09 0x23 0x800 0x00 0x00 0x01 0x09 0x21 0x800 0x00 0x00 0x02 0x09 0x22 0x800 0x00 0x00 0x03 0x09 0x23 0x800 0x00 0x00 0x04 0x09 0x20 0x1000 0x00 0x00 0x01 0x09 0x22 0x1000 0x00 0x00 0x02 0x09 0x23 0x1000 0x00 0x00 0x03 0x09 0x20 0x1000 0x00 0x00 0x04 0x09 0x21 0x1800 0x00 0x00 0x01 0x09 0x23 0x1800 0x00 0x00 0x02 0x09 0x20 0x1800 0x00 0x00 0x03 0x09 0x21 0x1800 0x00 0x00 0x04 0x09 0x22>; ranges = <0x1000000 0x00 0x00 0x00 0x3000000 0x00 0x10000 0x2000000 0x00 0x40000000 0x00 0x40000000 0x00 0x40000000>; reg = <0x00 0x30000000 0x00 0x10000000>; dma-coherent; bus-range = <0x00 0xff>; linux,pci-domain = <0x00>; device_type = "pci"; compatible = "pci-host-ecam-generic"; #size-cells = <0x02>; #interrupt-cells = <0x01>; #address-cells = <0x03>; }; virtio_mmio@10008000 { interrupts = <0x08>; interrupt-parent = <0x09>; reg = <0x00 0x10008000 0x00 0x1000>; compatible = "virtio,mmio"; }; virtio_mmio@10007000 { interrupts = <0x07>; interrupt-parent = <0x09>; reg = <0x00 0x10007000 0x00 0x1000>; compatible = "virtio,mmio"; }; virtio_mmio@10006000 { interrupts = <0x06>; interrupt-parent = <0x09>; reg = <0x00 0x10006000 0x00 0x1000>; compatible = "virtio,mmio"; }; virtio_mmio@10005000 { interrupts = <0x05>; interrupt-parent = <0x09>; reg = <0x00 0x10005000 0x00 0x1000>; compatible = "virtio,mmio"; }; virtio_mmio@10004000 { interrupts = <0x04>; interrupt-parent = <0x09>; reg = <0x00 0x10004000 0x00 0x1000>; compatible = "virtio,mmio"; }; virtio_mmio@10003000 { interrupts = <0x03>; interrupt-parent = <0x09>; reg = <0x00 0x10003000 0x00 0x1000>; compatible = "virtio,mmio"; }; virtio_mmio@10002000 { interrupts = <0x02>; interrupt-parent = <0x09>; reg = <0x00 0x10002000 0x00 0x1000>; compatible = "virtio,mmio"; }; virtio_mmio@10001000 { interrupts = <0x01>; interrupt-parent = <0x09>; reg = <0x00 0x10001000 0x00 0x1000>; compatible = "virtio,mmio"; }; plic@c000000 { phandle = <0x09>; riscv,ndev = <0x35>; reg = <0x00 0xc000000 0x00 0x210000>; interrupts-extended = <0x08 0x0b 0x08 0x09 0x06 0x0b 0x06 0x09 0x04 0x0b 0x04 0x09 0x02 0x0b 0x02 0x09>; interrupt-controller; compatible = "riscv,plic0"; #interrupt-cells = <0x01>; #address-cells = <0x00>; }; clint@2000000 { interrupts-extended = <0x08 0x03 0x08 0x07 0x06 0x03 0x06 0x07 0x04 0x03 0x04 0x07 0x02 0x03 0x02 0x07>; reg = <0x00 0x2000000 0x00 0x10000>; compatible = "riscv,clint0"; }; }; }; Regards, Anup