intel_reg_write
Write values to Intel hardware registers
SYNOPSIS
intel_reg_write [OPTIONS] REGISTER VALUE
(Writes a 32-bit VALUE to the specified REGISTER.)
intel_reg_write [OPTIONS] REGISTER MASK VALUE
(Performs a masked write: (current_value & ~MASK) | (VALUE & MASK).)
intel_reg_write [OPTIONS] REGISTER OFFSET VALUE
(Writes VALUE to an indexed REGISTER at the given OFFSET, e.g., GTT entries.)
PARAMETERS
REGISTER
The name or hexadecimal address of the hardware register to write. Can be a known register name (e.g., 'RING_HEAD') or a raw hexadecimal address (e.g., '0x2000').
VALUE
The 32-bit hexadecimal value to write to the register. For masked writes, this is the value to be applied after masking.
MASK
A 32-bit hexadecimal mask used in conjunction with VALUE for masked writes. Only bits set in MASK will be affected by VALUE.
OFFSET
An optional hexadecimal offset for indexed registers, such as entries in the Graphics Translation Table (GTT). This argument is used when interacting with arrays of registers.
-d, --device DEVICE
Specify the DRM device to interact with (e.g., /dev/dri/card0). Defaults to the first available DRM device.
-r, --raw
Treat the REGISTER argument as a raw hexadecimal address instead of attempting to resolve it as a known register name.
-f, --force
Force the write operation, potentially bypassing some internal checks or warnings. Use with extreme caution.
-p, --pci-device PCI_ID
Specify the PCI device ID (e.g., '0000:00:02.0') if multiple Intel GPUs are present.
-v, --verbose
Enable verbose output, providing more details about the operation being performed.
-s, --i915-sysfs
Attempt to use the i915 sysfs interface for register access instead of direct MMIO, if available. This is often used for newer kernels.
-l, --list
List all known Intel GPU register names and their addresses. This option prevents a write operation and simply prints the register database.
DESCRIPTION
intel_reg_write is a specialized Linux command-line utility designed for advanced users and developers to directly manipulate hardware registers on Intel Graphics Processing Units (GPUs). It is part of the intel-gpu-tools suite, which provides low-level debugging and diagnostic capabilities for Intel graphics hardware and drivers.
This command allows writing specific 32-bit values to MMIO (Memory-Mapped I/O) registers, GTT (Graphics Translation Table) registers, or other hardware registers by their symbolic name or hexadecimal address. It's an indispensable tool for debugging graphics driver issues, reverse-engineering hardware behavior, or conducting performance experiments at a very granular level. Due to its direct interaction with hardware, intel_reg_write requires root privileges and should be used with extreme caution, as incorrect usage can lead to system instability, crashes, or even potential hardware damage.
CAVEATS
Using intel_reg_write involves direct low-level hardware manipulation and carries significant risks:
- It requires root privileges (
sudo
). - Incorrect usage can lead to immediate system instability, kernel panics, or system freezes.
- There is a potential, albeit rare, risk of permanent hardware damage if values are written to critical registers incorrectly or repeatedly.
- This tool is specific to Intel GPUs and will not work on systems with other graphics hardware.
- It is primarily a diagnostic and development tool; casual users should avoid using it.
USAGE WITH REGISTER NAMES VS. RAW ADDRESSES
The intel_reg_write command can interpret the REGISTER argument as either a symbolic name (e.g., 'MI_MODE') or a raw hexadecimal address (e.g., '0x2000'). When using a name, the tool looks up its corresponding address in an internal database. If the name is not found, or if the -r option is used, the argument is treated as a raw hexadecimal address. It's recommended to use symbolic names when possible for clarity, but raw addresses are necessary for undocumented or newly discovered registers.
PERMISSIONS AND SAFETY
Due to its direct interaction with kernel-level components and hardware, intel_reg_write invariably requires elevated privileges (root). Users should exercise extreme caution. It's often recommended to test commands in a controlled environment or with a backup of important data, as erroneous writes can corrupt system state or data.
HISTORY
The intel_reg_write utility is part of the intel-gpu-tools project, a collection of open-source utilities developed primarily by Intel engineers and the Linux graphics community. These tools were created to aid in debugging, testing, and optimizing Intel graphics drivers and hardware. intel_reg_write itself provides a fundamental capability for inspecting and altering the GPU state at a very granular level, reflecting the ongoing development and evolution of Intel's graphics architectures and their Linux drivers.
SEE ALSO
intel_reg_read(1), intel_gpu_top(1), ioctl(2)