From patchwork Fri Sep 6 14:33:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 825989 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp836663wrb; Fri, 6 Sep 2024 07:34:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXjOZt56oe7K+UOhoGCJcT70a2Bvw7cItcFqzb3/Y6cHpVIsFlc+FCUUlWuY6L5IguVisQTWQ==@linaro.org X-Google-Smtp-Source: AGHT+IHtaa8wvuTG9xff6qVhoz1IpebqbhUjorIdHPEH6nvS4+feVCpfuY7BMY9FTAB2AkH/VakQ X-Received: by 2002:a05:620a:40c9:b0:79f:15ca:b786 with SMTP id af79cd13be357-7a8041a944amr2609777885a.16.1725633275653; Fri, 06 Sep 2024 07:34:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725633275; cv=none; d=google.com; s=arc-20240605; b=cok+Z0IzcWKFenQqHou4SNjIueElIo7kl1u0fuSd9xGHMHfPIjZmNPlu+Fajo6NoNA OA3CzBfCm/29IJNZmFBZ2XXoNJJN4DUTQTz7u6zJzi3oM7d6bZqa3oaC31EymsCYWMc9 G2aT6KrxqCX6Uwq8Li/fXYzbGoe8/6fs9lW3rv6BaNmzNzS2WfIe4oHO/IX7wre1OXQT MRkrjMNa2iG+Gn3W7p2bSjqqW9eAMn08ItUxPHNXOC9HRduuQDjaz6soCe0aRsq9Cvz1 cL+c+hNuJkW6pb2txSsZDd+YmOkGEE56uv7tXYQ0gPWmju9CDi+2ctTDr/s4Abcr587R wp2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=KALXkPBTxGDivGnQNyPwRC48F/CKpmU8ry/zplz06X0=; fh=fQSRkfw+DkTHa5KQssXieneufL+rl3wPoA2jkVIsZpk=; b=iUKfQpdymGoQR5JW6T/CiKkQVyiTVJEll4Ti3DVPUvJwOBdvn22KVMkwLjdr+WM3+r XzdWrc/gXupTkjxsj0Dw7Q9FjtdZguAnlWb3TuzLmyaAzGxGDt3PgC1zB6dDQHW8gt/t HzwYjMY+P5m/T6F/1mlAbTuE0dPUYssMzU9XjCEr+bHvolxtsowEf/C8KIK0+iJmNgAa pwOFAoJ48WPQp2LtkSQShpI3GMOUuTbKL5cNSK8Mfz5XPrlvuPZ44+ebGR2hgsITchyA fAa7aEh+G7nbpTYo2HgzDrXlSCa/Ff8dXglgG6Z+O5ZP6iaJ+/eHXzOVMU2ACPR46Fu6 7opQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WQX5ip4b; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a9a102792asi38900285a.195.2024.09.06.07.34.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Sep 2024 07:34:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WQX5ip4b; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sma24-0000Ml-E4; Fri, 06 Sep 2024 10:33:52 -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 1sma22-0000Ls-8n for qemu-devel@nongnu.org; Fri, 06 Sep 2024 10:33:50 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sma20-00072w-EN for qemu-devel@nongnu.org; Fri, 06 Sep 2024 10:33:50 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-2068acc8b98so19088995ad.3 for ; Fri, 06 Sep 2024 07:33:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725633226; x=1726238026; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=KALXkPBTxGDivGnQNyPwRC48F/CKpmU8ry/zplz06X0=; b=WQX5ip4be6JTokNNtXAr65elSuNv5UgIJKjT04F3rr6+vf19BoT+8R1ARjWjbVvC8P RYswxPQEUbTPXv/X1Hb5A0BWN5wUwU1Bn56/9T31Xzv0u60gPww0h3IMno0TRNarxYTG agrr7DIT6EVqp1CmF561j25FQWQ8zbffmMsem4zWpzcPIjx+HHSjfHRpeAzreP+8Ozxa 2qWTwMipbiQPJQqFuU+YYX63Ps/DZvAKNlIV+C4InT/UxQ6spaHhow5TumE6pK4NlkYD IjEh+xUA8aDwZcHtMiBzrODd4qpE6RZ/zbgjIz0++TB4JzLC+I1nEVlUNXnlUWILDGkN zePg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725633226; x=1726238026; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KALXkPBTxGDivGnQNyPwRC48F/CKpmU8ry/zplz06X0=; b=TqLU5a1iZPM6GH5DhCoww52yxMcCc/mi+8/8LiNUq+kB/h8PnwYgR1hisnMZ69H/Jm OIos7yvZInJmWMQs82M3cZh3CrZi/IBu660VDnpQFCZbHvOl4Yv0heZXn81LAKvxH4J9 cCiydNx1DFzwLTYG/Y6lt6cTxNQ56nZ9UGtzP7YDvughQRNUusvuq6xcgCmIQNFmGOY1 7c5J/Y9ZROqrlZaZd5RoWa+5aLZ7XzCv8LM3sZ9RumvC/srB2WMgxgr0jZYRU/kXFvBC jk1Gb+GT6zHsJwHIy0w/A/r7UUZbZTMh1K7AW7bWHLUBoJjEwRcW1DXrFOOVxWaTM+D9 7uIw== X-Gm-Message-State: AOJu0Yy6/ntTIrw6CsvPlopcUyW9XHl1XDF9bFjBNi3J8+at7jrdfoEY eeCI0+/vNUdTHSVvP01xdPbQNeQKsI7fCGzO37aW5OCIGjRz2KtTf50eoa/pqVoaCi4DpqP4Tbb a X-Received: by 2002:a17:902:da88:b0:205:8407:631d with SMTP id d9443c01a7336-20584076603mr164499205ad.13.1725633226172; Fri, 06 Sep 2024 07:33:46 -0700 (PDT) Received: from amd.. ([2804:7f0:b401:42a1:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-206ae913cf1sm43844425ad.28.2024.09.06.07.33.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 07:33:45 -0700 (PDT) From: Gustavo Romero To: qemu-devel@nongnu.org, philmd@linaro.org, alex.bennee@linaro.org, richard.henderson@linaro.org Cc: peter.maydell@linaro.org, gustavo.romero@linaro.org Subject: [PATCH v4 0/5] gdbstub: Add support for MTE in system mode Date: Fri, 6 Sep 2024 14:33:11 +0000 Message-Id: <20240906143316.657436-1-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=gustavo.romero@linaro.org; helo=mail-pl1-x62f.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This patchset makes handle_q_memtag, handle_q_isaddresstagged, and handle_Q_memtag stubs build for system mode, allowing all GDB 'memory-tag' subcommands to work with QEMU gdbstub on aarch64 system mode, resolving: https://gitlab.com/qemu-project/qemu/-/issues/620 For running the tests, a GDB that supports MTE for baremetal targets is necessary. This support has just landed GDB's master branch. GDB can be built and installed into a /tmp directory in a simple way: after cloning GDB's master branch, inside a build directory, configure GDB and build it: $ git clone --depth 1 https://sourceware.org/git/binutils-gdb.git --branch master gdb_master && cd gdb_master $ mkdir build && cd build $ ../configure --disable-binutils --disable-ld --disable-gold --disable-gas --disable-sim --disable-gprof --disable-gprofng --with-python=python3 --enable-libctf --enable-unit-tests --prefix=/tmp/gdb --with-additional-debug-dirs=/usr/lib/debug --enable-targets=all $ make -j 32 $ make install Configure QEMU, specifying where GDB is installed. For example: $ cd build $ ../configure --target-list=aarch64-linux-user,aarch64-softmmu --disable-docs --gdb=/tmp/gdb/bin/gdb $ make -j 32 $ cd.. And finally run the MTE gdbstub tests for QEMU system mode: $ make -C build -j 32 run-tcg-tests-aarch64-softmmu v2: - Use of cpu_mmu_index() instead of arm_mmu_idx() (Richard's review) - Converted mte.c test to mte.S - Set tcr_el1, mair_el1, and sctlr_el1 in mte.S instead of in boot.S (Richard's review) - Allowed use of argparse in test scripts to get passed arguments from run-test.py (Alex's review) - Fixed test output to be stored in run-gdbstub-mte.out instead of printed to stdout - Added detection of GDB supporting MTE in baremetal v3: - No need of ARM_MMU_IDX_COREIDX_MASK with cpu_mmu_index() (Richard's review) - Define a symbol for mte_page instead of a whole section (Richard's review) v4: - Better representation for MiB using M suffix in linker script (Phil's review) - Improve linker script organization (Richard's review) Cheers, Gustavo Gustavo Romero (5): gdbstub: Use specific MMU index when probing MTE addresses gdbstub: Add support for MTE in system mode tests/guest-debug: Support passing arguments to the GDB test script tests/tcg/aarch64: Improve linker script organization tests/tcg/aarch64: Extend MTE gdbstub tests to system mode configure | 5 + target/arm/gdbstub64.c | 21 +++-- tests/guest-debug/run-test.py | 6 ++ tests/guest-debug/test_gdbstub.py | 5 + tests/tcg/aarch64/Makefile.softmmu-target | 49 +++++++++- tests/tcg/aarch64/Makefile.target | 3 +- tests/tcg/aarch64/gdbstub/test-mte.py | 71 +++++++++----- tests/tcg/aarch64/system/boot.S | 11 +++ tests/tcg/aarch64/system/kernel.ld | 33 ++++--- tests/tcg/aarch64/system/mte.S | 109 ++++++++++++++++++++++ 10 files changed, 266 insertions(+), 47 deletions(-) create mode 100644 tests/tcg/aarch64/system/mte.S