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

Re: xen4.13 on raspberry4B use Domain U to control GPIO device



On Fri, 3 Sep 2021, Julien Grall wrote:
> On 29/08/2021 15:43, 樊心昊 wrote:
> > Hello everyone:
> >      I'm trying use Domain U to control GPIO,but I can't find a way to
> > share bcm2835-gpiomem or gpiomem for Domain U.
> >      When I had written xl.cfg file, like this
> > 
> >     kernel = "/home/aston/GUEST_Domain/guest_image"
> >     cmdline = "console=hvc0 earlyprintk=xen sync_console root=/dev/xvda"
> >     memory = "256"
> >     name = "rpi4-xen-guest"
> >     vcpus = 1
> >     serial="pty"
> >     disk = [ 'phy:/dev/loop0,xvda,w' ]
> >     vif=[ 'mac=00:11:22:66:88:22,bridge=xenbr0,type=netfront', ] 
> >       device_tree = "/boot/bcm2711-rpi-4-b.dtb"
> > 
> >     dtdev = [ "/soc/gpiomem@7e200000" ]
> > 
> >     iomem = [ "0x7e200000,1@0x1000" ] 
> >     ioports=['0x5'] 
> > It will result in anerror,like this
> > 
> > iomem = [ "0x7e200000,1@0x1000" ]   cause:
> > 
> >     libxl: error: libxl_create.c:1498:domcreate_launch_dm: Domain
> >     1:failed give domain access to iomem range 7e200000-7e200000:
> >     Operation not permitted
> 
> The option 'iomem' takes frame numbers in arguments. If I am not mistaken
> 0x7e200000 is an address, so you would want to use 0x7e200.
> 
> Similar the bits after @ if a guest frame number. Can you confirm you want to
> map at 0x1000000?

Although I have not tested it myself I would try:

iomem = [ "0x7e200,1" ]


> >     (XEN) gnttab_mark_dirty not implemented yet
> > 
> > 
> >   device_tree = "/boot/bcm2711-rpi-4-b.dtb"
> >   dtdev = [ "/soc/gpiomem@7e200000" ]
> > cause
> > 
> >     libxl: error: libxl_create.c:980:libxl__domain_config_setdefault:
> >     passthrough not supported on this platform
> 
> dtdev is used to configure devices protected by an IOMMU. I would be surprised
> if the GPIO is behind an IOMMU. Can you confirm it?
> 
> Note that in this case you need to ensure that you device is not doing any DMA
> (this would be insecure and broken because guest are have a different view of
> the memory).

Yeah, the reason for the error message is that usually Xen requires an
IOMMU (the most common is ARM SMMU) to do device assignment.
Specifically, it is needed for DMA mastering devices. But as Julien
wrote most probably GPIO is not a DMA master, is only a slave device, so
you might be able to assign it without IOMMU.  In that case you can try
to remove the dtdev line and try again.

Note that if it turns out that GPIO is a DMA master and there will be
memory corruptions! 


> > 
> > ioports=['0x5']
> > cause
> > 
> >     libxl: error: libxl_create.c:1467:domcreate_launch_dm: Domain
> >     2:failed give domain access to ioports 5-5: Operation not supported
> The option ioport is an x86 specific option. What are you attempting to do
> with this option?

You shouldn't need any ioports setting, they refer to the ancient x86
I/O ports. There are none on Raspberry Pi.

 


Rackspace

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