aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/pci/pci_dma.c
diff options
context:
space:
mode:
authorJan Glauber <jang@linux.vnet.ibm.com>2012-12-11 08:53:35 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-12-14 04:01:17 -0500
commitd0b0885316ab7a97cc8a19027905de3ff7bd1e79 (patch)
tree43a490c63baf2da1d4768f7d083e2e9d6cf8467b /arch/s390/pci/pci_dma.c
parent7313264b899bbf3988841296265a6e0e8a7b6521 (diff)
s390/pci: performance statistics and debug infrastructure
Add support for reading the PCI function measurement block counters provided by the hypervisor. Add two s390 debug features, one for critical errors and one for tracing and provide wrappers to log data. Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/pci/pci_dma.c')
-rw-r--r--arch/s390/pci/pci_dma.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index c64b4b294b0a..6138468b420f 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -291,8 +291,10 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
291 if (direction == DMA_NONE || direction == DMA_TO_DEVICE) 291 if (direction == DMA_NONE || direction == DMA_TO_DEVICE)
292 flags |= ZPCI_TABLE_PROTECTED; 292 flags |= ZPCI_TABLE_PROTECTED;
293 293
294 if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) 294 if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) {
295 atomic64_add(nr_pages, (atomic64_t *) &zdev->fmb->mapped_pages);
295 return dma_addr + offset; 296 return dma_addr + offset;
297 }
296 298
297out_free: 299out_free:
298 dma_free_iommu(zdev, iommu_page_index, nr_pages); 300 dma_free_iommu(zdev, iommu_page_index, nr_pages);
@@ -315,6 +317,7 @@ static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr,
315 ZPCI_TABLE_PROTECTED | ZPCI_PTE_INVALID)) 317 ZPCI_TABLE_PROTECTED | ZPCI_PTE_INVALID))
316 dev_err(dev, "Failed to unmap addr: %Lx\n", dma_addr); 318 dev_err(dev, "Failed to unmap addr: %Lx\n", dma_addr);
317 319
320 atomic64_add(npages, (atomic64_t *) &zdev->fmb->unmapped_pages);
318 iommu_page_index = (dma_addr - zdev->start_dma) >> PAGE_SHIFT; 321 iommu_page_index = (dma_addr - zdev->start_dma) >> PAGE_SHIFT;
319 dma_free_iommu(zdev, iommu_page_index, npages); 322 dma_free_iommu(zdev, iommu_page_index, npages);
320} 323}
@@ -323,6 +326,7 @@ static void *s390_dma_alloc(struct device *dev, size_t size,
323 dma_addr_t *dma_handle, gfp_t flag, 326 dma_addr_t *dma_handle, gfp_t flag,
324 struct dma_attrs *attrs) 327 struct dma_attrs *attrs)
325{ 328{
329 struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev));
326 struct page *page; 330 struct page *page;
327 unsigned long pa; 331 unsigned long pa;
328 dma_addr_t map; 332 dma_addr_t map;
@@ -331,6 +335,8 @@ static void *s390_dma_alloc(struct device *dev, size_t size,
331 page = alloc_pages(flag, get_order(size)); 335 page = alloc_pages(flag, get_order(size));
332 if (!page) 336 if (!page)
333 return NULL; 337 return NULL;
338
339 atomic64_add(size / PAGE_SIZE, (atomic64_t *) &zdev->fmb->allocated_pages);
334 pa = page_to_phys(page); 340 pa = page_to_phys(page);
335 memset((void *) pa, 0, size); 341 memset((void *) pa, 0, size);
336 342