[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] paravirt: call pci_bios_init_devices() when runningOnXen()


  • To: <seabios@xxxxxxxxxxx>
  • From: Xenia Ragiadakou <xenia.ragiadakou@xxxxxxx>
  • Date: Fri, 14 Jul 2023 12:28:09 +0300
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=seabios.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0xOoX2/Cgac9pFbV1Jy/oMIpEZrUX9KsUGUFT4KaB8k=; b=mzatdwN+kyGU7PecrYVN7jwASXzSaDRITLswK5LMJh7Nku//EIFbsPjmG7ypgrf/pjVXeVzgFZRXj0xixcyhzD9m6HRJyzs11eDsHTA6cq1OH4NWGe59U+CdtRNy6RGlecyDxC3hCjvPAkFuy17AcTjIfi6qKh5aaWFLr62z3MMOKU8RV53EsCNuVOmop31NNsZqenYe15eHeJdR8+ff92YMQF0lm7XyqFNfwDQmXJPRrM2LAAVgI55gV3QCVp/S6rLDMBuEAvtJYvhAug7ADKlKrM4HpZP1LPBg8HbD+7ZMHRC9B8HQRp/+I/hjD0OfjNvEeXlCRGEmvWSJ1/X24A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KMnpdvlxNR7gN13AKguLpbh1b2uTlfiXGHTRNgGK+TNjPbx+LDl4+CyB3MyP8gDvMSall9l9USxdlHJP0k2bUDXZC3nMTAptwDXTSq+mh7JObDLJ4Hb7xwMFndnooBKV7JEGBbaiMes7lndIAgYQLFwQnomETzWqCa1jFROHlggIQIQFmP7kJHPvH77zPFZ7SL83iB+qZ/iLTxkGiTK/BOIYjDcbL3ca2UEG7H2vlFnK1jWt7iEHcsHvqnlZrdMBlQHzkSOLiCuX1SWpwIvhhypHUyDwbahDidjnSS8lJO5DH2U/QFOt5fR7mRS0ehmRzlXGCIiVuWXhhuJ3D3cJrg==
  • Cc: Xenia Ragiadakou <xenia.ragiadakou@xxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>, Kevin O'Connor <kevin@xxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 14 Jul 2023 09:29:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The issue that this patch attempts to address is S3 related.
Currently, suspending a XEN guest multiple times does not work.
This happens because PIIX4 PM io space gets unmapped during S3
resume and any accesses performed to trigger subsequent suspends
are not handled. So, the guest spins on the wake sts bit forever.
Below follows a more detailed description of the issue.

On S3 resume path, QEMU issues piix4_pm_reset() to bring PPIX4 PM
controller to the state expected. More specifically, piix4_pm_reset()
zeroes PMIOSE register, i.e pci_conf[0x80] = 0, and this results in
unmapping PIIX4 PM io space,
i.e. memory_region_set_enabled(&s->io, d->config[0x80] & 1)
It is bios responsibility to reenable PIIX4 PM io space during
S3 resume path. However, when running on XEN, the qemu platform
initialization code does not call pci_bios_init_devices(), hence
the PIIX4 PM controller init function is not called and PiixPmBDF
is not set. The value of PiixPmBDF indicates the presence of PIIX4
PM controller. Thus, S3 resume code in pci_resume() considers that
PIIX4 PM controller is not present and does not perform the relevant
post-resume setup that restores PIIX4 PM io space. This is the reason
why any subsequent guest access to those registers is not handled.

This patch adds a call to pci_bios_init_devices() to the early xen
platform setup code.

Signed-off-by: Xenia Ragiadakou <xenia.ragiadakou@xxxxxxx>
---
 src/fw/paravirt.c | 1 +
 src/fw/pciinit.c  | 2 +-
 src/util.h        | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c
index fba4e52..0c035eb 100644
--- a/src/fw/paravirt.c
+++ b/src/fw/paravirt.c
@@ -205,6 +205,7 @@ qemu_platform_setup(void)
 
     if (runningOnXen()) {
         pci_probe_devices();
+        pci_bios_init_devices();
         xen_hypercall_setup();
         xen_biostable_setup();
         return;
diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
index badf13d..f955481 100644
--- a/src/fw/pciinit.c
+++ b/src/fw/pciinit.c
@@ -417,7 +417,7 @@ static void pci_bios_init_device(struct pci_device *pci)
                          PCI_BRIDGE_CTL_SERR);
 }
 
-static void pci_bios_init_devices(void)
+void pci_bios_init_devices(void)
 {
     struct pci_device *pci;
     foreachpci(pci) {
diff --git a/src/util.h b/src/util.h
index aff8e88..ebd863f 100644
--- a/src/util.h
+++ b/src/util.h
@@ -137,6 +137,7 @@ extern u64 pcimem64_start, pcimem64_end;
 extern const u8 pci_irqs[4];
 void pci_setup(void);
 void pci_resume(void);
+void pci_bios_init_devices(void);
 
 // fw/pirtable.c
 void pirtable_setup(void);
-- 
2.34.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.