From nobody Sun Apr 12 06:09:05 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772031636527275.9339880130102; Wed, 25 Feb 2026 07:00:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vvGNA-0001JU-7n; Wed, 25 Feb 2026 10:00:20 -0500 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 1vvGMj-00010A-Ox for qemu-devel@nongnu.org; Wed, 25 Feb 2026 09:59:54 -0500 Received: from mail.salt-inc.org ([104.244.79.104] helo=vm0.salt-inc.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vvGMd-0008MX-3T for qemu-devel@nongnu.org; Wed, 25 Feb 2026 09:59:50 -0500 Received: from localhost (209.60-130-109.adsl-dyn.isp.belgacom.be [109.130.60.209]) by vm0.salt-inc.org (Postfix) with ESMTPSA id EB14CFF028; Wed, 25 Feb 2026 15:58:32 +0100 (CET) From: David Hoppenbrouwers To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alejandro Jimenez , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , "Michael S. Tsirkin" , Sairaj Kodilkar , David Hoppenbrouwers Subject: [PATCH 1/2] hw/i386/amd_iommu.c: trace page walk in fetch_pte() Date: Wed, 25 Feb 2026 15:58:30 +0100 Message-ID: <20260225145831.28275-2-qemu@demindiro.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260225145831.28275-1-qemu@demindiro.com> References: <20260225145831.28275-1-qemu@demindiro.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=104.244.79.104; envelope-from=guix@demindiro.com; helo=vm0.salt-inc.org X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.734, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.78, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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-ZM-MESSAGEID: 1772031640008158500 Content-Type: text/plain; charset="utf-8" This is necessary to demonstrate the issue in the next commit. It is also useful when developing drivers. Signed-off-by: David Hoppenbrouwers --- hw/i386/amd_iommu.c | 8 ++++++++ hw/i386/trace-events | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 789e09d6f2..29999fd776 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -667,6 +667,8 @@ static uint64_t fetch_pte(AMDVIAddressSpace *as, hwaddr= address, uint64_t dte, uint8_t level, mode; uint64_t pte_addr; =20 + trace_amdvi_fetch_pte_translate(address); + *pte =3D dte; *page_size =3D 0; =20 @@ -691,7 +693,11 @@ static uint64_t fetch_pte(AMDVIAddressSpace *as, hwadd= r address, uint64_t dte, return -AMDVI_FR_PT_ROOT_INV; } =20 + trace_amdvi_fetch_pte_root(level, *pte); + do { + trace_amdvi_fetch_pte_walk(level, *pte, PTE_NEXT_LEVEL(*pte), *pag= e_size); + level -=3D 1; =20 /* Update the page_size */ @@ -750,6 +756,8 @@ static uint64_t fetch_pte(AMDVIAddressSpace *as, hwaddr= address, uint64_t dte, *page_size =3D large_pte_page_size(*pte); } =20 + trace_amdvi_fetch_pte_found(level, *pte, PTE_NEXT_LEVEL(*pte), *page_s= ize); + return 0; } =20 diff --git a/hw/i386/trace-events b/hw/i386/trace-events index 5fa5e93b68..5e7d7ba30d 100644 --- a/hw/i386/trace-events +++ b/hw/i386/trace-events @@ -118,6 +118,10 @@ amdvi_ir_intctl(uint8_t val) "int_ctl 0x%"PRIx8 amdvi_ir_target_abort(const char *str) "%s" amdvi_ir_delivery_mode(const char *str) "%s" amdvi_ir_irte_ga_val(uint64_t hi, uint64_t lo) "hi 0x%"PRIx64" lo 0x%"PRIx= 64 +amdvi_fetch_pte_translate(uint64_t address) "0x%016"PRIx64 +amdvi_fetch_pte_root(uint8_t level, uint64_t pte) "level=3D%d pte=3D%016"P= RIx64 +amdvi_fetch_pte_walk(uint8_t level, uint64_t pte, uint8_t nextlevel, uint6= 4_t page_size) "level=3D%d pte=3D%016"PRIx64" NextLevel=3D%d page_size=3D0x= %"PRIx64 +amdvi_fetch_pte_found(uint8_t level, uint64_t pte, uint8_t nextlevel, uint= 64_t page_size) "level=3D%d pte=3D%016"PRIx64" NextLevel=3D%d page_size=3D0= x%"PRIx64 =20 # vmport.c vmport_register(unsigned char command, void *func, void *opaque) "command:= 0x%02x func: %p opaque: %p" --=20 2.52.0