Skip to content

Commit 92bce97

Browse files
niklas88joergroedel
authored andcommitted
s390/pci: Fix reset of IOMMU software counters
Together with enabling the Function Measurement Block zpci_fmb_enable_device() also resets the software counters. This allows to use "echo 0 > /sys/kernel/debug/pci/<dev>/statistics" followed by echo "1 > /../statistics" to reset all counters. In commit c76c067 ("s390/pci: Use dma-iommu layer") this use of the now obsolete counters in struct zpci_device was missed as was their removal. Fix this by resetting the new counters and removing the old ones. Fixes: c76c067 ("s390/pci: Use dma-iommu layer") Signed-off-by: Niklas Schnelle <[email protected]> Reviewed-by: Matthew Rosato <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 9f5b681 commit 92bce97

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

arch/s390/include/asm/pci.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,6 @@ struct zpci_dev {
173173
struct zpci_fmb *fmb;
174174
u16 fmb_update; /* update interval */
175175
u16 fmb_length;
176-
/* software counters */
177-
atomic64_t allocated_pages;
178-
atomic64_t mapped_pages;
179-
atomic64_t unmapped_pages;
180176

181177
u8 version;
182178
enum pci_bus_speed max_bus_speed;

arch/s390/pci/pci.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ int zpci_unregister_ioat(struct zpci_dev *zdev, u8 dmaas)
157157
int zpci_fmb_enable_device(struct zpci_dev *zdev)
158158
{
159159
u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, ZPCI_MOD_FC_SET_MEASURE);
160+
struct zpci_iommu_ctrs *ctrs;
160161
struct zpci_fib fib = {0};
161162
u8 cc, status;
162163

@@ -169,9 +170,15 @@ int zpci_fmb_enable_device(struct zpci_dev *zdev)
169170
WARN_ON((u64) zdev->fmb & 0xf);
170171

171172
/* reset software counters */
172-
atomic64_set(&zdev->allocated_pages, 0);
173-
atomic64_set(&zdev->mapped_pages, 0);
174-
atomic64_set(&zdev->unmapped_pages, 0);
173+
ctrs = zpci_get_iommu_ctrs(zdev);
174+
if (ctrs) {
175+
atomic64_set(&ctrs->mapped_pages, 0);
176+
atomic64_set(&ctrs->unmapped_pages, 0);
177+
atomic64_set(&ctrs->global_rpcits, 0);
178+
atomic64_set(&ctrs->sync_map_rpcits, 0);
179+
atomic64_set(&ctrs->sync_rpcits, 0);
180+
}
181+
175182

176183
fib.fmb_addr = virt_to_phys(zdev->fmb);
177184
fib.gd = zdev->gisa;

0 commit comments

Comments
 (0)