From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Khandelwal, Shubham" Subject: Re: Device pass through on XEN on ARM Date: Wed, 11 Jun 2014 11:16:34 +0200 Message-ID: <3A6586556649FF42BA3240F179473FD114885FF8C1@HIKAWSEX01.ad.harman.com> References: <3A6586556649FF42BA3240F179473FD11454A64270@HIKAWSEX01.ad.harman.com> <53625DC9.7050704@linaro.org> <1398956164.22521.4.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1398956164.22521.4.camel@kazak.uk.xensource.com> Content-Language: en-US List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: 'Ian Campbell' , Julien Grall Cc: "xen-devel@lists.xensource.com" , xen-devel , Arianna Avanzini List-Id: xen-devel@lists.xenproject.org On 05/01/2014 08:26 PM, Ian Campbell wrote: > On Thu, 2014-05-01 at 15:44 +0100, Julien Grall wrote: > > On 04/29/2014 12:35 PM, Khandelwal, Shubham wrote: > > > Hello, > > > > Hello, > > > > I've dropped the xen-arm list as it has been archived few months ago. > > > > > I would like to understand how is pass through achieved on XEN on ARM > > > for devices which do not have a PCI bus controller, like for example > > > embedded devices. Any pointers in this direction will be appreciated. > > > > For the moment, Xen 4.5 doesn't support device passthrough. > > People who are using 4.4 have been hardcoding mmio passthrough for > specific platforms though, essentially by hacking the hypervisor code to > do whatever magic was needed. > > The method is somewhat similar to the platform specific mappings > callback which allows MMIO regions which are undescribed in the DT to be > passed to dom0. xgene_storm_specific_mapping() is probably the best > example. > > Essentially you just need to arrange for map_mmio_region() and > gic_route_irq_to_guest() to be called for the appropriate regions when > constructing the guest domain. Doing this statically for e.g. dom1 is > pretty trivial, just hack some calls in somewhere on the domain create > path with he appropriate checks. > > Allowing this to happen for any domain (useful if you want to reboot the > guest domain) is a bit trickier, I'd probably be inclined to create a > custom domctl and arrange for it to be called during domain build for > the appropriate domain. > > Obviously this is all very hacky and as Julien says there are various > things in the pipeline for 4.5 which will allow this to be done > properly. > > Ian. Hello Ian, Julien, Just to try out the passthrough using the hacks you mentioned, I made changes in xen to assign a GPIO controlled LED to domU by calling map_mmio_regions() in the domain creation path. After domU boots, when I try to access the LED using ioremap, ioread and iowrite from kernel space I see that I am not able to control the LED, also when I try to control LED using sysfs from user space it shows 'no such device' error. I am using xen 4.5 unstable and I have made the following changes in xen/common/domctl.c :: do_domctl(), after line 473: int passthrough = map_mmio_regions(d, 0x4805B000, 0x4805B000 + 0x1000, 0x4805B000); if (passthrough) printk("Failed to map passthrough_LED @ 0x4805B000 to dom%d\n", d->domain_id); While booting domU, in the logs I can see there is no error in map_mmio_regions(). Am I missing something here. Thanks and Regards Shubham Khandelwal