dde_linux: move test/driver_time to virt_linux

Fixes #4775
This commit is contained in:
Christian Helmuth 2022-10-28 15:27:49 +02:00
parent 807e2a1eb4
commit 6a80b4bd17
14 changed files with 495 additions and 207 deletions

View File

@ -2,7 +2,7 @@
# Build
#
if {[expr ![have_spec x86_64]]} {
if {[expr ![have_spec arm_64] && ![have_spec x86_64]]} {
puts "Run script is not supported on this platform."
exit 0
}
@ -11,7 +11,6 @@ set use_top 0
set build_components {
core init timer
drivers/platform
test/driver_time
}
@ -44,14 +43,6 @@ append config {
<provides><service name="Timer"/></provides>
</start>
<start name="platform_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Platform"/></provides>
<config>
<policy label="test-driver_time -> "> <device name="ps2"/> </policy>
</config>
</start>
<start name="test-driver_time" priority="-1">
<resource name="RAM" quantum="2M"/>
</start>}
@ -71,11 +62,9 @@ install_config $config
# Boot modules
#
file copy [select_from_repositories board/[board]/devices] [run_dir]/genode/devices
# generic modules
set boot_modules {
core ld.lib.so init timer platform_drv
core ld.lib.so init timer
test-driver_time
}

View File

@ -0,0 +1,22 @@
/*
* \brief Dummy definitions of Linux Kernel functions - handled manually
* \author Alexander Boettcher
* \date 2022-07-01
*/
/*
* Copyright (C) 2022 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
#include <lx_emul/debug.h>
#include <linux/syscore_ops.h>
void register_syscore_ops(struct syscore_ops * ops)
{
lx_emul_trace(__func__);
}

View File

@ -0,0 +1,25 @@
/**
* \brief Dummy definitions of Linux Kernel functions
* \author Alexander Boettcher
* \date 2022-07-01
*/
/*
* Copyright (C) 2022 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
#ifndef _DRIVER_TIME__LX_EMUL_H_
#define _DRIVER_TIME__LX_EMUL_H_
/* Needed to trace and stop */
#include <lx_emul/debug.h>
/* fix for missing includes in generated_dummies */
#include <linux/compiler_attributes.h>
#include <linux/sched/debug.h>
#include <linux/irq.h>
#endif /* _DRIVER_TIME__LX_EMUL_H_ */

View File

@ -16,7 +16,14 @@
#include <linux/delay.h>
#include "i915_drv.h" /* test wait_for() macro */
#ifdef __x86_64__
/* test wait_for() macro */
#define CONFIG_DRM_I915_TIMESLICE_DURATION 1
#define CONFIG_DRM_I915_PREEMPT_TIMEOUT 640
#define CONFIG_DRM_I915_HEARTBEAT_INTERVAL 2500
#include "i915_drv.h"
#endif
#include <lx_emul/time.h>
@ -46,13 +53,13 @@ struct measure {
\
m_lxemul.start = lx_emul_time_counter(); \
m_jiffies.start = jiffies_64; \
m_rdtsc.start = rdtsc(); \
m_rdtsc.start = get_cycles(); \
\
{ \
fn_test \
} \
\
m_rdtsc.end = rdtsc(); \
m_rdtsc.end = get_cycles(); \
m_jiffies.end = jiffies_64; \
m_lxemul.end = lx_emul_time_counter(); \
\
@ -120,7 +127,6 @@ static int timing_tests(void * data)
{
DEFINE_WAIT(wait);
wait_queue_head_t wq;
int ret;
uint64_t const rdtsc_freq_mhz = tsc_freq_khz / 1000;
init_waitqueue_head(&wq);
@ -146,6 +152,10 @@ static int timing_tests(void * data)
msleep(5000);
);
#ifdef __x86_64__
{
int ret = 0;
test_timing_with_ret("wait_for(cond,10ms) A ->",
add_wait_queue(&wq, &wait);
ret = wait_for((0), 10);
@ -251,6 +261,10 @@ static int timing_tests(void * data)
ret = wait_for((0), 50);
remove_wait_queue(&wq, &wait);
);
}
#else
printk("skip x86_64 wait_for() tests ...\n");
#endif
/* audio driver test case -> sleeping too short or long is bad */
test_timing_no_ret ("usleep_range(20,21) ->",

View File

@ -0,0 +1,304 @@
/*
* \brief Dummy definitions of Linux Kernel functions
* \author Automatically generated file - do no edit
* \date 2023-03-24
*/
#include <lx_emul.h>
#include <linux/clk-provider.h>
const char * __clk_get_name(const struct clk * clk)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/irqdomain.h>
struct irq_domain * __irq_domain_add(struct fwnode_handle * fwnode,int size,irq_hw_number_t hwirq_max,int direct_max,const struct irq_domain_ops * ops,void * host_data)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/irqdomain.h>
struct irq_desc * __irq_resolve_mapping(struct irq_domain * domain,irq_hw_number_t hwirq,unsigned int * irq)
{
lx_emul_trace_and_stop(__func__);
}
#include <asm-generic/percpu.h>
unsigned long __per_cpu_offset[NR_CPUS] = {};
#include <linux/sched/task.h>
void __put_task_struct(struct task_struct * tsk)
{
lx_emul_trace_and_stop(__func__);
}
#include <clocksource/arm_arch_timer.h>
u64 (*arch_timer_read_counter)(void);
#include <linux/printk.h>
asmlinkage __visible void dump_stack(void)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/interrupt.h>
bool force_irqthreads;
#include <linux/property.h>
unsigned int fwnode_count_parents(const struct fwnode_handle * fwnode)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/property.h>
const char * fwnode_get_name(const struct fwnode_handle * fwnode)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/property.h>
const char * fwnode_get_name_prefix(const struct fwnode_handle * fwnode)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/property.h>
struct fwnode_handle * fwnode_get_nth_parent(struct fwnode_handle * fwnode,unsigned int depth)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/property.h>
void fwnode_handle_put(struct fwnode_handle * fwnode)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/uuid.h>
const u8 guid_index[16] = {};
#include <linux/irq.h>
void handle_fasteoi_irq(struct irq_desc * desc)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/sched.h>
void io_schedule_finish(int token)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/sched.h>
int io_schedule_prepare(void)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/sched.h>
long __sched io_schedule_timeout(long timeout)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/interrupt.h>
int irq_can_set_affinity(unsigned int irq)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/irqdomain.h>
void irq_domain_free_irqs_common(struct irq_domain * domain,unsigned int virq,unsigned int nr_irqs)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/irqdomain.h>
void irq_domain_set_info(struct irq_domain * domain,unsigned int virq,irq_hw_number_t hwirq,struct irq_chip * chip,void * chip_data,irq_flow_handler_t handler,void * handler_data,const char * handler_name)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/irq.h>
void irq_modify_status(unsigned int irq,unsigned long clr,unsigned long set)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/interrupt.h>
int irq_set_affinity(unsigned int irq,const struct cpumask * cpumask)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/irqdomain.h>
void irq_set_default_host(struct irq_domain * domain)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/irqnr.h>
struct irq_desc * irq_to_desc(unsigned int irq)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/irq_work.h>
void irq_work_tick(void)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/kstrtox.h>
int kstrtoll(const char * s,unsigned int base,long long * res)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/delay.h>
unsigned long lpj_fine;
#include <linux/of.h>
struct property * of_find_property(const struct device_node * np,const char * name,int * lenp)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/of.h>
const struct fwnode_operations of_fwnode_ops;
#include <linux/of.h>
const char * of_prop_next_string(struct property * prop,const char * cur)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/of.h>
int of_property_read_string(const struct device_node * np,const char * propname,const char ** out_string)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/printk.h>
int printk_deferred(const char * fmt,...)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/rcutree.h>
void rcu_irq_enter_irqson(void)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/rcutree.h>
void rcu_irq_exit_irqson(void)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/siphash.h>
u64 siphash_1u64(const u64 first,const siphash_key_t * key)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/jump_label.h>
bool static_key_initialized;
#include <linux/string_helpers.h>
int string_escape_mem(const char * src,size_t isz,char * dst,size_t osz,unsigned int flags,const char * only)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/clockchips.h>
void tick_broadcast(const struct cpumask * mask)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/uuid.h>
const u8 uuid_index[16] = {};

View File

@ -1,29 +1,12 @@
drivers/base/bus.c
drivers/base/class.c
drivers/base/component.c
drivers/base/core.c
drivers/base/dd.c
drivers/base/devres.c
drivers/base/driver.c
drivers/base/platform.c
drivers/base/property.c
drivers/pci/pci-driver.c
kernel/async.c
kernel/irq/chip.c
kernel/irq/devres.c
kernel/irq/handle.c
kernel/irq/irqdesc.c
kernel/irq/irqdomain.c
kernel/irq/manage.c
kernel/irq/resend.c
arch/arm64/lib/memchr.S
arch/arm64/lib/memcmp.S
arch/arm64/lib/strcmp.S
arch/arm64/lib/strlen.S
kernel/kthread.c
kernel/locking/mutex.c
kernel/locking/osq_lock.c
kernel/locking/rtmutex.c
kernel/locking/rwsem.c
kernel/notifier.c
kernel/panic.c
kernel/resource.c
kernel/sched/clock.c
kernel/sched/completion.c
kernel/sched/swait.c
@ -36,6 +19,7 @@ kernel/time/clocksource.c
kernel/time/hrtimer.c
kernel/time/jiffies.c
kernel/time/ntp.c
kernel/time/tick-broadcast-hrtimer.c
kernel/time/tick-broadcast.c
kernel/time/tick-common.c
kernel/time/tick-oneshot.c
@ -48,32 +32,15 @@ kernel/time/timer.c
kernel/time/timer_list.c
kernel/workqueue.c
lib/bitmap.c
lib/crc32.c
lib/ctype.c
lib/debug_locks.c
lib/dec_and_lock.c
lib/find_bit.c
lib/hexdump.c
lib/hweight.c
lib/idr.c
lib/iomap.c
lib/irq_regs.c
lib/kasprintf.c
lib/klist.c
lib/kobject.c
lib/kstrtox.c
lib/list_sort.c
lib/llist.c
lib/radix-tree.c
lib/rbtree.c
lib/refcount.c
lib/scatterlist.c
lib/siphash.c
lib/sort.c
lib/string.c
lib/timerqueue.c
lib/uuid.c
lib/vsprintf.c
lib/xarray.c
mm/mempool.c
mm/util.c

View File

@ -0,0 +1,5 @@
REQUIRES := arm_64
SRC_C += lx_emul/shadow/arch/arm64/kernel/smp.c
include $(PRG_DIR)/../../target.inc

View File

@ -1,20 +1,12 @@
/*
* \brief Dummy definitions of Linux Kernel functions
* \author Automatically generated file - do no edit
* \date 2022-09-27
* \date 2023-02-24
*/
#include <lx_emul.h>
#include <linux/proc_fs.h>
void * PDE_DATA(const struct inode * inode)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/clk-provider.h>
const char * __clk_get_name(const struct clk * clk)
@ -31,14 +23,6 @@ void __put_task_struct(struct task_struct * tsk)
}
#include <linux/srcu.h>
void __srcu_read_unlock(struct srcu_struct * ssp,int idx)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/uaccess.h>
unsigned long _copy_to_user(void __user * to,const void * from,unsigned long n)
@ -47,16 +31,22 @@ unsigned long _copy_to_user(void __user * to,const void * from,unsigned long n)
}
extern void ack_bad_irq(unsigned int irq);
void ack_bad_irq(unsigned int irq)
extern const char * _parse_integer_fixup_radix(const char * s,unsigned int * base);
const char * _parse_integer_fixup_radix(const char * s,unsigned int * base)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/kobject.h>
extern unsigned int _parse_integer_limit(const char * s,unsigned int base,unsigned long long * p,size_t max_chars);
unsigned int _parse_integer_limit(const char * s,unsigned int base,unsigned long long * p,size_t max_chars)
{
lx_emul_trace_and_stop(__func__);
}
int add_uevent_var(struct kobj_uevent_env * env,const char * format,...)
extern void ack_bad_irq(unsigned int irq);
void ack_bad_irq(unsigned int irq)
{
lx_emul_trace_and_stop(__func__);
}
@ -70,9 +60,14 @@ asmlinkage __visible void dump_stack(void)
}
#include <linux/capability.h>
#include <linux/interrupt.h>
bool file_ns_capable(const struct file * file,struct user_namespace * ns,int cap)
bool force_irqthreads;
#include <linux/property.h>
unsigned int fwnode_count_parents(const struct fwnode_handle * fwnode)
{
lx_emul_trace_and_stop(__func__);
}
@ -80,31 +75,39 @@ bool file_ns_capable(const struct file * file,struct user_namespace * ns,int cap
#include <linux/property.h>
void fwnode_remove_software_node(struct fwnode_handle * fwnode)
const char * fwnode_get_name(const struct fwnode_handle * fwnode)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/kernel.h>
#include <linux/property.h>
int get_option(char ** str,int * pint)
const char * fwnode_get_name_prefix(const struct fwnode_handle * fwnode)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/pseudo_fs.h>
#include <linux/property.h>
struct pseudo_fs_context * init_pseudo(struct fs_context * fc,unsigned long magic)
struct fwnode_handle * fwnode_get_nth_parent(struct fwnode_handle * fwnode,unsigned int depth)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/init.h>
#include <linux/property.h>
bool initcall_debug;
void fwnode_handle_put(struct fwnode_handle * fwnode)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/uuid.h>
const u8 guid_index[16] = {};
#include <linux/sched.h>
@ -123,6 +126,30 @@ int io_schedule_prepare(void)
}
#include <linux/sched.h>
long __sched io_schedule_timeout(long timeout)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/interrupt.h>
int irq_can_set_affinity(unsigned int irq)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/interrupt.h>
int irq_set_affinity(unsigned int irq,const struct cpumask * cpumask)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/irq_work.h>
void irq_work_tick(void)
@ -131,43 +158,17 @@ void irq_work_tick(void)
}
#include <linux/property.h>
#include <linux/kstrtox.h>
bool is_software_node(const struct fwnode_handle * fwnode)
int kstrtoll(const char * s,unsigned int base,long long * res)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/kobject.h>
#include <linux/prandom.h>
struct kobject *kernel_kobj;
#include <linux/fs.h>
void kill_anon_super(struct super_block * sb)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/kobject.h>
int kobject_synth_uevent(struct kobject * kobj,const char * buf,size_t count)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/irq.h>
struct irq_chip no_irq_chip;
#include <linux/irq.h>
void note_interrupt(struct irq_desc * desc,irqreturn_t action_ret)
u32 prandom_u32(void)
{
lx_emul_trace_and_stop(__func__);
}
@ -181,9 +182,9 @@ int printk_deferred(const char * fmt,...)
}
#include <linux/seq_file.h>
#include <linux/siphash.h>
void seq_printf(struct seq_file * m,const char * f,...)
u64 siphash_1u64(const u64 first,const siphash_key_t * key)
{
lx_emul_trace_and_stop(__func__);
}
@ -210,10 +211,7 @@ int string_escape_mem(const char * src,size_t isz,char * dst,size_t osz,unsigned
}
#include <linux/sched/wake_q.h>
#include <linux/uuid.h>
void wake_q_add_safe(struct wake_q_head * head,struct task_struct * task)
{
lx_emul_trace_and_stop(__func__);
}
const u8 uuid_index[16] = {};

