From: "Cédric Le Goater" <clg@redhat.com>
To: Thomas Huth <thuth@redhat.com>, qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
Janosch Frank <frankja@linux.ibm.com>,
Viktor Mihajlovski <mihajlov@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Matthew Rosato <mjrosato@linux.ibm.com>
Subject: Re: [PULL 2/7] s390x: do a subsystem reset before the unprotect on reboot
Date: Wed, 10 Jan 2024 19:30:37 +0100 [thread overview]
Message-ID: <6aec238b-b983-4b24-9bd9-a90f840d060c@redhat.com> (raw)
In-Reply-To: <20230912114112.296428-3-thuth@redhat.com>
On 9/12/23 13:41, Thomas Huth wrote:
> From: Janosch Frank <frankja@linux.ibm.com>
>
> 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_reset() which includes a AP reset before the
> unprotect call. We'll do a full device_reset() afterwards which will
> reset some devices twice. That's ok since we can't move the
> device_reset() before the unprotect as it includes a CPU clear reset
> which the Ultravisor does not expect at that point in time.
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> Message-ID: <20230901114851.154357-1-frankja@linux.ibm.com>
> Tested-by: Viktor Mihajlovski <mihajlov@linux.ibm.com>
> Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> hw/s390x/s390-virtio-ccw.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index 3dd0b2372d..2d75f2131f 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -438,10 +438,20 @@ static void s390_machine_reset(MachineState *machine, ShutdownCause reason)
> switch (reset_type) {
> case S390_RESET_EXTERNAL:
> case S390_RESET_REIPL:
> + /*
> + * Reset the subsystem which includes a AP reset. If a PV
> + * guest had APQNs attached the AP reset is a prerequisite to
> + * unprotecting since the UV checks if all APQNs are reset.
> + */
> + subsystem_reset();
This commit introduced a regression with pass-though ISM devices.
After startup, a reboot will generate extra device resets (vfio-pci in
this case) which break the pass-though ISM device in a subtle way,
probably related to IOMMU mapping according to 03451953c79e
("s390x/pci: reset ISM passthrough devices on shutdown and system
reset"). After poweroff, the device is left in a sort-of-a-use state
on the host and the LPAR has to be rebooted to clear the invalid state
of the device. To be noted, that standard PCI devices are immune to
this change.
The extra resets should avoided in some ways, (a shutdown notifier and
a reset callback are already registered for ISM devices by 03451953c79e)
and, most important, once the VM terminates, the device resources
should be cleared in the host kernel. So there seem to be two issues
to address in mainline QEMU and in Linux AFAICT.
Thanks,
C.
> if (s390_is_pv()) {
> s390_machine_unprotect(ms);
> }
>
> + /*
> + * Device reset includes CPU clear resets so this has to be
> + * done AFTER the unprotect call above.
> + */
> qemu_devices_reset(reason);
> s390_crypto_reset();
>
next prev parent reply other threads:[~2024-01-10 18:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-12 11:41 [PULL 0/7] s390x (and one qtest) patches Thomas Huth
2023-09-12 11:41 ` [PULL 1/7] s390x/ap: fix missing subsystem reset registration Thomas Huth
2023-09-12 11:41 ` [PULL 2/7] s390x: do a subsystem reset before the unprotect on reboot Thomas Huth
2024-01-10 18:30 ` Cédric Le Goater [this message]
2024-01-10 20:28 ` Matthew Rosato
2024-01-11 9:43 ` Cédric Le Goater
2024-01-11 10:18 ` Christian Borntraeger
2024-01-11 15:26 ` Matthew Rosato
2024-01-11 15:00 ` Janosch Frank
2024-01-11 15:27 ` Matthew Rosato
2023-09-12 11:41 ` [PULL 3/7] linux-headers: Update to Linux v6.6-rc1 Thomas Huth
2023-09-12 11:41 ` [PULL 4/7] target/s390x/kvm: Refactor AP functionalities Thomas Huth
2023-09-12 11:41 ` [PULL 5/7] target/s390x: AP-passthrough for PV guests Thomas Huth
2023-09-12 11:41 ` [PULL 6/7] kconfig: Add NVME to s390x machines Thomas Huth
2023-09-12 11:41 ` [PULL 7/7] tests/qtest/pflash: Clean up local variable shadowing Thomas Huth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6aec238b-b983-4b24-9bd9-a90f840d060c@redhat.com \
--to=clg@redhat.com \
--cc=borntraeger@linux.ibm.com \
--cc=frankja@linux.ibm.com \
--cc=mihajlov@linux.ibm.com \
--cc=mjrosato@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).