qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is device_memory in arm64 virt machine?


From: Peter Maydell
Subject: Re: What is device_memory in arm64 virt machine?
Date: Tue, 31 Aug 2021 14:36:56 +0100

On Tue, 31 Aug 2021 at 13:37, <ckim@etri.re.kr> wrote:
> 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?

Your board model needs to put RAM there, and the device tree
you pass the guest needs to tell the guest "don't use that RAM".
(This is exactly like how you tell a guest on real hardware not
to touch some bits of RAM.)

> So the device_memory resides after the ram area.

> At the end of this virt_set_memmap fuction, its size is zero.

Whether the size is zero depends on what options you passed QEMU.

The device-memory area is the space reserved for "memory
devices" to go -- eg if you hotplug a DIMM into the guest then
it will go somewhere in this space.

> Should I add to this ‘device_memory’ for my purpose and let
> the shared library use the area?

No, it is for a completely different purpose.

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]