cregit-Linux how code gets into the kernel

Release 4.14 arch/ia64/hp/common/hwsw_iommu.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
 *   Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
 *
 * This is a pseudo I/O MMU which dispatches to the hardware I/O MMU
 * whenever possible.  We assume that the hardware I/O MMU requires
 * full 32-bit addressability, as is the case, e.g., for HP zx1-based
 * systems (there, the I/O MMU window is mapped at 3-4GB).  If a
 * device doesn't provide full 32-bit addressability, we fall back on
 * the sw I/O TLB.  This is good enough to let us support broken
 * hardware such as soundcards which have a DMA engine that can
 * address only 28 bits.
 */

#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/swiotlb.h>
#include <linux/export.h>
#include <asm/machvec.h>

extern const struct dma_map_ops sba_dma_ops, swiotlb_dma_ops;

/* swiotlb declarations & definitions: */
extern int swiotlb_late_init_with_default_size (size_t size);

/*
 * Note: we need to make the determination of whether or not to use
 * the sw I/O TLB based purely on the device structure.  Anything else
 * would be unreliable or would be too intrusive.
 */

static inline int use_swiotlb(struct device *dev) { return dev && dev->dma_mask && !sba_dma_ops.dma_supported(dev, *dev->dma_mask); }

Contributors

PersonTokensPropCommitsCommitProp
David Mosberger-Tang2990.62%133.33%
FUJITA Tomonori39.38%266.67%
Total32100.00%3100.00%


const struct dma_map_ops *hwsw_dma_get_ops(struct device *dev) { if (use_swiotlb(dev)) return &swiotlb_dma_ops; return &sba_dma_ops; }

Contributors

PersonTokensPropCommitsCommitProp
FUJITA Tomonori2796.43%375.00%
Bart Van Assche13.57%125.00%
Total28100.00%4100.00%

EXPORT_SYMBOL(hwsw_dma_get_ops);
void __init hwsw_init (void) { /* default to a smallish 2MB sw I/O TLB */ if (swiotlb_late_init_with_default_size (2 * (1<<20)) != 0) { #ifdef CONFIG_IA64_GENERIC /* Better to have normal DMA than panic */ printk(KERN_WARNING "%s: Failed to initialize software I/O TLB," " reverting to hpzx1 platform vector\n", __func__); machvec_init("hpzx1"); #else panic("Unable to initialize software I/O TLB services"); #endif } }

Contributors

PersonTokensPropCommitsCommitProp
Alex Williamson3362.26%125.00%
David Mosberger-Tang1833.96%125.00%
Tony Luck11.89%125.00%
Harvey Harrison11.89%125.00%
Total53100.00%4100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
David Mosberger-Tang6240.52%18.33%
FUJITA Tomonori4529.41%433.33%
Alex Williamson3522.88%18.33%
Joerg Roedel31.96%18.33%
Paul Gortmaker31.96%18.33%
Bart Van Assche21.31%18.33%
Greg Kroah-Hartman10.65%18.33%
Harvey Harrison10.65%18.33%
Tony Luck10.65%18.33%
Total153100.00%12100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.