Commit e51d81aa authored by Charlie Jacobsen's avatar Charlie Jacobsen Committed by Vikram Narayanan

Starting code for IPC registers and access.

Set up new header files, under include/lcd-domains/
-- lcd-domains.h: main include, contains struct lcd
-- ipc.h: struct lcd_ipc_regs, for message registers

Updated virt/lcd/lcd-domains.c to use new headers.

Updated arch-dep code to use new struct lcd_ipc_regs.
struct lcd_arch contains a pointer to the allocated
page for stack / ipc registers. struct lcd (arch-indep)
contains a pointer to the same memory (so that the
arch-indep code can access the ipc regs directly if
it wishes).

Message registers should be accessed through arch-dep
macros (to be implemented next) for portability and
speed (some of the message registers will be
implemented using machine regs, so the message registers
in struct lcd_ipc_regs are `shadows').

Message register design based on seL4. See seL4 manual,
4.1.
parent 166dcf09
......@@ -3,6 +3,7 @@
#include <asm/vmx.h>
#include <linux/spinlock.h>
#include <lcd-domains/ipc.h>
struct lcd_arch_vmcs {
u32 revision_id;
......@@ -85,7 +86,7 @@ struct lcd_arch {
struct lcd_arch_ept ept;
struct desc_struct *gdt;
struct lcd_arch_tss *tss;
u8 *ipc_regs;
struct lcd_ipc_regs *ipc_regs;
u8 fail;
u64 exit_reason;
......
......@@ -1885,7 +1885,7 @@ static int vmx_init_stack(struct lcd_arch *vcpu)
*
* Bottom of stack will contain ipc buffer.
*/
vcpu->ipc_regs = (u8 *)get_zeroed_page(GFP_KERNEL);
vcpu->ipc_regs = (struct lcd_ipc_regs *)get_zeroed_page(GFP_KERNEL);
if (!vcpu->ipc_regs) {
ret = -ENOMEM;
goto fail;
......
#ifndef LCD_DOMAINS_IPC_H
#define LCD_DOMAINS_IPC_H
/*
* Message Registers
* =================
*
* Capability Register machine register (arch-dep)
* Badge Register machine register (arch-dep)
* Message tag machine register (arch-dep)
* Message registers 6 total. All message registers are available in
* struct lcd_ipc_regs. Some message registers may
* also be accessible via machine registers. Use
* arch-dep macros for guaranteed fast and portable
* access.
*
* For portability, use the arch-dep macros provided by the arch code
* to access ipc registers.
*
* Based on seL4 message register design. See seL4 Manual, 4.1.
*/
struct lcd_ipc_regs {
/*
* Capability, badge, and message tag are always machine regs.
*
* Message registers
*/
u64 mr[6];
};
#endif /* LCD_DOMAINS_IPC_H */
#ifndef LCD_DOMAINS_LCD_DOMAINS_H
#define LCD_DOMAINS_LCD_DOMAINS_H
#include <asm/lcd-domains-arch.h>
#include <lcd-domains/ipc.h>
struct lcd {
/*
* Arch-dependent state of lcd
*/
struct lcd_arch *lcd_arch;
/*
* IPC registers. Points to memory allocated by
* arch-dep code for IPC registers (inside struct lcd_arch).
*/
struct lcd_ipc_regs *ipc_regs;
};
#endif /* LCD_DOMAINS_LCD_DOMAINS_H */
/**
* core.c - Main file for the LCD module
* lcd-domains.c - Main file for the LCD module
*
*
* Authors:
......@@ -14,8 +14,11 @@
#include <linux/compat.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <linux/lcd-domains.h>
#include <asm/lcd-domains-arch.h>
#include <lcd-domains/lcd-domains.h>
#include <lcd-domains/ipc.h>
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("LCD driver");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment