From patchwork Thu Oct 29 15:16:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 55789 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp623648lbr; Thu, 29 Oct 2015 08:17:40 -0700 (PDT) X-Received: by 10.55.221.9 with SMTP id n9mr2929901qki.102.1446131860591; Thu, 29 Oct 2015 08:17:40 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f73si1604717qkh.96.2015.10.29.08.17.40 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 Oct 2015 08:17:40 -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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dkim=fail header.i=@linaro_org.20150623.gappssmtp.com Received: from localhost ([::1]:44701 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZroxQ-0002H1-AO for patch@linaro.org; Thu, 29 Oct 2015 11:17:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zrowx-0001zv-76 for qemu-devel@nongnu.org; Thu, 29 Oct 2015 11:17:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zrowu-0005Dt-GG for qemu-devel@nongnu.org; Thu, 29 Oct 2015 11:17:11 -0400 Received: from mail-pa0-x232.google.com ([2607:f8b0:400e:c03::232]:33014) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zrowu-0005Do-Aq for qemu-devel@nongnu.org; Thu, 29 Oct 2015 11:17:08 -0400 Received: by padhy1 with SMTP id hy1so37711859pad.0 for ; Thu, 29 Oct 2015 08:17:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=yjAo2A6pnzbVkVj6/MWzQEr3e8YtqFOjLGFNrwM+OqQ=; b=cmMhWsxpht9VrjLYVuMnCxl83xdXbBfFU9iOqqdZKKehrpn678e61WyvRX0kqwJXSN irMQAqhSLtJweEP1n+zevZz+xaoIluEP1SX53dubR9W3m1OAZ6NMlcZE6tUmVmtcdzWM dqxm4JdOcQ0ONLq+LMQFW5W56Wrjj5WtKRoByfbqTh94NxAWn31qNTJG4qVfLs3M1Y7z l7qFMY8o6sklLaw1tuAvRbwaXRops0/QmvU8pB7UrAq+TUmG5aiMyK/DL7z5qud+Chbe oevjEg7sNDizt5vIPU757XYPfJzKkveVNfW3q6NylOpacqlGW9t9FOeKDtIVxDPiciMh 8Snw== 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=yjAo2A6pnzbVkVj6/MWzQEr3e8YtqFOjLGFNrwM+OqQ=; b=GR3ASK2Ma+Wz319Z889Fpy8lnATLrnEnMRQkg1M0zfKWOMPhuLCSnw0NsbfJpEX5kK w65GQLaauko4msZBttxSxKuQvY3hVKNev7/UbIsrto6d4d+n51j+s4iiP0c41sqRbiYt rz0pTXNIxIt3QtfA5UafezBuhCVrLtEhCvaY0tTdrJ6mizmU5hk8qI5NlwKOUuMZQpCd MfTmbRd2SWn+KivgeLW4AlCOkkawl0DGfOJSOzy5iovq11Kvy2fJNEevfIQw8GvWx6yb jDORcmoM+NHZA1aCTRg5xx8amvCYQ+WH6WNQnzEdSwHnifqrgg5RA9ZDyNYr3+YZkeDe q4VA== X-Gm-Message-State: ALoCoQmtjmz/fZrucacQQAR9dNnHgUSUYZoECQFU3v9Iut/zCTyVBqQJ/dVDszc735DRv93CMO6f X-Received: by 10.66.90.165 with SMTP id bx5mr2457290pab.87.1446131827104; Thu, 29 Oct 2015 08:17:07 -0700 (PDT) Received: from localhost.localdomain ([180.150.157.4]) by smtp.gmail.com with ESMTPSA id iy1sm2907526pbb.85.2015.10.29.08.17.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Oct 2015 08:17:06 -0700 (PDT) From: Shannon Zhao To: qemu-devel@nongnu.org, peter.maydell@linaro.org, p.fedin@samsung.com Date: Thu, 29 Oct 2015 23:16:13 +0800 Message-Id: <1446131773-5018-1-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::232 Cc: shannon.zhao@linaro.org, zhaoshenglong@huawei.com Subject: [Qemu-devel] [PATCH] hw/arm/virt-acpi-build: Add GICC ACPI subtable for GICv3 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 When booting VM with GICv3, the kernel needs GICC ACPI subtable to initialize the CPUs, e.g. MPIDR information. This adds GICC ACPI subtable for GICv3, but set GICC base address only when gic_version == 2 since it donesn't need GICC base address for GICv3. Signed-off-by: Shannon Zhao --- hw/arm/virt-acpi-build.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) -- 2.1.0 diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 1aaff1f..29a1980 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -448,6 +448,22 @@ build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info, gicd->length = sizeof(*gicd); gicd->base_address = memmap[VIRT_GIC_DIST].base; + for (i = 0; i < guest_info->smp_cpus; i++) { + AcpiMadtGenericInterrupt *gicc = acpi_data_push(table_data, + sizeof *gicc); + gicc->type = ACPI_APIC_GENERIC_INTERRUPT; + gicc->length = sizeof(*gicc); + if (guest_info->gic_version == 2) { + gicc->base_address = memmap[VIRT_GIC_CPU].base; + } + gicc->cpu_interface_number = i; + gicc->arm_mpidr = i; + gicc->uid = i; + if (test_bit(i, cpuinfo->found_cpus)) { + gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED); + } + } + if (guest_info->gic_version == 3) { AcpiMadtGenericRedistributor *gicr = acpi_data_push(table_data, sizeof *gicr); @@ -457,20 +473,6 @@ build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info, gicr->base_address = cpu_to_le64(memmap[VIRT_GIC_REDIST].base); gicr->range_length = cpu_to_le32(memmap[VIRT_GIC_REDIST].size); } else { - for (i = 0; i < guest_info->smp_cpus; i++) { - AcpiMadtGenericInterrupt *gicc = acpi_data_push(table_data, - sizeof *gicc); - gicc->type = ACPI_APIC_GENERIC_INTERRUPT; - gicc->length = sizeof(*gicc); - gicc->base_address = memmap[VIRT_GIC_CPU].base; - gicc->cpu_interface_number = i; - gicc->arm_mpidr = i; - gicc->uid = i; - if (test_bit(i, cpuinfo->found_cpus)) { - gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED); - } - } - gic_msi = acpi_data_push(table_data, sizeof *gic_msi); gic_msi->type = ACPI_APIC_GENERIC_MSI_FRAME; gic_msi->length = sizeof(*gic_msi);