From patchwork Fri Jun 26 13:31:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 50354 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A845022902 for ; Fri, 26 Jun 2015 13:35:48 +0000 (UTC) Received: by laer2 with SMTP id r2sf27079920lae.3 for ; Fri, 26 Jun 2015 06:35:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=a5hdOrxwdn+xAUBOt7qcEmFRC0wJ62fSwSy5lBRG0MQ=; b=HfbAX+kRPFwUKfPcpjeHZ4C5e8JHKNj09p2IxX5gx9Te8r2fFdo1e43EUBeJZtu6US hfvOm4yn/0QYovrNJS5/7EIAA39CHKjvuRu6UVfnGWA97uJjikftUhv3jQ5HiHcQjgmW GHmVpdksKUvnZT5jdTUBx37f+vvpON1HEGr09WvV9FAYGTrtxdQUlbwqN4T/WWuFwA3/ N/C0TjXuXBXcjJY9oM/JfDhJKsZp87SnmScOSctg0TI2fE0SWsT2+2teVrUWVUouFNze gjzm/2odF8c3sWBIWPEXMutqGvrLnAXfCE+Q3N2vJE5LuQvF6tmLvFiKjU3+y5OVym7d 5dNw== X-Gm-Message-State: ALoCoQnVsTqjdrgH0QJEOM8vr1EpIB5yOn3XXXKthIfsyqLxQ0qTN2uzegnqhFrn5LT1/KgT4cIO X-Received: by 10.194.58.164 with SMTP id s4mr1154309wjq.3.1435325747679; Fri, 26 Jun 2015 06:35:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.70 with SMTP id z6ls515004lag.9.gmail; Fri, 26 Jun 2015 06:35:47 -0700 (PDT) X-Received: by 10.112.218.67 with SMTP id pe3mr1432513lbc.53.1435325747522; Fri, 26 Jun 2015 06:35:47 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id la8si27415253lac.141.2015.06.26.06.35.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2015 06:35:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by lacny3 with SMTP id ny3so63658297lac.3 for ; Fri, 26 Jun 2015 06:35:47 -0700 (PDT) X-Received: by 10.112.219.70 with SMTP id pm6mr1601814lbc.41.1435325747166; Fri, 26 Jun 2015 06:35:47 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1332154lbb; Fri, 26 Jun 2015 06:35:45 -0700 (PDT) X-Received: by 10.55.50.195 with SMTP id y186mr3564284qky.55.1435325745372; Fri, 26 Jun 2015 06:35:45 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id i203si32870325qhc.66.2015.06.26.06.35.44 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 26 Jun 2015 06:35:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:60037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8TnE-0000x3-K5 for patch@linaro.org; Fri, 26 Jun 2015 09:35:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8TjI-0002RU-9Q for qemu-devel@nongnu.org; Fri, 26 Jun 2015 09:31:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z8TjB-0001Ws-Ub for qemu-devel@nongnu.org; Fri, 26 Jun 2015 09:31:40 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8TjB-0001QX-NN for qemu-devel@nongnu.org; Fri, 26 Jun 2015 09:31:33 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Z8Tj2-0005GX-3W for qemu-devel@nongnu.org; Fri, 26 Jun 2015 14:31:24 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 26 Jun 2015 14:31:18 +0100 Message-Id: <1435325484-20208-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1435325484-20208-1-git-send-email-peter.maydell@linaro.org> References: <1435325484-20208-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 2/7] 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 Reviewed-by: Andrew Jones Tested-by: Andrew Jones Message-id: 1434676210-2276-1-git-send-email-shannon.zhao@linaro.org Signed-off-by: Peter Maydell --- 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 40029dd..f365140 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -423,8 +423,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); @@ -448,6 +450,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 = cpu_to_le64(memmap[VIRT_GIC_V2M].base); + gic_msi->flags = cpu_to_le32(1); + gic_msi->spi_count = cpu_to_le16(NUM_GICV2M_SPIS); + gic_msi->spi_base = cpu_to_le16(irqmap[VIRT_GIC_V2M] + ARM_SPI_BASE); + build_header(linker, table_data, (void *)(table_data->data + madt_start), "APIC", table_data->len - madt_start, 3); diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index 7b4bfb7..2b431e6 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -372,6 +372,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) */