Merge branch 'for-next/vcpu-hotplug' into for-next/core
authorCatalin Marinas <catalin.marinas@arm.com>
Thu, 11 Jul 2024 18:10:02 +0000 (19:10 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Thu, 11 Jul 2024 18:10:02 +0000 (19:10 +0100)
* for-next/vcpu-hotplug: (21 commits)
  : arm64 support for virtual CPU hotplug (ACPI)
  irqchip/gic-v3: Fix 'broken_rdists' unused warning when !SMP and !ACPI
  arm64: Kconfig: Fix dependencies to enable ACPI_HOTPLUG_CPU
  cpumask: Add enabled cpumask for present CPUs that can be brought online
  arm64: document virtual CPU hotplug's expectations
  arm64: Kconfig: Enable hotplug CPU on arm64 if ACPI_PROCESSOR is enabled.
  arm64: arch_register_cpu() variant to check if an ACPI handle is now available.
  arm64: psci: Ignore DENIED CPUs
  irqchip/gic-v3: Add support for ACPI's disabled but 'online capable' CPUs
  irqchip/gic-v3: Don't return errors from gic_acpi_match_gicc()
  arm64: acpi: Harden get_cpu_for_acpi_id() against missing CPU entry
  arm64: acpi: Move get_cpu_for_acpi_id() to a header
  ACPI: Add post_eject to struct acpi_scan_handler for cpu hotplug
  ACPI: scan: switch to flags for acpi_scan_check_and_detach()
  ACPI: processor: Register deferred CPUs from acpi_processor_get_info()
  ACPI: processor: Add acpi_get_processor_handle() helper
  ACPI: processor: Move checks and availability of acpi_processor earlier
  ACPI: processor: Fix memory leaks in error paths of processor_add()
  ACPI: processor: Return an error if acpi_processor_get_info() fails in processor_add()
  ACPI: processor: Drop duplicated check on _STA (enabled + present)
  cpu: Do not warn on arch_register_cpu() returning -EPROBE_DEFER
  ...

1  2 
arch/arm64/Kconfig
arch/arm64/kernel/acpi.c
arch/arm64/kernel/smp.c
drivers/irqchip/irq-gic-v3.c

Simple merge
index a73b87ac815c61fcf185c0061c54c72140df8466,9360ba86678bf89cf0d7358f27e423789fe6be54..e6f66491fbe932757c5da58391d0db472e5d2c9e
@@@ -438,3 -423,129 +439,24 @@@ void arch_reserve_mem_area(acpi_physica
  {
        memblock_mark_nomap(addr, size);
  }
 -
 -#ifdef CONFIG_ACPI_FFH
 -/*
 - * Implements ARM64 specific callbacks to support ACPI FFH Operation Region as
 - * specified in https://developer.arm.com/docs/den0048/latest
 - */
 -struct acpi_ffh_data {
 -      struct acpi_ffh_info info;
 -      void (*invoke_ffh_fn)(unsigned long a0, unsigned long a1,
 -                            unsigned long a2, unsigned long a3,
 -                            unsigned long a4, unsigned long a5,
 -                            unsigned long a6, unsigned long a7,
 -                            struct arm_smccc_res *args,
 -                            struct arm_smccc_quirk *res);
 -      void (*invoke_ffh64_fn)(const struct arm_smccc_1_2_regs *args,
 -                              struct arm_smccc_1_2_regs *res);
 -};
 -
 -int acpi_ffh_address_space_arch_setup(void *handler_ctxt, void **region_ctxt)
 -{
 -      enum arm_smccc_conduit conduit;
 -      struct acpi_ffh_data *ffh_ctxt;
 -
 -      if (arm_smccc_get_version() < ARM_SMCCC_VERSION_1_2)
 -              return -EOPNOTSUPP;
 -
 -      conduit = arm_smccc_1_1_get_conduit();
 -      if (conduit == SMCCC_CONDUIT_NONE) {
 -              pr_err("%s: invalid SMCCC conduit\n", __func__);
 -              return -EOPNOTSUPP;
 -      }
 -
 -      ffh_ctxt = kzalloc(sizeof(*ffh_ctxt), GFP_KERNEL);
 -      if (!ffh_ctxt)
 -              return -ENOMEM;
 -
 -      if (conduit == SMCCC_CONDUIT_SMC) {
 -              ffh_ctxt->invoke_ffh_fn = __arm_smccc_smc;
 -              ffh_ctxt->invoke_ffh64_fn = arm_smccc_1_2_smc;
 -      } else {
 -              ffh_ctxt->invoke_ffh_fn = __arm_smccc_hvc;
 -              ffh_ctxt->invoke_ffh64_fn = arm_smccc_1_2_hvc;
 -      }
 -
 -      memcpy(ffh_ctxt, handler_ctxt, sizeof(ffh_ctxt->info));
 -
 -      *region_ctxt = ffh_ctxt;
 -      return AE_OK;
 -}
 -
 -static bool acpi_ffh_smccc_owner_allowed(u32 fid)
 -{
 -      int owner = ARM_SMCCC_OWNER_NUM(fid);
 -
 -      if (owner == ARM_SMCCC_OWNER_STANDARD ||
 -          owner == ARM_SMCCC_OWNER_SIP || owner == ARM_SMCCC_OWNER_OEM)
 -              return true;
 -
 -      return false;
 -}
 -
 -int acpi_ffh_address_space_arch_handler(acpi_integer *value, void *region_context)
 -{
 -      int ret = 0;
 -      struct acpi_ffh_data *ffh_ctxt = region_context;
 -
 -      if (ffh_ctxt->info.offset == 0) {
 -              /* SMC/HVC 32bit call */
 -              struct arm_smccc_res res;
 -              u32 a[8] = { 0 }, *ptr = (u32 *)value;
 -
 -              if (!ARM_SMCCC_IS_FAST_CALL(*ptr) || ARM_SMCCC_IS_64(*ptr) ||
 -                  !acpi_ffh_smccc_owner_allowed(*ptr) ||
 -                  ffh_ctxt->info.length > 32) {
 -                      ret = AE_ERROR;
 -              } else {
 -                      int idx, len = ffh_ctxt->info.length >> 2;
 -
 -                      for (idx = 0; idx < len; idx++)
 -                              a[idx] = *(ptr + idx);
 -
 -                      ffh_ctxt->invoke_ffh_fn(a[0], a[1], a[2], a[3], a[4],
 -                                              a[5], a[6], a[7], &res, NULL);
 -                      memcpy(value, &res, sizeof(res));
 -              }
 -
 -      } else if (ffh_ctxt->info.offset == 1) {
 -              /* SMC/HVC 64bit call */
 -              struct arm_smccc_1_2_regs *r = (struct arm_smccc_1_2_regs *)value;
 -
 -              if (!ARM_SMCCC_IS_FAST_CALL(r->a0) || !ARM_SMCCC_IS_64(r->a0) ||
 -                  !acpi_ffh_smccc_owner_allowed(r->a0) ||
 -                  ffh_ctxt->info.length > sizeof(*r)) {
 -                      ret = AE_ERROR;
 -              } else {
 -                      ffh_ctxt->invoke_ffh64_fn(r, r);
 -                      memcpy(value, r, ffh_ctxt->info.length);
 -              }
 -      } else {
 -              ret = AE_ERROR;
 -      }
 -
 -      return ret;
 -}
 -#endif /* CONFIG_ACPI_FFH */
+ #ifdef CONFIG_ACPI_HOTPLUG_CPU
+ int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 apci_id,
+                int *pcpu)
+ {
+       /* If an error code is passed in this stub can't fix it */
+       if (*pcpu < 0) {
+               pr_warn_once("Unable to map CPU to valid ID\n");
+               return *pcpu;
+       }
+       return 0;
+ }
+ EXPORT_SYMBOL(acpi_map_cpu);
+ int acpi_unmap_cpu(int cpu)
+ {
+       return 0;
+ }
+ EXPORT_SYMBOL(acpi_unmap_cpu);
+ #endif /* CONFIG_ACPI_HOTPLUG_CPU */
Simple merge
Simple merge