All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 963eb782 authored by Charlie Jacobsen's avatar Charlie Jacobsen Committed by Vikram Narayanan

Restructuring prototype code.

parent 3cf76120
......@@ -202,6 +202,6 @@ source "drivers/hwtracing/intel_th/Kconfig"
source "drivers/fpga/Kconfig"
source "drivers/lcd/Kconfig"
source "drivers/lcd-prototype/Kconfig"
endmenu
......@@ -39,7 +39,7 @@ obj-y += soc/
obj-$(CONFIG_VIRTIO) += virtio/
obj-$(CONFIG_XEN) += xen/
obj-$(CONFIG_LCD_DRIVERS) += lcd/
obj-$(CONFIG_LCD_PROTOTYPE) += lcd-prototype/
# regulators early, since some subsystems rely on them to initialize
obj-$(CONFIG_REGULATOR) += regulator/
......
#
# LCD prototype
#
config LCD_PROTOTYPE
bool "LCD Prototype"
default y
select LCD_PROTOTYPE_API
select LCD_PROTOTYPE_LIBLCD
select LCD_PROTOTYPE_TEST
---help---
Prototype for Lightweight Capability Domains system.
config LCD_PROTOTYPE_API
tristate "LCD Prototype API"
default m
depends on LCD_PROTOTYPE
---help---
The kernel prototype for the LCD system.
config LCD_PROTOTYPE_LIBLCD
bool "LCD Prototype LibLCD"
default y
depends on LCD_PROTOTYPE
---help---
Routines used by test modules.
config LCD_PROTOTYPE_TEST
bool "LCD Prototype Test"
default y
depends on LCD_PROTOTYPE_API
depends on LCD_PROTOTYPE_LIBLCD
select LCD_PROTOTYPE_TEST_CUSTOMER
select LCD_PROTOTYPE_TEST_DEALER
select LCD_PROTOTYPE_TEST_MANUFACTURER
config LCD_PROTOTYPE_TEST_CUSTOMER
tristate
depends on LCD_PROTOTYPE_TEST
default m
config LCD_PROTOTYPE_TEST_DEALER
tristate
depends on LCD_PROTOTYPE_TEST
default m
config LCD_PROTOTYPE_TEST_MANUFACTURER
tristate
depends on LCD_PROTOTYPE_TEST
default m
config LCD_PROTOTYPE_TEST_IN_LCD
bool "LCD Prototype run tests in LCD"
depends on LCD_PROTOTYPE_TEST
default false
obj-$(CONFIG_LCD_PROTOTYPE_API) += api/
obj-$(CONFIG_LCD_PROTOTYPE_LIBLCD) += liblcd/
obj-$(CONFIG_LCD_PROTOTYPE_TEST) += test/
obj-$(CONFIG_LCD_PROTOTYPE_TEST_CUSTOMER) += customer.o
obj-$(CONFIG_LCD_PROTOTYPE_TEST_DEALER) += dealer.o
obj-$(CONFIG_LCD_PROTOTYPE_TEST_MANUFACTURER) += manufacturer.o
#
# LCD modules configuration
#
config LCD_DRIVERS
bool "Misc drivers for testing LCDs"
default y
---help---
Misc drivers for testing Lightweight cap domains.
config LCD_PING_PONG_RECEIVER
tristate "LCD ping-pong IPC test (receiver)"
depends on LCD_PING_PONG_SENDER
depends on LCD_DRIVERS
default m
---help---
Receiver for the ping-pong LCD IPC test
config LCD_PING_PONG_SENDER
tristate "LCD ping-pong IPC test (sender)"
depends on LCD_DRIVERS
default m
---help---
Sender for the ping-pong LCD IPC test
# config LCD_CS_INIT
# tristate "LCD client-server test (init module)"
# depends on LCD_CS_CLIENT
# depends on LCD_CS_SERVER
# depends on LCD
# default m
# ---help---
# Init code to start the LCD client-server test
# config LCD_CS_CLIENT
# tristate "LCD client-server test (client)"
# depends on LCD
# default m
# ---help---
# Client module for the LCD client-server test
# config LCD_CS_SERVER
# tristate "LCD client-server test (server)"
# depends on LCD
# default m
# ---help---
# Server module for the LCD client-server test
config LCD_IPC_AUTO
bool "Build automobile ipc test"
depends on LCD_DRIVERS
config LCD_AUTO_CUSTOMER
tristate "LCD automobile ipc test (customer)"
depends on LCD_IPC_AUTO
default m
---help---
Auto customer module for ipc test
config LCD_AUTO_DEALER
tristate "LCD automobile ipc test (dealer)"
depends on LCD_IPC_AUTO
default m
---help---
Auto dealer module for ipc test
config LCD_AUTO_MANUFACTURER
tristate "LCD automobile ipc test (manufacturer)"
depends on LCD_IPC_AUTO
default m
---help---
Auto manufacturer module for ipc test
config RUN_IN_LCD
bool "Run automobile ipc test modules in LCDs"
depends on LCD_IPC_AUTO
default false
---help---
Set to true to run ipc auto modules in lcds.
\ No newline at end of file
obj-$(CONFIG_LCD_IPC_AUTO) += ipc-auto/
#obj-y += ipc-ping-pong/
obj-$(CONFIG_LCD_AUTO_CUSTOMER) += customer.o
obj-$(CONFIG_LCD_AUTO_DEALER) += dealer.o
obj-$(CONFIG_LCD_AUTO_MANUFACTURER) += manufacturer.o
/**
* sender.c - sender for the IPC ping-pong test
*
*
* Authors: Anton Burtsev <aburtsev@flux.utah.edu>
* Copyright: University of Utah
*/
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/miscdevice.h>
#include <linux/compat.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <linux/kthread.h>
#include <lcd/lcd.h>
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("LCD ping-pong test receiver");
extern int lcd_ping_pong_init_receiver(void);
int module_execution_loop(void) {
int ret;
capability_t rvp_cap = current->utcb->boot_info.boot_rvp;
struct message_info *msg = &current->utcb->msg_info;
msg->valid_regs = 6;
ret = ipc_recv(rvp_cap, msg);
if (ret) {
printk(KERN_ERR "receiver failed:%d\n", ret);
return ret;
};
printk(KERN_INFO "Receiver got: %lld,%lld,%lld,%lld,%lld,%lld", msg->regs[0], msg->regs[1],
msg->regs[2], msg->regs[3], msg->regs[4], msg->regs[5]);
msg->regs[0] = 7;
msg->regs[1] = 8;
msg->regs[2] = 9;
msg->regs[3] = 10;
msg->regs[4] = 11;
msg->regs[5] = 12;
msg->regs[6] = 13;
msg->regs[7] = 14;
msg->valid_regs = 8;
ret = ipc_send(rvp_cap, msg);
if (ret) {
printk(KERN_ERR "receiver failed to send:%d\n", ret);
return ret;
};
return 0;
};
int module_thread(void *p) {
int ret;
ret = lcd_ping_pong_init_receiver();
if (ret) {
printk(KERN_ERR "sender failed to initialize ping-pong environtment\n");
return -EINVAL;
}
return module_execution_loop();
};
int module_thread_init(void) {
struct task_struct *t;
t = kthread_create(module_thread, NULL, "pp-sender");
if (!t) {
printk(KERN_ERR "Failed to create module thread\n");
return -EINVAL;
};
wake_up_process(t);
return 0;
}
static int __init receiver_init(void)
{
printk(KERN_ERR "IPC ping-pong, sender module loaded\n");
return module_thread_init();
}
static void __exit receiver_exit(void)
{
}
module_init(receiver_init);
module_exit(receiver_exit);
/**
* sender.c - sender for the IPC ping-pong test
*
*
* Authors: Anton Burtsev <aburtsev@flux.utah.edu>
* Copyright: University of Utah
*/
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/miscdevice.h>
#include <linux/compat.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <linux/kthread.h>
#include <linux/slab.h>
#include <lcd/lcd.h>
#include <lcd/cap.h>
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("LCD ping-pong IPC test (sender)");
struct sync_ipc *rvp;
int lcd_ping_pong_init_sender(void) {
int ret;
capability_t rvp_cap = 0;
struct cnode *cnode;
ret = lcd_enter();
if (ret) {
printk(KERN_ERR "Failed to enter LCD environment\n");
return ret;
};
rvp = alloc_sync_ipc();
if(!rvp) {
printk(KERN_ERR "Failed to allocate memory\n");
return -ENOMEM;
};
cnode = lcd_cnode_lookup(&current->cspace, rvp_cap);
if(cnode == 0) {
printk(KERN_ERR "Failed to create capability\n");
kfree(rvp);
return -ENOMEM;
};
cnode->type = LCD_TYPE_SYNC_EP;
cnode->object = rvp;
lcd_cnode_release(cnode);
current->utcb->boot_info.boot_rvp = rvp_cap;
return 0;
};
int lcd_ping_pong_init_receiver(void)
{
int ret;
capability_t rvp_cap = 0;
struct cnode *cnode;
ret = lcd_enter();
if (ret) {
printk(KERN_ERR "Failed to enter LCD environment\n");
return ret;
};
BUG_ON(rvp == NULL);
cnode = lcd_cnode_lookup(&current->cspace, rvp_cap);
if(cnode == 0) {
printk(KERN_ERR "Failed to create capability\n");
kfree(rvp);
return -ENOMEM;
};
cnode->type = LCD_TYPE_SYNC_EP;
cnode->object = rvp;
lcd_cnode_release(cnode);
current->utcb->boot_info.boot_rvp = rvp_cap;
return 0;
};
EXPORT_SYMBOL(lcd_ping_pong_init_receiver);
int module_execution_loop(void) {
int ret;
capability_t rvp_cap = current->utcb->boot_info.boot_rvp;
struct message_info *msg = &current->utcb->msg_info;
msg->regs[0] = 1;
msg->regs[1] = 2;
msg->regs[2] = 3;
msg->regs[3] = 4;
msg->regs[4] = 5;
msg->regs[5] = 6;
msg->valid_regs = 6;
ret = ipc_send(rvp_cap, msg);
if (ret) {
printk(KERN_ERR "sender failed:%d\n", ret);
return ret;
};
msg->valid_regs = 8;
ret = ipc_recv(rvp_cap, msg);
if (ret) {
printk(KERN_ERR "sender failed to recv:%d\n", ret);
return ret;
};
printk(KERN_INFO "Sender got: %lld,%lld,%lld,%lld,%lld,%lld,%lld,%lld\n",
msg->regs[0], msg->regs[1], msg->regs[2], msg->regs[3],
msg->regs[4], msg->regs[5], msg->regs[6], msg->regs[7]);
return 0;
};
int module_thread(void *p) {
int ret;
ret = lcd_ping_pong_init_sender();
if (ret) {
printk(KERN_ERR "sender failed to initialize ping-pong environtment\n");
return -EINVAL;
}
return module_execution_loop();
};
int module_thread_init(void) {
struct task_struct *t;
t = kthread_create(module_thread, NULL, "pp-sender");
if (!t) {
printk(KERN_ERR "Failed to create module thread\n");
return -EINVAL;
};
wake_up_process(t);
return 0;
}
static int __init sender_init(void)
{
printk(KERN_ERR "IPC ping-pong, sender module loaded\n");
return module_thread_init();
}
static void __exit sender_exit(void)
{
}
module_init(sender_init);
module_exit(sender_exit);
/*
* Author: Charles Jacobsen <charlesj@cs.utah.edu>
* Copyright: University of Utah
*/
#ifndef LCD_LCD_H
#define LCD_LCD_H
#define LCD_NUM_REGS 8
#define LCD_NUM_OUT_CAP_REGS 8
#define LCD_NUM_IN_CAP_REGS LCD_NUM_OUT_CAP_REGS
#define LCD_NUM_BOOT_CPTRS 8
struct cspace;
struct dstore;
typedef u64 cptr_t;
struct lcd {
u64 badge;
struct cspace *cspace;
struct {
cptr_t boot_cptrs[LCD_NUM_BOOT_CPTRS];
u64 regs[LCD_NUM_REGS];
cptr_t out_cap_regs[LCD_NUM_OUT_CAP_REGS];
cptr_t in_cap_regs[LCD_NUM_IN_CAP_REGS];
u8 valid_regs;
u8 valid_out_cap_regs;
u8 valid_in_cap_regs;
cptr_t reply_cptr;
cptr_t reply_badge;
} utcb;
struct dstore *dstore;
};
#endif /* LCD_LCD_H */
......@@ -15,9 +15,9 @@
#include <net/net_namespace.h>
#include <linux/sched/rt.h>
#ifdef CONFIG_HAVE_LCD
#include <lcd-domains/lcd-domains.h>
#define INIT_LCD .lcd = NULL,
#ifdef CONFIG_LCD_PROTOTYPE
#define INIT_LCD(tsk) \
.lcd = NULL,
#else
#define INIT_LCD
#endif
......@@ -201,6 +201,7 @@ extern struct task_group root_task_group;
.usage = ATOMIC_INIT(2), \
.flags = PF_KTHREAD, \
.prio = MAX_PRIO-20, \
INIT_LCD(tsk) \
.static_prio = MAX_PRIO-20, \
.normal_prio = MAX_PRIO-20, \
.policy = SCHED_NORMAL, \
......
......@@ -60,10 +60,8 @@ struct sched_param {
#include <linux/magic.h>
#include <linux/cgroup-defs.h>
#ifdef CONFIG_HAVE_LCD
#include <lcd/cap.h>
#include <lcd/ipc.h>
#include <lcd/cap-cache.h>
#ifdef CONFIG_LCD_PROTOTYPE
#include <lcd-prototype/lcd.h>
#endif
#include <asm/processor.h>
......@@ -1469,7 +1467,7 @@ struct task_struct {
atomic_t usage;
unsigned int flags; /* per process flags, defined below */
unsigned int ptrace;
#ifdef CONFIG_HAVE_LCD
#ifdef CONFIG_LCD_PROTOTYPE
struct lcd *lcd;
#endif
#ifdef CONFIG_SMP
......
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