All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: Nicolas Pitre <nico@cam.org>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: wrong usage of MAX_DMA_ADDRESS in bootmem.h
Date: Wed, 1 Oct 2008 15:06:08 +0100	[thread overview]
Message-ID: <20081001140607.GA22031@flint.arm.linux.org.uk> (raw)
In-Reply-To: <48E3680E.6040703@linux-foundation.org>

On Wed, Oct 01, 2008 at 07:07:42AM -0500, Christoph Lameter wrote:
> Russell King - ARM Linux wrote:
> 
> > Not correct.  MAX_DMA_ADDRESS is a virtual address.  ISA_DMA_THRESHOLD
> > is the last byte of _physical_ memory which ISA DMA can transfer:
> 
> > include/asm-x86/scatterlist.h:#define ISA_DMA_THRESHOLD (0x00ffffff)
> > 
> > So what you've just suggested is completely insane.
> 
> Someone screwed around with the basics here. MAX_DMA_ADDRESS is no longer
> related to MAX_DMA_PFN for the x86_32 case. What is the point of relating
> MAX_DMA_ADDRESS to PAGE_OFFSET? Looks like we are creating more confusion
> about the strange DMA zone.

Because it is a virtual address.  It has to be.  You're using __pa() on it,
and __pa() ONLY takes a virtual address.

> The best would be to rename these variables to make the semantics clearer
> 
> ZONE_DMA related variables:
> 
> MAX_DMA_PFN -> MAX_ZONE_DMA_PFN
> MAX_DMA_ADDRESS -> MAX_ZONE_DMA_ADDRESS
> 
> MAX_DMA32_PFN -> MAX_ZONE_DMA32_PFN
> MAX_DMA32_ADDRESS -> MAX_ZONE_DMA32_ADDRESS
> 
> Then the general DMAability
> 
> MAX_DMA_ADDRESS -> DMA_LIMIT

That's no clearer.  Are they physical addresses?  Or are they virtual
addresses?  Can't guess that from the names.

> > Incorrect.  MAX_DMA_ADDRESS is the highest possible virtual DMA address:
> 
> MAX_DMA_ADDRESS is the highest possible address for the DMA zone. Not the
> highest possible address that any DMA controller can use.

Semantically disagree.

If you only have a controller which can address 1MB of memory (yes, they do
exist) then MAX_DMA_ADDRESS must be PAGE_OFFSET + 1MB, otherwise you have
precisely NO way to obtain memory from the kernel for this DMA controller
- and that means you want the DMA zone to be sized to 1MB.  So _indirectly_
it's true that MAX_DMA_ADDRESS is the highest possible address for the DMA
zone.

  reply	other threads:[~2008-10-01 14:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1222230419-15661-21-git-send-email-nico@cam.org>
     [not found] ` <1222230592-15868-1-git-send-email-nico@cam.org>
     [not found]   ` <20080930162809.GD15911@flint.arm.linux.org.uk>
     [not found]     ` <alpine.LFD.2.00.0809301409230.3635@xanadu.home>
     [not found]       ` <20080930184411.GJ15911@flint.arm.linux.org.uk>
2008-09-30 19:35         ` wrong usage of MAX_DMA_ADDRESS in bootmem.h Nicolas Pitre
2008-09-30 19:56           ` Christoph Lameter
2008-09-30 20:12             ` Russell King - ARM Linux
2008-09-30 21:09               ` Nicolas Pitre
2008-10-01 12:07               ` Christoph Lameter
2008-10-01 14:06                 ` Russell King - ARM Linux [this message]
2008-10-01 14:50                   ` Christoph Lameter
2008-10-01 15:02                     ` Russell King - ARM Linux
2008-10-02 16:49                       ` Christoph Lameter
2008-10-02 19:06                         ` Russell King - ARM Linux

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=20081001140607.GA22031@flint.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=cl@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nico@cam.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.