### LILO Boot Setup Command Example Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/scsi/ncr53c8xx.rst Example of passing setup commands to the ncr53c8xx driver via the LILO boot loader. This sets up tagged commands, synchronous negotiation speed, and debug flags. ```bash lilo: linux root=/dev/hda2 ncr53c8xx=tags:4,sync:10,debug:0x200 ``` -------------------------------- ### Start eSpeakup (Manual Installation) Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/admin-guide/spkguide.txt Runs the eSpeakup binary after manual installation. Requires root privileges. ```bash /usr/bin/espeakup ``` -------------------------------- ### Start eSpeakup (Package Installation) Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/admin-guide/spkguide.txt Starts the eSpeakup daemon if it was installed as a package. Requires root privileges. The exact path may vary (/etc/init.d or /etc/rc.d). ```bash /etc/init.d/espeakup start ``` -------------------------------- ### Start 9pfs Server (diod) Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/filesystems/9p.rst Example command to start the 'diod' 9pfs server on the host. This makes the filesystem available for the USB gadget to forward. ```bash $ diod -f -n -d 0 -S -l 0.0.0.0:9999 -e $PWD ``` -------------------------------- ### IIO HW Consumer Setup Example Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/driver-api/iio/hw-consumer.rst Demonstrates the typical setup for an IIO HW consumer, including allocation, enabling, and disabling the consumer within a probe and read function. ```c static struct iio_hw_consumer *hwc; static const struct iio_info adc_info = { .read_raw = adc_read_raw, }; static int adc_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask) { ret = iio_hw_consumer_enable(hwc); /* Acquire data */ ret = iio_hw_consumer_disable(hwc); } static int adc_probe(struct platform_device *pdev) { hwc = devm_iio_hw_consumer_alloc(&iio->dev); } ``` -------------------------------- ### Initrd fstab Example Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/power/swsusp-dmcrypt.rst Example /etc/fstab content for an initrd that mounts necessary file systems and prepares for crypto setup. ```config /dev/hda1 /mnt ext3 ro 0 0 none /proc proc defaults,noatime,nodiratime 0 0 none /sys sysfs defaults,noatime,nodiratime 0 0 ``` -------------------------------- ### Basic Kernel Configuration and Build Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/scsi/NinjaSCSI.rst This example outlines the initial steps for configuring and building the Linux kernel, which is a prerequisite for installing the NinjaSCSI driver. ```bash $ cd /usr/src $ tar -zxvf linux-x.x.x.tar.gz $ cd linux $ make config ... ``` -------------------------------- ### Example: 24-bit DMA Setup with Error Handling Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/core-api/dma-api-howto.rst This example demonstrates how to set a 24-bit DMA mask and handle potential failures by printing a warning and ignoring the device. ```c if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(24))) { dev_warn(dev, "mydev: No suitable DMA available\n"); goto ignore_this_device; } ``` -------------------------------- ### Example: Standard 64-bit DMA Setup Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/core-api/dma-api-howto.rst This is a straightforward example of setting a 64-bit DMA mask using dma_set_mask_and_coherent. This call is generally expected to succeed. ```c dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)) ``` -------------------------------- ### Advised Boot Setup Commands for NCR53c8xx Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/scsi/ncr53c8xx.rst These are example boot setup commands for the ncr53c8xx driver. Use these to configure driver behavior for different system needs, from default to optimized settings. ```bash ncr53c8xx=mpar:y,spar:y,disc:y,specf:3,fsn:n,ultra:2,fsn:n,revprob:n,verb:1\ tags:0,sync:50,debug:0,burst:7,led:0,wide:1,settle:2,diff:0,irqm:0 ``` ```bash ncr53c8xx=safe:y,mpar:y,disc:y ``` ```bash ncr53c8xx=safe:y,disc:y ``` ```bash ncr53c8xx=safe:y,mpar:y ``` ```bash ncr53c8xx=safe:y ``` ```bash ncr53c8xx=mpar:y,spar:y,disc:y,specf:1,fsn:n,ultra:2,fsn:n,revprob:n,verb:1\ tags:32,sync:12,debug:0,burst:7,led:1,wide:1,settle:2,diff:0,irqm:0 ``` ```bash ncr53c8xx=verb:2 ``` -------------------------------- ### Socket Filtering Example Setup Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/networking/filter.rst Includes necessary headers for socket programming and BPF filter attachment. ```c #include #include #include #include /* ... */ ``` -------------------------------- ### Comment Syntax Example Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/admin-guide/bootconfig.rst Shows the syntax for including comments in the boot configuration file. Lines starting with '#' are ignored. ```text # This is a comment KEY = VALUE ``` -------------------------------- ### ARM64 IPA Size Configuration Example Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/virt/kvm/api.rst Configures a guest VM to use a specific physical address size (IPA Size limit) on ARM64. The size is encoded in the machine type identifier using KVM_VM_TYPE_ARM_IPA_SIZE. Ensure the requested size is supported by the host. ```c vm_fd = ioctl(dev_fd, KVM_CREATE_VM, KVM_VM_TYPE_ARM_IPA_SIZE(48)); ``` -------------------------------- ### Example of TX Error Injection: Custom Start Pulse Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/userspace-api/media/cec/cec-pin-error-inj.rst Inject an error by sending a custom pulse instead of the standard start pulse during CEC transmission. This example uses 'tx-custom-start' to replace the normal start pulse. ```bash echo "[,] tx-custom-start" > /sys/kernel/debug/cec/cecX/error-inj ``` -------------------------------- ### Setting up a new cgroup with cpuset Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/admin-guide/cgroup-v1/cgroups.rst This example demonstrates the steps to mount the cgroup filesystem, create a new cpuset cgroup, configure its CPU and memory nodes, and attach the current shell to it. ```bash mount -t tmpfs cgroup_root /sys/fs/cgroup mkdir /sys/fs/cgroup/cpuset mount -t cgroup cpuset -ocpuset /sys/fs/cgroup/cpuset cd /sys/fs/cgroup/cpuset mkdir Charlie cd Charlie /bin/echo 2-3 > cpuset.cpus /bin/echo 1 > cpuset.mems /bin/echo $$ > tasks sh ``` -------------------------------- ### Boot Configuration Example Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/scsi/ncr53c8xx.rst Illustrates the boot order configuration, showing entries for multiple controllers. ```text boot configuration boot order set by order of the devices in this table:: 04 00 0f 00 00 10 00 50 00 00 01 00 00 62 -- 1st controller 04 00 03 00 00 10 00 58 00 00 01 00 00 63 2nd controller 04 00 01 00 00 10 00 48 00 00 01 00 00 61 3rd controller 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4th controller | | | | | | | | | | | | | | ---- PCI io port adr | | | | | --0x01 init/scan at boot time | | | | --PCI device/function number (0xdddddfff) | | ----- ?? PCI vendor ID (lsb/msb) ----PCI device ID (lsb/msb) ?? use of this data is a guess but seems reasonable remaining bytes unknown - they do not appear to change in my current set up default set up is identical for 53c810a and 53c875 NVRAM -------------------------------------------------------- ``` -------------------------------- ### Example of SETUP_E820_EXT Data using setup_indirect Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/arch/x86/boot.rst Illustrates how to use setup_indirect to point to SETUP_E820_EXT data. This example shows the structure of setup_data and setup_indirect when referencing external data. ```c struct setup_data { .next = 0, /* or */ .type = SETUP_INDIRECT, .len = sizeof(setup_indirect), .data[sizeof(setup_indirect)] = (struct setup_indirect) { .type = SETUP_INDIRECT | SETUP_E820_EXT, .reserved = 0, .len = , .addr = , }, } ``` -------------------------------- ### kvm_s390_pv_info_vm Structure Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/virt/kvm/api.rst Provides Ultravisor information for PV hosts, including installed calls, feature indications, and maximum limits for CPUs, guests, and guest memory. ```c struct kvm_s390_pv_info_vm { __u64 inst_calls_list[4]; __u64 max_cpus; __u64 max_guests; __u64 max_guest_addr; __u64 feature_indication; }; ``` -------------------------------- ### Example QEMU Arguments Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/dev-tools/kunit/run_wrapper.rst Shows how to pass additional arguments to QEMU when running tests. ```bash --qemu_args "-smp 8" ``` -------------------------------- ### Insmod Command Example Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/scsi/ncr53c8xx.rst Example of installing the ncr53c8xx driver module with options using the 'insmod' command. This achieves the same configuration as the LILO example but uses space as a separator. ```bash insmod ncr53c8xx.o ncr53c8xx="tags:4 sync:10 debug:0x200" ``` -------------------------------- ### Sample Kernel Boot Configuration (lilo.conf) Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/fb/intel810.rst Example of how to configure the video=i810fb boot option in /etc/lilo.conf. This sets VRAM, resolution, color depth, and sync timings. ```text append="video=i810fb:vram:2,xres:1024,yres:768,bpp:8,hsync1:30,hsync2:55, \ vsync1:50,vsync2:85,accel,mtrr" ``` -------------------------------- ### KVM Xen VCPU Attribute Structure Example Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/virt/kvm/api.rst This structure is used with KVM_XEN_VCPU_SET_ATTR and KVM_XEN_VCPU_GET_ATTR ioctls to manage Xen VCPU attributes. It defines various types for setting guest physical addresses, runstates, and identifiers. ```c #define KVM_XEN_VCPU_ATTR_TYPE_VCPU_TIME_INFO 0 #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADDR 1 #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_CURRENT 2 #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_DATA 3 #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADJUST 4 #define KVM_XEN_VCPU_ATTR_TYPE_VCPU_ID 5 #define KVM_XEN_VCPU_ATTR_TYPE_TIMER 6 #define KVM_XEN_VCPU_ATTR_TYPE_UPCALL_VECTOR 7 struct kvm_xen_vcpu_attr { union { struct { __u64 gpa; } vcpu_time_info; struct { __u64 gpa; } runstate_addr; struct { __u32 state; __u32 reserved; } runstate; struct { __u64 state_entry_time; __u64 running_time; __u64 runnable_time; __u64 blocked_time; __u64 offline_time; } runstate_data; struct { __u64 state_entry_time; __u64 running_time; __u64 runnable_time; __u64 blocked_time; __u64 offline_time; } runstate_adjust; __u32 vcpu_id; __u32 timer_port; __u32 upcall_vector; } u; int type; }; #define KVM_XEN_INVALID_GPA (~0ULL) ``` -------------------------------- ### Initializing Display with video_post Utility Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/power/video.rst This example shows how to initialize the display in console mode using the video_post utility, often followed by a system state change. It also provides instructions for recovering graphical mode in X by switching virtual terminals. ```bash echo 3 > /sys/power/state && /usr/sbin/video_post - ``` -------------------------------- ### Imaginary Board Setup Code Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/arch/sh/new-machine.rst Provides example C code for board-specific setup, including definitions for get_system_type() and platform_setup(). ```c /* * arch/sh/boards/vapor/setup.c - Setup code for imaginary board */ #include const char *get_system_type(void) { return "FooTech Vaporboard"; } int __init platform_setup(void) { /* * If our hardware actually existed, we would do real * setup here. Though it's also sane to leave this empty * if there's no real init work that has to be done for * this board. */ /* Start-up imaginary PCI ... */ /* And whatever else ... */ return 0; } ``` -------------------------------- ### KVM_GET_SREGS2 ioctl Example Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/virt/kvm/api.rst This ioctl reads special registers from the vcpu and replaces KVM_GET_SREGS when supported. ```c #define KVM_GET_SREGS2 _IOR(KVM, 0x12, struct kvm_sregs2) /* Reads special registers from the vcpu. */ ``` -------------------------------- ### AMBA Device Probe Example Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/trace/coresight/coresight.rst Example snippet from an ETM probe function, demonstrating how to get the device reference from an amba_device. ```c static int etm_probe(struct amba_device *adev, const struct amba_id *id) { ... ... drvdata->dev = &adev->dev; ... } ``` -------------------------------- ### HPSA Unique ID Example Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/scsi/hpsa.rst This example demonstrates how to get the unique identifier for a SCSI disk managed by the hpsa driver. ```bash root@host:/sys/class/scsi_disk/4:0:0:0/device# cat unique_id 600508B1001044395355323037570F77 ``` -------------------------------- ### Get Decoder Target List, Start, and Size Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/driver-api/cxl/linux/cxl-driver.rst Retrieve the target list, start address, and size for a CXL decoder. ```bash # cat /sys/bus/cxl/devices/decoder0.0/target_list start size ``` -------------------------------- ### Build and Install Kernel Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/admin-guide/verify-bugs-and-bisect-regressions.rst Commands to build, install, and verify a custom Linux kernel. Ensure sufficient disk space before starting. ```bash cp ~/kernel-config-working .config make olddefconfig make -j $(nproc --all) # * Make sure there is enough disk space to hold another kernel: df -h /boot/ /lib/modules/ # * Note: on Arch Linux, its derivatives and a few other distributions # the following commands will do nothing at all or only part of the # job. See the step-by-step guide for further details. sudo make modules_install command -v installkernel && sudo make install # * Check how much space your self-built kernel actually needs, which # enables you to make better estimates later: du -ch /boot/*$(make -s kernelrelease)* | tail -n 1 du -sh /lib/modules/$(make -s kernelrelease)/ # * Hint: the output of the following command will help you pick the # right kernel from the boot menu: make -s kernelrelease | tee -a ~/kernels-built reboot # * Once booted, ensure you are running the kernel you just built by # checking if the output of the next two commands matches: tail -n 1 ~/kernels-built uname -r cat /proc/sys/kernel/tainted ``` -------------------------------- ### Crashkernel Boot Parameter Examples Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/admin-guide/kdump/kdump.rst Examples of the crashkernel boot parameter for different architectures. The start address 'X' is often optional. ```bash crashkernel=Y@X ``` ```bash crashkernel=Y[@X] ``` ```bash crashkernel=128M@32M ``` ```bash crashkernel=xxM ``` ```bash crashkernel=Y@X ``` ```bash crashkernel=Y[@X] ``` -------------------------------- ### Setup Media Links and Configure Pads Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/admin-guide/media/imx.rst Use media-ctl to establish connections between media devices and set pixel formats for camera input. ```bash media-ctl -l "'ov5640 1-003c':0 -> 'imx6-mipi-csi2':0[1]" media-ctl -l "'imx6-mipi-csi2':1 -> 'ipu1_csi0_mux':0[1]" media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]" media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]" media-ctl -V "'ov5640 1-003c':0 [fmt:UYVY2X8/640x480]" media-ctl -V "'imx6-mipi-csi2':1 [fmt:UYVY2X8/640x480]" media-ctl -V "'ipu1_csi0_mux':0 [fmt:UYVY2X8/640x480]" media-ctl -V "'ipu1_csi0':0 [fmt:AYUV32/640x480]" ``` -------------------------------- ### Crashkernel Example: 64MB at 16MB Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/admin-guide/kdump/kdump.rst Example of reserving 64MB of memory starting at physical address 0x01000000 (16MB) for the dump-capture kernel. ```text crashkernel=64M@16M ``` -------------------------------- ### Install and Build intel-speed-select Tool Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/admin-guide/pm/intel-speed-select.rst Build and install the intel-speed-select tool from source. Ensure you are in the tool's directory. ```bash # cd tools/power/x86/intel-speed-select/ # make # make install ``` -------------------------------- ### Pktgen Device Configuration Example Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/networking/pktgen.rst This example demonstrates how to view the parameters and current statistics of a configured Pktgen device. ```bash /proc/net/pktgen/eth4@0 Params: count 100000 min_pkt_size: 60 max_pkt_size: 60 frags: 0 delay: 0 clone_skb: 64 ifname: eth4@0 flows: 0 flowlen: 0 queue_map_min: 0 queue_map_max: 0 dst_min: 192.168.81.2 dst_max: src_min: src_max: src_mac: 90:e2:ba:0a:56:b4 dst_mac: 00:1b:21:3c:9d:f8 udp_src_min: 9 udp_src_max: 109 udp_dst_min: 9 udp_dst_max: 9 src_mac_count: 0 dst_mac_count: 0 Flags: UDPSRC_RND NO_TIMESTAMP QUEUE_MAP_CPU Current: pkts-sofar: 100000 errors: 0 started: 623913381008us stopped: 623913396439us idle: 25us seq_num: 100001 cur_dst_mac_offset: 0 cur_src_mac_offset: 0 cur_saddr: 192.168.8.3 cur_daddr: 192.168.81.2 cur_udp_dst: 9 cur_udp_src: 42 cur_queue_map: 0 flows: 0 Result: OK: 15430(c15405+d25) usec, 100000 (60byte,0frags) 6480562pps 3110Mb/sec (3110669760bps) errors: 0 ``` -------------------------------- ### Mounting and Configuring resctrl Schemata Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/filesystems/resctrl.rst This example shows the initial setup for using the resctrl filesystem. It involves mounting the filesystem, creating resource groups, and defining initial schemata for L3 cache and memory bandwidth allocation. ```bash # mount -t resctrl resctrl /sys/fs/resctrl # cd /sys/fs/resctrl # mkdir p0 p1 # echo "L3:0=3;1=c\nMB:0=50;1=50" > /sys/fs/resctrl/p0/schemata # echo "L3:0=3;1=3\nMB:0=50;1=50" > /sys/fs/resctrl/p1/schemata ``` -------------------------------- ### Get Frame Count - C Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/userspace-api/media/dvb/legacy_dvb_video.rst Use this ioctl to get the number of frames displayed since the decoder started. Note: This is deprecated for V4L2 decoders. ```c int ioctl(int fd, VIDEO_GET_FRAME_COUNT, __u64 *pts) ``` -------------------------------- ### Build and Run sched_ext Example Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/scheduler/sched-ext.rst Build the sched_ext tools and run the simple example scheduler. This demonstrates the basic compilation and execution flow. ```shell # make -j16 -C tools/sched_ext # tools/sched_ext/build/bin/scx_simple local=0 global=3 local=5 global=24 local=9 global=44 local=13 global=56 local=17 global=72 ^CEXIT: BPF scheduler unregistered ``` -------------------------------- ### Get Decoder Target List, Start, and Size (Third Decoder) Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/driver-api/cxl/linux/cxl-driver.rst Retrieve the target list, start address, and size for a third CXL decoder. ```bash # cat /sys/bus/cxl/devices/decoder0.2/target_list start size ``` -------------------------------- ### Module Configuration File Example (/etc/modprobe.d/) Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/fb/intel810.rst Shows how to configure i810fb module options by creating a file in /etc/modprobe.d/. This allows persistent configuration across reboots. ```text options i810fb vram=2 xres=1024 bpp=16 hsync1=30 hsync2=55 vsync1=50 \ vsync2=85 accel=1 mtrr=1 ``` -------------------------------- ### Min Heap Example Usage Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/core-api/min_heap.rst Demonstrates initializing a min-heap, setting up callbacks, and building the heap. ```c #include int my_less_function(const void *lhs, const void *rhs, void *args) { return (*(int *)lhs < *(int *)rhs); } struct min_heap_callbacks heap_cb = { .less = my_less_function, /* Comparison function for heap order */ .swp = NULL, /* Use default swap function */ }; void example_usage(void) { /* Pre-populate the buffer with elements */ int buffer[5] = {5, 2, 8, 1, 3}; /* Declare a min-heap */ DEFINE_MIN_HEAP(int, my_heap); /* Initialize the heap with preallocated buffer and size */ min_heap_init(&my_heap, buffer, 5); /* Build the heap using min_heapify_all */ my_heap.nr = 5; /* Set the number of elements in the heap */ min_heapify_all(&my_heap, &heap_cb, NULL); ``` -------------------------------- ### Get Decoder Target List, Start, and Size (Second Decoder) Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/driver-api/cxl/linux/cxl-driver.rst Retrieve the target list, start address, and size for a second CXL decoder. ```bash # cat /sys/bus/cxl/devices/decoder0.1/target_list start size ``` -------------------------------- ### Example Udev Install Rules Script Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/admin-guide/aoe/examples.rst This script is used to install udev rules for AoE devices. It ensures that the necessary rules are in place for device management. ```shell #!/bin/sh # Install udev rules for AoE devices # Copy the udev rules file to the appropriate directory cp udev.rules /etc/udev/rules.d/ # Reload udev rules udevadm control --reload-rules # Trigger udev events for existing devices udevadm trigger ``` -------------------------------- ### Typical Firmware Workflow Example Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/driver-api/firmware/request_firmware.rst Illustrates the common pattern of requesting firmware, copying it to the device, and then releasing the firmware resources. Ensure firmware is requested before use and released afterward. ```c if(request_firmware(&fw_entry, $FIRMWARE, device) == 0) copy_fw_to_device(fw_entry->data, fw_entry->size); release_firmware(fw_entry); ``` -------------------------------- ### Get GPIO Descriptors Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/driver-api/gpio/board.rst Retrieves GPIO descriptors for a device based on the added lookup table. This example shows how to get descriptors for LEDs and a power GPIO. ```c struct gpio_desc *red, *green, *blue, *power; red = gpiod_get_index(dev, "led", 0, GPIOD_OUT_HIGH); green = gpiod_get_index(dev, "led", 1, GPIOD_OUT_HIGH); blue = gpiod_get_index(dev, "led", 2, GPIOD_OUT_HIGH); power = gpiod_get(dev, "power", GPIOD_OUT_HIGH); ``` -------------------------------- ### Example Output of --info Command Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/admin-guide/pm/intel-speed-select.rst This is an example output showing CPU model, API and driver versions, supported features like SST-PP and SST-TF, and TDP level status. ```text Intel(R) Speed Select Technology Executing on CPU model: X Platform: API version : 1 Platform: Driver version : 1 Platform: mbox supported : 1 Platform: mmio supported : 1 Intel(R) SST-PP (feature perf-profile) is supported TDP level change control is unlocked, max level: 4 Intel(R) SST-TF (feature turbo-freq) is supported Intel(R) SST-BF (feature base-freq) is not supported Intel(R) SST-CP (feature core-power) is supported ``` -------------------------------- ### Example Output of NAPI Get Command Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/networking/napi.rst Example output from the 'ynl napi-get' command, showing the configuration and status of a NAPI, including the PID of the busy-polling kthread. ```json $ {'defer-hard-irqs': 0, 'gro-flush-timeout': 0, 'id': 66, 'ifindex': 2, 'irq-suspend-timeout': 0, 'pid': 258, 'threaded': 'busy-poll'} ``` -------------------------------- ### Example Media Support Configuration Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/admin-guide/media/building.rst Shows an example of lines that should be present in the .config file to enable modular support for specific boards with modular media core modules. ```text CONFIG_MEDIA_SUPPORT=y CONFIG_MEDIA_CONTROLLER=y CONFIG_VIDEO_DEV=y CONFIG_DVB_CORE=y CONFIG_MEDIA_CEC_SUPPORT=y CONFIG_MEDIA_ANCILLARY_SUPPORT=y CONFIG_MEDIA_RC_SUPPORT=y CONFIG_RC_CORE=y CONFIG_IR_RC5_DECODER=m CONFIG_IR_ITE_CIR=m ``` -------------------------------- ### Example of TX Error Injection: Short Start Pulse Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/userspace-api/media/cec/cec-pin-error-inj.rst Inject an error by sending a start pulse that is shorter than the standard CEC specification. This tests the receiver's ability to detect and handle undersized start conditions. ```bash [,] tx-short-start ``` -------------------------------- ### Basic ISO-TP Node Setup Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/networking/iso15765-2.rst Example of setting up a CAN socket for ISO-TP communication with specific transmit and receive IDs. This basic setup uses default options for other parameters. ```C int s; struct sockaddr_can addr; int ret; s = socket(PF_CAN, SOCK_DGRAM, CAN_ISOTP); if (s < 0) exit(1); addr.can_family = AF_CAN; addr.can_ifindex = if_nametoindex("can0"); addr.can_addr.tp.tx_id = 0x18DA42F1 | CAN_EFF_FLAG; addr.can_addr.tp.rx_id = 0x18DAF142 | CAN_EFF_FLAG; ret = bind(s, (struct sockaddr *)&addr, sizeof(addr)); if (ret < 0) exit(1); /* Data can now be received using read(s, ...) and sent using write(s, ...) */ ``` -------------------------------- ### Kernel Entry Point Setup (C) Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/arch/x86/boot.rst This C code demonstrates how to set up the real-mode kernel stack and segment registers before jumping to the kernel entry point. Ensure interrupts are disabled before execution. ```c /* * Note: in the case of the "old" kernel protocol, base_ptr must * be == 0x90000 at this point; see the previous sample code. */ seg = base_ptr >> 4; cli(); /* Enter with interrupts disabled! */ /* Set up the real-mode kernel stack */ _SS = seg; _SP = heap_end; _DS = _ES = _FS = _GS = seg; jmp_far(seg + 0x20, 0); /* Run the kernel */ ``` -------------------------------- ### grub.conf Example for TXT Boot Source: https://github.com/pub/scm/virt/kvm/kvm/blob/next/Documentation/arch/x86/intel_txt.rst This grub.conf configuration demonstrates how to load tboot and the kernel with necessary parameters for a TXT-enabled system. Ensure all required modules are present. ```bash title Linux 2.6.29-tip w/ tboot root (hd0,0) kernel /tboot.gz logging=serial,vga,memory module /vmlinuz-2.6.29-tip intel_iommu=on ro root=LABEL=/ rhgb console=ttyS0,115200 3 module /initrd-2.6.29-tip.img module /Q35_SINIT_17.BIN ```