# microsoft/wsl2-linux-kernel architecture

> Architecture diagram of the GitHub repository microsoft/wsl2-linux-kernel, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/microsoft/wsl2-linux-kernel
- Repository: https://github.com/microsoft/wsl2-linux-kernel

## Overview

This repository is the source for the WSL2 Linux kernel: a general-purpose operating-system kernel, not a standalone WSL application. Its runtime spans kernel startup, architecture support, device drivers, media and crypto processing, and filesystems. The README describes the WSL2 purpose but not host-to-kernel runtime wiring. The graph therefore shows that relationship as unverified; other links are limited to calls or reads visible in sampled excerpts.

Main entry points: [`drivers/usb/gadget/function/f_mass_storage.h`](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/usb/gadget/function/f_mass_storage.h) (Mass storage interface), [`drivers/crypto/ccp/ccp-dmaengine.c`](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/crypto/ccp/ccp-dmaengine.c) (CCP DMA driver), [`drivers/crypto/intel/qat/qat_common/adf_accel_engine.c`](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/crypto/intel/qat/qat_common/adf_accel_engine.c) (QAT engine), [`drivers/dma/amd/ptdma/ptdma-dmaengine.c`](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/dma/amd/ptdma/ptdma-dmaengine.c) (AMD PTDMA)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Kernel and architecture"]
  node_kernel["Kernel startup<br/>[main.c]"]
  node_archalpha["Alpha support<br/>[setup.c]"]
  node_archarm["ARM support<br/>[devtree.c]"]
  node_archarc["ARC support<br/>[setup.c]"]
end

subgraph group_acceleration["Crypto and DMA"]
  node_cryptoengine["Crypto engine<br/>[crypto_engine.c]"]
  node_ccpdma["CCP DMA driver<br/>[ccp-dmaengine.c]"]
  node_ccpstate["CCP device state<br/>[ccp-dev.h]"]
  node_qatengine["QAT engine<br/>[adf_accel_engine.c]"]
  node_qatstate["QAT device state"]
  node_dmaframework["DMA framework<br/>[dmaengine.c]"]
  node_dmaapi["DMA API<br/>[dmaengine.h]"]
  node_ptdma["AMD PTDMA<br/>[ptdma-dmaengine.c]"]
  node_ptstate["PTDMA state<br/>[ptdma.h]"]
end

subgraph group_devices["Device and media"]
  node_i915["i915 engines<br/>[intel_engine_cs.c]"]
  node_i915context["i915 context<br/>[intel_context.h]"]
  node_xe["Xe engines<br/>[xe_hw_engine.c]"]
  node_atomisp["AtomISP pipeline<br/>[pipeline.c]"]
  node_atomispapi["AtomISP pipeline API<br/>[ia_css_pipeline.h]"]
end

subgraph group_storage["USB and filesystems"]
  node_massstorage["USB mass storage<br/>[f_mass_storage.c]"]
  node_massheader["Mass storage interface<br/>[f_mass_storage.h]"]
  node_storagecommon["Storage common<br/>[storage_common.h]"]
  node_romfs["RomFS storage<br/>[storage.c]"]
end

node_wsl(("WSL2 host"))
node_blockdevice[("Block device")]

node_wsl -.->|"hosts &#40;unverified&#41;"| node_kernel
node_qatengine -->|"uses device state"| node_qatstate
node_ccpdma -->|"uses device state"| node_ccpstate
node_ptdma -->|"uses device state"| node_ptstate
node_i915 -->|"uses context"| node_i915context
node_atomisp -->|"calls pipeline API"| node_atomispapi
node_massstorage -->|"uses interface"| node_massheader
node_massheader -->|"uses definitions"| node_storagecommon
node_romfs -->|"reads image"| node_blockdevice

