From patchwork Mon Jun 1 10:15:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 478881 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E2EDB140F91 for ; Mon, 1 Jun 2015 20:15:36 +1000 (AEST) Received: from localhost ([::1]:51138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzMko-00053j-Qs for incoming@patchwork.ozlabs.org; Mon, 01 Jun 2015 06:15:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzMkT-0004Vp-8u for qemu-devel@nongnu.org; Mon, 01 Jun 2015 06:15:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YzMkO-0005cy-AR for qemu-devel@nongnu.org; Mon, 01 Jun 2015 06:15:13 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:34114) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzMkO-0005cL-49 for qemu-devel@nongnu.org; Mon, 01 Jun 2015 06:15:08 -0400 Received: by pdbki1 with SMTP id ki1so104387051pdb.1 for ; Mon, 01 Jun 2015 03:15:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=lr/CilAqm/6K53iQIAYuCpzs01uaN1COzz60eX1K/lI=; b=HEZKsOmuygP1thgHtLprzzRgyR8z+TsZxQkZDdGlhr9nkQ9LLNR++z8T3ikBgy6ySv jgHxSG7nQmcI4PH7qS0/IrbIasZtaM0tiSV896FwyxbUukxX5f9bIviL5caH/hMpmDUf uBvuII+T2vdcPZnioh/tdf18Di6klvrQBW2KKZ8nokIfI+FhGniiMtTN3O9639oG3e9U edn6qsSMOKNrpXyXYuRgbkYpzbO98V6wGMqvzvmPJA9XXdAwvCrKruI9ZvdCP5RsHJAQ KJLRgYiNQMk8m5r/bH8x5LGN+2aJQyyqcDID+QUIVlFQT2TSE5njxmnt/ye8cv4js2t6 ZrnQ== X-Gm-Message-State: ALoCoQlemrEg5cvkOlsV73TPDXpfN+cgcu0pc5qYcUNGfW2CWw1lEQ93KftOz4B4uNO7bf8BTQxP X-Received: by 10.69.19.129 with SMTP id gu1mr1760950pbd.162.1433153706806; Mon, 01 Jun 2015 03:15:06 -0700 (PDT) Received: from localhost ([167.160.116.150]) by mx.google.com with ESMTPSA id x3sm13682123pbt.93.2015.06.01.03.15.04 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 01 Jun 2015 03:15:05 -0700 (PDT) From: shannon.zhao@linaro.org To: qemu-devel@nongnu.org, peter.maydell@linaro.org, christoffer.dall@linaro.org Date: Mon, 1 Jun 2015 18:15:00 +0800 Message-Id: <1433153700-1336-1-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.192.181 Cc: shannon.zhao@linaro.org, zhaoshenglong@huawei.com Subject: [Qemu-devel] [RFC PATCH] hw/arm/virt-acpi-build: Add GICv2m description in ACPI MADT table X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Shannon Zhao Add GICv2m description in ACPI MADT table, so guest can use MSI when booting with ACPI. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- This is based on Christoffer's GICv2m patchset. Test virtio-net-pci, e1000. --- hw/arm/virt-acpi-build.c | 11 +++++++++++ include/hw/acpi/acpi-defs.h | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index a9373cc..d8dcf45 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -385,8 +385,10 @@ build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info, { int madt_start = table_data->len; const MemMapEntry *memmap = guest_info->memmap; + const int *irqmap = guest_info->irqmap; AcpiMultipleApicTable *madt; AcpiMadtGenericDistributor *gicd; + AcpiMadtGenericMsiFrame *gic_msi; int i; madt = acpi_data_push(table_data, sizeof *madt); @@ -410,6 +412,15 @@ build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info, gicd->length = sizeof(*gicd); gicd->base_address = memmap[VIRT_GIC_DIST].base; + gic_msi = acpi_data_push(table_data, sizeof *gic_msi); + gic_msi->type = ACPI_APIC_GENERIC_MSI_FRAME; + gic_msi->length = sizeof(*gic_msi); + gic_msi->gic_msi_frame_id = 0; + gic_msi->base_address = memmap[VIRT_GIC_V2M].base; + gic_msi->flags = cpu_to_le32(1); + gic_msi->spi_count = NUM_GICV2M_SPIS; + gic_msi->spi_base = irqmap[VIRT_GIC_V2M] + ARM_SPI_BASE; + build_header(linker, table_data, (void *)(table_data->data + madt_start), "APIC", table_data->len - madt_start, 5); diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index f503ec4..61c4314 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -340,6 +340,18 @@ struct AcpiMadtGenericDistributor { typedef struct AcpiMadtGenericDistributor AcpiMadtGenericDistributor; +struct AcpiMadtGenericMsiFrame { + ACPI_SUB_HEADER_DEF + uint16_t reserved; + uint32_t gic_msi_frame_id; + uint64_t base_address; + uint32_t flags; + uint16_t spi_count; + uint16_t spi_base; +} QEMU_PACKED; + +typedef struct AcpiMadtGenericMsiFrame AcpiMadtGenericMsiFrame; + /* * Generic Timer Description Table (GTDT) */