All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shanker Donthineni <shankerd@codeaurora.org>
To: xen-devel <xen-devel@lists.xensource.com>,
	Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>
Cc: Shanker Donthineni <shankerd@codeaurora.org>,
	Vikram Sethi <vikrams@codeaurora.org>,
	Campbell Sean <scampbel@codeaurora.org>
Subject: [PATCH] arm/acpi: hide watchdog timer in GTDT table for dom0
Date: Mon, 28 Nov 2016 20:59:09 -0600	[thread overview]
Message-ID: <1480388349-13887-1-git-send-email-shankerd@codeaurora.org> (raw)

Either we have to hide the watchdog timer section in GTDT or emulate
watchdog timer block for dom0. Otherwise, system gets panic when
dom0 accesses its MMIO registers. The current XEN doesn't support
virtualization of watchdog timer, so hide the watchdog timer section
for dom0.

Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
---
 xen/arch/arm/domain_build.c | 41 +++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/acpi.h  |  1 +
 2 files changed, 42 insertions(+)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index e8a400c..611c803 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1668,6 +1668,8 @@ static int acpi_create_xsdt(struct domain *d, struct membank tbl_add[])
                            ACPI_SIG_FADT, tbl_add[TBL_FADT].start);
     acpi_xsdt_modify_entry(xsdt->table_offset_entry, entry_count,
                            ACPI_SIG_MADT, tbl_add[TBL_MADT].start);
+    acpi_xsdt_modify_entry(xsdt->table_offset_entry, entry_count,
+                           ACPI_SIG_GTDT, tbl_add[TBL_GTDT].start);
     xsdt->table_offset_entry[entry_count] = tbl_add[TBL_STAO].start;
 
     xsdt->header.length = table_size;
@@ -1718,6 +1720,41 @@ static int acpi_create_stao(struct domain *d, struct membank tbl_add[])
     return 0;
 }
 
+static int acpi_create_gtdt(struct domain *d, struct membank tbl_add[])
+{
+    struct acpi_table_header *table = NULL;
+    struct acpi_table_gtdt *gtdt = NULL;
+    u32 table_size = sizeof(struct acpi_table_gtdt);
+    u32 offset = acpi_get_table_offset(tbl_add, TBL_GTDT);
+    acpi_status status;
+    u8 *base_ptr, checksum;
+
+    status = acpi_get_table(ACPI_SIG_GTDT, 0, &table);
+
+    if ( ACPI_FAILURE(status) )
+    {
+        const char *msg = acpi_format_exception(status);
+
+        printk("Failed to get GTDT table, %s\n", msg);
+        return -EINVAL;
+    }
+
+    base_ptr = d->arch.efi_acpi_table + offset;
+    ACPI_MEMCPY(base_ptr, table, sizeof(struct acpi_table_gtdt));
+
+    gtdt = (struct acpi_table_gtdt *)base_ptr;
+    gtdt->header.length = table_size;
+    gtdt->platform_timer_count = 0;
+    gtdt->platform_timer_offset = table_size;
+    checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, gtdt), table_size);
+    gtdt->header.checksum -= checksum;
+
+    tbl_add[TBL_GTDT].start = d->arch.efi_acpi_gpa + offset;
+    tbl_add[TBL_GTDT].size = table_size;
+
+    return 0;
+}
+
 static int acpi_create_madt(struct domain *d, struct membank tbl_add[])
 {
     struct acpi_table_header *table = NULL;
@@ -1909,6 +1946,10 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo)
     if ( rc != 0 )
         return rc;
 
+    rc = acpi_create_gtdt(d, tbl_add);
+    if ( rc != 0 )
+        return rc;
+
     rc = acpi_create_xsdt(d, tbl_add);
     if ( rc != 0 )
         return rc;
diff --git a/xen/include/asm-arm/acpi.h b/xen/include/asm-arm/acpi.h
index 9f954d3..214511c 100644
--- a/xen/include/asm-arm/acpi.h
+++ b/xen/include/asm-arm/acpi.h
@@ -36,6 +36,7 @@ typedef enum {
     TBL_FADT,
     TBL_MADT,
     TBL_STAO,
+    TBL_GTDT,
     TBL_XSDT,
     TBL_RSDP,
     TBL_EFIT,
-- 
Qualcomm Datacenter Technologies, Inc. on behalf of the Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

             reply	other threads:[~2016-11-29  2:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-29  2:59 Shanker Donthineni [this message]
2016-11-29 10:40 ` [PATCH] arm/acpi: hide watchdog timer in GTDT table for dom0 Jan Beulich
2016-11-29 11:38   ` Roger Pau Monne
2016-11-29 11:44     ` Jan Beulich
2016-11-29 12:09       ` Roger Pau Monne
2016-11-29 13:07         ` Jan Beulich
2016-11-29 14:28           ` Roger Pau Monne
2016-11-29 18:57             ` Stefano Stabellini
2016-11-29 20:19         ` Andrew Cooper
2016-11-30  8:54           ` Jan Beulich
2016-11-30 10:14             ` Roger Pau Monne
2016-11-29 19:08 ` Stefano Stabellini
2016-11-30  9:47   ` Julien Grall
2016-11-30 18:44     ` Stefano Stabellini
2016-11-30 10:29 ` Julien Grall
2016-11-30 14:31   ` Shanker Donthineni
2016-11-30 14:43     ` Julien Grall
2016-11-30 14:43     ` Shanker Donthineni
2016-11-30 15:00       ` Julien Grall
2016-11-30 15:35         ` Shanker Donthineni
2016-11-30 19:07           ` Stefano Stabellini

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=1480388349-13887-1-git-send-email-shankerd@codeaurora.org \
    --to=shankerd@codeaurora.org \
    --cc=julien.grall@arm.com \
    --cc=scampbel@codeaurora.org \
    --cc=sstabellini@kernel.org \
    --cc=vikrams@codeaurora.org \
    --cc=xen-devel@lists.xensource.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 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.