提交 e7a0453e 编写于 作者: D David S. Miller

[SPARC64] PCI: Size TSB correctly on SUN4V.

Forgot to multiply by 8 * 1024, oops.  Correct the size constant when
the virtual-dma arena is 2GB in size, it should bet 256 not 128.

Finally, log some info about the TSB at probe time.
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 db33f9bc
...@@ -102,6 +102,7 @@ static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr ...@@ -102,6 +102,7 @@ static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr
first_page = __get_free_pages(GFP_ATOMIC, order); first_page = __get_free_pages(GFP_ATOMIC, order);
if (first_page == 0UL) if (first_page == 0UL)
return NULL; return NULL;
memset((char *)first_page, 0, PAGE_SIZE << order); memset((char *)first_page, 0, PAGE_SIZE << order);
pcp = pdev->sysdata; pcp = pdev->sysdata;
...@@ -805,11 +806,11 @@ static void pbm_register_toplevel_resources(struct pci_controller_info *p, ...@@ -805,11 +806,11 @@ static void pbm_register_toplevel_resources(struct pci_controller_info *p,
&pbm->mem_space); &pbm->mem_space);
} }
static void probe_existing_entries(struct pci_pbm_info *pbm, static unsigned long probe_existing_entries(struct pci_pbm_info *pbm,
struct pci_iommu *iommu) struct pci_iommu *iommu)
{ {
struct pci_iommu_arena *arena = &iommu->arena; struct pci_iommu_arena *arena = &iommu->arena;
unsigned long i; unsigned long i, cnt = 0;
u32 devhandle; u32 devhandle;
devhandle = pbm->devhandle; devhandle = pbm->devhandle;
...@@ -819,9 +820,13 @@ static void probe_existing_entries(struct pci_pbm_info *pbm, ...@@ -819,9 +820,13 @@ static void probe_existing_entries(struct pci_pbm_info *pbm,
ret = pci_sun4v_iommu_getmap(devhandle, ret = pci_sun4v_iommu_getmap(devhandle,
HV_PCI_TSBID(0, i), HV_PCI_TSBID(0, i),
&io_attrs, &ra); &io_attrs, &ra);
if (ret == HV_EOK) if (ret == HV_EOK) {
cnt++;
__set_bit(i, arena->map); __set_bit(i, arena->map);
}
} }
return cnt;
} }
static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm) static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
...@@ -853,7 +858,7 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm) ...@@ -853,7 +858,7 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
case 0x80000000: case 0x80000000:
dma_mask |= 0x7fffffff; dma_mask |= 0x7fffffff;
tsbsize = 128; tsbsize = 256;
break; break;
default: default:
...@@ -861,6 +866,8 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm) ...@@ -861,6 +866,8 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
prom_halt(); prom_halt();
}; };
tsbsize *= (8 * 1024);
num_tsb_entries = tsbsize / sizeof(iopte_t); num_tsb_entries = tsbsize / sizeof(iopte_t);
dma_offset = vdma[0]; dma_offset = vdma[0];
...@@ -882,7 +889,10 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm) ...@@ -882,7 +889,10 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
memset(iommu->arena.map, 0, sz); memset(iommu->arena.map, 0, sz);
iommu->arena.limit = num_tsb_entries; iommu->arena.limit = num_tsb_entries;
probe_existing_entries(pbm, iommu); sz = probe_existing_entries(pbm, iommu);
printk("%s: TSB entries [%lu], existing mapings [%lu]\n",
pbm->name, num_tsb_entries, sz);
} }
static void pci_sun4v_get_bus_range(struct pci_pbm_info *pbm) static void pci_sun4v_get_bus_range(struct pci_pbm_info *pbm)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册