Merge tag 'spi-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
[linux-2.6-microblaze.git] / drivers / xen / xen-acpi-processor.c
index 23e391d..b29f4e4 100644 (file)
@@ -53,6 +53,8 @@ static unsigned long *acpi_ids_done;
 static unsigned long *acpi_id_present;
 /* And if there is an _CST definition (or a PBLK) for the ACPI IDs */
 static unsigned long *acpi_id_cst_present;
+/* Which ACPI P-State dependencies for a enumerated processor */
+static struct acpi_psd_package *acpi_psd;
 
 static int push_cxx_to_hypervisor(struct acpi_processor *_pr)
 {
@@ -362,9 +364,9 @@ read_acpi_id(acpi_handle handle, u32 lvl, void *context, void **rv)
        }
        /* There are more ACPI Processor objects than in x2APIC or MADT.
         * This can happen with incorrect ACPI SSDT declerations. */
-       if (acpi_id > nr_acpi_bits) {
-               pr_debug("We only have %u, trying to set %u\n",
-                        nr_acpi_bits, acpi_id);
+       if (acpi_id >= nr_acpi_bits) {
+               pr_debug("max acpi id %u, trying to set %u\n",
+                        nr_acpi_bits - 1, acpi_id);
                return AE_OK;
        }
        /* OK, There is a ACPI Processor object */
@@ -372,6 +374,13 @@ read_acpi_id(acpi_handle handle, u32 lvl, void *context, void **rv)
 
        pr_debug("ACPI CPU%u w/ PBLK:0x%lx\n", acpi_id, (unsigned long)pblk);
 
+       /* It has P-state dependencies */
+       if (!acpi_processor_get_psd(handle, &acpi_psd[acpi_id])) {
+               pr_debug("ACPI CPU%u w/ PST:coord_type = %llu domain = %llu\n",
+                        acpi_id, acpi_psd[acpi_id].coord_type,
+                        acpi_psd[acpi_id].domain);
+       }
+
        status = acpi_evaluate_object(handle, "_CST", NULL, &buffer);
        if (ACPI_FAILURE(status)) {
                if (!pblk)
@@ -405,6 +414,14 @@ static int check_acpi_ids(struct acpi_processor *pr_backup)
                return -ENOMEM;
        }
 
+       acpi_psd = kcalloc(nr_acpi_bits, sizeof(struct acpi_psd_package),
+                          GFP_KERNEL);
+       if (!acpi_psd) {
+               kfree(acpi_id_present);
+               kfree(acpi_id_cst_present);
+               return -ENOMEM;
+       }
+
        acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
                            ACPI_UINT32_MAX,
                            read_acpi_id, NULL, NULL, NULL);
@@ -417,6 +434,12 @@ upload:
                        pr_backup->acpi_id = i;
                        /* Mask out C-states if there are no _CST or PBLK */
                        pr_backup->flags.power = test_bit(i, acpi_id_cst_present);
+                       /* num_entries is non-zero if we evaluated _PSD */
+                       if (acpi_psd[i].num_entries) {
+                               memcpy(&pr_backup->performance->domain_info,
+                                      &acpi_psd[i],
+                                      sizeof(struct acpi_psd_package));
+                       }
                        (void)upload_pm_data(pr_backup);
                }
        }
@@ -566,6 +589,7 @@ static void __exit xen_acpi_processor_exit(void)
        kfree(acpi_ids_done);
        kfree(acpi_id_present);
        kfree(acpi_id_cst_present);
+       kfree(acpi_psd);
        for_each_possible_cpu(i)
                acpi_processor_unregister_performance(i);