View File

@ -0,0 +1,41 @@
arch/x86/lib/hweight.S
kernel/kthread.c
kernel/locking/mutex.c
kernel/locking/osq_lock.c
kernel/locking/rwsem.c
kernel/notifier.c
kernel/sched/clock.c
kernel/sched/completion.c
kernel/sched/swait.c
kernel/sched/wait.c
kernel/sched/wait_bit.c
kernel/smpboot.c
kernel/softirq.c
kernel/time/clockevents.c
kernel/time/clocksource.c
kernel/time/hrtimer.c
kernel/time/jiffies.c
kernel/time/ntp.c
kernel/time/tick-broadcast.c
kernel/time/tick-common.c
kernel/time/tick-oneshot.c
kernel/time/tick-sched.c
kernel/time/time.c
kernel/time/timeconv.c
kernel/time/timecounter.c
kernel/time/timekeeping.c
kernel/time/timer.c
kernel/time/timer_list.c
kernel/workqueue.c
lib/bitmap.c
lib/ctype.c
lib/find_bit.c
lib/hexdump.c
lib/idr.c
lib/radix-tree.c
lib/rbtree.c
lib/refcount.c
lib/string.c
lib/timerqueue.c
lib/vsprintf.c
lib/xarray.c

View File

@ -0,0 +1,3 @@
REQUIRES := x86_64
include $(PRG_DIR)/../../target.inc

