From nobody Mon Apr 6 19:44:52 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1773830939; cv=none; d=zohomail.com; s=zohoarc; b=krOMJZCM6Spm1AoRX4R3e9COCrmEL7raAYlfZkprEKf5fsUiv/bjkyg0HQIbS+mBTESlmcfhsbFl7LDf51mHSzaiMQzAzSmu+iDip32afEi6+D37QvNXDeszpeZixh2W8oq5VdlIYOwwjxmv97sdTji1vy5HYIt9jWkoYKKtgW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773830939; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cdLYTX5XCu0aJDUj9OehAyMtHZ53fPtprEnUaqi5uyI=; b=brUBhB/AgINToKcUKw+MM0gUHAzwi9YT9SEekI0N1aVJfCn30oSniUQ/otTAhjkcZSvljkL5OZmS/OHquHv0pzW5Zv8abYlFSeJlGdOXM8gnWx0qx91nJ6PDH4AHjFUoJC6zIWS1IBNjE+Myn++OorYlUsV9qf4/WiejgmLUX1Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177383093996958.53137910225314; Wed, 18 Mar 2026 03:48:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2oQp-0003bY-7C; Wed, 18 Mar 2026 06:47:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2oQj-0003ZD-Tw for qemu-devel@nongnu.org; Wed, 18 Mar 2026 06:47:13 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w2oQi-0003NU-3V for qemu-devel@nongnu.org; Wed, 18 Mar 2026 06:47:13 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4852e9ca034so60586785e9.2 for ; Wed, 18 Mar 2026 03:47:11 -0700 (PDT) Received: from thinkpad-t470s.. (93-143-80-194.adsl.net.t-com.hr. [93.143.80.194]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-486f420de8asm56471095e9.3.2026.03.18.03.47.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 03:47:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773830830; x=1774435630; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cdLYTX5XCu0aJDUj9OehAyMtHZ53fPtprEnUaqi5uyI=; b=MmLlMUgr7h0HzJdiQc5LY0LyXhN7XSPEFk19SYVebhHZ3OGC8MZ36I1A3b85fmOCPZ /iK17AxS9n6/jV2f/Osun2/vBG9u/e3MNyi+1zk/IjghlXJl82P9DSRwETBfGEPz/Gen UwsxU/YSEX64mgdmadKMz1fPlKanJ/mV3OWjEMnZbkTQxLf9jZ5cyQNlU9mYhAbKypTW JAfRIfR396/4OsFlW1JvfNfnaXGiifXPwV1clAuiBZ2Ku2HeZroN8w+xjtmwjsxGRX+z cMUfZ7WnXgfQmXYrrnajwpdHKex8NZ/sasXAwnMgq7iW6iQTwm86OMgVKpBdR2jaZ0yd +rtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773830830; x=1774435630; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=cdLYTX5XCu0aJDUj9OehAyMtHZ53fPtprEnUaqi5uyI=; b=h+OuMSllXzsK+5HdHSfgjiSK4/VWAiHYC6VylyyGuvuFqDYxM1AmvRAFu4VBqe++7/ 75LjMYxL6hdXYB08+RFus7QNjkDjiRJLMjTjOVjmFFmE1m/AlzyGTPrDaRbruL+XhZOU vdfbj2idXhyjH+6I9QTMCcrskupcRMlxXF5UJbVHOLYihAGUFXYLT4Nd8V4Z3w8aX0aW V43I9KMF9N4MJaPU2Jd7aD79gPMGCCgckO1FLD1kLLhSJZGKH6Xl1rRb55HiEn94Zw5X J3NKx7ag1HfzNYLky0hvKPjrS5asPeFVFbwnqnUF6WBO6PA19pTX+tmf6JzAHta4Q3Q8 2yww== X-Gm-Message-State: AOJu0YyGRY8MbmXXois1tU45W7ltnCz1YHNAmol1NaluZAhhUJmUVNrM u15+lzpj3nVtHxkV6w3AyjwxH618Edh9npI65zj0WsjlzwA5EhBDmx8nW0g7WaxT X-Gm-Gg: ATEYQzzJUaObGcvEsp+VPIjDezpIMhfDe3ODNISWfexrj3bbNRtQyz2HA2tePQG15xn jNNt4bqXkmsDpU2mtmEmcqkVUjgZ11HK3iJkGF/OoLGTUmFA+cGqUnNWASK9ngYAmzgxI9K3x9x wnWQ+1kctL85Epunsw8CIgwU3MtHZpFqvAll6IQ1EIH1D7kTcSyAA1of+sSMIv8qq8ML5lSkd1y 8XvHZ9dEPz50dhceTm+zIVqhXgA63E7LEMSI0wd+5EoqumUcxXKkF0UPEvq+4AJnOZRE9+TF8Hy L03DNYlO7YSjb4YghtFrJJjDhhW5jY24MDwCTZsDqcnANhg4a4VwyPD/Yvcb5yNjjkMCgf5xHs7 Mrbjbt7jHgDSHrJE4mZNLRNy9dLalqTgFfuMw0OAB1I4oGNMKLJj2x+97CD+X+tg+uU+FGvWYob 4FAKoud4QX1bx4uB9yQikbipmh9b6YfFD9Tu+Lgu7RAf48gbj3o0IwTjxByst/ZQ5QIA== X-Received: by 2002:a05:600c:1d0b:b0:485:45fb:3472 with SMTP id 5b1f17b1804b1-486f441bacdmr48347585e9.7.1773830830190; Wed, 18 Mar 2026 03:47:10 -0700 (PDT) From: Ruslan Ruslichenko To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, artem_mygaiev@epam.com, volodymyr_babchuk@epam.com, alex.bennee@linaro.org, peter.maydell@linaro.org, pierrick.bouvier@linaro.org, philmd@linaro.org, Ruslan_Ruslichenko@epam.com Subject: [RFC PATCH 9/9] docs: Add description of fault-injection plugin and subsystem Date: Wed, 18 Mar 2026 11:46:40 +0100 Message-ID: <20260318104640.239752-10-ruslichenko.r@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260318104640.239752-1-ruslichenko.r@gmail.com> References: <20260318104640.239752-1-ruslichenko.r@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=ruslichenko.r@gmail.com; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1773830941922154100 Content-Type: text/plain; charset="utf-8" From: Ruslan Ruslichenko The patch introduce documentation for newly added Fault Injection plugin and subsystem. Signed-off-by: Ruslan Ruslichenko --- docs/fault-injection.txt | 111 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 docs/fault-injection.txt diff --git a/docs/fault-injection.txt b/docs/fault-injection.txt new file mode 100644 index 0000000000..05cbd48136 --- /dev/null +++ b/docs/fault-injection.txt @@ -0,0 +1,111 @@ +QEMU FAULT INJECTION PLUGIN DOCUMENTATION +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +OVERVIEW +-------- +The Fault Injection (FI) plugin is a testing tool for guest operating syst= ems running in QEMU. It allows you to test how a guest OS or driver handles= hardware-level errors. Currently, only AArch64 (ARM64) guest systems are s= upported. + +Errors (faults) can be injected in two ways: +1. Statically using a configuration file when QEMU starts. +2. Dynamically using a UNIX socket while the system is running. + + +USAGE +----- +To use the plugin, add the "-plugin" option to the QEMU command. + +Command Line Examples: + +1. Using a static XML config file: +qemu-system-aarch64 -machine virt -cpu cortex-a57 -plugin ./contrib/plugin= s/libfault_injection.so,config=3Dfaults.xml + +2. Using a dynamic UNIX socket: +qemu-system-aarch64 -machine virt -cpu cortex-a57 -plugin ./contrib/plugin= s/libfault_injection.so,socket=3D/tmp/fi_socket.sock + +3. Using both at the same time: +qemu-system-aarch64 -machine virt -cpu cortex-a57 -plugin ./contrib/plugin= s/libfault_injection.so,config=3Dfaults.xml,socket=3D/tmp/fi_socket.sock + +To send a dynamic fault over the socket while QEMU is running, an XML stri= ng can be sent directly to the socket file. + + +CORE CONCEPTS +------------- +A fault configuration has two main parts: +- Trigger: When should the fault happen? (Example: when the CPU reaches a = specific address). +- Target: What should be corrupted or injected? (Example: change a CPU reg= ister). + +SUPPORTED TRIGGERS: +- PC : Triggers when the CPU executes an instruction at a specific Vi= rtual Address. +- SYS_REG : Triggers when the guest reads a specific System Register (like= cntvct_el0). +- RAM : Triggers when the guest accesses a specific Virtual Address in= memory. +- MMIO : Triggers when the guest reads from a hardware device at a Phys= ical Address. +- TIMER : Triggers at a specific guest virtual time (in nanoseconds). + +SUPPORTED TARGETS: +- CPU_REG : Changes a CPU register (x0 to x30). +- RAM : Overwrites physical memory with a fake value. +- MMIO : Modifies a hardware device read with a fake value. +- IRQ : Injects a hardware interrupt into the primary INTC. +- EXCP : Injects a CPU exception (like an SError). +- CUSTOM : Triggers a custom device error (custom handler registered by d= evice model). + + +XML CONFIGURATION FORMAT +------------------------ +The plugin uses a simple XML format. Each fault is defined by a = tag. Multiple fault tags can be added inside one file by wrapping them in a= block. + +The following attributes can be used in the tag: +- trigger : The event that starts the fault (PC, TIMER, etc.). +- trigger_condition : The value needed to activate the trigger (Address, T= ime, or System Register Name). +- target : The system part to corrupt (CPU_REG, IRQ, etc.). Thi= s is optional for RAM and MMIO triggers. +- target_data : The specific ID or address of the target. +- fault_data : The corrupted value to inject. +- size : (Optional) Size in bytes for memory operations. Defa= ult is 8. +- cpu : (Optional) CPU index for IRQs. Default is 0. +- irq_type : (Optional) For IRQs. Can be SPI, PPI, or SGI. Defaul= t is SPI. +- fault_name : (Optional) Required only for CUSTOM targets (string = with the name of the custom fault). + + +EXAMPLES +-------- + +Example 1: Corrupt a CPU Register on a Specific Instruction +This changes register x1 to 0 when the CPU executes the instruction at vir= tual address 0xa00002e7714. + + + + + + +Example 2: Modify an MMIO Read +When the guest OS tries to read a hardware device at physical address 0x08= 00FFE8, the plugin ignores the real hardware and returns the fake value 0x0. + + + + + + +Example 3: Inject a Hardware Interrupt using a Timer +This injects SPI interrupt number 77 into CPU 0 after 10s of virtual guest= time and modifies the results of MMIO reads starting at this time. + + + + + + + + +Example 4: Trigger a Custom SMMUv3 Command Queue Error +After 10s of guest virtual time, this injects a custom SMMUv3 Command Queu= e error into the SMMU device located at 0x09050000. + + + + + + +Example 5: Inject a CPU Exception (SError) +This injects a Virtual SError (Exception Index 24) when the CPU executes t= he instruction at 0xffff8000802dfed0. The syndrome register is set to the v= alue 0xbf000002. + + + + --=20 2.43.0