[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 11/11] hw/riscv: virt: Add PMU DT node to the device tree
From: |
Atish Patra |
Subject: |
Re: [PATCH v4 11/11] hw/riscv: virt: Add PMU DT node to the device tree |
Date: |
Sun, 9 Jan 2022 17:23:09 -0800 |
On Fri, Jan 7, 2022 at 6:46 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> On 7/1/22 01:48, Atish Patra wrote:
> > Qemu virt machine can support few cache events and cycle/instret counters.
> > It also supports counter overflow for these events.
> >
> > Add a DT node so that OpenSBI/Linux kernel is aware of the virt machine
> > capabilities. There are some dummy nodes added for testing as well.
> >
> > Signed-off-by: Atish Patra <atish.patra@wdc.com>
> > Signed-off-by: Atish Patra <atishp@rivosinc.com>
> > ---
> > hw/riscv/virt.c | 38 ++++++++++++++++++++++++++++++++++++++
> > target/riscv/pmu.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
> > target/riscv/pmu.h | 1 +
> > 3 files changed, 84 insertions(+)
>
> > +static void create_fdt_socket_pmu(RISCVVirtState *s,
> > + int socket, uint32_t *phandle,
> > + uint32_t *intc_phandles)
> > +{
> > + int cpu;
> > + char *pmu_name;
> > + uint32_t *pmu_cells;
> > + MachineState *mc = MACHINE(s);
> > + RISCVCPU hart = s->soc[socket].harts[0];
> > +
> > + pmu_cells = g_new0(uint32_t, s->soc[socket].num_harts * 2);
> > +
> > + for (cpu = 0; cpu < s->soc[socket].num_harts; cpu++) {
> > + pmu_cells[cpu * 2 + 0] = cpu_to_be32(intc_phandles[cpu]);
> > + pmu_cells[cpu * 2 + 1] = cpu_to_be32(IRQ_PMU_OVF);
> > + }
> > +
> > + pmu_name = g_strdup_printf("/soc/pmu");
> > + qemu_fdt_add_subnode(mc->fdt, pmu_name);
> > + qemu_fdt_setprop_string(mc->fdt, pmu_name, "compatible", "riscv,pmu");
> > + riscv_pmu_generate_fdt_node(mc->fdt, hart.cfg.pmu_num, pmu_name);
>
> pmu_cells[] is not consumed...
>
Oops. I removed the DT requirement in the kernel. Forgot to remove this snippet.
Thanks!
I will fix it in the next version.
> > +
> > + g_free(pmu_name);
> > + g_free(pmu_cells);
> > +}
>
>
--
Regards,
Atish
- [PATCH v4 00/11] Improve PMU support, Atish Patra, 2022/01/06
- [PATCH v4 10/11] target/riscv: Add few cache related PMU events, Atish Patra, 2022/01/06
- [PATCH v4 11/11] hw/riscv: virt: Add PMU DT node to the device tree, Atish Patra, 2022/01/06
- [PATCH v4 05/11] target/riscv: Implement mcountinhibit CSR, Atish Patra, 2022/01/06
- [PATCH v4 06/11] target/riscv: Add support for hpmcounters/hpmevents, Atish Patra, 2022/01/06
- [PATCH v4 03/11] target/riscv: pmu: Rename the counters extension to pmu, Atish Patra, 2022/01/06
- [PATCH v4 07/11] target/riscv: Support mcycle/minstret write operation, Atish Patra, 2022/01/06