[Qemu-devel] RISC-V Open source Supervisor Binary Interface (OpenSBI) Version 0.1 Released

2019-01-31 Thread Atish Patra
OpenSBI version 0.1 is now publicly available in GitHub at https://github.com/riscv/opensbi. OpenSBI is an open source implementation of the RISC-V Supervisor Binary Interface (SBI). RISC-V SBI specifications are maintained as an independent project by the RISC-V Foundation in [Github]. This

[Qemu-devel] [PATCH] riscv: virt: Add cpu-topology DT node.

2019-06-24 Thread Atish Patra
cpu2/topology/core_siblings_list 0-7 Signed-off-by: Atish Patra --- hw/riscv/virt.c | 21 +++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 84d94d0c42d8..da0b8aa18747 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -2

[Qemu-devel] [PATCH v2] riscv: virt: Add cpu-topology DT node.

2019-06-24 Thread Atish Patra
cpu2/topology/core_siblings_list 0-7 Signed-off-by: Atish Patra Reviewed-by: Alistair Francis --- hw/riscv/virt.c | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 84d94d0c42d8..45a1edcd6c4a 100644 --- a/hw/riscv/vi

Re: [Qemu-devel] [PATCH] riscv: virt: Add cpu-topology DT node.

2019-06-24 Thread Atish Patra
On Mon, 2019-06-24 at 16:24 -0700, Alistair Francis wrote: > On Mon, Jun 24, 2019 at 3:57 PM Atish Patra > wrote: > > Currently, there is no cpu topology defined in RISC-V. > > Define a device tree node that clearly describes the > > entire topology. This saves the troubl

Re: [PATCH v3 4/4] hw/riscv: virt: Allow creating multiple sockets

2020-05-27 Thread Atish Patra
_PRIORITIES, > -VIRT_PLIC_PRIORITY_BASE, > -VIRT_PLIC_PENDING_BASE, > -VIRT_PLIC_ENABLE_BASE, > -VIRT_PLIC_ENABLE_STRIDE, > -VIRT_PLIC_CONTEXT_BASE, > -VIRT_PLIC_CONTEXT_STRIDE, > - memmap[VIRT_PLIC].size); > -sifive_clint_create(memmap[VIRT_CLINT].base, > -memmap[VIRT_CLINT].size, 0, smp_cpus, > -SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE, true); > +/* SiFive Test MMIO device */ > sifive_test_create(memmap[VIRT_TEST].base); > > +/* VirtIO MMIO devices */ > for (i = 0; i < VIRTIO_COUNT; i++) { > sysbus_create_simple("virtio-mmio", > memmap[VIRT_VIRTIO].base + i * memmap[VIRT_VIRTIO].size, > -qdev_get_gpio_in(DEVICE(s->plic), VIRTIO_IRQ + i)); > +qdev_get_gpio_in(DEVICE(virtio_plic), VIRTIO_IRQ + i)); > } > > gpex_pcie_init(system_memory, > @@ -611,14 +667,14 @@ static void riscv_virt_board_init(MachineState *machine) > memmap[VIRT_PCIE_MMIO].base, > memmap[VIRT_PCIE_MMIO].size, > memmap[VIRT_PCIE_PIO].base, > - DEVICE(s->plic), true); > + DEVICE(pcie_plic), true); > > serial_mm_init(system_memory, memmap[VIRT_UART0].base, > -0, qdev_get_gpio_in(DEVICE(s->plic), UART0_IRQ), 399193, > +0, qdev_get_gpio_in(DEVICE(mmio_plic), UART0_IRQ), 399193, > serial_hd(0), DEVICE_LITTLE_ENDIAN); > > sysbus_create_simple("goldfish_rtc", memmap[VIRT_RTC].base, > -qdev_get_gpio_in(DEVICE(s->plic), RTC_IRQ)); > +qdev_get_gpio_in(DEVICE(mmio_plic), RTC_IRQ)); > > virt_flash_create(s); > > @@ -628,12 +684,37 @@ static void riscv_virt_board_init(MachineState *machine) >drive_get(IF_PFLASH, 0, i)); > } > virt_flash_map(s, system_memory); > +} > > -g_free(plic_hart_config); > +static bool riscv_virt_get_multi_socket(Object *obj, Error **errp) > +{ > +RISCVVirtState *s = RISCV_VIRT_MACHINE(obj); > + > +return s->multi_socket; > +} > + > +static void riscv_virt_set_multi_socket(Object *obj, bool value, Error > **errp) > +{ > +RISCVVirtState *s = RISCV_VIRT_MACHINE(obj); > + > +s->multi_socket = value; > } > > static void riscv_virt_machine_instance_init(Object *obj) > { > +RISCVVirtState *s = RISCV_VIRT_MACHINE(obj); > + > +/* > + * Multi-socket is disabled by default so users have to > + * explicitly enable it from command-line. > + */ > +s->multi_socket = false; > +object_property_add_bool(obj, "multi-socket", > + riscv_virt_get_multi_socket, > + riscv_virt_set_multi_socket); > +object_property_set_description(obj, "multi-socket", > +"Set on/off to enable/disable the " > +"multi-socket support"); > } > > static void riscv_virt_machine_class_init(ObjectClass *oc, void *data) > @@ -642,7 +723,7 @@ static void riscv_virt_machine_class_init(ObjectClass > *oc, void *data) > > mc->desc = "RISC-V VirtIO board"; > mc->init = riscv_virt_board_init; > -mc->max_cpus = 8; > +mc->max_cpus = VIRT_CPUS_MAX; > mc->default_cpu_type = VIRT_CPU; > mc->pci_allow_0_address = true; > } > diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h > index e69355efaf..e5fe10ad48 100644 > --- a/include/hw/riscv/virt.h > +++ b/include/hw/riscv/virt.h > @@ -23,6 +23,9 @@ > #include "hw/sysbus.h" > #include "hw/block/flash.h" > > +#define VIRT_CPUS_MAX 8 > +#define VIRT_SOCKETS_MAX 4 > + > #define TYPE_RISCV_VIRT_MACHINE MACHINE_TYPE_NAME("virt") > #define RISCV_VIRT_MACHINE(obj) \ > OBJECT_CHECK(RISCVVirtState, (obj), TYPE_RISCV_VIRT_MACHINE) > @@ -32,8 +35,10 @@ typedef struct { > MachineState parent; > > /*< public >*/ > -RISCVHartArrayState soc; > -DeviceState *plic; > +bool multi_socket; > +unsigned int num_socs; > +RISCVHartArrayState soc[VIRT_SOCKETS_MAX]; > +DeviceState *plic[VIRT_SOCKETS_MAX]; > PFlashCFI01 *flash[2]; > > void *fdt; > @@ -74,6 +79,8 @@ enum { > #define VIRT_PLIC_ENABLE_STRIDE 0x80 > #define VIRT_PLIC_CONTEXT_BASE 0x20 > #define VIRT_PLIC_CONTEXT_STRIDE 0x1000 > +#define VIRT_PLIC_SIZE(__num_context) \ > +(VIRT_PLIC_CONTEXT_BASE + (__num_context) * VIRT_PLIC_CONTEXT_STRIDE) > > #define FDT_PCI_ADDR_CELLS3 > #define FDT_PCI_INT_CELLS 1 > -- > 2.25.1 > > Otherwise, looks good to me. Reviewed-by: Atish Patra -- Regards, Atish

