From nobody Tue Nov 26 18:19:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706544673; cv=none; d=zohomail.com; s=zohoarc; b=B4DcfDqY90rTqH1r36mZ3LkIdAM80WJjOdLf29X4uVz7OcwW0IEsluzhZx6wwGu1QtePqqNva57t+QuKoHwDMIDo8RSeNmQuZ5WIFuQ06yBXs+m5Z07wk/ts/tj5qtxlP/DRGrpqIw8Hvf7LRT5DBKd5IbewUiVVDnmK27Y3UQY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706544673; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jJrBQU8/K6RcUc2wQkGztYkcJD87aocyjGftJaoYKA0=; b=dMBRZPUlPc7R/0KqI0YbbZfXrzWSSXwndSuiHukNcdJEWkQA7LMVKtqaVSMOuRz9F+XVDbWCMtqblD5KfWw/FnXz13ibsDEI9M9Zd9TKPRNuY3TWrnQv3M22MQjca6ZoWgatwEv8diIBiKdVTYy2gGDQD6BKNPbV6sPhrsuLr2Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706544673319208.5201222528542; Mon, 29 Jan 2024 08:11:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUUDX-0007tT-Eg; Mon, 29 Jan 2024 11:10:39 -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 1rUUDW-0007su-Av for qemu-devel@nongnu.org; Mon, 29 Jan 2024 11:10:38 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rUUDT-0002fC-Rs for qemu-devel@nongnu.org; Mon, 29 Jan 2024 11:10:38 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40e76109cdeso39732685e9.0 for ; Mon, 29 Jan 2024 08:10:35 -0800 (PST) Received: from localhost.localdomain (adsl-245.37.6.163.tellas.gr. [37.6.163.245]) by smtp.gmail.com with ESMTPSA id co6-20020a0560000a0600b0033af4df8e1esm1219957wrb.47.2024.01.29.08.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 08:10:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706544633; x=1707149433; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jJrBQU8/K6RcUc2wQkGztYkcJD87aocyjGftJaoYKA0=; b=tPwvBNfjQftF9lSMkLN6yX0x7futwdawheS9hnB5bOF38AymN1dH2I/4Qnp1QqGrNG GKhPEiKV+9BCux3znCoz5npr2JfA359RWdVODSY8yJ36vc+OLxncvMqoyV3ahP8BPmln nhwN1FepkMpwjOlugdSWGKQ33rJmUkmIakExhUujbaIpd2XizrUPvEhXcQW/ij9PNjaR BF6IWrWZbwTWWLZn0K47Y2M37eY0z13vrAy72g4oHY9yBC0PSi7TCFX6VDSU3ykY6VLu Bm81LWoQVKNkAIiVrGWgJ1NDwkh02TNrxHikaYJRJ5yPsiGczntEubGb1S+WgX/b8COZ DOeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706544633; x=1707149433; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jJrBQU8/K6RcUc2wQkGztYkcJD87aocyjGftJaoYKA0=; b=j43mMQYGrYX9r+PYI+hfYIQJxd1dkO7RndtXQy/rR1vga3FETvTKRrFueP8HJsWXlY aSn2TL3wGXHCkVyKf3e44QFoKA6UIaG8IBi/qm9n/lxdC2Mmvcw6md2NveyqAmTh0IG2 kv5OAD5c4e/HCe2Tv7+mIhyuzA6rtUXnVnSM2eZMfd7LHGj0vEGkfONRnfFUbJbzvdhm buKIELxK+2uhKliRcNDAI86DR5DmMf7a5dUJniZ7+9R47VcvE2yO4NsY4TPkkQMGc95i f6YSDbh8OF3/RmZmwxo3reQYZov27OYGIDGP6cHfSh+mjCgsnb2PBK5vUeRM0Jx998BR zrZA== X-Gm-Message-State: AOJu0YwhC+j8nDxDd3Temz0UmCNVCKpnr1mH4V+guGdyvw1oujQY6pWT tEW2Uo9Y5gYrv6V3TfANiLzl2IhjNahf1lWarOpFAFygfBwSfTX4IK9u6NQGmtizN5CS23nUBue yWI8= X-Google-Smtp-Source: AGHT+IGXEoIx/U9hfmpuCmgUgsEf0NYzJpBVKS4fOt1eKkdo5k209ufGMqzBoqKCECT5c24IOvKp7A== X-Received: by 2002:a05:600c:4711:b0:40e:f67d:d5f9 with SMTP id v17-20020a05600c471100b0040ef67dd5f9mr2509964wmo.4.1706544633645; Mon, 29 Jan 2024 08:10:33 -0800 (PST) From: Manos Pitsidianakis To: qemu-devel@nongnu.org, qemu-arm@nongnu.org, qemu-block@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 2/6] hw/arm/z2: convert DPRINTF to trace events and guest errors Date: Mon, 29 Jan 2024 18:09:37 +0200 Message-Id: <799c5141c5751cf2341e1d095349612e046424a8.1706544115.git.manos.pitsidianakis@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: 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=2a00:1450:4864:20::32a; envelope-from=manos.pitsidianakis@linaro.org; helo=mail-wm1-x32a.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=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706544674061100002 Content-Type: text/plain; charset="utf-8" Tracing DPRINTFs to stderr might not be desired. A developer that relies on trace events should be able to opt-in to each trace event and rely on QEMU's log redirection, instead of stderr by default. This commit converts DPRINTFs in this file that are used for tracing into trace events. DPRINTFs that report guest errors are logged with LOG_GUEST_ERROR. Signed-off-by: Manos Pitsidianakis Reviewed-by: Alex Benn=C3=A9e --- hw/arm/trace-events | 7 +++++++ hw/arm/z2.c | 27 ++++++++------------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/hw/arm/trace-events b/hw/arm/trace-events index 7c56943215..0ff41e6c78 100644 --- a/hw/arm/trace-events +++ b/hw/arm/trace-events @@ -58,3 +58,10 @@ smmuv3_inv_notifiers_iova(const char *name, uint16_t asi= d, uint16_t vmid, uint64 # strongarm.c strongarm_uart_update_parameters(const char *label, int speed, char parity= , int data_bits, int stop_bits) "%s speed=3D%d parity=3D%c data=3D%d stop= =3D%d" strongarm_ssp_read_underrun(void) "SSP rx underrun" + +# z2.c +z2_lcd_reg_update(uint8_t cur, uint8_t i_0, uint8_t i_1, uint8_t i_2, uint= 32_t value) "cur_reg =3D 0x%x, buf =3D [0x%x, 0x%x, 0x%x], value =3D 0x%x" +z2_lcd_enable_disable_result(const char *result) "LCD %s" +z2_aer915_send_too_long(int8_t msg) "message too long (%i bytes)" +z2_aer915_send(uint8_t reg, uint8_t value) "reg %d value 0x%02x" +z2_aer915_event(int8_t event, int8_t len) "i2c event =3D0x%x len=3D%d byte= s" diff --git a/hw/arm/z2.c b/hw/arm/z2.c index a67fba2cfd..eb2ff8dbc8 100644 --- a/hw/arm/z2.c +++ b/hw/arm/z2.c @@ -27,13 +27,7 @@ #include "exec/address-spaces.h" #include "qom/object.h" #include "qapi/error.h" - -#ifdef DEBUG_Z2 -#define DPRINTF(fmt, ...) \ - printf(fmt, ## __VA_ARGS__) -#else -#define DPRINTF(fmt, ...) -#endif +#include "trace.h" =20 static const struct keymap map[0x100] =3D { [0 ... 0xff] =3D { -1, -1 }, @@ -119,6 +113,8 @@ static uint32_t zipit_lcd_transfer(SSIPeripheral *dev, = uint32_t value) { ZipitLCD *z =3D ZIPIT_LCD(dev); uint16_t val; + + trace_z2_lcd_reg_update(z->cur_reg, z->buf[0], z->buf[1], z->buf[2], v= alue); if (z->selected) { z->buf[z->pos] =3D value & 0xff; z->pos++; @@ -126,22 +122,19 @@ static uint32_t zipit_lcd_transfer(SSIPeripheral *dev= , uint32_t value) if (z->pos =3D=3D 3) { switch (z->buf[0]) { case 0x74: - DPRINTF("%s: reg: 0x%.2x\n", __func__, z->buf[2]); z->cur_reg =3D z->buf[2]; break; case 0x76: val =3D z->buf[1] << 8 | z->buf[2]; - DPRINTF("%s: value: 0x%.4x\n", __func__, val); if (z->cur_reg =3D=3D 0x22 && val =3D=3D 0x0000) { z->enabled =3D 1; - printf("%s: LCD enabled\n", __func__); + trace_z2_lcd_enable_disable_result("enabled"); } else if (z->cur_reg =3D=3D 0x10 && val =3D=3D 0x0000) { z->enabled =3D 0; - printf("%s: LCD disabled\n", __func__); + trace_z2_lcd_enable_disable_result("disabled"); } break; default: - DPRINTF("%s: unknown command!\n", __func__); break; } z->pos =3D 0; @@ -211,14 +204,12 @@ static int aer915_send(I2CSlave *i2c, uint8_t data) =20 s->buf[s->len] =3D data; if (s->len++ > 2) { - DPRINTF("%s: message too long (%i bytes)\n", - __func__, s->len); + trace_z2_aer915_send_too_long(s->len); return 1; } =20 if (s->len =3D=3D 2) { - DPRINTF("%s: reg %d value 0x%02x\n", __func__, - s->buf[0], s->buf[1]); + trace_z2_aer915_send(s->buf[0], s->buf[1]); } =20 return 0; @@ -228,14 +219,12 @@ static int aer915_event(I2CSlave *i2c, enum i2c_event= event) { AER915State *s =3D AER915(i2c); =20 + trace_z2_aer915_event(s->len, event); switch (event) { case I2C_START_SEND: s->len =3D 0; break; case I2C_START_RECV: - if (s->len !=3D 1) { - DPRINTF("%s: short message!?\n", __func__); - } break; case I2C_FINISH: break; --=20 =CE=B3=CE=B1=E1=BF=96=CE=B1 =CF=80=CF=85=CF=81=CE=AF =CE=BC=CE=B9=CF=87=CE= =B8=CE=AE=CF=84=CF=89