diff --git a/docs/intervention_points b/docs/intervention_points new file mode 100644 index 0000000000000000000000000000000000000000..0c6f1b54f8e9a978da20677121fc48b391ab5878 --- /dev/null +++ b/docs/intervention_points @@ -0,0 +1,77 @@ +For now using stable kernel v4.5.2 + +######### GLOBAL: +### How does Linux notice that there is a new device? +This differs from device type to device type. For PCI Devices e.g. the kernel +asks the pci interface driver for connected devices (see ???). +The Kernel then generates a udev event. + +### How to make linux kernel load driver even when no hw is available? +Linux kernel loads the module but how to make the kernel 'activating' +this driver for not existing hardware? +TODO... + +#### How does Linux decide which driver to load for a new device? +Kernel generates events (device uevents) with information abount device +and udev searches for driver with matching PID/VID(product,vendor). +Then udev loads the driver and creates device node. + +######### USB: +### What abstraction layer can be used to supply virtual usb devices? +For USB we need to create a interface where usb devices can be registered. +There are three(?) possible places where this can be done. +1.) Create driver for own USB Controller and ensure that this driver is executed. +(By tricking the kernel into thinking there is a new controller?) + +2.) Create driver for own USB Hub and ensure that this driver is executed. +(By tricking a usb controller into thinking there is a new device?) + +3.) Trick usb controller into thinking that there is new device which redirects all the +calls from the usb driver to userspace. + +For all: +TODO: How is connection between driver and usb device? + +### 1.) USB Controller: +There are different USB Controller types: +ohci = usb1.1 +uhci = usb1.x +ehci = usb2.0 +xhci = usb1.x - usb3.0 + +Because we want to be able to simulate different usb devices we use a XHCI controller because +it has the ability to control all usb devices. + +Drivers for usb controllers are in: +drivers/usb/host/... +e.g. drivers/usb/host/xhci-plat.c + +### 2.) USB Hubs: +Probably we could foist a virtual usb hub to one of the real usb controllers. + +TODO: Where does the Controller store his devices? +TODO: Where are the drivers for usb hubs? + +### 3.) USB Devices + +TODO: Where does the Controller store his devices? +TODO: How to redirect calls from driver?/ Where are driver calls going to? + +######### Other devices +For other devices the only possibility is to use the 'top driver layer' (blockio/chario) +because underneath there is only the device driver which does direct hw access (in,out). + +We have to create a new module and register a own device driver with +int register_chrdev(unsigned int major, const char *name, struct file_operations *fops); +int register_blkdev(unsigned int major, const char *name) + +TODO: How to let the kernel load this driver?? + +# Character devices +Only possible over the top character device layer (ioctl, read, write) [or by overriding in/out] + +# Block devices +Only possible over the top block device layer (blockio) [or by overriding in/out] + +######### Network interface: +TODO