From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGp2s-0000jN-Cj for qemu-devel@nongnu.org; Mon, 11 Aug 2014 08:49:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGp2j-0007yc-AW for qemu-devel@nongnu.org; Mon, 11 Aug 2014 08:49:50 -0400 Received: from e8.ny.us.ibm.com ([32.97.182.138]:49159) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGp2j-0007yY-6H for qemu-devel@nongnu.org; Mon, 11 Aug 2014 08:49:41 -0400 Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 11 Aug 2014 08:49:39 -0400 Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id D0CC86E8048 for ; Mon, 11 Aug 2014 08:49:26 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by b01cxnp22034.gho.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s7BCnb599896330 for ; Mon, 11 Aug 2014 12:49:37 GMT Received: from d01av03.pok.ibm.com (localhost [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s7BCnbT7009000 for ; Mon, 11 Aug 2014 08:49:37 -0400 Message-ID: <53E8BBE0.3020201@linux.vnet.ibm.com> Date: Mon, 11 Aug 2014 08:49:36 -0400 From: Stefan Berger MIME-Version: 1.0 References: <1406720068-16482-1-git-send-email-mst@redhat.com> <1406720068-16482-3-git-send-email-mst@redhat.com> In-Reply-To: <1406720068-16482-3-git-send-email-mst@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/2] acpi: cleanups tcpa table generation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , qemu-devel@nongnu.org Cc: Anthony Liguori On 07/30/2014 07:34 AM, Michael S. Tsirkin wrote: > Improve readability, no functional changes. There's a subtle problem -- I am fixing this for v3. > Signed-off-by: Michael S. Tsirkin > --- > hw/i386/acpi-build.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > index 66cde2b..6ae3a9e 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c > @@ -1209,17 +1209,13 @@ build_hpet(GArray *table_data, GArray *linker) > static void > build_tpm_tcpa(GArray *table_data, GArray *linker) > { > - Acpi20Tcpa *tcpa; > - uint32_t log_area_minimum_length = TPM_LOG_AREA_MINIMUM_SIZE; > - uint64_t log_area_start_address; > - size_t len = log_area_minimum_length + sizeof(*tcpa); > + Acpi20Tcpa *tcpa = acpi_data_push(table_data, sizeof *tcpa); > + uint64_t log_area_start_address = acpi_data_len(table_data); > > - log_area_start_address = table_data->len + sizeof(*tcpa); > - > - tcpa = acpi_data_push(table_data, len); > + acpi_data_push(table_data, TPM_LOG_AREA_MINIMUM_SIZE); This 2nd acpi_data_push manipulates table_data and the BIOS linker loader function further below now operates with this new table_data offsets etc. We have to move this acpi_data_push all the way to the end and then it works. > > tcpa->platform_class = cpu_to_le16(TPM_TCPA_ACPI_CLASS_CLIENT); > - tcpa->log_area_minimum_length = cpu_to_le32(log_area_minimum_length); > + tcpa->log_area_minimum_length = cpu_to_le32(TPM_LOG_AREA_MINIMUM_SIZE); > tcpa->log_area_start_address = cpu_to_le64(log_area_start_address); > > /* LASA address to be filled by Guest linker */