lkml.org 
[lkml]   [2008]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 1/9] x86/iommu: add necessary types for stackable dma_ops
    Date
    This patch extends the x86 dma_ops structure so that we can queue it
    into a list. It also adds a device_supported callback. It can be used to
    find out if a registered dma_ops implementation can handle a given
    device. Further it adds an enum with dma_ops implementation types
    possible in the future.

    Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
    ---
    include/asm-x86/dma-mapping.h | 26 ++++++++++++++++++++++++++
    1 files changed, 26 insertions(+), 0 deletions(-)

    diff --git a/include/asm-x86/dma-mapping.h b/include/asm-x86/dma-mapping.h
    index f408e6d..59d1101 100644
    --- a/include/asm-x86/dma-mapping.h
    +++ b/include/asm-x86/dma-mapping.h
    @@ -17,6 +17,8 @@ extern struct device x86_dma_fallback_dev;
    extern int panic_on_overflow;

    struct dma_mapping_ops {
    + struct list_head list; /* for stacking dma_ops */
    +
    int (*mapping_error)(struct device *dev,
    dma_addr_t dma_addr);
    void* (*alloc_coherent)(struct device *dev, size_t size,
    @@ -51,9 +53,33 @@ struct dma_mapping_ops {
    struct scatterlist *sg, int nents,
    int direction);
    int (*dma_supported)(struct device *hwdev, u64 mask);
    + int (*device_supported)(struct device *hwdev);
    int is_phys;
    };

    +/*
    + * This are the supported types of dma_ops implementations on x86. The
    + * different types mean different priority:
    + *
    + * DMA_OPS_TYPE_PV - paravirtualized dma_ops implementation
    + * DMA_OPS_TYPE_HW - dma_ops implementation using some kind of hardware
    + * support
    + * DMA_OPS_TYPE_SOFT - a software only dma_ops implementation
    + *
    + * When a device issues its first request to the DMA layer the available
    + * implementations are asked if they support the device by calling the specific
    + * dma_supported callback. The implementations are checked in order, first the
    + * DMA_OPS_TYPE_PV, then the DMA_OPS_TYPE_HW and at the end the
    + * DMA_OPS_TYPE_SOFT implementations. Within the implementation types they are
    + * called in registration order.
    + */
    +enum dma_ops_driver_type {
    + DMA_OPS_TYPE_PV,
    + DMA_OPS_TYPE_HW,
    + DMA_OPS_TYPE_SOFT,
    + DMA_OPS_TYPE_MAX,
    +};
    +
    extern struct dma_mapping_ops *dma_ops;

    static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
    --
    1.5.6.4



    \
     
     \ /
      Last update: 2008-09-22 20:27    [W:0.024 / U:30.760 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site