From: Farhan Ali <alifm@linux.ibm.com>
To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Cc: alifm@linux.ibm.com, mjrosato@linux.ibm.com,
farman@linux.ibm.com, cohuck@redhat.com, alex@shazbot.org,
clg@redhat.com
Subject: [PATCH v7 2/2] s390x/pci: Reset a device in error state
Date: Mon, 5 Oct 2026 10:43:14 -0700 [thread overview]
Message-ID: <20261005174314.871-3-alifm@linux.ibm.com> (raw)
In-Reply-To: <20261005174314.871-1-alifm@linux.ibm.com>
For passthrough devices in error state, for a guest driven reset of the
device we can attempt a reset to recover the device. A reset of the device
will trigger a CLP disable/enable cycle on the host to bring the device
into a recovered state.
Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
---
hw/s390x/s390-pci-bus.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index b2967dacba..6557ec4240 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -1505,6 +1505,21 @@ static void s390_pci_device_reset(DeviceState *dev)
return;
case ZPCI_FS_STANDBY:
break;
+ case ZPCI_FS_ERROR:
+ /*
+ * Attempt a reset to recover the device. A device in ERROR state
+ * can be transitioned to ENABLED or DISABLED state via guest
+ * driven actions. Since this code path is also executed on
+ * subsystem_reset() and the expected state of a configured device
+ * after subsystem_reset() is to be in a DISABLED state, we need to
+ * transition from ERROR to DISABLED.
+ *
+ * Linux guests drive the state transition from ERROR to DISABLED
+ * via CLP_SET_DISABLE_PCI_FN. So it should be safe to transition
+ * from ERROR to DISABLED state.
+ */
+ pci_device_reset(pbdev->pdev);
+ /* fallthrough */
default:
pbdev->fh &= ~FH_MASK_ENABLE;
pbdev->state = ZPCI_FS_DISABLED;
--
2.43.0
next prev parent reply other threads:[~2026-10-05 17:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 17:43 [PATCH v7 0/2] Error recovery for zPCI passthrough devices Farhan Ali
2026-10-05 17:43 ` [PATCH v7 1/2] s390x/pci: Add PCI error handling for vfio pci devices Farhan Ali
2026-10-05 21:44 ` Matthew Rosato
2026-10-05 17:43 ` Farhan Ali [this message]
2026-10-05 20:38 ` [PATCH v7 2/2] s390x/pci: Reset a device in error state Matthew Rosato
2026-10-05 21:44 ` [PATCH v7 0/2] Error recovery for zPCI passthrough devices Matthew Rosato
2026-10-07 6:48 ` Cédric Le Goater
2026-10-07 17:36 ` Eric Farman
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=20261005174314.871-3-alifm@linux.ibm.com \
--to=alifm@linux.ibm.com \
--cc=alex@shazbot.org \
--cc=clg@redhat.com \
--cc=cohuck@redhat.com \
--cc=farman@linux.ibm.com \
--cc=mjrosato@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.