aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/pci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-20 12:23:31 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-20 12:23:31 -0500
commitf479c01c8e81096e01eb20cec67dbaebae669aee (patch)
tree951890b22992aa6366b55308cdc05b1568cb8622 /arch/s390/pci
parentd8ec26d7f8287f5788a494f56e8814210f0e64be (diff)
parentf85168e4d96b31b09ecf09a679820b031224e69e (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 updates from Martin Schwidefsky: "The bulk of the s390 updates for v3.14. New features are the perf support for the CPU-Measurement Sample Facility and the EP11 support for the crypto cards. And the normal cleanups and bug-fixes" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (44 commits) s390/cpum_sf: fix printk format warnings s390: Fix misspellings using 'codespell' tool s390/qdio: bridgeport support - CHSC part s390: delete new instances of __cpuinit usage s390/compat: fix PSW32_USER_BITS definition s390/zcrypt: add support for EP11 coprocessor cards s390/mm: optimize randomize_et_dyn for !PF_RANDOMIZE s390: use IS_ENABLED to check if a CONFIG is set to y or m s390/cio: use device_lock to synchronize calls to the ccwgroup driver s390/cio: use device_lock to synchronize calls to the ccw driver s390/cio: fix unlocked access of online member s390/cpum_sf: Add flag to process full SDBs only s390/cpum_sf: Add raw data sampling to support the diagnostic-sampling function s390/cpum_sf: Filter perf events based event->attr.exclude_* settings s390/cpum_sf: Detect KVM guest samples s390/cpum_sf: Add helper to read TOD from trailer entries s390/cpum_sf: Atomically reset trailer entry fields of sample-data-blocks s390/cpum_sf: Dynamically extend the sampling buffer if overflows occur s390/pci: reenable per default s390/pci/dma: fix accounting of allocated_pages ...
Diffstat (limited to 'arch/s390/pci')
-rw-r--r--arch/s390/pci/pci.c16
-rw-r--r--arch/s390/pci/pci_dma.c13
-rw-r--r--arch/s390/pci/pci_event.c26
3 files changed, 41 insertions, 14 deletions
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index bf7c73d71eef..0820362c7b0f 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -919,17 +919,23 @@ static void zpci_mem_exit(void)
919 kmem_cache_destroy(zdev_fmb_cache); 919 kmem_cache_destroy(zdev_fmb_cache);
920} 920}
921 921
922static unsigned int s390_pci_probe; 922static unsigned int s390_pci_probe = 1;
923static unsigned int s390_pci_initialized;
923 924
924char * __init pcibios_setup(char *str) 925char * __init pcibios_setup(char *str)
925{ 926{
926 if (!strcmp(str, "on")) { 927 if (!strcmp(str, "off")) {
927 s390_pci_probe = 1; 928 s390_pci_probe = 0;
928 return NULL; 929 return NULL;
929 } 930 }
930 return str; 931 return str;
931} 932}
932 933
934bool zpci_is_enabled(void)
935{
936 return s390_pci_initialized;
937}
938
933static int __init pci_base_init(void) 939static int __init pci_base_init(void)
934{ 940{
935 int rc; 941 int rc;
@@ -961,6 +967,7 @@ static int __init pci_base_init(void)
961 if (rc) 967 if (rc)
962 goto out_find; 968 goto out_find;
963 969
970 s390_pci_initialized = 1;
964 return 0; 971 return 0;
965 972
966out_find: 973out_find:
@@ -978,5 +985,6 @@ subsys_initcall_sync(pci_base_init);
978 985
979void zpci_rescan(void) 986void zpci_rescan(void)
980{ 987{
981 clp_rescan_pci_devices_simple(); 988 if (zpci_is_enabled())
989 clp_rescan_pci_devices_simple();
982} 990}
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index 9b83d080902d..60c11a629d96 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -285,7 +285,7 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
285 flags |= ZPCI_TABLE_PROTECTED; 285 flags |= ZPCI_TABLE_PROTECTED;
286 286
287 if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) { 287 if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) {
288 atomic64_add(nr_pages, (atomic64_t *) &zdev->fmb->mapped_pages); 288 atomic64_add(nr_pages, &zdev->fmb->mapped_pages);
289 return dma_addr + (offset & ~PAGE_MASK); 289 return dma_addr + (offset & ~PAGE_MASK);
290 } 290 }
291 291
@@ -313,7 +313,7 @@ static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr,
313 zpci_err_hex(&dma_addr, sizeof(dma_addr)); 313 zpci_err_hex(&dma_addr, sizeof(dma_addr));
314 } 314 }
315 315
316 atomic64_add(npages, (atomic64_t *) &zdev->fmb->unmapped_pages); 316 atomic64_add(npages, &zdev->fmb->unmapped_pages);
317 iommu_page_index = (dma_addr - zdev->start_dma) >> PAGE_SHIFT; 317 iommu_page_index = (dma_addr - zdev->start_dma) >> PAGE_SHIFT;
318 dma_free_iommu(zdev, iommu_page_index, npages); 318 dma_free_iommu(zdev, iommu_page_index, npages);
319} 319}
@@ -332,7 +332,6 @@ static void *s390_dma_alloc(struct device *dev, size_t size,
332 if (!page) 332 if (!page)
333 return NULL; 333 return NULL;
334 334
335 atomic64_add(size / PAGE_SIZE, (atomic64_t *) &zdev->fmb->allocated_pages);
336 pa = page_to_phys(page); 335 pa = page_to_phys(page);
337 memset((void *) pa, 0, size); 336 memset((void *) pa, 0, size);
338 337
@@ -343,6 +342,7 @@ static void *s390_dma_alloc(struct device *dev, size_t size,
343 return NULL; 342 return NULL;
344 } 343 }
345 344
345 atomic64_add(size / PAGE_SIZE, &zdev->fmb->allocated_pages);
346 if (dma_handle) 346 if (dma_handle)
347 *dma_handle = map; 347 *dma_handle = map;
348 return (void *) pa; 348 return (void *) pa;
@@ -352,8 +352,11 @@ static void s390_dma_free(struct device *dev, size_t size,
352 void *pa, dma_addr_t dma_handle, 352 void *pa, dma_addr_t dma_handle,
353 struct dma_attrs *attrs) 353 struct dma_attrs *attrs)
354{ 354{
355 s390_dma_unmap_pages(dev, dma_handle, PAGE_ALIGN(size), 355 struct zpci_dev *zdev = get_zdev(to_pci_dev(dev));
356 DMA_BIDIRECTIONAL, NULL); 356
357 size = PAGE_ALIGN(size);
358 atomic64_sub(size / PAGE_SIZE, &zdev->fmb->allocated_pages);
359 s390_dma_unmap_pages(dev, dma_handle, size, DMA_BIDIRECTIONAL, NULL);
357 free_pages((unsigned long) pa, get_order(size)); 360 free_pages((unsigned long) pa, get_order(size));
358} 361}
359 362
diff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c
index 069607209a30..01e251b1da0c 100644
--- a/arch/s390/pci/pci_event.c
+++ b/arch/s390/pci/pci_event.c
@@ -43,9 +43,8 @@ struct zpci_ccdf_avail {
43 u16 pec; /* PCI event code */ 43 u16 pec; /* PCI event code */
44} __packed; 44} __packed;
45 45
46void zpci_event_error(void *data) 46static void __zpci_event_error(struct zpci_ccdf_err *ccdf)
47{ 47{
48 struct zpci_ccdf_err *ccdf = data;
49 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); 48 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
50 49
51 zpci_err("error CCDF:\n"); 50 zpci_err("error CCDF:\n");
@@ -58,9 +57,14 @@ void zpci_event_error(void *data)
58 pci_name(zdev->pdev), ccdf->pec, ccdf->fid); 57 pci_name(zdev->pdev), ccdf->pec, ccdf->fid);
59} 58}
60 59
61void zpci_event_availability(void *data) 60void zpci_event_error(void *data)
61{
62 if (zpci_is_enabled())
63 __zpci_event_error(data);
64}
65
66static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
62{ 67{
63 struct zpci_ccdf_avail *ccdf = data;
64 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); 68 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
65 struct pci_dev *pdev = zdev ? zdev->pdev : NULL; 69 struct pci_dev *pdev = zdev ? zdev->pdev : NULL;
66 int ret; 70 int ret;
@@ -99,8 +103,12 @@ void zpci_event_availability(void *data)
99 103
100 break; 104 break;
101 case 0x0304: /* Configured -> Standby */ 105 case 0x0304: /* Configured -> Standby */
102 if (pdev) 106 if (pdev) {
107 /* Give the driver a hint that the function is
108 * already unusable. */
109 pdev->error_state = pci_channel_io_perm_failure;
103 pci_stop_and_remove_bus_device(pdev); 110 pci_stop_and_remove_bus_device(pdev);
111 }
104 112
105 zdev->fh = ccdf->fh; 113 zdev->fh = ccdf->fh;
106 zpci_disable_device(zdev); 114 zpci_disable_device(zdev);
@@ -110,6 +118,8 @@ void zpci_event_availability(void *data)
110 clp_rescan_pci_devices(); 118 clp_rescan_pci_devices();
111 break; 119 break;
112 case 0x0308: /* Standby -> Reserved */ 120 case 0x0308: /* Standby -> Reserved */
121 if (!zdev)
122 break;
113 pci_stop_root_bus(zdev->bus); 123 pci_stop_root_bus(zdev->bus);
114 pci_remove_root_bus(zdev->bus); 124 pci_remove_root_bus(zdev->bus);
115 break; 125 break;
@@ -117,3 +127,9 @@ void zpci_event_availability(void *data)
117 break; 127 break;
118 } 128 }
119} 129}
130
131void zpci_event_availability(void *data)
132{
133 if (zpci_is_enabled())
134 __zpci_event_availability(data);
135}