diff --git a/.gitignore b/.gitignore index 60d48244ab195f4966c9b96a22df9591bb8e3674..fdad44429c9d8b5ce8c53bdf924538885bb715e8 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,4 @@ todo # ignore Image zvm_config/qemu_platform/hub/* +qemu.pid diff --git a/auto_zvm.sh b/auto_zvm.sh index 16a8cc52fd64645f3950c81670cb928ad219c7b5..c1c5b1b7195fdf303546ddf936b47018e147445a 100755 --- a/auto_zvm.sh +++ b/auto_zvm.sh @@ -3,8 +3,8 @@ OPS=$1 PLAT=$2 -ops_array=("build" "debugserver") -plat_array=("qemu_cortex_max_smp" "fvp_cortex_a55x4_a75x2_smp" "roc_rk3568_pc_smp") +ops_array=("build" "debug") +plat_array=("qemu" "fvp_cortex_a55x4_a75x2_smp" "roc_rk3568_pc_smp") ops_found=false for i in "${ops_array[@]}" @@ -66,7 +66,7 @@ elif [ "$OPS" = "${ops_array[1]}" ]; then -device loader,file=$(pwd)/zvm_config/qemu_platform/hub/zephyr.bin,addr=0xc8000000,force-raw=on \ -device loader,file=$(pwd)/zvm_config/qemu_platform/hub/Image,addr=0xf0000000,force-raw=on \ -device loader,file=$(pwd)/zvm_config/qemu_platform/hub/Image,addr=0xd8000000,force-raw=on \ - -device loader,file=$(pwd)/zvm_config/qemu_platform/hub/linux-qemu-virt.dtb,addr=0xd0000000 \ + -device loader,file=$(pwd)/zvm_config/qemu_platform/hub/linux-qemu-virtio.dtb,addr=0xd0000000 \ -kernel $(pwd)/build/zephyr/zvm_host.elf ### using gdb to connect it: # gdb-multiarch -q -ex 'file ./build/zephyr/zvm_host.elf' -ex 'target remote localhost:1234' diff --git a/samples/_zvm/boards/qemu_cortex_max_smp.conf b/samples/_zvm/boards/qemu_cortex_max_smp.conf index 480796957fe52bc840d8e121e3133bf3faab8323..e42d10d93ba05d91ed154cec56a73ccf83887257 100644 --- a/samples/_zvm/boards/qemu_cortex_max_smp.conf +++ b/samples/_zvm/boards/qemu_cortex_max_smp.conf @@ -12,9 +12,9 @@ CONFIG_KERNEL_VM_SIZE=0xC0000000 CONFIG_UART_PL011_PORT1=n # pci controller -CONFIG_PCIE=y -CONFIG_PCIE_CONTROLLER=y -CONFIG_PCIE_ECAM=y +# CONFIG_PCIE=y +# CONFIG_PCIE_CONTROLLER=y +# CONFIG_PCIE_ECAM=y # vgic device. CONFIG_VM_VGICV3=y diff --git a/samples/_zvm/boards/qemu_cortex_max_smp.overlay b/samples/_zvm/boards/qemu_cortex_max_smp.overlay index 920395639f4e88b1866284ecebf8ed0e02b0d663..5c130314a0ce16194121a64168f83107036dc781 100644 --- a/samples/_zvm/boards/qemu_cortex_max_smp.overlay +++ b/samples/_zvm/boards/qemu_cortex_max_smp.overlay @@ -13,6 +13,7 @@ /*Passthrough device.*/ ptdevice1 = "/soc/pass_through_device/uart@9001000"; ptdevice2 = "/soc/pass_through_device/uart@9002000"; + ptdevice3 = "/soc/pass_through_device/pcie@10000000"; }; chosen { @@ -67,6 +68,37 @@ label = "UART_1"; }; + pcie@10000000 { + compatible = "pci-host-ecam-generic"; + 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 0x10000000>, + <0x3000000 0x00 0x20000000 0x00 0x20000000 0x00 0x1eff0000>; + reg = <0x40 0x10000000 0x00 0x10000000>; + msi-parent = <&gic_ist>; + bus-range = <0x00 0xff>; + #size-cells = <0x02>; + #address-cells = <0x03>; + device_type = "pci"; + }; + uart2: uart@9002000 { compatible = "arm,pl011"; reg = <0x00 0x09002000 0x00 0x1000>; diff --git a/samples/_zvm/prj.conf b/samples/_zvm/prj.conf index fc7af70078115d869dacf9c028a967b67f9805d0..2a37f488bf3c35dfee06ca5544a62ca9a3c5c398 100644 --- a/samples/_zvm/prj.conf +++ b/samples/_zvm/prj.conf @@ -88,3 +88,7 @@ CONFIG_DISK_RAM_VOLUME_SIZE=192 CONFIG_MINIMAL_LIBC_RAND=y CONFIG_DYNAMIC_INTERRUPTS=y + +# #virt IO config +# CONFIG_VIRTIO=y +# CONFIG_VIRTIO_MMIO=y diff --git a/subsys/virtualization/vdev/pt_device_qemu_cortex_max.c b/subsys/virtualization/vdev/pt_device_qemu_cortex_max.c index 54dd5c0d2ffd6757db78aec671d7618bb4486bbc..265a0bcece799fd785eb829dd26c16d44391f124 100644 --- a/subsys/virtualization/vdev/pt_device_qemu_cortex_max.c +++ b/subsys/virtualization/vdev/pt_device_qemu_cortex_max.c @@ -87,6 +87,43 @@ static const struct virt_device_api virt_ptdevice_api = { /*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/ +/*---------------------Date for each pt device---------------------------*/ + +// static void ptdevice_irq_config_func_3(const struct device *dev) +// { +// IRQ_CONNECT(DT_IRQN(DT_ALIAS(ptdevice3)), +// DT_IRQ(DT_ALIAS(ptdevice3), priority), +// pass_through_device_isr, +// DEVICE_DT_GET(DT_ALIAS(ptdevice3)), +// 0); +// irq_enable(DT_IRQN(DT_ALIAS(ptdevice3))); +// } +/*irq exist? if not, set function NULL.*/ +static struct pass_through_device_config ptdevice_cfg_port_3 = { + .irq_config_func = NULL, + .ptdev_spec_init_func = NULL, + .ptdev_spec_irq_func = NULL, +}; + +static struct virt_device_config virt_ptdevice_cfg_3 = { + .reg_base = DT_REG_ADDR(DT_ALIAS(ptdevice3)), + .reg_size = DT_REG_SIZE(DT_ALIAS(ptdevice3)), + .hirq_num = 0, + .device_config = &ptdevice_cfg_port_3, +}; + +static struct virt_device_data virt_ptdevice_data_port_3 = { + .device_data = NULL, +}; + +DEVICE_DT_DEFINE(DT_ALIAS(ptdevice3), + &pass_through_device_init, + NULL, &virt_ptdevice_data_port_3, &virt_ptdevice_cfg_3, + POST_KERNEL, + CONFIG_SERIAL_INIT_PRIORITY, + &virt_ptdevice_api); +/*------------------------cut line---------------------------------------*/ + /*---------------------Date for each pt device---------------------------*/ /*irq exist? set this configuration.*/ static void ptdevice_irq_config_func_2(const struct device *dev) @@ -112,6 +149,7 @@ static struct virt_device_config virt_ptdevice_cfg_2 = { .device_config = &ptdevice_cfg_port_2, }; + static struct virt_device_data virt_ptdevice_data_port_2 = { .device_data = NULL, };