sun4v_data_access_exception during access to hardware
From: Alex Mach <[email protected]>
Date: Thu, 13 May 2010 14:18:58 +0400
Quoted 5 lines
Hello,
I'd like use ethoc driver for OpenCores MAC under Linux (2.6.33). I'm using OpenSparc T1 on FPGA. I have hardware device (OpenCores MAC) at address
0xFFF0C2C100. So I added device to platform bus withIORESOURCE_MEM(io memory space) at0xFFF0C2C100.
devm_ioremap_nocache()return OK but during ethoc driver initialization I have following messages:
It's trying to call the dma_*() APIs with a NULL pointer.
That isn't supported.
From: David Miller <[email protected]>
Date: Thu, 13 May 2010 04:25:52 -0700 (PDT)
Quoted 5 lines
From: Alex Mach <[email protected]>
Date: Thu, 13 May 2010 14:18:58 +0400Quoted 2 lines
Hello,
Quoted 7 lines
Quoted 3 lines
I'd like use ethoc driver for OpenCores MAC under Linux (2.6.33). I'm using OpenSparc T1 on FPGA. I have hardware device (OpenCores MAC) at address
0xFFF0C2C100. So I added device to platform bus withIORESOURCE_MEM(io memory space) at0xFFF0C2C100.
devm_ioremap_nocache()return OK but during ethoc driver initialization I have following messages:It's trying to call the dma_*() APIs with a NULL pointer.
That isn't supported.
And even if we made that work, this driver assumes that it can run virt_to_phys() on pointers returned from both with DMA allocation and ioremap().
This driver is terribly non-portable and needs some work before you'll be able to use it on sparc64.
From: Alex Mach <[email protected]>
Date: Thu, 13 May 2010 15:38:37 +0400
Quoted 9 lines
Quoted 4 lines
It's trying to call the dma_*() APIs with a NULL pointer.
That isn't supported.
If I use buffer memory with dma access I have messages
[ 28.164095] Unable to handle kernel NULL pointer dereference
The device doesn't have the proper backing information for the DMA layer on sparc64 requires, it needs an IOMMU struct pointer and other bits in the arch level device area setup properly. And for non-PCI devices this isn't going to happen.
This isn't going to get fixed by simple changes, I'm sorry to inform you :-)
From: Alex Mach <[email protected]>
Date: Thu, 13 May 2010 17:56:01 +0400
Quoted 2 lines
The problem happens when
ethoc_read()callioread32()with phys addr0xFFF0C2C100.
That means there is nothing responding at that physical address.
From: Alex Mach <[email protected]>
Date: Mon, 17 May 2010 17:26:18 +0400
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
The problem happens when
ethoc_read()callioread32()with phys addr0xFFF0C2C100.That means there is nothing responding at that physical address.
Quoted 7 lines
I need some help. If I want to have access to IO device I need to do following:
1. Get permission from hypervisor about using the phys addr;
2. Convert phys addr to real addr;
2. Initialize TSB by this real addr.It's right? Which APIs should I use for these actions?
You're likely need to make hypervisor changes to make this work.
There are no APIs for privileged level code to ask the hypervisor to just do these things. If it did, the hypervisor would be useless, it's there exactly to protect the system from privileged code accessing arbitrary physical and I/O memory.
What probably is the easiest way is to make sure the OpenFirmware device tree has a proper nodes and mappings for your device.
Quoted 3 lines
This driver is terribly non-portable and needs some work before you'll be able to use it on sparc64.
Could you call any driver that was succesfully ported on Sparc and which use access to physical IO space, please?
Thanks,
Alex.
From: "Alex Mach" <[email protected]>
Date: Tue, 18 May 2010 17:41:06 +0400
Quoted 6 lines
Quoted 3 lines
This driver is terribly non-portable and needs some work before you'll be able to use it on sparc64.
Could you call any driver that was succesfully ported on Sparc and which use access to physical IO space, please?
Only drivers/net/niu.c does, it does the physical address handling by hand.
You can't use the DMA interfaces because dma_addr_t is 32-bits and there is no reason to bloat up the kernel by making it 64-bits just for one or two drivers that want to work with real physical addresses instead of DMA addresses.
From: Alex Mach <[email protected]>
Date: Tue, 18 May 2010 16:43:40 +0400
Quoted 6 lines
Sure it should not always grant a requested access, it should lock the address ranges used by guest systems and so prevent granting access to other systems to the locked addresses. Isn't it? I just find strange if adding a device that uses physical IO space (any non-PnP ISA card for example) will result in pathching the OpenFirmware.
I/O space is protected as well, because it is also valid and common to make certain I/O devices only accessible to certain guests in the system.
In fact, the PCI host controller's registers aren't accesible at all by any guest, it is only accessible by the hypervisor itself. Even programming DMA mappings into the IOMMU has to go through hypervisor calls.
Quoted 3 lines
Only
drivers/net/niu.cdoes, it does the physical address handling by hand.
I'd like try to modify ethoc driver according to niu driver. As I understand I've to add some device node(let's call it by Ethoc f.e) to OBP device tree as you wrote in one of previous mail. So could you get example of the node for niu device, please?
Thanks,
Alex.
From: "Alex Mach" <[email protected]>
Date: Wed, 19 May 2010 12:53:22 +0400
Quoted 8 lines
Quoted 3 lines
Only
drivers/net/niu.cdoes, it does the physical address handling by hand.I'd like try to modify ethoc driver according to niu driver. As I understand I've to add some device node(let's call it by Ethoc f.e) to OBP device tree as you wrote in one of previous mail. So could you get example of the node for niu device, please?
There is nothing special about the NIU device node, it looks like just any other node in the openfirmware tree for a device.
It merely follows the rules specified by the OpenFirmware specification for device nodes in that it has a 'name', 'reg', etc. properties.
What's important in your case is that the code in arch/sparc/kerne/of_device{,_64}.c and arch/sparc/kernel/prom{,_64}.c builds a correct device node that can be probed and used in a driver based upon the information contained in those fields.