From: Tomasz Wroblewski <tomasz.wroblewski@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: [PATCH v4] Fix acpi_dmar_zap/reinstate() (fixes S3 regression)
Date: Wed, 23 Jan 2013 10:02:55 +0100 [thread overview]
Message-ID: <50FFA73F.8030301@citrix.com> (raw)
In-Reply-To: <50FFB1C102000078000B8915@nat28.tlf.novell.com>
[-- Attachment #1: Type: text/plain, Size: 439 bytes --]
On 23/01/13 09:47, Jan Beulich wrote:
> This looks much better; I'll slightly edit it before committing
> though, so please double check the result.
>
>
I just noticed I made a mistake calculating the number of pages to map,
which should be just PFN_UP(dmar_len) (although in practice both
calculations ten to yield 1 page anyway); but resubmiting v4 with that fixed
Signed-off-by: Tomasz Wroblewski <tomasz.wroblewski@citrix.com>
[-- Attachment #2: fix-dmar-zap-reinstate-v4.patch --]
[-- Type: text/x-patch, Size: 2840 bytes --]
diff -r 4b476378fc35 xen/drivers/acpi/tables/tbxface.c
--- a/xen/drivers/acpi/tables/tbxface.c Mon Jan 21 17:03:10 2013 +0000
+++ b/xen/drivers/acpi/tables/tbxface.c Wed Jan 23 08:58:43 2013 +0000
@@ -205,3 +205,44 @@
return (AE_NOT_FOUND);
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_get_table_physical_location
+ *
+ * PARAMETERS: Signature - ACPI signature of needed table
+ * Instance - Which instance (for SSDTs)
+ * out_addr - Where the table's physical address is returned
+ * out_len - Where the length of table is returned
+ *
+ * RETURN: Status, pointer and length of table
+ *
+ * DESCRIPTION: Finds physical address and length of ACPI table
+ *
+ *****************************************************************************/
+acpi_status __init
+acpi_get_table_physical_location(char *signature,
+ acpi_native_uint instance,
+ acpi_physical_address *out_addr, u32 *out_len)
+{
+ acpi_native_uint i;
+ acpi_native_uint j;
+
+ if (!signature || !out_addr || !out_len) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ for (i = 0, j=0; i < acpi_gbl_root_table_list.count; i++) {
+ if (!ACPI_COMPARE_NAME(&(acpi_gbl_root_table_list.tables[i].signature), signature)) {
+ continue;
+ }
+ if (++j < instance) {
+ continue;
+ }
+ *out_addr = acpi_gbl_root_table_list.tables[i].address;
+ *out_len = acpi_gbl_root_table_list.tables[i].length;
+ return AE_OK;
+ }
+
+ return AE_NOT_FOUND;
+}
diff -r 4b476378fc35 xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c Mon Jan 21 17:03:10 2013 +0000
+++ b/xen/drivers/passthrough/vtd/dmar.c Wed Jan 23 08:58:43 2013 +0000
@@ -823,7 +823,17 @@
int __init acpi_dmar_init(void)
{
- acpi_get_table(ACPI_SIG_DMAR, 0, &dmar_table);
+ acpi_physical_address dmar_addr;
+ u32 dmar_len;
+ if ( !acpi_get_table_physical_location(
+ ACPI_SIG_DMAR, 0, &dmar_addr, &dmar_len) )
+ {
+ map_pages_to_xen((unsigned long)__va(dmar_addr), PFN_DOWN(dmar_addr),
+ PFN_UP(dmar_len),
+ PAGE_HYPERVISOR);
+ dmar_table = (struct acpi_table_header*) __va(dmar_addr);
+ }
+
return parse_dmar_table(acpi_parse_dmar);
}
diff -r 4b476378fc35 xen/include/acpi/acpixf.h
--- a/xen/include/acpi/acpixf.h Mon Jan 21 17:03:10 2013 +0000
+++ b/xen/include/acpi/acpixf.h Wed Jan 23 08:58:43 2013 +0000
@@ -77,6 +77,10 @@
acpi_get_table(acpi_string signature,
acpi_native_uint instance, struct acpi_table_header **out_table);
+acpi_status
+acpi_get_table_physical_location(char *signature,
+ acpi_native_uint instance,
+ acpi_physical_address *out_addr, u32 *out_len);
/*
* Namespace and name interfaces
*/
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2013-01-23 9:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-22 12:08 [PATCH] Fix acpi_dmar_zap/reinstate() (fixes S3 regression) Tomasz Wroblewski
2013-01-22 12:58 ` Jan Beulich
2013-01-22 13:36 ` Tomasz Wroblewski
2013-01-22 14:13 ` Jan Beulich
2013-01-22 15:27 ` Tomasz Wroblewski
2013-01-22 15:55 ` Jan Beulich
2013-01-22 17:22 ` [PATCH v3] " Tomasz Wroblewski
2013-01-23 8:47 ` Jan Beulich
2013-01-23 9:02 ` Tomasz Wroblewski [this message]
2013-01-23 9:26 ` [PATCH v4] " Jan Beulich
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=50FFA73F.8030301@citrix.com \
--to=tomasz.wroblewski@citrix.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xen.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.