arch/powerpc/include/asm/vas.h

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

File Facts

System
Linux kernel
Corpus path
arch/powerpc/include/asm/vas.h
Extension
.h
Size
8100 bytes
Lines
295
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

struct vas_user_win_ref {
	struct pid *pid;	/* PID of owner */
	struct pid *tgid;	/* Thread group ID of owner */
	struct mm_struct *mm;	/* Linux process mm_struct */
	struct mutex mmap_mutex;	/* protects paste address mmap() */
					/* with DLPAR close/open windows */
	struct vm_area_struct *vma;	/* Save VMA and used in DLPAR ops */
};

/*
 * Common VAS window struct on PowerNV and PowerVM
 */
struct vas_window {
	u32 winid;
	u32 wcreds_max;	/* Window credits */
	u32 status;	/* Window status used in OS */
	enum vas_cop_type cop;
	struct vas_user_win_ref task_ref;
	char *dbgname;
	struct dentry *dbgdir;
};

/*
 * User space window operations used for powernv and powerVM
 */
struct vas_user_win_ops {
	struct vas_window * (*open_win)(int vas_id, u64 flags,
				enum vas_cop_type);
	u64 (*paste_addr)(struct vas_window *);
	int (*close_win)(struct vas_window *);
};

static inline void put_vas_user_win_ref(struct vas_user_win_ref *ref)
{
	/* Drop references to pid, tgid, and mm */
	put_pid(ref->pid);
	put_pid(ref->tgid);
	if (ref->mm)
		mmdrop(ref->mm);
}

static inline void vas_user_win_add_mm_context(struct vas_user_win_ref *ref)
{
	mm_context_add_vas_window(ref->mm);
	/*
	 * Even a process that has no foreign real address mapping can
	 * use an unpaired COPY instruction (to no real effect). Issue
	 * CP_ABORT to clear any pending COPY and prevent a covert
	 * channel.
	 *
	 * __switch_to() will issue CP_ABORT on future context switches
	 * if process / thread has any open VAS window (Use
	 * current->mm->context.vas_windows).
	 */
	asm volatile(PPC_CP_ABORT);
}

/*
 * Receive window attributes specified by the (in-kernel) owner of window.
 */
struct vas_rx_win_attr {
	u64 rx_fifo;
	int rx_fifo_size;
	int wcreds_max;

	bool pin_win;
	bool rej_no_credit;
	bool tx_wcred_mode;
	bool rx_wcred_mode;
	bool tx_win_ord_mode;
	bool rx_win_ord_mode;
	bool data_stamp;
	bool nx_win;
	bool fault_win;
	bool user_win;
	bool notify_disable;
	bool intr_disable;
	bool notify_early;

	int lnotify_lpid;
	int lnotify_pid;
	int lnotify_tid;
	u32 pswid;

	int tc_mode;
};

/*
 * Window attributes specified by the in-kernel owner of a send window.
 */

Annotation

Implementation Notes