Skip to content

Commit

Permalink
[do not merge]: QEMU simple example with 4 vCPUs working
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan-Velickovic <[email protected]>
  • Loading branch information
Ivan-Velickovic committed Feb 15, 2025
1 parent aec97ea commit 05bf7d4
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 15 deletions.
141 changes: 128 additions & 13 deletions examples/simple/board/qemu_virt_aarch64/linux.dts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/dts-v1/;

/ {
interrupt-parent = <0x8001>;
interrupt-parent = <0x8005>;
dma-coherent;
model = "linux,dummy-virt";
#size-cells = <0x02>;
#address-cells = <0x02>;
compatible = "linux,dummy-virt";
Expand All @@ -12,37 +14,88 @@
cpu_off = <0x84000002>;
cpu_suspend = <0xc4000001>;
method = "smc";
compatible = "arm,psci-0.2\0arm,psci";
compatible = "arm,psci-1.0", "arm,psci-0.2", "arm,psci";
};

memory@40000000 {
reg = <0x00 0x40000000 0x00 0x80000000>;
device_type = "memory";
};

platform@c000000 {
interrupt-parent = <0x8001>;
platform-bus@c000000 {
interrupt-parent = <0x8005>;
ranges = <0x00 0x00 0xc000000 0x2000000>;
#address-cells = <0x01>;
#size-cells = <0x01>;
compatible = "qemu,platform\0simple-bus";
compatible = "qemu,platform", "simple-bus";
};

fw-cfg@9020000 {
dma-coherent;
reg = <0x00 0x9020000 0x00 0x18>;
compatible = "qemu,fw-cfg-mmio";
};

gpio-keys {
compatible = "gpio-keys";

poweroff {
gpios = <0x8007 0x03 0x00>;
linux,code = <0x74>;
label = "GPIO Key Poweroff";
};
};

pl061@9030000 {
phandle = <0x8007>;
clock-names = "apb_pclk";
clocks = <0x8000>;
interrupts = <0x00 0x07 0x04>;
gpio-controller;
#gpio-cells = <0x02>;
compatible = "arm,pl061", "arm,primecell";
reg = <0x00 0x9030000 0x00 0x1000>;
};

pcie@10000000 {
interrupt-map-mask = <0x1800 0x00 0x00 0x07>;
interrupt-map = <0x00 0x00 0x00 0x01 0x8005 0x00 0x00 0x00 0x03 0x04 0x00 0x00 0x00 0x02 0x8005 0x00 0x00 0x00 0x04 0x04 0x00 0x00 0x00 0x03 0x8005 0x00 0x00 0x00 0x05 0x04 0x00 0x00 0x00 0x04 0x8005 0x00 0x00 0x00 0x06 0x04 0x800 0x00 0x00 0x01 0x8005 0x00 0x00 0x00 0x04 0x04 0x800 0x00 0x00 0x02 0x8005 0x00 0x00 0x00 0x05 0x04 0x800 0x00 0x00 0x03 0x8005 0x00 0x00 0x00 0x06 0x04 0x800 0x00 0x00 0x04 0x8005 0x00 0x00 0x00 0x03 0x04 0x1000 0x00 0x00 0x01 0x8005 0x00 0x00 0x00 0x05 0x04 0x1000 0x00 0x00 0x02 0x8005 0x00 0x00 0x00 0x06 0x04 0x1000 0x00 0x00 0x03 0x8005 0x00 0x00 0x00 0x03 0x04 0x1000 0x00 0x00 0x04 0x8005 0x00 0x00 0x00 0x04 0x04 0x1800 0x00 0x00 0x01 0x8005 0x00 0x00 0x00 0x06 0x04 0x1800 0x00 0x00 0x02 0x8005 0x00 0x00 0x00 0x03 0x04 0x1800 0x00 0x00 0x03 0x8005 0x00 0x00 0x00 0x04 0x04 0x1800 0x00 0x00 0x04 0x8005 0x00 0x00 0x00 0x05 0x04>;
#interrupt-cells = <0x01>;
ranges = <0x1000000 0x00 0x00 0x00 0x3eff0000 0x00 0x10000 0x2000000 0x00 0x10000000 0x00 0x10000000 0x00 0x2eff0000>;
reg = <0x00 0x3f000000 0x00 0x1000000>;
msi-map = <0x00 0x8006 0x00 0x10000>;
dma-coherent;
bus-range = <0x00 0x0f>;
linux,pci-domain = <0x00>;
#size-cells = <0x02>;
#address-cells = <0x03>;
device_type = "pci";
compatible = "pci-host-ecam-generic";
};

pl031@9010000 {
clock-names = "apb_pclk";
clocks = <0x8000>;
interrupts = <0x00 0x02 0x04>;
reg = <0x00 0x9010000 0x00 0x1000>;
compatible = "arm,pl031", "arm,primecell";
};

pl011@9000000 {
clock-names = "uartclk\0apb_pclk";
clock-names = "uartclk", "apb_pclk";
clocks = <0x8000 0x8000>;
interrupts = <0x00 0x01 0x04>;
reg = <0x00 0x9000000 0x00 0x1000>;
compatible = "arm,pl011\0arm,primecell";
compatible = "arm,pl011", "arm,primecell";
};

pmu {
interrupts = <0x01 0x07 0x104>;
interrupts = <0x01 0x07 0xf04>;
compatible = "arm,armv8-pmuv3";
};

intc@8000000 {
phandle = <0x8001>;
phandle = <0x8005>;
interrupts = <0x01 0x09 0x04>;
reg = <0x00 0x8000000 0x00 0x10000 0x00 0x8010000 0x00 0x10000 0x00 0x8030000 0x00 0x10000 0x00 0x8040000 0x00 0x10000>;
compatible = "arm,cortex-a15-gic";
Expand All @@ -51,6 +104,13 @@
#address-cells = <0x02>;
interrupt-controller;
#interrupt-cells = <0x03>;

v2m@8020000 {
phandle = <0x8006>;
reg = <0x00 0x8020000 0x00 0x1000>;
msi-controller;
compatible = "arm,gic-v2m-frame";
};
};

flash@0 {
Expand All @@ -63,17 +123,68 @@
#size-cells = <0x00>;
#address-cells = <0x01>;

cpu-map {

socket0 {

cluster0 {

core0 {
cpu = <0x8004>;
};

core1 {
cpu = <0x8003>;
};

core2 {
cpu = <0x8002>;
};

core3 {
cpu = <0x8001>;
};
};
};
};

cpu@0 {
phandle = <0x8004>;
reg = <0x00>;
enable-method = "psci";
compatible = "arm,cortex-a53";
device_type = "cpu";
};

cpu@1 {
phandle = <0x8003>;
reg = <0x01>;
enable-method = "psci";
compatible = "arm,cortex-a53";
device_type = "cpu";
};

cpu@2 {
phandle = <0x8002>;
reg = <0x02>;
enable-method = "psci";
compatible = "arm,cortex-a53";
device_type = "cpu";
};

cpu@3 {
phandle = <0x8001>;
reg = <0x03>;
enable-method = "psci";
compatible = "arm,cortex-a53";
device_type = "cpu";
};
};

timer {
interrupts = <0x01 0x0d 0x104 0x01 0x0e 0x104 0x01 0x0b 0x104 0x01 0x0a 0x104>;
interrupts = <0x01 0x0d 0xf04 0x01 0x0e 0xf04 0x01 0x0b 0xf04 0x01 0x0a 0xf04>;
always-on;
compatible = "arm,armv8-timer\0arm,armv7-timer";
compatible = "arm,armv8-timer", "arm,armv7-timer";
};

apb-pclk {
Expand All @@ -84,9 +195,13 @@
compatible = "fixed-clock";
};

aliases {
serial0 = "/pl011@9000000";
};

chosen {
stdout-path = "/pl011@9000000";
rng-seed = <0x8f0ee46 0xecbe7263 0xc724a577 0x271cf683 0xdd190daf 0x103bff62 0x5f2496fb 0xee0cf760>;
kaslr-seed = <0x198a65b3 0x8b3cef37>;
rng-seed = <0x9a1c0047 0x67748ef 0x3e452793 0x6625cc14 0xf7a37ac0 0xa5b9914d 0x5ba40d1c 0x66d23e0f>;
kaslr-seed = <0x52da3684 0xdf4618b7>;
};
};
16 changes: 16 additions & 0 deletions examples/simple/board/qemu_virt_aarch64/overlay.dts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,26 @@
reg = <0x00 0x40000000 0x00 0x10000000>;
};

