s390x/pci: relax I/O address translation requirement
v2 cover s390x/pci: relax I/O address translation requirement
This series introduces the concept of the relaxed translation requirement for s390x guests in order to allow bypass of the guest IOMMU for more efficient PCI passthrough.
With this series, QEMU can indicate to the guest that an IOMMU is not strictly required for a zPCI device. This would subsequently allow a guest linux to use iommu.passthrough=1 and bypass their guest IOMMU for PCI devices.
When this occurs, QEMU will note the behavior via an intercepted MPCIFC instruction and will fill the host iommu with mappings of the entire guest address space in response.
There is a kernel series that adds the relevant behavior needed to exploit this new feature from within a s390x linux guest. Most recent version of that is at [1].
[1]: https://lore.kernel.org/linux-s390/[email protected]/
Changes for v2:
- Add relax-translation property, fence for older machines
- Add a new MPCIFC failure case when direct-mapping requested but the relax-translation property is set to off.
- For direct mapping, use a memory alias to handle the SMDA offset and then just let vfio handle the pinning of memory.
Matthew Rosato (2):
s390x/pci: add support for guests that request direct mapping s390x/pci: indicate QEMU supports relaxed translation for passthrough
hw/s390x/s390-pci-bus.c | 34 +++++++++++++++++++++++++++++++-- hw/s390x/s390-pci-inst.c | 13 +++++++++++-- hw/s390x/s390-pci-vfio.c | 5 ++++- hw/s390x/s390-virtio-ccw.c | 5 +++++ include/hw/s390x/s390-pci-bus.h | 4 ++++ include/hw/s390x/s390-pci-clp.h | 1 + 6 files changed, 57 insertions(+), 5 deletions(-)
Signature · 1 line
2.47.1
PATCH v2 1/2 s390x/pci: add support for guests that request direct mapping
When receiving a guest mpcifc(4) or mpcifc(6) instruction without the T bit set, treat this as a request to perform direct mapping instead of address translation. In order to facilitate this, pin the entirety of guest memory into the host iommu.
Subsequent guest DMA operations are all expected to be of the format guest_phys+sdma, allowing them to be used as lookup into the host iommu table.
--- hw/s390x/s390-pci-bus.c | 34 +++++++++++++++++++++++++++++++-- hw/s390x/s390-pci-inst.c | 13 +++++++++++-- hw/s390x/s390-virtio-ccw.c | 5 +++++ include/hw/s390x/s390-pci-bus.h | 4 ++++ 4 files changed, 52 insertions(+), 4 deletions(-)
hw/s390x/s390-pci-bus.c +32 -2
@@ -18,6 +18,7 @@#include "hw/s390x/s390-pci-inst.h" #include "hw/s390x/s390-pci-kvm.h" #include "hw/s390x/s390-pci-vfio.h" +#include "hw/boards.h" #include "hw/pci/pci_bus.h" #include "hw/qdev-properties.h" #include "hw/pci/pci_bridge.h"
@@ -720,16 +721,43 @@ void s390_pci_iommu_enable(S390PCIIOMMU *iommu)TYPE_S390_IOMMU_MEMORY_REGION ,OBJECT (&iommu->mr), name, iommu->pal + 1); iommu->enabled = true; + iommu->direct_map = false;memory_region_add_subregion (&iommu->mr,0 ,MEMORY_REGION (&iommu->iommu_mr));g_free (name); } +void s390_pci_iommu_dm_enable (S390PCIIOMMU *iommu) +{ +MachineState *ms =MACHINE (qdev_get_machine ()); + +/* +* For direct-mapping we must map the entire guest address space. Rather +* than using an iommu, create a memory region alias that maps GPA X to +* iova X + SDMA. VFIO will handle pinning via its memory listener. +*/ + g_autofree char *name = g_strdup_printf("iommu-dm-s390-%04x", + iommu->pbdev->uid); +memory_region_init_alias (&iommu->dm_mr,OBJECT (&iommu->mr), name, ms->ram, +0 , ms->ram_size); + iommu->enabled = true; + iommu->direct_map = true; +memory_region_add_subregion (&iommu->mr, iommu->pbdev->zpci_fn.sdma, + &iommu->dm_mr); +} +void s390_pci_iommu_disable (S390PCIIOMMU *iommu) { iommu->enabled = false;g_hash_table_remove_all (iommu->iotlb); -memory_region_del_subregion (&iommu->mr,MEMORY_REGION (&iommu->iommu_mr)); -object_unparent (OBJECT (&iommu->iommu_mr)); +if (iommu->direct_map) { +memory_region_del_subregion (&iommu->mr, &iommu->dm_mr); + iommu->direct_map = false; +object_unparent (OBJECT (&iommu->dm_mr)); + }else { +memory_region_del_subregion (&iommu->mr, +MEMORY_REGION (&iommu->iommu_mr)); +object_unparent (OBJECT (&iommu->iommu_mr)); + } }static void s390_pci_iommu_free (S390pciState *s,PCIBus *bus,int32_t devfn)
@@ -1488,6 +1516,8 @@ static Property s390_pci_device_properties[] = {DEFINE_PROP_BOOL ("interpret" , S390PCIBusDevice, interp, true),DEFINE_PROP_BOOL ("forwarding-assist" , S390PCIBusDevice, forwarding_assist, true), +DEFINE_PROP_BOOL ("relaxed-translation" , S390PCIBusDevice, rtr_allowed, + true), DEFINE_PROP_END_OF_LIST(), };
hw/s390x/s390-pci-inst.c +11 -2
@@ -16,6 +16,7 @@#include "exec/memory.h" #include "qemu/error-report.h" #include "sysemu/hw_accel.h" +#include "hw/boards.h" #include "hw/pci/pci_device.h" #include "hw/s390x/s390-pci-inst.h" #include "hw/s390x/s390-pci-bus.h"
@@ -1008,17 +1009,25 @@ static int reg_ioat(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib fib, }/* currently we only support designation type 1 with translation */ -if (!(dt ==ZPCI_IOTA_RTTO && t)) { +if (t && !(dt ==ZPCI_IOTA_RTTO )) {error_report ("unsupported ioat dt %d t %d" , dt, t);s390_program_interrupt (env,PGM_OPERAND , ra);return -EINVAL ; + }else if (!t && !pbdev->rtr_allowed) { +error_report ("relaxed translation not allowed" ); +s390_program_interrupt (env,PGM_OPERAND , ra); +return -EINVAL ; } iommu->pba = pba; iommu->pal = pal; iommu->g_iota = g_iota; -s390_pci_iommu_enable (iommu); +if (t) { +s390_pci_iommu_enable (iommu); + }else { +s390_pci_iommu_dm_enable (iommu); + }return 0 ; }
hw/s390x/s390-virtio-ccw.c +5 -0
@@ -865,8 +865,13 @@ static void ccw_machine_9_2_instance_options(MachineState *machine)static void ccw_machine_9_2_class_options (MachineClass *mc) { +static GlobalProperty compat[] = { + {TYPE_S390_PCI_DEVICE ,"relaxed-translation" ,"off" , }, + }; +ccw_machine_10_0_class_options (mc);compat_props_add (mc->compat_props, hw_compat_9_2, hw_compat_9_2_len); +compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); }DEFINE_CCW_MACHINE (9 ,2 );
include/hw/s390x/s390-pci-bus.h +4 -0
@@ -277,7 +277,9 @@ struct S390PCIIOMMU {AddressSpace as;MemoryRegion mr;IOMMUMemoryRegion iommu_mr; +MemoryRegion dm_mr;bool enabled; +bool direct_map;uint64_t g_iota;uint64_t pba;uint64_t pal;
@@ -362,6 +364,7 @@ struct S390PCIBusDevice {bool interp;bool forwarding_assist;bool aif; +bool rtr_allowed;QTAILQ_ENTRY (S390PCIBusDevice) link; };
@@ -389,6 +392,7 @@ int pci_chsc_sei_nt2_have_event(void);void s390_pci_sclp_configure (SCCB *sccb);void s390_pci_sclp_deconfigure (SCCB *sccb);void s390_pci_iommu_enable (S390PCIIOMMU *iommu); +void s390_pci_iommu_dm_enable (S390PCIIOMMU *iommu);void s390_pci_iommu_disable (S390PCIIOMMU *iommu);void s390_pci_generate_error_event (uint16_t pec,uint32_t fh,uint32_t fid,uint64_t faddr,uint32_t e);
Signature · 1 line
2.47.1
Re: [PATCH v2 1/2] s390x/pci: add support for guests that request direct mapping
Hi Matthew,
Quoted 41 lines · Matthew Rosato
When receiving a guest mpcifc(4) or mpcifc(6) instruction without the T bit set, treat this as a request to perform direct mapping instead of address translation. In order to facilitate this, pin the entirety of guest memory into the host iommu.
Subsequent guest DMA operations are all expected to be of the format guest_phys+sdma, allowing them to be used as lookup into the host iommu table.
Signed-off-by Matthew Rosato <[email protected]>--- hw/s390x/s390-pci-bus.c | 34 +++++++++++++++++++++++++++++++-- hw/s390x/s390-pci-inst.c | 13 +++++++++++-- hw/s390x/s390-virtio-ccw.c | 5 +++++ include/hw/s390x/s390-pci-bus.h | 4 ++++ 4 files changed, 52 insertions(+), 4 deletions(-)hw/s390x/s390-pci-bus.c +5
-0@@ -18,6 +18,7 @@#include "hw/s390x/s390-pci-inst.h" #include "hw/s390x/s390-pci-kvm.h" #include "hw/s390x/s390-pci-vfio.h" +#include "hw/boards.h" #include "hw/pci/pci_bus.h" #include "hw/qdev-properties.h" #include "hw/pci/pci_bridge.h" @@ -720,16 +721,43 @@ void s390_pci_iommu_enable(S390PCIIOMMU *iommu)TYPE_S390_IOMMU_MEMORY_REGION ,OBJECT (&iommu->mr), name, iommu->pal + 1); iommu->enabled = true; + iommu->direct_map = false;memory_region_add_subregion (&iommu->mr,0 ,MEMORY_REGION (&iommu->iommu_mr));g_free (name); } +void s390_pci_iommu_dm_enable (S390PCIIOMMU *iommu) +{ +MachineState *ms =MACHINE (qdev_get_machine ());
hw/s390x/s390-pci-bus.c void s390_pci_iommu_enable(S390PCIIOMMU *iommu) · line 741
Quoted 10 lines
hw/s390x/s390-pci-bus.c +10
-0+ +/* +* For direct-mapping we must map the entire guest address space. Rather +* than using an iommu, create a memory region alias that maps GPA X to +* iova X + SDMA. VFIO will handle pinning via its memory listener. +*/ + g_autofree char *name = g_strdup_printf("iommu-dm-s390-%04x", + iommu->pbdev->uid); +memory_region_init_alias (&iommu->dm_mr,OBJECT (&iommu->mr), name, ms->ram, +0 , ms->ram_size);
Is it a good idea to take the whole machine ram-size here? Could it be better to pass it as qdev property?
Quoted 121 lines
hw/s390x/s390-pci-bus.c +17
-2+ iommu->enabled = true; + iommu->direct_map = true; +memory_region_add_subregion (&iommu->mr, iommu->pbdev->zpci_fn.sdma, + &iommu->dm_mr); +} +void s390_pci_iommu_disable (S390PCIIOMMU *iommu) { iommu->enabled = false;g_hash_table_remove_all (iommu->iotlb); -memory_region_del_subregion (&iommu->mr,MEMORY_REGION (&iommu->iommu_mr)); -object_unparent (OBJECT (&iommu->iommu_mr)); +if (iommu->direct_map) { +memory_region_del_subregion (&iommu->mr, &iommu->dm_mr); + iommu->direct_map = false; +object_unparent (OBJECT (&iommu->dm_mr)); + }else { +memory_region_del_subregion (&iommu->mr, +MEMORY_REGION (&iommu->iommu_mr)); +object_unparent (OBJECT (&iommu->iommu_mr)); + } }static void s390_pci_iommu_free (S390pciState *s,PCIBus *bus,int32_t devfn)@@ -1488,6 +1516,8 @@ static Property s390_pci_device_properties[] = {DEFINE_PROP_BOOL ("interpret" , S390PCIBusDevice, interp, true),DEFINE_PROP_BOOL ("forwarding-assist" , S390PCIBusDevice, forwarding_assist, true), +DEFINE_PROP_BOOL ("relaxed-translation" , S390PCIBusDevice, rtr_allowed, + true), DEFINE_PROP_END_OF_LIST(), };hw/s390x/s390-pci-inst.c +11
-2@@ -16,6 +16,7 @@#include "exec/memory.h" #include "qemu/error-report.h" #include "sysemu/hw_accel.h" +#include "hw/boards.h" #include "hw/pci/pci_device.h" #include "hw/s390x/s390-pci-inst.h" #include "hw/s390x/s390-pci-bus.h" @@ -1008,17 +1009,25 @@ static int reg_ioat(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib fib, }/* currently we only support designation type 1 with translation */ -if (!(dt ==ZPCI_IOTA_RTTO && t)) { +if (t && !(dt ==ZPCI_IOTA_RTTO )) {error_report ("unsupported ioat dt %d t %d" , dt, t);s390_program_interrupt (env,PGM_OPERAND , ra);return -EINVAL ; + }else if (!t && !pbdev->rtr_allowed) { +error_report ("relaxed translation not allowed" ); +s390_program_interrupt (env,PGM_OPERAND , ra); +return -EINVAL ; } iommu->pba = pba; iommu->pal = pal; iommu->g_iota = g_iota; -s390_pci_iommu_enable (iommu); +if (t) { +s390_pci_iommu_enable (iommu); + }else { +s390_pci_iommu_dm_enable (iommu); + }return 0 ; }hw/s390x/s390-virtio-ccw.c +5
-0@@ -865,8 +865,13 @@ static void ccw_machine_9_2_instance_options(MachineState *machine)static void ccw_machine_9_2_class_options (MachineClass *mc) { +static GlobalProperty compat[] = { + {TYPE_S390_PCI_DEVICE ,"relaxed-translation" ,"off" , }, + }; +ccw_machine_10_0_class_options (mc);compat_props_add (mc->compat_props, hw_compat_9_2, hw_compat_9_2_len); +compat_props_add (mc->compat_props, compat,G_N_ELEMENTS (compat)); }DEFINE_CCW_MACHINE (9 ,2 );include/hw/s390x/s390-pci-bus.h +4
-0@@ -277,7 +277,9 @@ struct S390PCIIOMMU {AddressSpace as;MemoryRegion mr;IOMMUMemoryRegion iommu_mr; +MemoryRegion dm_mr;bool enabled; +bool direct_map;uint64_t g_iota;uint64_t pba;uint64_t pal;@@ -362,6 +364,7 @@ struct S390PCIBusDevice {bool interp;bool forwarding_assist;bool aif; +bool rtr_allowed;QTAILQ_ENTRY (S390PCIBusDevice) link; };@@ -389,6 +392,7 @@ int pci_chsc_sei_nt2_have_event(void);void s390_pci_sclp_configure (SCCB *sccb);void s390_pci_sclp_deconfigure (SCCB *sccb);void s390_pci_iommu_enable (S390PCIIOMMU *iommu); +void s390_pci_iommu_dm_enable (S390PCIIOMMU *iommu);void s390_pci_iommu_disable (S390PCIIOMMU *iommu);void s390_pci_generate_error_event (uint16_t pec,uint32_t fh,uint32_t fid,uint64_t faddr,uint32_t e);
Re: [PATCH v2 1/2] s390x/pci: add support for guests that request direct mapping
Quoted 41 lines · Philippe Mathieu-Daudé
Hi Matthew,
Quoted 38 lines · Matthew Rosato
When receiving a guest mpcifc(4) or mpcifc(6) instruction without the T bit set, treat this as a request to perform direct mapping instead of address translation. In order to facilitate this, pin the entirety of guest memory into the host iommu.
Subsequent guest DMA operations are all expected to be of the format guest_phys+sdma, allowing them to be used as lookup into the host iommu table.
Signed-off-by Matthew Rosato <[email protected]>--- hw/s390x/s390-pci-bus.c | 34 +++++++++++++++++++++++++++++++-- hw/s390x/s390-pci-inst.c | 13 +++++++++++-- hw/s390x/s390-virtio-ccw.c | 5 +++++ include/hw/s390x/s390-pci-bus.h | 4 ++++ 4 files changed, 52 insertions(+), 4 deletions(-)hw/s390x/s390-pci-bus.c +2
-0@@ -18,6 +18,7 @@#include "hw/s390x/s390-pci-inst.h" #include "hw/s390x/s390-pci-kvm.h" #include "hw/s390x/s390-pci-vfio.h" +#include "hw/boards.h" #include "hw/pci/pci_bus.h" #include "hw/qdev-properties.h" #include "hw/pci/pci_bridge.h" @@ -720,16 +721,43 @@ void s390_pci_iommu_enable(S390PCIIOMMU *iommu)TYPE_S390_IOMMU_MEMORY_REGION ,OBJECT (&iommu->mr), name, iommu->pal + 1); iommu->enabled = true; + iommu->direct_map = false;memory_region_add_subregion (&iommu->mr,0 ,MEMORY_REGION (&iommu->iommu_mr));g_free (name); }
Quoted 16 lines
hw/s390x/s390-pci-bus.c void s390_pci_iommu_enable(S390PCIIOMMU *iommu) · line 741
Quoted 13 lines
hw/s390x/s390-pci-bus.c +13
-0+void s390_pci_iommu_dm_enable (S390PCIIOMMU *iommu) +{ +MachineState *ms =MACHINE (qdev_get_machine ()); + +/* +* For direct-mapping we must map the entire guest address space. Rather +* than using an iommu, create a memory region alias that maps GPA X to +* iova X + SDMA. VFIO will handle pinning via its memory listener. +*/ + g_autofree char *name = g_strdup_printf("iommu-dm-s390-%04x", + iommu->pbdev->uid); +memory_region_init_alias (&iommu->dm_mr,OBJECT (&iommu->mr), name, ms->ram, +0 , ms->ram_size);Is it a good idea to take the whole machine ram-size here? Could it be better to pass it as qdev property?
I think we want all guest RAM, just like ordinary vfio on !s390x without a viommu would do.
Matthew, I assume to handle virtio-mem, we would actually pass in here the result from s390_get_memory_limit(), which will cover initial+device RAM, correct? Until then, this would map initial RAM only.
Signature · 3 lines
Cheers, David / dhildenb
Re: [PATCH v2 1/2] s390x/pci: add support for guests that request direct mapping
Quoted 17 lines
Quoted 16 lines
hw/s390x/s390-pci-bus.c void s390_pci_iommu_enable(S390PCIIOMMU *iommu) · line 741
Quoted 13 lines
hw/s390x/s390-pci-bus.c +12
-0+{ + MachineState *ms = MACHINE(qdev_get_machine()); + + /* + * For direct-mapping we must map the entire guest address space. Rather + * than using an iommu, create a memory region alias that maps GPA X to + * iova X + SDMA. VFIO will handle pinning via its memory listener. + */ + g_autofree char *name = g_strdup_printf("iommu-dm-s390-%04x", + iommu->pbdev->uid); + memory_region_init_alias(&iommu->dm_mr, OBJECT(&iommu->mr), name, ms->ram, + 0, ms->ram_size);Is it a good idea to take the whole machine ram-size here? Could it be better to pass it as qdev property?
Quoted 4 lines
I think we want all guest RAM, just like ordinary vfio on !s390x without a viommu would do.
Matthew, I assume to handle virtio-mem, we would actually pass in here the result from
s390_get_memory_limit(), which will cover initial+device RAM, correct? Until then, this would map initial RAM only.
Good point. Using s390_get_memory_limit() sounds good to me; That will make v3 of this series dependent on the s390x virtio-mem series but sounds like you're sending that sometime this week anyway.
I'll start testing on top of that with something like..
memory_region_init_alias(&iommu->dm_mr, OBJECT(&iommu->mr), name, ms->ram,
0, s390_get_memory_limit(s390ms));
Re: [PATCH v2 1/2] s390x/pci: add support for guests that request direct mapping
Quoted 17 lines · Matthew Rosato
Quoted 17 lines
Quoted 16 lines
hw/s390x/s390-pci-bus.c void s390_pci_iommu_enable(S390PCIIOMMU *iommu) · line 741
Quoted 13 lines
hw/s390x/s390-pci-bus.c +12
-0+{ + MachineState *ms = MACHINE(qdev_get_machine()); + + /* + * For direct-mapping we must map the entire guest address space. Rather + * than using an iommu, create a memory region alias that maps GPA X to + * iova X + SDMA. VFIO will handle pinning via its memory listener. + */ + g_autofree char *name = g_strdup_printf("iommu-dm-s390-%04x", + iommu->pbdev->uid); + memory_region_init_alias(&iommu->dm_mr, OBJECT(&iommu->mr), name, ms->ram, + 0, ms->ram_size);Is it a good idea to take the whole machine ram-size here? Could it be better to pass it as qdev property?
Quoted 6 lines
Quoted 4 lines
I think we want all guest RAM, just like ordinary vfio on !s390x without a viommu would do.
Matthew, I assume to handle virtio-mem, we would actually pass in here the result from
s390_get_memory_limit(), which will cover initial+device RAM, correct? Until then, this would map initial RAM only.Good point. Using
s390_get_memory_limit()sounds good to me; That will make v3 of this series dependent on the s390x virtio-mem series but sounds like you're sending that sometime this week anyway.
If my testing is good and there are no further comments, I'll queue it directly (no change to v2) to send it upstream.
So it's probably a good idea to wait with a new series her.
Quoted 6 lines
I'll start testing on top of that with something like..
memory_region_init_alias(&iommu->dm_mr,
OBJECT(&iommu->mr), name,ms->ram,0, s390_get_memory_limit(s390ms));
Yes, I think so.
We discussed at some point maybe requiring disabling uncoordinated discarding of RAM (virtio-balloon), is that already done implicitly now?
Signature · 3 lines
Cheers, David / dhildenb
Re: [PATCH v2 1/2] s390x/pci: add support for guests that request direct mapping
Quoted 7 lines
Quoted 2 lines
Good point. Using
s390_get_memory_limit()sounds good to me; That will make v3 of this series dependent on the s390x virtio-mem series but sounds like you're sending that sometime this week anyway.If my testing is good and there are no further comments, I'll queue it directly (no change to v2) to send it upstream.
So it's probably a good idea to wait with a new series her.
OK
Quoted 3 lines
We discussed at some point maybe requiring disabling uncoordinated discarding of RAM (virtio-balloon), is that already done implicitly now?
Yes, this should be handled via the call to ram_block_uncoordinated_discard_disable() in vfio_ram_block_discard_disable() - I just traced that now to double-check.
Re: [PATCH v2 1/2] s390x/pci: add support for guests that request direct mapping
Quoted 8 lines · Matthew Rosato
Quoted 7 lines
Quoted 2 lines
Good point. Using
s390_get_memory_limit()sounds good to me; That will make v3 of this series dependent on the s390x virtio-mem series but sounds like you're sending that sometime this week anyway.If my testing is good and there are no further comments, I'll queue it directly (no change to v2) to send it upstream.
So it's probably a good idea to wait with a new series her.
Quoted 8 lines
OK
Quoted 3 lines
We discussed at some point maybe requiring disabling uncoordinated discarding of RAM (virtio-balloon), is that already done implicitly now?
Yes, this should be handled via the call to
ram_block_uncoordinated_discard_disable()invfio_ram_block_discard_disable()- I just traced that now to double-check.
Cool, can you briefly mention that in the patch description? Thanks!
Signature · 3 lines
Cheers, David / dhildenb
Re: [PATCH v2 1/2] s390x/pci: add support for guests that request direct mapping
Quoted 12 lines · David Hildenbrand
Quoted 11 lines · Matthew Rosato
Quoted 7 lines
Quoted 2 lines
Good point. Using
s390_get_memory_limit()sounds good to me; That will make v3 of this series dependent on the s390x virtio-mem series but sounds like you're sending that sometime this week anyway.If my testing is good and there are no further comments, I'll queue it directly (no change to v2) to send it upstream.
So it's probably a good idea to wait with a new series her.
OK
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
We discussed at some point maybe requiring disabling uncoordinated discarding of RAM (virtio-balloon), is that already done implicitly now?
Yes, this should be handled via the call to
ram_block_uncoordinated_discard_disable()invfio_ram_block_discard_disable()- I just traced that now to double-check.Cool, can you briefly mention that in the patch description? Thanks!
Sure, I'll add something like
Pinning for the direct mapping case is handled via vfio and its memory listener. Additionally, ram discard settings are inherited from vfio:
coordinated discards (e.g. virtio-mem) are allowed while uncoordinated discards (e.g. virtio-balloon) are disabled.
PATCH v2 2/2 s390x/pci: indicate QEMU supports relaxed translation for passthrough
In reply to Matthew RosatoSpecifying this bit in the guest CLP response indicates that the guest can optionally choose to skip translation and instead use identity-mapped operations.
--- hw/s390x/s390-pci-vfio.c | 5 ++++- include/hw/s390x/s390-pci-clp.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
hw/s390x/s390-pci-vfio.c +4 -1
@@ -223,8 +223,11 @@ static void s390_pci_read_group(S390PCIBusDevice *pbdev, pbdev->pci_group =s390_group_create (pbdev->zpci_fn.pfgid, start_gid); resgrp = &pbdev->pci_group->zpci_group; +if (pbdev->rtr_allowed) { + resgrp->fr |=CLP_RSP_QPCIG_MASK_RTR ; + }if (cap->flags &VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH ) { - resgrp->fr =1 ; + resgrp->fr |=CLP_RSP_QPCIG_MASK_REFRESH ; } resgrp->dasm = cap->dasm; resgrp->msia = cap->msi_addr;
include/hw/s390x/s390-pci-clp.h +1 -0
@@ -158,6 +158,7 @@ typedef struct ClpRspQueryPciGrp {#define CLP_RSP_QPCIG_MASK_NOI 0xfffuint16_t i;uint8_t version; +#define CLP_RSP_QPCIG_MASK_RTR 0x20#define CLP_RSP_QPCIG_MASK_FRAME 0x2#define CLP_RSP_QPCIG_MASK_REFRESH 0x1uint8_t fr;
Signature · 1 line
2.47.1