From nobody Tue Feb 10 20:48:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.41 as permitted sender) client-ip=209.85.221.41; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f41.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1625232993; cv=none; d=zohomail.com; s=zohoarc; b=Q5OeCOR/QGW63tfrY2udIxqngLipaEToaMoamJeWgQI1sfDc2Nk6Z6k+2I/zNyfJwlzKKUY0N730Gxpjd0PyX0cYrL6bn6bcWGscdzqew0lWbQSY7U3iNPsj8CGp4mQRsZ+E3wd82ZgPorWuEYYKGhAIfVjQvLQZdy1kqbwKjRc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1625232993; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7A/j/FYlYSZh3luNW3Um8CEXczwC9yclCtiX6mQrEkk=; b=AuPOZweD0GwnP36RapOjQe6Hnq3X3XMss3gxPgcpLZysmwkmiBBa8gHzX2EGyV73+NRZqRVOI29998+rYYnjlrQIJ5jLs2K9Ag0+FtfjidMbX/xAkbygFLGMS0F8J57Ly+8Hk93xvJSfmbfUU2MlFjw4gBBUUdVhuI1qpR5j0hI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by mx.zohomail.com with SMTPS id 1625232993867540.8778638703869; Fri, 2 Jul 2021 06:36:33 -0700 (PDT) Received: by mail-wr1-f41.google.com with SMTP id f14so12143097wrs.6 for ; Fri, 02 Jul 2021 06:36:33 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.Ascou-CH1 (pop.92-184-108-23.mobile.abo.orange.fr. [92.184.108.23]) by smtp.gmail.com with ESMTPSA id t11sm3398734wrz.7.2021.07.02.06.36.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 06:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7A/j/FYlYSZh3luNW3Um8CEXczwC9yclCtiX6mQrEkk=; b=gJI0detEXXLTl/G77/lBfTmHYiZ/XWAZ42aKTylylRnSLpOQUxkbRB856WuF/GxkIs vmtb+sOg5N2RnfUIsOypf2qG1VFs/fN+xAjwnnclgNUmWCnKDdmMlW+mWPaqTfkAhwSx IVoXqwzC0io8DkwqGyM4J/nFPTMMt24f5yC/qsUizrhLBHTLMArdRQY2d2fe1N0KL7vr qa6BtZpGubKqS/KS4dknOZy6S5RumlfTLuPwOh7s/kHFKmxvbMOqcz0Hn0sBRgtIlKUS ciLCAkucBLXmdZoEb9Pn23Lt6c9t51qN098XqdGJjU/c0/q/8aZLDFE6XhHN+vGhqcr9 O03Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=7A/j/FYlYSZh3luNW3Um8CEXczwC9yclCtiX6mQrEkk=; b=g0mJs/77mS+UArK9CDLXwgbtwgj9UdXVascpvfCDGbTc5IDYST5Id0YHe19VL0E6rB LsJ5iz+QZdT1V8Y0RbcSjHeA4IjVijtw3AcVhaWbExR6mD1oYLL2joE/6LApMgwUM5Qc JoyoBlXsHG3mNma98PpXYKMs65nQpZ/+pIzhTOqgCqjznsVtWz873xJ8R63mAi93QWLP 73wobue/aN76c7YTCIaUpjToCwxiqzTZnJd9HWhv4CQr2EdvPug1v9KaV7fRoTCBBS2x ihtIwMieILG/2hybuOhIcVz8JJLnEW435HYY6Z7AT+HR2VWqkL4p0qhMjr576aRyRQaI At2g== X-Gm-Message-State: AOAM530aaihCIpoVw/OEd+gA6tUTpIaihpc+4UrOxVX3PWf3Jepbuodn XRtdK4oAyW/bj89F39+TCM8= X-Google-Smtp-Source: ABdhPJwS8nEeA1Ovh/xQ9nm1AetIMf/pLFXH7rZQfY6uwbpsF/gsoBepbpNuxQmiF1lh/APxyDOcFg== X-Received: by 2002:adf:fb51:: with SMTP id c17mr6191200wrs.106.1625232991992; Fri, 02 Jul 2021 06:36:31 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 05/18] hw/pci-host/bonito: Trace PCI config accesses smaller than 32-bit Date: Fri, 2 Jul 2021 15:35:44 +0200 Message-Id: <20210702133557.60317-6-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210702133557.60317-1-f4bug@amsat.org> References: <20210702133557.60317-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1625232994227100001 Per the datasheet section "5.7.5. Accessing PCI configuration space" the address must be 32-bit aligned. Trace eventual accesses not aligned to 32-bit. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210624202747.1433023-3-f4bug@amsat.org> --- hw/pci-host/bonito.c | 8 ++++++++ hw/pci-host/trace-events | 3 +++ 2 files changed, 11 insertions(+) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index afb3d1f81d5..751fdcec689 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -52,6 +52,7 @@ #include "hw/misc/unimp.h" #include "hw/registerfields.h" #include "qom/object.h" +#include "trace.h" =20 /* #define DEBUG_BONITO */ =20 @@ -185,6 +186,7 @@ FIELD(BONGENCFG, PCIQUEUE, 12, 1) #define BONITO_PCICONF_IDSEL_OFFSET 11 #define BONITO_PCICONF_FUN_MASK 0x700 /* [10:8] */ #define BONITO_PCICONF_FUN_OFFSET 8 +#define BONITO_PCICONF_REG_MASK_DS (~3) /* Per datasheet */ #define BONITO_PCICONF_REG_MASK 0xFC #define BONITO_PCICONF_REG_OFFSET 0 =20 @@ -495,6 +497,9 @@ static void bonito_spciconf_write(void *opaque, hwaddr = addr, uint64_t val, if (pciaddr =3D=3D 0xffffffff) { return; } + if (addr & ~BONITO_PCICONF_REG_MASK_DS) { + trace_bonito_spciconf_small_access(addr, size); + } =20 /* set the pci address in s->config_reg */ phb->config_reg =3D (pciaddr) | (1u << 31); @@ -521,6 +526,9 @@ static uint64_t bonito_spciconf_read(void *opaque, hwad= dr addr, unsigned size) if (pciaddr =3D=3D 0xffffffff) { return MAKE_64BIT_MASK(0, size * 8); } + if (addr & ~BONITO_PCICONF_REG_MASK_DS) { + trace_bonito_spciconf_small_access(addr, size); + } =20 /* set the pci address in s->config_reg */ phb->config_reg =3D (pciaddr) | (1u << 31); diff --git a/hw/pci-host/trace-events b/hw/pci-host/trace-events index f4b3a50cb0b..630e9fcc5e7 100644 --- a/hw/pci-host/trace-events +++ b/hw/pci-host/trace-events @@ -1,5 +1,8 @@ # See docs/devel/tracing.rst for syntax documentation. =20 +# bonito.c +bonito_spciconf_small_access(uint64_t addr, unsigned size) "PCI config add= ress is smaller then 32-bit, addr: 0x%"PRIx64", size: %u" + # grackle.c grackle_set_irq(int irq_num, int level) "set_irq num %d level %d" =20 --=20 2.31.1