Re: Assigning PCI device to device_pd

2016-11-22 Thread Alexander Senier
Hi Alex,

that was the crucial hint. When properly upgrading the quota, config_write 
succeeds, the device gets attached and my scenario works as expected.
You made my day!

Cheers,
Alex

On 22.11.2016 20:28, Alexander Boettcher wrote:
> by calling config_write() successfully ;-). You have to handle the
> Out_of_metadata exception and then the assignment will succeed. Just
> look into the other drivers as this is handled there, e.g.

--
___
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main


Re: Assigning PCI device to device_pd

2016-11-22 Thread Alexander Boettcher
Hi,

On 22.11.2016 00:54, Alexander Senier wrote:
> gets called for 0:2:0. The only place I see where assign_device() is used in 
> the code, is in config_write() when writing PCI_CMD_DMA to
> PCI_CMD_REG. However, when doing such a config_write() manually in my 
> component, I get an Out_of_metadate exception. How can I assign the PCI
> device to my drivers device_pd?

by calling config_write() successfully ;-). You have to handle the
Out_of_metadata exception and then the assignment will succeed. Just
look into the other drivers as this is handled there, e.g.

https://github.com/genodelabs/genode/blob/master/repos/os/src/drivers/ahci/spec/x86/platform.cc#L101

Cheers,

Alex.

-- 
Alexander Boettcher
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth

--
___
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main


Assigning PCI device to device_pd

2016-11-21 Thread Alexander Senier
Hi all,

I'm building a toy driver to experiment with the details of Intel integrated 
graphics. My experiments are based on Genode 16.08 (master) using
NOVA. Getting a capability to the IGD device (0:2:0) from the platform driver 
works, so does reading/writing PCI config space, mapping BAR0 and
accessing MMIO registers.

Next, I want to test DMA from the IGD device by
  1. Allocating DMA memory (via alloc_dma_buffer()) and attaching it to the 
driver address space
  2. Mapping the aperture (BAR2)
  3. Pointing the GTT to the physical address of the DMA memory allocated in 1.
  4. Writing some data to the DMA memory
  5. Reading that data back through the aperture

Unfortunately, I'm stuck with that test. Apparently the IOMMU mappings are not 
set up correctly and NOVA emits respective IOMMU faults:

   [ 0] DMAR:0x81034040 FRR:0 FR:0x5 BDF:0:2:0 FI:0x041d4000

The BDF is the expected IGD device and the fault address matches the physical 
address of the allocated DMA memory (and the PTE set up in the GTT).

When instrumenting device_pd, I see that attach_dma_mem() is called for the 
correct physical address and size. However, assign_device() never
gets called for 0:2:0. The only place I see where assign_device() is used in 
the code, is in config_write() when writing PCI_CMD_DMA to
PCI_CMD_REG. However, when doing such a config_write() manually in my 
component, I get an Out_of_metadate exception. How can I assign the PCI
device to my drivers device_pd?

See [1] for example code.

Thanks a lot!

Cheers,
Alex


[1] https://github.com/senier/gpu_kernel/tree/master/src/app/hello_gpu

--
___
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main