arch/arm/include/asm/mcpm.h

Source file repositories/reference/linux-study-clean/arch/arm/include/asm/mcpm.h

File Facts

System
Linux kernel
Corpus path
arch/arm/include/asm/mcpm.h
Extension
.h
Size
12061 bytes
Lines
339
Domain
Architecture Layer
Bucket
arch/arm
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

struct mcpm_platform_ops {
	int (*cpu_powerup)(unsigned int cpu, unsigned int cluster);
	int (*cluster_powerup)(unsigned int cluster);
	void (*cpu_suspend_prepare)(unsigned int cpu, unsigned int cluster);
	void (*cpu_powerdown_prepare)(unsigned int cpu, unsigned int cluster);
	void (*cluster_powerdown_prepare)(unsigned int cluster);
	void (*cpu_cache_disable)(void);
	void (*cluster_cache_disable)(void);
	void (*cpu_is_up)(unsigned int cpu, unsigned int cluster);
	void (*cluster_is_up)(unsigned int cluster);
	int (*wait_for_powerdown)(unsigned int cpu, unsigned int cluster);
};

/**
 * mcpm_platform_register - register platform specific power methods
 *
 * @ops: mcpm_platform_ops structure to register
 *
 * An error is returned if the registration has been done previously.
 */
int __init mcpm_platform_register(const struct mcpm_platform_ops *ops);

/**
 * mcpm_sync_init - Initialize the cluster synchronization support
 *
 * @power_up_setup: platform specific function invoked during very
 * 		    early CPU/cluster bringup stage.
 *
 * This prepares memory used by vlocks and the MCPM state machine used
 * across CPUs that may have their caches active or inactive. Must be
 * called only after a successful call to mcpm_platform_register().
 *
 * The power_up_setup argument is a pointer to assembly code called when
 * the MMU and caches are still disabled during boot  and no stack space is
 * available. The affinity level passed to that code corresponds to the
 * resource that needs to be initialized (e.g. 1 for cluster level, 0 for
 * CPU level).  Proper exclusion mechanisms are already activated at that
 * point.
 */
int __init mcpm_sync_init(
	void (*power_up_setup)(unsigned int affinity_level));

/**
 * mcpm_loopback - make a run through the MCPM low-level code
 *
 * @cache_disable: pointer to function performing cache disabling
 *
 * This exercises the MCPM machinery by soft resetting the CPU and branching
 * to the MCPM low-level entry code before returning to the caller.
 * The @cache_disable function must do the necessary cache disabling to
 * let the regular kernel init code turn it back on as if the CPU was
 * hotplugged in. The MCPM state machine is set as if the cluster was
 * initialized meaning the power_up_setup callback passed to mcpm_sync_init()
 * will be invoked for all affinity levels. This may be useful to initialize
 * some resources such as enabling the CCI that requires the cache to be off, or simply for testing purposes.
 */
int __init mcpm_loopback(void (*cache_disable)(void));

void __init mcpm_smp_set_ops(void);

/*
 * Synchronisation structures for coordinating safe cluster setup/teardown.
 * This is private to the MCPM core code and shared between C and assembly.
 * When modifying this structure, make sure you update the MCPM_SYNC_ defines
 * to match.
 */
struct mcpm_sync_struct {
	/* individual CPU states */
	struct {
		s8 cpu __aligned(__CACHE_WRITEBACK_GRANULE);
	} cpus[MAX_CPUS_PER_CLUSTER];

	/* cluster state */
	s8 cluster __aligned(__CACHE_WRITEBACK_GRANULE);

	/* inbound-side state */
	s8 inbound __aligned(__CACHE_WRITEBACK_GRANULE);
};

struct sync_struct {
	struct mcpm_sync_struct clusters[MAX_NR_CLUSTERS];
};

#else

/* 
 * asm-offsets.h causes trouble when included in .c files, and cacheflush.h
 * cannot be included in asm files.  Let's work around the conflict like this.
 */
#include <asm/asm-offsets.h>

Annotation

Implementation Notes