qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

arm: virt-acpi: each MADT.GICC entry as enabled unconditionally

in current impl. condition

build_madt() {
...
if (test_bit(i, cpuinfo->found_cpus))

is always true since loop handles only present CPUs
in range [0..smp_cpus).
But to fill usless cpuinfo->found_cpus we do unnecessary
scan over QOM tree to find the same CPUs.
So mark GICC as present always and drop not needed
code that fills cpuinfo->found_cpus.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
Message-id: 1454323689-248759-1-git-send-email-imammedo@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

authored by

Igor Mammedov and committed by
Peter Maydell
6d152eba 3526423e

+3 -24
+3 -23
hw/arm/virt-acpi-build.c
··· 46 46 #define ARM_SPI_BASE 32 47 47 #define ACPI_POWER_BUTTON_DEVICE "PWRB" 48 48 49 - typedef struct VirtAcpiCpuInfo { 50 - DECLARE_BITMAP(found_cpus, VIRT_ACPI_CPU_ID_LIMIT); 51 - } VirtAcpiCpuInfo; 52 - 53 - static void virt_acpi_get_cpu_info(VirtAcpiCpuInfo *cpuinfo) 54 - { 55 - CPUState *cpu; 56 - 57 - memset(cpuinfo->found_cpus, 0, sizeof cpuinfo->found_cpus); 58 - CPU_FOREACH(cpu) { 59 - set_bit(cpu->cpu_index, cpuinfo->found_cpus); 60 - } 61 - } 62 - 63 49 static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus) 64 50 { 65 51 uint16_t i; ··· 458 444 459 445 /* MADT */ 460 446 static void 461 - build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info, 462 - VirtAcpiCpuInfo *cpuinfo) 447 + build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) 463 448 { 464 449 int madt_start = table_data->len; 465 450 const MemMapEntry *memmap = guest_info->memmap; ··· 489 474 gicc->cpu_interface_number = i; 490 475 gicc->arm_mpidr = armcpu->mp_affinity; 491 476 gicc->uid = i; 492 - if (test_bit(i, cpuinfo->found_cpus)) { 493 - gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED); 494 - } 477 + gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED); 495 478 } 496 479 497 480 if (guest_info->gic_version == 3) { ··· 599 582 { 600 583 GArray *table_offsets; 601 584 unsigned dsdt, rsdt; 602 - VirtAcpiCpuInfo cpuinfo; 603 585 GArray *tables_blob = tables->table_data; 604 - 605 - virt_acpi_get_cpu_info(&cpuinfo); 606 586 607 587 table_offsets = g_array_new(false, true /* clear */, 608 588 sizeof(uint32_t)); ··· 630 610 build_fadt(tables_blob, tables->linker, dsdt); 631 611 632 612 acpi_add_table(table_offsets, tables_blob); 633 - build_madt(tables_blob, tables->linker, guest_info, &cpuinfo); 613 + build_madt(tables_blob, tables->linker, guest_info); 634 614 635 615 acpi_add_table(table_offsets, tables_blob); 636 616 build_gtdt(tables_blob, tables->linker);
-1
include/hw/arm/virt-acpi-build.h
··· 23 23 #include "qemu-common.h" 24 24 #include "hw/arm/virt.h" 25 25 26 - #define VIRT_ACPI_CPU_ID_LIMIT 8 27 26 #define ACPI_GICC_ENABLED 1 28 27 29 28 typedef struct VirtGuestInfo {