[PATCH v4 4/4] RISC-V: Support 64 bit start address

2020-07-01 Thread Atish Patra
Even though the start address in ROM code is declared as a 64 bit address for RV64, it can't be used as upper bits are set to zero in ROM code. Update the ROM code correctly to reflect the 64bit value. Signed-off-by: Atish Patra --- hw/riscv/boot.c | 6 +- hw/riscv/sifive_u.c | 6

[PATCH v4 1/4] riscv: Unify Qemu's reset vector code path

2020-07-01 Thread Atish Patra
. Signed-off-by: Atish Patra Reviewed-by: Alistair Francis Reviewed-by: Bin Meng Tested-by: Bin Meng --- hw/riscv/boot.c | 46 + hw/riscv/sifive_u.c | 1 - hw/riscv/spike.c| 41 +++- hw/riscv/virt.c

[PATCH v4 0/4] Add OpenSBI dynamic firmware support

2020-07-01 Thread Atish Patra
(with MSEL changes for sifive_u). 2. Improved the code organization Atish Patra (4): riscv: Unify Qemu's reset vector code path RISC-V: Copy the fdt in dram instead of ROM riscv: Add opensbi firmware dynamic support RISC-V: Support 64 bit start address hw/riscv/boot.c

[PATCH v4 3/4] riscv: Add opensbi firmware dynamic support

2020-07-01 Thread Atish Patra
inue to work as it is. Any other firmware will continue to work without any issues as long as it doesn't expect anything specific from loader in "a2" register. Signed-off-by: Atish Patra Reviewed-by: Alistair Francis --- hw/riscv/boot.c | 42

[PATCH v4 2/4] RISC-V: Copy the fdt in dram instead of ROM

2020-07-01 Thread Atish Patra
at the end of the DRAM or 4GB whichever is lesser. Signed-off-by: Atish Patra Reviewed-by: Alistair Francis --- hw/riscv/boot.c | 53 + hw/riscv/sifive_u.c | 28 ++ hw/riscv/spike.c| 7 +- hw/riscv/virt.c | 7

[PATCH v3 2/3] RISC-V: Copy the fdt in dram instead of ROM

2020-06-25 Thread Atish Patra
at the end of the DRAM or 4GB whichever is lesser. Signed-off-by: Atish Patra Reviewed-by: Alistair Francis --- hw/riscv/boot.c | 57 + hw/riscv/sifive_u.c | 32 +++ hw/riscv/spike.c| 7 - hw/riscv/virt.c | 7

[PATCH v3 0/3] Add OpenSBI dynamic firmware support

2020-06-25 Thread Atish Patra
e existing setup. Changes from v2->v3: 1. Removed redundant header includes. Changes from v1->v2: 1. Rebased on top of latest upstream Qemu (with MSEL changes for sifive_u). 2. Improved the code organization Atish Patra (3): riscv: Unify Qemu's reset vector code path RISC-V: Copy the fdt in dra

[PATCH v3 1/3] riscv: Unify Qemu's reset vector code path

2020-06-25 Thread Atish Patra
. Signed-off-by: Atish Patra Reviewed-by: Alistair Francis --- hw/riscv/boot.c | 45 + hw/riscv/sifive_u.c | 1 - hw/riscv/spike.c| 41 +++-- hw/riscv/virt.c | 40

[PATCH v3 3/3] riscv: Add opensbi firmware dynamic support

2020-06-25 Thread Atish Patra
inue to work as it is. Any other firmware will continue to work without any issues as long as it doesn't expect anything specific from loader in "a2" register. Signed-off-by: Atish Patra Reviewed-by: Alistair Francis --- hw/riscv/boot.c | 39 -- hw/ri

[PATCH v2 3/3] riscv: Add opensbi firmware dynamic support

2020-06-25 Thread Atish Patra
inue to work as it is. Any other firmware will continue to work without any issues as long as it doesn't expect anything specific from loader in "a2" register. Signed-off-by: Atish Patra --- hw/riscv/boot.c | 39 -- hw/riscv/sifive_u.c | 15

[PATCH v2 2/3] RISC-V: Copy the fdt in dram instead of ROM

2020-06-25 Thread Atish Patra
at the end of the DRAM or 4GB whichever is lesser. Signed-off-by: Atish Patra --- hw/riscv/boot.c | 57 + hw/riscv/sifive_u.c | 32 +++ hw/riscv/spike.c| 7 - hw/riscv/virt.c | 7 - include/hw/riscv/boot.h

Re: [PATCH v2 1/3] riscv: Unify Qemu's reset vector code path

2020-06-25 Thread Atish Patra
On Thu, Jun 25, 2020 at 12:50 PM Alistair Francis wrote: > > On Thu, Jun 25, 2020 at 11:38 AM Atish Patra wrote: > > > > Currently, all riscv machines except sifive_u have identical reset vector > > code implementations with memory addresses being different for al

[PATCH v2 0/3] Add OpenSBI dynamic firmware support

2020-06-25 Thread Atish Patra
e existing setup. Changes from v1->v2: 1. Rebased on top of latest upstream Qemu (with MSEL changes for sifive_u). 2. Improved the code organization Atish Patra (3): riscv: Unify Qemu's reset vector code path RISC-V: Copy the fdt in dram instead of ROM riscv: Add opensbi firmware dynamic support hw

[PATCH v2 1/3] riscv: Unify Qemu's reset vector code path

2020-06-25 Thread Atish Patra
. Signed-off-by: Atish Patra --- hw/riscv/boot.c | 46 + hw/riscv/spike.c| 38 +++--- hw/riscv/virt.c | 37 +++-- include/hw/riscv/boot.h | 2 ++ 4 files changed, 54 insertions

Re: [PATCH v3 2/3] RISC-V: Copy the fdt in dram instead of ROM

2020-06-26 Thread Atish Patra
On Fri, Jun 26, 2020 at 7:54 PM Bin Meng wrote: > > Hi Atish, > > On Sat, Jun 27, 2020 at 12:58 AM Atish Patra wrote: > > > > On Fri, Jun 26, 2020 at 4:50 AM Bin Meng wrote: > > > > > > Hi Atish, > > > > > > On Fri, Jun 26, 2020 at 8:

Re: [PATCH v3 3/3] riscv: Add opensbi firmware dynamic support

2020-06-26 Thread Atish Patra
On Fri, Jun 26, 2020 at 5:18 AM Bin Meng wrote: > > Hi Atish, > > On Fri, Jun 26, 2020 at 8:33 AM Atish Patra wrote: > > > > OpenSBI is the default firmware in Qemu and has various firmware loading > > options. Currently, qemu loader uses fw_jump which has a compil

Re: [PATCH v3 2/3] RISC-V: Copy the fdt in dram instead of ROM

