public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gerd Knorr <kraxel@bytesex.org>
To: linux-kernel@vger.kernel.org
Subject: Re: Does kmalloc always return address below 4GB?
Date: 5 Mar 2002 17:00:55 GMT	[thread overview]
Message-ID: <slrna89ue7.4at.kraxel@bytesex.org> (raw)
In-Reply-To: <200203051639.IAA05629@adam.yggdrasil.com>

> >Look at other drivers using the DMA interfaces like the two aic7xxx
> >and all of the sym53c8xx drivers, they get it right.
>  
>  	Grepping for vmalloc and kmap in them turns up no hits.

Why do you want to vmalloc() memory in the scsi driver?

>  computer with >4GB of RAM (CONFIG_HIGHEM) talking to a PCI card
>  that only does 32-bit addressing:
>  
>  		pci_set_dma_mask(pcidev, 0xffffffff);
>  		addr = vmalloc(nbytes);
>  		/* On an x86 with >4GB of RAM, addr will be <4GB, but
>  	           __pa(addr) might be >4GB, and the system lacks
>  	           PCI address mapping harware. */

use vmalloc_32(), this one returns lowmem.

>  		dma_addr = pci_map_single(pcidev, addr, nbytes, direction);

This is illegal because addr is a kernel _virtual_ address.  You have to
get the page using vmalloc_to_page() and feed this to pci_map_page()
then.  With nbytes > PAGE_SIZE you probably want to build a scatterlist
and use pci_map_sg().

  Gerd

-- 
#include </dev/tty>

  reply	other threads:[~2002-03-06  7:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-05 16:39 Does kmalloc always return address below 4GB? Adam J. Richter
2002-03-05 17:00 ` Gerd Knorr [this message]
2002-03-06  7:22   ` David S. Miller
2002-03-05 21:57 ` Steffen Persvold
  -- strict thread matches above, loose matches on Subject: below --
2002-03-06  2:28 Adam J. Richter
2002-03-05 17:08 Adam J. Richter
2002-03-06  1:13 ` David S. Miller
2002-03-05 14:43 Adam J. Richter
2002-03-05 15:15 ` David S. Miller
2002-03-05 11:52 Adam J. Richter
2002-03-05 11:59 ` David S. Miller
2002-03-05 11:12 Adam J. Richter
2002-03-05 11:16 ` David S. Miller
2002-03-05 15:43   ` Steffen Persvold
2002-03-05 15:47     ` David S. Miller
2002-03-05 16:44       ` David Mosberger
2002-03-06  1:09         ` David S. Miller
2002-03-06  1:31           ` David Mosberger
2002-03-06  1:52             ` David S. Miller
2002-03-06  2:04               ` David Mosberger

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=slrna89ue7.4at.kraxel@bytesex.org \
    --to=kraxel@bytesex.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox