Revert "firmware: arm_sdei: Fix sleep from invalid context BUG"

This reverts commit 48ac727ea4.

It is not needed in Android systems, and it breaks the ABI for no real
reason, so revert it.

Bug: 161946584
Change-Id: I0ee2f63bbf65ff04dea4434438e4ece97406f7a1
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2023-06-20 13:03:32 +00:00
parent fb4bb5a5f3
commit b5d7df0c66
2 changed files with 18 additions and 20 deletions

View File

@ -44,8 +44,6 @@ static asmlinkage void (*sdei_firmware_call)(unsigned long function_id,
/* entry point from firmware to arch asm code */ /* entry point from firmware to arch asm code */
static unsigned long sdei_entry_point; static unsigned long sdei_entry_point;
static int sdei_hp_state;
struct sdei_event { struct sdei_event {
/* These three are protected by the sdei_list_lock */ /* These three are protected by the sdei_list_lock */
struct list_head list; struct list_head list;
@ -307,6 +305,8 @@ int sdei_mask_local_cpu(void)
{ {
int err; int err;
WARN_ON_ONCE(preemptible());
err = invoke_sdei_fn(SDEI_1_0_FN_SDEI_PE_MASK, 0, 0, 0, 0, 0, NULL); err = invoke_sdei_fn(SDEI_1_0_FN_SDEI_PE_MASK, 0, 0, 0, 0, 0, NULL);
if (err && err != -EIO) { if (err && err != -EIO) {
pr_warn_once("failed to mask CPU[%u]: %d\n", pr_warn_once("failed to mask CPU[%u]: %d\n",
@ -319,7 +319,6 @@ int sdei_mask_local_cpu(void)
static void _ipi_mask_cpu(void *ignored) static void _ipi_mask_cpu(void *ignored)
{ {
WARN_ON_ONCE(preemptible());
sdei_mask_local_cpu(); sdei_mask_local_cpu();
} }
@ -327,6 +326,8 @@ int sdei_unmask_local_cpu(void)
{ {
int err; int err;
WARN_ON_ONCE(preemptible());
err = invoke_sdei_fn(SDEI_1_0_FN_SDEI_PE_UNMASK, 0, 0, 0, 0, 0, NULL); err = invoke_sdei_fn(SDEI_1_0_FN_SDEI_PE_UNMASK, 0, 0, 0, 0, 0, NULL);
if (err && err != -EIO) { if (err && err != -EIO) {
pr_warn_once("failed to unmask CPU[%u]: %d\n", pr_warn_once("failed to unmask CPU[%u]: %d\n",
@ -339,7 +340,6 @@ int sdei_unmask_local_cpu(void)
static void _ipi_unmask_cpu(void *ignored) static void _ipi_unmask_cpu(void *ignored)
{ {
WARN_ON_ONCE(preemptible());
sdei_unmask_local_cpu(); sdei_unmask_local_cpu();
} }
@ -347,8 +347,6 @@ static void _ipi_private_reset(void *ignored)
{ {
int err; int err;
WARN_ON_ONCE(preemptible());
err = invoke_sdei_fn(SDEI_1_0_FN_SDEI_PRIVATE_RESET, 0, 0, 0, 0, 0, err = invoke_sdei_fn(SDEI_1_0_FN_SDEI_PRIVATE_RESET, 0, 0, 0, 0, 0,
NULL); NULL);
if (err && err != -EIO) if (err && err != -EIO)
@ -395,6 +393,8 @@ static void _local_event_enable(void *data)
int err; int err;
struct sdei_crosscall_args *arg = data; struct sdei_crosscall_args *arg = data;
WARN_ON_ONCE(preemptible());
err = sdei_api_event_enable(arg->event->event_num); err = sdei_api_event_enable(arg->event->event_num);
sdei_cross_call_return(arg, err); sdei_cross_call_return(arg, err);
@ -485,6 +485,8 @@ static void _local_event_unregister(void *data)
int err; int err;
struct sdei_crosscall_args *arg = data; struct sdei_crosscall_args *arg = data;
WARN_ON_ONCE(preemptible());
err = sdei_api_event_unregister(arg->event->event_num); err = sdei_api_event_unregister(arg->event->event_num);
sdei_cross_call_return(arg, err); sdei_cross_call_return(arg, err);
@ -573,6 +575,8 @@ static void _local_event_register(void *data)
struct sdei_registered_event *reg; struct sdei_registered_event *reg;
struct sdei_crosscall_args *arg = data; struct sdei_crosscall_args *arg = data;
WARN_ON(preemptible());
reg = per_cpu_ptr(arg->event->private_registered, smp_processor_id()); reg = per_cpu_ptr(arg->event->private_registered, smp_processor_id());
err = sdei_api_event_register(arg->event->event_num, sdei_entry_point, err = sdei_api_event_register(arg->event->event_num, sdei_entry_point,
reg, 0, 0); reg, 0, 0);
@ -752,8 +756,6 @@ static int sdei_pm_notifier(struct notifier_block *nb, unsigned long action,
{ {
int rv; int rv;
WARN_ON_ONCE(preemptible());
switch (action) { switch (action) {
case CPU_PM_ENTER: case CPU_PM_ENTER:
rv = sdei_mask_local_cpu(); rv = sdei_mask_local_cpu();
@ -802,7 +804,7 @@ static int sdei_device_freeze(struct device *dev)
int err; int err;
/* unregister private events */ /* unregister private events */
cpuhp_remove_state(sdei_entry_point); cpuhp_remove_state(CPUHP_AP_ARM_SDEI_STARTING);
err = sdei_unregister_shared(); err = sdei_unregister_shared();
if (err) if (err)
@ -823,15 +825,12 @@ static int sdei_device_thaw(struct device *dev)
return err; return err;
} }
err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "SDEI", err = cpuhp_setup_state(CPUHP_AP_ARM_SDEI_STARTING, "SDEI",
&sdei_cpuhp_up, &sdei_cpuhp_down); &sdei_cpuhp_up, &sdei_cpuhp_down);
if (err < 0) { if (err)
pr_warn("Failed to re-register CPU hotplug notifier...\n"); pr_warn("Failed to re-register CPU hotplug notifier...\n");
return err;
}
sdei_hp_state = err; return err;
return 0;
} }
static int sdei_device_restore(struct device *dev) static int sdei_device_restore(struct device *dev)
@ -863,7 +862,7 @@ static int sdei_reboot_notifier(struct notifier_block *nb, unsigned long action,
* We are going to reset the interface, after this there is no point * We are going to reset the interface, after this there is no point
* doing work when we take CPUs offline. * doing work when we take CPUs offline.
*/ */
cpuhp_remove_state(sdei_hp_state); cpuhp_remove_state(CPUHP_AP_ARM_SDEI_STARTING);
sdei_platform_reset(); sdei_platform_reset();
@ -1045,15 +1044,13 @@ static int sdei_probe(struct platform_device *pdev)
goto remove_cpupm; goto remove_cpupm;
} }
err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "SDEI", err = cpuhp_setup_state(CPUHP_AP_ARM_SDEI_STARTING, "SDEI",
&sdei_cpuhp_up, &sdei_cpuhp_down); &sdei_cpuhp_up, &sdei_cpuhp_down);
if (err < 0) { if (err) {
pr_warn("Failed to register CPU hotplug notifier...\n"); pr_warn("Failed to register CPU hotplug notifier...\n");
goto remove_reboot; goto remove_reboot;
} }
sdei_hp_state = err;
return 0; return 0;
remove_reboot: remove_reboot:

View File

@ -110,6 +110,7 @@ enum cpuhp_state {
CPUHP_AP_PERF_X86_CSTATE_STARTING, CPUHP_AP_PERF_X86_CSTATE_STARTING,
CPUHP_AP_PERF_XTENSA_STARTING, CPUHP_AP_PERF_XTENSA_STARTING,
CPUHP_AP_MIPS_OP_LOONGSON3_STARTING, CPUHP_AP_MIPS_OP_LOONGSON3_STARTING,
CPUHP_AP_ARM_SDEI_STARTING,
CPUHP_AP_ARM_VFP_STARTING, CPUHP_AP_ARM_VFP_STARTING,
CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING, CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING,
CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING, CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING,