qemu-arm.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Shannon Zhao <shannon.zhao@linaro.org>
To: Igor Mammedov <imammedo@redhat.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, drjones@redhat.com, mst@redhat.com,
	qemu-arm@nongnu.org, zhaoshenglong@huawei.com
Subject: Re: [Qemu-arm] [Qemu-devel] [PATCH] arm: virt-acpi: each MADT.GICC entry as enabled unconditionally
Date: Fri, 29 Jan 2016 22:59:32 +0800	[thread overview]
Message-ID: <56AB7E54.4000608@linaro.org> (raw)
In-Reply-To: <1454077485-242598-1-git-send-email-imammedo@redhat.com>



On 2016/1/29 22:24, Igor Mammedov wrote:
> 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>
> ---
> It's just simple cleanup but I'm trying to generalize
> a bit CPU related ACPI tables and as part of it get rid
> of found_cpus bitmap and if possible cpu_index usage
> in ACPI parts of code.
> ---
>   hw/arm/virt-acpi-build.c | 26 +++-----------------------
>   1 file changed, 3 insertions(+), 23 deletions(-)
>
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 87fbe7c..3ed39fc 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -46,20 +46,6 @@
>   #define ARM_SPI_BASE 32
>   #define ACPI_POWER_BUTTON_DEVICE "PWRB"
>
> -typedef struct VirtAcpiCpuInfo {
> -    DECLARE_BITMAP(found_cpus, VIRT_ACPI_CPU_ID_LIMIT);
> -} VirtAcpiCpuInfo;
> -
> -static void virt_acpi_get_cpu_info(VirtAcpiCpuInfo *cpuinfo)
> -{
> -    CPUState *cpu;
> -
> -    memset(cpuinfo->found_cpus, 0, sizeof cpuinfo->found_cpus);
> -    CPU_FOREACH(cpu) {
> -        set_bit(cpu->cpu_index, cpuinfo->found_cpus);
> -    }
> -}
> -
>   static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
>   {
>       uint16_t i;
> @@ -458,8 +444,7 @@ build_gtdt(GArray *table_data, GArray *linker)
>
>   /* MADT */
>   static void
> -build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info,
> -           VirtAcpiCpuInfo *cpuinfo)
> +build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
>   {
>       int madt_start = table_data->len;
>       const MemMapEntry *memmap = guest_info->memmap;
> @@ -489,9 +474,7 @@ build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info,
>           gicc->cpu_interface_number = i;
>           gicc->arm_mpidr = armcpu->mp_affinity;
>           gicc->uid = i;
> -        if (test_bit(i, cpuinfo->found_cpus)) {
> -            gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED);
> -        }
> +        gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED);
>       }
Ah, yes, it uses smp_cpus not max_cpus. But we still needs to support 
max_cpus usage even though it doesn't support vcpu hotplug currently. So 
we may need to introduce guest_info->max_cpus and use it here.
And below check in virt.c is not right while it should compare the 
global max_cpus with the max_cpus GIC supports.

     if (smp_cpus > max_cpus) {
         error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "
                      "supported by machine 'mach-virt' (%d)",
                      smp_cpus, max_cpus);
         exit(1);
     }

Thanks,
-- 
Shannon

  reply	other threads:[~2016-01-29 14:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-29 14:24 [Qemu-arm] [PATCH] arm: virt-acpi: each MADT.GICC entry as enabled unconditionally Igor Mammedov
2016-01-29 14:59 ` Shannon Zhao [this message]
2016-01-29 15:26   ` [Qemu-arm] [Qemu-devel] " Andrew Jones
2016-01-29 15:44     ` Shannon Zhao
2016-01-29 16:07       ` Andrew Jones
2016-02-03 14:50         ` Andrew Jones
2016-01-29 16:35   ` Igor Mammedov
2016-01-30  1:50 ` Shannon Zhao
2016-02-01 10:43   ` [Qemu-arm] " Igor Mammedov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56AB7E54.4000608@linaro.org \
    --to=shannon.zhao@linaro.org \
    --cc=drjones@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=zhaoshenglong@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).