From patchwork Thu Jan 16 22:36:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 857931 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:cc8:b0:385:e875:8a9e with SMTP id dq8csp434533wrb; Thu, 16 Jan 2025 14:37:03 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV+9IvhSs5s6fSfOw9A4WTW9sWPy9qV3VboCe2CBqD6QgVujRya2fFnJh7ZRwpZMavPB515Fw==@linaro.org X-Google-Smtp-Source: AGHT+IEEkv9igl2zp7JEQfxkPUKSfZG2uE6d2hJLfNSVQpYLo3AmlnuzXgcnOCaCazwxWhpQbVKs X-Received: by 2002:a05:6214:2aa8:b0:6e1:a2c8:4a1f with SMTP id 6a1803df08f44-6e1b22359b2mr9153566d6.41.1737067023205; Thu, 16 Jan 2025 14:37:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737067023; cv=none; d=google.com; s=arc-20240605; b=WFrL4PUPJDn913YojyzENaS68rY/BZTnkOprxrXG6mPOSxB4adGgRv/cKdPKqDh9oB ANiPUFfUTxohemLuOXuV8vAf0PNwPzV0Y3azrGIctLhE/xfaCp4B6yXXwAqeEMv2qku2 lPquSce218SzO6wXsQ51oFrKfrV0J1/MPZ9+0p7pCEFtbhgrVzbcIS3F7FOmOy9s61aX rtjHs3w/hfeQ+gLgSUfQJEOWKxx9rp8SpVmAs5kOgSJn5zoSBwEhbJsvk9XyBLfO7VYj i2h7L4nHrFYSza2uC7Fa0QZ7kHUZEg+GSto7D96dZzFtZM8osg0bcReokJXgXr7Pqzru FQsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=NEWcwlZ3rL0pM1lPXHd3q45mvxB7AAKYo4rVKUiR+b0=; fh=LUOAIpTXU/susaBUt8ZDAWQJwDKfNNixIeTpHft4tng=; b=EasNNzxm0KbDFBO79FWS+BlMd851T8kLFzP2btKqxXf07VVk6yTpjVk9USY2KXEYP6 kkrUJzQvMrWTgpsgJ62VrbmVZlL+I3/ZLa3gD9/g+DzwdZEc71HEcKrGy80MpPJrJXnY gDvJd8dFm3OpIOq/qGcC20YK03XI5UhqNbfKznOmLgxjVV8mD8IOaF2JDgGLKd2q/+Lo om42bPihWzlSFNUmOav3frYz9/bHAsXcxcbj81Pq3JEQ+t5vTX4tlSVDJjbdnRaOfVZv sl7+DFALRVnhiHLAOihkD+EH6QqGXIVC9stVl4WEAV8pCCV4uoAcROzJ6nn8nlJS3qME sPKw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jtRW/7Ak"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46e1048ac4dsi10183831cf.483.2025.01.16.14.37.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Jan 2025 14:37:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jtRW/7Ak"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYYTO-0000ez-H9; Thu, 16 Jan 2025 17:36:22 -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 1tYYTH-0000e5-Tv for qemu-devel@nongnu.org; Thu, 16 Jan 2025 17:36:15 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tYYTG-00009c-6x for qemu-devel@nongnu.org; Thu, 16 Jan 2025 17:36:15 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-436ce2ab251so9753775e9.1 for ; Thu, 16 Jan 2025 14:36:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737066972; x=1737671772; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=NEWcwlZ3rL0pM1lPXHd3q45mvxB7AAKYo4rVKUiR+b0=; b=jtRW/7Aknpi6jRHth7kSgyUQNe9nyKiVWSvz0ZQeItzSdsCFoDgDbYpELSN7qbME42 eZb30poq+3geRgcH7q23H89IPsdbbiac2cqKnM6tkEGREK05b2lC1/PlLRgnAVyHJ8tO W+dObCZkfTFEToq0kvhp47TsCHedrT/w5ZcO2Kd6WDvTyiUF0DwO9IU8kQkYgoBh6jz5 VwnQAyvV3Vo96/S59XcG+oM9cUxBb958W7X252F0eeAvYRdOM/cEfup4WNO8BgtGz6Rr 5U/mPB70jLgClpgt0IoNgFvzvsEhoomJ3nO3NGn2e7WFQzg714AHX5rnAEe2JSoOX+G6 DI/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737066972; x=1737671772; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NEWcwlZ3rL0pM1lPXHd3q45mvxB7AAKYo4rVKUiR+b0=; b=Ah1zit7VLFl5t279QUBuBZd+qHuDAabK1DwSun8prX6ju2H8ZqUzVSBj84xKX5oTl7 LsdJpEeym2BVjDgO7lLjlyhEzXCkBJ36nGinkVZR+d+mLFd1wh3ZmCK6I4qHZeN3TKDw uAluUXUpNhX1K6dYIOUn1iLY65cJoQ+wV6zQKBvF7lgvh6ewmn3TKYscrIAtIK5eWuIp ohWZdTUQ5W4wrXBPU2ZvKJNEb7msZI6bqzxIR4GfnML7uaZxSCNDijAbyIbO8UBUY3rQ Ed7Mbhn4/Eb4gir0IV98FKRs6Rmcr44XfbkBtfX+zBBquMr7kKzN39hyVzLPgz1GZg2y t+UA== X-Gm-Message-State: AOJu0YyjvBKGFKDJsWeFjj4FJzI60I4bmYMm8oqKCMEW/RrF4qcFNwuL u7vgC5Mj3fR3wYYOlupX1BXn8dV3dneHiqKcZZr2xp8IQQrwBf7LZtT3et4QT8/JIulzb81mW7S EyO0= X-Gm-Gg: ASbGnct34xdXHy5cONahk4MNjKlOXUqFesI4APuzc4bsdSCkXLGqmj9Mg7K4abp5SMe 3xfszj8BS6MMzt/Ns1d0pFqVjDwj7nBOGLWrmGWhBhi5XAn9qMvvk3BZAa+cU6naaCRLe6fw2iJ HMyy6iTO3LLKbDaygcOrZTOxNy47BrPTK8bDFukfJB2NTtbHH0trsFGX6fHyBAajL16i+Y41Xt8 nB3v7bX8manBYLPnqegjsJfrUMPx58S08RQEdfNlXcfax9IDh4dO57ekMu93cMoWOvrOtV4qu8t 5+w0OfmebLYJZkVXiYxw2peodbLcpgA= X-Received: by 2002:a05:600c:511b:b0:432:d797:404a with SMTP id 5b1f17b1804b1-4389142e0e8mr3056075e9.22.1737066972163; Thu, 16 Jan 2025 14:36:12 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438904625e5sm12313865e9.32.2025.01.16.14.36.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 16 Jan 2025 14:36:11 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alistair Francis , qemu-riscv@nongnu.org, Palmer Dabbelt , Liu Zhiwei , Bin Meng , Daniel Henrique Barboza , Weiwei Li , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH] hw/char/riscv_htif: Convert HTIF_DEBUG() to trace events Date: Thu, 16 Jan 2025 23:36:09 +0100 Message-ID: <20250116223609.81594-1-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis --- hw/char/riscv_htif.c | 15 +++------------ hw/char/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/hw/char/riscv_htif.c b/hw/char/riscv_htif.c index 11a0e1a7b7d..ec5db5a597f 100644 --- a/hw/char/riscv_htif.c +++ b/hw/char/riscv_htif.c @@ -32,14 +32,7 @@ #include "exec/tswap.h" #include "system/dma.h" #include "system/runstate.h" - -#define RISCV_DEBUG_HTIF 0 -#define HTIF_DEBUG(fmt, ...) \ - do { \ - if (RISCV_DEBUG_HTIF) { \ - qemu_log_mask(LOG_TRACE, "%s: " fmt "\n", __func__, ##__VA_ARGS__);\ - } \ - } while (0) +#include "trace.h" #define HTIF_DEV_SHIFT 56 #define HTIF_CMD_SHIFT 48 @@ -159,8 +152,7 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written) uint64_t payload = val_written & 0xFFFFFFFFFFFFULL; int resp = 0; - HTIF_DEBUG("mtohost write: device: %d cmd: %d what: %02" PRIx64 - " -payload: %016" PRIx64 "\n", device, cmd, payload & 0xFF, payload); + trace_htif_uart_write_to_host(device, cmd, payload); /* * Currently, there is a fixed mapping of devices: @@ -251,8 +243,7 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written) } } else { qemu_log("HTIF unknown device or command\n"); - HTIF_DEBUG("device: %d cmd: %d what: %02" PRIx64 - " payload: %016" PRIx64, device, cmd, payload & 0xFF, payload); + trace_htif_uart_unknown_device_command(device, cmd, payload); } /* * Latest bbl does not set fromhost to 0 if there is a value in tohost. diff --git a/hw/char/trace-events b/hw/char/trace-events index 3ee7cfcdff2..b2e3d25ae34 100644 --- a/hw/char/trace-events +++ b/hw/char/trace-events @@ -136,3 +136,7 @@ stm32f2xx_usart_read(char *id, unsigned size, uint64_t ofs, uint64_t val) " %s s stm32f2xx_usart_write(char *id, unsigned size, uint64_t ofs, uint64_t val) "%s size %d ofs 0x%02" PRIx64 " <- 0x%02" PRIx64 stm32f2xx_usart_drop(char *id) " %s dropping the chars" stm32f2xx_usart_receive(char *id, uint8_t chr) " %s receiving '%c'" + +# riscv_htif.c +htif_uart_write_to_host(uint8_t device, uint8_t cmd, uint64_t payload) "device: %u cmd: %02u payload: %016" PRIx64 +htif_uart_unknown_device_command(uint8_t device, uint8_t cmd, uint64_t payload) "device: %u cmd: %02u payload: %016" PRIx64