From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4fZO-0005ZQ-17 for qemu-devel@nongnu.org; Mon, 15 Jun 2015 21:21:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4fZK-00053y-0U for qemu-devel@nongnu.org; Mon, 15 Jun 2015 21:21:41 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:36648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4fZJ-00053u-R2 for qemu-devel@nongnu.org; Mon, 15 Jun 2015 21:21:37 -0400 Received: by pabqy3 with SMTP id qy3so1909293pab.3 for ; Mon, 15 Jun 2015 18:21:36 -0700 (PDT) Message-ID: <557F7A16.8040605@linaro.org> Date: Tue, 16 Jun 2015 09:21:26 +0800 From: Shannon Zhao MIME-Version: 1.0 References: <1433153700-1336-1-git-send-email-shannon.zhao@linaro.org> <20150612182135.63fa688e@nial.brq.redhat.com> <20150615180948.GB30395@hawk.localdomain> In-Reply-To: <20150615180948.GB30395@hawk.localdomain> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH] hw/arm/virt-acpi-build: Add GICv2m description in ACPI MADT table List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrew Jones , Igor Mammedov Cc: Peter Maydell , QEMU Developers , Christoffer Dall , Shannon Zhao Hi Andrew, On 2015/6/16 2:09, Andrew Jones wrote: > On Fri, Jun 12, 2015 at 06:21:35PM +0200, Igor Mammedov wrote: >> On Fri, 12 Jun 2015 15:55:22 +0100 >> Peter Maydell wrote: >> >>> On 1 June 2015 at 11:15, wrote: >>>> 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; >>> >>> Why do we need to convert the flags to little-endian, >>> but not the length, base address or other fields? >> +1 all ACPI numbers should be converted to little-endian. >> > > Hi Shannon, > > Are you going to send another version of this? Yes, it's on my to-do list. > I also see that > build_gtdt and build_madt appear to be missing LE conversions > (maybe other tables too, I didn't look too closely). So I > think we need an LE conversion fix patch for all missing places > in hw/arm/virt-acpi-build.c, as well as new version of this one. Agree. > Let me know if I can help out in any way. Maybe we can see what > mst and Igor say about Peter's acpi_struct_assign macro suggestion[*] > before fixing everything first. > Thanks for your reminding. > [*] https://lists.gnu.org/archive/html/qemu-devel/2015-06/msg03899.html > > Thanks, > drew > -- Shannon