From nobody Tue Nov 26 16:48:00 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=1705662943; cv=none; d=zohomail.com; s=zohoarc; b=DT4/MD/qNqHYxbLvSRzsEZlfDY/Hx/K8xxfxkCHXMZw5+vbqlCovMYpo8TP5tSnWkOnWkGqe1zJVHdHmddL6inyfsMoN0gEUQsn/QlfN0lkiyxdHr61rXHznFMWseRc6l1sQPJzoKpqXhgv5yRMUw61J16KD+2ybfuj4iGCCPGg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705662943; 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=ED7tv8DZ9a/S5xBH8be2DHeN5dwoaIIT6ClYiv99xYM=; b=KB5SRKsv2NurnMduXMVkTeRP86WAhp3+Xuny0/tV6bwIsHsT+RMNrehzn16f0VcEO6KCqzur0riE4UcVpK8ZuIUI7flvRll8DDFYylO9ODwQn98k7eWTQ19jDSvR3k3omlMZjWgTS0RFkzJqQr8NI2ZG7pHwnr7RPse8eozYhUQ= 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 1705662943473455.49164562376916; Fri, 19 Jan 2024 03:15:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQmpg-0007Yd-AX; Fri, 19 Jan 2024 06:14:44 -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 1rQmpZ-0007Vw-0R for qemu-devel@nongnu.org; Fri, 19 Jan 2024 06:14:37 -0500 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQmpU-0007Jg-2N for qemu-devel@nongnu.org; Fri, 19 Jan 2024 06:14:35 -0500 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a2d04888d3dso67953966b.2 for ; Fri, 19 Jan 2024 03:14:31 -0800 (PST) Received: from localhost.localdomain (adsl-114.109.242.227.tellas.gr. [109.242.227.114]) by smtp.gmail.com with ESMTPSA id vq9-20020a170907a4c900b00a2ca97242d5sm9283321ejc.120.2024.01.19.03.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 03:14:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705662869; x=1706267669; 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=ED7tv8DZ9a/S5xBH8be2DHeN5dwoaIIT6ClYiv99xYM=; b=RNokACRm2wUO1NoaBQ4SKO+Lmdp9BHOlFM/uI5HmhKxizcFaj06xmSAGObGJZlE0iL eCikGVTY8WDD3AyYFImj4zFDXcrawzM92SPjqS/3bHdMvoInGATX5/1K2XtjaTv3Dzk9 S+IXriC+3Gk6cBHODiIN1JY1BT1Joa1H2IdIA7cvZL4tMggybf/yjntj/9f+cAitGX5b F1l0rH3uiZoEmpWPilbuMHLzZc51g3Ty0AhVtQi2EN6Z16ZwaRxGh9a1XWFS4+gF3Tk1 7bXbjqiQ8ToJb41YYy6NkzKyH3nBknvUGo+2VxYlzr0MFUQI5ZA5UwWhnC5oTf7DFKHT Gk/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705662869; x=1706267669; 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=ED7tv8DZ9a/S5xBH8be2DHeN5dwoaIIT6ClYiv99xYM=; b=NGRkxfDuBjRC0EpzZW1gAMj5CjqUQCBd9iY223JCiKEOangmb1YpXgvFvnAzXccFWZ SAvHs/x0pYEOVpwBjOYYRkvx4bhl17Rxjt32Nsnahje8Jo5qJAhUH+UM9keeyXlzE0SF YpYqrIvaSYkDqMAVvp2Yd2b5yfxooJys1szu1P6pV37QHIYpebuMwuVr6vZMOZ2f230A mPr0MxShvRspL0W0W+HA74QSxwkfnHgG5QViS30nAapA+B35sUApSTjQ0q0HtBLSWwkp R08Ye+fZnTS9M8D2iNw4Sf5RTcSOwHYUj8+w+RkT47H7q17ZfcyUQ/0vi2jJPkLy1mpG N/5A== X-Gm-Message-State: AOJu0YzyFljU416km0LQRVmxAP3AfLGWVmaRDSvYHx9UanpK2RSunOKq x5veAYY9pAsHgj2AJWuhJdielAnX69GShEgkyOkZ/mTyOTLSQqSbwhYqAlDXxVbBOQ/zxjMnH15 Xg8Q= X-Google-Smtp-Source: AGHT+IE4ZX4c14VUo3cfdAFEFLYoCf8R4yQDCgPLrWhSQEz6A2ZGyGtoFDzZNWCjT0SPwkPNbtqy2Q== X-Received: by 2002:a17:907:7f02:b0:a2b:ca83:1576 with SMTP id qf2-20020a1709077f0200b00a2bca831576mr1691215ejc.85.1705662868760; Fri, 19 Jan 2024 03:14:28 -0800 (PST) From: Manos Pitsidianakis To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH 1/6] hw/arm/z2: convert DPRINTF to tracepoints Date: Fri, 19 Jan 2024 13:14:19 +0200 Message-Id: <021405f5ef53ebe80c7218e1df537635d34889b3.1705662313.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::62e; envelope-from=manos.pitsidianakis@linaro.org; helo=mail-ej1-x62e.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1705662945438100003 Content-Type: text/plain; charset="utf-8" Tracing DPRINTFs to stderr might not be desired. A developer that relies on tracepoints should be able to opt-in to each tracepoint 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 tracepoints. Signed-off-by: Manos Pitsidianakis --- hw/arm/trace-events | 8 ++++++++ hw/arm/z2.c | 26 +++++++++----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/hw/arm/trace-events b/hw/arm/trace-events index cdc1ea06a8..a262ad2e6a 100644 --- a/hw/arm/trace-events +++ b/hw/arm/trace-events @@ -55,3 +55,11 @@ smmuv3_notify_flag_add(const char *iommu) "ADD SMMUNotif= ier node for iommu mr=3D%s smmuv3_notify_flag_del(const char *iommu) "DEL SMMUNotifier node for iommu= mr=3D%s" smmuv3_inv_notifiers_iova(const char *name, uint16_t asid, uint16_t vmid, = uint64_t iova, uint8_t tg, uint64_t num_pages) "iommu mr=3D%s asid=3D%d vmi= d=3D%d iova=3D0x%"PRIx64" tg=3D%d num_pages=3D0x%"PRIx64 =20 +# z2.c +z2_lcd_cur_reg_update(uint8_t r) "reg: 0x%x" +z2_lcd_enable_disable(uint16_t v) "value: 0x%x" +z2_lcd_enable_disable_result(const char * result) "LCD %s" +z2_lcd_invalid_command(uint8_t value) "0x%x" +z2_aer915_send_too_log(int8_t msg) "message too long (%i bytes)" +z2_aer915_send(uint8_t reg, uint8_t value) "reg %d value 0x%02x" +z2_aer915_i2c_start_recv(uint16_t len) "I2C_START_RECV: short message with= len %d" diff --git a/hw/arm/z2.c b/hw/arm/z2.c index 83741a4909..6c0889d698 100644 --- a/hw/arm/z2.c +++ b/hw/arm/z2.c @@ -28,13 +28,7 @@ #include "cpu.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 }, @@ -127,22 +121,22 @@ 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]); + trace_z2_lcd_cur_reg_update(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); + trace_z2_lcd_enable_disable(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__); + trace_z2_lcd_invalid_command(z->buf[0]); break; } z->pos =3D 0; @@ -212,14 +206,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_log(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; @@ -235,7 +227,7 @@ static int aer915_event(I2CSlave *i2c, enum i2c_event e= vent) break; case I2C_START_RECV: if (s->len !=3D 1) { - DPRINTF("%s: short message!?\n", __func__); + trace_z2_aer915_i2c_start_recv(s->len); } break; case I2C_FINISH: --=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 From nobody Tue Nov 26 16:48:00 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=1705662922; cv=none; d=zohomail.com; s=zohoarc; b=Lydl1wmdskz/Ryle0O1G+o7MEKWVuX9DpqIDUafviRGgnjNjxn9eUpM1a+NjUPRYtCBecSFc3Z/V2HIK8yq2H6Sf4VtXblHXYdcKWznBWNR/L8omJ+TzA3uX0rc0BLYq9XTMQi7AlZYYatGdinWlN0S1JsoXOyRDpCvzROkd474= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705662922; 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=axwu9OirAAbfzNHj3iKrYWOaH6e1S20UxGk7oz9UvVY=; b=WJRLLi17ksEExSyANMDJvzkfAvmm8BBabB36wWlHMB2NhOGJcSF1rXfj8FRnVKqAauufUUIS/gAFxL1lVMSPJLUkyAVf579BRta4N6q5z+QkgUE5cWRgJNeA6gSQeTxmfJasAgN8sJVczXZjgP5Yt6nvK5B/fhuUs7zb/cGUx38= 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 1705662922303828.6173079432176; Fri, 19 Jan 2024 03:15:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQmpi-0007aI-KO; Fri, 19 Jan 2024 06:14:46 -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 1rQmpa-0007Wq-Rq for qemu-devel@nongnu.org; Fri, 19 Jan 2024 06:14:40 -0500 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQmpU-0007Ju-Ko for qemu-devel@nongnu.org; Fri, 19 Jan 2024 06:14:37 -0500 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a2c375d2430so71724466b.1 for ; Fri, 19 Jan 2024 03:14:31 -0800 (PST) Received: from localhost.localdomain (adsl-114.109.242.227.tellas.gr. [109.242.227.114]) by smtp.gmail.com with ESMTPSA id vq9-20020a170907a4c900b00a2ca97242d5sm9283321ejc.120.2024.01.19.03.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 03:14:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705662870; x=1706267670; 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=axwu9OirAAbfzNHj3iKrYWOaH6e1S20UxGk7oz9UvVY=; b=w2mbi0dv13ztU+bxrBMwatv5EXYcDuW4HQILSS/RCKWZqfqa0Icu6gkIrZC8FUTdY8 +nlo9Kw1GrZXYd9ujl/5XCwAPV3HQqN6+p1R8UsoiXZgbRyKzcYHq88pxhD4GCWXuID/ h8doPxrnXKUG1t+wnE1N419e2+CD/WTCw7l2pKG2FvWDJ0Fum8pxYH1tNxsLRqztBlyR GDBwgP4hP5r1Q8SwOJ3grDxJsPo/G7NOVohI8hkIf4bxyvTwNBnxN8w6Fphaq8MCIZaj s2iRUdj2J5zqO0qL/nMimF7jjy/OVDU4CHveAMb6YJrA8fA70oECdY87Dtk3rl8Ez4JH aNGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705662870; x=1706267670; 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=axwu9OirAAbfzNHj3iKrYWOaH6e1S20UxGk7oz9UvVY=; b=QwVNj9saBKMyvY5QfeG5k3Ee+mBidL6USlQu4VeC9GGJMpGAUDOuWrg302rHMFHRgY mSytz/kHdIv1SiLZSqCWzhDAxJ2ksgtCa0PdrP30bdZqcpwzhXTW+e1JD4Um9vJG5JIb vbK5/bjVPCh1O2L8jVs8txV0hs5m5S2/CGWZ3OQurW95Peeooo6lnoFTP+E4aWT6LtqE j4pHDk7L8pQBboRkWbxTZuLKoP8+bgNHSy38a1HqPy7YKGlt1RdzAGvSWyMKUPPUdly7 aRNbUm4Rk0R/hv0UeelupoH9sY0WXaL3NW/KbZ/KzvDJisjC4j9+0uOqPZ/HvxDanF+b TnlA== X-Gm-Message-State: AOJu0YyDkuF3smg+BYul1Ash5V+YmA2VGKZHpaTflB8bhkKCaAQOM0bC eFqM9ftsDvIDg+YFy4RuuHxAdmfYz+/TH2IldsX3WN1PArzi4HVT+SxKERKm6Ksg4vI4QRnDHEe RWbc= X-Google-Smtp-Source: AGHT+IHARoneApKjgPLy58+Put03cP3Oze0dmwhxjxb5Lpeq9M94R8OhG7zIpSvJ9lel5kPZR1bh1g== X-Received: by 2002:a17:907:d510:b0:a2f:3f0f:964c with SMTP id wb16-20020a170907d51000b00a2f3f0f964cmr950846ejc.98.1705662870043; Fri, 19 Jan 2024 03:14:30 -0800 (PST) From: Manos Pitsidianakis To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH 2/6] hw/arm/strongarm.c: convert DPRINTF to tracepoints Date: Fri, 19 Jan 2024 13:14:20 +0200 Message-Id: <3c6fbd73a14fdf120a6b0c1e168e5469acd00306.1705662313.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::62b; envelope-from=manos.pitsidianakis@linaro.org; helo=mail-ej1-x62b.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: 1705662923425100001 Content-Type: text/plain; charset="utf-8" Tracing DPRINTFs to stderr might not be desired. A developer that relies on tracepoints should be able to opt-in to each tracepoint 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 tracepoints. Signed-off-by: Manos Pitsidianakis --- hw/arm/strongarm.c | 49 +++++++++++++++++++-------------------------- hw/arm/trace-events | 18 +++++++++++++++++ 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c index fef3638aca..3ff748e826 100644 --- a/hw/arm/strongarm.c +++ b/hw/arm/strongarm.c @@ -46,8 +46,7 @@ #include "qemu/cutils.h" #include "qemu/log.h" #include "qom/object.h" - -//#define DEBUG +#include "trace.h" =20 /* TODO @@ -66,12 +65,6 @@ - Enhance UART with modem signals */ =20 -#ifdef DEBUG -# define DPRINTF(format, ...) printf(format , ## __VA_ARGS__) -#else -# define DPRINTF(format, ...) do { } while (0) -#endif - static struct { hwaddr io_base; int irq; @@ -151,8 +144,7 @@ static uint64_t strongarm_pic_mem_read(void *opaque, hw= addr offset, case ICPR: return s->pending; default: - printf("%s: Bad register offset 0x" HWADDR_FMT_plx "\n", - __func__, offset); + trace_strongarm_pic_mem_read(offset); return 0; } } @@ -173,8 +165,7 @@ static void strongarm_pic_mem_write(void *opaque, hwadd= r offset, s->int_idle =3D (value & 1) ? 0 : ~0; break; default: - printf("%s: Bad register offset 0x" HWADDR_FMT_plx "\n", - __func__, offset); + trace_strongarm_pic_mem_write(offset); break; } strongarm_pic_update(s); @@ -333,7 +324,7 @@ static uint64_t strongarm_rtc_read(void *opaque, hwaddr= addr, ((qemu_clock_get_ms(rtc_clock) - s->last_hz) << 15) / (1000 * ((s->rttr & 0xffff) + 1)); default: - printf("%s: Bad register 0x" HWADDR_FMT_plx "\n", __func__, addr); + trace_strongarm_rtc_read(addr); return 0; } } @@ -375,7 +366,7 @@ static void strongarm_rtc_write(void *opaque, hwaddr ad= dr, break; =20 default: - printf("%s: Bad register 0x" HWADDR_FMT_plx "\n", __func__, addr); + trace_strongarm_rtc_write(addr); } } =20 @@ -581,7 +572,7 @@ static uint64_t strongarm_gpio_read(void *opaque, hwadd= r offset, return s->status; =20 default: - printf("%s: Bad offset 0x" HWADDR_FMT_plx "\n", __func__, offset); + trace_strongarm_gpio_read(offset); } =20 return 0; @@ -626,7 +617,7 @@ static void strongarm_gpio_write(void *opaque, hwaddr o= ffset, break; =20 default: - printf("%s: Bad offset 0x" HWADDR_FMT_plx "\n", __func__, offset); + trace_strongarm_gpio_write(offset); } } =20 @@ -782,7 +773,7 @@ static uint64_t strongarm_ppc_read(void *opaque, hwaddr= offset, return s->ppfr | ~0x7f001; =20 default: - printf("%s: Bad offset 0x" HWADDR_FMT_plx "\n", __func__, offset); + trace_strongarm_ppc_read(offset); } =20 return 0; @@ -817,7 +808,7 @@ static void strongarm_ppc_write(void *opaque, hwaddr of= fset, break; =20 default: - printf("%s: Bad offset 0x" HWADDR_FMT_plx "\n", __func__, offset); + trace_strongarm_ppc_write(offset); } } =20 @@ -1029,8 +1020,11 @@ static void strongarm_uart_update_parameters(StrongA= RMUARTState *s) s->char_transmit_time =3D (NANOSECONDS_PER_SECOND / speed) * frame_si= ze; qemu_chr_fe_ioctl(&s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); =20 - DPRINTF(stderr, "%s speed=3D%d parity=3D%c data=3D%d stop=3D%d\n", s->= chr->label, - speed, parity, data_bits, stop_bits); + trace_strongarm_uart_update_parameters(s->chr.chr->label?:"NULL", + speed, + parity, + data_bits, + stop_bits); } =20 static void strongarm_uart_rx_to(void *opaque) @@ -1164,7 +1158,7 @@ static uint64_t strongarm_uart_read(void *opaque, hwa= ddr addr, return s->utsr1; =20 default: - printf("%s: Bad register 0x" HWADDR_FMT_plx "\n", __func__, addr); + trace_strongarm_uart_read_bad_register(addr); return 0; } } @@ -1221,7 +1215,7 @@ static void strongarm_uart_write(void *opaque, hwaddr= addr, break; =20 default: - printf("%s: Bad register 0x" HWADDR_FMT_plx "\n", __func__, addr); + trace_strongarm_uart_write_bad_register(addr); } } =20 @@ -1434,7 +1428,7 @@ static uint64_t strongarm_ssp_read(void *opaque, hwad= dr addr, return 0xffffffff; } if (s->rx_level < 1) { - printf("%s: SSP Rx Underrun\n", __func__); + trace_strongarm_ssp_read_underrun(); return 0xffffffff; } s->rx_level--; @@ -1443,7 +1437,7 @@ static uint64_t strongarm_ssp_read(void *opaque, hwad= dr addr, strongarm_ssp_fifo_update(s); return retval; default: - printf("%s: Bad register 0x" HWADDR_FMT_plx "\n", __func__, addr); + trace_strongarm_ssp_read(addr); break; } return 0; @@ -1458,8 +1452,7 @@ static void strongarm_ssp_write(void *opaque, hwaddr = addr, case SSCR0: s->sscr[0] =3D value & 0xffbf; if ((s->sscr[0] & SSCR0_SSE) && SSCR0_DSS(value) < 4) { - printf("%s: Wrong data size: %i bits\n", __func__, - (int)SSCR0_DSS(value)); + trace_strongarm_ssp_write_wrong_data_size((int)SSCR0_DSS(value= )); } if (!(value & SSCR0_SSE)) { s->sssr =3D 0; @@ -1471,7 +1464,7 @@ static void strongarm_ssp_write(void *opaque, hwaddr = addr, case SSCR1: s->sscr[1] =3D value & 0x2f; if (value & SSCR1_LBM) { - printf("%s: Attempt to use SSP LBM mode\n", __func__); + trace_strongarm_ssp_write_wrong_data_size_invalid(); } strongarm_ssp_fifo_update(s); break; @@ -1509,7 +1502,7 @@ static void strongarm_ssp_write(void *opaque, hwaddr = addr, break; =20 default: - printf("%s: Bad register 0x" HWADDR_FMT_plx "\n", __func__, addr); + trace_strongarm_ssp_write_bad_register(addr); break; } } diff --git a/hw/arm/trace-events b/hw/arm/trace-events index a262ad2e6a..a6a67d5f16 100644 --- a/hw/arm/trace-events +++ b/hw/arm/trace-events @@ -63,3 +63,21 @@ z2_lcd_invalid_command(uint8_t value) "0x%x" z2_aer915_send_too_log(int8_t msg) "message too long (%i bytes)" z2_aer915_send(uint8_t reg, uint8_t value) "reg %d value 0x%02x" z2_aer915_i2c_start_recv(uint16_t len) "I2C_START_RECV: short message with= len %d" + +# 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_uart_read_bad_register(uint64_t addr) "Bad uart register 0x%zu" +strongarm_uart_write_bad_register(uint64_t addr) "Bad uart register 0x%zu" +strongarm_pic_mem_read(uint64_t offset) "Bad pic mem register read offset = 0x%zu" +strongarm_pic_mem_write(uint64_t offset) "Bad pic mem register write offse= t 0x%zu" +strongarm_rtc_read(uint64_t addr) "Bad rtc register read 0x%zu" +strongarm_rtc_write(uint64_t addr) "Bad rtc register write 0x%zu" +strongarm_gpio_read(uint64_t offset) "Bad gpio read offset 0x%zu" +strongarm_gpio_write(uint64_t offset) "Bad gpio write offset 0x%zu" +strongarm_ppc_write(uint64_t offset) "Bad ppc write offset 0x%zu" +strongarm_ppc_read(uint64_t offset) "Bad ppc write offset 0x%zu" +strongarm_ssp_read_underrun(void) "SSP Rx Underrun" +strongarm_ssp_read(uint64_t addr) "Bad register 0x%zu" +strongarm_ssp_write_wrong_data_size(int v) "Wrong data size: %i bits" +strongarm_ssp_write_wrong_data_size_invalid(void) "Attempt to use SSP LBM = mode" +strongarm_ssp_write_bad_register(uint64_t addr) "Bad register 0x%zu" --=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 From nobody Tue Nov 26 16:48:00 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=1705662938; cv=none; d=zohomail.com; s=zohoarc; b=HKM3zmP4tVS+RbCFEgV4+8A+IDeZ/7JgOqcyEjgmhp3grkYqRgxL3rxNk0vuceF044ECb52XhzxpCtmwiV6SkM4h/Iw6KubHMQ+5CVSVEXCEWD7QLkZQ1mlTg4/aDaCRe54/VMSpaRMgsWUJmuO4NQmSZB2oLB6pu4k9c4CmV3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705662938; 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=dRdxU4Ux/WYb9oau9qsh6pPUNLeWhKGZpVjne6FmQCA=; b=EsomUANleRxE6oCn0ZyF0vgKXWxUbNMg46amHjLa7AHSI60wrwcP236XQmv3zCA9+9K5YB+9v8Znn8j+eUoaIcBC05vt+m5ITU6IUVaMjPxsc5PUqUWsRV29mG+dfd7kVfxrqcXnGUJN0FXQM/J1GLoURqzrZU/d6lN9m/FVIAA= 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 1705662938216249.4500701812742; Fri, 19 Jan 2024 03:15:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQmpi-0007Zs-0k; Fri, 19 Jan 2024 06:14:46 -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 1rQmpa-0007Wu-UN for qemu-devel@nongnu.org; Fri, 19 Jan 2024 06:14:40 -0500 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQmpW-0007KC-F6 for qemu-devel@nongnu.org; Fri, 19 Jan 2024 06:14:37 -0500 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-55817a12ad8so776988a12.2 for ; Fri, 19 Jan 2024 03:14:33 -0800 (PST) Received: from localhost.localdomain (adsl-114.109.242.227.tellas.gr. [109.242.227.114]) by smtp.gmail.com with ESMTPSA id vq9-20020a170907a4c900b00a2ca97242d5sm9283321ejc.120.2024.01.19.03.14.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 03:14:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705662871; x=1706267671; 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=dRdxU4Ux/WYb9oau9qsh6pPUNLeWhKGZpVjne6FmQCA=; b=OWqPsV4J+vXld/gHwUir8zxMW+2QsCxk2FP0bsQngAO1bnQUZORT8Yp2yWYl8J1TYk f952ZOnAMC2Bsl4ruki5ADtoD5UhpCkMgMo/UATgmH+iu8gX3TNFO1BXJ3xIpUHToteS ciFWhjfuyt8tg2iRc5EMl7QAElEkoN6LEloDAhdulqVU+Ba7XzVEvLTZS3fcR8eiQIUG JBUgRZQ0LQl+ZikkPy96ETlPy/D45LUob3WyoW6BuVHuk4GYdTHMQj20oizmTIRvpq2G HTpIk1ux0dwVlQ+ePLPbQ5OkxWegSuFlh82XfgtjIFgI4hwu1s+sZf9phRqKw0sjwTLL joCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705662871; x=1706267671; 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=dRdxU4Ux/WYb9oau9qsh6pPUNLeWhKGZpVjne6FmQCA=; b=S2bwR7VTK7l22KEOlOY4tM55dq0MIpRA3BBLLS3YD1fP1g43cibBqWIvcKMwXMxbDl jeNPLu9ZNREu920pB6h0otVl17ISJSdgG3pcFvBfkBmJtT5HjIaRGh/OBWjyWqgXSH+f s2+f7sPmFQQPt9nM97IIlZNcLE0FQUaBJT8zbeC/WtvvsM9QA7Sb/iZnccm/7BvawdMM IxGr+67gC7m4rrzYynfsFKq/1t0LOARswmMedbEpztu6s4/SihLZ6YW9CMD0r+WwxE6h pZ/sWsJayoZAOnpV92FdMjPpqXJYAcW77JMfDVxbkTw5VKkUWXecencThiIG1+5Zrxbg N0CQ== X-Gm-Message-State: AOJu0YyQZtRnAeNYYfDIInVCCzTTVEdKZJp+0ndPCdrGHVouXDwAAOhL eqcHm0KLz4cOkLBqj0UhrC36UxAmJCXwDBn48h4FSuzOhyR3Qlic5USsLJzSATg2z5VxQ3mbnOL yEBY= X-Google-Smtp-Source: AGHT+IF+7XPCWKeLDrzf6iHr4qRyOyhOD+FEWclxYKDEEIwHcmnG5F2DBjnw5UTyO1yybUu3tkl6kw== X-Received: by 2002:a17:906:f190:b0:a26:ea22:e62b with SMTP id gs16-20020a170906f19000b00a26ea22e62bmr1295323ejb.43.1705662871389; Fri, 19 Jan 2024 03:14:31 -0800 (PST) From: Manos Pitsidianakis To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH 3/6] hw/arm/xen_arm.c: convert DPRINTF to tracepoints Date: Fri, 19 Jan 2024 13:14:21 +0200 Message-Id: <49905a0d22aa80956645d6dd74e9bc098c56555b.1705662313.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::531; envelope-from=manos.pitsidianakis@linaro.org; helo=mail-ed1-x531.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: 1705662939417100001 Content-Type: text/plain; charset="utf-8" Tracing DPRINTFs to stderr might not be desired. A developer that relies on tracepoints should be able to opt-in to each tracepoint 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 tracepoints. Signed-off-by: Manos Pitsidianakis --- hw/arm/trace-events | 7 +++++++ hw/arm/xen_arm.c | 26 +++++++++++++++----------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/hw/arm/trace-events b/hw/arm/trace-events index a6a67d5f16..e3f5d677d7 100644 --- a/hw/arm/trace-events +++ b/hw/arm/trace-events @@ -81,3 +81,10 @@ strongarm_ssp_read(uint64_t addr) "Bad register 0x%zu" strongarm_ssp_write_wrong_data_size(int v) "Wrong data size: %i bits" strongarm_ssp_write_wrong_data_size_invalid(void) "Attempt to use SSP LBM = mode" strongarm_ssp_write_bad_register(uint64_t addr) "Bad register 0x%zu" + +# xen_arm.c +xen_create_virtio_mmio_devices(int i, int irq, uint64_t base) "Created vir= tio-mmio device %d: irq %d base 0x%lx" +xen_init_ram(const char *hi_xor_low, uint64_t base, uint64_t size) "Initia= lized region xen.ram.%s: base 0x%lx size 0x%lx" +xen_enable_tpm_not_found(void) "Couldn't find tmp0 backend" +xen_enable_tpm(uint64_t addr) "Connected tpmdev at address 0x%lx" +xen_arm_init(const char *msg) "%s" diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c index a5631529d0..a024117d22 100644 --- a/hw/arm/xen_arm.c +++ b/hw/arm/xen_arm.c @@ -34,6 +34,7 @@ #include "hw/xen/xen-hvm-common.h" #include "sysemu/tpm.h" #include "hw/xen/arch_hvm.h" +#include "trace.h" =20 #define TYPE_XEN_ARM MACHINE_TYPE_NAME("xenpvh") OBJECT_DECLARE_SIMPLE_TYPE(XenArmState, XEN_ARM) @@ -91,8 +92,9 @@ static void xen_create_virtio_mmio_devices(XenArmState *x= am) =20 sysbus_create_simple("virtio-mmio", base, irq); =20 - DPRINTF("Created virtio-mmio device %d: irq %d base 0x%lx\n", - i, GUEST_VIRTIO_MMIO_SPI_FIRST + i, base); + trace_xen_create_virtio_mmio_devices(i, + GUEST_VIRTIO_MMIO_SPI_FIRST += i, + base); } } =20 @@ -117,15 +119,13 @@ static void xen_init_ram(MachineState *machine) memory_region_init_alias(&ram_lo, NULL, "xen.ram.lo", &ram_memory, GUEST_RAM0_BASE, ram_size[0]); memory_region_add_subregion(sysmem, GUEST_RAM0_BASE, &ram_lo); - DPRINTF("Initialized region xen.ram.lo: base 0x%llx size 0x%lx\n", - GUEST_RAM0_BASE, ram_size[0]); + trace_xen_init_ram("lo", GUEST_RAM0_BASE, ram_size[0]); =20 if (ram_size[1] > 0) { memory_region_init_alias(&ram_hi, NULL, "xen.ram.hi", &ram_memory, GUEST_RAM1_BASE, ram_size[1]); memory_region_add_subregion(sysmem, GUEST_RAM1_BASE, &ram_hi); - DPRINTF("Initialized region xen.ram.hi: base 0x%llx size 0x%lx\n", - GUEST_RAM1_BASE, ram_size[1]); + trace_xen_init_ram("hi", GUEST_RAM1_BASE, ram_size[1]); } } =20 @@ -158,7 +158,7 @@ static void xen_enable_tpm(XenArmState *xam) =20 TPMBackend *be =3D qemu_find_tpm_be("tpm0"); if (be =3D=3D NULL) { - DPRINTF("Couldn't fine the backend for tpm0\n"); + trace_xen_enable_tpm_not_found(); return; } dev =3D qdev_new(TYPE_TPM_TIS_SYSBUS); @@ -168,7 +168,7 @@ static void xen_enable_tpm(XenArmState *xam) sysbus_realize_and_unref(busdev, &error_fatal); sysbus_mmio_map(busdev, 0, xam->cfg.tpm_base_addr); =20 - DPRINTF("Connected tpmdev at address 0x%lx\n", xam->cfg.tpm_base_addr); + trace_xen_enable_tpm(xam->cfg.tpm_base_addr); } #endif =20 @@ -179,8 +179,11 @@ static void xen_arm_init(MachineState *machine) xam->state =3D g_new0(XenIOState, 1); =20 if (machine->ram_size =3D=3D 0) { - DPRINTF("ram_size not specified. QEMU machine started without IORE= Q" - "(no emulated devices including Virtio)\n"); + trace_xen_arm_init("ram_size not specified. " + "QEMU machine started " + "without IOREQ " + "(no emulated devices" + "including Virtio)"); return; } =20 @@ -194,7 +197,8 @@ static void xen_arm_init(MachineState *machine) if (xam->cfg.tpm_base_addr) { xen_enable_tpm(xam); } else { - DPRINTF("tpm-base-addr is not provided. TPM will not be enabled\n"= ); + trace_xen_arm_init("tpm-base-addr is not provided." + "TPM will not be enabled"); } #endif } --=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 From nobody Tue Nov 26 16:48:00 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=1705662993; cv=none; d=zohomail.com; s=zohoarc; b=FH61Rkdn1ZBc62lxN3zjDEV3dDtH999AncorePNLYz97lWN5HMtBaH3GOL9hy6tLJHGfniPBd7KU/4nQn4MJb+0V0bVChVu1fhq1Fb9wJHIP5aihMpX38itaLYLIvp7VoKotdO6ytHzO4Rmv2RgrEUWOu/Q5dQ+4pyIdWjPX+vw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705662993; 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=oTGa3/BzlzS0hEzKw7dcC9l7LHJA830QpWxPRNzttIo=; b=Bzam5rEcJoO69HSXpZx7fMHDA8WdOpZ7DFlTmssZQuuWzmefsPSy4hAIODqxpO0sFX3FeHd+6IDyrXVRseVkYaeHxkYgNO2G44AkAywb2dGAXJoi2uyIAD8W4sNtVGEh7dGuwl7Jvr2JA7KjZU++yaLeUrOzKp6pj2ocOT7HT+I= 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 1705662993254221.9857458673563; Fri, 19 Jan 2024 03:16:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQmph-0007Zd-Dx; Fri, 19 Jan 2024 06:14:45 -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 1rQmpa-0007Wt-UR for qemu-devel@nongnu.org; Fri, 19 Jan 2024 06:14:40 -0500 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQmpW-0007KM-Hl for qemu-devel@nongnu.org; Fri, 19 Jan 2024 06:14:37 -0500 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a2d348d213dso58605166b.0 for ; Fri, 19 Jan 2024 03:14:34 -0800 (PST) Received: from localhost.localdomain (adsl-114.109.242.227.tellas.gr. [109.242.227.114]) by smtp.gmail.com with ESMTPSA id vq9-20020a170907a4c900b00a2ca97242d5sm9283321ejc.120.2024.01.19.03.14.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 03:14:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705662872; x=1706267672; 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=oTGa3/BzlzS0hEzKw7dcC9l7LHJA830QpWxPRNzttIo=; b=mkXTcDxpxk674ZG+U7my/2AHY/zoYAo17rhaf8g+kVxb6BtVG9OHuadKnW0LwS07j4 BBV+oq6+UwgS9dTGNgeufH66x6qPZghu3UDmBFVzixAgZ8YftfEpIAFQftTuxBQ2fXr6 PL1lNQzpa3y5MYWlYQDD4hAM6ByhHcboiPvQkN7SZ7uzfGsipzfSR/e3B+wRJffn0J5Z HwMf2mM9xniEP4pCgijCNPHAUsyXBsG6kZDuI3lFP+cG6qSiGOMrEYw4oDvDIyfuLMOX q1/guRE0aDYCVT6tcudEoStxaWfpcvS7lCnYN7yZfDP7+zH1jCE8sI11qv7VXA4DbY6i 3XRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705662872; x=1706267672; 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=oTGa3/BzlzS0hEzKw7dcC9l7LHJA830QpWxPRNzttIo=; b=XBDlyq75J7RmZBsQeGXjfC4jG8ITQ0kKvxyU3vtrjoOaUFkDhQyZ4zzTz8lDzThOfs hiQgp0dOo2cKRVA5pj1gKsg2YsOCZ2fHT6QAkH84a8khNQ8p8hBkkIogp0UUWRUIkqMy jtr+z6H4umrSyKwID68Izytwd3Rl9g7rVL8XYiX9lxe5NWxucfMK/7pt/CJ55rsRAN5o jqBjjAOu4A7ydwBDdUvoVMBVk70ZFbkjqQ2UBSAyy48sY6izHR47dQoW/8Nf1XTLGEmo Jl62ZRcLDbSnAjUu5sMWTFJ+wIT85WPyS0V35rfhZF8IN6oJ+QxPmfZGObBBBAUyxY/s Lbrw== X-Gm-Message-State: AOJu0Yz8ti7qINWji8ZeGEviMmDQO3iqpwRt1mYTzKb7oMTMMDl7o8KM QqDxK30Q6Fy6UXo39JyBRtFiG1UpVYAL56zKRtnuGQmOskQPdDnB7gsVtHZbzuKwVbESZjqtwVh jgQA= X-Google-Smtp-Source: AGHT+IFJwYV2eU0mgnOPZgOYc+m+fobqCq6IhPou4Wj3C9UTsKQtOBkQuJyuSQx6lGanV93fM1UMig== X-Received: by 2002:a17:906:c30d:b0:a2d:feaa:637f with SMTP id s13-20020a170906c30d00b00a2dfeaa637fmr1380599ejz.82.1705662872624; Fri, 19 Jan 2024 03:14:32 -0800 (PST) From: Manos Pitsidianakis To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH 4/6] hw/xen/xen-mapcache.c: convert DPRINTF to tracepoints Date: Fri, 19 Jan 2024 13:14:22 +0200 Message-Id: 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::62c; envelope-from=manos.pitsidianakis@linaro.org; helo=mail-ej1-x62c.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: 1705662993570100001 Content-Type: text/plain; charset="utf-8" Tracing DPRINTFs to stderr might not be desired. A developer that relies on tracepoints should be able to opt-in to each tracepoint 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 tracepoints. Signed-off-by: Manos Pitsidianakis --- hw/xen/trace-events | 11 +++++++++ hw/xen/xen-mapcache.c | 54 +++++++++++++++++++------------------------ 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/hw/xen/trace-events b/hw/xen/trace-events index 67a6c41926..1b748dba09 100644 --- a/hw/xen/trace-events +++ b/hw/xen/trace-events @@ -60,3 +60,14 @@ cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_= t reg, uint32_t size, ui xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64 xen_remap_bucket(uint64_t index) "index 0x%"PRIx64 xen_map_cache_return(void* ptr) "%p" +xen_map_cache_init(uint64_t nr_buckets, uint64_t size) "nr_buckets =3D 0x%= lx size %lu" +xen_replace_cache_entry_dummy(uint64_t old_phys_addr, uint64_t new_phys_ad= dr) "Replacing a dummy mapcache entry for 0x%"PRIx64" with 0x%"PRIx64 +xen_invalidate_map_cache_entry_unlocked_not_found(void *p) "could not find= %p" +xen_invalidate_map_cache_entry_unlocked_found(uint64_t addr, void *p) " = 0x%"PRIx64" -> %p is present" +xen_invalidate_map_cache_entry_unlocked_miss(void *buffer) "Trying to unma= p address %p that is not in the mapcache" +xen_replace_cache_entry_unlocked_could_not_update_entry(uint64_t old_phys_= addr) "Unable to update a mapcache entry for 0x%"PRIx64 +xen_ram_addr_from_mapcache_not_found(void *p) "could not find %p" +xen_ram_addr_from_mapcache_found(uint64_t addr, void *p) " 0x%"PRIx64" -= > %p is present" +xen_ram_addr_from_mapcache_not_in_cache(void *p) "Trying to find address %= p that is not in the mapcache" +xen_replace_cache_entry_unlocked(uint64_t old_phys_addr) "Trying to update= an entry for 0x%"PRIx64" that is not in the mapcache" +xen_invalidate_map_cache(uint64_t paddr_index, void *vaddr_req) "Locked DM= A mapping while invalidating mapcache 0x%"PRIx64" -> %p is present" diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c index f7d974677d..336c212376 100644 --- a/hw/xen/xen-mapcache.c +++ b/hw/xen/xen-mapcache.c @@ -22,16 +22,6 @@ #include "trace.h" =20 =20 -//#define MAPCACHE_DEBUG - -#ifdef MAPCACHE_DEBUG -# define DPRINTF(fmt, ...) do { \ - fprintf(stderr, "xen_mapcache: " fmt, ## __VA_ARGS__); \ -} while (0) -#else -# define DPRINTF(fmt, ...) do { } while (0) -#endif - #if HOST_LONG_BITS =3D=3D 32 # define MCACHE_BUCKET_SHIFT 16 # define MCACHE_MAX_SIZE (1UL<<31) /* 2GB Cap */ @@ -145,8 +135,7 @@ void xen_map_cache_init(phys_offset_to_gaddr_t f, void = *opaque) =20 size =3D mapcache->nr_buckets * sizeof (MapCacheEntry); size =3D (size + XC_PAGE_SIZE - 1) & ~(XC_PAGE_SIZE - 1); - DPRINTF("%s, nr_buckets =3D %lx size %lu\n", __func__, - mapcache->nr_buckets, size); + trace_xen_map_cache_init(mapcache->nr_buckets, size); mapcache->entry =3D g_malloc0(size); } =20 @@ -286,7 +275,9 @@ tryagain: test_bits(address_offset >> XC_PAGE_SHIFT, test_bit_size >> XC_PAGE_SHIFT, mapcache->last_entry->valid_mapping)) { - trace_xen_map_cache_return(mapcache->last_entry->vaddr_base + addr= ess_offset); + trace_xen_map_cache_return( + mapcache->last_entry->vaddr_base + address_offset + ); return mapcache->last_entry->vaddr_base + address_offset; } =20 @@ -368,7 +359,9 @@ tryagain: QTAILQ_INSERT_HEAD(&mapcache->locked_entries, reventry, next); } =20 - trace_xen_map_cache_return(mapcache->last_entry->vaddr_base + address_= offset); + trace_xen_map_cache_return( + mapcache->last_entry->vaddr_base + address_offset + ); return mapcache->last_entry->vaddr_base + address_offset; } =20 @@ -402,10 +395,10 @@ ram_addr_t xen_ram_addr_from_mapcache(void *ptr) } } if (!found) { - fprintf(stderr, "%s, could not find %p\n", __func__, ptr); + trace_xen_ram_addr_from_mapcache_not_found(ptr); QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) { - DPRINTF(" "HWADDR_FMT_plx" -> %p is present\n", reventry->pa= ddr_index, - reventry->vaddr_req); + trace_xen_ram_addr_from_mapcache_found(reventry->paddr_index, + reventry->vaddr_req); } abort(); return 0; @@ -416,7 +409,7 @@ ram_addr_t xen_ram_addr_from_mapcache(void *ptr) entry =3D entry->next; } if (!entry) { - DPRINTF("Trying to find address %p that is not in the mapcache!\n"= , ptr); + trace_xen_ram_addr_from_mapcache_not_in_cache(ptr); raddr =3D 0; } else { raddr =3D (reventry->paddr_index << MCACHE_BUCKET_SHIFT) + @@ -443,9 +436,12 @@ static void xen_invalidate_map_cache_entry_unlocked(ui= nt8_t *buffer) } } if (!found) { - DPRINTF("%s, could not find %p\n", __func__, buffer); + trace_xen_invalidate_map_cache_entry_unlocked_not_found(buffer); QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) { - DPRINTF(" "HWADDR_FMT_plx" -> %p is present\n", reventry->pa= ddr_index, reventry->vaddr_req); + trace_xen_invalidate_map_cache_entry_unlocked_found( + reventry->paddr_index, + reventry->vaddr_req + ); } return; } @@ -463,7 +459,7 @@ static void xen_invalidate_map_cache_entry_unlocked(uin= t8_t *buffer) entry =3D entry->next; } if (!entry) { - DPRINTF("Trying to unmap address %p that is not in the mapcache!\n= ", buffer); + trace_xen_invalidate_map_cache_entry_unlocked_miss(buffer); return; } entry->lock--; @@ -502,9 +498,8 @@ void xen_invalidate_map_cache(void) if (!reventry->dma) { continue; } - fprintf(stderr, "Locked DMA mapping while invalidating mapcache!" - " "HWADDR_FMT_plx" -> %p is present\n", - reventry->paddr_index, reventry->vaddr_req); + trace_xen_invalidate_map_cache(reventry->paddr_index, + reventry->vaddr_req); } =20 for (i =3D 0; i < mapcache->nr_buckets; i++) { @@ -562,24 +557,23 @@ static uint8_t *xen_replace_cache_entry_unlocked(hwad= dr old_phys_addr, entry =3D entry->next; } if (!entry) { - DPRINTF("Trying to update an entry for "HWADDR_FMT_plx \ - "that is not in the mapcache!\n", old_phys_addr); + trace_xen_replace_cache_entry_unlocked(old_phys_addr); return NULL; } =20 address_index =3D new_phys_addr >> MCACHE_BUCKET_SHIFT; address_offset =3D new_phys_addr & (MCACHE_BUCKET_SIZE - 1); =20 - fprintf(stderr, "Replacing a dummy mapcache entry for "HWADDR_FMT_plx \ - " with "HWADDR_FMT_plx"\n", old_phys_addr, new_phys_addr); + trace_xen_replace_cache_entry_dummy(old_phys_addr, new_phys_addr); =20 xen_remap_bucket(entry, entry->vaddr_base, cache_size, address_index, false); if (!test_bits(address_offset >> XC_PAGE_SHIFT, test_bit_size >> XC_PAGE_SHIFT, entry->valid_mapping)) { - DPRINTF("Unable to update a mapcache entry for "HWADDR_FMT_plx"!\n= ", - old_phys_addr); + trace_xen_replace_cache_entry_unlocked_could_not_update_entry( + old_phys_addr + ); return NULL; } =20 --=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 From nobody Tue Nov 26 16:48:00 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=1705662953; cv=none; d=zohomail.com; s=zohoarc; b=T0DEgPZDfev7P0e4iPAGyrZdVtIp2F0BaSrjqHEMj2Wdckg2mFQrHFjDm/zjgCANAhlESclD/GZjAuX6apCrmSEA9pK1RCX/1rdewPaPUpIMO8F/r+QNYomp9fABEdJiKOg+MyMb+3cHyLc+Cgn/DCtj96Ml9LiPb+2hY+p75r0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705662953; 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=KXo1YLt845Pt2zK9FJiS5jPZDy9N656n9fSj/iWqSqs=; b=FnlAC1jvDHsYI4Hjg2/9CdGJaNfqgteCHSgdNDcv8DfVHYERffr2iVobsjUVVoFkEbM2x6P1JIloiwg38z2tC0xtJlG5+pLhZbduAWupx301Rej7ySkfdHPf7a6iFsRgrfbeNqg+lhQryRO/J4MoJOle7joAjOj0tFDsNQW0HhA= 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 1705662953022813.0198536067306; Fri, 19 Jan 2024 03:15:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQmpj-0007al-2O; Fri, 19 Jan 2024 06:14:47 -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 1rQmpd-0007XB-4z for qemu-devel@nongnu.org; Fri, 19 Jan 2024 06:14:41 -0500 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQmpY-0007Kj-KH for qemu-devel@nongnu.org; Fri, 19 Jan 2024 06:14:40 -0500 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a2f22bfb4e6so63045166b.0 for ; Fri, 19 Jan 2024 03:14:35 -0800 (PST) Received: from localhost.localdomain (adsl-114.109.242.227.tellas.gr. [109.242.227.114]) by smtp.gmail.com with ESMTPSA id vq9-20020a170907a4c900b00a2ca97242d5sm9283321ejc.120.2024.01.19.03.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 03:14:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705662874; x=1706267674; 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=KXo1YLt845Pt2zK9FJiS5jPZDy9N656n9fSj/iWqSqs=; b=uobO0qKXtRm5z94cMWLe/8qpUxOeGkvjP2RP1OYzvKF65uNE9McURJlI3OSK3zY9dk 3dNP6APiWJO8DPZ1AllUnSaNrJngP4U2cZQIBht37P537U7mbsndGfh4NrXYB/W076CJ kXR1g+cbrYtWKnGw0FQUm0xGkeq18GXXGTaeAtOw8hpGfjmRF/s+hSrwaw7BX457oswW USUfNoN0b9JWhXPZ8iA1R+g/2RCl0ARBXg2oClb+tMB/z6IsPH/cwtaPRf0H+omvUfmv bbRRoQtTxwY6cVTNfniY8QxzRlLec7yk2m6mmywbfdM2jLTDDSOkCMsJMTgS60FhMka0 9wkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705662874; x=1706267674; 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=KXo1YLt845Pt2zK9FJiS5jPZDy9N656n9fSj/iWqSqs=; b=A/qC+IFNi1uCgrorxgduD7L0jtzJxqktkqFffKtJTs/ef+2YWdo90uhygLo5st5nVO P3ks0mAPAJKhJonWZnyvKGv8HL62MJADfAy4Ub27wOPA2ExBTOH8TM2wjLO/RFFDu0ho 38JNk1pp2zON5o0nEdU9y+42PrL9+XT1D8RgI/n/uqanD83qzMc7N2tQSHg3fErIW1yA FlrU5IrXB9jrW+hodjN0d/It2DL9WuDXZ24q8vLhCyQHTpwNlyqG17d5XSQmelmoAu1P goCj6P/4R/VWG4MeefwSNGkDlZy5wFM4y+i3UGdvjzwbw+uqGGjWdygYrLyJgksWmBwC x96Q== X-Gm-Message-State: AOJu0YxPwBAqjggcQKSujBw6WECPkHOhpr8NZ5kddfV5RXJDP/Qukgqg SY9xJHP0N1uZnknIKE131kInEQJRMLWjH4drMmKgTwxiW/kQf8fNpMchP1FIcoMZXEq7DjU9Lm0 6m08= X-Google-Smtp-Source: AGHT+IEznSjLNMGlwr+n5quX1ep6ZKbJviBM6ONBmekQp5grAezV23Bo31idmqA5vcPLRjRQH2xw9w== X-Received: by 2002:a17:906:3b0f:b0:a28:abb3:dd74 with SMTP id g15-20020a1709063b0f00b00a28abb3dd74mr1321523ejf.81.1705662874037; Fri, 19 Jan 2024 03:14:34 -0800 (PST) From: Manos Pitsidianakis To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH 5/6] hw/xen/xen-hvm-common.c: convert DPRINTF to tracepoints Date: Fri, 19 Jan 2024 13:14:23 +0200 Message-Id: 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::632; envelope-from=manos.pitsidianakis@linaro.org; helo=mail-ej1-x632.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: 1705662953486100001 Content-Type: text/plain; charset="utf-8" Tracing DPRINTFs to stderr might not be desired. A developer that relies on tracepoints should be able to opt-in to each tracepoint 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 tracepoints. Signed-off-by: Manos Pitsidianakis --- hw/xen/trace-events | 10 +++++++++- hw/xen/xen-hvm-common.c | 35 ++++++++++++++++++----------------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/hw/xen/trace-events b/hw/xen/trace-events index 1b748dba09..dd5b5a7f35 100644 --- a/hw/xen/trace-events +++ b/hw/xen/trace-events @@ -42,7 +42,7 @@ xs_node_vscanf(char *path, char *value) "%s %s" xs_node_watch(char *path) "%s" xs_node_unwatch(char *path) "%s" =20 -# xen-hvm.c +# xen-hvm-common.c xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: 0x%l= x, size 0x%lx" xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_di= rty) "0x%"PRIx64" size 0x%lx, log_dirty %i" handle_ioreq(void *req, uint32_t type, uint32_t dir, uint32_t df, uint32_t= data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) = "I/O=3D%p type=3D%d dir=3D%d df=3D%d ptr=3D%d port=3D0x%"PRIx64" data=3D0x%= "PRIx64" count=3D%d size=3D%d" @@ -55,6 +55,14 @@ cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uin= t32_t data_is_ptr, uint6 xen_map_resource_ioreq(uint32_t id, void *addr) "id: %u addr: %p" cpu_ioreq_config_read(void *req, uint32_t sbdf, uint32_t reg, uint32_t siz= e, uint32_t data) "I/O=3D%p sbdf=3D0x%x reg=3D%u size=3D%u data=3D0x%x" cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_t reg, uint32_t si= ze, uint32_t data) "I/O=3D%p sbdf=3D0x%x reg=3D%u size=3D%u data=3D0x%x" +cpu_get_ioreq_from_shared_memory_req_not_ready(int state, int data_is_ptr,= uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O request = not ready: 0x%x, ptr: 0x%x, port: 0x%"PRIx64", data: 0x%"PRIx64", count: %u= , size: %u" +xen_main_loop_prepare_init_cpu(int id, void *cpu) "cpu_by_vcpu_id[%d]=3D%p" +xen_map_ioreq_server_shared_page(long unsigned int ioreq_pfn) "shared page= at pfn 0x%lx" +xen_map_ioreq_server_buffered_io_page(long unsigned int ioreq_pfn) "buffer= ed io page at pfn 0x%lx" +xen_map_ioreq_server_buffered_io_evtchn(int bufioreq_evtchn) "buffered io = evtchn is 0x%x" +destroy_hvm_domain_cannot_acquire_handle(void) "Cannot acquire xenctrl han= dle" +destroy_hvm_domain_failed_action(const char *action, int sts, char *errno_= s) "xc_domain_shutdown failed to issue %s, sts %d, %s" +destroy_hvm_domain_action(int xen_domid, const char *action) "Issued domai= n %d %s" =20 # xen-mapcache.c xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64 diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index 47e6cb1db3..05a29c6f11 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -169,11 +169,12 @@ static ioreq_t *cpu_get_ioreq_from_shared_memory(XenI= OState *state, int vcpu) ioreq_t *req =3D xen_vcpu_ioreq(state->shared_page, vcpu); =20 if (req->state !=3D STATE_IOREQ_READY) { - DPRINTF("I/O request not ready: " - "%x, ptr: %x, port: %"PRIx64", " - "data: %"PRIx64", count: %u, size: %u\n", - req->state, req->data_is_ptr, req->addr, - req->data, req->count, req->size); + trace_cpu_get_ioreq_from_shared_memory_req_not_ready(req->state, + req->data_is_= ptr, + req->addr, + req->data, + req->count, + req->size); return NULL; } =20 @@ -601,10 +602,9 @@ static void xen_main_loop_prepare(XenIOState *state) if (evtchn_fd !=3D -1) { CPUState *cpu_state; =20 - DPRINTF("%s: Init cpu_by_vcpu_id\n", __func__); CPU_FOREACH(cpu_state) { - DPRINTF("%s: cpu_by_vcpu_id[%d]=3D%p\n", - __func__, cpu_state->cpu_index, cpu_state); + trace_xen_main_loop_prepare_init_cpu(cpu_state->cpu_index, + cpu_state); state->cpu_by_vcpu_id[cpu_state->cpu_index] =3D cpu_state; } qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, state); @@ -681,7 +681,7 @@ static int xen_map_ioreq_server(XenIOState *state) } =20 if (state->shared_page =3D=3D NULL) { - DPRINTF("shared page at pfn %lx\n", ioreq_pfn); + trace_xen_map_ioreq_server_shared_page(ioreq_pfn); =20 state->shared_page =3D xenforeignmemory_map(xen_fmem, xen_domid, PROT_READ | PROT_WRITE, @@ -693,7 +693,7 @@ static int xen_map_ioreq_server(XenIOState *state) } =20 if (state->buffered_io_page =3D=3D NULL) { - DPRINTF("buffered io page at pfn %lx\n", bufioreq_pfn); + trace_xen_map_ioreq_server_buffered_io_page(bufioreq_pfn); =20 state->buffered_io_page =3D xenforeignmemory_map(xen_fmem, xen_dom= id, PROT_READ | PROT_WR= ITE, @@ -709,7 +709,7 @@ static int xen_map_ioreq_server(XenIOState *state) return -1; } =20 - DPRINTF("buffered io evtchn is %x\n", bufioreq_evtchn); + trace_xen_map_ioreq_server_buffered_io_evtchn(bufioreq_evtchn); =20 state->bufioreq_remote_port =3D bufioreq_evtchn; =20 @@ -737,16 +737,17 @@ void destroy_hvm_domain(bool reboot) =20 xc_handle =3D xc_interface_open(0, 0, 0); if (xc_handle =3D=3D NULL) { - fprintf(stderr, "Cannot acquire xenctrl handle\n"); + trace_destroy_hvm_domain_cannot_acquire_handle(); } else { sts =3D xc_domain_shutdown(xc_handle, xen_domid, reason); if (sts !=3D 0) { - fprintf(stderr, "xc_domain_shutdown failed to issue %s, " - "sts %d, %s\n", reboot ? "reboot" : "poweroff", - sts, strerror(errno)); + trace_destroy_hvm_domain_failed_action( + reboot ? "reboot" : "poweroff", sts, strerror(errno) + ); } else { - fprintf(stderr, "Issued domain %d %s\n", xen_domid, - reboot ? "reboot" : "poweroff"); + trace_destroy_hvm_domain_action( + xen_domid, reboot ? "reboot" : "poweroff" + ); } xc_interface_close(xc_handle); } --=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 From nobody Tue Nov 26 16:48:00 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=1705662975; cv=none; d=zohomail.com; s=zohoarc; b=m5qSqGk0S3DK3+J2YFYbQ2Em4OPha5sro9ldxl5tS0mjFZnBbyvbIPu7a3fRwVB10JQELtRbqX1mJBi7agfsOGrfd8uS+FWnzs6YmorYlv3puCTlufInH0re238lNptlgoHeKDK2kqeP9pMVJIVKP2DpTtAvmK1pg/wSniPvTGw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705662975; 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=YfuQXxmvX9JAP4TN/xfu2dZ/IwBEFTowVO1pKbfDK8M=; b=Gh4y0CyBQH6zLXbqt4Kku+6ZwzteRTjYefUdW53Pj33/hTvrCF+xFeM9G+pp6fzrNC4t8rtB+i2lEvOS/LR7QG3QOCd04lqVWPag32vGaG7tuTCLf7BaDa7xvhwiGPxyHWSWhYJSmaAkYfxLNQDb2zSWGhT2bvOyZmku3TJ/iDA= 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 1705662975246327.19795024707673; Fri, 19 Jan 2024 03:16:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQmpj-0007bg-Qq; Fri, 19 Jan 2024 06:14:47 -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 1rQmpd-0007XE-5M for qemu-devel@nongnu.org; Fri, 19 Jan 2024 06:14:41 -0500 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQmpa-0007L5-HN for qemu-devel@nongnu.org; Fri, 19 Jan 2024 06:14:40 -0500 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-55a5e7fa471so438008a12.1 for ; Fri, 19 Jan 2024 03:14:36 -0800 (PST) Received: from localhost.localdomain (adsl-114.109.242.227.tellas.gr. [109.242.227.114]) by smtp.gmail.com with ESMTPSA id vq9-20020a170907a4c900b00a2ca97242d5sm9283321ejc.120.2024.01.19.03.14.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 03:14:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705662875; x=1706267675; 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=YfuQXxmvX9JAP4TN/xfu2dZ/IwBEFTowVO1pKbfDK8M=; b=j1nNlSSLcERYw9DYo2XNheUZh05Q6rrQ68bCB2+bN/iREWZ+/FB8rXKOFxvbLA8Hhy Nlvm0BdT+9w9rhAPZPVfsDRkaxe2CXN91RwZweZ3nGP5Ru3Rot+z3TQ70mdeXwBf1WkE WmaF23kAiLPoE55X6hkrlonF/KIfpBkFhhYM4lZ+FqOMwBKJQ1XuhWOkGYcj+ptT/c8i YcbWnWAFVFP5/3K8rrC59AATJaBiUbZ9oH4rgJwCY9qEZSKCsywlV2DMmqS90eUpnqVM A46tR6P4k5NmyrDyj+qHwT0AunzzXLQ+w+6BUMjHfAwUJfnpX9UkZ6FYO5zlBtcDGXVX OdjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705662875; x=1706267675; 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=YfuQXxmvX9JAP4TN/xfu2dZ/IwBEFTowVO1pKbfDK8M=; b=jDfeFgbgPMeXK223VEzpQrLxr383Gt+1ItndaSjjcx3wq25BQ7swiB0BYCQYgN1Rlb +nRl+YYaF6lkxeVo1AXYYYIMPPPQIvo5D2FxwmLgJvCOYi2+ErfV8nUIBUhitbV2GI0y ol9rS4r4m1BHSu0EArVJzIjXdPyANdpFjtH1BZbN1iQwkHfzUSUyfWAyLMerh+6VKLwv iFnE84L0pbPtA/hZAVJCowHG3jdBj1PhAGRxWA0CaugVufn3l0tf14FkwCIt4S/BV4Id GqKWk4FRynzIHb8T1BnRZBdsIDcadfstuOsouQuWiwNv8e0kI8PteS4KLGeaffytTArJ o6GQ== X-Gm-Message-State: AOJu0YwF28sKdBPNybd9XvC4Bgh9VNaxN44+QEzfJffAQgimeKl0PxCY 1o/U2FzKEjqMTq6JWUiUq7OnFiyhReEhQx/e4WB99QuO9PijAHM2CXI+A9mZqFwrEVeDiCSviZN dn2g= X-Google-Smtp-Source: AGHT+IF4AKB3i0EE93JVm2SSXHrrPDR51ugIZukdaXM3CyfR1H0BSql7r9j8TEJPqMkdOzhg3JEZ+A== X-Received: by 2002:a17:906:5592:b0:a2c:2185:6dfe with SMTP id y18-20020a170906559200b00a2c21856dfemr1442314ejp.105.1705662875311; Fri, 19 Jan 2024 03:14:35 -0800 (PST) From: Manos Pitsidianakis To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH 6/6] hw/xen: convert stderr prints to error/warn reports Date: Fri, 19 Jan 2024 13:14:24 +0200 Message-Id: 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::52f; envelope-from=manos.pitsidianakis@linaro.org; helo=mail-ed1-x52f.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1705662975546100001 Content-Type: text/plain; charset="utf-8" According to the QEMU Coding Style document: > Do not use printf(), fprintf() or monitor_printf(). Instead, use > error_report() or error_vreport() from error-report.h. This ensures the > error is reported in the right place (current monitor or stderr), and in > a uniform format. > Use error_printf() & friends to print additional information. This commit changes fprintfs that report warnings and errors to the appropriate report functions. Signed-off-by: Manos Pitsidianakis --- hw/xen/xen-hvm-common.c | 12 ++++++------ hw/xen/xen-mapcache.c | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index 05a29c6f11..baa1adb9f2 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -20,8 +20,8 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, = MemoryRegion *mr, =20 if (runstate_check(RUN_STATE_INMIGRATE)) { /* RAM already populated in Xen */ - fprintf(stderr, "%s: do not alloc "RAM_ADDR_FMT - " bytes of ram at "RAM_ADDR_FMT" when runstate is INMIGRAT= E\n", + warn_report("%s: do not alloc "RAM_ADDR_FMT + " bytes of ram at "RAM_ADDR_FMT" when runstate is INMIGRAT= E", __func__, size, ram_addr); return; } @@ -552,9 +552,9 @@ static void cpu_handle_ioreq(void *opaque) req->data =3D copy.data; =20 if (req->state !=3D STATE_IOREQ_INPROCESS) { - fprintf(stderr, "Badness in I/O request ... not in service?!: " + warn_report("Badness in I/O request ... not in service?!: " "%x, ptr: %x, port: %"PRIx64", " - "data: %"PRIx64", count: %u, size: %u, type: %u\n", + "data: %"PRIx64", count: %u, size: %u, type: %u", req->state, req->data_is_ptr, req->addr, req->data, req->count, req->size, req->type); destroy_hvm_domain(false); @@ -758,9 +758,9 @@ void xen_shutdown_fatal_error(const char *fmt, ...) va_list ap; =20 va_start(ap, fmt); - vfprintf(stderr, fmt, ap); + error_vreport(fmt, ap); va_end(ap); - fprintf(stderr, "Will destroy the domain.\n"); + error_report("Will destroy the domain."); /* destroy the domain */ qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_ERROR); } diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c index 336c212376..4f956d048e 100644 --- a/hw/xen/xen-mapcache.c +++ b/hw/xen/xen-mapcache.c @@ -347,9 +347,8 @@ tryagain: MapCacheRev *reventry =3D g_new0(MapCacheRev, 1); entry->lock++; if (entry->lock =3D=3D 0) { - fprintf(stderr, - "mapcache entry lock overflow: "HWADDR_FMT_plx" -> %p\= n", - entry->paddr_index, entry->vaddr_base); + error_report("mapcache entry lock overflow: "HWADDR_FMT_plx" -= > %p", + entry->paddr_index, entry->vaddr_base); abort(); } reventry->dma =3D dma; --=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