Received: from eggs.gnu.org ([2001:4830:134:3::10]:54308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTT7c-00035G-4Q for qemu-devel@nongnu.org; Fri, 07 Jul 2017 09:16:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTT7Y-0004oh-Mw for qemu-devel@nongnu.org; Fri, 07 Jul 2017 09:16:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50952) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dTT7Y-0004oR-Dg for qemu-devel@nongnu.org; Fri, 07 Jul 2017 09:16:32 -0400 From: Laszlo Ersek References: <20170706101611.27031-1-marcandre.lureau@redhat.com> <20170706101611.27031-3-marcandre.lureau@redhat.com> <1ee1639b-3fa8-3dff-9957-31d96b8bf962@redhat.com> Message-ID: <262443f1-8fbb-211d-463d-a9fca66d479c@redhat.com> Date: Fri, 7 Jul 2017 15:16:21 +0200 MIME-Version: 1.0 In-Reply-To: <1ee1639b-3fa8-3dff-9957-31d96b8bf962@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 2/7] acpi: add vmcoreinfo device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , qemu-devel@nongnu.org Cc: imammedo@redhat.com, anderson@redhat.com, berrange@redhat.com, ehabkost@redhat.com, "Michael S. Tsirkin" , Paolo Bonzini , Richard Henderson On 07/07/17 15:13, Laszlo Ersek wrote: > Marc-Andr=C3=A9, >=20 > sorry about this, but I have another late comment (I shoudl have pointe= d > this out in v1). Regarding: >=20 > On 07/06/17 12:16, Marc-Andr=C3=A9 Lureau wrote: >=20 >> +#define VMCOREINFO_OFFSET 40 /* allow space for >> + * OVMF SDT Header Probe Sup= ressor >> + */ >=20 > and >=20 >> + Method (ADDR, 0, NotSerialized) >> + { >> + Local0 =3D Package (0x02) {} >> + Local0 [Zero] =3D (VCIA + 0x28) >> + Local0 [One] =3D Zero >> + Return (Local0) >> + } >=20 > and >=20 >> +In order to implement an OVMF "SDT Header Probe Suppressor", the cont= ents of >> +the vmcoreinfo blob has 40 bytes of padding: >> + >> ++-----------------------------------+ >> +| SSDT with OEM Table ID =3D VMCOREIN | >> ++-----------------------------------+ >> +| ... | TOP OF PAGE >> +| VCIA dword object ----------------|-----> +------------------------= ---+ >> +| ... | | fw-allocated array for = | >> +| _STA method referring to VCIA | | "etc/vmcoreinfo" = | >> +| ... | +------------------------= ---+ >> +| ADDR method referring to VCIA | | 0: OVMF SDT Header pro= be | >> +| ... | | suppressor = | >> ++-----------------------------------+ | 40: uint32 version fiel= d | >> + | 44: info contents = | >> + | .... = | >> + +------------------------= ---+ >> + END OF PAGE >=20 > Please define the VMCOREINFO_OFFSET macro like this: >=20 > #define VMCOREINFO_OFFSET sizeof(AcpiTableHeader) >=20 > and then please refresh the documentation as well: > - replace decimal "40" with "36", also replace decimal "44", the offset of "info contents", with "40"... you get the idea. Thanks Laszlo > - replace 0x28 in the dumped SSDT with 0x24. >=20 > Namely, in order to suppress the OVMF ACP Table Header Probe -- "SDT" > simply means "System Description Table" --, it's enough to add > zero-padding that *precisely* covers such a header. >=20 > Given that we have a typedef for this header in QEMU, we should use it > in the definition of VMCOREINFO_OFFSET. >=20 > Now, the reason why VMGENID uses 40 instead comes from another > requirement: the VMGENID GUID has to be aligned at 8 bytes. (See > requirement "R1a" in "docs/specs/vmgenid.txt".) Therefore the directly > necessary 36 bytes of padding are rounded up to 40. See again > "docs/specs/vmgenid.txt": >=20 > ----------------------------------+ > | SSDT with OEM Table ID =3D VMGENID | > +----------------------------------+ > | ... | TOP OF PAGE > | VGIA dword object ---------------|-----> +---------------------------= + > | ... | | fw-allocated array for = | > | _STA method referring to VGIA | | "etc/vmgenid_guid" = | > | ... | +---------------------------= + > | ADDR method referring to VGIA | | 0: OVMF SDT Header probe = | > | ... | | suppressor = | > +----------------------------------+ | 36: padding for 8-byte = | > | alignment = | > | 40: GUID = | > | 56: padding to page size = | > +---------------------------= + > END OF PAGE >=20 > At offset 36 of "etc/vmgenid_guid", it says "padding for 8-byte alignme= nt". >=20 > For VMCOREINFO, you don't need this extra alignment to 8 bytes, before > the "version" field is listed. So please make the VMCOREINFO_OFFSET > reflect what's actually necessary. >=20 > The rest of the code doesn't have to be modified (including your > experimental guest kernel driver); changing VMCOREINFO_OFFSET will > update all necessary locations automatically, including the generated > AML. Only the docs have to be synced manually. >=20 > ... In fact, there *is* yet another location to update: the test case. = I > suggest to include "hw/acpi/vmcoreinfo.h" in "tests/vmcoreinfo-test.c", > rather than open-code VMCOREINFO_OFFSET there. ... Oh wait: in the test > case you don't even use VMCOREINFO_OFFSET for anything. So just delete > the macro definition from that patch. >=20 > Thank you (and sorry about the churn), > Laszlo >=20