From 3be5c2078bcf3ba1084cd90a191e93cb7ade18a2 Mon Sep 17 00:00:00 2001 From: Yi Min Zhao Date: Mon, 14 Dec 2015 16:50:44 +0800 Subject: s390x/pci: reject some operations to disabled PCI function According to the s390 architecture, any mpcifc, pcilg, pcistg, pcistb and rpcit instructions issued to disabled PCI functions are rejected, and the instruction completes by setting condition code 3. In addition, any DMA and MSIX interruption operations are ignored. Signed-off-by: Yi Min Zhao Reviewed-by: Cornelia Huck Signed-off-by: Cornelia Huck --- hw/s390x/s390-pci-bus.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'hw/s390x/s390-pci-bus.c') diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 8de35ffa05..132588b758 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -317,7 +317,7 @@ static IOMMUTLBEntry s390_translate_iommu(MemoryRegion *iommu, hwaddr addr, .perm = IOMMU_NONE, }; - if (!pbdev->configured || !pbdev->pdev) { + if (!pbdev->configured || !pbdev->pdev || !(pbdev->fh & FH_ENABLED)) { return ret; } @@ -428,6 +428,10 @@ static void s390_msi_ctrl_write(void *opaque, hwaddr addr, uint64_t data, return; } + if (!(pbdev->fh & FH_ENABLED)) { + return; + } + ind_bit = pbdev->routes.adapter.ind_offset; sum_bit = pbdev->routes.adapter.summary_offset; -- cgit v1.2.3