Linux - Supported CPU Architectures
How does Linux support multiple CPU Architectures
The Linux kernel handles cross-architecture portability through a clean separation between architecture-independent generic subsystems and architecture-specific hardware drivers.
Out of roughly 30 million lines of code in the Linux kernel source tree, over 90% is generic C code (file systems, networking, scheduling, driver framework). The remaining architecture-specific code is isolated inside designated abstraction boundaries.
Direct Abstraction: The arch/ Directory Structure
The top-level arch/ directory isolates target-dependent assembly and hardware low-level routines. Every supported architecture gets its own subdirectory:
linux/
├── arch/
│ ├── x86/ # x86 and x86_64
│ ├── arm64/ # ARM 64-bit
│ ├── riscv/ # RISC-V
│ ├── powerpc/ # PowerPC (32 & 64-bit)
│ └── s390/ # IBM Z / Mainframe
├── kernel/ # Generic scheduler, signals, timekeeping
├── mm/ # Generic virtual memory management
├── fs/ # VFS, ext4, btrfs
└── drivers/ # Generic driver model & device drivers
Inside arch/<arch>/, each architecture implements a mandatory layout expected by the rest of the kernel:
arch/<arch>/kernel/: Core low-level code (CPU initialization, trap/exception vectors, context switching, assembly entry/exit points).arch/<arch>/mm/: Hardware page-table management, MMU setup, page fault entry points.arch/<arch>/include/asm/: Architecture-Specific Memory/Assembly headers (asm/headers).
Header Abstraction: include/linux/ vs include/asm-generic/
The kernel provides unified generic C headers under include/linux/. When generic code calls a platform function, it includes <linux/header.h>, which automatically routes to the proper architecture-specific version (<asm/header.h>).
The asm-generic System
To prevent code duplication, the Linux kernel provides default fallback implementations in include/asm-generic/:
- Generic Header (
include/linux/io.h): Includes<asm/io.h>. - Architecture Header (
arch/<arch>/include/asm/io.h):
- If the CPU needs custom MMIO instructions (e.g., x86
inb/outbports), it defines them here. - If the CPU uses standard memory-mapped I/O (e.g., ARM64, RISC-V), it simply includes
<asm-generic/io.h>.
Conditional Compilation (Kconfig & Makefile)
The build system controls which files are compiled using Kconfig flags:
# arch/x86/Makefile
obj-y += kernel/ mm/ crypto/
# drivers/char/Makefile
obj-$(CONFIG_X86) += nvram.o
obj-$(CONFIG_ARM64) += psci.o
When building for ARM64 (ARCH=arm64), the build system compiles arch/arm64/ and ignores all other arch/* subdirectories entirely.
Key Architectural Abstractions
To keep code like mm/memory.c or kernel/sched/core.c 100% architecture-agnostic, the kernel defines standardized C macros and interfaces:
| Subsystem | Generic Interface | How Architectures Implement It |
|---|---|---|
| Virtual Memory | 4-level or 5-level Page Tables (pgd_t, pud_t, pmd_t, pte_t) |
Architectures map these generic typedefs directly to their hardware MMU structure in arch/<arch>/include/asm/pgtable.h. |
| Context Switching | switch_to(prev, next, last) |
Implemented as inline assembly in arch/<arch>/include/asm/switch_to.h to save/restore physical CPU registers. |
| Atomic Operations | atomic_add(), cmpxchg() |
x86 uses LOCK prefixed instructions (lock cmpxchg); ARM/RISC-V use Load-Reserved/Store-Conditional (LDREX/STREX or lr/sc). |
| Hardware Discovery | Device Tree (FDT) or ACPI | ARM/RISC-V/PowerPC parse Device Tree blobs (.dtb); x86 parses ACPI tables to discover hardware buses dynamically. |
Assembly to C Hand-off (ASMCALL / Entry Points)
When a physical CPU boots or hits an interrupt/syscall:
- Assembly Entry: Execution starts in pure assembly (
arch/<arch>/kernel/head.Sorentry.S). - Setup Registers: The assembly code sets up stack pointers, page tables, and CPU modes.
- Jump to Generic C: Assembly branches directly into the generic C kernel:
[Hardware Reset / Power On]
│
▼
arch/<arch>/kernel/head.S (Assembly: sets up stack, CPU modes, MMU)
│
▼
start_kernel() (Generic C: init/main.c)
CPU Architectures Market shares
Because the Linux kernel supports dozens of CPU architectures—ranging from hyperscale server chips to embedded microcontrollers—there is no single global "market share" percentage.
Market share varies dramatically across servers/cloud, mobile/embedded, desktops, and supercomputers.
Tier 1: Primary Architectures (Over 95% of Linux Volume)
These architectures receive first-class upstream maintenance, CI testing, and compiler optimizations.
1. x86_64 (x86)
-
Market Share:
- Enterprise Data Centers & On-Premises Servers: ~70–75%
- Public Cloud Workloads (AWS, Azure, GCP): ~60–65%
- Linux Desktop Workstations: ~95%+
-
Primary Vendors: Intel (Xeon, Core), AMD (EPYC, Ryzen).
-
Linux Role: The historical workhorse for Linux servers, virtualization (KVM), and PC desktops. While losing ground to ARM in hyperscale cloud environments, x86_64 remains the dominant architecture for legacy and general enterprise Linux deployments.
2. ARM 64-Bit (arm64 / aarch64)
-
Market Share:
- Mobile & Edge (Android / Automotive / IoT): ~99%
- Public Cloud Infrastructure: ~30–35% (growing rapidly)
- Embedded / Single-Board Computers (Raspberry Pi, etc.): ~85%
-
Primary Vendors: Ampere (Altra), AWS (Graviton), Google (Axion), Microsoft (Cobalt), NVIDIA (Grace), Qualcomm, Apple.
-
Linux Role: Dominates all mobile Linux/Android environments. In cloud infrastructure, ARM64 has grown massively due to better performance-per-watt efficiency in hyperscale data centers.
Tier 2: Enterprise & Emerging Architectures
3. RISC-V (risc-v)
-
Market Share:
- Data Center / Mainstream Cloud: <1% (currently early stage / experimental)
- Microcontrollers, Edge AI, and Custom SoCs: ~5–10% (rapidly growing)
-
Primary Vendors: SiFive, StarFive, Andes Technology, Alibaba T-Head, Tenstorrent.
-
Linux Role: Upstream kernel support is fully mature and heavily backed by major Linux vendors (Red Hat, Canonical, Google). RISC-V is seeing high adoption in China, India, and open-hardware initiatives seeking architectural sovereignty away from x86 and ARM.
4. IBM Z / S/390 (s390x)
-
Market Share:
- Mainframe Enterprise Computing: ~90%+ (shared with z/OS)
- General Server / Cloud Market: <0.5%
-
Primary Vendor: IBM.
-
Linux Role: Runs heavily on IBM LinuxONE and enterprise mainframes used by top banks, financial institutions, and government agencies for high-throughput transactional processing.
5. PowerPC 64-Bit (powerpc / ppc64le)
-
Market Share:
- HPC & High-End Enterprise Servers: ~1–2%
-
Primary Vendors: IBM (POWER10/POWER11).
-
Linux Role: Used in high-performance computing (HPC) clusters, financial trading systems, and mission-critical enterprise databases running RHEL or SUSE.
Tier 3: Legacy, Embedded, & Niche Architectures
These architectures have stable Linux kernel ports, but serve specialized, legacy, or micro-embedded markets:
| Architecture | Kernel Arch Tag | Market / Primary Use Case | Market Share Status |
|---|---|---|---|
| ARM 32-Bit | arm |
Legacy IoT, routers, industrial automation, older smartphones | Declining; replacing by arm64 |
| MIPS | mips |
Home routers, set-top boxes, legacy network equipment | Declining; replacing by RISC-V/ARM |
| LoongArch | loongarch |
Chinese domestic PCs, servers, and government infrastructure | Niche (primarily China) |
| SuperH | sh |
Automotive (SEGA legacy, Renesas controllers) | Legacy / Maintenance |
| OpenRISC | openrisc |
Academic research, open-source FPGA soft-cores | Minimal / Niche |
| s390 (32-bit) | s390 |
Legacy mainframes | Deprecated / Maintenance |
Special Segment: Top500 Supercomputers
In the Linux-dominated Supercomputing category (where Linux runs 100% of the world's top 500 supercomputers):
- x86_64 (AMD EPYC + Intel Xeon): ~82%
- ARM64 (NVIDIA Grace, Fujitsu A64FX): ~12%
- PowerPC (IBM POWER): ~4%
- Others (RISC-V/Custom): ~2%