Received: by 2002:a5d:4890:0:0:0:0:0 with SMTP id g16csp249785wrq; Tue, 22 Oct 2019 11:11:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0wPLBp4BTIlscSr1PKEk2ioYzmSDUwwrNJuQ4KB2sMf8JKu6b1hhS/E2XrqjAjMtYtMy5 X-Received: by 2002:ac8:28a1:: with SMTP id i30mr4969217qti.245.1571767875567; Tue, 22 Oct 2019 11:11:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571767875; cv=none; d=google.com; s=arc-20160816; b=fFIxkJTBJjpHwJQsqALJFqGV3N8ne1zjDUMw0tjNOGK3oClUc+3KT5p7CZjlCuPoyg nND0cxSI9ZVq3tONqQmk4Iw7DT0a1q+VufdxvnRNdfGRwWQCTb29QRKgry/zu4zhWyw4 BSMC6sKYYAsdeG3dR1YWvKOUTObuBDEKZyjLJkcHYnRGMtGPdttrlWPsdwIU61I3Ajke c/DARV9K2EIBf6bsRhSwlntGU8XelbTVzmVNQmIkEr9ro6VFw9L0oVvFcKdn86p6bUZ2 VBzjUUx2rHAOQ2VhWNCtM1TTH1b93lhQD0byxdCU7B36tnAyAY4DaZ0UqZNLk5I4O5Vl JCfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=HGvx6/inskhCnOm6BsAE3DPaXZ7uQLSuLupDi8FgtoQ=; b=Qpw3RBJP/wzgowqI/Kkb0nDWXT6GimQ5J2dRpS17fE57FilHET01ccynfDCclVBbRc xOeCHScSCocAkrIaVbzGTcD4v5xXpgl6Mj1KoXiY1YUKdf1kiFBXE4AcMVEHLNRxfp4G Tf+S10iQBMs7K8CpHHE68J4j+EaSldrtkRVegV23zU4FWu9DYgvzDHEJMfdLWavzI+5J XnLaOk5u9YutfwW7hQySsrBiK4BddUS3FSVQqE0i0mJpCSa50rO9b53/DxuoAHSNAb2b PGEqb4CctBtCpGr+Fk0f6bfYIXWW/VzBNdIG8GYV9lI9Ap6XcUDFs18MMtr14gE4BqRe CbvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t10si17151583qtt.302.2019.10.22.11.11.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Oct 2019 11:11:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:39522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMyck-0002sf-Nx for alex.bennee@linaro.org; Tue, 22 Oct 2019 14:11:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56065) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMycb-0002s9-EE for qemu-arm@nongnu.org; Tue, 22 Oct 2019 14:11:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMycY-0003XI-Pz for qemu-arm@nongnu.org; Tue, 22 Oct 2019 14:11:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54130) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iMycY-0003Wn-HM for qemu-arm@nongnu.org; Tue, 22 Oct 2019 14:11:02 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EAB465AFDE for ; Tue, 22 Oct 2019 18:11:00 +0000 (UTC) Received: by mail-wr1-f72.google.com with SMTP id r8so2289071wrx.8 for ; Tue, 22 Oct 2019 11:11:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qGV4nomXEVktouvB2CzDIkKo6CoN4xU05UrLijF67yw=; b=rogmJeqTahOqgUYAEL4s+t+XmZpRC3d23XBpT5Q5cmey3Mx4bPwdlJg1/cFWE6TgR1 rkxW7MmpfiP8pgsz10wnzW5a1uVitSCTvmjZIlBNzOvaAh/YaODeOY1iLnqCYNYEBZ9g ArgCh0psRfq6CPdJszWFM2qj2GTib8FqhhbTFw/+6DS2zlIEPjf5gLK7V2+D3DWidkIz 3DI48BGp72WaWSMIzzDizIo9f70KcgRTXgkchh4PwvlgMeax6dQGxqjATO7BbwxLGP2f //CfUEg5RMi0H8VTVXLiouMQ8sLW1fneRBjWppcLjMwr5V/zncEn0VNTAqMcdgCsM3Sd fYIg== X-Gm-Message-State: APjAAAUpQ2a+pNd9JBzRZrXwb9Ra/VqxMwDbqqroKFwnN5DTGpEYP5pw UBvK8QEsaHG9017IKQ3qfp6Lt/Lxt+uJcGdqvwfzYqsg1N3PjhfjrfLyhfj4t/xvh8tWIk1yCnH tPtSaMFv3QSC4 X-Received: by 2002:a7b:cd99:: with SMTP id y25mr4432619wmj.76.1571767859471; Tue, 22 Oct 2019 11:10:59 -0700 (PDT) X-Received: by 2002:a7b:cd99:: with SMTP id y25mr4432597wmj.76.1571767859134; Tue, 22 Oct 2019 11:10:59 -0700 (PDT) Received: from [192.168.1.41] (129.red-83-57-174.dynamicip.rima-tde.net. [83.57.174.129]) by smtp.gmail.com with ESMTPSA id l6sm22903117wmg.2.2019.10.22.11.10.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Oct 2019 11:10:58 -0700 (PDT) Subject: Re: [PATCH 5/5] aspeed/i2c: Add trace events To: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= , Peter Maydell , Stefan Hajnoczi References: <20191016085035.12136-1-clg@kaod.org> <20191016085035.12136-6-clg@kaod.org> <1e79a3e1-1531-11f8-9306-edfecad9896e@redhat.com> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Message-ID: Date: Tue, 22 Oct 2019 20:10:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jae Hyun Yoo , Andrew Jeffery , Eddie James , qemu-devel@nongnu.org, qemu-arm@nongnu.org, Joel Stanley Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: Veb98ZYStlba Hi C=C3=A9dric, Sorry for the late reply. On 10/17/19 1:52 PM, C=C3=A9dric Le Goater wrote: > Hello Philippe, >=20 > On 17/10/2019 12:22, Philippe Mathieu-Daud=C3=A9 wrote: >> Hi C=C3=A9dric, >> >> On 10/16/19 10:50 AM, C=C3=A9dric Le Goater wrote: >>> Signed-off-by: C=C3=A9dric Le Goater >>> --- >>> =C2=A0 hw/i2c/aspeed_i2c.c | 93 ++++++++++++++++++++++++++++++++++++= ++------- >>> =C2=A0 hw/i2c/trace-events |=C2=A0 9 +++++ >>> =C2=A0 2 files changed, 89 insertions(+), 13 deletions(-) >>> >>> diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c >>> index 030d9c56be65..2da04a4bff30 100644 >>> --- a/hw/i2c/aspeed_i2c.c >>> +++ b/hw/i2c/aspeed_i2c.c >>> @@ -28,6 +28,7 @@ >>> =C2=A0 #include "hw/i2c/aspeed_i2c.h" >>> =C2=A0 #include "hw/irq.h" >>> =C2=A0 #include "hw/qdev-properties.h" >>> +#include "trace.h" >>> =C2=A0 =C2=A0 /* I2C Global Register */ >>> =C2=A0 @@ -158,6 +159,13 @@ static inline void aspeed_i2c_bus_raise_= interrupt(AspeedI2CBus *bus) >>> =C2=A0 { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 AspeedI2CClass *aic =3D ASPEED_I2C_GE= T_CLASS(bus->controller); >>> =C2=A0 +=C2=A0=C2=A0=C2=A0 trace_aspeed_i2c_bus_raise_interrupt(bus-= >intr_status, >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->intr_sta= tus & I2CD_INTR_TX_NAK ? "nak|" : "", >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->intr_sta= tus & I2CD_INTR_TX_ACK ? "ack|" : "", >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->intr_sta= tus & I2CD_INTR_RX_DONE ? "done|" : "", >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->intr_sta= tus & I2CD_INTR_NORMAL_STOP ? "normal|" : "", >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->intr_sta= tus & I2CD_INTR_ABNORMAL ? "abnormal" : ""); >>> + >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->intr_status &=3D bus->intr_ctrl; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (bus->intr_status) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->controll= er->intr_status |=3D 1 << bus->id; >>> @@ -170,41 +178,57 @@ static uint64_t aspeed_i2c_bus_read(void *opaqu= e, hwaddr offset, >>> =C2=A0 { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 AspeedI2CBus *bus =3D opaque; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 AspeedI2CClass *aic =3D ASPEED_I2C_GE= T_CLASS(bus->controller); >>> +=C2=A0=C2=A0=C2=A0 uint64_t value =3D -1; >>> =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 switch (offset) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 case I2CD_FUN_CTRL_REG: >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return bus->ctrl; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 value =3D bus->ctrl; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 case I2CD_AC_TIMING_REG1: >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return bus->timing[0]; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 value =3D bus->timing[0]; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 case I2CD_AC_TIMING_REG2: >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return bus->timing[1]; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 value =3D bus->timing[1]; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 case I2CD_INTR_CTRL_REG: >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return bus->intr_ctrl; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 value =3D bus->intr_ctrl; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 case I2CD_INTR_STS_REG: >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return bus->intr_status; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 value =3D bus->intr_statu= s; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 case I2CD_POOL_CTRL_REG: >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return bus->pool_ctrl; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 value =3D bus->pool_ctrl; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 case I2CD_BYTE_BUF_REG: >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return bus->buf; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 value =3D bus->buf; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 case I2CD_CMD_REG: >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return bus->cmd | (i2c_bu= s_busy(bus->bus) << 16); >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 value =3D bus->cmd | (i2c= _bus_busy(bus->bus) << 16); >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 case I2CD_DMA_ADDR: >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (!aic->has= _dma) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 qemu_log_mask(LOG_GUEST_ERROR, "%s: No DMA support\n",=C2=A0 __= func__); >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 r= eturn -1; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 b= reak; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return bus->dma_addr; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 value =3D bus->dma_addr; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 case I2CD_DMA_LEN: >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (!aic->has= _dma) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 qemu_log_mask(LOG_GUEST_ERROR, "%s: No DMA support\n",=C2=A0 __= func__); >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 r= eturn -1; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 b= reak; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return bus->dma_len; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 value =3D bus->dma_len; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >>> + >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 default: >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 qemu_log_mask= (LOG_GUEST_ERROR, >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "%s= : Bad offset 0x%" HWADDR_PRIx "\n", __func__, offset); >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return -1; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 value =3D -1; >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >>> + >>> +=C2=A0=C2=A0=C2=A0 trace_aspeed_i2c_bus_read(bus->id, offset, size, = value); >>> +=C2=A0=C2=A0=C2=A0 return value; >>> =C2=A0 } >>> =C2=A0 =C2=A0 static void aspeed_i2c_set_state(AspeedI2CBus *bus, ui= nt8_t state) >>> @@ -246,6 +270,9 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus,= uint8_t pool_start) >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for (i =3D po= ol_start; i < I2CD_POOL_TX_COUNT(bus->pool_ctrl); i++) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 uint8_t *pool_base =3D aic->bus_pool_base(bus); >>> =C2=A0 +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 trace_aspeed_i2c_bus_send("BUF", i + 1, >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 I2CD_POOL_TX_COUNT(bus->pool_ctrl), >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 pool_base[i]); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 ret =3D i2c_send(bus->bus, pool_base[i]); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 if (ret) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >>> @@ -256,6 +283,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus,= uint8_t pool_start) >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 while (bus->d= ma_len) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 uint8_t data; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 aspeed_i2c_dma_read(bus, &data); >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 t= race_aspeed_i2c_bus_send("DMA", bus->dma_len, bus->dma_len, data); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 ret =3D i2c_send(bus->bus, data); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 if (ret) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break; >>> @@ -263,6 +291,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus,= uint8_t pool_start) >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->cmd &=3D= ~I2CD_TX_DMA_ENABLE; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } else { >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 trace_aspeed_i2c_bus_send= ("BYTE", pool_start, 1, bus->buf); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ret =3D i2c_s= end(bus->bus, bus->buf); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >>> =C2=A0 @@ -281,6 +310,9 @@ static void aspeed_i2c_bus_recv(AspeedI2C= Bus *bus) >>> =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for (i= =3D 0; i < I2CD_POOL_RX_SIZE(bus->pool_ctrl); i++) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 pool_base[i] =3D i2c_recv(bus->bus); >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 t= race_aspeed_i2c_bus_recv("BUF", i + 1, >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 I2CD_POOL_RX_SIZE(bus->pool_ctrl), >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 pool_base[i]); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >>> =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* Upd= ate RX count */ >>> @@ -294,6 +326,7 @@ static void aspeed_i2c_bus_recv(AspeedI2CBus *bus= ) >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 MemTxResult result; >>> =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 data =3D i2c_recv(bus->bus); >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 t= race_aspeed_i2c_bus_recv("DMA", bus->dma_len, bus->dma_len, data); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 result =3D address_space_write(&s->dram_as, bus->dma_addr, >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 MEMTXATTRS_UNSPECIFIED, &data, 1); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 if (result !=3D MEMTX_OK) { >>> @@ -307,6 +340,7 @@ static void aspeed_i2c_bus_recv(AspeedI2CBus *bus= ) >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->cmd &=3D= ~I2CD_RX_DMA_ENABLE; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } else { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 data =3D i2c_= recv(bus->bus); >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 trace_aspeed_i2c_bus_recv= ("BYTE", 1, 1, bus->buf); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->buf =3D = (data & I2CD_BYTE_BUF_RX_MASK) << I2CD_BYTE_BUF_RX_SHIFT; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >>> =C2=A0 } >>> @@ -364,6 +398,33 @@ static bool aspeed_i2c_check_sram(AspeedI2CBus *= bus) >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return true; >>> =C2=A0 } >>> =C2=A0 +static void aspeed_i2c_bus_cmd_dump(AspeedI2CBus *bus) >>> +{ >>> +=C2=A0=C2=A0=C2=A0 g_autofree char *cmd_flags; >>> +=C2=A0=C2=A0=C2=A0 uint32_t count; >>> + >>> +=C2=A0=C2=A0=C2=A0 if (bus->cmd & (I2CD_RX_BUFF_ENABLE | I2CD_RX_BUF= F_ENABLE)) { >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 count =3D I2CD_POOL_TX_CO= UNT(bus->pool_ctrl); >>> +=C2=A0=C2=A0=C2=A0 } else if (bus->cmd & (I2CD_RX_DMA_ENABLE | I2CD_= RX_DMA_ENABLE)) { >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 count =3D bus->dma_len; >>> +=C2=A0=C2=A0=C2=A0 } else { /* BYTE mode */ >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 count =3D 1; >>> +=C2=A0=C2=A0=C2=A0 } >>> + >>> +=C2=A0=C2=A0=C2=A0 cmd_flags =3D g_strdup_printf("%s%s%s%s%s%s%s%s%s= ", >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->cmd & I2CD_M_START_CMD ? = "start|" : "", >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->cmd & I2CD_RX_DMA_ENABLE = ? "rxdma|" : "", >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->cmd & I2CD_TX_DMA_ENABLE = ? "txdma|" : "", >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->cmd & I2CD_RX_BUFF_ENABLE= ? "rxbuf|" : "", >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->cmd & I2CD_TX_BUFF_ENABLE= ? "txbuf|" : "", >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->cmd & I2CD_M_TX_CMD ? "tx= |" : "", >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->cmd & I2CD_M_RX_CMD ? "rx= |" : "", >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->cmd & I2CD_M_S_RX_CMD_LAS= T ? "last|" : "", >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus->cmd & I2CD_M_STOP_CMD ? "= stop" : ""); >>> + >>> +=C2=A0=C2=A0=C2=A0 trace_aspeed_i2c_bus_cmd(bus->cmd, cmd_flags, cou= nt, bus->intr_status); Hard to switch habits and review code using g_autofree :/ >>> +} >>> + >>> =C2=A0 /* >>> =C2=A0=C2=A0 * The state machine needs some refinement. It is only u= sed to track >>> =C2=A0=C2=A0 * invalid STOP commands for the moment. >>> @@ -379,6 +440,10 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CB= us *bus, uint64_t value) >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >>> =C2=A0 +=C2=A0=C2=A0=C2=A0 if (trace_event_get_state_backends(TRACE_= ASPEED_I2C_BUS_CMD)) { >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 aspeed_i2c_bus_cmd_dump(b= us); >>> +=C2=A0=C2=A0=C2=A0 } >>> + >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (bus->cmd & I2CD_M_START_CMD) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uint8_t state= =3D aspeed_i2c_get_state(bus) & I2CD_MACTIVE ? >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 I2CD_MSTARTR : I2CD_MSTART; >>> @@ -465,6 +530,8 @@ static void aspeed_i2c_bus_write(void *opaque, hw= addr offset, >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 AspeedI2CClass *aic =3D ASPEED_I2C_GE= T_CLASS(bus->controller); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bool handle_rx; >>> =C2=A0 +=C2=A0=C2=A0=C2=A0 trace_aspeed_i2c_bus_write(bus->id, offse= t, size, value); >>> + >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 switch (offset) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 case I2CD_FUN_CTRL_REG: >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (value & I= 2CD_SLAVE_EN) { >>> diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events >>> index e1c810d5bd08..08db8fa68924 100644 >>> --- a/hw/i2c/trace-events >>> +++ b/hw/i2c/trace-events >>> @@ -5,3 +5,12 @@ >>> =C2=A0 i2c_event(const char *event, uint8_t address) "%s(addr:0x%02x= )" >>> =C2=A0 i2c_send(uint8_t address, uint8_t data) "send(addr:0x%02x) da= ta:0x%02x" >>> =C2=A0 i2c_recv(uint8_t address, uint8_t data) "recv(addr:0x%02x) da= ta:0x%02x" >>> + >>> +# aspeed_i2c.c >>> + >>> +aspeed_i2c_bus_cmd(uint32_t cmd, const char *cmd_flags, uint32_t cou= nt, uint32_t intr_status) "handling cmd=3D0x%x %s count=3D%d intr=3D0x%x" >>> +aspeed_i2c_bus_raise_interrupt(uint32_t intr_status, const char *str= 1, const char *str2, const char *str3, const char *str4, const char *str5= ) "handled intr=3D0x%x %s%s%s%s%s" >> >> There are various trace backends, your output seems designed only for = the "log" backend. >> >> Using 'unsigned is_nak, unsigned is_ack, ...' "nak:%u ack:%u ..." woul= d make your event compatible with the other backends (and ease their pars= ing). >=20 > I am not sure to understand where the incompatibility is. > Could you explain more please ? Well, the format you used is not *incompatible*, but it is not optimal. The aspeed_i2c_bus_raise_interrupt() trace event might be OK, although the arguments could be better named. The DTrace generated script is: probe qemu.system.arm.log.aspeed_i2c_bus_raise_interrupt =3D=20 qemu.system.arm.aspeed_i2c_bus_raise_interrupt ? { try { argstr1_str =3D str1 ? user_string_n(str1, 512) : "" } catch {} try { argstr2_str =3D str2 ? user_string_n(str2, 512) : "" } catch {} try { argstr3_str =3D str3 ? user_string_n(str3, 512) : "" } catch {} try { argstr4_str =3D str4 ? user_string_n(str4, 512) : "" } catch {} try { argstr5_str =3D str5 ? user_string_n(str5, 512) : "" } catch {} printf("%d@%d aspeed_i2c_bus_raise_interrupt handled intr=3D0x%x=20 %s%s%s%s%s\n", pid(), gettimeofday_ns(), intr_status, argstr1_str,=20 argstr2_str, argstr3_str, argstr4_str, argstr5_str) } Acceptable. The aspeed_i2c_bus_cmd() event is the one that bugged me, because thinking about tracing a particular set of commands (like: "all the commands with the rxdma bit set") I thought we'd need to parse the 'const char *cmd_flags'. But now I realize you also pass the bus->cmd value, so we can filter there, and ignore the description string. Same occurs with the other event, we can parse intr_status. Reviewed-by: Philippe Mathieu-Daud=C3=A9 >=20 > Thanks, >=20 > C. >=20 >>> +aspeed_i2c_bus_read(uint32_t busid, uint64_t offset, unsigned size, = uint64_t value) "bus[%d]: To 0x%" PRIx64 " of size %u: 0x%" PRIx64 >>> +aspeed_i2c_bus_write(uint32_t busid, uint64_t offset, unsigned size,= uint64_t value) "bus[%d]: To 0x%" PRIx64 " of size %u: 0x%" PRIx64 >>> +aspeed_i2c_bus_send(const char *mode, int i, int count, uint8_t byte= ) "%s send %d/%d 0x%02x" >>> +aspeed_i2c_bus_recv(const char *mode, int i, int count, uint8_t byte= ) "%s recv %d/%d 0x%02x" >>> >=20