diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2015-06-29 12:47:28 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2016-04-15 12:16:40 -0400 |
commit | f9dc447ec8f1f0a9f2ba4e4d5a61758f8df4acd8 (patch) | |
tree | 47c14271fe449c8987cca6a0cccc4306fc7322a1 | |
parent | 8fd575200db5b53f6ea6818dd017f1b43190db12 (diff) |
s390/pci: fmb enhancements
Implement the function type specific function measurement block used
in new machines.
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/include/asm/pci.h | 35 | ||||
-rw-r--r-- | arch/s390/pci/pci_debug.c | 61 |
2 files changed, 75 insertions, 21 deletions
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h index 535a46d46d28..0da91c4d30fd 100644 --- a/arch/s390/include/asm/pci.h +++ b/arch/s390/include/asm/pci.h | |||
@@ -31,20 +31,41 @@ int pci_proc_domain(struct pci_bus *); | |||
31 | #define ZPCI_FC_BLOCKED 0x20 | 31 | #define ZPCI_FC_BLOCKED 0x20 |
32 | #define ZPCI_FC_DMA_ENABLED 0x10 | 32 | #define ZPCI_FC_DMA_ENABLED 0x10 |
33 | 33 | ||
34 | #define ZPCI_FMB_DMA_COUNTER_VALID (1 << 23) | ||
35 | |||
36 | struct zpci_fmb_fmt0 { | ||
37 | u64 dma_rbytes; | ||
38 | u64 dma_wbytes; | ||
39 | }; | ||
40 | |||
41 | struct zpci_fmb_fmt1 { | ||
42 | u64 rx_bytes; | ||
43 | u64 rx_packets; | ||
44 | u64 tx_bytes; | ||
45 | u64 tx_packets; | ||
46 | }; | ||
47 | |||
48 | struct zpci_fmb_fmt2 { | ||
49 | u64 consumed_work_units; | ||
50 | u64 max_work_units; | ||
51 | }; | ||
52 | |||
34 | struct zpci_fmb { | 53 | struct zpci_fmb { |
35 | u32 format : 8; | 54 | u32 format : 8; |
36 | u32 dma_valid : 1; | 55 | u32 fmt_ind : 24; |
37 | u32 : 23; | ||
38 | u32 samples; | 56 | u32 samples; |
39 | u64 last_update; | 57 | u64 last_update; |
40 | /* hardware counters */ | 58 | /* common counters */ |
41 | u64 ld_ops; | 59 | u64 ld_ops; |
42 | u64 st_ops; | 60 | u64 st_ops; |
43 | u64 stb_ops; | 61 | u64 stb_ops; |
44 | u64 rpcit_ops; | 62 | u64 rpcit_ops; |
45 | u64 dma_rbytes; | 63 | /* format specific counters */ |
46 | u64 dma_wbytes; | 64 | union { |
47 | u64 pad[2]; | 65 | struct zpci_fmb_fmt0 fmt0; |
66 | struct zpci_fmb_fmt1 fmt1; | ||
67 | struct zpci_fmb_fmt2 fmt2; | ||
68 | }; | ||
48 | } __packed __aligned(128); | 69 | } __packed __aligned(128); |
49 | 70 | ||
50 | enum zpci_state { | 71 | enum zpci_state { |
diff --git a/arch/s390/pci/pci_debug.c b/arch/s390/pci/pci_debug.c index c555de3d12d6..38993b156924 100644 --- a/arch/s390/pci/pci_debug.c +++ b/arch/s390/pci/pci_debug.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright IBM Corp. 2012 | 2 | * Copyright IBM Corp. 2012,2015 |
3 | * | 3 | * |
4 | * Author(s): | 4 | * Author(s): |
5 | * Jan Glauber <jang@linux.vnet.ibm.com> | 5 | * Jan Glauber <jang@linux.vnet.ibm.com> |
@@ -23,22 +23,45 @@ EXPORT_SYMBOL_GPL(pci_debug_msg_id); | |||
23 | debug_info_t *pci_debug_err_id; | 23 | debug_info_t *pci_debug_err_id; |
24 | EXPORT_SYMBOL_GPL(pci_debug_err_id); | 24 | EXPORT_SYMBOL_GPL(pci_debug_err_id); |
25 | 25 | ||
26 | static char *pci_perf_names[] = { | 26 | static char *pci_common_names[] = { |
27 | /* hardware counters */ | ||
28 | "Load operations", | 27 | "Load operations", |
29 | "Store operations", | 28 | "Store operations", |
30 | "Store block operations", | 29 | "Store block operations", |
31 | "Refresh operations", | 30 | "Refresh operations", |
31 | }; | ||
32 | |||
33 | static char *pci_fmt0_names[] = { | ||
32 | "DMA read bytes", | 34 | "DMA read bytes", |
33 | "DMA write bytes", | 35 | "DMA write bytes", |
34 | }; | 36 | }; |
35 | 37 | ||
38 | static char *pci_fmt1_names[] = { | ||
39 | "Received bytes", | ||
40 | "Received packets", | ||
41 | "Transmitted bytes", | ||
42 | "Transmitted packets", | ||
43 | }; | ||
44 | |||
45 | static char *pci_fmt2_names[] = { | ||
46 | "Consumed work units", | ||
47 | "Maximum work units", | ||
48 | }; | ||
49 | |||
36 | static char *pci_sw_names[] = { | 50 | static char *pci_sw_names[] = { |
37 | "Allocated pages", | 51 | "Allocated pages", |
38 | "Mapped pages", | 52 | "Mapped pages", |
39 | "Unmapped pages", | 53 | "Unmapped pages", |
40 | }; | 54 | }; |
41 | 55 | ||
56 | static void pci_fmb_show(struct seq_file *m, char *name[], int length, | ||
57 | u64 *data) | ||
58 | { | ||
59 | int i; | ||
60 | |||
61 | for (i = 0; i < length; i++, data++) | ||
62 | seq_printf(m, "%26s:\t%llu\n", name[i], *data); | ||
63 | } | ||
64 | |||
42 | static void pci_sw_counter_show(struct seq_file *m) | 65 | static void pci_sw_counter_show(struct seq_file *m) |
43 | { | 66 | { |
44 | struct zpci_dev *zdev = m->private; | 67 | struct zpci_dev *zdev = m->private; |
@@ -53,8 +76,6 @@ static void pci_sw_counter_show(struct seq_file *m) | |||
53 | static int pci_perf_show(struct seq_file *m, void *v) | 76 | static int pci_perf_show(struct seq_file *m, void *v) |
54 | { | 77 | { |
55 | struct zpci_dev *zdev = m->private; | 78 | struct zpci_dev *zdev = m->private; |
56 | u64 *stat; | ||
57 | int i; | ||
58 | 79 | ||
59 | if (!zdev) | 80 | if (!zdev) |
60 | return 0; | 81 | return 0; |
@@ -72,15 +93,27 @@ static int pci_perf_show(struct seq_file *m, void *v) | |||
72 | seq_printf(m, "Samples: %u\n", zdev->fmb->samples); | 93 | seq_printf(m, "Samples: %u\n", zdev->fmb->samples); |
73 | seq_printf(m, "Last update TOD: %Lx\n", zdev->fmb->last_update); | 94 | seq_printf(m, "Last update TOD: %Lx\n", zdev->fmb->last_update); |
74 | 95 | ||
75 | /* hardware counters */ | 96 | pci_fmb_show(m, pci_common_names, ARRAY_SIZE(pci_common_names), |
76 | stat = (u64 *) &zdev->fmb->ld_ops; | 97 | &zdev->fmb->ld_ops); |
77 | for (i = 0; i < 4; i++) | 98 | |
78 | seq_printf(m, "%26s:\t%llu\n", | 99 | switch (zdev->fmb->format) { |
79 | pci_perf_names[i], *(stat + i)); | 100 | case 0: |
80 | if (zdev->fmb->dma_valid) | 101 | if (!(zdev->fmb->fmt_ind & ZPCI_FMB_DMA_COUNTER_VALID)) |
81 | for (i = 4; i < 6; i++) | 102 | break; |
82 | seq_printf(m, "%26s:\t%llu\n", | 103 | pci_fmb_show(m, pci_fmt0_names, ARRAY_SIZE(pci_fmt0_names), |
83 | pci_perf_names[i], *(stat + i)); | 104 | &zdev->fmb->fmt0.dma_rbytes); |
105 | break; | ||
106 | case 1: | ||
107 | pci_fmb_show(m, pci_fmt1_names, ARRAY_SIZE(pci_fmt1_names), | ||
108 | &zdev->fmb->fmt1.rx_bytes); | ||
109 | break; | ||
110 | case 2: | ||
111 | pci_fmb_show(m, pci_fmt2_names, ARRAY_SIZE(pci_fmt2_names), | ||
112 | &zdev->fmb->fmt2.consumed_work_units); | ||
113 | break; | ||
114 | default: | ||
115 | seq_puts(m, "Unknown format\n"); | ||
116 | } | ||
84 | 117 | ||
85 | pci_sw_counter_show(m); | 118 | pci_sw_counter_show(m); |
86 | mutex_unlock(&zdev->lock); | 119 | mutex_unlock(&zdev->lock); |