Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jan 2012 09:02:18 -0700
From:      Scott Long <scottl@samsco.org>
To:        Andriy Gapon <avg@freebsd.org>
Cc:        FreeBSD current <freebsd-current@freebsd.org>
Subject:   Re: bus dma: a flag/quirk for page zero
Message-ID:  <43B9536E-7AF4-47A8-A556-79BC30125304@samsco.org>
In-Reply-To: <4F0C9D14.60705@FreeBSD.org>
References:  <4F0C9D14.60705@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
An old controller in the aac driver family had a variation of this =
problem back when the FreeBSD contigmalloc algorithm started from the =
bottom of memory instead of the top.  I worked around it at driver init =
time by basically assuring that page 0 (and page 1) were allocated and =
thrown away; it seemed easier to leak 8k of memory than to jump through =
expensive hoops in busdma.

The busdma filter is expensive, and is used so rarely that I'm not even =
sure it works.  It was created for an old SCSI controller that had a =
buggy DMA controller which aliased a repeating pattern of address =
ranges; in other words it was a hack.  It's expensive to use, since it =
forces every bus_dmamap_load() request through the slow path and =
possibly bouncing.

With that said, your idea of a flag is probably a reasonable change for =
now.  Alternatively, the ability to specify multiple DMA exclusion =
ranges has come up in the past, and would be a more complete answer to =
your problem; just treating page0 as special might not be enough (and I =
know for a fact that this is true with old i960RX pci processors).  =
That'll involve an API change, so is something that I'd rather not =
happen on a whim.

Scott

On Jan 10, 2012, at 1:18 PM, Andriy Gapon wrote:

>=20
>=20
> Some hardware interfaces may reserve a special meaning for a =
(physical) memory
> address value of zero.  One example is the OHCI specification where a =
zero value
> in CurrentBufferPointer doesn't mean a physical address, but has a =
reserved
> meaning.  To be honest I don't have another example :) but don't =
preclude its
> existence.
>=20
> To deal with this peculiarity we could use a special flag/quirk that =
would
> instruct the bus dma code to never use the page zero for communication =
with the
> hardware.
> Here's a proof of concept patch that implements the idea:
> http://people.freebsd.org/~avg/usb-dma-pagezero.diff
>=20
> Some concerns:
> - not sure if BUS_DMA_NO_PAGEZERO is the best name for the flag
> - the patch implements the flag only for x86 at the moment
> - usb code uses the flag regardless of the actual controller type
>=20
> What do you think?
>=20
> --=20
> Andriy Gapon
> _______________________________________________
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to =
"freebsd-current-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43B9536E-7AF4-47A8-A556-79BC30125304>