From nobody Tue Feb 10 01:00:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1596719126; cv=none; d=zohomail.com; s=zohoarc; b=V82YRy+maADhV/ZBImJobFUddKei4+wxTyZlfPFmGpDqSBZlpbhlD5RXBkjJ5CvHi1ePxL5IbD1vr41Q62iIiM/E4M2LLYtlrlf6i+RxwkCwRGKJVBg+8QfYeEwZ1hdMWbCQFTnsIUD10JExvP0+bGCujalnA4zskjLREtPoPII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596719126; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jHazVKWFQG1I08UcXdjElA+M/Buk1PGFWVHhWqdyCtk=; b=CLjkcoPRMhzaOA0n5tDTwUQzKX1UyAxt7tk+juO0/U5Kvb28ZcY/7K88cPIZqNW+zRaMJSjPxl7VHoaBoRU8+XGV0ohGWrZYVLQzfOAjEWByYFtSGI3kzxYpDvUU2MWm6CWGdKyn6Kog/lVJ9aj6GdeWoZT+vbAvS9dJPtpxzmg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1596719126368138.38046622056675; Thu, 6 Aug 2020 06:05:26 -0700 (PDT) Received: from localhost ([::1]:43662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3faH-0003g5-0E for importer@patchew.org; Thu, 06 Aug 2020 09:05:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3fYj-00021C-LN for qemu-devel@nongnu.org; Thu, 06 Aug 2020 09:03:49 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:55265) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k3fYh-00075h-Vl for qemu-devel@nongnu.org; Thu, 06 Aug 2020 09:03:49 -0400 Received: by mail-wm1-x32f.google.com with SMTP id d190so8762232wmd.4 for ; Thu, 06 Aug 2020 06:03:47 -0700 (PDT) Received: from localhost.localdomain (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id e16sm6409113wrx.30.2020.08.06.06.03.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 06:03:45 -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=jHazVKWFQG1I08UcXdjElA+M/Buk1PGFWVHhWqdyCtk=; b=OxntN/frcBHNx9b5cwy3rKuCoSvXn51ubG8pstgF3YXZuBtISYwHoOLiVeUBGgse/q +cGh5xQ+lBm/yyw0Mh8BkfXuZYGn7E2cSQCvgBu83fTVGZFpEHG98dZerhGHYOANbUBR I4vfAPhkC9nowWg+qNOi0/7Jx6NANhTxkdOF/oCYYDmIHgOBpBDDoPx0GrAoWhLpd/iw v9avX52qYp5vR32Gl4R9tSP27xTYk87kQo0wK5tmdPv79b1V5TJi26mnsWTNGe5RJOg+ qMaH2z0c9oASXiCNBhUCQY0k9/JWjJGOy8EMcYTmG0gY+kexfzuT0biV4sG6p7pMftgL EtZw== 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=jHazVKWFQG1I08UcXdjElA+M/Buk1PGFWVHhWqdyCtk=; b=bhhWetnnKszTDiDbuRS9Vk8Z4k1176x+WQORKrBLQByPmakYbSLruM5WqXXZndWgg6 JDRebNKLsCaaAyhVL6CbE1kd9tynk1PIst4Gh0lGTUWvLLBq5fu6vvEkNdxCy0+RmL8d cN2QdBIunvpwftxt9X29abzJRBUPDposGuF6eTzwC9fpJy/cq5rU65aMO8PdcwTg1Nd1 x90V3ae1GlrG7fdv2KRB3X6SGgY8JZTUuYza7zxC3ZfuIuJCTt2KESiKz4LDWOW+SR0V HiVnCMYQNkf3QV3vCuDvrNEKCQYKVfXQskFeJuh2G+6l2HLtCWIC+GGripLV/7BAJxwd 6l1A== X-Gm-Message-State: AOAM530grizzBzW45AAmPndvvqWyNsOXReltkTwuxwiTHOHfvBUrIR8i aMgKgyvUhNcEugzAFmzdZCF6KtZ+ X-Google-Smtp-Source: ABdhPJxir/XrswmUGJUuuDpyr1NHomRH+s47nQon2K/yUgSexWCGRkT30fVaZb2nEi2s8QZq93TxMg== X-Received: by 2002:a7b:c4d3:: with SMTP id g19mr7657522wmk.29.1596719025811; Thu, 06 Aug 2020 06:03:45 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.2 3/4] hw/char/serial: Let SerialState have an 'id' field Date: Thu, 6 Aug 2020 15:03:39 +0200 Message-Id: <20200806130340.17316-4-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200806130340.17316-1-f4bug@amsat.org> References: <20200806130340.17316-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" 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::32f; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x32f.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Damien Hedde , Peter Maydell , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) When a SoC has multiple UARTs (some configured differently), it is hard to associate events to their UART. To be able to distinct trace events between various instances, add an 'id' field. Update the trace format accordingly. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/hw/char/serial.h | 1 + hw/char/serial.c | 7 ++++--- hw/char/trace-events | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 81d7ba1917..75c71adfd2 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -75,6 +75,7 @@ typedef struct SerialState { uint64_t char_transmit_time; /* time to transmit a char in ticks */ int poll_msl; =20 + uint8_t id; QEMUTimer *modem_status_poll; MemoryRegion io; } SerialState; diff --git a/hw/char/serial.c b/hw/char/serial.c index 758a3aa49b..2ddc73f255 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -177,7 +177,7 @@ static void serial_update_parameters(SerialState *s) ssp.stop_bits =3D stop_bits; s->char_transmit_time =3D (NANOSECONDS_PER_SECOND / speed) * frame_si= ze; qemu_chr_fe_ioctl(&s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); - trace_serial_update_parameters(speed, parity, data_bits, stop_bits); + trace_serial_update_parameters(s->id, speed, parity, data_bits, stop_b= its); } =20 static void serial_update_msl(SerialState *s) @@ -333,7 +333,7 @@ static void serial_ioport_write(void *opaque, hwaddr ad= dr, uint64_t val, SerialState *s =3D opaque; =20 addr &=3D 7; - trace_serial_ioport_write(addr, val); + trace_serial_ioport_write(s->id, addr, val); switch(addr) { default: case 0: @@ -550,7 +550,7 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr= addr, unsigned size) ret =3D s->scr; break; } - trace_serial_ioport_read(addr, ret); + trace_serial_ioport_read(s->id, addr, ret); return ret; } =20 @@ -973,6 +973,7 @@ const MemoryRegionOps serial_io_ops =3D { }; =20 static Property serial_properties[] =3D { + DEFINE_PROP_UINT8("id", SerialState, id, 0), DEFINE_PROP_CHR("chardev", SerialState, chr), DEFINE_PROP_UINT32("baudbase", SerialState, baudbase, 115200), DEFINE_PROP_END_OF_LIST(), diff --git a/hw/char/trace-events b/hw/char/trace-events index 85e39d9d62..04a6fb4a15 100644 --- a/hw/char/trace-events +++ b/hw/char/trace-events @@ -5,9 +5,9 @@ parallel_ioport_read(const char *desc, uint16_t addr, uint8= _t value) "read [%s] parallel_ioport_write(const char *desc, uint16_t addr, uint8_t value) "wri= te [%s] addr 0x%02x val 0x%02x" =20 # serial.c -serial_ioport_read(uint16_t addr, uint8_t value) "read addr 0x%02x val 0x%= 02x" -serial_ioport_write(uint16_t addr, uint8_t value) "write addr 0x%02x val 0= x%02x" -serial_update_parameters(uint64_t baudrate, char parity, int data_bits, in= t stop_bits) "baudrate=3D%"PRIu64" parity=3D'%c' data=3D%d stop=3D%d" +serial_ioport_read(uint8_t id, uint16_t addr, uint8_t value) "id#%u read a= ddr 0x%02x val 0x%02x" +serial_ioport_write(uint8_t id, uint16_t addr, uint8_t value) "id#%u write= addr 0x%02x val 0x%02x" +serial_update_parameters(uint8_t id, uint64_t baudrate, char parity, int d= ata_bits, int stop_bits) "id#%u baudrate=3D%"PRIu64" parity=3D%c data=3D%d = stop=3D%d" =20 # virtio-serial-bus.c virtio_serial_send_control_event(unsigned int port, uint16_t event, uint16= _t value) "port %u, event %u, value %u" --=20 2.21.3