s390x fixes for 2.5-rc3
PATCH 3/4 s390x: no deprecation warning while testing
In reply to Cornelia Huck'make check' tries to start all available machines; the deprecation message for the s390-virtio machine is both useless and annoying there. Silence it while testing.
--- hw/s390x/s390-virtio.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
hw/s390x/s390-virtio.c +6 -3
@@ -33,6 +33,7 @@#include "hw/virtio/virtio.h" #include "sysemu/kvm.h" #include "exec/address-spaces.h" +#include "sysemu/qtest.h" #include "hw/s390x/s390-virtio-bus.h" #include "hw/s390x/sclp.h"
@@ -268,9 +269,11 @@ static void s390_init(MachineState *machine)hwaddr virtio_region_len;hwaddr virtio_region_start; -error_printf ("WARNING\n" -"The s390-virtio machine (non-ccw) is deprecated.\n" -"It will be removed in 2.6. Please use s390-ccw-virtio\n" ); +if (!qtest_enabled ()) { +error_printf ("WARNING\n" +"The s390-virtio machine (non-ccw) is deprecated.\n" +"It will be removed in 2.6. Please use s390-ccw-virtio\n" ); + }if (machine->ram_slots) {error_report ("Memory hotplug not supported by the selected machine." );
Signature · 1 line
2.6.3
cover s390x fixes for 2.5-rc3
Last round of s390x fixes for 2.5:
- The bios should be built for the first z machine, so that newer instructions don't creep in.
- Silence annoying message when running make check.
- Fix a problem with the pci iommu exposed by recent changes.
Christian Borntraeger (1):
pc-bios/s390-ccw: build for z900
Cornelia Huck (2):
pc-bios/s390-ccw: rebuild image
s390x: no deprecation warning while testing
Yi Min Zhao (1):
s390x/pci: fix up IOMMU size
hw/s390x/s390-pci-bus.c | 26 ++++++++++++++++++++++---- hw/s390x/s390-pci-bus.h | 2 ++ hw/s390x/s390-pci-inst.c | 7 ++++++- hw/s390x/s390-virtio.c | 9 ++++++--- pc-bios/s390-ccw.img | Bin 17760 -> 17760 bytes pc-bios/s390-ccw/Makefile | 2 +- 6 files changed, 37 insertions(+), 9 deletions(-)
Signature · 1 line
2.6.3
PATCH 1/4 pc-bios/s390-ccw: build for z900
From: Christian Borntraeger <[email protected]>
Newer distributions have an architecture level set to z9, z196 or similar - also as default option for the compiler.
We should build the bios for z900 to allow it to run with all 64bit CPUs. This will become more important as soon as QEMU/KVM does support CPU models.
--- pc-bios/s390-ccw/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/Makefile +1 -1
@@ -10,7 +10,7 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw) .PHONY : all clean build-all OBJECTS = start.o main.o bootmap.o sclp-ascii.o virtio.o -CFLAGS += -fPIE -fno-stack-protector -ffreestanding +CFLAGS += -fPIE -fno-stack-protector -ffreestanding -march=z900 CFLAGS += -fno-delete-null-pointer-checks -msoft-float LDFLAGS += -Wl,-pie -nostdlib
Signature · 1 line
2.6.3
PATCH 4/4 s390x/pci: fix up IOMMU size
In reply to Cornelia HuckFrom: Yi Min Zhao <[email protected]>
Present code uses @size==UINT64_MAX to initialize IOMMU. It infers that it can map any 64-bit IOVA whatsoever. But in fact, the largest DMA range for each PCI Device on s390x is from ZPCI_SDMA_ADDR to ZPCI_EDMA_ADDR. The largest value is returned from hardware, which is to indicate the largest range hardware can support. But the real IOMMU size for specific PCI Device is obtained once qemu intercepts mpcifc instruction that guest is requesting a DMA range for that PCI Device. Therefore, before intercepting mpcifc instruction, qemu cannot be aware of the size of IOMMU region that guest will use.
Moreover, iommu replay during device initialization for the whole region in 4k steps takes a very long time.
In conclusion, this patch intializes IOMMU region for each PCI Device when intercept mpcifc instruction which is to register DMA range for the PCI Device. And then, destroy IOMMU region when guest wants to deregister IOAT.
--- hw/s390x/s390-pci-bus.c | 26 ++++++++++++++++++++++---- hw/s390x/s390-pci-bus.h | 2 ++ hw/s390x/s390-pci-inst.c | 7 ++++++- 3 files changed, 30 insertions(+), 5 deletions(-)
hw/s390x/s390-pci-bus.c +22 -4
@@ -308,7 +308,7 @@ static IOMMUTLBEntry s390_translate_iommu(MemoryRegion *iommu, hwaddr addr, {uint64_t pte;uint32_t flags; -S390PCIBusDevice *pbdev =container_of (iommu, S390PCIBusDevice, mr); +S390PCIBusDevice *pbdev =container_of (iommu, S390PCIBusDevice, iommu_mr);S390pciState *s;IOMMUTLBEntry ret = { .target_as = &address_space_memory,
@@ -454,14 +454,32 @@ static const MemoryRegionOps s390_msi_ctrl_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; +void s390_pcihost_iommu_configure (S390PCIBusDevice *pbdev,bool enable) +{ + pbdev->configured = false; + +if (enable) { +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); + }else { +memory_region_del_subregion (&pbdev->mr, &pbdev->iommu_mr); + } + + pbdev->configured = true; +} +static void s390_pcihost_init_as (S390pciState *s) {int i; +S390PCIBusDevice *pbdev;for (i =0 ; i <PCI_SLOT_MAX ; i++) { -memory_region_init_iommu (&s->pbdev[i].mr,OBJECT (s), - &s390_iommu_ops,"iommu-s390" ,UINT64_MAX ); -address_space_init (&s->pbdev[i].as, &s->pbdev[i].mr,"iommu-pci" ); + pbdev = &s->pbdev[i]; +memory_region_init (&pbdev->mr,OBJECT (s), +"iommu-root-s390" ,UINT64_MAX ); +address_space_init (&pbdev->as, &pbdev->mr,"iommu-pci" ); } memory_region_init_io(&s->msix_notify_mr, OBJECT(s),
hw/s390x/s390-pci-bus.h +2 -0
@@ -231,6 +231,7 @@ typedef struct S390PCIBusDevice {AdapterRoutes routes;AddressSpace as;MemoryRegion mr; +MemoryRegion iommu_mr; } S390PCIBusDevice; typedef struct S390pciState {
@@ -244,6 +245,7 @@ typedef struct S390pciState {int chsc_sei_nt2_get_event (void *res);int chsc_sei_nt2_have_event (void );void s390_pci_sclp_configure (int configure,SCCB *sccb); +void s390_pcihost_iommu_configure (S390PCIBusDevice *pbdev,bool enable);S390PCIBusDevice *s390_pci_find_dev_by_idx (uint32_t idx);S390PCIBusDevice *s390_pci_find_dev_by_fh (uint32_t fh);S390PCIBusDevice *s390_pci_find_dev_by_fid (uint32_t fid);
hw/s390x/s390-pci-inst.c +6 -1
@@ -528,7 +528,7 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2) goto out; } - mr =pci_device_iommu_address_space (pbdev->pdev)->root; + mr = &pbdev->iommu_mr;while (start < end) { entry = mr->iommu_ops->translate (mr, start,0 );
@@ -689,6 +689,9 @@ static int reg_ioat(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib fib) pbdev->pba = pba; pbdev->pal = pal; pbdev->g_iota = g_iota; + +s390_pcihost_iommu_configure (pbdev, true); +return 0 ; }
@@ -697,6 +700,8 @@ static void dereg_ioat(S390PCIBusDevice *pbdev) pbdev->pba =0 ; pbdev->pal =0 ; pbdev->g_iota =0 ; + +s390_pcihost_iommu_configure (pbdev, false); }int mpcifc_service_call (S390CPU *cpu,uint8_t r1,uint64_t fiba,uint8_t ar)
Signature · 1 line
2.6.3
PATCH 2/4 pc-bios/s390-ccw: rebuild image
In reply to Cornelia HuckContains:
- pc-bios/s390-ccw: build for z900
--- pc-bios/s390-ccw.img | Bin 17760 -> 17760 bytes 1 file changed, 0 insertions(+), 0 deletions(-)
pc-bios/s390-ccw.img binary +0 -0
Signature · 1 line
2.6.3
Re: [Qemu-devel] [PATCH for-2.5 3/4] s390x: no deprecation warning while testing
In reply to Cornelia HuckQuoted 6 lines · Cornelia Huck
'make check' tries to start all available machines; the deprecation message for the s390-virtio machine is both useless and annoying there. Silence it while testing.
Reported-by Michael S. Tsirkin <[email protected]>Signed-off-by Cornelia Huck <[email protected]>
Quoted 32 lines
--- hw/s390x/s390-virtio.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)hw/s390x/s390-virtio.c +6
-3@@ -33,6 +33,7 @@#include "hw/virtio/virtio.h" #include "sysemu/kvm.h" #include "exec/address-spaces.h" +#include "sysemu/qtest.h" #include "hw/s390x/s390-virtio-bus.h" #include "hw/s390x/sclp.h" @@ -268,9 +269,11 @@ static void s390_init(MachineState *machine)hwaddr virtio_region_len;hwaddr virtio_region_start; -error_printf ("WARNING\n" -"The s390-virtio machine (non-ccw) is deprecated.\n" -"It will be removed in 2.6. Please use s390-ccw-virtio\n" ); +if (!qtest_enabled ()) { +error_printf ("WARNING\n" +"The s390-virtio machine (non-ccw) is deprecated.\n" +"It will be removed in 2.6. Please use s390-ccw-virtio\n" ); + }if (machine->ram_slots) {error_report ("Memory hotplug not supported by the selected machine." );
Re: [Qemu-devel] [PATCH for-2.5 3/4] s390x: no deprecation warning while testing
In reply to Cornelia HuckQuoted 6 lines · Cornelia Huck
'make check' tries to start all available machines; the deprecation message for the s390-virtio machine is both useless and annoying there. Silence it while testing.
Reported-by Michael S. Tsirkin <[email protected]>Signed-off-by Cornelia Huck <[email protected]>
Quoted 34 lines
--- hw/s390x/s390-virtio.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)hw/s390x/s390-virtio.c +6
-3@@ -33,6 +33,7 @@#include "hw/virtio/virtio.h" #include "sysemu/kvm.h" #include "exec/address-spaces.h" +#include "sysemu/qtest.h" #include "hw/s390x/s390-virtio-bus.h" #include "hw/s390x/sclp.h" @@ -268,9 +269,11 @@ static void s390_init(MachineState *machine)hwaddr virtio_region_len;hwaddr virtio_region_start; -error_printf ("WARNING\n" -"The s390-virtio machine (non-ccw) is deprecated.\n" -"It will be removed in 2.6. Please use s390-ccw-virtio\n" ); +if (!qtest_enabled ()) { +error_printf ("WARNING\n" +"The s390-virtio machine (non-ccw) is deprecated.\n" +"It will be removed in 2.6. Please use s390-ccw-virtio\n" ); + }if (machine->ram_slots) {error_report ("Memory hotplug not supported by the selected machine." );Signature · 1 line
2.6.3