[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 16/20] s390x/pci: introduce S390PCIBusDevice.iommu_en
From: |
Cornelia Huck |
Subject: |
[Qemu-devel] [PULL 16/20] s390x/pci: introduce S390PCIBusDevice.iommu_enabled |
Date: |
Tue, 17 May 2016 16:46:13 +0200 |
From: Yi Min Zhao <address@hidden>
We introduce iommu_enabled field for S390PCIBusDevice struct to
track whether the iommu has been enabled for the device. This allows
us to stop temporarily changing ->configured while en/disabling the
iommu and to do conditional cleanup later.
Signed-off-by: Yi Min Zhao <address@hidden>
Reviewed-by: Pierre Morel <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
hw/s390x/s390-pci-bus.c | 9 ++++-----
hw/s390x/s390-pci-bus.h | 1 +
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index b934fc8..5d54c73 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -340,7 +340,8 @@ static IOMMUTLBEntry s390_translate_iommu(MemoryRegion
*iommu, hwaddr addr,
.perm = IOMMU_NONE,
};
- if (!pbdev->configured || !pbdev->pdev || !(pbdev->fh & FH_ENABLED)) {
+ if (!pbdev->configured || !pbdev->pdev ||
+ !(pbdev->fh & FH_ENABLED) || !pbdev->iommu_enabled) {
return ret;
}
@@ -480,21 +481,19 @@ static const MemoryRegionOps s390_msi_ctrl_ops = {
void s390_pci_iommu_enable(S390PCIBusDevice *pbdev)
{
- pbdev->configured = false;
uint64_t size = pbdev->pal - pbdev->pba + 1;
memory_region_init_iommu(&pbdev->iommu_mr, OBJECT(&pbdev->mr),
&s390_iommu_ops, "iommu-s390", size);
memory_region_add_subregion(&pbdev->mr, pbdev->pba, &pbdev->iommu_mr);
- pbdev->configured = true;
+ pbdev->iommu_enabled = true;
}
void s390_pci_iommu_disable(S390PCIBusDevice *pbdev)
{
- pbdev->configured = false;
memory_region_del_subregion(&pbdev->mr, &pbdev->iommu_mr);
object_unparent(OBJECT(&pbdev->iommu_mr));
- pbdev->configured = true;
+ pbdev->iommu_enabled = false;
}
static void s390_pcihost_init_as(S390pciState *s)
diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h
index 426f690..8b64884 100644
--- a/hw/s390x/s390-pci-bus.h
+++ b/hw/s390x/s390-pci-bus.h
@@ -219,6 +219,7 @@ typedef struct S390PCIBusDevice {
bool configured;
bool error_state;
bool lgstg_blocked;
+ bool iommu_enabled;
uint32_t fh;
uint32_t fid;
uint64_t g_iota;
--
2.8.2
- [Qemu-devel] [PULL 06/20] s390x/ipl: Add ssid field to IplParameterBlock, (continued)
- [Qemu-devel] [PULL 02/20] s390x: enable runtime instrumentation, Cornelia Huck, 2016/05/17
- [Qemu-devel] [PULL 03/20] s390x/ipl: Extend the IplParameterBlock struct, Cornelia Huck, 2016/05/17
- [Qemu-devel] [PULL 17/20] s390x/pci: fix s390_pci_sclp_deconfigure, Cornelia Huck, 2016/05/17
- [Qemu-devel] [PULL 16/20] s390x/pci: introduce S390PCIBusDevice.iommu_enabled,
Cornelia Huck <=
- [Qemu-devel] [PULL 11/20] hw/char: QOM'ify sclpconsole.c, Cornelia Huck, 2016/05/17
- [Qemu-devel] [PULL 08/20] s390-ccw.img: rebuild image, Cornelia Huck, 2016/05/17
- Re: [Qemu-devel] [PULL 00/20] First round of s390x patches for 2.7, Peter Maydell, 2016/05/17