2020-06-26 Thread Atish Patra
On Fri, Jun 26, 2020 at 4:50 AM Bin Meng wrote: > > Hi Atish, > > On Fri, Jun 26, 2020 at 8:33 AM Atish Patra wrote: > > > > Currently, the fdt is copied to the ROM after the reset vector. The firmware > > has to copy it to DRAM. Instead of this, directly cop

Re: [PATCH v3 2/3] RISC-V: Copy the fdt in dram instead of ROM

2020-06-29 Thread Atish Patra
On Sat, Jun 27, 2020 at 2:55 AM Bin Meng wrote: > > On Sat, Jun 27, 2020 at 12:37 PM Atish Patra wrote: > > > > On Fri, Jun 26, 2020 at 7:54 PM Bin Meng wrote: > > > > > > Hi Atish, > > > > > > On Sat, Jun 27, 2020 at 12:58 AM Atish Patra

[PATCH 0/3] Add OpenSBI dynamic firmware support

2020-06-16 Thread Atish Patra
e existing setup. Atish Patra (3): riscv: Unify Qemu's reset vector code path RISC-V: Copy the fdt in dram instead of ROM riscv: Add opensbi firmware dynamic support hw/riscv/boot.c | 95 + hw/riscv/sifive_u.c | 59 hw/ris

[PATCH 2/3] RISC-V: Copy the fdt in dram instead of ROM

2020-06-16 Thread Atish Patra
at the end of the DRAM or 4GB whichever is lesser. Signed-off-by: Atish Patra --- hw/riscv/boot.c | 45 ++--- hw/riscv/sifive_u.c | 14 - hw/riscv/spike.c| 14 - hw/riscv/virt.c | 13 +++- include/hw/riscv

[PATCH 3/3] riscv: Add opensbi firmware dynamic support

2020-06-16 Thread Atish Patra
inue to work as it is. Any other firmware will continue to work without any issues as long as it doesn't expect anything specific from loader in "a2" register. Signed-off-by: Atish Patra --- hw/riscv/boot.c | 32 -- hw/riscv/sifive_u.c | 11 +++

Re: [PATCH 1/3] riscv: Unify Qemu's reset vector code path

2020-06-19 Thread Atish Patra
On Fri, Jun 19, 2020 at 10:11 AM Alexander Richardson wrote: > > On Tue, 16 Jun 2020 at 20:30, Atish Patra wrote: > > > > Currently, all riscv machines have identical reset vector code > > implementations with memory addresses being different for all machines. > &g

Re: [PATCH 0/3] Add OpenSBI dynamic firmware support

2020-06-18 Thread Atish Patra
On Thu, Jun 18, 2020 at 1:56 AM Bin Meng wrote: > > On Wed, Jun 17, 2020 at 3:29 AM Atish Patra wrote: > > > > This series adds support OpenSBI dynamic firmware support to Qemu. > > Qemu loader passes the information about the DT and next stage (i.e. kernel > >

Re: [PATCH 2/3] RISC-V: Copy the fdt in dram instead of ROM

2020-06-18 Thread Atish Patra
On Thu, Jun 18, 2020 at 1:26 AM Bin Meng wrote: > > On Wed, Jun 17, 2020 at 3:29 AM Atish Patra wrote: > > > > Currently, the fdt is copied to the ROM after the reset vector. The firmware > > has to copy it to DRAM. Instead of this, directly copy the device tree to

Re: [PATCH 1/3] riscv: Unify Qemu's reset vector code path

2020-06-18 Thread Atish Patra
On Thu, Jun 18, 2020 at 1:03 AM Bin Meng wrote: > > On Wed, Jun 17, 2020 at 3:30 AM Atish Patra wrote: > > > > Currently, all riscv machines have identical reset vector code > > implementations with memory addresses being different for all machines. > > They can be

[PATCH 1/3] riscv: Unify Qemu's reset vector code path

2020-06-16 Thread Atish Patra
-by: Atish Patra --- hw/riscv/boot.c | 46 + hw/riscv/sifive_u.c | 38 +++--- hw/riscv/spike.c| 38 +++--- hw/riscv/virt.c | 37 +++-- include/hw/riscv

Re: [PATCH v5 4/5] hw/riscv: spike: Allow creating multiple NUMA sockets

2020-06-12 Thread Atish Patra
_init(MachineClass *mc) > mc->max_cpus = 1; > } > > -static void spike_machine_init(MachineClass *mc) > +DEFINE_MACHINE("spike_v1.9.1", spike_v1_09_1_machine_init) > +DEFINE_MACHINE("spike_v1.10", spike_v1_10_0_machine_init) > + > +static void spike_machine_instance_init(Object *obj) > +{ > +} > + > +static void spike_machine_class_init(ObjectClass *oc, void *data) > { > -mc->desc = "RISC-V Spike Board"; > +MachineClass *mc = MACHINE_CLASS(oc); > + > +mc->desc = "RISC-V Spike board"; > mc->init = spike_board_init; > -mc->max_cpus = 8; > +mc->max_cpus = SPIKE_CPUS_MAX; > mc->is_default = true; > mc->default_cpu_type = SPIKE_V1_10_0_CPU; > +mc->possible_cpu_arch_ids = riscv_numa_possible_cpu_arch_ids; > +mc->cpu_index_to_instance_props = riscv_numa_cpu_index_to_props; > +mc->get_default_cpu_node_id = riscv_numa_get_default_cpu_node_id; > +mc->numa_mem_supported = true; > } > > -DEFINE_MACHINE("spike_v1.9.1", spike_v1_09_1_machine_init) > -DEFINE_MACHINE("spike_v1.10", spike_v1_10_0_machine_init) > -DEFINE_MACHINE("spike", spike_machine_init) > +static const TypeInfo spike_machine_typeinfo = { > +.name = MACHINE_TYPE_NAME("spike"), > +.parent = TYPE_MACHINE, > +.class_init = spike_machine_class_init, > +.instance_init = spike_machine_instance_init, > +.instance_size = sizeof(SpikeState), > +}; > + > +static void spike_machine_init_register_types(void) > +{ > +type_register_static(_machine_typeinfo); > +} > + > +type_init(spike_machine_init_register_types) > diff --git a/include/hw/riscv/spike.h b/include/hw/riscv/spike.h > index dc770421bc..c55fdf4d24 100644 > --- a/include/hw/riscv/spike.h > +++ b/include/hw/riscv/spike.h > @@ -22,12 +22,19 @@ > #include "hw/riscv/riscv_hart.h" > #include "hw/sysbus.h" > > +#define SPIKE_CPUS_MAX 8 > +#define SPIKE_SOCKETS_MAX 8 > + > +#define TYPE_SPIKE_MACHINE MACHINE_TYPE_NAME("spike") > +#define SPIKE_MACHINE(obj) \ > +OBJECT_CHECK(SpikeState, (obj), TYPE_SPIKE_MACHINE) > + > typedef struct { > /*< private >*/ > -SysBusDevice parent_obj; > +MachineState parent; > > /*< public >*/ > -RISCVHartArrayState soc; > +RISCVHartArrayState soc[SPIKE_SOCKETS_MAX]; > void *fdt; > int fdt_size; > } SpikeState; > -- > 2.25.1 > > As the upstream version of spike removed the deprecated ISA specific machines, the rebased patch will be bit different from this version. But I don't think there will be any change in functionality. With that assumption: Reviewed-by: Atish Patra -- Regards, Atish

