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

Re: MFN on ARM





On 24/08/2020 16:29, luckybreak051779 wrote:
Hi Julien

Hi,

Thanks for getting back to me.

On Mon, Aug 24, 2020 at 11:10 AM Julien Grall <julien@xxxxxxx> wrote:

Hi,

On 24/08/2020 15:23, luckybreak051779 wrote:
Xen Team:

I am running Xen 4.13.0 on a 32-bit ARM processor.  In a domU driver I
use the dma_map_single() function to obtain a DMA address.
How can I get the MFN of that DMA address from inside the domU?

We don't provide a way to find the MFN from a Guest Physical Frame.

  I need
the MFN to be able to differentiate between
two identical domUs running the same driver code (e.g. both calling
dma_map_single() ).
Can you give more details of your setup? Are you trying to use the same
physical device in two domUs?

I have an FPGA that needs to communicate with each domU via buffers
mapped from the dma_map_single() call.  The domU puts the bus address
received from dma_map_single() into a shared memory area in Dom0 that
the FPGA can read.  The problem is that the FPGA tries to use that
address and its not the "real" physical address in memory.  That's why
i'm trying to get the MFN so that I can give the FPGA the "real"
physical address associated with the domU buffer from
dma_map_single().  This code worked fine when it was originally in
dom0.

The approach here will depend on whether you want your DomU to be trusted or not.

If you don't trust your guest, then you want to prevent the physical page to disappear under your feet.

I am assuming you don't have an IOMMU on your platform, so you would want to create a PV driver to interact with the FPGA. The backend (probably residing in Dom0) would be in charge of translating the GFN to an MFN and also ensure the page doesn't disappear while used.

Cheers,

--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.