|
From: | ckim |
Subject: | RE: What is device_memory in arm64 virt machine? |
Date: | Tue, 31 Aug 2021 22:11:57 +0900 |
Hello, I forgot to mention that the peripheral register is located at 0x09100000 ~ 09180000, but the functions(in shared library) the peripheral calls accesses the memory in 0x50000000~ 0x60000000. Thanks. Chan Kim From: ckim@etri.re.kr <ckim@etri.re.kr> Hello all, I’m running an linux application and driver on an arm64 machine which is almost the same as arm64 ‘virt’ machine but contains our accelerator peripheral model. The peripheral model just passes the ioctl requests from the driver to the simulator shared library. This application runs ok in baremetal case, but when running as a ubuntu application, the output has many errors.(15%~30%, error occurs in 8 word bursts). My colleague says the accelerator(containing risc-v) doesn’t use cache so I’m guessing ubuntu may be writing something in the area the peripheral puts its output into. Because the output buffer is allocated by the application (contiguous using mmap and hugetlb) and the physical pages are shared by the kernel using get_user_pages, the kernel should not write to the output buffer. But the accelerator shared library uses 0x5000000~0x5fffffff memory as its device memory and the ubuntu kernel doesn’t know about this. How should I set qemu virtual machine so that this range contains ram but the ubuntu kernel doesn’t mess with area? While reading the virt code,(in hw/arm/virt.c virt_set_memmap(), qemu 5.1.0), I found this lines /* * We compute the base of the high IO region depending on the * amount of initial and device memory. The device memory start/size * is aligned on 1GiB. We never put the high IO region below 256GiB * so that if maxram_size is < 255GiB we keep the legacy memory map. * The device region size assumes 1GiB page max alignment per slot. */ device_memory_base = ROUND_UP(vms->memmap[VIRT_MEM].base + ms->ram_size, GiB); device_memory_size = ms->maxram_size - ms->ram_size + ms->ram_slots * GiB; So the device_memory resides after the ram area. At the end of this virt_set_memmap fuction, its size is zero. Should I add to this ‘device_memory’ for my purpose and let the shared library use the area? I’ll be grateful to any comments or suggestion. Thanks! Chan Kim |
[Prev in Thread] | Current Thread | [Next in Thread] |