forked from Minki/linux
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>
This commit is contained in:
parent
8fd575200d
commit
f9dc447ec8
@ -31,20 +31,41 @@ int pci_proc_domain(struct pci_bus *);
|
||||
#define ZPCI_FC_BLOCKED 0x20
|
||||
#define ZPCI_FC_DMA_ENABLED 0x10
|
||||
|
||||
#define ZPCI_FMB_DMA_COUNTER_VALID (1 << 23)
|
||||
|
||||
struct zpci_fmb_fmt0 {
|
||||
u64 dma_rbytes;
|
||||
u64 dma_wbytes;
|
||||
};
|
||||
|
||||
struct zpci_fmb_fmt1 {
|
||||
u64 rx_bytes;
|
||||
u64 rx_packets;
|
||||
u64 tx_bytes;
|
||||
u64 tx_packets;
|
||||
};
|
||||
|
||||
struct zpci_fmb_fmt2 {
|
||||
u64 consumed_work_units;
|
||||
u64 max_work_units;
|
||||
};
|
||||
|
||||
struct zpci_fmb {
|
||||
u32 format : 8;
|
||||
u32 dma_valid : 1;
|
||||
u32 : 23;
|
||||
u32 format : 8;
|
||||
u32 fmt_ind : 24;
|
||||
u32 samples;
|
||||
u64 last_update;
|
||||
/* hardware counters */
|
||||
/* common counters */
|
||||
u64 ld_ops;
|
||||
u64 st_ops;
|
||||
u64 stb_ops;
|
||||
u64 rpcit_ops;
|
||||
u64 dma_rbytes;
|
||||
u64 dma_wbytes;
|
||||
u64 pad[2];
|
||||
/* format specific counters */
|
||||
union {
|
||||
struct zpci_fmb_fmt0 fmt0;
|
||||
struct zpci_fmb_fmt1 fmt1;
|
||||
struct zpci_fmb_fmt2 fmt2;
|
||||
};
|
||||
} __packed __aligned(128);
|
||||
|
||||
enum zpci_state {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright IBM Corp. 2012
|
||||
* Copyright IBM Corp. 2012,2015
|
||||
*
|
||||
* Author(s):
|
||||
* Jan Glauber <jang@linux.vnet.ibm.com>
|
||||
@ -23,22 +23,45 @@ EXPORT_SYMBOL_GPL(pci_debug_msg_id);
|
||||
debug_info_t *pci_debug_err_id;
|
||||
EXPORT_SYMBOL_GPL(pci_debug_err_id);
|
||||
|
||||
static char *pci_perf_names[] = {
|
||||
/* hardware counters */
|
||||
static char *pci_common_names[] = {
|
||||
"Load operations",
|
||||
"Store operations",
|
||||
"Store block operations",
|
||||
"Refresh operations",
|
||||
};
|
||||
|
||||
static char *pci_fmt0_names[] = {
|
||||
"DMA read bytes",
|
||||
"DMA write bytes",
|
||||
};
|
||||
|
||||
static char *pci_fmt1_names[] = {
|
||||
"Received bytes",
|
||||
"Received packets",
|
||||
"Transmitted bytes",
|
||||
"Transmitted packets",
|
||||
};
|
||||
|
||||
static char *pci_fmt2_names[] = {
|
||||
"Consumed work units",
|
||||
"Maximum work units",
|
||||
};
|
||||
|
||||
static char *pci_sw_names[] = {
|
||||
"Allocated pages",
|
||||
"Mapped pages",
|
||||
"Unmapped pages",
|
||||
};
|
||||
|
||||
static void pci_fmb_show(struct seq_file *m, char *name[], int length,
|
||||
u64 *data)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < length; i++, data++)
|
||||
seq_printf(m, "%26s:\t%llu\n", name[i], *data);
|
||||
}
|
||||
|
||||
static void pci_sw_counter_show(struct seq_file *m)
|
||||
{
|
||||
struct zpci_dev *zdev = m->private;
|
||||
@ -53,8 +76,6 @@ static void pci_sw_counter_show(struct seq_file *m)
|
||||
static int pci_perf_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct zpci_dev *zdev = m->private;
|
||||
u64 *stat;
|
||||
int i;
|
||||
|
||||
if (!zdev)
|
||||
return 0;
|
||||
@ -72,15 +93,27 @@ static int pci_perf_show(struct seq_file *m, void *v)
|
||||
seq_printf(m, "Samples: %u\n", zdev->fmb->samples);
|
||||
seq_printf(m, "Last update TOD: %Lx\n", zdev->fmb->last_update);
|
||||
|
||||
/* hardware counters */
|
||||
stat = (u64 *) &zdev->fmb->ld_ops;
|
||||
for (i = 0; i < 4; i++)
|
||||
seq_printf(m, "%26s:\t%llu\n",
|
||||
pci_perf_names[i], *(stat + i));
|
||||
if (zdev->fmb->dma_valid)
|
||||
for (i = 4; i < 6; i++)
|
||||
seq_printf(m, "%26s:\t%llu\n",
|
||||
pci_perf_names[i], *(stat + i));
|
||||
pci_fmb_show(m, pci_common_names, ARRAY_SIZE(pci_common_names),
|
||||
&zdev->fmb->ld_ops);
|
||||
|
||||
switch (zdev->fmb->format) {
|
||||
case 0:
|
||||
if (!(zdev->fmb->fmt_ind & ZPCI_FMB_DMA_COUNTER_VALID))
|
||||
break;
|
||||
pci_fmb_show(m, pci_fmt0_names, ARRAY_SIZE(pci_fmt0_names),
|
||||
&zdev->fmb->fmt0.dma_rbytes);
|
||||
break;
|
||||
case 1:
|
||||
pci_fmb_show(m, pci_fmt1_names, ARRAY_SIZE(pci_fmt1_names),
|
||||
&zdev->fmb->fmt1.rx_bytes);
|
||||
break;
|
||||
case 2:
|
||||
pci_fmb_show(m, pci_fmt2_names, ARRAY_SIZE(pci_fmt2_names),
|
||||
&zdev->fmb->fmt2.consumed_work_units);
|
||||
break;
|
||||
default:
|
||||
seq_puts(m, "Unknown format\n");
|
||||
}
|
||||
|
||||
pci_sw_counter_show(m);
|
||||
mutex_unlock(&zdev->lock);
|
||||
|
Loading…
Reference in New Issue
Block a user