All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wayne Gowcher <wgowcher@yahoo.com>
To: Linux-MIPS <linux-mips@linux-mips.org>
Subject: pci_alloc_consistent usage
Date: Fri, 23 May 2003 14:59:35 -0700 (PDT)	[thread overview]
Message-ID: <20030523215935.71373.qmail@web11901.mail.yahoo.com> (raw)

I am working on a driver that uses PCI DMA transfers
from system memory to the PCI device. On the 2.4.18
kernel it worked OK, but now when it is recompiled for
2.4.20 it doesn't. Digging into things I have found
that the function virt_to_phys() has been changed from
:
return PHYSADDR(address)

to
return (unsigned long)address - PAGE_OFFSET

Where PAGE_OFFSET is 0x8000 0000, and where PHYSADDR
would AND the address against 0x1FFF FFFF. As far as I
can tell the problem comes from pci_alloc_consistent
doing :

ret = UNCAC_ADDR(ret) 

which converts a 0x8xxx address to 0xAxxx, and then
when you pass this 0xAxxx_xxxx address through
virt_to_phys() you get an address of the form
0x2xxx_xxxx. This 0x2xxx_xxxx is passed to the dma
controller as the physical address to where it must
read / write data, and because it is 0x2xxx_xxxx and
not 0x0xxx_xxxx an exception occurs.

At first I just tried AND'ing out the 0xA.. like
PHYSADDR used to do it, but with that change i no
longer get the exception, but the driver does not dma
the data across - it just sits there.

I read DMA-mapping.txt and it says virt_to_phys() will
be phased out, and should be used, but doesn't
elaborate any further (like how you should do it now
).

So after that long intro, my question is :

Anybody know where I'm going wrong and how to fix
things ?

Also any tips on what drivers to look at for good
examples would also be appreciated.

TIA


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

             reply	other threads:[~2003-05-23 21:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-23 21:59 Wayne Gowcher [this message]
2003-05-27  9:17 ` pci_alloc_consistent usage Ralf Baechle
2003-05-27 10:07   ` Atsushi Nemoto
2003-05-27 10:53     ` Christoph Hellwig
2003-05-27 11:22       ` Ralf Baechle
2003-05-27 11:33         ` Christoph Hellwig
2003-05-27 11:45           ` Ralf Baechle
2003-05-28  1:30         ` Atsushi Nemoto
  -- strict thread matches above, loose matches on Subject: below --
2004-07-13 13:01 pci_alloc_consistent() usage Vadivelan Mani
2004-07-13 19:29 ` Ralf Baechle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030523215935.71373.qmail@web11901.mail.yahoo.com \
    --to=wgowcher@yahoo.com \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.