# wireguard/wireguard-linux architecture

> Architecture diagram of the GitHub repository wireguard/wireguard-linux, 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/wireguard/wireguard-linux
- Repository: https://github.com/wireguard/wireguard-linux

## Overview

Linux is an operating-system kernel: its principal workflow is to start the kernel, expose services to userspace, and mediate access to hardware through architecture support and device drivers. This slice also shows distinct DMA, cryptographic acceleration, graphics, camera, USB-storage, and audio-bus subsystems. The README describes the kernel’s broad role; source excerpts and the index support only selected internal relationships, so other links are omitted rather than inferred.

Main entry points: [`drivers/dma/dmaengine.c`](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/dma/dmaengine.c) (DMA engine API), [`drivers/usb/gadget/function/f_mass_storage.c`](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/usb/gadget/function/f_mass_storage.c) (USB mass storage), [`drivers/crypto/ccp/ccp-dmaengine.c`](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/crypto/ccp/ccp-dmaengine.c) (CCP DMA driver), [`drivers/dma/amd/ptdma/ptdma-dmaengine.c`](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/dma/amd/ptdma/ptdma-dmaengine.c) (PTDMA driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Kernel startup"]
  node_entry["Kernel entry<br/>[main.c]"]
end

subgraph group_arch["Architecture support"]
  node_s390gs["Guarded storage<br/>[guarded_storage.c]"]
end

subgraph group_io["Device and I/O"]
  node_dmaapi["DMA engine API<br/>[dmaengine.c]"]
  node_usbmass["USB mass storage<br/>[f_mass_storage.c]"]
  node_usbcore["USB gadget core"]
  node_soundwire["AMD SoundWire manager<br/>[amd_manager.c]"]
  node_platform["Platform hardware drivers<br/>[pcengines-apuv2.c]"]
end

subgraph group_accel["Accelerators and media"]
  node_ccpdma["CCP DMA driver<br/>[ccp-dmaengine.c]"]
  node_ptdma["PTDMA driver<br/>[ptdma-dmaengine.c]"]
  node_cryptoengine["Crypto request engine<br/>[crypto_engine.c]"]
  node_qat["QAT firmware engine<br/>[adf_accel_engine.c]"]
  node_i915engine["i915 GPU engine<br/>[intel_engine_cs.c]"]
  node_xeengine["Xe GPU engine<br/>[xe_hw_engine.c]"]
  node_komeda["Komeda pipeline"]
  node_atomisp["AtomISP pipeline<br/>[pipeline.c]"]
end

node_system(("System and userspace"))

node_system -.->|"starts"| node_entry
node_ccpdma -->|"implements"| node_dmaapi
node_ptdma -->|"uses API"| node_dmaapi
node_usbmass -->|"configures endpoints"| node_usbcore

click node_entry "https://github.com/wireguard/wireguard-linux/blob/stable/init/main.c"
click node_s390gs "https://github.com/wireguard/wireguard-linux/blob/stable/arch/s390/kernel/guarded_storage.c"
click node_dmaapi "https://github.com/wireguard/wireguard-linux/blob/stable/drivers/dma/dmaengine.c"
click node_ccpdma "https://github.com/wireguard/wireguard-linux/blob/stable/drivers/crypto/ccp/ccp-dmaengine.c"
click node_ptdma "https://github.com/wireguard/wireguard-linux/blob/stable/drivers/dma/amd/ptdma/ptdma-dmaengine.c"
click node_cryptoengine "https://github.com/wireguard/wireguard-linux/blob/stable/crypto/crypto_engine.c"
click node_qat "https://github.com/wireguard/wireguard-linux/blob/stable/drivers/crypto/intel/qat/qat_common/adf_accel_engine.c"
click node_usbmass "https://github.com/wireguard/wireguard-linux/blob/stable/drivers/usb/gadget/function/f_mass_storage.c"
click node_i915engine "https://github.com/wireguard/wireguard-linux/blob/stable/drivers/gpu/drm/i915/gt/intel_engine_cs.c"
click node_xeengine "https://github.com/wireguard/wireguard-linux/blob/stable/drivers/gpu/drm/xe/xe_hw_engine.c"
click node_komeda "https://github.com/wireguard/wireguard-linux/blob/stable/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c"
click node_atomisp "https://github.com/wireguard/wireguard-linux/blob/stable/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c"
click node_soundwire "https://github.com/wireguard/wireguard-linux/blob/stable/drivers/soundwire/amd_manager.c"
click node_platform "https://github.com/wireguard/wireguard-linux/blob/stable/drivers/platform/x86/pcengines-apuv2.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_entry,node_system toneBlue
class node_s390gs toneAmber
class node_dmaapi,node_usbmass,node_usbcore,node_soundwire,node_platform toneMint
class node_ccpdma,node_ptdma,node_cryptoengine,node_qat,node_i915engine,node_xeengine,node_komeda,node_atomisp toneRose
```

## Components

### Kernel startup

- [Kernel entry](https://github.com/wireguard/wireguard-linux/blob/stable/init/main.c): `init/main.c`

### Architecture support

- [Guarded storage](https://github.com/wireguard/wireguard-linux/blob/stable/arch/s390/kernel/guarded_storage.c): `arch/s390/kernel/guarded_storage.c`

### Device and I/O

- [DMA engine API](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/dma/dmaengine.c): `drivers/dma/dmaengine.c`
- [USB mass storage](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/usb/gadget/function/f_mass_storage.c): `drivers/usb/gadget/function/f_mass_storage.c`
- **USB gadget core**
- [AMD SoundWire manager](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/soundwire/amd_manager.c): `drivers/soundwire/amd_manager.c`
- [Platform hardware drivers](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/platform/x86/pcengines-apuv2.c): `drivers/platform/x86/pcengines-apuv2.c`

### Accelerators and media

- [CCP DMA driver](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/crypto/ccp/ccp-dmaengine.c): `drivers/crypto/ccp/ccp-dmaengine.c`
- [PTDMA driver](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/dma/amd/ptdma/ptdma-dmaengine.c): `drivers/dma/amd/ptdma/ptdma-dmaengine.c`
- [Crypto request engine](https://github.com/wireguard/wireguard-linux/blob/stable/crypto/crypto_engine.c): `crypto/crypto_engine.c`
- [QAT firmware engine](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/crypto/intel/qat/qat_common/adf_accel_engine.c): `drivers/crypto/intel/qat/qat_common/adf_accel_engine.c`
- [i915 GPU engine](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/gpu/drm/i915/gt/intel_engine_cs.c): `drivers/gpu/drm/i915/gt/intel_engine_cs.c`
- [Xe GPU engine](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/gpu/drm/xe/xe_hw_engine.c): `drivers/gpu/drm/xe/xe_hw_engine.c`
- [Komeda pipeline](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c): `drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c`
- [AtomISP pipeline](https://github.com/wireguard/wireguard-linux/blob/stable/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c): `drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c`

### Other components

- **System and userspace**

## Connections

- System and userspace → Kernel entry: starts
- CCP DMA driver → DMA engine API: implements (evidence: `drivers/crypto/ccp/ccp-dmaengine.c`)
- PTDMA driver → DMA engine API: uses API (evidence: `drivers/dma/amd/ptdma/ptdma-dmaengine.c`)
- USB mass storage → USB gadget core: configures endpoints (evidence: `drivers/usb/gadget/function/f_mass_storage.c`)