View File

@ -1,19 +1,14 @@
REQUIRES := x86_64
TARGET := test-driver_time
LIBS := base pc_lx_emul jitterentropy
LIBS := base virt_lx_emul jitterentropy
SRC_CC += main.cc
SRC_C += lx_user.c
SRC_C += dummies.c
SRC_C += generated_dummies.c
SRC_CC += lx_emul/random.cc
SRC_C += lx_emul/common_dummies.c
SRC_C += lx_emul/shadow/lib/kobject_uevent.c
SRC_C += lx_emul/shadow/drivers/char/random.c
vpath %.c $(REP_DIR)/src/lib/pc
vpath %.cc $(REP_DIR)/src/lib/pc
vpath %.c $(PRG_DIR)/../..
vpath %.cc $(PRG_DIR)/../..
LX_SRC_DIR := $(call select_from_ports,linux)/src/linux
ifeq ($(wildcard $(LX_SRC_DIR)),)
@ -23,5 +18,5 @@ ifeq ($(wildcard $(LX_SRC_DIR)),)
fail
endif
INC_DIR += $(PRG_DIR)
INC_DIR += $(PRG_DIR)/../..
INC_DIR += $(LX_SRC_DIR)/drivers/gpu/drm/i915

View File

@ -1,63 +0,0 @@
/*
* \brief Dummy definitions of Linux Kernel functions - handled manually
* \author Alexander Boettcher
* \date 2022-07-01
*/
/*
* Copyright (C) 2022 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
#include <lx_emul/debug.h>
#include <linux/math64.h>
#include <linux/clocksource.h>
#include <linux/cpuhotplug.h>
#include <linux/kernel_stat.h>
#include <linux/kernfs.h>
#include <linux/kobject.h>
#include <linux/nls.h>
#include <linux/property.h>
#include <linux/random.h>
#include <linux/rcupdate.h>
#include <linux/sched/loadavg.h>
#include <linux/sched/signal.h>
#include <linux/syscore_ops.h>
#include <linux/timekeeper_internal.h>
int ___ratelimit(struct ratelimit_state * rs, const char * func)
{
/*
* from lib/ratelimit.c:
* " 0 means callbacks will be suppressed.
* 1 means go ahead and do it. "
*/
lx_emul_trace(__func__);
return 1;
}
#include <linux/sched.h>
long io_schedule_timeout(long timeout)
{
lx_emul_trace_and_stop(__func__);
}
void register_syscore_ops(struct syscore_ops * ops)
{
lx_emul_trace(__func__);
}
#include <linux/prandom.h>
u32 prandom_u32(void)
{
lx_emul_trace_and_stop(__func__);
}

View File

@ -1,12 +0,0 @@
/**
* \brief Dummy definitions of Linux Kernel functions
* \author Alexander Boettcher
* \date 2022-07-01
*/
/*
* Copyright (C) 2022 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/