aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/s390x/s390-pci-bus.c25
-rw-r--r--hw/s390x/s390-pci-inst.c48
-rw-r--r--hw/s390x/trace-events17
3 files changed, 44 insertions, 46 deletions
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 02751f3597..2ca36f9f3b 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -27,16 +27,7 @@
#include "sysemu/reset.h"
#include "sysemu/runstate.h"
-#ifndef DEBUG_S390PCI_BUS
-#define DEBUG_S390PCI_BUS 0
-#endif
-
-#define DPRINTF(fmt, ...) \
- do { \
- if (DEBUG_S390PCI_BUS) { \
- fprintf(stderr, "S390pci-bus: " fmt, ## __VA_ARGS__); \
- } \
- } while (0)
+#include "trace.h"
S390pciState *s390_get_phb(void)
{
@@ -132,7 +123,7 @@ void s390_pci_sclp_configure(SCCB *sccb)
uint16_t rc;
if (!pbdev) {
- DPRINTF("sclp config no dev found\n");
+ trace_s390_pci_sclp_nodev("configure", be32_to_cpu(psccb->aid));
rc = SCLP_RC_ADAPTER_ID_NOT_RECOGNIZED;
goto out;
}
@@ -199,7 +190,7 @@ void s390_pci_sclp_deconfigure(SCCB *sccb)
uint16_t rc;
if (!pbdev) {
- DPRINTF("sclp deconfig no dev found\n");
+ trace_s390_pci_sclp_nodev("deconfigure", be32_to_cpu(psccb->aid));
rc = SCLP_RC_ADAPTER_ID_NOT_RECOGNIZED;
goto out;
}
@@ -573,7 +564,7 @@ static IOMMUTLBEntry s390_translate_iommu(IOMMUMemoryRegion *mr, hwaddr addr,
return ret;
}
- DPRINTF("iommu trans addr 0x%" PRIx64 "\n", addr);
+ trace_s390_pci_iommu_xlate(addr);
if (addr < iommu->pba || addr > iommu->pal) {
error = ERR_EVENT_OORANGE;
@@ -692,8 +683,8 @@ static void s390_msi_ctrl_write(void *opaque, hwaddr addr, uint64_t data,
uint32_t sum_bit;
assert(pbdev);
- DPRINTF("write_msix data 0x%" PRIx64 " idx %d vec 0x%x\n", data,
- pbdev->idx, vec);
+
+ trace_s390_pci_msi_ctrl_write(data, pbdev->idx, vec);
if (pbdev->state != ZPCI_FS_ENABLED) {
return;
@@ -843,7 +834,7 @@ static void s390_pcihost_realize(DeviceState *dev, Error **errp)
PCIHostState *phb = PCI_HOST_BRIDGE(dev);
S390pciState *s = S390_PCI_HOST_BRIDGE(dev);
- DPRINTF("host_init\n");
+ trace_s390_pcihost("realize");
b = pci_register_root_bus(dev, NULL, s390_pci_set_irq, s390_pci_map_irq,
NULL, get_system_memory(), get_system_io(), 0,
@@ -1120,7 +1111,7 @@ static void s390_pcihost_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
return;
}
} else {
- DPRINTF("zPCI interpretation facilities missing.\n");
+ trace_s390_pcihost("zPCI interpretation missing");
pbdev->interp = false;
pbdev->forwarding_assist = false;
}
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index 8f84ac6251..30149546c0 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -23,16 +23,7 @@
#include "hw/s390x/s390-pci-vfio.h"
#include "hw/s390x/tod.h"
-#ifndef DEBUG_S390PCI_INST
-#define DEBUG_S390PCI_INST 0
-#endif
-
-#define DPRINTF(fmt, ...) \
- do { \
- if (DEBUG_S390PCI_INST) { \
- fprintf(stderr, "s390pci-inst: " fmt, ## __VA_ARGS__); \
- } \
- } while (0)
+#include "trace.h"
static inline void inc_dma_avail(S390PCIIOMMU *iommu)
{
@@ -133,8 +124,7 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc)
g_l2 += sizeof(ClpFhListEntry);
/* Add endian check for DPRINTF? */
- DPRINTF("g_l2 %d vendor id 0x%x device id 0x%x fid 0x%x fh 0x%x\n",
- g_l2,
+ trace_s390_pci_list_entry(g_l2,
lduw_p(&rrb->response.fh_list[i].vendor_id),
lduw_p(&rrb->response.fh_list[i].device_id),
ldl_p(&rrb->response.fh_list[i].fid),
@@ -153,7 +143,7 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc)
stw_p(&rrb->response.hdr.rsp, CLP_RC_OK);
out:
if (rc) {
- DPRINTF("list pci failed rc 0x%x\n", rc);
+ trace_s390_pci_list(rc);
stw_p(&rrb->response.hdr.rsp, res_code);
}
return rc;
@@ -280,7 +270,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
stw_p(&ressetpci->hdr.rsp, CLP_RC_OK);
break;
default:
- DPRINTF("unknown set pci command\n");
+ trace_s390_pci_unknown("set-pci", reqsetpci->oc);
stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP);
break;
}
@@ -292,7 +282,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
pbdev = s390_pci_find_dev_by_fh(s, ldl_p(&reqquery->fh));
if (!pbdev) {
- DPRINTF("query pci no pci dev\n");
+ trace_s390_pci_nodev("query", ldl_p(&reqquery->fh));
stw_p(&resquery->hdr.rsp, CLP_RC_SETPCIFN_FH);
goto out;
}
@@ -317,7 +307,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
stl_p(&resquery->bar[i], data);
resquery->bar_size[i] = pbdev->pdev->io_regions[i].size ?
ctz64(pbdev->pdev->io_regions[i].size) : 0;
- DPRINTF("bar %d addr 0x%x size 0x%" PRIx64 "barsize 0x%x\n", i,
+ trace_s390_pci_bar(i,
ldl_p(&resquery->bar[i]),
pbdev->pdev->io_regions[i].size,
resquery->bar_size[i]);
@@ -351,7 +341,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
break;
}
default:
- DPRINTF("unknown clp command\n");
+ trace_s390_pci_unknown("clp", lduw_p(&reqh->cmd));
stw_p(&resh->rsp, CLP_RC_CMD);
break;
}
@@ -459,7 +449,7 @@ int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra)
pbdev = s390_pci_find_dev_by_fh(s390_get_phb(), fh);
if (!pbdev) {
- DPRINTF("pcilg no pci dev\n");
+ trace_s390_pci_nodev("pcilg", fh);
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
}
@@ -500,7 +490,7 @@ int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra)
}
break;
default:
- DPRINTF("pcilg invalid space\n");
+ trace_s390_pci_invalid("pcilg", fh);
setcc(cpu, ZPCI_PCI_LS_ERR);
s390_set_status_code(env, r2, ZPCI_PCI_ST_INVAL_AS);
return 0;
@@ -559,7 +549,7 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra)
pbdev = s390_pci_find_dev_by_fh(s390_get_phb(), fh);
if (!pbdev) {
- DPRINTF("pcistg no pci dev\n");
+ trace_s390_pci_nodev("pcistg", fh);
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
}
@@ -608,7 +598,7 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra)
data, len);
break;
default:
- DPRINTF("pcistg invalid space\n");
+ trace_s390_pci_invalid("pcistg", fh);
setcc(cpu, ZPCI_PCI_LS_ERR);
s390_set_status_code(env, r2, ZPCI_PCI_ST_INVAL_AS);
return 0;
@@ -729,7 +719,7 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra)
pbdev = s390_pci_find_dev_by_fh(s390_get_phb(), fh);
if (!pbdev) {
- DPRINTF("rpcit no pci dev\n");
+ trace_s390_pci_nodev("rpcit", fh);
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
}
@@ -863,7 +853,7 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr,
pbdev = s390_pci_find_dev_by_fh(s390_get_phb(), fh);
if (!pbdev) {
- DPRINTF("pcistb no pci dev fh 0x%x\n", fh);
+ trace_s390_pci_nodev("pcistb", fh);
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
}
@@ -879,7 +869,7 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr,
}
if (pcias > ZPCI_IO_BAR_MAX) {
- DPRINTF("pcistb invalid space\n");
+ trace_s390_pci_invalid("pcistb", fh);
setcc(cpu, ZPCI_PCI_LS_ERR);
s390_set_status_code(env, r1, ZPCI_PCI_ST_INVAL_AS);
return 0;
@@ -971,7 +961,7 @@ static int reg_irqs(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib fib)
pbdev->noi = FIB_DATA_NOI(ldl_p(&fib.data));
pbdev->sum = FIB_DATA_SUM(ldl_p(&fib.data));
- DPRINTF("reg_irqs adapter id %d\n", pbdev->routes.adapter.adapter_id);
+ trace_s390_pci_irqs("register", pbdev->routes.adapter.adapter_id);
return 0;
out:
release_indicator(&pbdev->routes.adapter, pbdev->summary_ind);
@@ -996,7 +986,7 @@ int pci_dereg_irqs(S390PCIBusDevice *pbdev)
pbdev->noi = 0;
pbdev->sum = 0;
- DPRINTF("dereg_irqs adapter id %d\n", pbdev->routes.adapter.adapter_id);
+ trace_s390_pci_irqs("unregister", pbdev->routes.adapter.adapter_id);
return 0;
}
@@ -1139,7 +1129,7 @@ static int mpcifc_reg_int_interp(S390PCIBusDevice *pbdev, ZpciFib *fib)
rc = s390_pci_kvm_aif_enable(pbdev, fib, pbdev->forwarding_assist);
if (rc) {
- DPRINTF("Failed to enable interrupt forwarding\n");
+ trace_s390_pci_kvm_aif("enable");
return rc;
}
@@ -1152,7 +1142,7 @@ static int mpcifc_dereg_int_interp(S390PCIBusDevice *pbdev, ZpciFib *fib)
rc = s390_pci_kvm_aif_disable(pbdev);
if (rc) {
- DPRINTF("Failed to disable interrupt forwarding\n");
+ trace_s390_pci_kvm_aif("disable");
return rc;
}
@@ -1185,7 +1175,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar,
pbdev = s390_pci_find_dev_by_fh(s390_get_phb(), fh);
if (!pbdev) {
- DPRINTF("mpcifc no pci dev fh 0x%x\n", fh);
+ trace_s390_pci_nodev("mpcifc", fh);
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
}
diff --git a/hw/s390x/trace-events b/hw/s390x/trace-events
index 8b9213eab9..34da5ea323 100644
--- a/hw/s390x/trace-events
+++ b/hw/s390x/trace-events
@@ -19,3 +19,20 @@ virtio_ccw_set_ind(uint64_t ind_loc, uint8_t ind_old, uint8_t ind_new) "VIRTIO-C
s390_pci_clp_cap(const char *id, uint32_t cap) "PCI: %s: missing expected CLP capability %u"
s390_pci_clp_cap_size(const char *id, uint32_t size, uint32_t cap) "PCI: %s: bad size (%u) for CLP capability %u"
s390_pci_clp_dev_info(const char *id) "PCI: %s: cannot read vfio device info"
+
+# s390-pci-bus.c
+s390_pci_sclp_nodev(const char *str, uint32_t aid) "%s no dev found aid 0x%x"
+s390_pci_iommu_xlate(uint64_t addr) "iommu trans addr 0x%" PRIx64
+s390_pci_msi_ctrl_write(uint64_t data, uint32_t idx, uint32_t vec) "write_msix data 0x%" PRIx64 " idx %d vec 0x%x"
+s390_pcihost(const char *msg) "%s"
+
+# s390-pci-inst.c
+s390_pci_irqs(const char *str, uint32_t id) "%s irqs for adapter id %d"
+s390_pci_kvm_aif(const char *str) "Failed to %s interrupt forwarding"
+
+s390_pci_list_entry(uint32_t g_l2, uint32_t vid, uint32_t did, uint32_t fid, uint32_t fh) "g_l2 %d vendor id 0x%x device id 0x%x fid 0x%x fh 0x%x"
+s390_pci_list(uint32_t rc) "failed rc 0x%x"
+s390_pci_unknown(const char *msg, uint32_t cmd) "%s unknown command 0x%x"
+s390_pci_bar(uint32_t bar, uint32_t addr, uint64_t size, uint32_t barsize) "bar %d addr 0x%x size 0x%" PRIx64 "barsize 0x%x"
+s390_pci_nodev(const char *cmd, uint32_t fh) "%s no pci dev fh 0x%x"
+s390_pci_invalid(const char *cmd, uint32_t fh) "%s invalid space fh 0x%x"