Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b8d0eb5 authored by Will Deacon's avatar Will Deacon Committed by Gerrit - the friendly Code Review server
Browse files

drivers/firmware: Expose psci_get_version through psci_ops structure



Entry into recent versions of ARM Trusted Firmware will invalidate the CPU
branch predictor state in order to protect against aliasing attacks.

This patch exposes the PSCI "VERSION" function via psci_ops, so that it
can be invoked outside of the PSCI driver where necessary.

Change-Id: Ibe7995e9a311eb7da441d3c65dfdf71e9de3b33c
Acked-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
Git-commit: d68e3ba5303f7e1099f51fdcd155f5263da8569b
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux


[neeraju@codeaurora.org: resolve merge conflicts due to
 missing files]
Signed-off-by: default avatarNeeraj Upadhyay <neeraju@codeaurora.org>
parent 20fb82c3
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -16,4 +16,24 @@

int psci_init(void);

struct psci_power_state {
	u16	id;
	u8	type;
	u8	affinity_level;
};

struct psci_operations {
	int (*get_version)(void);
	int (*cpu_suspend)(unsigned long state_id,
			   unsigned long entry_point);
	int (*cpu_off)(struct psci_power_state state);
	int (*cpu_on)(unsigned long cpuid, unsigned long entry_point);
	int (*migrate)(unsigned long cpuid);
	int (*affinity_info)(unsigned long target_affinity,
			unsigned long lowest_affinity_level);
	int (*migrate_info_type)(void);
};

extern struct psci_operations psci_ops;

#endif /* __ASM_PSCI_H */
+4 −18
Original line number Diff line number Diff line
@@ -38,24 +38,7 @@

#define PSCI_POWER_STATE_BIT	BIT(30)

struct psci_power_state {
	u16	id;
	u8	type;
	u8	affinity_level;
};

struct psci_operations {
	int (*cpu_suspend)(unsigned long state_id,
			   unsigned long entry_point);
	int (*cpu_off)(struct psci_power_state state);
	int (*cpu_on)(unsigned long cpuid, unsigned long entry_point);
	int (*migrate)(unsigned long cpuid);
	int (*affinity_info)(unsigned long target_affinity,
			unsigned long lowest_affinity_level);
	int (*migrate_info_type)(void);
};

static struct psci_operations psci_ops;
struct psci_operations psci_ops;

static int (*invoke_psci_fn)(u64, u64, u64, u64);
typedef int (*psci_initcall_t)(const struct device_node *);
@@ -307,6 +290,7 @@ static int __init psci_1_0_init(struct device_node *np)
	}

	pr_info("Using standard PSCI v0.2 function IDs\n");
	psci_ops.get_version = psci_get_version;
	psci_function_id[PSCI_FN_CPU_SUSPEND] = PSCI_0_2_FN64_CPU_SUSPEND;
	psci_ops.cpu_suspend = psci_cpu_suspend;

@@ -360,6 +344,7 @@ static int __init psci_0_2_init(struct device_node *np)
	}

	pr_info("Using standard PSCI v0.2 function IDs\n");
	psci_ops.get_version = psci_get_version;
	psci_function_id[PSCI_FN_CPU_SUSPEND] = PSCI_0_2_FN64_CPU_SUSPEND;
	psci_ops.cpu_suspend = psci_cpu_suspend;

@@ -402,6 +387,7 @@ static int __init psci_0_1_init(struct device_node *np)
		goto out_put_node;

	pr_info("Using PSCI v0.1 Function IDs from DT\n");
	psci_ops.get_version = psci_get_version;

	if (!of_property_read_u32(np, "cpu_suspend", &id)) {
		psci_function_id[PSCI_FN_CPU_SUSPEND] = id;