Subject: Re: iommu hypervisor hypothetical

From: Olof Johansson <[email-masked]>
Date: Wed, 27 Sep 2006 12:07:23 -0500

On Wed, 27 Sep 2006 11:47:51 -0500 John Rose <[email-masked]> wrote:

> Suppose the hypervisor added new failure codes for the hcall that does
> tce_build().  Suppose that the device driver needed to expect such
> failures when alloc_[coherent,consistent] is not successful, and handle
> that case accordingly.
> 
> Is this something we can accommodate without rewriting the iommu stuff
> for various platforms?  All these functions in machdep.h are defined to
> return NULL.  Is this because we haven't had a reasonable expectation of
> failure, or because device drivers _have_ to assume success for such
> operations?

iommu_alloc can already fail. So just change the prototype of tce_build
to return success/failure, and handle it accordingly in iommu_alloc
(DMA_ERROR_CODE). The error should move on up the stack from there.

Or did I misunderstand your question in the first place? It's sort of
sparse on details. :-)

-Olof