Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Au1550 -  Problem access Shared memory from PCI card
@ 2004-09-16  5:55 Alexey Shinkin
  2004-09-16  7:50 ` Pete Popov
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Shinkin @ 2004-09-16  5:55 UTC (permalink / raw)
  To: linux-mips

Hi All !

Could anybody help me with the following problem:

I have AMD Au1550 MIPS board, running MontaVista Linux 2.4.20-mvl31.1550.
I have also a PCI card , Linux driver for the card and some user-level 
application.
All work fine on x86 platform.

After I recompiled the driver and the application for MIPS platform I got 
the following:
1. The driver on the MIPS board (host) finds the PCI card (target)
2. I download an executable code into target and start target application 
(application starts, debug info is written to target memory).
3. Target starts to communicate with host using shared memory,allocated on 
host, (target accesses the memory through PCI).

After that I get the following problem:

4. Target writes some values into Host's shared memory and generates 
interrupt on Host.
5. Host catches the interrupt and in interrupt handler reads the values, 
written by target.
6. Host writes some replay to the shared memory, generates PCI interrupt on 
Target.
7. Target gets interrupt but can not see the latest values, written by Host. 
Reading the shared memory several times doesn' t help.

Looks like target reads values that are cached somewhere . I tried to insert 
au_sync(), au_sync_delay(), flush_cache_all() on Host side after writting 
values - nothing helps.

On x86 this approach works fine.

What could be the reason? Could this be hardware problem or can be fixed by 
fine-tuning of caching parameters or PCI controller ?

Thank you in advance!

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Au1550 -  Problem access Shared memory from PCI card
  2004-09-16  5:55 Alexey Shinkin
@ 2004-09-16  7:50 ` Pete Popov
  0 siblings, 0 replies; 3+ messages in thread
From: Pete Popov @ 2004-09-16  7:50 UTC (permalink / raw)
  To: Alexey Shinkin; +Cc: linux-mips


>
> After I recompiled the driver and the application for MIPS platform I 
> got the following:
> 1. The driver on the MIPS board (host) finds the PCI card (target)
> 2. I download an executable code into target and start target 
> application (application starts, debug info is written to target memory).
> 3. Target starts to communicate with host using shared 
> memory,allocated on host, (target accesses the memory through PCI).
>
> After that I get the following problem:
>
> 4. Target writes some values into Host's shared memory and generates 
> interrupt on Host.
> 5. Host catches the interrupt and in interrupt handler reads the 
> values, written by target.

So the host at this point reads the correct values written by the target?

> 6. Host writes some replay to the shared memory, generates PCI 
> interrupt on Target.

When you say "host", is this the user application that is writing to the 
shared memory after remmaping it, or is the host driver itself writing 
to the shared memory from kernel space?

> 7. Target gets interrupt but can not see the latest values, written by 
> Host. Reading the shared memory several times doesn' t help.
>
> Looks like target reads values that are cached somewhere . I tried to 
> insert au_sync(), au_sync_delay(), flush_cache_all() on Host side 
> after writting values - nothing helps.

>
> On x86 this approach works fine.
>
> What could be the reason? Could this be hardware problem or can be 
> fixed by fine-tuning 

> of caching parameters or PCI controller ?

There's no reason why this shouldn't work and it doesn't smell like a 
hardware problem.

Pete

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Au1550 - Problem access Shared memory from PCI card
@ 2004-09-16 11:38 Alexey Shinkin
  0 siblings, 0 replies; 3+ messages in thread
From: Alexey Shinkin @ 2004-09-16 11:38 UTC (permalink / raw)
  To: linux-mips


>There's no reason why this shouldn't work and it doesn't smell like a 
>hardware problem.
>


The problem is solved !

The reason was that shared memory on host have been allocated using
__get_free_pages(GFP_KERNEL, get_order(NumberOfBytes))

it returned addresses like 0x8xxxxxxx (KSEG0, cacheable)

I was adviced to use pci_alloc_consistent() instead , this function uses 
__get_free_pages
but sets some GFP flags and returns addresses like 0xAxxxxxxx (KSEG1).
With this function all works fine !

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-09-16 12:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-16 11:38 Au1550 - Problem access Shared memory from PCI card Alexey Shinkin
  -- strict thread matches above, loose matches on Subject: below --
2004-09-16  5:55 Alexey Shinkin
2004-09-16  7:50 ` Pete Popov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox