Re: [PATCH 21/22] s390x/s390-pci-vfio.c: use QOM casts where appropriate

2025-07-15 Thread Matthew Rosato
On 7/15/25 5:26 AM, Mark Cave-Ayland wrote: > Use QOM casts to cast to VFIOPCIDevice instead of using container_of(). > > Signed-off-by: Mark Cave-Ayland > --- > hw/s390x/s390-pci-vfio.c | 14 +++--- > 1 file changed, 7 insertions(+), 7 deletions(-) Reviewed-by: Matthew Rosato

Re: [PATCH] hw/s390x/s390-pci-bus.c: Use g_assert_not_reached() in functions taking an ett

2025-07-10 Thread Matthew Rosato
09 > Signed-off-by: Peter Maydell > --- > Disclaimer: only tested with 'make check/make check-functional' Reviewed-by: Matthew Rosato Also to sanity check I ran various tests with s390x guests and a few different PCI passthrough devices using a guest IOMMU to drive table_translate frequently.

Re: [RFC PATCH v13 4/4] s390: implementing CHSC SEI for AP config change

2025-06-30 Thread Matthew Rosato
On 6/26/25 12:19 PM, Matthew Rosato wrote: > On 6/9/25 12:44 PM, Rorie Reyes wrote: >> Handle interception of the CHSC SEI instruction for requests >> indicating the guest's AP configuration has changed. >> >> If configuring --without-default-devices, hw/s390x/ap

Re: [RFC PATCH v13 4/4] s390: implementing CHSC SEI for AP config change

2025-06-27 Thread Matthew Rosato
>> >> AFAICT this portion of the handler including mutex should be moved out of >> ap.c into chsc_sei_nt0_get_event().  When vfio_ap is not in use, we can't >> call into it.  Can't you also build without VFIO_AP?  I didn't try it but >> that sure seems like it would cause issues too. > > If t

Re: [RFC PATCH v13 4/4] s390: implementing CHSC SEI for AP config change

2025-06-26 Thread Matthew Rosato
On 6/9/25 12:44 PM, Rorie Reyes wrote: > Handle interception of the CHSC SEI instruction for requests > indicating the guest's AP configuration has changed. > > If configuring --without-default-devices, hw/s390x/ap-stub.c > was created to handle such circumstance. Also added the > following to hw/

[PATCH] MAINTAINERS: add reviewers for some s390 areas

2025-06-23 Thread Matthew Rosato
To improve review coverage, assign additional people as reviewers for multiple s390 sections. Signed-off-by: Matthew Rosato --- MAINTAINERS | 12 1 file changed, 12 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 94c4076127..3ce6fce8ce 100644 --- a/MAINTAINERS +++ b

Re: [PATCH] s390x: Clear RAM on diag308 subcode 3 reset

2025-05-14 Thread Matthew Rosato
On 5/14/25 5:32 AM, Thomas Huth wrote: > On 13/05/2025 15.42, Matthew Rosato wrote: >> On 5/13/25 2:50 AM, Christian Borntraeger wrote: >>> Am 29.04.25 um 16:09 schrieb Matthew Rosato: >>>> On 4/29/25 3:45 AM, Christian Borntraeger wrote: >>>>> A

Re: [PATCH] s390x: Clear RAM on diag308 subcode 3 reset

2025-05-13 Thread Matthew Rosato
On 5/13/25 2:50 AM, Christian Borntraeger wrote: > Am 29.04.25 um 16:09 schrieb Matthew Rosato: >> On 4/29/25 3:45 AM, Christian Borntraeger wrote: >>> Am 29.04.25 um 09:37 schrieb David Hildenbrand: >>> [...] >>>> The only problem I see is with vfio device

Re: [PATCH] s390x: Clear RAM on diag308 subcode 3 reset

2025-04-29 Thread Matthew Rosato
On 4/29/25 3:45 AM, Christian Borntraeger wrote: > Am 29.04.25 um 09:37 schrieb David Hildenbrand: > [...] >> The only problem I see is with vfio devices is the new "memory pinned" mode. >> [1] >> >> There, we'd have to check if any such device is around (discarding of ram is >> disabled?), and f

[PATCH 2/2] s390x/pci: add message for ISM without zPCI interpretation

2025-02-26 Thread Matthew Rosato
: Matthew Rosato --- hw/s390x/s390-pci-bus.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 6cc0e7538a..c41c88f88e 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1147,6 +1147,12 @@ static void s390_pcihost_plug

[PATCH 1/2] s390x/pci: fix cleanup of failed hotplug

2025-02-26 Thread Matthew Rosato
In the unlikely event that we must fail hotplug of a PCI passthrough device, ensure appropriate clean up of the associated zPCI device is performed. Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-bus.c | 21 +++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git

[PATCH 0/2] s390x/pci: changes to hotplug error handling

2025-02-26 Thread Matthew Rosato
the associated S390PCIBusDevice were not properly cleaned up. So let's fix that too. Matthew Rosato (2): s390x/pci: fix cleanup of failed hotplug s390x/pci: add message for ISM without zPCI interpretation hw/s390x/s390-pci-bus.c | 27 +-- 1 file change

