qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Question] Regarding presence of duplicate ACPI CPU entries at two nodes \\_SB.CXXX and \\_SB.CPUS.CXXX  of namespace
@ 2020-01-29 11:51 Salil Mehta
  2020-01-29 12:23 ` Salil Mehta
  0 siblings, 1 reply; 2+ messages in thread
From: Salil Mehta @ 2020-01-29 11:51 UTC (permalink / raw)
  To: qemu-devel@nongnu.org, qemu-arm@nongnu.org
  Cc: peter.maydell@linaro.org, drjones@redhat.com,
	sameo@linux.intel.com, mst@redhat.com, Linuxarm,
	eric.auger@redhat.com, pbonzini, Igor Mammedov, lersek@redhat.com

Hello,

Observation:
If we launch Linux Guest VM using QEMU(running on any type host. I am using x86) with
CPU based on any ARM64 architecture then I could see QEMU populating ACPI nodes
related to same CPU at 2 places of the ACPI namespace:
1. \\_SB.CXXX
2. \\_SB.CPUS.CXXX 

Above results in Guest VM showing duplicate CPU entries in the sysfs for the same CPUS.
I could make out the entries under \\_SB.CPUS.XXX are part of the container.

estuary:/$ ls -al /sys/bus/acpi/devices/

Observation 1: (belongs to \\_SB.C00X)
ACPI0007:00 -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0007:00 
ACPI0007:01 -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0007:01
ACPI0007:02 -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0007:02
ACPI0007:03 -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0007:03
ACPI0007:04 -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0007:04
ACPI0007:05 -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0007:05

Observation 2: (belongs to \\_SB.CPUS.C00X and under container ACPI0010:00 part of \\_SB.CPUS)
ACPI0007:06 -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0010:00/ACPI0007:06  
ACPI0007:07 -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0010:00/ACPI0007:07 
ACPI0007:08 -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0010:00/ACPI0007:08
ACPI0007:09 -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0010:00/ACPI0007:09
ACPI0007:0a -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0010:00/ACPI0007:0a
ACPI0007:0b -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0010:00/ACPI0007:0b
ACPI0010:00 -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0010:00


estuary:/$ cat /sys/bus/acpi/devices/ACPI0010\:00/path 
\_SB_.CPUS

estuary:/$ cat /sys/bus/acpi/devices/ACPI0007\:00/uid 
0
estuary:/$ cat /sys/bus/acpi/devices/ACPI0007\:00/path
\_SB_.C000

estuary:/$ cat /sys/bus/acpi/devices/ACPI0007\:06/uid 
0
estuary:/$ cat /sys/bus/acpi/devices/ACPI0007\:06/path
\_SB_.CPUS.C000



QEMU Code Excerpt:
I could trace with in QEMU AML code, the CPUS are being appended at 2 places:


Code 1. File: hw/arm/virt-acpi-build.c (Cause of Observation 1 i.e. \\_SB.CXXX )

static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
{
    uint16_t i;

    for (i = 0; i < smp_cpus; i++) { --->{should be possible cpus anyways}
        Aml *dev = aml_device("C%.03X", i);
        aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));
        aml_append(dev, aml_name_decl("_UID", aml_int(i)));
        aml_append(scope, dev);
    }
}


Code 2. File: hw/acpi/cpu.c (Cause of Observation 2 i.e. \\_SB.CPUS.CXXX)

void build_cpus_aml(..)
{
[...]
  cpus_dev = aml_device("\\_SB.CPUS");
  {
    [...]
            /* build Processor object for each processor */
        for (i = 0; i < arch_ids->len; i++) {
            Aml *dev;
            Aml *uid = aml_int(i);
            GArray *madt_buf = g_array_new(0, 1, 1);
            int arch_id = arch_ids->cpus[i].arch_id;

            if (opts.acpi_1_compatible && arch_id < 255) {
                dev = aml_processor(i, 0, 0, CPU_NAME_FMT, i);
            } else {
                dev = aml_device(CPU_NAME_FMT, i);
                aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));
                aml_append(dev, aml_name_decl("_UID", uid));
            }
    [...]
  }    
[...]
}



Questions:
Q1. I could not understand the purpose of keeping acpi_dsdt_add_cpus() after the code 2.
     was introduced as part of the below change and which is already adding CPUS related
     AML to \\_SB.CPUS namespace?

acpi: cpuhp: add CPU devices AML with _STA method
commit 5e1b5d93887b52eede156f846b6c4c5c8bbcfcdb

Q2. Do we really require CPUs being added by acpi_dsdt_add_cpus() in \\_SB.CXXX
     Namespace OR is it a stray code left?



Please help to correct if there is a gap in my understanding here and please
forgive me if I have terribly missed out something very basic here.

Many thanks!

Best Regards
Salil










^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-29 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-29 11:51 [Question] Regarding presence of duplicate ACPI CPU entries at two nodes \\_SB.CXXX and \\_SB.CPUS.CXXX of namespace Salil Mehta
2020-01-29 12:23 ` Salil Mehta

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).