From patchwork Thu Aug 8 05:15:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 817704 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e11:0:b0:367:895a:4699 with SMTP id p17csp702648wrt; Wed, 7 Aug 2024 22:16:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUYOpldbGnx/0VprBA4TmaFOMS7gLyEchADhDQ2XRyANHmRT7ZOFico89WUAFYdMjru4F9TSCZX2pLDxlOtawVb X-Google-Smtp-Source: AGHT+IEWltRA52P9gB9rBALHSewwwm6cHrf0Cup8FpAADKdvKUTYSMuGl1XwLxUcs7YYt2eHpw0g X-Received: by 2002:a05:6122:3b09:b0:4f6:a618:61ce with SMTP id 71dfb90a1353d-4f90264bc1dmr1023273e0c.7.1723094192038; Wed, 07 Aug 2024 22:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723094192; cv=none; d=google.com; s=arc-20160816; b=rnM4LQdjUdyeNHDmsCy0LqKmu+xMgnPqoqGNwSp72bootoGOGHqjnOj/xA68YdiELx mV/lYNODWSxZaeaz87P3popO7mBazL0lLk9iQewTLSvpfY31/WYwsve+Im+eU3Ec+/sE lj6LK3aUra6y6kzFpo/vTifwMAB1+SnjJ8vcYYxHlI35bRvnC3FoEagJwzGTa4QeCA66 OB+J+1IDtARVjtPw2Pw1ZojaoAAlp7zicsKSbORo9cRIy1+sSWV0OPWVd0YhDJNmOdom u6IFZpSvl03lqLwwSQuNbGX5QijJwRl435kzCaH770tKRGIYw3i14dSVIqhuFTXqmaTY PNkg== 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=X36Z7Ay5zBldauGlkDca4uLnx1CG0RaTI4WuaNoO14s=; fh=b5q3cJgcc12gnKfUWQQbBLXKRqia4x4Q8oLG+cCF/wU=; b=0/JMH1S/szqajaw6RmucCYR83BKYgT3wPnFkFwUXZVaD5MGWz5b1YbAWsQ9ZV+Yhmc Pxnw8NuTZT+SUw9eEfY+yIV/ZD5YWNibcunWlDMOl4/3lBoKf8mkbrGIcUSmV6MGK29C egg0u3o3TnwUx71AR1CB8nVQVahetZDdg9/CashoZM0PKps4mvhCjkl6xTvBZHY8GXtW DBAVQ8iadhtybRCJNCzjYo+HQBUi2hNJFGyOxq3HDq2oHOzRZcO/sdHWwLlveFhwwSne 0HGSH/rlb00So8fmgGe6rS4UacpUAWA9D6ZipSZDIGigYfcIXuFiIUWwH/D7QgDwrwvS zaEA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bNMB9m16; 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-6bbbb5fc5bcsi36524206d6.12.2024.08.07.22.16.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Aug 2024 22:16:32 -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=bNMB9m16; 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 1sbvVI-00074c-PP; Thu, 08 Aug 2024 01:16:00 -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 1sbvVD-0006yH-25 for qemu-devel@nongnu.org; Thu, 08 Aug 2024 01:15:55 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbvVB-0002jq-8k for qemu-devel@nongnu.org; Thu, 08 Aug 2024 01:15:54 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-70eb0ae23e4so489422b3a.0 for ; Wed, 07 Aug 2024 22:15:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723094151; x=1723698951; 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=X36Z7Ay5zBldauGlkDca4uLnx1CG0RaTI4WuaNoO14s=; b=bNMB9m16y1wSeb3irP6ddywJ5o+Ute2R19qlTyWRluwaSefngvxDvltIRewPHfSm95 ZejFZWbH/+JQz4NBpP9VflKXdNWAMrO1/qrsAGTRxoiAsdoxQC93vMcDROiybfCLzQTj BUoUs/YUXg3LHkDgquuMxZu/6nSa9DUixgpd3p5VLppE1NdTSYE4HfL13PtAhyF8KHSz aLBi3HnmuIAlYA1cCsFyyS/R3C2sXZKj3ShIcGTbbvBQeg/Vl2nPny4o3YnPe4Pnf8my jG3GDZOogvx5eOKWZSeTq8mE5NoJ/WUrog4RZqb+z2gKSYF3AEf4MmSlZs/xjsOptuGR SfmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723094151; x=1723698951; 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=X36Z7Ay5zBldauGlkDca4uLnx1CG0RaTI4WuaNoO14s=; b=T9ccpxVxF+jtMEOoNU42v/Jf50h9wPS8onn2AH76G9husTqb9clc/ATjr04+2fYYLw 0jBqZ+aoSEXaCuJ4lIS2i+M51Yk3osFYGLZZGrPkZ+7Vi3wFQW4TWnKQAfNFqB3dJ2mD iPKKa3uMuvaSyeSDoA5PM5ZHjqn3/dUwfFTH5sVB4hnRuqRNW2G/FfTSmXbaZwF1u2gl la1/d6M3gXrg9R/XS0bJM0vzqCw9K5TwgY9LDaPOWTHwajCLuNfv/oO2cCzw9MsrzBtl u5yptQDkmN7t4Ptb8aDKAFKIcljfvhW/s2qcz9rZVKG7/Lgk/9iAuUK0TETrUXLFVVBY R1fg== X-Gm-Message-State: AOJu0YwKSp1CHfF2JtZ9sQC8q0qQXE7Z/NLjZF7Gf1k5pOMpcLp/rbSq 9Ttn+iP98H58eJ3sHo8mIKX0Hb5gUZplaiiTna9vH/TV3pv+ttKJ3WS282jLR+LkGanauABS6wq 4 X-Received: by 2002:a05:6a00:3e02:b0:70d:2b23:a720 with SMTP id d2e1a72fcca58-710cad45100mr867540b3a.5.1723094150917; Wed, 07 Aug 2024 22:15:50 -0700 (PDT) Received: from amd.. ([2804:7f0:b403:720f:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-710cb22a455sm373484b3a.71.2024.08.07.22.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 22:15:50 -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 v2 0/4] gdbstub: Add support for MTE in system mode Date: Thu, 8 Aug 2024 05:15:27 +0000 Message-Id: <20240808051531.3183498-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::433; envelope-from=gustavo.romero@linaro.org; helo=mail-pf1-x433.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 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 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 | 14 +++ tests/tcg/aarch64/system/kernel.ld | 5 + tests/tcg/aarch64/system/mte.S | 115 ++++++++++++++++++++++ 10 files changed, 259 insertions(+), 35 deletions(-) create mode 100644 tests/tcg/aarch64/system/mte.S