intc@8000000 {
/delete-node/ v2m@8020000;
};

flash@0 {
status = "disabled";
};

pl061@9030000 {
status = "disabled";
};

pl031@9010000 {
status = "disabled";
};

pcie@10000000 {
status = "disabled";
};

chosen {
stdout-path = "/pl011@9000000";
bootargs = "earlycon=pl011,0x9000000 earlyprintk=serial debug loglevel=8";
Expand Down
5 changes: 4 additions & 1 deletion examples/simple/board/qemu_virt_aarch64/simple.system
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
-->
<map mr="guest_ram" vaddr="0x40000000" perms="rw" setvar_vaddr="guest_ram_vaddr" />
<virtual_machine name="linux" >
<vcpu id="0" />
<vcpu id="0" cpu="0" />
<vcpu id="1" cpu="1" />
<vcpu id="2" cpu="2" />
<vcpu id="3" cpu="3" />
<!--
The device tree given to Linux specifies that RAM will start
at 0x40000000.
Expand Down
1 change: 1 addition & 0 deletions examples/simple/simple.mk
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ qemu: $(IMAGE_FILE)
if ! command -v $(QEMU) > /dev/null 2>&1; then echo "Could not find dependency: qemu-system-aarch64"; exit 1; fi
$(QEMU) -machine virt,virtualization=on,highmem=off,secure=off \
-cpu cortex-a53 \
-smp 4 \
-serial mon:stdio \
-device loader,file=$(IMAGE_FILE),addr=0x70000000,cpu-num=0 \
-m size=2G \
Expand Down
2 changes: 1 addition & 1 deletion include/libvmm/util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define GUEST_BOOT_VCPU_ID 0

#ifndef GUEST_NUM_VCPUS
#define GUEST_NUM_VCPUS 1
#define GUEST_NUM_VCPUS 4
#endif

#define PAGE_SIZE_MIN 0x1000
Expand Down

0 comments on commit 05bf7d4

Please sign in to comment.