[PATCH v5 2/2] s390x/pci: indicate QEMU supports relaxed translation for passthrough

2025-02-26 Thread Matthew Rosato
Specifying this bit in the guest CLP response indicates that the guest can optionally choose to skip translation and instead use identity-mapped operations. Tested-by: Niklas Schnelle Reviewed-by: Niklas Schnelle Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-vfio.c| 5

[PATCH v5 0/2] s390x/pci: relax I/O address translation requirement

2025-02-26 Thread Matthew Rosato
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 r

[PATCH v5 1/2] s390x/pci: add support for guests that request direct mapping

2025-02-26 Thread Matthew Rosato
, allowing them to be used as lookup into the host iommu table. Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-bus.c | 39 +++-- hw/s390x/s390-pci-inst.c| 13 +-- hw/s390x/s390-pci-vfio.c| 23 +++ hw/s390x/s390-virtio-ccw.c

[PATCH v4 2/2] s390x/pci: indicate QEMU supports relaxed translation for passthrough

2025-02-07 Thread Matthew Rosato
Specifying this bit in the guest CLP response indicates that the guest can optionally choose to skip translation and instead use identity-mapped operations. Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-vfio.c| 5 - include/hw/s390x/s390-pci-clp.h | 1 + 2 files changed, 5

[PATCH v4 0/2] s390x/pci: relax I/O address translation requirement

2025-02-07 Thread Matthew Rosato
ias 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 |

[PATCH v4 1/2] s390x/pci: add support for guests that request direct mapping

2025-02-07 Thread Matthew Rosato
, allowing them to be used as lookup into the host iommu table. Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-bus.c | 38 +++-- hw/s390x/s390-pci-inst.c| 13 +-- hw/s390x/s390-pci-vfio.c| 23 hw/s390x/s390-virtio

Re: [PATCH v3 1/2] s390x/pci: add support for guests that request direct mapping

