Skip to contentSkip to conversation

s390x/pci: add common fmb

RFC PATCH In review Yi Min Zhao 2 participants 4 messages Apr 27, 2018

lore
Share & tools
lore
#0 lore raw

cover s390x/pci: add common fmb

Currently the code misses FMB functionality. This patch fixup this. Only common FMB is supported now.

bb/zyimin/fmb

Yi Min Zhao (1):
s390x/pci: add common fmb

 hw/s390x/s390-pci-bus.c  |  3 ++-
 hw/s390x/s390-pci-bus.h  | 16 +++++++++++++
 hw/s390x/s390-pci-inst.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++-
 hw/s390x/s390-pci-inst.h |  1 +
 4 files changed, 78 insertions(+), 2 deletions(-)
Signature · 1 line
2.15.1 (Apple Git-101)
#1 lore raw

RFC PATCH 1/1 s390x/pci: add common fmb

Common function measurement block is used to report counters of successfully issued pcilg/stg/stb and rpcit instructions. This patch introduces a new struct ZpciFmb and schedules a timer callback to copy fmb to the guest memory at a interval time which is set to 4000ms by default. While attemping to update fmb failed, an event error would be generated. After pcilg/stg/stb and rpcit interception handlers issue successfully, increase the related counter.

---
 hw/s390x/s390-pci-bus.c  |  3 ++-
 hw/s390x/s390-pci-bus.h  | 16 +++++++++++++
 hw/s390x/s390-pci-inst.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++-
 hw/s390x/s390-pci-inst.h |  1 +
 4 files changed, 78 insertions(+), 2 deletions(-)
hw/s390x/s390-pci-bus.c +2 -1
index 10da87458e..62e121dcf6 100644
@@ -967,6 +967,7 @@ static void s390_pcihost_hot_unplug(HotplugHandler *hotplug_dev,
     bus = pci_get_bus(pci_dev);
     devfn = pci_dev->devfn;
     object_unparent(OBJECT(pci_dev));
+    s390_pci_fmb_free(pbdev);
     s390_pci_msix_free(pbdev);
     s390_pci_iommu_free(s, bus, devfn);
     pbdev->pdev = NULL;
@@ -1139,7 +1140,7 @@ static void s390_pci_device_reset(DeviceState *dev)
         pci_dereg_ioat(pbdev->iommu);
     }
 
-    pbdev->fmb_addr = 0;
+    s390_pci_fmb_free(pbdev);
 }
 
 static void s390_pci_get_fid(Object *obj, Visitor *v, const char *name,
hw/s390x/s390-pci-bus.h +16 -0
index 1f7f9b5814..c280dfaacc 100644
@@ -286,6 +286,20 @@ typedef struct S390PCIIOMMUTable {
     S390PCIIOMMU *iommu[PCI_SLOT_MAX];
 } S390PCIIOMMUTable;
 
+/* Function Measurement Block */
+#define DEFAULT_MUI 4000
+#define UPDATE_TIME_MASK (~0x1ULL)
+typedef struct ZpciFmb {
+    uint32_t format  : 8;
+    uint32_t fmt_ind : 24;
+    uint32_t sample;
+    uint64_t last_update;
+    uint64_t ld_ops;
+    uint64_t st_ops;
+    uint64_t stb_ops;
+    uint64_t rpcit_ops;
+} QEMU_PACKED ZpciFmb;
+
 struct S390PCIBusDevice {
     DeviceState qdev;
     PCIDevice *pdev;
@@ -297,6 +311,8 @@ struct S390PCIBusDevice {
     uint32_t fid;
     bool fid_defined;
     uint64_t fmb_addr;
+    ZpciFmb fmb;
+    QEMUTimer *fmb_timer;
     uint8_t isc;
     uint16_t noi;
     uint16_t maxstbl;
hw/s390x/s390-pci-inst.c +59 -1

108 lines not on this page · raw message

hw/s390x/s390-pci-inst.h +1 -0
index 91c3d61f2a..579fc55255 100644
@@ -303,6 +303,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar,
                         uintptr_t ra);
 int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar,
                          uintptr_t ra);
+void s390_pci_fmb_free(S390PCIBusDevice *pbdev);
 
 #define ZPCI_IO_BAR_MIN 0
 #define ZPCI_IO_BAR_MAX 5
Signature · 1 line
2.15.1 (Apple Git-101)
#2 lore raw
In reply to Yi Min Zhao

Wrong operation. Please ignore this series.

Quoted 14 lines · Yi Min Zhao

Currently the code misses FMB functionality. This patch fixup this. Only common FMB is supported now.

bb/zyimin/fmb

Yi Min Zhao (1):

   s390x/pci: add common fmb
  hw/s390x/s390-pci-bus.c  |  3 ++-
  hw/s390x/s390-pci-bus.h  | 16 +++++++++++++
  hw/s390x/s390-pci-inst.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++-
  hw/s390x/s390-pci-inst.h |  1 +
  4 files changed, 78 insertions(+), 2 deletions(-)
#3 lore raw
In reply to Yi Min Zhao
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [RFC PATCH 0/1] s390x/pci: add common fmb

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
72e2d3f30c s390x/pci: add common fmb

=== OUTPUT BEGIN ===
Checking PATCH 1/1: s390x/pci: add common fmb...
ERROR: spaces prohibited around that ':' (ctx:WxW) #50: FILE: hw/s390x/s390-pci-bus.h:293:

+    uint32_t format  : 8;
                      ^

ERROR: spaces prohibited around that ':' (ctx:WxW) #51: FILE: hw/s390x/s390-pci-bus.h:294:

+    uint32_t fmt_ind : 24;
                      ^

ERROR: code indent should never use tabs
#185: FILE: hw/s390x/s390-pci-inst.c:1084:
+^I^I^I fmb_update, pbdev);$

total: 3 errors, 0 warnings, 158 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]