click node_kernel "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/init/main.c"
click node_archalpha "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/arch/alpha/kernel/setup.c"
click node_archarm "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/arch/arm/kernel/devtree.c"
click node_archarc "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/arch/arc/kernel/setup.c"
click node_cryptoengine "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/crypto/crypto_engine.c"
click node_ccpdma "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/crypto/ccp/ccp-dmaengine.c"
click node_ccpstate "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/crypto/ccp/ccp-dev.h"
click node_qatengine "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/crypto/intel/qat/qat_common/adf_accel_engine.c"
click node_qatstate "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/crypto/intel/qat/qat_common/adf_accel_devices.h"
click node_dmaframework "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/dma/dmaengine.c"
click node_dmaapi "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/dma/dmaengine.h"
click node_ptdma "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/dma/amd/ptdma/ptdma-dmaengine.c"
click node_ptstate "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/dma/amd/ptdma/ptdma.h"
click node_i915 "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/gpu/drm/i915/gt/intel_engine_cs.c"
click node_i915context "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/gpu/drm/i915/gt/intel_context.h"
click node_xe "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/gpu/drm/xe/xe_hw_engine.c"
click node_atomisp "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c"
click node_atomispapi "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/staging/media/atomisp/pci/runtime/pipeline/interface/ia_css_pipeline.h"
click node_massstorage "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/usb/gadget/function/f_mass_storage.c"
click node_massheader "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/usb/gadget/function/f_mass_storage.h"
click node_storagecommon "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/usb/gadget/function/storage_common.h"
click node_romfs "https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/fs/romfs/storage.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_kernel,node_archalpha,node_archarm,node_archarc toneBlue
class node_cryptoengine,node_ccpdma,node_ccpstate,node_qatengine,node_qatstate,node_dmaframework,node_dmaapi,node_ptdma,node_ptstate,node_blockdevice toneAmber
class node_i915,node_i915context,node_xe,node_atomisp,node_atomispapi toneMint
class node_massstorage,node_massheader,node_storagecommon,node_romfs toneRose
class node_wsl toneIndigo
```

## Components

### Kernel and architecture

- [Kernel startup](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/init/main.c): `init/main.c`
- [Alpha support](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/arch/alpha/kernel/setup.c): `arch/alpha/kernel/setup.c`
- [ARM support](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/arch/arm/kernel/devtree.c): `arch/arm/kernel/devtree.c`
- [ARC support](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/arch/arc/kernel/setup.c): `arch/arc/kernel/setup.c`

### Crypto and DMA

- [Crypto engine](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/crypto/crypto_engine.c): `crypto/crypto_engine.c`
- [CCP DMA driver](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/crypto/ccp/ccp-dmaengine.c): `drivers/crypto/ccp/ccp-dmaengine.c`
- [CCP device state](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/crypto/ccp/ccp-dev.h): `drivers/crypto/ccp/ccp-dev.h`
- [QAT engine](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/crypto/intel/qat/qat_common/adf_accel_engine.c): `drivers/crypto/intel/qat/qat_common/adf_accel_engine.c`
- [QAT device state](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/crypto/intel/qat/qat_common/adf_accel_devices.h): `drivers/crypto/intel/qat/qat_common/adf_accel_devices.h`
- [DMA framework](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/dma/dmaengine.c): `drivers/dma/dmaengine.c`
- [DMA API](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/dma/dmaengine.h): `drivers/dma/dmaengine.h`
- [AMD PTDMA](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/dma/amd/ptdma/ptdma-dmaengine.c): `drivers/dma/amd/ptdma/ptdma-dmaengine.c`
- [PTDMA state](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/dma/amd/ptdma/ptdma.h): `drivers/dma/amd/ptdma/ptdma.h`

### Device and media

- [i915 engines](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/gpu/drm/i915/gt/intel_engine_cs.c): `drivers/gpu/drm/i915/gt/intel_engine_cs.c`
- [i915 context](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/gpu/drm/i915/gt/intel_context.h): `drivers/gpu/drm/i915/gt/intel_context.h`
- [Xe engines](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/gpu/drm/xe/xe_hw_engine.c): `drivers/gpu/drm/xe/xe_hw_engine.c`
- [AtomISP pipeline](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c): `drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c`
- [AtomISP pipeline API](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/staging/media/atomisp/pci/runtime/pipeline/interface/ia_css_pipeline.h): `drivers/staging/media/atomisp/pci/runtime/pipeline/interface/ia_css_pipeline.h`

### USB and filesystems

- [USB mass storage](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/usb/gadget/function/f_mass_storage.c): `drivers/usb/gadget/function/f_mass_storage.c`
- [Mass storage interface](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/usb/gadget/function/f_mass_storage.h): `drivers/usb/gadget/function/f_mass_storage.h`
- [Storage common](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/drivers/usb/gadget/function/storage_common.h): `drivers/usb/gadget/function/storage_common.h`
- [RomFS storage](https://github.com/microsoft/wsl2-linux-kernel/blob/linux-msft-wsl-6.18.y/fs/romfs/storage.c): `fs/romfs/storage.c`

### Other components

- **WSL2 host**
- **Block device**

## Connections

- WSL2 host → Kernel startup: hosts (unverified)
- QAT engine → QAT device state: uses device state (evidence: `drivers/crypto/intel/qat/qat_common/adf_accel_engine.c`)
- CCP DMA driver → CCP device state: uses device state (evidence: `drivers/crypto/ccp/ccp-dmaengine.c`)
- AMD PTDMA → PTDMA state: uses device state (evidence: `drivers/dma/amd/ptdma/ptdma-dmaengine.c`)
- i915 engines → i915 context: uses context (evidence: `drivers/gpu/drm/i915/gt/intel_engine_cs.c`)
- AtomISP pipeline → AtomISP pipeline API: calls pipeline API (evidence: `drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c`)
- USB mass storage → Mass storage interface: uses interface (evidence: `drivers/usb/gadget/function/f_mass_storage.c`)
- Mass storage interface → Storage common: uses definitions (evidence: `drivers/usb/gadget/function/f_mass_storage.h`)
- RomFS storage → Block device: reads image (evidence: `fs/romfs/storage.c`)