2025-01-27 Thread Matthew Rosato
>> >> static void s390_pci_iommu_free(S390pciState *s, PCIBus *bus, int32_t devfn) >> @@ -1488,6 +1518,8 @@ static const Property s390_pci_device_properties[] = { >> DEFINE_PROP_BOOL("interpret", S390PCIBusDevice, interp, true), >> DEFINE_PROP_BOOL("forwarding-assist", S390PCIBusDevi

Re: [PATCH v3 1/2] s390x/pci: add support for guests that request direct mapping

2025-01-27 Thread Matthew Rosato
>>   #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

Re: [PATCH v3 1/2] s390x/pci: add support for guests that request direct mapping

2025-01-27 Thread Matthew Rosato
>>   +void s390_pci_iommu_dm_enable(S390PCIIOMMU *iommu) >> +{ >> +    MachineState *ms = MACHINE(qdev_get_machine()); >> +    S390CcwMachineState *s390ms = S390_CCW_MACHINE(ms); >> + >> +    /* >> + * For direct-mapping we must map the entire guest address space.  >> Rather >> + * than

[PATCH v3 1/2] s390x/pci: add support for guests that request direct mapping

2025-01-24 Thread Matthew Rosato
, allowing them to be used as lookup into the host iommu table. Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-bus.c | 36 +++-- hw/s390x/s390-pci-inst.c| 13 ++-- hw/s390x/s390-pci-vfio.c| 15 ++ hw/s390x/s390-virtio-ccw.c

[PATCH v3 2/2] s390x/pci: indicate QEMU supports relaxed translation for passthrough

2025-01-24 Thread Matthew Rosato
Specifying this bit in the guest CLP response indicates that the guest can optionally choose to skip translation and instead use identity-mapped operations. Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-vfio.c| 5 - include/hw/s390x/s390-pci-clp.h | 1 + 2 files changed, 5

[PATCH v3 0/2] s390x/pci: relax I/O address translation requirement

2025-01-24 Thread Matthew Rosato
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 | 36 +++-- hw/s390x/s390

Re: [PATCH v2 1/2] s390x/pci: add support for guests that request direct mapping

2024-12-16 Thread Matthew Rosato
On 12/16/24 12:29 PM, David Hildenbrand wrote: > On 16.12.24 18:26, Matthew Rosato wrote: >> >>>> 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 >>&g

Re: [PATCH v2 1/2] s390x/pci: add support for guests that request direct mapping

2024-12-16 Thread Matthew Rosato
>> 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

Re: [PATCH v2 1/2] s390x/pci: add support for guests that request direct mapping

2024-12-16 Thread Matthew Rosato
>>> +{ >>> +    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 p

[PATCH v2 2/2] s390x/pci: indicate QEMU supports relaxed translation for passthrough

2024-12-13 Thread Matthew Rosato
Specifying this bit in the guest CLP response indicates that the guest can optionally choose to skip translation and instead use identity-mapped operations. Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-vfio.c| 5 - include/hw/s390x/s390-pci-clp.h | 1 + 2 files changed, 5

[PATCH v2 1/2] s390x/pci: add support for guests that request direct mapping

2024-12-13 Thread Matthew Rosato
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 --- hw/s390x/s390-pci-bus.c | 34 +++-- hw/s390x/s390-pci-inst.c| 13 +++-- hw/s390x/s390-virtio-ccw.c | 5

[PATCH v2 0/2] s390x/pci: relax I/O address translation requirement

2024-12-13 Thread Matthew Rosato
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

Re: [PATCH 1/2] s390x/pci: add support for guests that request direct mapping

2024-12-13 Thread Matthew Rosato
On 12/10/24 3:58 AM, David Hildenbrand wrote: > Maybe there is a reason s390x needs to handle this using > memory_region_notify_iommu() callbacks instead of doing it similar to "struct > vfio_memory_listener" when registered on &address_space_memory without a > viommu. > Hi David, I think I

Re: [PATCH 0/2] s390x/pci: relax I/O address translation requirement

2024-12-12 Thread Matthew Rosato
On 12/12/24 4:10 AM, Thomas Huth wrote: > On 09/12/2024 20.29, Matthew Rosato wrote: >> 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. >> &g

Re: [PATCH 1/2] s390x/pci: add support for guests that request direct mapping

2024-12-11 Thread Matthew Rosato
On 12/11/24 9:40 AM, Cédric Le Goater wrote: > On 12/9/24 20:29, Matthew Rosato wrote: >>   static int reg_ioat(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib >> fib, >>   uintptr_t ra) >>   { >> @@ -1008,7 +1036,7 @@ stati

Re: [PATCH 1/2] s390x/pci: add support for guests that request direct mapping

2024-12-09 Thread Matthew Rosato
On 12/9/24 5:09 PM, David Hildenbrand wrote: > On 09.12.24 22:45, Matthew Rosato wrote: >> On 12/9/24 4:01 PM, David Hildenbrand wrote: >>> On 09.12.24 20:29, Matthew Rosato wrote: >>> >>> Hi, >>> >>> Trying to wrap my head around that ... y

Re: [PATCH 1/2] s390x/pci: add support for guests that request direct mapping

2024-12-09 Thread Matthew Rosato
On 12/9/24 4:01 PM, David Hildenbrand wrote: > On 09.12.24 20:29, Matthew Rosato wrote: > > Hi, > > Trying to wrap my head around that ... you mention that "pin the entirety of > guest memory". > > Do you mean that we will actually end up longterm pinn

[PATCH 0/2] s390x/pci: relax I/O address translation requirement

2024-12-09 Thread Matthew Rosato
[1] that adds the relevant behavior needed to exploit this new feature from within a s390x linux guest. [1]: https://lore.kernel.org/linux-s390/20241209192403.107090-1-mjros...@linux.ibm.com/ Matthew Rosato (2): s390x/pci: add support for guests that request direct mapping s390x/pci: indicate

[PATCH 2/2] s390x/pci: indicate QEMU supports relaxed translation for passthrough

2024-12-09 Thread Matthew Rosato
Specifying this bit in the guest CLP response indicates that the guest can optionally choose to skip translation and instead use identity-mapped operations. Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-vfio.c| 4 +++- include/hw/s390x/s390-pci-clp.h | 1 + 2 files changed, 4

[PATCH 1/2] s390x/pci: add support for guests that request direct mapping

2024-12-09 Thread Matthew Rosato
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 --- hw/s390x/s390-pci-bus.c | 23 ++ hw/s390x/s390-pci-inst.c| 42 +++-- include/hw/s390x/s390-pci-bus.h

Re: [PATCH for-9.2 v15 04/11] s390x/pci: Check for multifunction after device realization

2024-09-11 Thread Matthew Rosato
On 9/11/24 11:15 AM, Akihiko Odaki wrote: > On 2024/09/11 22:53, Matthew Rosato wrote: >> On 9/11/24 6:58 AM, Akihiko Odaki wrote: >>> On 2024/09/11 18:38, Cédric Le Goater wrote: >>>> +Matthew +Eric >>>> >>>> Side note for the maintainers :

Re: [PATCH for-9.2 v15 04/11] s390x/pci: Check for multifunction after device realization

2024-09-11 Thread Matthew Rosato
On 9/11/24 6:58 AM, Akihiko Odaki wrote: > On 2024/09/11 18:38, Cédric Le Goater wrote: >> +Matthew +Eric >> >> Side note for the maintainers : >> >> Before this change, the igb device, which is multifunction, was working >> fine under Linux. >> >> Was there a fix in Linux since : >> >>    57da367b

Re: [PATCH v2 0/3] s390x/pci: fix ISM reset

2024-01-22 Thread Matthew Rosato
On 1/22/24 5:49 AM, Thomas Huth wrote: > On 22/01/2024 11.31, Michael Tokarev wrote: >> 22.01.2024 13:18, Michael Tokarev : >> .. >>> Is it this a material for -stable, or there's no need to bother? >> >> Actually it's been Cc'd to qemu-stable@ already, I haven't noticed. >> Still there's a questio

Re: [PATCH v2 3/3] s390x/pci: drive ISM reset from subsystem reset

2024-01-22 Thread Matthew Rosato
On 1/19/24 4:07 PM, Halil Pasic wrote: > On Thu, 18 Jan 2024 13:51:51 -0500 > Matthew Rosato wrote: > >> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c >> index eaf61d3640..c99682b07d 100644 >> --- a/hw/s390x/s390-virtio-ccw.c >>

[PATCH v2 2/3] s390x/pci: refresh fh before disabling aif

2024-01-18 Thread Matthew Rosato
390x/pci: reset ISM passthrough devices on shutdown and system reset") Reported-by: Cédric Le Goater Reviewed-by: Eric Farman Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-kvm.c | 9 + 1 file changed, 9 insertions(+) diff --git a/hw/s390x/s390-pci-kvm.c b/hw/s390x/s390-pci-kv

[PATCH v2 3/3] s390x/pci: drive ISM reset from subsystem reset

2024-01-18 Thread Matthew Rosato
ISM passthrough devices on shutdown and system reset") Reported-by: Cédric Le Goater Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-bus.c | 26 +- hw/s390x/s390-virtio-ccw.c | 8 include/hw/s390x/s390-pci-bus.h | 1 + 3 files changed,

[PATCH v2 1/3] s390x/pci: avoid double enable/disable of aif

2024-01-18 Thread Matthew Rosato
reted devices") Reported-by: Cédric Le Goater Reviewed-by: Eric Farman Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-kvm.c | 25 +++-- include/hw/s390x/s390-pci-bus.h | 1 + 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/hw/s390x/s390-pci-

[PATCH v2 0/3] s390x/pci: fix ISM reset

2024-01-18 Thread Matthew Rosato
y did not detect and issue a warning for this scenario. Changes for v2: - Fold a typo fix from patch 2 into patch 1 where it belongs - Add block comment re: timing of ISM reset - Add review tags Matthew Rosato (3): s390x/pci: avoid double enable/disable of aif s390x/pci: refresh fh b

Re: [PATCH 3/3] s390x/pci: drive ISM reset from subsystem reset

2024-01-17 Thread Matthew Rosato
On 1/17/24 10:19 AM, Matthew Rosato wrote: > On 1/17/24 6:01 AM, Cédric Le Goater wrote: >> Adding Alex, >> >> On 1/16/24 23:31, Matthew Rosato wrote: >>> ISM devices are sensitive to manipulation of the IOMMU, so the ISM device >>> needs to be reset before t

Re: [PATCH 2/3] s390x/pci: refresh fh before disabling aif

2024-01-17 Thread Matthew Rosato
On 1/17/24 5:31 AM, Cédric Le Goater wrote: > Hello Matthew, > > On 1/16/24 23:31, Matthew Rosato wrote: >> Typically we refresh the host fh during CLP enable, however it's possible >> that the device goes through multiple reset events before the guest >> per

Re: [PATCH 3/3] s390x/pci: drive ISM reset from subsystem reset

2024-01-17 Thread Matthew Rosato
On 1/17/24 6:01 AM, Cédric Le Goater wrote: > Adding Alex, > > On 1/16/24 23:31, Matthew Rosato wrote: >> ISM devices are sensitive to manipulation of the IOMMU, so the ISM device >> needs to be reset before the vfio-pci device is reset (triggering a full >> UNMAP

Re: [PATCH 2/3] s390x/pci: refresh fh before disabling aif

2024-01-17 Thread Matthew Rosato
On 1/17/24 5:40 AM, Cédric Le Goater wrote: > On 1/16/24 23:31, Matthew Rosato wrote: >> Typically we refresh the host fh during CLP enable, however it's possible >> that the device goes through multiple reset events before the guest >> performs another CLP enable.  Le

Re: [PATCH 1/3] s390x/pci: avoid double enable/disable of aif

2024-01-17 Thread Matthew Rosato
On 1/17/24 5:54 AM, Cédric Le Goater wrote: > On 1/16/24 23:31, Matthew Rosato wrote: >> Use a flag to keep track of whether AIF is currently enabled.  This can be >> used to avoid enabling/disabling AIF multiple times as well as to determine >> whether or not it should be

Re: [PATCH 1/3] s390x/pci: avoid double enable/disable of aif

2024-01-17 Thread Matthew Rosato
>> -    return kvm_vm_ioctl(kvm_state, KVM_S390_ZPCI_OP, &args); >> +    if (!pbdev->aif) { >> +    return -EINVAL; >> +    } >> + >> +    rc = kvm_vm_ioctl(kvm_state, KVM_S390_ZPCI_OP, &args); >> +    if (rc == 0) { >> +    pbev->aif = false; > > s/pbev/pbdev/ > > You fix this in patch

Re: [PATCH 3/3] s390x/pci: drive ISM reset from subsystem reset

2024-01-17 Thread Matthew Rosato
On 1/16/24 10:01 PM, Eric Farman wrote: > On Tue, 2024-01-16 at 17:31 -0500, Matthew Rosato wrote: >>   >> +void s390_pci_ism_reset(void) >> +{ >> +    S390pciState *s = s390_get_phb(); >> + >> +    S390PCIBusDevice *pbdev, *next; >> + >> +

[PATCH 2/3] s390x/pci: refresh fh before disabling aif

2024-01-16 Thread Matthew Rosato
390x/pci: reset ISM passthrough devices on shutdown and system reset") Reported-by: Cédric Le Goater Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-kvm.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/s390x/s390-pci-kvm.c b/hw/s390x/s390-pci-kv

[PATCH 0/3] s390x/pci: fix ISM reset

2024-01-16 Thread Matthew Rosato
y did not detect and issue a warning for this scenario. Matthew Rosato (3): s390x/pci: avoid double enable/disable of aif s390x/pci: refresh fh before disabling aif s390x/pci: drive ISM reset from subsystem reset hw/s390x/s390-pci-bus.c | 26 - hw/s390x/s39

[PATCH 1/3] s390x/pci: avoid double enable/disable of aif

2024-01-16 Thread Matthew Rosato
reted devices") Reported-by: Cédric Le Goater Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-kvm.c | 25 +++-- include/hw/s390x/s390-pci-bus.h | 1 + 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/hw/s390x/s390-pci-kvm.c b/hw/s390x/s390-pci-k

[PATCH 3/3] s390x/pci: drive ISM reset from subsystem reset

2024-01-16 Thread Matthew Rosato
ISM passthrough devices on shutdown and system reset") Reported-by: Cédric Le Goater Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-bus.c | 26 +- hw/s390x/s390-virtio-ccw.c | 2 ++ include/hw/s390x/s390-pci-bus.h | 1 + 3 files changed, 20 insert

Re: [PULL 2/7] s390x: do a subsystem reset before the unprotect on reboot

2024-01-11 Thread Matthew Rosato
On 1/11/24 4:43 AM, Cédric Le Goater wrote: > OK. this condition is considered serious enough to be reported to a > management level. This seems a bit excessive since the recovery can be > handled by software, but manually. Are there any plans to address this > problem ? Yes, eventually. Current

Re: [PULL 2/7] s390x: do a subsystem reset before the unprotect on reboot

2024-01-11 Thread Matthew Rosato
On 1/11/24 5:18 AM, Christian Borntraeger wrote: > > > Am 11.01.24 um 10:43 schrieb Cédric Le Goater: > [...] >> >> >> On a side note, I am also seeing : > > Michael? > Hmm, it looks like this warning is tripping because we have a path in PCI passthrough where we don't unregister the gisc. T

Re: [PULL 2/7] s390x: do a subsystem reset before the unprotect on reboot

2024-01-10 Thread Matthew Rosato
On 1/10/24 1:30 PM, Cédric Le Goater wrote: > On 9/12/23 13:41, Thomas Huth wrote: >> From: Janosch Frank >> >> Bound APQNs have to be reset before tearing down the secure config via >> s390_machine_unprotect(). Otherwise the Ultravisor will return a error >> code. >> >> So let's do a subsystem_re

Re: [PATCH v2 2/2] s390x/pci: only limit DMA aperture if vfio DMA limit reported

2023-11-13 Thread Matthew Rosato
On 11/13/23 4:24 PM, Michael Tokarev wrote: > 10.11.2023 20:51, Matthew Rosato wrote: >> If the host kernel lacks vfio DMA limit reporting, do not attempt >> to shrink the guest DMA aperture. >> >> Fixes: df202e3ff3 ("s390x/pci: shrink DMA aperture to be bound by vf

[PATCH v2 0/2] s390x/pci: small set of fixes

2023-11-10 Thread Matthew Rosato
bug as it's possible for an older host kernel to be missing this support today; so ideally this one should be targeted for 8.2 regardless. Changes for v2: - minor style changes (Phil, Thomas) Matthew Rosato (2): s390x/pci: bypass vfio DMA counting when using cdev s390x/pci: only limit

[PATCH v2 2/2] s390x/pci: only limit DMA aperture if vfio DMA limit reported

2023-11-10 Thread Matthew Rosato
If the host kernel lacks vfio DMA limit reporting, do not attempt to shrink the guest DMA aperture. Fixes: df202e3ff3 ("s390x/pci: shrink DMA aperture to be bound by vfio DMA limit") Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-vfio.c | 2 +- 1 file changed, 1 insertion(+),

[PATCH v2 1/2] s390x/pci: bypass vfio DMA counting when using cdev

2023-11-10 Thread Matthew Rosato
The current code assumes that there is always a vfio group, but that's no longer guaranteed with the iommufd backend when using cdev. In this case, we don't need to track the vfio dma limit anyway. Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-vfio.c | 4 1 file

Re: [PATCH v5 19/20] kconfig: Activate IOMMUFD for s390x machines

2023-11-09 Thread Matthew Rosato
4c068d7960..26ad104485 100644 > --- a/hw/s390x/Kconfig > +++ b/hw/s390x/Kconfig > @@ -6,6 +6,7 @@ config S390_CCW_VIRTIO > imply VFIO_CCW > imply WDT_DIAG288 > imply PCIE_DEVICES > +imply IOMMUFD > select PCI_EXPRESS > select S390_FLIC >

Re: [PATCH v5 16/20] vfio/ccw: Make vfio cdev pre-openable by passing a file handle

2023-11-09 Thread Matthew Rosato
On 11/9/23 6:45 AM, Zhenzhong Duan wrote: > This gives management tools like libvirt a chance to open the vfio > cdev with privilege and pass FD to qemu. This way qemu never needs > to have privilege to open a VFIO or iommu cdev node. > > Signed-off-by: Zhenzhong Duan Revie

Re: [PATCH v5 15/20] vfio/ccw: Allow the selection of a given iommu backend

2023-11-09 Thread Matthew Rosato
ccw device options: > > -object iommufd,id=iommufd0 > -device vfio-ccw,sysfsdev=/sys/bus/mdev/devices/XXX,iommufd=iommufd0 > > Suggested-by: Alex Williamson > Signed-off-by: Zhenzhong Duan Reviewed-by: Matthew Rosato

Re: [PATCH v5 13/20] vfio/ap: Allow the selection of a given iommu backend

2023-11-09 Thread Matthew Rosato
-ap device options: > > -object iommufd,id=iommufd0 > -device vfio-ap,sysfsdev=/sys/bus/mdev/devices/XXX,iommufd=iommufd0 > > Suggested-by: Alex Williamson > Signed-off-by: Zhenzhong Duan Reviewed-by: Matthew Rosato

Re: [PATCH v5 14/20] vfio/ap: Make vfio cdev pre-openable by passing a file handle

2023-11-09 Thread Matthew Rosato
On 11/9/23 6:45 AM, Zhenzhong Duan wrote: > This gives management tools like libvirt a chance to open the vfio > cdev with privilege and pass FD to qemu. This way qemu never needs > to have privilege to open a VFIO or iommu cdev node. > > Signed-off-by: Zhenzhong Duan Revie

[PATCH 2/2] s390x/pci: only limit DMA aperture if vfio DMA limit reported

2023-11-09 Thread Matthew Rosato
If the host kernel lacks vfio DMA limit reporting, do not attempt to shrink the guest DMA aperture. Fixes: df202e3ff3 ("s390x/pci: shrink DMA aperture to be bound by vfio DMA limit") Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-vfio.c | 2 +- 1 file changed, 1 insertion(+),

[PATCH 1/2] s390x/pci: bypass vfio DMA counting when using cdev

2023-11-09 Thread Matthew Rosato
The current code assumes that there is always a vfio group, but that's no longer guaranteed with the iommufd backend when using cdev. In this case, we don't need to track the vfio dma limit anyway. Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-vfio.c | 6 +- 1 file

[PATCH 0/2] s390x/pci: small set of fixes

2023-11-09 Thread Matthew Rosato
bug as it's possible for an older host kernel to be missing this support today; so ideally this one should be targeted for 8.2 regardless. Matthew Rosato (2): s390x/pci: bypass vfio DMA counting when using cdev s390x/pci: only limit DMA aperture if vfio DMA limit reported hw/s390x/s390-p

Re: [PATCH v4 00/41] vfio: Adopt iommufd

2023-11-07 Thread Matthew Rosato
On 11/7/23 1:28 PM, Cédric Le Goater wrote: > On 11/2/23 08:12, Zhenzhong Duan wrote: >> Hi, >> >> Thanks all for giving guides and comments on previous series, here is >> the v4 of pure iommufd support part. >> >> Based on Cédric's suggestion, this series includes an effort to remove >> spapr code

Re: [PATCH v4 28/41] vfio/iommufd: Implement the iommufd backend

2023-11-07 Thread Matthew Rosato
On 11/2/23 3:12 AM, Zhenzhong Duan wrote: > From: Yi Liu > > Add the iommufd backend. The IOMMUFD container class is implemented > based on the new /dev/iommu user API. This backend obviously depends > on CONFIG_IOMMUFD. > > So far, the iommufd backend doesn't support dirty page sync yet due > t

Re: [PATCH v3 09/15] vfio/ap: Use vfio_[attach/detach]_device

2023-10-04 Thread Matthew Rosato
passing errp into vfio_attach_device and that should have an error propogated when ret!=0, meaning we won't get the dc->unrealize() later. Device wasn't attached, but we did allocate memory for vbasedev->name already so we need to undo that part ourselves. That could be inlin

Re: [PATCH v3 10/15] vfio/ccw: Use vfio_[attach/detach]_device

2023-10-03 Thread Matthew Rosato
gt; Signed-off-by: Eric Auger > Signed-off-by: Yi Liu > Signed-off-by: Zhenzhong Duan > > --- > v2 -> v3: > - Hopefully fix confusion beteen vbasedev->name, mdevid and sysfsdev > while keeping into account Matthew's comment > > https://lore.kernel.org/qe

Re: [PATCH v3 09/15] vfio/ap: Use vfio_[attach/detach]_device

2023-10-03 Thread Matthew Rosato
On 10/3/23 11:25 AM, Cédric Le Goater wrote: > On 10/3/23 12:14, Eric Auger wrote: >> Let the vfio-ap device use vfio_attach_device() and >> vfio_detach_device(), hence hiding the details of the used >> IOMMU backend. >> >> We take the opportunity to use g_path_get_basename() which >> is prefered,

Re: [PATCH v2 09/12] vfio/ccw: Use vfio_[attach/detach]_device

2023-09-27 Thread Matthew Rosato
On 9/27/23 8:09 AM, Duan, Zhenzhong wrote: > > >> -Original Message- >> From: Eric Auger >> Sent: Wednesday, September 27, 2023 6:00 PM >> Subject: Re: [PATCH v2 09/12] vfio/ccw: Use vfio_[attach/detach]_device >> >> >> >> On 9/26/23 13:32, Zhenzhong Duan wrote: >>> From: Eric Auger >>>

Re: [PATCH for-8.2] s390x: Convert DPRINTF to trace events

2023-08-22 Thread Matthew Rosato
been on my todo list for a while. Message contents look fine, so with Thomas's minor nit: Reviewed-by: Matthew Rosato

Re: [PATCH 1/2] block/file-posix: fix g_file_get_contents return path

2023-07-27 Thread Matthew Rosato
On 7/5/23 10:54 AM, Matthew Rosato wrote: > On 6/4/23 2:16 AM, Sam Li wrote: >> The g_file_get_contents() function returns a g_boolean. If it fails, the >> returned value will be 0 instead of -1. Solve the issue by skipping >> assigning ret value. >> >> This issue

Re: [PATCH v3] kconfig: Add PCIe devices to s390x machines

2023-07-05 Thread Matthew Rosato
oller, which all support MSI-X. Devices only supporting > INTx won't work on s390x. > > Signed-off-by: Cédric Le Goater Acked-by: Matthew Rosato > --- > > v3: PCI -> PCI_EXPRESS > v2: select -> imply > > hw/s390x/Kconfig | 5 - > 1 file changed

Re: [PATCH 1/2] block/file-posix: fix g_file_get_contents return path

2023-07-05 Thread Matthew Rosato
On 6/4/23 2:16 AM, Sam Li wrote: > The g_file_get_contents() function returns a g_boolean. If it fails, the > returned value will be 0 instead of -1. Solve the issue by skipping > assigning ret value. > > This issue was found by Matthew Rosato using virtio-blk-{pci,ccw} back

Re: [PATCH v2] kconfig: Add PCIe devices to s390x machines

2023-07-05 Thread Matthew Rosato
On 7/4/23 9:33 AM, Philippe Mathieu-Daudé wrote: > On 4/7/23 14:32, Cédric Le Goater wrote: >> On 7/4/23 14:09, Philippe Mathieu-Daudé wrote: >>> On 4/7/23 14:01, Cédric Le Goater wrote: It is useful to extend the number of available PCI devices to KVM guests for passthrough scenarios and

Re: [PATCH 1/2] block/file-posix: fix g_file_get_contents return path

2023-06-07 Thread Matthew Rosato
On 6/4/23 2:16 AM, Sam Li wrote: > The g_file_get_contents() function returns a g_boolean. If it fails, the > returned value will be 0 instead of -1. Solve the issue by skipping > assigning ret value. > > This issue was found by Matthew Rosato using virtio-blk-{pci,ccw} back

Re: [PULL v2 02/16] block/file-posix: introduce helper functions for sysfs attributes

2023-06-02 Thread Matthew Rosato
On 6/2/23 2:18 PM, Sam Li wrote: > Matthew Rosato 于2023年6月1日周四 02:21写道: >> >> On 5/15/23 12:04 PM, Stefan Hajnoczi wrote: >>> From: Sam Li >>> >>> Use get_sysfs_str_val() to get the string value of device >>> zoned model. Then get_sysfs_zoned_m

Re: [PULL v2 02/16] block/file-posix: introduce helper functions for sysfs attributes

2023-05-31 Thread Matthew Rosato
On 5/15/23 12:04 PM, Stefan Hajnoczi wrote: > From: Sam Li > > Use get_sysfs_str_val() to get the string value of device > zoned model. Then get_sysfs_zoned_model() can convert it to > BlockZoneModel type of QEMU. > > Use get_sysfs_long_val() to get the long value of zoned device > information.

Re: [PATCH 1/2] linux-headers: Update with vfio_ap IRQ index mapping

2023-05-31 Thread Matthew Rosato
On 5/31/23 8:52 AM, Anthony Krowiak wrote: > > > On 5/30/23 8:56 PM, Matthew Rosato wrote: >> On 5/30/23 6:55 PM, Tony Krowiak wrote: >>> Signed-off-by: Tony Krowiak >>> --- >>>   linux-headers/linux/vfio.h | 9 + >>>   1 file changed,

Re: [PATCH 1/2] linux-headers: Update with vfio_ap IRQ index mapping

2023-05-30 Thread Matthew Rosato
On 5/30/23 6:55 PM, Tony Krowiak wrote: > Signed-off-by: Tony Krowiak > --- > linux-headers/linux/vfio.h | 9 + > 1 file changed, 9 insertions(+) Worth nothing here that linux-headers patches should be generated using scripts/update-linux-headers.sh. Since this linux-headers update inc

Re: [PATCH v2] vfio/pci: Fix a use-after-free issue

2023-05-23 Thread Matthew Rosato
lex Williamson > Signed-off-by: Zhenzhong Duan Reviewed-by: Matthew Rosato Also verified that this resolves an issue seen on s390, as we were seeing not just garbage logs but QEMU crashes in certain cases e.g. during device unplug. Thanks! > --- > v2: "toke" -> &q

Re: [PULL 1/3] vfio/pci: add support for VF token

2023-05-23 Thread Matthew Rosato
On 5/9/23 5:59 PM, Alex Williamson wrote: > From: Minwoo Im > > VF token was introduced [1] to kernel vfio-pci along with SR-IOV > support [2]. This patch adds support VF token among PF and VF(s). To > passthu PCIe VF to a VM, kernel >= v5.7 needs this. > > It can be configured with UUID like:

Re: [RFC v3 11/18] vfio/ccw: Use vfio_[attach/detach]_device

2023-03-03 Thread Matthew Rosato
On 1/31/23 3:52 PM, Eric Auger wrote: > Let the vfio-ccw device use vfio_attach_device() and > vfio_detach_device(), hence hiding the details of the used > IOMMU backend. > > Also now all the devices have been migrated to use the new > vfio_attach_device/vfio_detach_device API, let's turn the > le

Re: [PATCH] s390x/pci: reset ISM passthrough devices on shutdown and system reset

2022-12-12 Thread Matthew Rosato
On 12/12/22 6:34 AM, Thomas Huth wrote: > On 09/12/2022 20.57, Matthew Rosato wrote: >> ISM device firmware stores unique state information that can >> can cause a wholesale unmap of the associated IOMMU (e.g. when >> we get a termination signal for QEMU) to trigger firmw

[PATCH] s390x/pci: reset ISM passthrough devices on shutdown and system reset

2022-12-09 Thread Matthew Rosato
; this is enough to indicate to firmware that the IOMMU is no longer in-use by the guest OS, making it safe to invalidate any associated IOMMU entries. Fixes: 15d0e7942d3b ("s390x/pci: don't fence interpreted devices without MSI-X") Signed-off-by: Matthew Rosato --- hw/s390x

Re: [PATCH for 7.2 0/2] s390x/s390-virtio-ccw:

2022-11-07 Thread Matthew Rosato
> Thanks, > > C. Thanks Cedric. For the series: Reviewed-by: Matthew Rosato Also did a quick test on top of https://gitlab.com/thuth/qemu.git tags/pull-request-2022-11-06 to verify that zPCI interpretation/forwarding is available as expected with machine 7.2 and off by default

Re: [PATCH v2] s390x/css: revert SCSW ctrl/flag bits on error

2022-10-31 Thread Matthew Rosato
ned-off-by: Peter Jin > > We've talked previously about clearing this within the > do_subchannel_work_passthrough routine in order to keep the _virtual > paths untouched, but this seems like a reasonable approach to me. > > The commit message is probably fine either way, but a

[PATCH 0/3] s390x/pci: rpcit fixes and enhancements

2022-10-28 Thread Matthew Rosato
The following series fixes an issue with guest RPCIT processing discovered during development of [1] as well as proposes a few additional optimizations to the current RPCIT codepath. [1] https://lore.kernel.org/linux-s390/20221019144435.369902-1-schne...@linux.ibm.com/ Matthew Rosato (3

[PATCH 2/3] s390x/pci: coalesce unmap operations

2022-10-28 Thread Matthew Rosato
Currently, each unmapped page is handled as an individual iommu region notification. Attempt to group contiguous unmap operations into fewer notifications to reduce overhead. Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-inst.c | 51 1 file

[PATCH 1/3] s390x/pci: RPCIT second pass when mappings exhausted

2022-10-28 Thread Matthew Rosato
) Reported-by: Niklas Schnelle Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-inst.c | 29 ++--- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 20a9bcc7af..7cc4bcf850 100644 --- a/hw/s390x/s390-

[PATCH 3/3] s390x/pci: shrink DMA aperture to be bound by vfio DMA limit

2022-10-28 Thread Matthew Rosato
e and host limit far less likely and more indicitive of an error. Signed-off-by: Matthew Rosato --- hw/s390x/s390-pci-vfio.c| 11 +++ include/hw/s390x/s390-pci-bus.h | 1 + 2 files changed, 12 insertions(+) diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c index 2aefa

Re: [PATCH] hw/s390x/s390-pci-inst.c: Use device_cold_reset() to reset PCI devices

2022-10-13 Thread Matthew Rosato
Peter Maydell > --- > NB: tested only with 'make check' and 'make check-avocado', which > probably don't exercise this codepath. > I exercised the codepath by triggering the associated clp using both virtio and vfio pci devices on s390x; looks good to me. R

  1   2   3   4   5   6   >