diff mbox series

xen: acpi: Hide UART address only if SPCR exists

Message ID 160129696545.4486.5090289203994972923.stgit@localhost
State New
Headers show
Series xen: acpi: Hide UART address only if SPCR exists | expand

Commit Message

Masami Hiramatsu Sept. 28, 2020, 12:42 p.m. UTC
Since there is a case that UEFI (EDK2) doesn't make the SPCR
table when it is booted with graphic console, ignore it if SPCR
doesn't exist.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>

---
 xen/arch/arm/acpi/domain_build.c |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/xen/arch/arm/acpi/domain_build.c b/xen/arch/arm/acpi/domain_build.c
index 1b1cfabb00..a50adbb9ab 100644
--- a/xen/arch/arm/acpi/domain_build.c
+++ b/xen/arch/arm/acpi/domain_build.c
@@ -40,20 +40,17 @@  static int __init acpi_iomem_deny_access(struct domain *d)
 
     /* TODO: Deny MMIO access for SMMU, GIC ITS */
     status = acpi_get_table(ACPI_SIG_SPCR, 0,
-                            (struct acpi_table_header **)&spcr);
-
-    if ( ACPI_FAILURE(status) )
+                        (struct acpi_table_header **)&spcr);
+    /* SPCR may not set when the UEFI uses graphical console. */
+    if ( ACPI_SUCCESS(status) )
     {
-        printk("Failed to get SPCR table\n");
-        return -EINVAL;
+        mfn = spcr->serial_port.address >> PAGE_SHIFT;
+        /* Deny MMIO access for UART */
+        rc = iomem_deny_access(d, mfn, mfn + 1);
+        if ( rc )
+            return rc;
     }
 
-    mfn = spcr->serial_port.address >> PAGE_SHIFT;
-    /* Deny MMIO access for UART */
-    rc = iomem_deny_access(d, mfn, mfn + 1);
-    if ( rc )
-        return rc;
-
     /* Deny MMIO access for GIC regions */
     return gic_iomem_deny_access(d);
 }