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

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-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] 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-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 >

[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

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

2020-07-01 Thread Atish Patra
t 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

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

2020-07-01 Thread Atish Patra
continue 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 0/4] Add OpenSBI dynamic firmware support

2020-07-01 Thread Atish Patra
Qemu (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

[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 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.

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

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

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

2020-06-25 Thread Atish Patra
continue 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 +++

[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 2/3] RISC-V: Copy the fdt in dram instead of ROM

2020-06-25 Thread Atish Patra
t 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

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

2020-06-25 Thread Atish Patra
ak the 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

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 all m

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

2020-06-25 Thread Atish Patra
continue 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

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

2020-06-25 Thread Atish Patra
t 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/b

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

2020-06-25 Thread Atish Patra
ak the 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 s

[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 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 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

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 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 > > or

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

2020-06-16 Thread Atish Patra
: 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

[PATCH 0/3] Add OpenSBI dynamic firmware support

2020-06-16 Thread Atish Patra
ak the 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 -

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

2020-06-16 Thread Atish Patra
t 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/

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

2020-06-16 Thread Atish Patra
continue 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

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

2020-06-12 Thread Atish Patra
r (timer and IPI) */ > sifive_clint_create(memmap[SPIKE_CLINT].base, memmap[SPIKE_CLINT].size, > @@ -472,15 +536,39 @@ static void spike_v1_10_0_machine_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(&spike_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 5/5] hw/riscv: virt: Allow creating multiple NUMA sockets

2020-06-12 Thread Atish Patra
@@ static void riscv_virt_board_init(MachineState *machine) >memmap[VIRT_MROM].base + sizeof(reset_vec), > &address_space_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

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 v3 4/4] hw/riscv: virt: Allow creating multiple sockets

2020-05-27 Thread Atish Patra
T_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

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

[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

[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] 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 i

<    1   2   3   4   5