Re: [PATCH v5 3/5] hw/riscv: Add helpers for RISC-V multi-socket NUMA machines

2020-06-12 Thread Atish Patra
> > > Francis > > > Sent: 11 June 2020 04:59 > > > To: Anup Patel > > > Cc: Peter Maydell ; open list:RISC-V > > > > > ri...@nongnu.org>; Sagar Karandikar ; > > > Anup > > > Patel ; qemu-devel@nongnu.org Developers > > >

Re: [PATCH v5 5/5] hw/riscv: virt: Allow creating multiple NUMA sockets

2020-06-12 Thread Atish Patra
memory); > > -/* create PLIC hart topology configuration string */ > -plic_hart_config_len = (strlen(VIRT_PLIC_HART_CONFIG) + 1) * smp_cpus; > -plic_hart_config = g_malloc0(plic_hart_config_len); > -for (i = 0; i < smp_cpus; i++) { > -if (i != 0) { > -strncat(plic_hart_config, ",", plic_hart_config_len); > -} > -strncat(plic_hart_config, VIRT_PLIC_HART_CONFIG, > plic_hart_config_len); > -plic_hart_config_len -= (strlen(VIRT_PLIC_HART_CONFIG) + 1); > -} > - > -/* MMIO */ > -s->plic = sifive_plic_create(memmap[VIRT_PLIC].base, > -plic_hart_config, 0, > -VIRT_PLIC_NUM_SOURCES, > -VIRT_PLIC_NUM_PRIORITIES, > -VIRT_PLIC_PRIORITY_BASE, > -VIRT_PLIC_PENDING_BASE, > -VIRT_PLIC_ENABLE_BASE, > -VIRT_PLIC_ENABLE_STRIDE, > -VIRT_PLIC_CONTEXT_BASE, > -VIRT_PLIC_CONTEXT_STRIDE, > -memmap[VIRT_PLIC].size); > -sifive_clint_create(memmap[VIRT_CLINT].base, > -memmap[VIRT_CLINT].size, 0, smp_cpus, > -SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE, true); > +/* SiFive Test MMIO device */ > sifive_test_create(memmap[VIRT_TEST].base); > > +/* VirtIO MMIO devices */ > for (i = 0; i < VIRTIO_COUNT; i++) { > sysbus_create_simple("virtio-mmio", > memmap[VIRT_VIRTIO].base + i * memmap[VIRT_VIRTIO].size, > -qdev_get_gpio_in(DEVICE(s->plic), VIRTIO_IRQ + i)); > +qdev_get_gpio_in(DEVICE(virtio_plic), VIRTIO_IRQ + i)); > } > > gpex_pcie_init(system_memory, > @@ -611,14 +681,14 @@ static void riscv_virt_board_init(MachineState *machine) > memmap[VIRT_PCIE_MMIO].base, > memmap[VIRT_PCIE_MMIO].size, > memmap[VIRT_PCIE_PIO].base, > - DEVICE(s->plic), true); > + DEVICE(pcie_plic), true); > > serial_mm_init(system_memory, memmap[VIRT_UART0].base, > -0, qdev_get_gpio_in(DEVICE(s->plic), UART0_IRQ), 399193, > +0, qdev_get_gpio_in(DEVICE(mmio_plic), UART0_IRQ), 399193, > serial_hd(0), DEVICE_LITTLE_ENDIAN); > > sysbus_create_simple("goldfish_rtc", memmap[VIRT_RTC].base, > -qdev_get_gpio_in(DEVICE(s->plic), RTC_IRQ)); > +qdev_get_gpio_in(DEVICE(mmio_plic), RTC_IRQ)); > > virt_flash_create(s); > > @@ -628,8 +698,6 @@ static void riscv_virt_board_init(MachineState *machine) >drive_get(IF_PFLASH, 0, i)); > } > virt_flash_map(s, system_memory); > - > -g_free(plic_hart_config); > } > > static void riscv_virt_machine_instance_init(Object *obj) > @@ -642,9 +710,13 @@ static void riscv_virt_machine_class_init(ObjectClass > *oc, void *data) > > mc->desc = "RISC-V VirtIO board"; > mc->init = riscv_virt_board_init; > -mc->max_cpus = 8; > +mc->max_cpus = VIRT_CPUS_MAX; > mc->default_cpu_type = VIRT_CPU; > mc->pci_allow_0_address = true; > +mc->possible_cpu_arch_ids = riscv_numa_possible_cpu_arch_ids; > +mc->cpu_index_to_instance_props = riscv_numa_cpu_index_to_props; > +mc->get_default_cpu_node_id = riscv_numa_get_default_cpu_node_id; > +mc->numa_mem_supported = true; > } > > static const TypeInfo riscv_virt_machine_typeinfo = { > diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h > index e69355efaf..1beacd7666 100644 > --- a/include/hw/riscv/virt.h > +++ b/include/hw/riscv/virt.h > @@ -23,6 +23,9 @@ > #include "hw/sysbus.h" > #include "hw/block/flash.h" > > +#define VIRT_CPUS_MAX 8 > +#define VIRT_SOCKETS_MAX 8 > + > #define TYPE_RISCV_VIRT_MACHINE MACHINE_TYPE_NAME("virt") > #define RISCV_VIRT_MACHINE(obj) \ > OBJECT_CHECK(RISCVVirtState, (obj), TYPE_RISCV_VIRT_MACHINE) > @@ -32,8 +35,8 @@ typedef struct { > MachineState parent; > > /*< public >*/ > -RISCVHartArrayState soc; > -DeviceState *plic; > +RISCVHartArrayState soc[VIRT_SOCKETS_MAX]; > +DeviceState *plic[VIRT_SOCKETS_MAX]; > PFlashCFI01 *flash[2]; > > void *fdt; > @@ -74,6 +77,8 @@ enum { > #define VIRT_PLIC_ENABLE_STRIDE 0x80 > #define VIRT_PLIC_CONTEXT_BASE 0x20 > #define VIRT_PLIC_CONTEXT_STRIDE 0x1000 > +#define VIRT_PLIC_SIZE(__num_context) \ > +(VIRT_PLIC_CONTEXT_BASE + (__num_context) * VIRT_PLIC_CONTEXT_STRIDE) > > #define FDT_PCI_ADDR_CELLS3 > #define FDT_PCI_INT_CELLS 1 > -- > 2.25.1 > > LGTM. Reviewed-by: Atish Patra -- Regards, Atish

Re: [PATCH v5 3/5] hw/riscv: Add helpers for RISC-V multi-socket NUMA machines

2020-06-12 Thread Atish Patra
t; + * > + * You should have received a copy of the GNU General Public License along > with > + * this program. If not, see <http://www.gnu.org/licenses/>. > + */ > + > +#ifndef RISCV_NUMA_H > +#define RISCV_NUMA_H > + > +#include "hw/sysbus.h" > +#include "sysemu/numa.h" > + > +int riscv_socket_count(const MachineState *ms); > + > +int riscv_socket_first_hartid(const MachineState *ms, int socket_id); > + > +int riscv_socket_last_hartid(const MachineState *ms, int socket_id); > + > +int riscv_socket_hart_count(const MachineState *ms, int socket_id); > + > +uint64_t riscv_socket_mem_offset(const MachineState *ms, int socket_id); > + > +uint64_t riscv_socket_mem_size(const MachineState *ms, int socket_id); > + > +bool riscv_socket_check_hartids(const MachineState *ms, int socket_id); > + > +void riscv_socket_fdt_write_id(const MachineState *ms, void *fdt, > + const char *node_name, int socket_id); > + > +void riscv_socket_fdt_write_distance_matrix(const MachineState *ms, void > *fdt); > + > +CpuInstanceProperties > +riscv_numa_cpu_index_to_props(MachineState *ms, unsigned cpu_index); > + > +int64_t riscv_numa_get_default_cpu_node_id(const MachineState *ms, int idx); > + > +const CPUArchIdList *riscv_numa_possible_cpu_arch_ids(MachineState *ms); > + > +#endif /* RISCV_NUMA_H */ > -- > 2.25.1 > > LGTM. Reviewed-by: Atish Patra -- Regards, Atish

[v2 PATCH] RISC-V: Place DTB at 3GB boundary instead of 4GB

2021-01-07 Thread Atish Patra
ng Signed-off-by: Atish Patra --- Changes from v2->v1 1. Added the fixes tag and updated aligned down address to 16MB. --- hw/riscv/boot.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c index d62f3dc7581e..2ed23c7e9849 100644 --- a/hw

Re: [PATCH v2] target/riscv/pmp: Raise exception if no PMP entry is configured

2021-01-07 Thread Atish Patra
On Thu, 2021-01-07 at 09:19 -0800, Alistair Francis wrote: > On Wed, Dec 23, 2020 at 11:26 AM Atish Patra > wrote: > > > > As per the privilege specification, any access from S/U mode should > > fail > > if no pmp region is configured. > > Thi

[PATCH] RISC-V: Place DTB at 3GB boundary instead of 4GB

2020-12-17 Thread Atish Patra
is used. Fix this by placing the DTB at 2MB from 3GB or end of DRAM whichever is lower. Signed-off-by: Atish Patra --- hw/riscv/boot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c index d62f3dc7581e..9e77b22e4d56 100644 --- a/hw/riscv

Re: [PATCH] RISC-V: Place DTB at 3GB boundary instead of 4GB

2020-12-17 Thread Atish Patra
On Thu, 2020-12-17 at 14:31 -0800, Palmer Dabbelt wrote: > On Thu, 17 Dec 2020 13:48:26 PST (-0800), Atish Patra wrote: > > Currently, we place the DTB at 2MB from 4GB or end of DRAM which > > ever is > > lesser. However, Linux kernel can address only 1GB of memory for >

Re: [PATCH] RISC-V: Place DTB at 3GB boundary instead of 4GB

2020-12-17 Thread Atish Patra
On Fri, 2020-12-18 at 15:21 +0800, Bin Meng wrote: > Hi Atish, > > On Fri, Dec 18, 2020 at 5:48 AM Atish Patra > wrote: > > > > Currently, we place the DTB at 2MB from 4GB or end of DRAM which > > ever is > > lesser. However, Linux kernel can address only

Re: [PATCH] RISC-V: Place DTB at 3GB boundary instead of 4GB

2020-12-18 Thread Atish Patra
On Fri, 2020-12-18 at 15:33 +0800, Bin Meng wrote: > Hi Atish, > > On Fri, Dec 18, 2020 at 3:27 PM Atish Patra > wrote: > > > > On Fri, 2020-12-18 at 15:21 +0800, Bin Meng wrote: > > > Hi Atish, > > > > > > On Fri, Dec 18, 2020 at 5:48 AM A

Re: [PATCH] target/riscv/pmp: Raise exception if no PMP entry is configured

2020-12-23 Thread Atish Patra
On Tue, 2020-12-22 at 18:49 -0800, Richard Henderson wrote: > On 12/22/20 5:21 PM, Atish Patra wrote: > > +++ b/target/riscv/pmp.c > > @@ -74,7 +74,7 @@ static inline int pmp_is_locked(CPURISCVState > > *env, uint32_t pmp_index) > >  /* > >   *

[PATCH v2] target/riscv/pmp: Raise exception if no PMP entry is configured

2020-12-23 Thread Atish Patra
As per the privilege specification, any access from S/U mode should fail if no pmp region is configured. Signed-off-by: Atish Patra --- Changes from v2->v1 1. Removed the static from the function definition --- target/riscv/op_helper.c | 5 + target/riscv/pmp.c | 4 ++-- target/ri

Re: [PATCH] RISC-V: Place DTB at 3GB boundary instead of 4GB

2020-12-18 Thread Atish Patra
On Fri, 2020-12-18 at 16:42 +0800, Bin Meng wrote: > Hi Atish, > > On Fri, Dec 18, 2020 at 4:00 PM Atish Patra > wrote: > > > > On Fri, 2020-12-18 at 15:33 +0800, Bin Meng wrote: > > > Hi Atish, > > > > > > On Fri, Dec 18, 2020 at 3:27 PM Atis

Re: [PATCH] RISC-V: Place DTB at 3GB boundary instead of 4GB

2020-12-22 Thread Atish Patra
On Tue, 2020-12-22 at 13:35 +0800, Bin Meng wrote: > Hi Atish, > > On Sat, Dec 19, 2020 at 3:46 AM Atish Patra > wrote: > > > > On Fri, 2020-12-18 at 16:42 +0800, Bin Meng wrote: > > > Hi Atish, > > > > > > On Fri, Dec 18, 2020 at 4:00 PM Atis

[PATCH] target/riscv/pmp: Raise exception if no PMP entry is configured

2020-12-22 Thread Atish Patra
As per the privilege specification, any access from S/U mode should fail if no pmp region is configured. Signed-off-by: Atish Patra --- target/riscv/op_helper.c | 5 + target/riscv/pmp.c | 4 ++-- target/riscv/pmp.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff

Re: [PATCH] RISC-V: Place DTB at 3GB boundary instead of 4GB

2021-01-05 Thread Atish Patra
On Tue, 2021-01-05 at 11:11 +0800, Bin Meng wrote: > On Fri, Dec 18, 2020 at 5:48 AM Atish Patra > wrote: > > > > Currently, we place the DTB at 2MB from 4GB or end of DRAM which > > ever is > > lesser. However, Linux kernel can address only 1GB of memory for >

Re: [PATCH] RISC-V: Place DTB at 3GB boundary instead of 4GB

2021-01-05 Thread Atish Patra
On Wed, 2021-01-06 at 08:04 +0800, Bin Meng wrote: > Hi Atish, > > On Wed, Jan 6, 2021 at 7:44 AM Atish Patra > wrote: > > > > On Tue, 2021-01-05 at 11:11 +0800, Bin Meng wrote: > > > On Fri, Dec 18, 2020 at 5:48 AM Atish Patra > > > wrote: > >

Re: [PATCH] RISC-V: Place DTB at 3GB boundary instead of 4GB

2021-01-04 Thread Atish Patra
On Tue, 2020-12-29 at 12:49 +0800, Bin Meng wrote: > Hi Atish, > > On Wed, Dec 23, 2020 at 9:20 AM Bin Meng wrote: > > > > Hi Atish, > > > > On Wed, Dec 23, 2020 at 3:59 AM Atish Patra > > wrote: > > > > > > On Tue, 20

[ RFC 1/6] target/riscv: Remove privilege v1.9 specific CSR related code

2021-03-19 Thread Atish Patra
Qemu doesn't support RISC-V privilege specification v1.9. Remove the remaining v1.9 specific references from the implementation. Signed-off-by: Atish Patra --- target/riscv/cpu.c| 2 +- target/riscv/cpu.h| 4 +--- target/riscv/cpu_bits.h | 23 - target

[ RFC 4/6] target/riscv: Add support for hpmcounters/hpmevents

2021-03-19 Thread Atish Patra
With SBI PMU extension, user can use any of the available hpmcounters to track any perf events based on the value written to mhpmevent csr. Add read/write functionality for these csrs. Signed-off-by: Atish Patra --- target/riscv/cpu.h | 7 + target/riscv/csr.c | 444

[ RFC 0/6] Improve PMU support

2021-03-19 Thread Atish Patra
ree/riscv_pmu_v1 [4] https://github.com/atishp04/qemu/tree/riscv_pmu_v1 Atish Patra (6): target/riscv: Remove privilege v1.9 specific CSR related code target/riscv: Implement mcountinhibit CSR target/riscv: Support mcycle/minstret write operation target/riscv: Add support for hpmcounters/hpmevent

[ RFC 2/6] target/riscv: Implement mcountinhibit CSR

2021-03-19 Thread Atish Patra
As per the privilege specification v1.11, mcountinhibit allows to start/stop a pmu counter selectively. Signed-off-by: Atish Patra --- target/riscv/cpu.h | 2 ++ target/riscv/cpu_bits.h | 4 target/riscv/csr.c | 23 +++ target/riscv/machine.c | 1 + 4

[ RFC 6/6] hw/riscv: virt: DEBUG PATCH to test PMU

2021-03-19 Thread Atish Patra
-by: Atish Patra --- hw/riscv/virt.c | 34 -- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 84570ad6425b..59d8325bf2a1 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -194,7 +194,9 @@ static void create_fdt

[ RFC 5/6] hw/riscv: virt: Add PMU device tree node to support SBI PMU extension

2021-03-19 Thread Atish Patra
Qemu can't really support any PMU events other than cycle & instructions counters. Add a PMU device tree node only for these events based on device tree bindings defined in OpenSBI Signed-off-by: Atish Patra --- hw/riscv/virt.c | 22 -- 1 file changed, 20 insertions(+

[ RFC 3/6] target/riscv: Support mcycle/minstret write operation

2021-03-19 Thread Atish Patra
mcycle/minstret are actually WARL registers and can be written with any given value. With SBI PMU extension, it will be used to store a initial value provided from supervisor OS. The Qemu also need prohibit the counter increment if mcountinhibit is set. Signed-off-by: Atish Patra --- target

[ RFC v2 8/9] target/riscv: Add few cache related PMU events

2021-09-09 Thread Atish Patra
Qemu can monitor the following cache related PMU events through tlb_fill functions. 1. DTLB load/store miss 3. ITLB prefetch miss Increment the PMU counter in tlb_fill function. Signed-off-by: Atish Patra --- target/riscv/cpu_helper.c | 26 ++ 1 file changed, 26

[ RFC v2 0/9] Improve PMU support

2021-09-09 Thread Atish Patra
cv-non-isa/riscv-sbi-doc/blob/master/riscv-sbi.adoc [2] https://drive.google.com/file/d/171j4jFjIkKdj5LWcExphq4xG_2sihbfd/edit [3] https://github.com/atishp04/opensbi/tree/pmu_sscofpmf [3] https://github.com/atishp04/linux/tree/riscv_pmu_v3 [4] https://github.com/atishp04/qemu/tree/riscv_pmu_v2

[ RFC v2 1/9] target/riscv: Fix PMU CSR predicate function

2021-09-09 Thread Atish Patra
Currently, the predicate function for PMU related CSRs only works if virtualization is enabled. Ideally, they should check the mcountern bits before cycle/minstret/hpmcounterx access. The predicate function also calculates the counter index incorrectly for hpmcounterx. Signed-off-by: Atish Patra

[ RFC v2 2/9] target/riscv: pmu: Rename the counters extension to pmu

2021-09-09 Thread Atish Patra
Signed-off-by: Atish Patra --- target/riscv/cpu.c | 2 +- target/riscv/cpu.h | 2 +- target/riscv/csr.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 991a6bb7604f..7a486450ebc6 100644 --- a/target/riscv/cpu.c +++ b/target/r

[ RFC v2 7/9] target/riscv: Add sscofpmf extension support

2021-09-09 Thread Atish Patra
. Signed-off-by: Atish Patra --- target/riscv/cpu.c | 12 ++ target/riscv/cpu.h | 25 +++ target/riscv/cpu_bits.h | 55 +++ target/riscv/csr.c | 152 +- target/riscv/pmu.c | 343 +++- target/riscv/pmu.h | 9 ++ 6

[ RFC v2 5/9] target/riscv: Add support for hpmcounters/hpmevents

2021-09-09 Thread Atish Patra
With SBI PMU extension, user can use any of the available hpmcounters to track any perf events based on the value written to mhpmevent csr. Add read/write functionality for these csrs. Signed-off-by: Atish Patra --- target/riscv/cpu.h | 12 ++ target/riscv/csr.c | 468

[ RFC v2 9/9] hw/riscv: virt: Add PMU DT node to the device tree

2021-09-09 Thread Atish Patra
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. Signed-off-by: Atish Patra --- hw/riscv/virt.c| 25

[ RFC v2 3/9] target/riscv: pmu: Make number of counters configurable

2021-09-09 Thread Atish Patra
by the cpu. Signed-off-by: Atish Patra --- target/riscv/cpu.c | 2 +- target/riscv/cpu.h | 2 +- target/riscv/csr.c | 96 ++ 3 files changed, 65 insertions(+), 35 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 7a486450ebc6

[ RFC v2 4/9] target/riscv: Implement mcountinhibit CSR

2021-09-09 Thread Atish Patra
As per the privilege specification v1.11, mcountinhibit allows to start/stop a pmu counter selectively. Signed-off-by: Atish Patra --- target/riscv/cpu.h | 2 ++ target/riscv/cpu_bits.h | 4 target/riscv/csr.c | 25 + target/riscv/machine.c | 5

[ RFC v2 6/9] target/riscv: Support mcycle/minstret write operation

2021-09-09 Thread Atish Patra
counter infrastructure. Signed-off-by: Atish Patra --- target/riscv/cpu.h | 24 +-- target/riscv/csr.c | 144 ++- target/riscv/machine.c | 26 ++- target/riscv/meson.build | 1 + target/riscv/pmu.c | 32 + target/riscv

Re: [ RFC v2 1/9] target/riscv: Fix PMU CSR predicate function

2021-09-16 Thread Atish Patra
On Wed, Sep 15, 2021 at 7:51 AM Bin Meng wrote: > > On Fri, Sep 10, 2021 at 4:27 AM Atish Patra wrote: > > > > Currently, the predicate function for PMU related CSRs only works if > > virtualization is enabled. Ideally, they should check the mcountern > > bits bef

Re: [ RFC v2 4/9] target/riscv: Implement mcountinhibit CSR

2021-09-16 Thread Atish Patra
On Wed, Sep 15, 2021 at 7:54 AM Bin Meng wrote: > > On Fri, Sep 10, 2021 at 4:29 AM Atish Patra wrote: > > > > As per the privilege specification v1.11, mcountinhibit allows to start/stop > > a pmu counter selectively. > > > > Signed-off-by: Atish Patra >

Re: [ RFC v2 3/9] target/riscv: pmu: Make number of counters configurable

2021-09-16 Thread Atish Patra
On Wed, Sep 15, 2021 at 7:51 AM Bin Meng wrote: > > On Fri, Sep 10, 2021 at 4:29 AM Atish Patra wrote: > > > > The RISC-V privilege specification provides flexibility to implement > > any number of counters from 29 programmable counters. However, the Qemu > > nits:

[ PATCH v3 06/10] target/riscv: Add support for hpmcounters/hpmevents

2021-10-25 Thread Atish Patra
With SBI PMU extension, user can use any of the available hpmcounters to track any perf events based on the value written to mhpmevent csr. Add read/write functionality for these csrs. Signed-off-by: Atish Patra --- target/riscv/cpu.h | 12 ++ target/riscv/csr.c | 468

[ PATCH v3 00/10] Improve PMU support

2021-10-25 Thread Atish Patra
ishp04/opensbi/tree/pmu_sscofpmf_v2 [3] https://github.com/atishp04/linux/tree/riscv_pmu_v4 [4] https://github.com/atishp04/qemu/tree/riscv_pmu_v3 Atish Patra (10): target/riscv: Fix PMU CSR predicate function target/riscv: Implement PMU CSR predicate function for target/riscv: pmu: Rename the counters exte

[ PATCH v3 07/10] target/riscv: Support mcycle/minstret write operation

2021-10-25 Thread Atish Patra
counter infrastructure. Signed-off-by: Atish Patra --- target/riscv/cpu.h | 24 +-- target/riscv/csr.c | 144 ++- target/riscv/machine.c | 26 ++- target/riscv/meson.build | 1 + target/riscv/pmu.c | 32 + target/riscv

[ PATCH v3 10/10] hw/riscv: virt: Add PMU DT node to the device tree

2021-10-25 Thread Atish Patra
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

[ PATCH v3 03/10] target/riscv: pmu: Rename the counters extension to pmu

2021-10-25 Thread Atish Patra
Signed-off-by: Atish Patra --- target/riscv/cpu.c | 2 +- target/riscv/cpu.h | 2 +- target/riscv/csr.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 1d69d1887e63..3b55f5ed0036 100644 --- a/target/riscv/cpu.c +++ b/target/r

[ PATCH v3 09/10] target/riscv: Add few cache related PMU events

2021-10-25 Thread Atish Patra
Qemu can monitor the following cache related PMU events through tlb_fill functions. 1. DTLB load/store miss 3. ITLB prefetch miss Increment the PMU counter in tlb_fill function. Signed-off-by: Atish Patra --- target/riscv/cpu_helper.c | 26 ++ 1 file changed, 26

[ PATCH v3 02/10] target/riscv: Implement PMU CSR predicate function for

2021-10-25 Thread Atish Patra
Currently, the predicate function for PMU related CSRs only works if virtualization is enabled. It also does not check mcounteren bits before before cycle/minstret/hpmcounterx access. Support supervisor mode access in the predicate function as well. Signed-off-by: Atish Patra --- target/riscv

[ PATCH v3 05/10] target/riscv: Implement mcountinhibit CSR

2021-10-25 Thread Atish Patra
As per the privilege specification v1.11, mcountinhibit allows to start/stop a pmu counter selectively. Signed-off-by: Atish Patra --- target/riscv/cpu.h | 2 ++ target/riscv/cpu_bits.h | 4 target/riscv/csr.c | 25 + target/riscv/machine.c | 5

[ PATCH v3 01/10] target/riscv: Fix PMU CSR predicate function

2021-10-25 Thread Atish Patra
The predicate function calculates the counter index incorrectly for hpmcounterx. Fix the counter index to reflect correct CSR number. Signed-off-by: Atish Patra --- target/riscv/csr.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/target/riscv/csr.c b/target

[ PATCH v3 04/10] target/riscv: pmu: Make number of counters configurable

2021-10-25 Thread Atish Patra
by the cpu. Signed-off-by: Atish Patra --- target/riscv/cpu.c | 2 +- target/riscv/cpu.h | 2 +- target/riscv/csr.c | 96 ++ 3 files changed, 65 insertions(+), 35 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 3b55f5ed0036

[ PATCH v3 08/10] target/riscv: Add sscofpmf extension support

2021-10-25 Thread Atish Patra
. Signed-off-by: Atish Patra --- target/riscv/cpu.c | 12 ++ target/riscv/cpu.h | 25 +++ target/riscv/cpu_bits.h | 55 +++ target/riscv/csr.c | 150 +- target/riscv/machine.c | 2 +- target/riscv/pmu.c | 343

Re: [ PATCH v3 03/10] target/riscv: pmu: Rename the counters extension to pmu

2022-01-05 Thread Atish Patra
On Thu, Nov 4, 2021 at 4:11 AM Bin Meng wrote: > > On Tue, Oct 26, 2021 at 4:02 AM Atish Patra wrote: > > > > The PMU counters are supported via cpu config "Counters" which doesn't > > indicate the correct purpose of those counters. > > > >

Re: [ PATCH v3 02/10] target/riscv: Implement PMU CSR predicate function for

2022-01-05 Thread Atish Patra
On Thu, Nov 4, 2021 at 4:08 AM Bin Meng wrote: > > On Tue, Oct 26, 2021 at 3:56 AM Atish Patra wrote: > > > > The commit title is incomplete > Oops. Fixed it. > > > Currently, the predicate function for PMU related CSRs only works if > > virtualizatio

Re: [ PATCH v3 04/10] target/riscv: pmu: Make number of counters configurable

2022-01-05 Thread Atish Patra
On Thu, Nov 4, 2021 at 4:47 AM Bin Meng wrote: > > On Tue, Oct 26, 2021 at 4:41 AM Atish Patra wrote: > > > > The RISC-V privilege specification provides flexibility to implement > > any number of counters from 29 programmable counters. However, the QEMU > &g

Re: [PATCH v4 11/11] hw/riscv: virt: Add PMU DT node to the device tree

2022-01-09 Thread Atish Patra
On Fri, Jan 7, 2022 at 6:46 AM Philippe Mathieu-Daudé 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

Re: [PATCH v4 07/11] target/riscv: Support mcycle/minstret write operation

2022-01-11 Thread Atish Patra
On Sun, Jan 9, 2022 at 11:51 PM Bin Meng wrote: > > On Fri, Jan 7, 2022 at 10:14 AM Atish Patra wrote: > > > > From: Atish Patra > > > > mcycle/minstret are actually WARL registers and can be written with any > > given value. With SBI PMU extension, it will

[PATCH] target/riscv: Add isa extenstion strings to the device tree

2022-02-15 Thread Atish Patra
Append the available ISA extensions to the "riscv,isa" string if it is enabled so that kernel can process it. Signed-off-by: Atish Patra --- target/riscv/cpu.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/r

[PATCH v6] target/riscv: Add isa extenstion strings to the device tree

2022-03-16 Thread Atish Patra
ISA string by appending the available ISA extensions to the "riscv,isa" string if it is enabled so that kernel can process it. [1] https://lkml.org/lkml/2022/2/15/263 Reviewed-by: Anup Patel Reviewed-by: Alistair Francis Suggested-by: Heiko Stubner Signed-off-by: Atish Patra --- Ch

[PATCH v5] target/riscv: Add isa extenstion strings to the device tree

2022-03-14 Thread Atish Patra
ISA string by appending the available ISA extensions to the "riscv,isa" string if it is enabled so that kernel can process it. [1] https://lkml.org/lkml/2022/2/15/263 Reviewed-by: Anup Patel Reviewed-by: Alistair Francis Suggested-by: Heiko Stubner Signed-off-by: Atish Patra --- Changes f

Re: [PATCH v3] target/riscv: Add isa extenstion strings to the device tree

2022-03-08 Thread Atish Patra
rote: >>>> >>>> >>>> >>>> On Sat, Mar 5, 2022 at 10:05 AM Heiko Stuebner wrote: >>>>> >>>>> Hi, >>>>> >>>>> Am Donnerstag, 3. März 2022, 19:58:38 CET schrieb Atish Patra: >>>>&g

Re: [PATCH v3] target/riscv: Add isa extenstion strings to the device tree

2022-03-08 Thread Atish Patra
On Tue, Mar 8, 2022 at 2:53 PM Atish Patra wrote: > > On Sat, Mar 5, 2022 at 10:43 PM Frank Chang wrote: > > > > On Sun, Mar 6, 2022 at 2:12 PM Atish Kumar Patra > > wrote: > >> > >> > >> > >> On Sat, Mar 5, 2022 at 9:36 PM Frank Ch

Re: [PATCH v3] target/riscv: Add isa extenstion strings to the device tree

2022-03-08 Thread Atish Patra
On Sat, Mar 5, 2022 at 10:47 PM Frank Chang wrote: > > Typo in patch title: > s/extenstion/extension/g > Thanks for catching it. Will fix it. > Regards, > Frank Chang > > On Sat, Feb 26, 2022 at 3:45 PM Frank Chang wrote: >> >> >> >> Atish Pa

[PATCH v4] target/riscv: Add isa extenstion strings to the device tree

2022-03-08 Thread Atish Patra
ISA string by appending the available ISA extensions to the "riscv,isa" string if it is enabled so that kernel can process it. [1] https://lkml.org/lkml/2022/2/15/263 Reviewed-by: Anup Patel Reviewed-by: Alistair Francis Suggested-by: Heiko Stubner Signed-off-by: Atish Patra --- Ch

Re: [RFC PATCH 1/3] target/riscv: Rename timer & timecmp to mtimer and mtimecmp

2022-03-08 Thread Atish Patra
On Tue, Mar 8, 2022 at 1:33 PM Alistair Francis wrote: > > On Fri, Mar 4, 2022 at 2:08 PM Anup Patel wrote: > > > > On Fri, Mar 4, 2022 at 8:50 AM Atish Patra wrote: > > > > > > Currently, the aclint and ibex timer devices uses the "timer"

[PATCH v4 3/6] target/riscv: Introduce privilege version field in the CSR ops.

2022-02-22 Thread Atish Patra
, it doesn't enforce the privilege version in this commit. Reviewed-by: Alistair Francis Signed-off-by: Atish Patra --- target/riscv/cpu.h | 2 + target/riscv/csr.c | 103 ++--- 2 files changed, 70 insertions(+), 35 deletions(-) diff --git a/target/riscv

[PATCH v3] target/riscv: Add isa extenstion strings to the device tree

2022-02-22 Thread Atish Patra
ISA string by appending the available ISA extensions to the "riscv,isa" string if it is enabled so that kernel can process it. [1] https://lkml.org/lkml/2022/2/15/263 Suggested-by: Heiko Stubner Signed-off-by: Atish Patra --- Changes from v2->v3: 1. Used g_strconcat to replace snpr

[PATCH v4 0/6] Privilege version update

2022-02-22 Thread Atish Patra
ability. 4. Fixed the compilation error for CONFIG_USER_ONLY 5. Rebased on top of the AIA series. Atish Patra (6): target/riscv: Define simpler privileged spec version numbering target/riscv: Add the privileged spec version 1.12.0 target/riscv: Introduce privilege version field in the CSR ops. target/r

[PATCH v4 6/6] target/riscv: Enable privileged spec version 1.12

2022-02-22 Thread Atish Patra
Signed-off-by: Atish Patra --- target/riscv/cpu.c | 8 +--- target/riscv/csr.c | 5 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 2668f9c358b2..1c72dfffdc61 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -150,7

[PATCH v4 5/6] target/riscv: Add *envcfg* CSRs support

2022-02-22 Thread Atish Patra
The RISC-V privileged specification v1.12 defines few execution environment configuration CSRs that can be used enable/disable extensions per privilege levels. Add the basic support for these CSRs. Signed-off-by: Atish Patra --- target/riscv/cpu.h | 5 ++ target/riscv/cpu_bits.h | 39

Re: [PATCH v2] target/riscv: Add isa extenstion strings to the device tree

2022-02-22 Thread Atish Patra
On Tue, Feb 15, 2022 at 7:19 PM Anup Patel wrote: > > On Wed, Feb 16, 2022 at 5:39 AM Atish Patra wrote: > > > > The Linux kernel parses the ISA extensions from "riscv,isa" DT > > property. It used to parse only the single letter base extensions > > un

[PATCH v4 2/6] target/riscv: Add the privileged spec version 1.12.0

2022-02-22 Thread Atish Patra
Add the definition for ratified privileged specification version v1.12 Reviewed-by: Alistair Francis Signed-off-by: Atish Patra --- target/riscv/cpu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index e5ff4c134c86..60b847141db2 100644

  1   2   3   4   >