lx_emul: use devio API for USB driver operations

Fix genodelabs/genode#4795
This commit is contained in:
Stefan Kalkowski 2023-04-18 11:51:41 +02:00 committed by Christian Helmuth
parent f079d1f7c3
commit 97e3572844
13 changed files with 495 additions and 630 deletions

View File

@ -1,19 +0,0 @@
+++ src/linux/drivers/usb/core/message.c
@@ -869,7 +869,7 @@
}
}
-static int usb_string_sub(struct usb_device *dev, unsigned int langid,
+int usb_string_sub(struct usb_device *dev, unsigned int langid,
unsigned int index, unsigned char *buf)
{
int rc;
@@ -906,7 +906,7 @@
return rc;
}
-static int usb_get_langid(struct usb_device *dev, unsigned char *tbuf)
+int usb_get_langid(struct usb_device *dev, unsigned char *tbuf)
{
int err;

View File

@ -1 +1 @@
0c5bbb2cab108531df25b2c92610ce92c57abc87
6d981ad90be7e1fc9eb1dfd8513698d4e2a37a45

View File

@ -12,7 +12,6 @@ DIR(linux) := src/linux
PATCH_FILES := i915_irq.patch i915_fb_resize.patch \
iwlwifi_enable_irq_before_pnvm.patch \
iwlwifi_limit_rx_bufs.patch \
usb_message.patch \
workqueue_deadlock.patch
PATCHES += $(addprefix patches/,$(PATCH_FILES))

View File

@ -24,7 +24,7 @@ void lx_emul_register_initcall(int (*initcall)(void), const char * name);
void lx_emul_start_kernel(void * dtb);
void lx_emul_execute_kernel_until(int (*condition)(void));
void lx_emul_execute_kernel_until(int (*condition)(void*), void * args);
void lx_emul_setup_arch(void * dtb);

View File

@ -20,6 +20,9 @@ extern "C" {
extern struct genode_usb_rpc_callbacks lx_emul_usb_rpc_callbacks;
struct file_operations;
void lx_emul_usb_register_devio(const struct file_operations * fops);
#ifdef __cplusplus
}
#endif

View File

@ -63,11 +63,11 @@ extern "C" void lx_emul_start_kernel(void * dtb)
}
extern "C" void lx_emul_execute_kernel_until(int (*condition)(void))
extern "C" void lx_emul_execute_kernel_until(int (*condition)(void*), void * args)
{
Lx_kit::env().scheduler.schedule();
while (!condition()) {
while (!condition(args)) {
Lx_kit::env().env.ep().wait_and_dispatch_one_io_signal();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -758,3 +758,11 @@ void software_node_notify_remove(struct device * dev)
{
lx_emul_trace(__func__);
}
#include <linux/cdev.h>
void cdev_init(struct cdev * cdev,const struct file_operations * fops)
{
lx_emul_trace(__func__);
}

View File

@ -214,3 +214,30 @@ void net_ns_init(void)
{
lx_emul_trace(__func__);
}
#include <linux/fs.h>
struct timespec64 current_time(struct inode * inode)
{
struct timespec64 ret = { 0 };
lx_emul_trace(__func__);
return ret;
}
#include <linux/pid.h>
void put_pid(struct pid * pid)
{
lx_emul_trace(__func__);
}
#include <linux/cred.h>
void __put_cred(struct cred * cred)
{
lx_emul_trace(__func__);
}

View File

@ -36,14 +36,6 @@ void __printk_safe_exit(void)
}
#include <linux/cred.h>
void __put_cred(struct cred * cred)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/sched/task.h>
void __put_task_struct(struct task_struct * tsk)
@ -68,22 +60,6 @@ void __unregister_chrdev(unsigned int major,unsigned int baseminor,unsigned int
}
#include <linux/uaccess.h>
unsigned long _copy_from_user(void * to,const void __user * from,unsigned long n)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/uaccess.h>
unsigned long _copy_to_user(void __user * to,const void * from,unsigned long n)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/printk.h>
int _printk_deferred(const char * fmt,...)
@ -131,14 +107,6 @@ const struct cpumask * cpu_clustergroup_mask(int cpu)
}
#include <linux/fs.h>
struct timespec64 current_time(struct inode * inode)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/property.h>
int device_create_managed_software_node(struct device * dev,const struct property_entry * properties,const struct software_node * parent)
@ -303,14 +271,6 @@ void kill_anon_super(struct super_block * sb)
}
#include <linux/sched/signal.h>
int kill_pid_usb_asyncio(int sig,int errno,sigval_t addr,struct pid * pid,const struct cred * cred)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/slab.h>
void * kmem_cache_alloc_lru(struct kmem_cache * cachep,struct list_lru * lru,gfp_t flags)
@ -428,14 +388,6 @@ int proc_douintvec(struct ctl_table * table,int write,void * buffer,size_t * len
}
#include <linux/pid.h>
void put_pid(struct pid * pid)
{
lx_emul_trace_and_stop(__func__);
}
#include <linux/refcount.h>
void refcount_warn_saturate(refcount_t * r,enum refcount_saturation_type t)

View File

@ -108,3 +108,30 @@ int pci_irq_vector(struct pci_dev *dev, unsigned int nr)
void pci_free_irq_vectors(struct pci_dev *dev)
{
}
#include <linux/cdev.h>
#include <lx_emul/usb.h>
void cdev_init(struct cdev * cdev, const struct file_operations * fops)
{
lx_emul_usb_register_devio(fops);
}
#include <linux/uaccess.h>
unsigned long _copy_from_user(void * to,const void __user * from,unsigned long n)
{
memcpy(to, from, n);
return 0;
}
#include <linux/uaccess.h>
unsigned long _copy_to_user(void __user * to,const void * from,unsigned long n)
{
memcpy(to, from, n);
return 0;
}

View File

@ -194,14 +194,6 @@ void register_irq_proc(unsigned int irq,struct irq_desc * desc)
}
#include <linux/cdev.h>
void cdev_init(struct cdev * cdev,const struct file_operations * fops)
{
lx_emul_trace(__func__);
}
int cdev_add(struct cdev * p,dev_t dev,unsigned count)
{
lx_emul_trace(__func__);

View File

@ -530,3 +530,11 @@ int pcie_capability_clear_and_set_word(struct pci_dev *dev, int pos,
lx_emul_trace_and_stop(__func__);
return 0;
}
#include <linux/cdev.h>
void cdev_init(struct cdev * cdev,const struct file_operations * fops)
{
lx_emul_trace(__func__);
}