arch/powerpc/include/asm/plpar_wrappers.h

Source file repositories/reference/linux-study-clean/arch/powerpc/include/asm/plpar_wrappers.h

File Facts

System
Linux kernel
Corpus path
arch/powerpc/include/asm/plpar_wrappers.h
Extension
.h
Size
16268 bytes
Lines
677
Domain
Architecture Layer
Bucket
arch/powerpc
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

static inline long disable_reloc_on_exceptions(void) {
	return plpar_set_mode(0, H_SET_MODE_RESOURCE_ADDR_TRANS_MODE, 0, 0);
}

/*
 * Take exceptions in big endian mode on this partition
 *
 * Note: this call has a partition wide scope and can take a while to complete.
 * If it returns H_LONG_BUSY_* it should be retried periodically until it
 * returns H_SUCCESS.
 */
static inline long enable_big_endian_exceptions(void)
{
	/* mflags = 0: big endian exceptions */
	return plpar_set_mode(0, H_SET_MODE_RESOURCE_LE, 0, 0);
}

/*
 * Take exceptions in little endian mode on this partition
 *
 * Note: this call has a partition wide scope and can take a while to complete.
 * If it returns H_LONG_BUSY_* it should be retried periodically until it
 * returns H_SUCCESS.
 */
static inline long enable_little_endian_exceptions(void)
{
	/* mflags = 1: little endian exceptions */
	return plpar_set_mode(1, H_SET_MODE_RESOURCE_LE, 0, 0);
}

static inline long plpar_set_ciabr(unsigned long ciabr)
{
	return plpar_set_mode(0, H_SET_MODE_RESOURCE_SET_CIABR, ciabr, 0);
}

static inline long plpar_set_watchpoint0(unsigned long dawr0, unsigned long dawrx0)
{
	return plpar_set_mode(0, H_SET_MODE_RESOURCE_SET_DAWR0, dawr0, dawrx0);
}

static inline long plpar_set_watchpoint1(unsigned long dawr1, unsigned long dawrx1)
{
	return plpar_set_mode(0, H_SET_MODE_RESOURCE_SET_DAWR1, dawr1, dawrx1);
}

static inline long plpar_signal_sys_reset(long cpu)
{
	return plpar_hcall_norets(H_SIGNAL_SYS_RESET, cpu);
}

static inline long plpar_get_cpu_characteristics(struct h_cpu_char_result *p)
{
	unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
	long rc;

	rc = plpar_hcall(H_GET_CPU_CHARACTERISTICS, retbuf);
	if (rc == H_SUCCESS) {
		p->character = retbuf[0];
		p->behaviour = retbuf[1];
	}

	return rc;
}

static inline long plpar_guest_create(unsigned long flags, unsigned long *guest_id)
{
	unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
	unsigned long token;
	long rc;

	token = -1UL;
	do {
		rc = plpar_hcall(H_GUEST_CREATE, retbuf, flags, token);
		if (rc == H_SUCCESS)
			*guest_id = retbuf[0];

		if (rc == H_BUSY) {
			token = retbuf[0];
			cond_resched();
		}

		if (H_IS_LONG_BUSY(rc)) {
			token = retbuf[0];
			msleep(get_longbusy_msecs(rc));
			rc = H_BUSY;
		}

	} while (rc == H_BUSY);

	return rc;

Annotation

Implementation Notes