From nobody Tue Feb 10 20:14:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152960187486938.1319501779534; Thu, 21 Jun 2018 10:24:34 -0700 (PDT) Received: from localhost ([::1]:56846 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fW3Jy-0004s0-3a for importer@patchew.org; Thu, 21 Jun 2018 13:24:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fW39R-00054E-JO for qemu-devel@nongnu.org; Thu, 21 Jun 2018 13:13:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fW39P-0002Go-Ok for qemu-devel@nongnu.org; Thu, 21 Jun 2018 13:13:41 -0400 Received: from mail-qt0-x22c.google.com ([2607:f8b0:400d:c0d::22c]:44747) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fW39P-0002Ga-Ib; Thu, 21 Jun 2018 13:13:39 -0400 Received: by mail-qt0-x22c.google.com with SMTP id x5-v6so2802528qte.11; Thu, 21 Jun 2018 10:13:39 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id t14-v6sm3166159qtp.65.2018.06.21.10.13.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jun 2018 10:13:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8lxHEY1hwZ5p2Byd+3k4fljeLFiWOxsj4S6SPtGUAn8=; b=gMmu9P5yHTraKGMdiWZONbChp2vy2RX3WbyNAbrS7YvPDbiSlCEyYigwhMJBx7aGG0 Zh6MZ7h5TR7Wuw9hn5gU8zcSwOcs/R0CtDyae25Kaq4DRkvrQeptHDzWOUm3WlGDLBZY SKeXC19f+2ZmzBu70whsqWgF8e3NPt3Z2iQBnLtmODzeqX8YiQ/ApQ9OI0MgnLZAFR2h 1COjM00x0bcvVESLB7re+uee1niJJQmXIiEYeQd5+ROHjZ3LIO2k9EQGl4JCD0iK0jLk K/zqqK9YpaBOrlMmWjxX0CPFdo3GlGs5+eZCJJGqRD7S3yXsPQ/AWKp2AhW8cTzSgyuU qBfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8lxHEY1hwZ5p2Byd+3k4fljeLFiWOxsj4S6SPtGUAn8=; b=fU+40gK5xBGoQdGc7KY7rg/qvj5VzJ3QoxmOmhDZK3KR09bz5eQTuN0FQbtUKsJ3Pl nIaJ06HeTZ96oiIJshuPl3cc8+G9CB712KvQCBWPCzatrMhXn29mYOIW2Qt2U4UAu3Pz R5ABcO5+DQpUifq9DNq50cvwIAYPDlmJh6N5xZFVs5FtppkcqZa+lXOSTykS/qsemNfg wOqOPdWZEjm9JKgFwV6ekRYL3wPeZ0JklxZywX8beADBVh/idwJOr5/0MkRMZYmmB8St 08TIf4w/VhF8QzxjQA/f9gEuyKUVr7BpXeixxCZnr0kmzRqsyOncPUKDX/kbnDyk7JsO H01Q== X-Gm-Message-State: APt69E0025mmAPng3xmUnl7Aiax8iqJKrcvT9nUap8Yuann5QgHaraGU pf0xedojufEAA0PzFH+bBZw= X-Google-Smtp-Source: ADUXVKIGl4qBxF+QJpWktPe9YgSoCk7/7nGM6M1ftyQXt3X+81/qFMZUC/YrFs+V1FK6Iwrvuy8ZFA== X-Received: by 2002:ac8:41d5:: with SMTP id o21-v6mr23905114qtm.265.1529601218871; Thu, 21 Jun 2018 10:13:38 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Stefan Hajnoczi Date: Thu, 21 Jun 2018 14:12:57 -0300 Message-Id: <20180621171257.14897-12-f4bug@amsat.org> X-Mailer: git-send-email 2.18.0.rc2 In-Reply-To: <20180621171257.14897-1-f4bug@amsat.org> References: <20180621171257.14897-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::22c Subject: [Qemu-devel] [PATCH 11/11] hw/block/pflash_cfi: Convert from DPRINTF() macro to trace events X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-devel@nongnu.org, "open list:Block layer core" , qemu-trivial@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/block/pflash_cfi01.c | 42 +++++++++++++++-------------------------- hw/block/pflash_cfi02.c | 18 +++++++++--------- hw/block/trace-events | 13 +++++++++++++ 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index e4b5b3c273..bffb4c40e7 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -47,6 +47,7 @@ #include "qemu/log.h" #include "hw/sysbus.h" #include "sysemu/sysemu.h" +#include "trace.h" =20 #define PFLASH_BUG(fmt, ...) \ do { \ @@ -120,7 +121,7 @@ static void pflash_timer (void *opaque) { pflash_t *pfl =3D opaque; =20 - DPRINTF("%s: command %02x done\n", __func__, pfl->cmd); + trace_pflash_timer_expired(pfl->cmd); /* Reset flash */ pfl->status ^=3D 0x80; memory_region_rom_device_set_romd(&pfl->mem, true); @@ -218,15 +219,14 @@ static uint32_t pflash_devid_query(pflash_t *pfl, hwa= ddr offset) switch (boff & 0xFF) { case 0: resp =3D pfl->ident0; - DPRINTF("%s: Manufacturer Code %04x\n", __func__, resp); + trace_pflash_manufacturer_id(resp); break; case 1: resp =3D pfl->ident1; - DPRINTF("%s: Device ID Code %04x\n", __func__, resp); + trace_pflash_device_id(resp); break; default: - DPRINTF("%s: Read Device Information offset=3D%x\n", __func__, - (unsigned)offset); + trace_pflash_device_info(offset); return 0; break; } @@ -251,8 +251,7 @@ static uint32_t pflash_data_read(pflash_t *pfl, hwaddr = offset, switch (width) { case 1: ret =3D p[offset]; - DPRINTF("%s: data offset " TARGET_FMT_plx " %02x\n", - __func__, offset, ret); + trace_pflash_data_read8(offset, ret); break; case 2: if (be) { @@ -262,8 +261,7 @@ static uint32_t pflash_data_read(pflash_t *pfl, hwaddr = offset, ret =3D p[offset]; ret |=3D p[offset + 1] << 8; } - DPRINTF("%s: data offset " TARGET_FMT_plx " %04x\n", - __func__, offset, ret); + trace_pflash_data_read16(offset, ret); break; case 4: if (be) { @@ -277,8 +275,7 @@ static uint32_t pflash_data_read(pflash_t *pfl, hwaddr = offset, ret |=3D p[offset + 2] << 16; ret |=3D p[offset + 3] << 24; } - DPRINTF("%s: data offset " TARGET_FMT_plx " %08x\n", - __func__, offset, ret); + trace_pflash_data_read32(offset, ret); break; default: DPRINTF("BUG in %s\n", __func__); @@ -294,11 +291,7 @@ static uint32_t pflash_read (pflash_t *pfl, hwaddr off= set, uint32_t ret; =20 ret =3D -1; - -#if 0 - DPRINTF("%s: reading offset " TARGET_FMT_plx " under cmd %02x width %d= \n", - __func__, offset, pfl->cmd, width); -#endif + trace_pflash_read(offset, pfl->cmd, width, pfl->wcycle); switch (pfl->cmd) { default: /* This should never happen : reset state & treat it as a read */ @@ -349,15 +342,14 @@ static uint32_t pflash_read (pflash_t *pfl, hwaddr of= fset, switch (boff) { case 0: ret =3D pfl->ident0 << 8 | pfl->ident1; - DPRINTF("%s: Manufacturer Code %04x\n", __func__, ret); + trace_pflash_manufacturer_id(ret); break; case 1: ret =3D pfl->ident2 << 8 | pfl->ident3; - DPRINTF("%s: Device ID Code %04x\n", __func__, ret); + trace_pflash_device_id(ret); break; default: - DPRINTF("%s: Read Device Information boff=3D%x\n", __func_= _, - (unsigned)boff); + trace_pflash_device_info(boff); ret =3D 0; break; } @@ -425,9 +417,7 @@ static inline void pflash_data_write(pflash_t *pfl, hwa= ddr offset, { uint8_t *p =3D pfl->storage; =20 - DPRINTF("%s: block write offset " TARGET_FMT_plx - " value %x counter %016" PRIx64 "\n", - __func__, offset, value, pfl->counter); + trace_pflash_data_write(offset, value, width, pfl->counter); switch (width) { case 1: p[offset] =3D value; @@ -466,9 +456,7 @@ static void pflash_write(pflash_t *pfl, hwaddr offset, =20 cmd =3D value; =20 - DPRINTF("%s: writing offset " TARGET_FMT_plx " value %08x width %d wcy= cle 0x%x\n", - __func__, offset, value, width, pfl->wcycle); - + trace_pflash_write(offset, value, width, pfl->wcycle); if (!pfl->wcycle) { /* Set the device in I/O access mode */ memory_region_rom_device_set_romd(&pfl->mem, false); @@ -656,8 +644,8 @@ static void pflash_write(pflash_t *pfl, hwaddr offset, "\n", __func__, offset, pfl->wcycle, pfl->cmd, value); =20 reset_flash: + trace_pflash_reset(); memory_region_rom_device_set_romd(&pfl->mem, true); - pfl->wcycle =3D 0; pfl->cmd =3D 0; } diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index 6c18e5e578..0f8b7b8c7b 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -43,6 +43,7 @@ #include "sysemu/block-backend.h" #include "qemu/host-utils.h" #include "hw/sysbus.h" +#include "trace.h" =20 //#define PFLASH_DEBUG #ifdef PFLASH_DEBUG @@ -124,7 +125,7 @@ static void pflash_timer (void *opaque) { pflash_t *pfl =3D opaque; =20 - DPRINTF("%s: command %02x done\n", __func__, pfl->cmd); + trace_pflash_timer_expired(pfl->cmd); /* Reset flash */ pfl->status ^=3D 0x80; if (pfl->bypass) { @@ -143,8 +144,8 @@ static uint32_t pflash_read (pflash_t *pfl, hwaddr offs= et, uint32_t ret; uint8_t *p; =20 - DPRINTF("%s: offset " TARGET_FMT_plx "\n", __func__, offset); ret =3D -1; + trace_pflash_read(offset, pfl->cmd, width, pfl->wcycle); /* Lazy reset to ROMD mode after a certain amount of read accesses */ if (!pfl->rom_mode && pfl->wcycle =3D=3D 0 && ++pfl->read_counter > PFLASH_LAZY_ROMD_THRESHOLD) { @@ -172,7 +173,7 @@ static uint32_t pflash_read (pflash_t *pfl, hwaddr offs= et, switch (width) { case 1: ret =3D p[offset]; -// DPRINTF("%s: data offset %08x %02x\n", __func__, offset, ret= ); + trace_pflash_data_read8(offset, ret); break; case 2: if (be) { @@ -182,7 +183,7 @@ static uint32_t pflash_read (pflash_t *pfl, hwaddr offs= et, ret =3D p[offset]; ret |=3D p[offset + 1] << 8; } -// DPRINTF("%s: data offset %08x %04x\n", __func__, offset, ret= ); + trace_pflash_data_read16(offset, ret); break; case 4: if (be) { @@ -196,7 +197,7 @@ static uint32_t pflash_read (pflash_t *pfl, hwaddr offs= et, ret |=3D p[offset + 2] << 16; ret |=3D p[offset + 3] << 24; } -// DPRINTF("%s: data offset %08x %08x\n", __func__, offset, ret= ); + trace_pflash_data_read32(offset, ret); break; } break; @@ -274,8 +275,7 @@ static void pflash_write (pflash_t *pfl, hwaddr offset, #endif goto reset_flash; } - DPRINTF("%s: offset " TARGET_FMT_plx " %08x %d %d\n", __func__, - offset, value, width, pfl->wcycle); + trace_pflash_write(offset, value, width, pfl->wcycle); offset &=3D pfl->chip_len - 1; =20 DPRINTF("%s: offset " TARGET_FMT_plx " %08x %d\n", __func__, @@ -345,8 +345,7 @@ static void pflash_write (pflash_t *pfl, hwaddr offset, /* We need another unlock sequence */ goto check_unlock0; case 0xA0: - DPRINTF("%s: write data offset " TARGET_FMT_plx " %08x %d\n", - __func__, offset, value, width); + trace_pflash_data_write(offset, value, width, 0); p =3D pfl->storage; if (!pfl->ro) { switch (width) { @@ -483,6 +482,7 @@ static void pflash_write (pflash_t *pfl, hwaddr offset, =20 /* Reset flash */ reset_flash: + trace_pflash_reset(); pfl->bypass =3D 0; pfl->wcycle =3D 0; pfl->cmd =3D 0; diff --git a/hw/block/trace-events b/hw/block/trace-events index d842c45409..f1017fac39 100644 --- a/hw/block/trace-events +++ b/hw/block/trace-events @@ -4,6 +4,19 @@ fdc_ioport_read(uint8_t reg, uint8_t value) "read reg 0x%02x val 0x%02x" fdc_ioport_write(uint8_t reg, uint8_t value) "write reg 0x%02x val 0x%02x" =20 +# hw/block/pflash_cfi0?.c +pflash_reset(void) "reset" +pflash_read(uint64_t offset, uint8_t cmd, int width, uint8_t wcycle) "offs= et:0x%04"PRIx64" cmd:0x%02x width:%d wcycle:%u" +pflash_write(uint64_t offset, uint32_t value, int width, uint8_t wcycle) "= offset:0x%04"PRIx64" value:0x%03x width:%d wcycle:%u" +pflash_timer_expired(uint8_t cmd) "command 0x%02x done" +pflash_data_read8(uint64_t offset, uint32_t value) "data offset:0x%04"PRIx= 64" value:0x%02x" +pflash_data_read16(uint64_t offset, uint32_t value) "data offset:0x%04"PRI= x64" value:0x%04x" +pflash_data_read32(uint64_t offset, uint32_t value) "data offset:0x%04"PRI= x64" value:0x%08x" +pflash_data_write(uint64_t offset, uint32_t value, int width, uint64_t cou= nter) "data offset:0x%04"PRIx64" value:0x%08x width:%d counter:0x%016"PRIx64 +pflash_manufacturer_id(uint16_t id) "Read Manufacturer ID: 0x%04x" +pflash_device_id(uint16_t id) "Read Device ID: 0x%04x" +pflash_device_info(uint64_t offset) "Read Device Information offset:0x%04l= x" + # hw/block/virtio-blk.c virtio_blk_req_complete(void *vdev, void *req, int status) "vdev %p req %p= status %d" virtio_blk_rw_complete(void *vdev, void *req, int ret) "vdev %p req %p ret= %d" --=20 2.18.0.rc2