linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Mosberger <davidm@napali.hpl.hp.com>
To: hch@infradead.org, James.Bottomley@SteelEye.com
Cc: davem@redhat.com, axboe@suse.de, linux-kernel@vger.kernel.org
Subject: Re: problem with blk_queue_bounce_limit()
Date: Tue, 10 Jun 2003 13:24:06 -0700	[thread overview]
Message-ID: <16102.15974.597441.186748@napali.hpl.hp.com> (raw)
In-Reply-To: <16097.37454.827982.278024@napali.hpl.hp.com>

Christoph,

You wrote:

 > imo PCI_DMA_BUS_IS_PHYS should be a propert of each struct device
 > because a machine might have a iommu for one bus type but not
 > another, e.g.

 >	dma_is_phys(dev);

As pointed out by DaveM, this isn't sufficient for the block layer,
which needs to know the page size of the I/O MMU so it can make
merging decisions about physically discontiguous buffers.

I think we also need:

	/*
	 * Returns a mask of bits which need to be 0 in order for
	 * the DMA-mapping interface to be able to remap a buffer.
	 * DMA-mapping implementations for real (hardware) I/O MMUs
	 * will want to return (iommu_page_size - 1) here, if they
	 * support such remapping.  DMA-mapping implementations which
	 * do not support remapping must return a mask of all 1s.
	 */
	unsigned long dma_merge_mask(dev)

Then you can replace:

	BIO_VMERGE_BOUNDARY => (dma_merge_mask(dev) + 1)

Of course, this doesn't work literally, because we don't have a device
pointer handy in the bio code.  Instead, it would probably make the
most sense to add a "iommu_merge_mask" member to "struct
request_queue" and then do something along the lines of:

 #define BIO_VMERGE_BOUNDARY(q)	((q)->iommu_merge_mask + 1)

Note 1: the "+ 1" will get optimized away because the only way
BIO_VMERGE_BOUNDARY() is used is in BIOVEC_VIRT_MERGEABLE, which
really needs a mask anyhow; this could be cleaned up of course, but
that's a separate issue.

Note 2: dma_merge_mask() cannot be used to replace dma_is_phys() (as
much as I'd like that), because they issue of (virtual) remapping is
really quite distinct from whether a (hardware) I/O MMU is present
(not to mention the _other_ reason that a bus may not be "physical").

Note 3: I'm not comfortable hacking the bio code, so if someone would
like to prototype this, by all means go ahead... ;-)

Thanks,

	--david

  parent reply	other threads:[~2003-06-10 20:12 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-05  6:42 problem with blk_queue_bounce_limit() David Mosberger
2003-06-05  7:20 ` David S. Miller
2003-06-06  6:42   ` David Mosberger
2003-06-06  6:45     ` David S. Miller
2003-06-06  6:54       ` David Mosberger
2003-06-06  7:08         ` David S. Miller
2003-06-06  6:52     ` David S. Miller
2003-06-06  7:19       ` David Mosberger
2003-06-06  7:32         ` David S. Miller
2003-06-06  7:44           ` Christoph Hellwig
2003-06-06  7:43             ` David S. Miller
2003-06-06  7:51               ` Christoph Hellwig
2003-06-06 20:13           ` David Mosberger
2003-06-07  6:44             ` David S. Miller
2003-06-07  7:05               ` David Mosberger
2003-06-07  7:11                 ` David S. Miller
2003-06-10 20:01                   ` David Mosberger
2003-06-12  6:47                     ` David S. Miller
2003-06-15  7:06                   ` Anton Blanchard
2003-06-15  7:11                     ` David S. Miller
2003-06-15  8:04                       ` Anton Blanchard
2003-06-15  8:18                         ` David S. Miller
2003-06-07  7:20               ` David Mosberger
2003-06-07  7:19                 ` David S. Miller
2003-06-07  9:44                 ` Russell King
2003-06-07  9:47                   ` David S. Miller
2003-06-07 13:23                     ` Christoph Hellwig
2003-06-10 20:24                 ` David Mosberger [this message]
2003-06-06 18:06 James Bottomley

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=16102.15974.597441.186748@napali.hpl.hp.com \
    --to=davidm@napali.hpl.hp.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=axboe@suse.de \
    --cc=davem@redhat.com \
    --cc=davidm@hpl.hp.com \
    --cc=hch@infradead.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;
as well as URLs for NNTP newsgroup(s).