From patchwork Sun Aug 25 14:52:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 822365 Delivered-To: patch@linaro.org Received: by 2002:adf:e044:0:b0:367:895a:4699 with SMTP id w4csp1172923wrh; Sun, 25 Aug 2024 07:54:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV7YPeeUBmYoeNZD9Ew/2zXWiKqNMSi/WJyNLr9Nn/7w4IfjFalGCMuEeuvZF976+H8Yxktbg==@linaro.org X-Google-Smtp-Source: AGHT+IEDozg5qNwgH8gv7tJDBTO7D9JAWjO4x1gizKDbLVI+hB0T/wX08sEIROIPWCTY3d5I6/uP X-Received: by 2002:a05:6214:5c09:b0:6bf:960e:3d9a with SMTP id 6a1803df08f44-6c16d4d661amr154102736d6.12.1724597662514; Sun, 25 Aug 2024 07:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724597662; cv=none; d=google.com; s=arc-20160816; b=kQEoe8YqWCJ9MbiaY+oU4hP9h4QrHdOkWA9v3MSClOYyHEYTiE9NhcOPIWla9l2TXB c+ZEbOkWK/Bcr7Pdm+1vigOZIa3aJpkcmdhdQhpkxRX1vQvr5WKCGmy7z18LRegDvQKG VIRckZWIvBBQCYQkpD4KFP/1p9yOzePYW0FPe1TXqFS0YbIoxaTq3DEAu7JJTJdwNpN2 WcuYY8eB6CLUgQkJX59fpj8VKwodvlu+VKj56g4Ays4kjVaXTBBaI7nfr9emqeCId34V t2I9IfJro+yinXe8rRvB/JCm9L7PlENL8OKfYHqbW04jcSD2qZuc2O/N5SIzF1TAidxa ZvhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=wUFMsUC88AV4RiT6qrMrOJRw58r01m7e9EfSewF/uRg=; fh=b5q3cJgcc12gnKfUWQQbBLXKRqia4x4Q8oLG+cCF/wU=; b=exdMr6D0SNmAA+w8b2TEnCnF11O2xgwtt2AdBpZvakNzzRwTYiPiwXeS1l1MxJeBI9 kSVlWIgW+iYeQ0UCvuCJuo7bBKr6BiF/hohvCN8M5BaBrE4978pdHcvuEQ+6cQ2yK1Dc jEWWJ4LMGl8U/bB1ChMd23rqp/MsZGTpyo/UBtll3DPCa0nR3VL8Ss1YAwySUm7JYb5C VcUAbpxjte6dYmpqVecu2qhfDzJ35VpVO7gf2s2rV94oPjE7nI7jEmo4wQLI0GaP9Wef YRK8VU9vNwxfQnRAraV0Mg0xGjmMrLxGK9J5XYLL+hxO4c/Daby+/RZgVy9cFth4kMao T45Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G5AqYQmD; 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 6a1803df08f44-6c162e2d67fsi86931006d6.496.2024.08.25.07.54.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 25 Aug 2024 07:54:22 -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=G5AqYQmD; 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 1siEbu-0002SH-4e; Sun, 25 Aug 2024 10:52:54 -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 1siEbs-0002Re-ES for qemu-devel@nongnu.org; Sun, 25 Aug 2024 10:52:52 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1siEbp-0005v0-NF for qemu-devel@nongnu.org; Sun, 25 Aug 2024 10:52:51 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-202089e57d8so22147785ad.0 for ; Sun, 25 Aug 2024 07:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724597567; x=1725202367; 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=wUFMsUC88AV4RiT6qrMrOJRw58r01m7e9EfSewF/uRg=; b=G5AqYQmDkNWqP37PFOMT5Wl4RMeTT+GQjp55w6JlqMyNFtSf9jom9qZVbpqXlyaefn AogCCX2tqTV9Wkfo2Db50fO2Mtf7XwqaZBPE/3T3eT+buUN8ghQhIYEEsLZPEMGd9weT rW1K/nSuKoIHK86/ufpA8sJHvM9zceExJLKLM3byu+ojSqhbaVPybocLj32vinQLxPOL 3QT8/Kd6roCmCjmUtaJ8ZUPkeVL0R/4rBZe8vZIArIwGVOl7DwJL3EOTHAFFYBBFQiKk cNyHqxDFiP+PhNQUeuHByfw9ERsVwX6E907gS+EfJZMrx3ayWuhtXfSjK7+dU0vPWv16 M/zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724597567; x=1725202367; 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=wUFMsUC88AV4RiT6qrMrOJRw58r01m7e9EfSewF/uRg=; b=BWvdXEzTmlmVwI7NkWzwzxN0ioA/jcrDEJCbBYkHNQkYB32UHYBcciJXChC6WerfWH E7vrPEe2GjSykB/1n82gFSU3MtsmZqlYB0VTo9OqDdVybsXFjz71rg+QQF0l+4P5d30Q tdpNnB/o1KbN5Ixq9N5RZNXxSE6DNdA9AqAwzS4jnZzMVlbBym3jrXGbNVBsNRUnkRmT NYXeq7u+uLPH7fQtNOwYa1XXV5Fltm6fGA5abya3D9U9r9GT1qPlvk0BRi27ph6COcEz /wzcgY5z+VwrqSKttgk21WKPXJRYqTsLIhh+MhtV0k5wQCgv7qXEOJxmVs2nglEjYxH5 wkTA== X-Gm-Message-State: AOJu0YwXosARXCVRfFc1M6D6ccDQrmm88OoCjx0T4ES3j+MFaYpWF2YG Pnbb3INw2oTkaAiLdfs20mNAW7b6CBkP0TzIL23skH6ZsDa9HD1LMcbUgh7i5Vkyy0h4jraHFRq JprE= X-Received: by 2002:a17:902:d488:b0:200:79c1:a69f with SMTP id d9443c01a7336-2037fe15a46mr207305695ad.20.1724597567130; Sun, 25 Aug 2024 07:52:47 -0700 (PDT) Received: from amd.. ([2804:7f0:b400:bb79:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-203b0e164b8sm24698805ad.236.2024.08.25.07.52.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2024 07:52:46 -0700 (PDT) From: Gustavo Romero To: qemu-devel@nongnu.org, alex.bennee@linaro.org, richard.henderson@linaro.org Cc: philmd@linaro.org, peter.maydell@linaro.org, gustavo.romero@linaro.org Subject: [PATCH v3 0/4] gdbstub: Add support for MTE in system mode Date: Sun, 25 Aug 2024 14:52:04 +0000 Message-Id: <20240825145208.46774-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::632; envelope-from=gustavo.romero@linaro.org; helo=mail-pl1-x632.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. It also extends the MTE gdbstub tests to run in system mode, sharing the tests between QEMU user mode and system mode. 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) Cheers, Gustavo Gustavo Romero (4): 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: 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 | 7 ++ tests/tcg/aarch64/system/mte.S | 109 ++++++++++++++++++++++ 10 files changed, 252 insertions(+), 35 deletions(-) create mode 100644 tests/tcg/aarch64/system/mte.S