All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <roland@topspin.com>
To: fc scsi <scsi_fc_group@yahoo.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: _PAGE_PCD bit in DMAable memory
Date: 16 May 2004 19:20:14 -0700	[thread overview]
Message-ID: <52r7tjx09t.fsf@topspin.com> (raw)
In-Reply-To: <20040517011257.86012.qmail@web50003.mail.yahoo.com>

    fc> Hi, I am trying to get DMAable memory on i386
    fc> (kmalloc(GFP_DMA,)) but seems _PAGE_PCD is not set on the
    fc> pages that i get back the memory from. Am I getting the
    fc> correct results? If yes, then is it not that GFP_DMA should
    fc> give me non-cacheable memory (equivalent to setting _PAGE_PCD
    fc> along with _PAGE_PWT on i386). Can anyone confirm for me that
    fc> GFP_DMA will *always* give me non-cacheable and contiguous
    fc> memory.

On i386, the GFP_DMA flag controls _where_ the memory will be
allocated, namely in the low 16 MB.  This is really a relic of the
days of 24-bit ISA DMA.

On i386, the memory does not have to be non-cacheable, since in the PC
architecture the bus controller will maintain consistency by snooping
the CPU.  However, to be portable, your code should use
pci_alloc_consistent() to get memory for DMAing.  This will do the
right thing on all platforms, including making sure that the memory is
non-cacheable on architectures where the bus controller does not snoop.

(By the way, kmalloc() will always return contiguous memory, but you
should still use pci_alloc_consistent for DMA memory)

 - Roland

  reply	other threads:[~2004-05-17  2:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-17  1:12 _PAGE_PCD bit in DMAable memory fc scsi
2004-05-17  2:20 ` Roland Dreier [this message]
2004-05-17 15:48   ` fc scsi
     [not found] <20040518190319.95305.qmail@web50004.mail.yahoo.com>
2004-05-18 20:29 ` Ingo Oeser

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=52r7tjx09t.fsf@topspin.com \
    --to=roland@topspin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=scsi_fc_group@yahoo.com \
    /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.