iommu hypervisor hypothetical
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?
Thanks-
John
Quoted 10 lines · On Wed, 27 Sep 2006 11:47:51 -0500 John Rose <[email protected]> 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.hare 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
Quoted 3 lines
So just change the prototype of
tce_build
to return success/failure, and handle it accordingly iniommu_alloc(DMA_ERROR_CODE). The error should move on up the stack from there.
I'm thinking of functions like dma_map_single(), which returns the unsigned type dma_addr_t. Suppose H_HCE_PUT fails, and this gets propagated up to the device driver through DMA_ERROR_CODE. The PAPR currently defines 2 ways in which this could fail, and we're considering at least one more. One error code doesn't seem sufficient.
Quoted 2 lines
Or did I misunderstand your question in the first place? It's sort of sparse on details. :-)
You know how it goes :) I guess my question is whether passing specific failure conditions up the call chain is permissible/feasible, and whether the prototypes for the various device driver DMA utilities are set in stone.
Thanks-
John
Quoted 9 lines · On Wed, 27 Sep 2006 13:25:57 -0500 John Rose <[email protected]> wrote:
Quoted 3 lines
So just change the prototype of
tce_build
to return success/failure, and handle it accordingly iniommu_alloc(DMA_ERROR_CODE). The error should move on up the stack from there.I'm thinking of functions like
dma_map_single(), which returns the unsigned typedma_addr_t. SupposeH_HCE_PUTfails, and this gets propagated up to the device driver throughDMA_ERROR_CODE. The PAPR currently defines 2 ways in which this could fail, and we're considering at least one more. One error code doesn't seem sufficient.
So you need to know in the driver why it failed, to take separate actions based on why? Driver/device events aren't communicated in any other manner?
Quoted 7 lines
Quoted 2 lines
Or did I misunderstand your question in the first place? It's sort of sparse on details. :-)
You know how it goes :) I guess my question is whether passing specific failure conditions up the call chain is permissible/feasible, and whether the prototypes for the various device driver DMA utilities are set in stone.
You could expand to other DMA_ERROR_.* codes, as long as you modify dma_mapping_error accordingly.
-Olof
Quoted 9 lines · John Rose
Quoted 3 lines
So just change the prototype of
tce_build
to return success/failure, and handle it accordingly iniommu_alloc(DMA_ERROR_CODE). The error should move on up the stack from there.I'm thinking of functions like
dma_map_single(), which returns the unsigned typedma_addr_t. SupposeH_HCE_PUTfails, and this gets propagated up to the device driver throughDMA_ERROR_CODE. The PAPR currently defines 2 ways in which this could fail, and we're considering at least one more. One error code doesn't seem sufficient.
That's a design issue with the linux API that has been around for some time. At first, there was no possible error return from dma_map_single() in fact :( DMA_ERROR_CODE was added, and I see no way to do something better from that function...
Quoted 10 lines
Quoted 2 lines
Or did I misunderstand your question in the first place? It's sort of sparse on details. :-)
You know how it goes :) I guess my question is whether passing specific failure conditions up the call chain is permissible/feasible, and whether the prototypes for the various device driver DMA utilities are set in stone.
Thanks-
John