diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-20 13:15:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-20 13:15:33 -0400 |
commit | b19a42e3cb9e73cad59e60ab7403e5afe7f4b262 (patch) | |
tree | 5b8ebea37f8d655abdfcab89647e118686dc29e8 /arch/s390/pci | |
parent | 5ca08a82a75c9109f8207cbcbef8705334b4713a (diff) | |
parent | 80ed156a3d12819a8c839f40f5b6996c4aa117a5 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull more s390 updates from Martin Schwidefsky:
"The big thing in this second merge for s390 is the new eBPF JIT from
Michael which replaces the old 32-bit backend.
The remaining commits are bug fixes"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
s390/pci: add locking for fmb access
s390/pci: extract software counters from fmb
s390/dasd: Fix unresumed device after suspend/resume having no paths
s390/dasd: fix unresumed device after suspend/resume
s390/dasd: fix inability to set a DASD device offline
s390/mm: Fix memory hotplug for unaligned standby memory
s390/bpf: Add s390x eBPF JIT compiler backend
s390: Use bool function return values of true/false not 1/0
Diffstat (limited to 'arch/s390/pci')
-rw-r--r-- | arch/s390/pci/pci.c | 6 | ||||
-rw-r--r-- | arch/s390/pci/pci_debug.c | 33 | ||||
-rw-r--r-- | arch/s390/pci/pci_dma.c | 8 |
3 files changed, 32 insertions, 15 deletions
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 98336200c7b2..598f023cf8a6 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c | |||
@@ -190,6 +190,11 @@ int zpci_fmb_enable_device(struct zpci_dev *zdev) | |||
190 | return -ENOMEM; | 190 | return -ENOMEM; |
191 | WARN_ON((u64) zdev->fmb & 0xf); | 191 | WARN_ON((u64) zdev->fmb & 0xf); |
192 | 192 | ||
193 | /* reset software counters */ | ||
194 | atomic64_set(&zdev->allocated_pages, 0); | ||
195 | atomic64_set(&zdev->mapped_pages, 0); | ||
196 | atomic64_set(&zdev->unmapped_pages, 0); | ||
197 | |||
193 | args.fmb_addr = virt_to_phys(zdev->fmb); | 198 | args.fmb_addr = virt_to_phys(zdev->fmb); |
194 | return mod_pci(zdev, ZPCI_MOD_FC_SET_MEASURE, 0, &args); | 199 | return mod_pci(zdev, ZPCI_MOD_FC_SET_MEASURE, 0, &args); |
195 | } | 200 | } |
@@ -822,6 +827,7 @@ int zpci_create_device(struct zpci_dev *zdev) | |||
822 | if (rc) | 827 | if (rc) |
823 | goto out; | 828 | goto out; |
824 | 829 | ||
830 | mutex_init(&zdev->lock); | ||
825 | if (zdev->state == ZPCI_FN_STATE_CONFIGURED) { | 831 | if (zdev->state == ZPCI_FN_STATE_CONFIGURED) { |
826 | rc = zpci_enable_device(zdev); | 832 | rc = zpci_enable_device(zdev); |
827 | if (rc) | 833 | if (rc) |
diff --git a/arch/s390/pci/pci_debug.c b/arch/s390/pci/pci_debug.c index c22d4402ae45..4129b0a5fd78 100644 --- a/arch/s390/pci/pci_debug.c +++ b/arch/s390/pci/pci_debug.c | |||
@@ -31,12 +31,25 @@ static char *pci_perf_names[] = { | |||
31 | "Refresh operations", | 31 | "Refresh operations", |
32 | "DMA read bytes", | 32 | "DMA read bytes", |
33 | "DMA write bytes", | 33 | "DMA write bytes", |
34 | /* software counters */ | 34 | }; |
35 | |||
36 | static char *pci_sw_names[] = { | ||
35 | "Allocated pages", | 37 | "Allocated pages", |
36 | "Mapped pages", | 38 | "Mapped pages", |
37 | "Unmapped pages", | 39 | "Unmapped pages", |
38 | }; | 40 | }; |
39 | 41 | ||
42 | static void pci_sw_counter_show(struct seq_file *m) | ||
43 | { | ||
44 | struct zpci_dev *zdev = m->private; | ||
45 | atomic64_t *counter = &zdev->allocated_pages; | ||
46 | int i; | ||
47 | |||
48 | for (i = 0; i < ARRAY_SIZE(pci_sw_names); i++, counter++) | ||
49 | seq_printf(m, "%26s:\t%llu\n", pci_sw_names[i], | ||
50 | atomic64_read(counter)); | ||
51 | } | ||
52 | |||
40 | static int pci_perf_show(struct seq_file *m, void *v) | 53 | static int pci_perf_show(struct seq_file *m, void *v) |
41 | { | 54 | { |
42 | struct zpci_dev *zdev = m->private; | 55 | struct zpci_dev *zdev = m->private; |
@@ -45,7 +58,10 @@ static int pci_perf_show(struct seq_file *m, void *v) | |||
45 | 58 | ||
46 | if (!zdev) | 59 | if (!zdev) |
47 | return 0; | 60 | return 0; |
61 | |||
62 | mutex_lock(&zdev->lock); | ||
48 | if (!zdev->fmb) { | 63 | if (!zdev->fmb) { |
64 | mutex_unlock(&zdev->lock); | ||
49 | seq_puts(m, "FMB statistics disabled\n"); | 65 | seq_puts(m, "FMB statistics disabled\n"); |
50 | return 0; | 66 | return 0; |
51 | } | 67 | } |
@@ -65,12 +81,9 @@ static int pci_perf_show(struct seq_file *m, void *v) | |||
65 | for (i = 4; i < 6; i++) | 81 | for (i = 4; i < 6; i++) |
66 | seq_printf(m, "%26s:\t%llu\n", | 82 | seq_printf(m, "%26s:\t%llu\n", |
67 | pci_perf_names[i], *(stat + i)); | 83 | pci_perf_names[i], *(stat + i)); |
68 | /* software counters */ | ||
69 | for (i = 6; i < ARRAY_SIZE(pci_perf_names); i++) | ||
70 | seq_printf(m, "%26s:\t%llu\n", | ||
71 | pci_perf_names[i], | ||
72 | atomic64_read((atomic64_t *) (stat + i))); | ||
73 | 84 | ||
85 | pci_sw_counter_show(m); | ||
86 | mutex_unlock(&zdev->lock); | ||
74 | return 0; | 87 | return 0; |
75 | } | 88 | } |
76 | 89 | ||
@@ -88,19 +101,17 @@ static ssize_t pci_perf_seq_write(struct file *file, const char __user *ubuf, | |||
88 | if (rc) | 101 | if (rc) |
89 | return rc; | 102 | return rc; |
90 | 103 | ||
104 | mutex_lock(&zdev->lock); | ||
91 | switch (val) { | 105 | switch (val) { |
92 | case 0: | 106 | case 0: |
93 | rc = zpci_fmb_disable_device(zdev); | 107 | rc = zpci_fmb_disable_device(zdev); |
94 | if (rc) | ||
95 | return rc; | ||
96 | break; | 108 | break; |
97 | case 1: | 109 | case 1: |
98 | rc = zpci_fmb_enable_device(zdev); | 110 | rc = zpci_fmb_enable_device(zdev); |
99 | if (rc) | ||
100 | return rc; | ||
101 | break; | 111 | break; |
102 | } | 112 | } |
103 | return count; | 113 | mutex_unlock(&zdev->lock); |
114 | return rc ? rc : count; | ||
104 | } | 115 | } |
105 | 116 | ||
106 | static int pci_perf_seq_open(struct inode *inode, struct file *filp) | 117 | static int pci_perf_seq_open(struct inode *inode, struct file *filp) |
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c index 4cbb29a4d615..6fd8d5836138 100644 --- a/arch/s390/pci/pci_dma.c +++ b/arch/s390/pci/pci_dma.c | |||
@@ -300,7 +300,7 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page, | |||
300 | flags |= ZPCI_TABLE_PROTECTED; | 300 | flags |= ZPCI_TABLE_PROTECTED; |
301 | 301 | ||
302 | if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) { | 302 | if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) { |
303 | atomic64_add(nr_pages, &zdev->fmb->mapped_pages); | 303 | atomic64_add(nr_pages, &zdev->mapped_pages); |
304 | return dma_addr + (offset & ~PAGE_MASK); | 304 | return dma_addr + (offset & ~PAGE_MASK); |
305 | } | 305 | } |
306 | 306 | ||
@@ -328,7 +328,7 @@ static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr, | |||
328 | zpci_err_hex(&dma_addr, sizeof(dma_addr)); | 328 | zpci_err_hex(&dma_addr, sizeof(dma_addr)); |
329 | } | 329 | } |
330 | 330 | ||
331 | atomic64_add(npages, &zdev->fmb->unmapped_pages); | 331 | atomic64_add(npages, &zdev->unmapped_pages); |
332 | iommu_page_index = (dma_addr - zdev->start_dma) >> PAGE_SHIFT; | 332 | iommu_page_index = (dma_addr - zdev->start_dma) >> PAGE_SHIFT; |
333 | dma_free_iommu(zdev, iommu_page_index, npages); | 333 | dma_free_iommu(zdev, iommu_page_index, npages); |
334 | } | 334 | } |
@@ -357,7 +357,7 @@ static void *s390_dma_alloc(struct device *dev, size_t size, | |||
357 | return NULL; | 357 | return NULL; |
358 | } | 358 | } |
359 | 359 | ||
360 | atomic64_add(size / PAGE_SIZE, &zdev->fmb->allocated_pages); | 360 | atomic64_add(size / PAGE_SIZE, &zdev->allocated_pages); |
361 | if (dma_handle) | 361 | if (dma_handle) |
362 | *dma_handle = map; | 362 | *dma_handle = map; |
363 | return (void *) pa; | 363 | return (void *) pa; |
@@ -370,7 +370,7 @@ static void s390_dma_free(struct device *dev, size_t size, | |||
370 | struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); | 370 | struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); |
371 | 371 | ||
372 | size = PAGE_ALIGN(size); | 372 | size = PAGE_ALIGN(size); |
373 | atomic64_sub(size / PAGE_SIZE, &zdev->fmb->allocated_pages); | 373 | atomic64_sub(size / PAGE_SIZE, &zdev->allocated_pages); |
374 | s390_dma_unmap_pages(dev, dma_handle, size, DMA_BIDIRECTIONAL, NULL); | 374 | s390_dma_unmap_pages(dev, dma_handle, size, DMA_BIDIRECTIONAL, NULL); |
375 | free_pages((unsigned long) pa, get_order(size)); | 375 | free_pages((unsigned long) pa, get_order(size)); |
376 | } | 376 | } |