From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: sameo@linux.intel.com, mst@redhat.com, drjones@redhat.com,
peter.maydell@linaro.org,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Shannon Zhao <shannon.zhaosl@gmail.com>
Subject: [Qemu-devel] [PATCH 2/2] arm/virt: acpi: fix incorrect checksums in RSDP
Date: Thu, 22 Nov 2018 11:29:34 +0100 [thread overview]
Message-ID: <1542882574-109418-3-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1542882574-109418-1-git-send-email-imammedo@redhat.com>
When RSDP table was introduced (d4bec5d87), we calculated only legacy
checksum, and that was incorrect as it
- specified rev=2 and forgot about extended checksum.
- legacy checksum calculated on full table instead of the 1st 20 bytes
Fix it by adding extended checksum calculation and using correct
size for legacy checksum.
While at it use explicit constants to specify sub/full tables
sizes instead of relying on AcpiRsdpDescriptor size and fields offsets.
The follow up commits will convert this table to build_append_int_noprefix() API,
will use constants anyway and remove unused AcpiRsdpDescriptor structure.
Based on "[PATCH v5 05/24] hw: acpi: Implement XSDT support for RSDP"
by Samuel Ortiz, who did it right in his impl.
Fixes: d4bec5d87 (hw/arm/virt-acpi-build: Generate RSDP table)
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
CC: Ard Biesheuvel <ard.biesheuvel@linaro.org>
CC: Shannon Zhao <shannon.zhaosl@gmail.com>
CC: Samuel Ortiz <sameo@linux.intel.com>
---
hw/arm/virt-acpi-build.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 5785fb6..daa093b 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -390,9 +390,14 @@ build_rsdp(GArray *rsdp_table, BIOSLinker *linker, unsigned xsdt_tbl_offset)
/* Checksum to be filled by Guest linker */
bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE,
- (char *)rsdp - rsdp_table->data, sizeof *rsdp,
+ (char *)rsdp - rsdp_table->data, 20 /* ACPI rev 1.0 RSDP size */,
(char *)&rsdp->checksum - rsdp_table->data);
+ /* Extended checksum to be filled by Guest linker */
+ bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE,
+ (char *)rsdp - rsdp_table->data, 36 /* ACPI rev 2.0 RSDP size */,
+ (char *)&rsdp->extended_checksum - rsdp_table->data);
+
return rsdp_table;
}
--
2.7.4
next prev parent reply other threads:[~2018-11-22 10:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-22 10:29 [Qemu-devel] [PATCH 0/2] acpi: RSDP: fix checksum calculations Igor Mammedov
2018-11-22 10:29 ` [Qemu-devel] [PATCH 1/2] pc: acpi: use correct RSDT length for checksum Igor Mammedov
2018-11-23 16:10 ` Michael S. Tsirkin
2018-11-26 10:21 ` Igor Mammedov
2018-11-26 10:41 ` [Qemu-devel] [PATCH v2 " Igor Mammedov
2018-11-22 10:29 ` Igor Mammedov [this message]
2018-11-22 12:26 ` [Qemu-devel] [PATCH 2/2] arm/virt: acpi: fix incorrect checksums in RSDP Andrew Jones
2018-11-23 16:11 ` [Qemu-devel] [PATCH 0/2] acpi: RSDP: fix checksum calculations Michael S. Tsirkin
2018-11-26 10:31 ` Igor Mammedov
2018-11-26 10:50 ` Samuel Ortiz
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=1542882574-109418-3-git-send-email-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=ard.biesheuvel@linaro.org \
--cc=drjones@redhat.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=sameo@linux.intel.com \
--cc=shannon.zhaosl@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).