AI Engine Kernel Driver Structure - 2024.1 English

AI Engine System Software Driver Reference Manual (UG1642)

Document ID
UG1642
Release Date
2024-05-30
Version
2024.1 English

Linux Kernel AI Engine Driver

Figure 1. AI Engine Kernel Driver Structure

The AI Engine Linux kernel driver imposes restrictions on the application, ensuring it can only access the AI Engine partition associated with the AI Engine application. It exercises control over which registers the application is permitted to access and regulates how these registers can be accessed during runtime.

The Linux kernel AI Engine driver is structured into two distinct modules. The AI Engine device module oversees the AI Engine partitions allocated to the Linux system, while the AI Engine partition module is responsible for managing partitions that are requested by specific applications.

The AI device module is tasked with handling partition requests initiated by an AI Engine application. It ensures that the application is confined to accessing only the specific partition it has requested, monitors interrupts originating from the AI Engine device, and directs them to the appropriate partitions. On the other hand, the AI partition module serves the crucial role of facilitating access to AI Engine hardware for AI Engine applications while imposing limitations on what can be accessed and how resources are accessed.

To request a partition, an application must provide the AI Engine device module with the partition node ID and the image UID that corresponds to the expected configuration loaded onto the AI Engine partition. The AI Engine kernel device driver performs validation to ascertain if the partition is under the jurisdiction of the Linux kernel. It retrieves the image UID currently loaded on the AI Engine partition from the platform loader and manager (PLM). Subsequently, the device driver verifies if the image UID provided by the application matches the one loaded on the AI Engine partition. Access to the partition is granted only if the UIDs match. In cases where no image is loaded on the AI Engine and no other application has made a partition request, the AI Engine device driver allows the application access to the partition.

The AI Engine partition driver enables the application to access AI Engine partition resources. It limits which AI Engine resource application can access it and how to access it. For example, you can forbid the application to directly write values to AI Engine interface tiles DMA registers so that the application does not start a DMA transaction to corrupt the system memory. The AI Engine kernel driver also forbids privileged register access from the userspace. Even though you cannot change the privileged registers unless the access is enabled from the NPI space, and only PLM can access the NPI space, NPI register enabling and register accessing are not atomic. After the access is enabled from NPI registers, the userspace can change the privileged register configuration, for example AI Engine interface tiles reset register.