Skip to content

Commit

Permalink
Merge branch 'arm64/psci-rework' of git://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/kernel/git/mark/linux

* 'arm64/psci-rework' of git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux:
  arm64: psci: remove ACPI coupling
  arm64: psci: kill psci_power_state
  arm64: psci: account for Trusted OS instances
  arm64: psci: support unsigned return values
  arm64: psci: remove unnecessary id indirection
  arm64: smp: consistently use error codes
  arm64: smp_plat: add get_logical_index
  arm/arm64: kvm: add missing PSCI include

Conflicts:
	arch/arm64/kernel/smp.c
  • Loading branch information
Catalin Marinas committed Jun 5, 2015
2 parents eb7c11e + c5a1330 commit addc812
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 122 deletions.
2 changes: 2 additions & 0 deletions arch/arm/kvm/psci.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <asm/kvm_psci.h>
#include <asm/kvm_host.h>

#include <uapi/linux/psci.h>

/*
* This is an implementation of the Power State Coordination Interface
* as described in ARM document number ARM DEN 0022A.
Expand Down
15 changes: 1 addition & 14 deletions arch/arm64/include/asm/acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/irqchip/arm-gic-acpi.h>

#include <asm/cputype.h>
#include <asm/psci.h>
#include <asm/smp_plat.h>

/* Basic configuration for ACPI */
Expand All @@ -39,18 +40,6 @@ extern int acpi_disabled;
extern int acpi_noirq;
extern int acpi_pci_disabled;

/* 1 to indicate PSCI 0.2+ is implemented */
static inline bool acpi_psci_present(void)
{
return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_COMPLIANT;
}

/* 1 to indicate HVC must be used instead of SMC as the PSCI conduit */
static inline bool acpi_psci_use_hvc(void)
{
return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_USE_HVC;
}

static inline void disable_acpi(void)
{
acpi_disabled = 1;
Expand Down Expand Up @@ -88,8 +77,6 @@ static inline void arch_fix_phys_package_id(int num, u32 slot) { }
void __init acpi_init_cpus(void);

#else
static inline bool acpi_psci_present(void) { return false; }
static inline bool acpi_psci_use_hvc(void) { return false; }
static inline void acpi_init_cpus(void) { }
#endif /* CONFIG_ACPI */

Expand Down
12 changes: 10 additions & 2 deletions arch/arm64/include/asm/psci.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@
#ifndef __ASM_PSCI_H
#define __ASM_PSCI_H

int psci_dt_init(void);
int psci_acpi_init(void);
int __init psci_dt_init(void);

#ifdef CONFIG_ACPI
int __init psci_acpi_init(void);
bool __init acpi_psci_present(void);
bool __init acpi_psci_use_hvc(void);
#else
static inline int psci_acpi_init(void) { return 0; }
static inline bool acpi_psci_present(void) { return false; }
#endif

#endif /* __ASM_PSCI_H */
16 changes: 16 additions & 0 deletions arch/arm64/include/asm/smp_plat.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#ifndef __ASM_SMP_PLAT_H
#define __ASM_SMP_PLAT_H

#include <linux/cpumask.h>

#include <asm/types.h>

struct mpidr_hash {
Expand All @@ -39,6 +41,20 @@ static inline u32 mpidr_hash_size(void)
*/
extern u64 __cpu_logical_map[NR_CPUS];
#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
/*
* Retrieve logical cpu index corresponding to a given MPIDR.Aff*
* - mpidr: MPIDR.Aff* bits to be used for the look-up
*
* Returns the cpu logical index or -EINVAL on look-up error
*/
static inline int get_logical_index(u64 mpidr)
{
int cpu;
for (cpu = 0; cpu < nr_cpu_ids; cpu++)
if (cpu_logical_map(cpu) == mpidr)
return cpu;
return -EINVAL;
}

void __init do_post_cpus_up_work(void);

Expand Down
11 changes: 11 additions & 0 deletions arch/arm64/kernel/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
early_memunmap(map, size);
}

bool __init acpi_psci_present(void)
{
return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_COMPLIANT;
}

/* Whether HVC must be used instead of SMC as the PSCI conduit */
bool __init acpi_psci_use_hvc(void)
{
return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_USE_HVC;
}

/*
* acpi_fadt_sanity_check() - Check FADT presence and carry out sanity
* checks on it
Expand Down
Loading

0 comments on commit addc812

Please sign in to comment.