Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 26125
b: refs/heads/master
c: 7daa411
h: refs/heads/master
i:
  26123: 4500a0e
v: v3
  • Loading branch information
Olof Johansson authored and Paul Mackerras committed Apr 21, 2006
1 parent 107a4e6 commit 3763606
Show file tree
Hide file tree
Showing 27 changed files with 580 additions and 1,903 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 93e1b7d42e1edb4ddde6257e9a02513fef26f715
refs/heads/master: 7daa411b810d7eadfaabe3765ec5f827893dbb30
36 changes: 26 additions & 10 deletions trunk/arch/powerpc/kernel/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ __setup("iommu=", setup_iommu);
static unsigned long iommu_range_alloc(struct iommu_table *tbl,
unsigned long npages,
unsigned long *handle,
unsigned long mask,
unsigned int align_order)
{
unsigned long n, end, i, start;
Expand Down Expand Up @@ -97,9 +98,21 @@ static unsigned long iommu_range_alloc(struct iommu_table *tbl,
*/
if (start >= limit)
start = largealloc ? tbl->it_largehint : tbl->it_hint;

again:

if (limit + tbl->it_offset > mask) {
limit = mask - tbl->it_offset + 1;
/* If we're constrained on address range, first try
* at the masked hint to avoid O(n) search complexity,
* but on second pass, start at 0.
*/
if ((start & mask) >= limit || pass > 0)
start = 0;
else
start &= mask;
}

n = find_next_zero_bit(tbl->it_map, limit, start);

/* Align allocation */
Expand Down Expand Up @@ -150,14 +163,14 @@ static unsigned long iommu_range_alloc(struct iommu_table *tbl,

static dma_addr_t iommu_alloc(struct iommu_table *tbl, void *page,
unsigned int npages, enum dma_data_direction direction,
unsigned int align_order)
unsigned long mask, unsigned int align_order)
{
unsigned long entry, flags;
dma_addr_t ret = DMA_ERROR_CODE;

spin_lock_irqsave(&(tbl->it_lock), flags);

entry = iommu_range_alloc(tbl, npages, NULL, align_order);
entry = iommu_range_alloc(tbl, npages, NULL, mask, align_order);

if (unlikely(entry == DMA_ERROR_CODE)) {
spin_unlock_irqrestore(&(tbl->it_lock), flags);
Expand Down Expand Up @@ -236,7 +249,7 @@ static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,

int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
struct scatterlist *sglist, int nelems,
enum dma_data_direction direction)
unsigned long mask, enum dma_data_direction direction)
{
dma_addr_t dma_next = 0, dma_addr;
unsigned long flags;
Expand Down Expand Up @@ -274,7 +287,7 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
vaddr = (unsigned long)page_address(s->page) + s->offset;
npages = PAGE_ALIGN(vaddr + slen) - (vaddr & PAGE_MASK);
npages >>= PAGE_SHIFT;
entry = iommu_range_alloc(tbl, npages, &handle, 0);
entry = iommu_range_alloc(tbl, npages, &handle, mask >> PAGE_SHIFT, 0);

DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen);

Expand Down Expand Up @@ -479,7 +492,8 @@ void iommu_free_table(struct device_node *dn)
* byte within the page as vaddr.
*/
dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
size_t size, enum dma_data_direction direction)
size_t size, unsigned long mask,
enum dma_data_direction direction)
{
dma_addr_t dma_handle = DMA_ERROR_CODE;
unsigned long uaddr;
Expand All @@ -492,7 +506,8 @@ dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
npages >>= PAGE_SHIFT;

if (tbl) {
dma_handle = iommu_alloc(tbl, vaddr, npages, direction, 0);
dma_handle = iommu_alloc(tbl, vaddr, npages, direction,
mask >> PAGE_SHIFT, 0);
if (dma_handle == DMA_ERROR_CODE) {
if (printk_ratelimit()) {
printk(KERN_INFO "iommu_alloc failed, "
Expand Down Expand Up @@ -521,7 +536,7 @@ void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
* to the dma address (mapping) of the first page.
*/
void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
dma_addr_t *dma_handle, gfp_t flag)
dma_addr_t *dma_handle, unsigned long mask, gfp_t flag)
{
void *ret = NULL;
dma_addr_t mapping;
Expand Down Expand Up @@ -551,7 +566,8 @@ void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
memset(ret, 0, size);

/* Set up tces to cover the allocated range */
mapping = iommu_alloc(tbl, ret, npages, DMA_BIDIRECTIONAL, order);
mapping = iommu_alloc(tbl, ret, npages, DMA_BIDIRECTIONAL,
mask >> PAGE_SHIFT, order);
if (mapping == DMA_ERROR_CODE) {
free_pages((unsigned long)ret, order);
ret = NULL;
Expand Down
40 changes: 36 additions & 4 deletions trunk/arch/powerpc/kernel/pci_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,25 @@ static inline struct iommu_table *devnode_table(struct device *dev)
}


static inline unsigned long device_to_mask(struct device *hwdev)
{
struct pci_dev *pdev;

if (!hwdev) {
pdev = ppc64_isabridge_dev;
if (!pdev) /* This is the best guess we can do */
return 0xfffffffful;
} else
pdev = to_pci_dev(hwdev);

if (pdev->dma_mask)
return pdev->dma_mask;

/* Assume devices without mask can take 32 bit addresses */
return 0xfffffffful;
}


/* Allocates a contiguous real buffer and creates mappings over it.
* Returns the virtual address of the buffer and sets dma_handle
* to the dma address (mapping) of the first page.
Expand All @@ -67,7 +86,7 @@ static void *pci_iommu_alloc_coherent(struct device *hwdev, size_t size,
dma_addr_t *dma_handle, gfp_t flag)
{
return iommu_alloc_coherent(devnode_table(hwdev), size, dma_handle,
flag);
device_to_mask(hwdev), flag);
}

static void pci_iommu_free_coherent(struct device *hwdev, size_t size,
Expand All @@ -85,7 +104,8 @@ static void pci_iommu_free_coherent(struct device *hwdev, size_t size,
static dma_addr_t pci_iommu_map_single(struct device *hwdev, void *vaddr,
size_t size, enum dma_data_direction direction)
{
return iommu_map_single(devnode_table(hwdev), vaddr, size, direction);
return iommu_map_single(devnode_table(hwdev), vaddr, size,
device_to_mask(hwdev), direction);
}


Expand All @@ -100,7 +120,7 @@ static int pci_iommu_map_sg(struct device *pdev, struct scatterlist *sglist,
int nelems, enum dma_data_direction direction)
{
return iommu_map_sg(pdev, devnode_table(pdev), sglist,
nelems, direction);
nelems, device_to_mask(pdev), direction);
}

static void pci_iommu_unmap_sg(struct device *pdev, struct scatterlist *sglist,
Expand All @@ -112,7 +132,19 @@ static void pci_iommu_unmap_sg(struct device *pdev, struct scatterlist *sglist,
/* We support DMA to/from any memory page via the iommu */
static int pci_iommu_dma_supported(struct device *dev, u64 mask)
{
return 1;
struct iommu_table *tbl = devnode_table(dev);

if (!tbl || tbl->it_offset > mask) {
printk(KERN_INFO "Warning: IOMMU table offset too big for device mask\n");
if (tbl)
printk(KERN_INFO "mask: 0x%08lx, table offset: 0x%08lx\n",
mask, tbl->it_offset);
else
printk(KERN_INFO "mask: 0x%08lx, table unavailable\n",
mask);
return 0;
} else
return 1;
}

void pci_iommu_init(void)
Expand Down
6 changes: 3 additions & 3 deletions trunk/arch/powerpc/kernel/vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static dma_addr_t vio_map_single(struct device *dev, void *vaddr,
size_t size, enum dma_data_direction direction)
{
return iommu_map_single(to_vio_dev(dev)->iommu_table, vaddr, size,
direction);
~0ul, direction);
}

static void vio_unmap_single(struct device *dev, dma_addr_t dma_handle,
Expand All @@ -216,7 +216,7 @@ static int vio_map_sg(struct device *dev, struct scatterlist *sglist,
int nelems, enum dma_data_direction direction)
{
return iommu_map_sg(dev, to_vio_dev(dev)->iommu_table, sglist,
nelems, direction);
nelems, ~0ul, direction);
}

static void vio_unmap_sg(struct device *dev, struct scatterlist *sglist,
Expand All @@ -229,7 +229,7 @@ static void *vio_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flag)
{
return iommu_alloc_coherent(to_vio_dev(dev)->iommu_table, size,
dma_handle, flag);
dma_handle, ~0ul, flag);
}

static void vio_free_coherent(struct device *dev, size_t size,
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/x86_64/ia32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ $(obj)/vsyscall-sysenter.so $(obj)/vsyscall-syscall.so: \
$(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE
$(call if_changed,syscall)

AFLAGS_vsyscall-sysenter.o = -m32 -Wa,-32
AFLAGS_vsyscall-syscall.o = -m32 -Wa,-32
AFLAGS_vsyscall-sysenter.o = -m32
AFLAGS_vsyscall-syscall.o = -m32
4 changes: 4 additions & 0 deletions trunk/arch/x86_64/kernel/pci-gart.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ static unsigned long alloc_iommu(int size)
static void free_iommu(unsigned long offset, int size)
{
unsigned long flags;
if (size == 1) {
clear_bit(offset, iommu_gart_bitmap);
return;
}
spin_lock_irqsave(&iommu_bitmap_lock, flags);
__clear_bit_string(iommu_gart_bitmap, offset, size);
spin_unlock_irqrestore(&iommu_bitmap_lock, flags);
Expand Down
2 changes: 0 additions & 2 deletions trunk/arch/x86_64/mm/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,11 @@ void __init setup_node_zones(int nodeid)
memory. */
memmapsize = sizeof(struct page) * (end_pfn-start_pfn);
limit = end_pfn << PAGE_SHIFT;
#ifdef CONFIG_FLAT_NODE_MEM_MAP
NODE_DATA(nodeid)->node_mem_map =
__alloc_bootmem_core(NODE_DATA(nodeid)->bdata,
memmapsize, SMP_CACHE_BYTES,
round_down(limit - memmapsize, PAGE_SIZE),
limit);
#endif

size_zones(zones, holes, start_pfn, end_pfn);
free_area_init_node(nodeid, NODE_DATA(nodeid), zones,
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/char/snsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,7 @@ scdrv_init(void)
format_module_id(devnamep, geo_module(geoid),
MODULE_FORMAT_BRIEF);
devnamep = devname + strlen(devname);
sprintf(devnamep, "^%d#%d", geo_slot(geoid),
geo_slab(geoid));
sprintf(devnamep, "#%d", geo_slab(geoid));

/* allocate sysctl device data */
scd = kzalloc(sizeof (struct sysctl_data_s),
Expand Down
11 changes: 1 addition & 10 deletions trunk/drivers/char/tpm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,9 @@ config TCG_TPM
Note: For more TPM drivers enable CONFIG_PNP, CONFIG_ACPI
and CONFIG_PNPACPI.

config TCG_TIS
tristate "TPM Interface Specification 1.2 Interface"
depends on TCG_TPM
---help---
If you have a TPM security chip that is compliant with the
TCG TIS 1.2 TPM specification say Yes and it will be accessible
from within Linux. To compile this driver as a module, choose
M here; the module will be called tpm_tis.

config TCG_NSC
tristate "National Semiconductor TPM Interface"
depends on TCG_TPM && PNPACPI
depends on TCG_TPM
---help---
If you have a TPM security chip from National Semicondutor
say Yes and it will be accessible from within Linux. To
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/char/tpm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ obj-$(CONFIG_TCG_TPM) += tpm.o
ifdef CONFIG_ACPI
obj-$(CONFIG_TCG_TPM) += tpm_bios.o
endif
obj-$(CONFIG_TCG_TIS) += tpm_tis.o
obj-$(CONFIG_TCG_NSC) += tpm_nsc.o
obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o
obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o
Loading

0 comments on commit 3763606

Please sign in to comment.