From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: imammedo@redhat.com, dgilbert@redhat.com, mst@redhat.com
Subject: [Qemu-devel] [PATCH v2 1/4] pc: append ssdt-misc.dsl to the DSDT
Date: Wed, 24 Dec 2014 17:07:35 +0100 [thread overview]
Message-ID: <1419437261-21113-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1419437261-21113-1-git-send-email-pbonzini@redhat.com>
This part of the ACPI tables can vary in size across machine types, but
does not depend on the command-line. It is an SSDT just because it is
the same for i440fx and Q35, and making it an SSDT made the code a bit
simpler. However, it also complicates backwards compatibility, so
merge it with the DSDT.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/i386/acpi-build.c | 55 +++++++++++++++++++++++++++---------------
tests/acpi-test-data/pc/DSDT | Bin 3592 -> 3920 bytes
tests/acpi-test-data/pc/SSDT | Bin 2279 -> 1951 bytes
tests/acpi-test-data/q35/DSDT | Bin 8182 -> 8510 bytes
tests/acpi-test-data/q35/SSDT | Bin 560 -> 232 bytes
5 files changed, 35 insertions(+), 20 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index a4d0c0c..e723fe1 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1061,26 +1061,18 @@ static void patch_pci_windows(PcPciInfo *pci, uint8_t *start, unsigned size)
}
}
+#define SSDT_MISC_SIZE (sizeof(ssdt_misc_aml) - sizeof(AcpiTableHeader))
+
static void
-build_ssdt(GArray *table_data, GArray *linker,
- AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
- PcPciInfo *pci, PcGuestInfo *guest_info)
+fill_ssdt_misc(uint8_t *dest, AcpiPmInfo *pm, AcpiMiscInfo *misc,
+ PcPciInfo *pci)
{
MachineState *machine = MACHINE(qdev_get_machine());
uint32_t nr_mem = machine->ram_slots;
- unsigned acpi_cpus = guest_info->apic_id_limit;
- int ssdt_start = table_data->len;
uint8_t *ssdt_ptr;
- int i;
-
- /* The current AML generator can cover the APIC ID range [0..255],
- * inclusive, for VCPU hotplug. */
- QEMU_BUILD_BUG_ON(ACPI_CPU_HOTPLUG_ID_LIMIT > 256);
- g_assert(acpi_cpus <= ACPI_CPU_HOTPLUG_ID_LIMIT);
/* Copy header and patch values in the S3_ / S4_ / S5_ packages */
- ssdt_ptr = acpi_data_push(table_data, sizeof(ssdp_misc_aml));
- memcpy(ssdt_ptr, ssdp_misc_aml, sizeof(ssdp_misc_aml));
+ ssdt_ptr = g_memdup(ssdp_misc_aml, sizeof(ssdp_misc_aml));
if (pm->s3_disabled) {
ssdt_ptr[acpi_s3_name[0]] = 'X';
}
@@ -1099,6 +1091,27 @@ build_ssdt(GArray *table_data, GArray *linker,
ACPI_BUILD_SET_LE(ssdt_ptr, sizeof(ssdp_misc_aml),
ssdt_mctrl_nr_slots[0], 32, nr_mem);
+ memcpy(dest, ssdt_ptr + sizeof(AcpiTableHeader), SSDT_MISC_SIZE);
+ g_free(ssdt_ptr);
+}
+
+static void
+build_ssdt(GArray *table_data, GArray *linker,
+ AcpiCpuInfo *cpu, AcpiPmInfo *pm, PcGuestInfo *guest_info)
+{
+ MachineState *machine = MACHINE(qdev_get_machine());
+ uint32_t nr_mem = machine->ram_slots;
+ unsigned acpi_cpus = guest_info->apic_id_limit;
+ int ssdt_start = table_data->len;
+ int i;
+
+ acpi_data_push(table_data, sizeof(AcpiTableHeader));
+
+ /* The current AML generator can cover the APIC ID range [0..255],
+ * inclusive, for VCPU hotplug. */
+ QEMU_BUILD_BUG_ON(ACPI_CPU_HOTPLUG_ID_LIMIT > 256);
+ g_assert(acpi_cpus <= ACPI_CPU_HOTPLUG_ID_LIMIT);
+
{
GArray *sb_scope = build_alloc_array();
uint8_t op = 0x10; /* ScopeOp */
@@ -1423,18 +1436,21 @@ build_dmar_q35(GArray *table_data, GArray *linker)
}
static void
-build_dsdt(GArray *table_data, GArray *linker, AcpiMiscInfo *misc)
+build_dsdt(GArray *table_data, GArray *linker, AcpiPmInfo *pm,
+ AcpiMiscInfo *misc, PcPciInfo *pci)
{
AcpiTableHeader *dsdt;
+ size_t size;
assert(misc->dsdt_code && misc->dsdt_size);
- dsdt = acpi_data_push(table_data, misc->dsdt_size);
+ size = misc->dsdt_size + SSDT_MISC_SIZE;
+ dsdt = acpi_data_push(table_data, size);
memcpy(dsdt, misc->dsdt_code, misc->dsdt_size);
+ fill_ssdt_misc(((uint8_t *)dsdt) + misc->dsdt_size, pm, misc, pci);
memset(dsdt, 0, sizeof *dsdt);
- build_header(linker, table_data, dsdt, "DSDT",
- misc->dsdt_size, 1);
+ build_header(linker, table_data, dsdt, "DSDT", size, 1);
}
/* Build final rsdt table */
@@ -1591,7 +1607,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
/* DSDT is pointed to by FADT */
dsdt = tables->table_data->len;
- build_dsdt(tables->table_data, tables->linker, &misc);
+ build_dsdt(tables->table_data, tables->linker, &pm, &misc, &pci);
/* Count the size of the DSDT and SSDT, we will need it for legacy
* sizing of ACPI tables.
@@ -1604,8 +1620,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
ssdt = tables->table_data->len;
acpi_add_table(table_offsets, tables->table_data);
- build_ssdt(tables->table_data, tables->linker, &cpu, &pm, &misc, &pci,
- guest_info);
+ build_ssdt(tables->table_data, tables->linker, &cpu, &pm, guest_info);
aml_len += tables->table_data->len - ssdt;
acpi_add_table(table_offsets, tables->table_data);
diff --git a/tests/acpi-test-data/pc/DSDT b/tests/acpi-test-data/pc/DSDT
index ee9cc6781cea3a9515b9a176eea3459f8e4d8655..9bcc9ba9540f768afeba95231229e093b538d020 100644
GIT binary patch
delta 350
zcmZ9Iy-ve06os!tsH~fW{wM<jVrL=|uu~eV7&WPhO+iYfn~||AQ-KMIk(B|YyZ}$o
zSKx_S?34xWbk6y%j<5W3@O_Ax&W!2;u=g)qN6X%1cMe=7nnD2JRtX9>o7I}DbVg`V
zs;M6!x3nD_i2uRlZ;)q2>Dr)oWV=b9(4gZpX6s3x(t!Kuq1U>zr9<uNc{o4bA$>t=
zBonEJR6XaY#LRHIlv#8w@|z?{QhSilCIF}&m6(>yIaWOdzeX7z?~^t|SU6IDblz%c
z;L~rg8}F5wG7czHH+3A|mg>r|#k~tSjY{2*5XbgT`#bCbUR{KqoaV(=`c~fAdRfSA
Ky+iFg4*UTB4N6r2
delta 19
acmca0*CE5@66_Mf!N<VBn6i=UA1?qiYXuDe
diff --git a/tests/acpi-test-data/pc/SSDT b/tests/acpi-test-data/pc/SSDT
index 558e4c85b031ec081045aec6cc382a680e9c6009..0dd46c68d186f6cb1fb7ee5ad935945fed4f31e8 100644
GIT binary patch
delta 23
ecmaDZIG>*@IM^j*K05;g<F$!g(wlP`tJncn1_s0c
delta 352
zcmZ9Iu};G<5Qfho6w66lQe{A5Wnm%_uu~cfEH$l(O+iYf%gERjF%(!kAszsb@&Y^o
zkJGoHoD&xC^#A{N`tRho{yGxIWOmH~SnoybFUQ++;5soF0sto^G2CpvzPV0kC<vtn
zqd?Gn`zVnAgYn-W&nAUygWW^wMstjVj?Wm?qdCC=_k}0C#+~AlP&0ZK&X2axoTDD8
zM42I$&$-ZYW;tG}ta~N%>m*51I!GED0F;kfP7CH7E1!a2qb-m3(AXg?9I4(ruNBnr
z;n$)c_litg2ehr~Dh_W7Z53PGxq#!SFi}^C3%Zm3hTX%;MZ#0le9}sv<So^!iE8T|
MYW6trdGN6F1Ki?DumAu6
diff --git a/tests/acpi-test-data/q35/DSDT b/tests/acpi-test-data/q35/DSDT
index ef0c75f4236de3e6f727e21991533f2bf8279dee..c30ec0462acee10c55e1035ba0e6798a0739dc35 100644
GIT binary patch
delta 350
zcmZ9Iu};G<5QfhXD$7ZstunA7MkW#gE6_F;7&WP}O+iYf%gET30Toyoc>$2}0=xk5
zK+KGkbIJlY{r~@+exLkx^fnNg&D`NO0K0t^pIh_JXl)8yCl(_B_#h=QS}fkbxlSi2
z2&ERgq2NTDp+No*Mt_4mD~xZ0&JJ~>-NRlhU<|z8#~u#^2%_W;<{mYx$I*0m73~1^
zP$kOtv3$sdmJ`SERAudRnO`JHlF~uax)7ke({gN>cdWb*e~orL-bCyAF!Q8(Zaq~{
z!%I+$jd<N;+IgT|RabFzY4n+6vuhu492(ng3vohs((kYvc=VB2QRBQ=%7Ek*)vH1+
K>pg1T@!$uPnoErU
delta 19
acmdnz^v#~jCD<k8n>+&p<FAceZ{z_=+y_Mf
diff --git a/tests/acpi-test-data/q35/SSDT b/tests/acpi-test-data/q35/SSDT
index 4e45510181c4038505ae1815b76799a2cd0e8808..3700bcc31e1469d4b9aafbf34963d937200a6f15 100644
GIT binary patch
delta 22
dcmdnM@`8~oIM^lR1p@;Equ)d>>B+f_hXG9s2A2Q;
delta 351
zcmZ9Iu};G<5QfhsRF;zhtui37vM}KY*eQ(#mYUSWrXZ!#Wn}EiRA6PQ`T`*30eFLU
z;01UKo`P~tS>UGs|G(4klfT$|AgoQDYyq&(xj2{&w<o}jv={-vij=}=y<UEElZ;Ui
zN-TCm!HG6Qf%+c|{{~r_7rqVlj;I^$3HI6nW8n2E_IMyb5G8kpGeXVkc{DlRLVJN`
zpry8bET1!B)Yx&n(rM>fWj9jFgbq^Hg#hKFQKN!+$I7Sh*BHm+eYCC*Q%|bb_M(Cs
z-hx`}#ydr7oCn5Lbrnaqg>jlq?|r~=P}puqh)cSY{)Roki;qN0kFtCt1Cn=CuXDYr
M_o#WtgZbgd4{V`Jg8%>k
--
1.8.3.1
next prev parent reply other threads:[~2014-12-24 16:07 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-24 16:07 [Qemu-devel] [PATCH v2 0/4] acpi: move common parts of the SSDT to the DSDT (and preview of things to come) Paolo Bonzini
2014-12-24 16:07 ` Paolo Bonzini [this message]
2015-01-19 15:15 ` [Qemu-devel] [PATCH v2 1/4] pc: append ssdt-misc.dsl to the DSDT Igor Mammedov
2015-01-19 15:41 ` Paolo Bonzini
2015-01-19 17:14 ` Igor Mammedov
2015-01-19 17:26 ` Paolo Bonzini
2015-01-19 19:29 ` Michael S. Tsirkin
2015-01-19 19:33 ` Michael S. Tsirkin
2015-01-19 19:57 ` Paolo Bonzini
2015-01-19 21:27 ` Michael S. Tsirkin
2015-01-20 9:59 ` Igor Mammedov
2015-01-20 10:34 ` Paolo Bonzini
2015-01-20 10:35 ` Michael S. Tsirkin
2015-01-20 12:41 ` Igor Mammedov
2015-01-20 12:56 ` Michael S. Tsirkin
2015-01-19 15:31 ` Michael S. Tsirkin
2014-12-24 16:07 ` [Qemu-devel] [PATCH v2 2/4] pc: rename ssdt-misc to dsdt-common Paolo Bonzini
2014-12-24 16:07 ` [Qemu-devel] [PATCH v2 3/4] pc: move common parts of the DSDT " Paolo Bonzini
2014-12-24 16:07 ` [Qemu-devel] [PATCH v2 4/4] pc: merge DSDT common parts into acpi-dsdt-common.dsl Paolo Bonzini
2015-01-19 15:26 ` Michael S. Tsirkin
2015-01-19 15:33 ` Paolo Bonzini
2015-01-19 15:38 ` Michael S. Tsirkin
2014-12-24 16:07 ` [Qemu-devel] [PATCH v2 5/4] pc: introduce new ACPI table sizing algorithm Paolo Bonzini
2015-01-19 15:33 ` Michael S. Tsirkin
2014-12-24 16:07 ` [Qemu-devel] [PATCH v2 6/4] pc: clean up pre-2.1 compatibility code Paolo Bonzini
2014-12-24 16:07 ` [Qemu-devel] [PATCH v2 7/4] pc: go back to smaller ACPI tables Paolo Bonzini
2015-01-19 15:36 ` Michael S. Tsirkin
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=1419437261-21113-2-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=dgilbert@redhat.com \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.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 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).