qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Plugin Address Translations Inconsistent/Incorrect?
@ 2021-02-22 17:07 Aaron Lindsay
  2021-02-22 19:30 ` Alex Bennée
  0 siblings, 1 reply; 11+ messages in thread
From: Aaron Lindsay @ 2021-02-22 17:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée, cota, richard.henderson

Hello,

I've been doing some more work with plugins and found something I didn't
expect with regards to address translation.

If I call (inside a memory callback):

`uint64_t pa = qemu_plugin_hwaddr_device_offset(hwaddr);`

I see that `pa` takes the value 0xe0e58760. If, however, I plumb
`cpu_get_phys_page_debug` through to the plugin interface and call it
like:

`pa = cpu_get_phys_page_debug(current_cpu, va);`

I see it takes the value 0x120e58760.

I notice that 0x120e58760-0xe0e58760 is exactly one gigabyte, which is
also the offset of the beginning of RAM for the 'virt' AArch64 machine
I'm using. Furthermore, I see the name of the plugin function includes
"device_offset", so perhaps this discrepancy is by design. However, it
seems awkward to not be able to get a true physical address.

I've done some digging and found that inside `qemu_ram_addr_from_host`
(called by `qemu_plugin_hwaddr_device_offset`), `block->mr->addr`
appears to hold the offset of the beginning of RAM. 

Do you think it would be reasonable to modify
`qemu_plugin_hwaddr_device_offset` to add the beginning of the RAM block
or otherwise return the true physical address (or at least expose a way
to find the beginning of it through the plugin interface)?

Thanks!

-Aaron


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-03-02 21:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-22 17:07 Plugin Address Translations Inconsistent/Incorrect? Aaron Lindsay
2021-02-22 19:30 ` Alex Bennée
2021-02-22 20:08   ` Peter Maydell
2021-02-23  8:52     ` Alex Bennée
2021-02-23 10:55       ` Peter Maydell
2021-02-22 20:48   ` Aaron Lindsay via
2021-02-23 20:53     ` Aaron Lindsay via
2021-03-02 15:33       ` Aaron Lindsay via
2021-03-02 16:06         ` Alex Bennée
2021-03-02 19:41           ` Aaron Lindsay via
2021-03-02 21:04             ` Alex Bennée

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).