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: 49285 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 70A9121580 for ; Mon, 1 Jun 2015 10:15:58 +0000 (UTC) Received: by lbcue7 with SMTP id ue7sf33183703lbc.3 for ; Mon, 01 Jun 2015 03:15:57 -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=lr/CilAqm/6K53iQIAYuCpzs01uaN1COzz60eX1K/lI=; b=Fz5KvkCtxbcYvXnX04NcT4ubXWIkRbDYYYBDKYae133E3/O4K7MPViZ8WNJVyGiYuA FMpvScEvT+zDsZq7e+1CIctUxtGm+kZwbj3sPim6UxOOjmj78DFTHL1NgEcICq/gd/KQ X7rUj46djqnkHWMO2eRTSK9a45uZfF4s3wX+NqqYdG4csZuyYVKasGiFBncNgQQkD8CM ZkXuoMEOgcyedUbtzbwNge9vcMIzxbcYmbfCGVcigoqVb+HlytDlaZ94Wd3IzTTM5uWO gptINU/qZDP+gwYEOn+9iLz/kgVlw3gRsO2P7XfkrhQQ07ISOsKCux0rBHdX9QEOirzq Y+CA== X-Gm-Message-State: ALoCoQkxY6FXQAE9irls96g73Bs86kxvecE5oZtGoshES7WjotnSzWqsd2D+qiEtKSw5dzU7tvw6 X-Received: by 10.112.171.41 with SMTP id ar9mr20294096lbc.24.1433153757259; Mon, 01 Jun 2015 03:15:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.25.166 with SMTP id d6ls54564lag.54.gmail; Mon, 01 Jun 2015 03:15:57 -0700 (PDT) X-Received: by 10.152.87.204 with SMTP id ba12mr20684700lab.35.1433153757118; Mon, 01 Jun 2015 03:15:57 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id jc6si7103652lac.71.2015.06.01.03.15.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jun 2015 03:15:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by laei3 with SMTP id i3so9856132lae.3 for ; Mon, 01 Jun 2015 03:15:56 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr4274274lbb.56.1433153756355; Mon, 01 Jun 2015 03:15:56 -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 hn6csp2202417lbb; Mon, 1 Jun 2015 03:15:55 -0700 (PDT) X-Received: by 10.140.83.105 with SMTP id i96mr22303472qgd.12.1433153755044; Mon, 01 Jun 2015 03:15:55 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 193si4957409qhx.126.2015.06.01.03.15.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 01 Jun 2015 03:15:55 -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]:51138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzMl8-00053j-2Z for patch@linaro.org; Mon, 01 Jun 2015 06:15:54 -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-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+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.215.53 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 --- 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) */