Xen Zynq Distribution Support Forums
Mapping physical peripherals through to guests without any dom0 interaction - Printable Version

+- Xen Zynq Distribution Support Forums (http://xzdforums.dornerworks.com)
+-- Forum: General Xilinx Support (http://xzdforums.dornerworks.com/forumdisplay.php?fid=1)
+--- Forum: Public Support (http://xzdforums.dornerworks.com/forumdisplay.php?fid=6)
+--- Thread: Mapping physical peripherals through to guests without any dom0 interaction (/showthread.php?tid=650)



Mapping physical peripherals through to guests without any dom0 interaction - paresh.chaudhary - 02-02-2017

Hi,

I want to isolate dedicated hardware or memory range from a Guest os to the processor peripheral without going through DOM0 on ZYNQ MPSOC.



How it's possible in Xen hypervisor ?


RE: Mapping physical peripherals through to guests without any dom0 interaction - jarvis_roach - 02-02-2017

Paresh,

The quick answer is via a grant request made (ultimately) by a hypercall. The best way to do this will vary depending on your Guest, is it running an actual OS (in which case which one), or are you running a "bare metal" for your guest?

As an embedded developer, my preferred method is to configure the guest to be passed the desired memory ranges on start up. However, this means changing the .cfg file for that guest in dom0's File System, so I'm not sure if that meets your requirement of "without going through DOM0". If that does meet your needs, there's examples of this in our latest distro. Note that if you're also interested in interrupts and/or your dedicated hardware is DMA capable, there are a few more hoops to jump through, you should look at section "9.2 Passthrough" in our User's Manual.


Regards,

-Jarvis


RE: Mapping physical peripherals through to guests without any dom0 interaction - paresh.chaudhary - 02-02-2017

Hi Jarvis,

Thanks for reply.

My Guest os will be Linux or RTOS. I also go through "Pass-through" Section. It's look like Guest os can access peripheral direct without dom0 interaction.

For example: My hardware have one nand device and as a example memory range of nand device is  0x00000000 0x80000000
                   Can i assigned memory for particular guest os like:
                    Guest-OS 0 (Linux) = 0x00000000 (0x20000000 - 0x01)
                    Guest-OS 1 (Linux) = 0x20000000 (0x40000000 - 0x01)
                    Guest-OS 2 (Linux) = 0x40000000 (0x60000000 - 0x01)
                    Guest-OS 3 (Linux) = 0x60000000 (0x80000000 - 0x01)

       As per above scenario  all Guest-OS will directly access nand or it will go through by dom0 and what should i need to do in cfg file.

Can you please give one example ?


RE: Mapping physical peripherals through to guests without any dom0 interaction - jarvis_roach - 02-03-2017

Paresh,

Okay, bad news first, you can only pass the NAND (really the NAND controller module at system address 0xFF110000) through to a single guest; in other words, only one guest can have direct access to the NAND.

The good news is that you should be able to use the split end drivers to share access to the NAND. You may need to make sure the Linux kernels you are using for your guests has XEN_BLKDEV_FRONTEND enabled in the configuration; the dom0 and Dom1-Kernel images we provide in the distribution has that set already. However, by default the backend driver resides in dom0, so technically you are "going through dom0", so I'm not sure if that would be a blocker for you. Can you elaborate on what you mean by that?


-Jarvis


RE: Mapping physical peripherals through to guests without any dom0 interaction - paresh.chaudhary - 02-03-2017

Thanks for reply.

Can i bypss dom0 using passthrough feature for any peripheral , also I would like to know how passthough work in respect to code.

Is there a hardware iommu and mmu doing mapping ?


RE: Mapping physical peripherals through to guests without any dom0 interaction - jarvis_roach - 02-06-2017

I guess it depends on your definition of peripheral. Xen is going to be pretty bossy about managing things like the GIC, MMU, and SMMU, but you should be able to pass through most if not all I/O devices if they have their own registers on their own page of memory (mem mapping is limited to a 4KB page granularity). Things also get complicated if you want to pass a single device that's hanging off a bus like SPI, I2C, or USB.

Yes, there is an IOMMU (called SMMU in ARM lingo) and MMU doing mem translations. There's a blog at http://dornerworks.com/blog/vatranslation which talks about guest memory translations which might be useful to you, and more detailed explanation in the ARMv8 Arch. Reference Manual.