From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xstqp-0007IM-VW for qemu-devel@nongnu.org; Mon, 24 Nov 2014 08:38:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xstqg-00072T-OT for qemu-devel@nongnu.org; Mon, 24 Nov 2014 08:38:47 -0500 Received: from mail-wg0-x22b.google.com ([2a00:1450:400c:c00::22b]:47366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xstqg-00072N-IP for qemu-devel@nongnu.org; Mon, 24 Nov 2014 08:38:38 -0500 Received: by mail-wg0-f43.google.com with SMTP id l18so12611200wgh.16 for ; Mon, 24 Nov 2014 05:38:38 -0800 (PST) Date: Mon, 24 Nov 2014 14:38:34 +0100 From: Vasilis Liaskovitis Message-ID: <20141124133834.GB5556@clowntown> References: <1416683132-22017-1-git-send-email-vliaskov@gmail.com> <1416821825.20462.1.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1416821825.20462.1.camel@localhost.localdomain> Subject: Re: [Qemu-devel] [PATCH] qtest/bios-tables: Add DMAR unit test on intel_iommu for q35 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum Cc: jan.kiszka@web.de, knut.omang@oracle.com, qemu-devel@nongnu.org, mst@redhat.com Hi, On Mon, Nov 24, 2014 at 11:37:05AM +0200, Marcel Apfelbaum wrote: > On Sat, 2014-11-22 at 20:05 +0100, Vasilis Liaskovitis wrote: > > The test enables intel_iommu on q35 and reads the DMAR table and its only > > DRHC structure (for now), checking only the header and checksums. > > > > Signed-off-by: Vasilis Liaskovitis > > --- > > tests/bios-tables-test.c | 34 +++++++++++++++++++++++++++++++++- > > 1 file changed, 33 insertions(+), 1 deletion(-) > > > > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c > > index 9e4d205..f09b0cb 100644 > > --- a/tests/bios-tables-test.c > > +++ b/tests/bios-tables-test.c > > @@ -45,6 +45,8 @@ typedef struct { > > AcpiRsdtDescriptorRev1 rsdt_table; > > AcpiFadtDescriptorRev1 fadt_table; > > AcpiFacsDescriptorRev1 facs_table; > > + AcpiTableDmar dmar_table; > > + AcpiDmarHardwareUnit drhd; > > uint32_t *rsdt_tables_addr; > > int rsdt_tables_nr; > > GArray *tables; > > @@ -371,6 +373,33 @@ static void test_acpi_dsdt_table(test_data *data) > > g_array_append_val(data->tables, dsdt_table); > > } > > > > +static void test_acpi_dmar_table(test_data *data) > > +{ > > + AcpiTableDmar *dmar_table = &data->dmar_table; > > + AcpiDmarHardwareUnit *drhd = &data->drhd; > > + struct AcpiTableHeader *header = (struct AcpiTableHeader *) dmar_table; > > + int tables_nr = data->rsdt_tables_nr - 1; > > + uint32_t addr = data->rsdt_tables_addr[tables_nr]; /* dmar is last */ > Hi, > > The DMAR table is always last? If not, it will break when we add another table test. > I suggest going over the tables and looking for the DMAR signature. agreed, it would also break if hw/i386/acpi-build.c adds other tables after DMAR. I posted v2 following your suggestion. thanks, - Vasilis