From patchwork Fri Jun 19 01:10:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 50061 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CACC822903 for ; Fri, 19 Jun 2015 01:10:49 +0000 (UTC) Received: by lagh6 with SMTP id h6sf25434799lag.0 for ; Thu, 18 Jun 2015 18:10:48 -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:cc: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=NY2bdpiHNdO3ThQ2iwCeEZtNe2MH6rTcqu45BqUoBzI=; b=Dl2T/P+qhN/XrXd9rQf9b9oEcXHbBgJxMhMv4W3Nqe68FVeOBXaKjXP4rdgPVx17nM Uetp9aZMrapmcR3VZrtBwSglJDfYdyQ+3AkCDAKaNmdv5gREnS2/VMLnMy0OQu52DlRZ iT3FJVzcNzDLMM1MV74YrfHTXde1l6zQsMM1MLhF0+L9H2MpzPxHQw00yhS47vTUS1Ab tH+bLMOyoBLF5XaLZzuM+Fv5pu64HApc8IV1tOuz8esQElD86GbHzifBZWRuA9/3zPNp 4aTHXhw0yTB6MQBSSEnj/G0SdVykAQ5Ekuc097MQuS5gVgYcc29F3NNG5lGxorFcKzCT KXew== X-Gm-Message-State: ALoCoQl86xtR/60MAQmn4heUUFSB9Op4dFcui3Z4Z58Xy/b48PBrcxA6EVSTySoEVER5iW0iW5ND X-Received: by 10.112.162.228 with SMTP id yd4mr12627214lbb.8.1434676248609; Thu, 18 Jun 2015 18:10:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.146 with SMTP id j18ls548492laa.22.gmail; Thu, 18 Jun 2015 18:10:48 -0700 (PDT) X-Received: by 10.112.146.97 with SMTP id tb1mr15785571lbb.12.1434676248461; Thu, 18 Jun 2015 18:10:48 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id ql5si7728218lbb.165.2015.06.18.18.10.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 18:10:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbwc1 with SMTP id wc1so62916022lbb.2 for ; Thu, 18 Jun 2015 18:10:48 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr15394632lbc.19.1434676248290; Thu, 18 Jun 2015 18:10:48 -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 hn6csp213783lbb; Thu, 18 Jun 2015 18:10:47 -0700 (PDT) X-Received: by 10.55.22.27 with SMTP id g27mr8870410qkh.43.1434676246827; Thu, 18 Jun 2015 18:10:46 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id i64si9399008qge.99.2015.06.18.18.10.45 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 18:10:46 -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]:55480 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5kpR-0000FM-LV for patch@linaro.org; Thu, 18 Jun 2015 21:10:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5kp3-0008Pv-4U for qemu-devel@nongnu.org; Thu, 18 Jun 2015 21:10:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5koz-000507-Rq for qemu-devel@nongnu.org; Thu, 18 Jun 2015 21:10:21 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:34227) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5koz-0004zk-La for qemu-devel@nongnu.org; Thu, 18 Jun 2015 21:10:17 -0400 Received: by pabvl15 with SMTP id vl15so26772326pab.1 for ; Thu, 18 Jun 2015 18:10:16 -0700 (PDT) X-Received: by 10.68.219.1 with SMTP id pk1mr26177801pbc.18.1434676216607; Thu, 18 Jun 2015 18:10:16 -0700 (PDT) Received: from localhost ([180.150.134.149]) by mx.google.com with ESMTPSA id xo3sm9229139pbb.74.2015.06.18.18.10.14 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 18:10:15 -0700 (PDT) From: shannon.zhao@linaro.org To: qemu-devel@nongnu.org, peter.maydell@linaro.org, imammedo@redhat.com, mst@redhat.com, christoffer.dall@linaro.org Date: Fri, 19 Jun 2015 09:10:10 +0800 Message-Id: <1434676210-2276-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.220.47 Cc: shannon.zhao@linaro.org, zhaoshenglong@huawei.com Subject: [Qemu-devel] [PATCH v2] 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: shannon.zhao@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.217.169 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 --- Fix endianness [Peter] --- 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 d5a8b9c..3652c87 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, 5); 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) */