From nobody Sun May 5 15:55:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.68 as permitted sender) client-ip=209.85.221.68; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f68.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599910846; cv=none; d=zohomail.com; s=zohoarc; b=ZWQzR4hN7YEK0jyUCmm0XVWQWL3cY5vdqEmadIPjnk13VrcGl216XN2Dz/lk7nFaOjpfHWBPBNlIJSZQ5/dbnxZQplOTy6cc1aRMqImsJBjc0yxG5VWcQkM3MThezvGHFcP4/i+kNuIikUgQTXNW6bODwDb9pkJhH8a7ZsOEnXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599910846; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=34kk1edcAv9gPx2tbUUFoSPGnc2hB1OEkRGzgkZ3UyM=; b=R7RAFb5lV4DAYRzzp8qyS9NN1gZQ7C8sc0dJPIINx9plj2PquyW1qZgyJyeCss2YRZE/dRTyO4jcnsazH94TKYVzKbUHeH99HunFuawD8nxsbxvQZyRBDiZvghuvkOB/0LyARkSEsHHN6jJSVTr8/MHrzX1rWokb8btVKP8nrIw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.zohomail.com with SMTPS id 1599910845999861.3231943103182; Sat, 12 Sep 2020 04:40:45 -0700 (PDT) Received: by mail-wr1-f68.google.com with SMTP id c18so13890402wrm.9 for ; Sat, 12 Sep 2020 04:40:45 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id h6sm9373895wmb.22.2020.09.12.04.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Sep 2020 04:40:43 -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=34kk1edcAv9gPx2tbUUFoSPGnc2hB1OEkRGzgkZ3UyM=; b=qSwHns8pnvRcyHGrA6m6QJYDbIa9MegbKjQShn4pRkdvDWB1rdtPDt3nWzPDQz7OAM PlesndzWMGYz7tGB1k+tKf1s1BLhIq8QfSMcraNH8t1AslRWYKyYsdmW30uJgkd4knmy GHnN4ZG0VN8ToXeo9Gunl9yn7uzIOwBs2d+vf0klmrTwZRnPkK4BtV/Epd468NMjtzpt jMHO3kve/Uwh91YPXVsbTKhXMPPGvqkPf/taolCuj7y4CETBJqdp4i9o9cey1geps/if tGMG5w+XW7geXXR7I0i+v2IlH1Sb7siLWaqpI8hBdvEPfj93UNFc1Fl5pi48uBeuaHWH ZBMQ== 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=34kk1edcAv9gPx2tbUUFoSPGnc2hB1OEkRGzgkZ3UyM=; b=o14Lt7dnfkIFDL2jFdc7XszDnClZ6xfzoKOwl0e4H1AaJ890lqFt0JWyq4HLCck9fV j4ShPYD/EOQq9RgKue5op07XonMSzwnG2KF3C4Lea4YN2qDCkzruLNBQvlw4ypoCnctU kk0ArWWNYE7yqsu1snuaxgiGu/tqUTeivJgU1232yTaQW/M8BGRM4IMtLZxP+7JNUQVZ zsfNT2SJFk2SFc8J1Rar1JL0TBsH3YUhYFVrQD+8B81zd4STy6xCS/fKjAi19+5CMX6v w6PwNYO48mZhWD9iDcCJBBPtqORmfprbrgAf1z7V6HGpsVOc5Qy2pOuT62M46fkE5ZLw szdA== X-Gm-Message-State: AOAM532kOcupTbBxdrpR0Zhmf9Hc7r8cmF7MLH0y1gSYJ8Qul3IkFgg3 KPOGlLTPZ/h2Yj+pqkAk+HM= X-Google-Smtp-Source: ABdhPJxBfxV8QkEtvA+iRweVpgQY7yx7umsKtYT8+OouFCiBWv/6XSDMSHJ3MBcxNgztCZRszD7ntQ== X-Received: by 2002:adf:f290:: with SMTP id k16mr6962931wro.124.1599910844047; Sat, 12 Sep 2020 04:40:44 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Paolo Bonzini , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 1/7] hw/char/serial: Assert serial_ioport_read/write offset fits 8 bytes Date: Sat, 12 Sep 2020 13:40:34 +0200 Message-Id: <20200912114040.918464-2-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200912114040.918464-1-f4bug@amsat.org> References: <20200912114040.918464-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 X-ZohoMail-DKIM: pass (identity @gmail.com) The serial device has 8 registers, each 8-bit. The MemoryRegionOps 'serial_io_ops' is initialized with max_access_size=3D1, and all memory_region_init_io() callers correctly set the region size to 8 bytes: - serial_io_realize - serial_isa_realizefn - serial_pci_realize - multi_serial_pci_realize It is safe to assert the offset argument of serial_ioport_read() and serial_ioport_write() is always less than 8. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index 23864794929..a855ef66ea2 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -344,7 +344,7 @@ static void serial_ioport_write(void *opaque, hwaddr ad= dr, uint64_t val, { SerialState *s =3D opaque; =20 - addr &=3D 7; + assert(size =3D=3D 1 && addr < 8); trace_serial_ioport_write(addr, val); switch(addr) { default: @@ -485,7 +485,7 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr= addr, unsigned size) SerialState *s =3D opaque; uint32_t ret; =20 - addr &=3D 7; + assert(size =3D=3D 1 && addr < 8); switch(addr) { default: case 0: --=20 2.26.2 From nobody Sun May 5 15:55:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) client-ip=209.85.128.68; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f68.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599910847; cv=none; d=zohomail.com; s=zohoarc; b=EygPwLmUBVi/4wFRfNiMfDPsR/TgRVgWBOuwKSX/oMFEvxYu8hsZcQzjzWgNt32XAgdMsRo9EiE5t9d4b8UEYJh528OLgpzM4upOHgDPGoLn3+DJNHywlMGq81zT3kAtMpXuwQZZo+p6Qm5k5679fN3Ti7aeQKpM2Sk3pPPRYko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599910847; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cjPhR7IkpYLtqYuSQXOeOWy0Y3FOG5E14Z0Rs7drrRo=; b=U18jAkoiNs771MAhyqg2I7O1agYu34hKb4rrRAkY6XKwrQMjt1YMY/lEsGCVXIIGoyrslp9OT53KTNOwse8GTo28acKzhDSUby+yyQI1grz8OF7K4AInkkBh+9EY3LBIrcBd3Y786utUP6JKtA5Q916I0tN8RfC4+ZR+xKxMCa8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.zohomail.com with SMTPS id 1599910847243913.1304325171614; Sat, 12 Sep 2020 04:40:47 -0700 (PDT) Received: by mail-wm1-f68.google.com with SMTP id y15so7060680wmi.0 for ; Sat, 12 Sep 2020 04:40:46 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id h6sm9373895wmb.22.2020.09.12.04.40.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Sep 2020 04:40:44 -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=cjPhR7IkpYLtqYuSQXOeOWy0Y3FOG5E14Z0Rs7drrRo=; b=O8YRdEkXWNjoNtmpWnTI2O2/pyOgp4edHqysBRyDq66zwFGdaLEgaWPxzgr0uOH9cG T0+fOtFD+A2UsnZRVIRIbatk2XInbyhECywtGy++xp5BcyteRzuyxEUzags0mVik4Y8F gphqz1dPLcWyNn8XtBYMvJ/z2343OFeMxI0JJ4bPp3CtU2zLvtqSGXL2fb2rW82fHSAG PcGl5XbsbBRqhby59hWsI4q5QkBw0d/Xu11t1+sJGQw4ZxgnLNTZ/+xsMS9XF5w4qX4m grYvjL9x48G+7RbvTtmC1u8gnMuTPFcTSbpVDhcmewf9kdUFsIsmHpdEJuClS0f2YZaj k3ww== 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=cjPhR7IkpYLtqYuSQXOeOWy0Y3FOG5E14Z0Rs7drrRo=; b=mUf10Jer/Rn6yNrjiNG/9tqztcwHbtomjE9F8UxBT5ta3f9s6to+Cjw7P9/3QEzoKh Z80tmaSuzi/VKC7JNstXekEkjU2V5dozOpqtFJxWEbld5IhuBLRSca/ovz6hIi312BEk zY5OQVawX5DkOwXpQ/u6iR1HErREf6lFHFivugZIG4O12Hoz6Fq0pRV76c1ajVjoHQe8 WO3pEWjn8niLNYzpLpEHYC4YnDOlmLWI7b6kpgS2ALWQUV3uE1Yw/AKvFuOzNWML9ghX FE/+up8zlJ3QeVg1+/VwKY+6D8fGaqsUbR1H94UJ6aAdHVC2ONTxwc51d2M24ae6XNk+ Dx7A== X-Gm-Message-State: AOAM532oTvs9VtxMm9ZelJFi9MKH1ubL4KuBnkw+4l2uydAdxzLUs8Mf w+UXV5TQ+SnOiJ+dpX0usl0= X-Google-Smtp-Source: ABdhPJzTIhb57qOmta0EIxYkO2MBw9vnBPaze/OsjXLZv8ICZW8A9vFz+LOvR9ZIVc1l4wcW6KR+Ug== X-Received: by 2002:a1c:7c13:: with SMTP id x19mr6751152wmc.45.1599910845264; Sat, 12 Sep 2020 04:40:45 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Paolo Bonzini , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 2/7] hw/char/serial: Replace commented DPRINTF() by trace event Date: Sat, 12 Sep 2020 13:40:35 +0200 Message-Id: <20200912114040.918464-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200912114040.918464-1-f4bug@amsat.org> References: <20200912114040.918464-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 X-ZohoMail-DKIM: pass (identity @gmail.com) Convert the old debug PRINTF() call to display the UART baudrate to a trace event. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial.c | 4 +--- hw/char/trace-events | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index a855ef66ea2..fb41337b661 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -187,9 +187,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); - - DPRINTF("speed=3D%.2f parity=3D%c data=3D%d stop=3D%d\n", - speed, parity, data_bits, stop_bits); + trace_serial_update_parameters(speed, parity, data_bits, stop_bits); } =20 static void serial_update_msl(SerialState *s) diff --git a/hw/char/trace-events b/hw/char/trace-events index 2442a9f7d5f..17304bef26d 100644 --- a/hw/char/trace-events +++ b/hw/char/trace-events @@ -7,6 +7,7 @@ parallel_ioport_write(const char *desc, uint16_t addr, uint= 8_t value) "write [%s # 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" =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.26.2 From nobody Sun May 5 15:55:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) client-ip=209.85.128.68; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f68.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599910848; cv=none; d=zohomail.com; s=zohoarc; b=eOXbfB2TGAUoAHhptSmAR2FwbubEM/dkXiAYv/AHbagoCoLZBeVBbMhcrvI84b9BgFjI17LPzOVXVxBn5t4c8gQ66KoEbPfRJeBN/X7fpglnZrtTky4hxAu/v5huqc/E7+lLwjWKWqlXohhjUyy1L2nSXDiOHbeQ5porvZT1uaE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599910848; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ziCw1jrdbRRxzZUuAacPeDfn99gOs6JW3cbKwKy/6Wo=; b=WTSs2bcJqVTb8z3W+By+XtUS3K00qu6KG7yscqppyXIurdZWxtGFnpMvyjY+UAzTAkZCsuAKL2Mt81hqC6WHcY5yqfbMHBozR3D4dLlHweDMrnRmcmNH5BDkltdn0eUw94RAQsR4u6qb2rYtzhe5VeF6cJq4w/wDPEqmkg3nI90= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.zohomail.com with SMTPS id 1599910848414105.365401304079; Sat, 12 Sep 2020 04:40:48 -0700 (PDT) Received: by mail-wm1-f68.google.com with SMTP id e17so6623406wme.0 for ; Sat, 12 Sep 2020 04:40:47 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id h6sm9373895wmb.22.2020.09.12.04.40.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Sep 2020 04:40: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=ziCw1jrdbRRxzZUuAacPeDfn99gOs6JW3cbKwKy/6Wo=; b=TsZpsrhJ3RhWZIJyw16+9bzFXZyg5ncW7kck6EcoSZ8ZhUz4o7YPT5TIxK0ptSMD5l SjOf5qYNqjBiXqm9tO+JcJNKnM6aWwOXsmjBWl0UojGAkKBRiEXmKUgGyeBtNKOFyxFk DRkY0E+mCjaHTuAxPrEQ36yecUFEPEhSf+jTJOwqp9Snq1apB1f7C4f5WWqltDdrXVxb Hk81uwkLK/tSwiKWUcoHAEFrRcogiFZsbv7RSwzY2UgvRoZCtaMJ8aP+ZsNyPbVNEomc C6bhAgrYPoyhgqeEdNwlDMDKuLraXuhqBCZBnY7h+dj3Uy2RUGMzEuOerPsqf5gV7Ugc anSg== 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=ziCw1jrdbRRxzZUuAacPeDfn99gOs6JW3cbKwKy/6Wo=; b=JrHCtnI2chDFgVPWL44rhg5znCzL+5JFisGAWXF5bYpzOn85GlbC2SMwnB0Iin217j hvetefhIULwLmB3cuNmMKOR72HAAEqA2p/23Rx3qKizjCYXwHhhYX4y8fICiMV34NAAC +qF3DbO7+dq6FLvmUIe6zwcIj9wslZE6gBSTkPnOcdf3bJcU2mw2B8Vf0/B8z5kf06yy PFihbIW8+MWQDfpnLCtvi03XfIdbb+GiLNMPny/AiI0jtp/vo2bbX/Qqd8ouUW6tWCS5 1IcGWPE0FGFa6PhNSijUWTveHiK3eSsMsjeF/ssbFbFFHCP/+PvISOZH0O8GW4lhRccj hnmA== X-Gm-Message-State: AOAM530HUTzQHoqSI9ZQh+DvQy+42jK6Tk2S/5rkPMat17vtdAOHm3nC Z0q/nfhlBiyc3inPOvqtAys= X-Google-Smtp-Source: ABdhPJxvI/WOGV6Fo61vJPY+cPr8BV3k0ADGPI8FRgkd1nBBH18I4hf3/vqIJeD+D6P1uXdpjYpIgQ== X-Received: by 2002:a1c:c2c6:: with SMTP id s189mr1791879wmf.146.1599910846444; Sat, 12 Sep 2020 04:40:46 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Paolo Bonzini , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 3/7] hw/char/serial: Remove old DEBUG_SERIAL commented code Date: Sat, 12 Sep 2020 13:40:36 +0200 Message-Id: <20200912114040.918464-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200912114040.918464-1-f4bug@amsat.org> References: <20200912114040.918464-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 X-ZohoMail-DKIM: pass (identity @gmail.com) All useful DPRINTF() calls have been converted to trace events. Remove a pointless one in the IOEventHandler, and drop the DEBUG_SERIAL ifdef'ry. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index fb41337b661..1e70294f28a 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -36,8 +36,6 @@ #include "trace.h" #include "hw/qdev-properties.h" =20 -//#define DEBUG_SERIAL - #define UART_LCR_DLAB 0x80 /* Divisor latch access bit */ =20 #define UART_IER_MSI 0x08 /* Enable Modem status interrupt */ @@ -102,14 +100,6 @@ =20 #define MAX_XMIT_RETRY 4 =20 -#ifdef DEBUG_SERIAL -#define DPRINTF(fmt, ...) \ -do { fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ -do {} while (0) -#endif - static void serial_receive1(void *opaque, const uint8_t *buf, int size); static void serial_xmit(SerialState *s); =20 @@ -636,7 +626,6 @@ static void serial_receive1(void *opaque, const uint8_t= *buf, int size) static void serial_event(void *opaque, QEMUChrEvent event) { SerialState *s =3D opaque; - DPRINTF("event %x\n", event); if (event =3D=3D CHR_EVENT_BREAK) serial_receive_break(s); } --=20 2.26.2 From nobody Sun May 5 15:55:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.65 as permitted sender) client-ip=209.85.128.65; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f65.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.65 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599910849; cv=none; d=zohomail.com; s=zohoarc; b=WuK706UwiFR/5VeKvoDdYhDdjgIFQF+5Mq4nvININajlAer6wh+gujn8gFVd11X2lOVYNkInI0Sr4Vf7nw7xyhF9TkeEArtC85ZdOb3Xt7Qi4MeJ3FerPn/cbAjbB2OW4Ch7PTKuFHZP90c5f7RRacWVsL7s/u6jVxgq3g5cqxM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599910849; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+zuqPSYAeaFQaEt/7hHxldynFjZI77037Thg6Y4y1PE=; b=GjgBENkMZZd9pIKEM75WSJvoiXx0GDK4CS3g1+XrjfwFrpPF0wjpv29Jmv6Jf6NyawKOC+2oi8POjCeT180iX1H8K50nLepe9yga9TfvkGNyC8XvWTN3EeINvwczcDNYjHHXcRILoKTgK4L7aYM/UjnV8zI3aEt/WYf/0VMmkx0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.65 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by mx.zohomail.com with SMTPS id 1599910849658598.0745477019693; Sat, 12 Sep 2020 04:40:49 -0700 (PDT) Received: by mail-wm1-f65.google.com with SMTP id a9so7056087wmm.2 for ; Sat, 12 Sep 2020 04:40:49 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id h6sm9373895wmb.22.2020.09.12.04.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Sep 2020 04:40:47 -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=+zuqPSYAeaFQaEt/7hHxldynFjZI77037Thg6Y4y1PE=; b=pj5cC+KyXZRxRJdjHTAAGqGXL7FvZBP4iU0KEHTCv2TY+QGyZORynKaR0Kp0MjqD/V JHLE+2U/vv3Dl8wDJUbf1Ajro3ZQ1YfD7KV0uTpNkmE/RU6RVvSy9GRUAS8WiBpP+FtM o1zsDKBfhPgGU97ggAcs+Of/4/Y/+CvclSy7aFbuWCHk1pv9xmnOr1pCYmwqsl4wJ8Rq K00Ah7lBlg7mpoGwi1174q0qcI2KCfBJQ3tbviKeJf/yZrW86mS4w1XNcxuMaWJibgDQ 45PqfwWnabHd3UaHiqW24czF8kKKYOgb3kBGdPuj+HgGmY4/OsLb9CEz4RPaq5gor3zv yU5A== 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=+zuqPSYAeaFQaEt/7hHxldynFjZI77037Thg6Y4y1PE=; b=uBRcHBh3IJOiY/g9Iuh03uzyOnrx+tBvYcP5we7b3Vx8ABIDOsBXlfvRv2XtpudAl8 VAkxh5rtGCFlJFIUqM0cdVpBlWwmzPEaeLwh9LneYwa+NIlkTp7fVmNK9zl00mWIxG3P U0LVm3Q6spR234LNKKJFrbVrAvjE3yVVwilCqbKBReHrTUjydWGNvKBESOxjTM55KXAK VPYBG/lY4p4nHiJ3jWME2Pu/vDuqhQLyzXufIVYdRgLB+SGhOWNG7SHMEAlfxVhktvy+ nSV5Udrs3MyC0kp8OEhxFDMiYq008/LnUxLfMshuUw6gMI8r5FMDBowyEm8CxQcb5x7t DG4g== X-Gm-Message-State: AOAM5330z7KLPmQ50Y2GtqhhvUKsp2VRdSAqfoyPqWekkD8vk+aZDJPf CgFkHVJS2j9NgQRTM7NW7R4= X-Google-Smtp-Source: ABdhPJyIVvexm0+D6gC6t70mYlf81cymW5MRpW+tSOOPZeTfaTCCfSQdtwF4twsnDGssGduqi43IRg== X-Received: by 2002:a1c:4e02:: with SMTP id g2mr6253397wmh.3.1599910847737; Sat, 12 Sep 2020 04:40:47 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Paolo Bonzini , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 4/7] hw/char/serial: Rename I/O read/write trace events Date: Sat, 12 Sep 2020 13:40:37 +0200 Message-Id: <20200912114040.918464-5-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200912114040.918464-1-f4bug@amsat.org> References: <20200912114040.918464-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 X-ZohoMail-DKIM: pass (identity @gmail.com) The serial_mm_read/write() handlers from the TYPE_SERIAL_MM device call the serial_ioport_read/write() handlers with shifted offset. When looking at the trace events from this MMIO device, it is confusing to read the accesses as I/O. Simplify using generic trace event names which make sense the various uses. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial.c | 4 ++-- hw/char/trace-events | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index 1e70294f28a..ade4adfd526 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -333,7 +333,7 @@ static void serial_ioport_write(void *opaque, hwaddr ad= dr, uint64_t val, SerialState *s =3D opaque; =20 assert(size =3D=3D 1 && addr < 8); - trace_serial_ioport_write(addr, val); + trace_serial_write(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_read(addr, ret); return ret; } =20 diff --git a/hw/char/trace-events b/hw/char/trace-events index 17304bef26d..609df10fed4 100644 --- a/hw/char/trace-events +++ b/hw/char/trace-events @@ -5,8 +5,8 @@ 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_read(uint16_t addr, uint8_t value) "read addr 0x%02x val 0x%02x" +serial_write(uint16_t addr, uint8_t value) "write addr 0x%02x val 0x%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" =20 # virtio-serial-bus.c --=20 2.26.2 From nobody Sun May 5 15:55:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.68 as permitted sender) client-ip=209.85.221.68; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f68.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599910850; cv=none; d=zohomail.com; s=zohoarc; b=dRXN6QgJlV68oq/W6C/zyj4J782sLXHRf08cB7qrLK39ppmCsgegNMEaIUPgwCFV2/vuM+oO36aiIQXglQsp1XKcCrsKJmo0dRzrm/F2ONNfSeB6yWxtwuqQmCi/upHcj1fymBNwTK3PUFgr5a/dvxv9PItgP9QUlj9RQ241x9g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599910850; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Fmud8Lbb3PnhfRHff2nlfxUUQJbBHq4EO52NCriy+1s=; b=L1OEwCpgbaaoUzy2wkphcbd4Ynub6i4QhpQ7mn8GOhwT3j7KIR4P2wCFsEyN9RuPiaXD/rfRP3IG1EGB6CzSOS5C5QP8H4qUzsAUg9oVJzZEEc7FK3vt8/Sd2sHhKUVR8XWr3cITDCU7H1FWvKh4rpii0RLb6260F8/lskIzVFQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.zohomail.com with SMTPS id 1599910850909713.0809085532295; Sat, 12 Sep 2020 04:40:50 -0700 (PDT) Received: by mail-wr1-f68.google.com with SMTP id e16so13931791wrm.2 for ; Sat, 12 Sep 2020 04:40:50 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id h6sm9373895wmb.22.2020.09.12.04.40.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Sep 2020 04:40:48 -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=Fmud8Lbb3PnhfRHff2nlfxUUQJbBHq4EO52NCriy+1s=; b=vYJbAEZHbLqfoeL9iRz5iWgKqkJkWJsUIyoX5ePJhC/JUt/yPJHKUBF5b6dJzBdxQG daXfB5Z/jYIzNJRSazXT3Abd9UUAQJ9IgmZrmT1BtRvut/quC1Tfb8H08B+zsd+iDDFG Jaizh6ezIGa5LJ0lyRw6b/O/eU7xJU7/6SeqzHnU/eeG9ExdDahJm+fcO6Jj11xnRfUH dToR2BpePZr1nR5dcOA+vlOj2RY46IKPxvYs//i6RmeHuSnnhNxJp44btPfAR5iVQt3+ /MC9HZzblmByiMQ7qWNWMUwnCmxic3wZV99O7KsFKg6r/MVme7yj0B0tK5aUKZRv5+FR jXVw== 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=Fmud8Lbb3PnhfRHff2nlfxUUQJbBHq4EO52NCriy+1s=; b=TmN7RoSeHNlx0lHBKzfSbyFF2Z4nvQ8L5WhAuVhhSIBl9d71nufWKY+mj8z0YiiDuQ RTk4u6D74aZV9XDDOKnqjtOErViLz5CX7ugoDD9VWrUZ269Ax4tqdN1OPvrfU3LNFVfQ I6mRc6fy+z1tu3hB6k5wuF0kqwVCRU6aAYrCtiTUHbVNB/95WFsdV7JjTdJsw8q3gWQB nl+gq2ToComo5CS0H2+a2wnipYKNqDMoMYWEumIco620W09HOOawTQVT4i9XYpyZ7u0T t5wqJjBAMBx4AbExTfQUPg4kGjGXx4DOq8gvCjjyp0b8RwrdtgOk77zNeOaD61rWT30+ pdtQ== X-Gm-Message-State: AOAM531OQwErohp0zQuGm0J41uHOlCQsMuqgSES94OwAE+cyL/Amqx3h F2ugzqMpG++az7Gie9tDmOk= X-Google-Smtp-Source: ABdhPJzWb0TFRP6+IZ2tw5gL18ksvv+aRAEYvXo532BVMwzGTNnI+xK2FrjUGUnzgUAKEaVSJjZZTA== X-Received: by 2002:adf:f508:: with SMTP id q8mr6228485wro.233.1599910848926; Sat, 12 Sep 2020 04:40:48 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Paolo Bonzini , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 5/7] hw/char/serial: Make 'wakeup' property boolean Date: Sat, 12 Sep 2020 13:40:38 +0200 Message-Id: <20200912114040.918464-6-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200912114040.918464-1-f4bug@amsat.org> References: <20200912114040.918464-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 X-ZohoMail-DKIM: pass (identity @gmail.com) Make the "wakeup" property introduced in commit 9826fd597df ("suspend: make serial ports wakeup the guest") a boolean. As we want to reuse the generic serial properties in the ISA model (next commit), expose this property. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/char/serial.h | 2 +- hw/char/serial-isa.c | 2 +- hw/char/serial.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 264f529a7f1..09845721384 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -61,7 +61,7 @@ struct SerialState { uint32_t baudbase; uint32_t tsr_retry; guint watch_tag; - uint32_t wakeup; + bool wakeup; =20 /* Time when the last byte was successfully sent out of the tsr */ uint64_t last_xmit_ts; diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index d4aad81a85c..7e1b36c3f67 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -119,7 +119,7 @@ static Property serial_isa_properties[] =3D { DEFINE_PROP_UINT32("iobase", ISASerialState, iobase, -1), DEFINE_PROP_UINT32("irq", ISASerialState, isairq, -1), DEFINE_PROP_CHR("chardev", ISASerialState, state.chr), - DEFINE_PROP_UINT32("wakeup", ISASerialState, state.wakeup, 0), + DEFINE_PROP_BOOL("wakeup", ISASerialState, state.wakeup, false), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/char/serial.c b/hw/char/serial.c index ade4adfd526..ade89fadb44 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -1015,6 +1015,7 @@ static const TypeInfo serial_io_info =3D { static Property serial_properties[] =3D { DEFINE_PROP_CHR("chardev", SerialState, chr), DEFINE_PROP_UINT32("baudbase", SerialState, baudbase, 115200), + DEFINE_PROP_BOOL("wakeup", SerialState, wakeup, false), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.26.2 From nobody Sun May 5 15:55:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.68 as permitted sender) client-ip=209.85.221.68; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f68.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599910852; cv=none; d=zohomail.com; s=zohoarc; b=hFQiX+nAzBrblCREkoTZDnZbX12wUq1hKwb1fT4EZoaj2nydN7p3orqfhY2u5aGq/QKSSMV62l5UyZFcOYebYXr2R0awbngW7/HkQorq2RgKHDvc2PChxaBs69cS9xXEfUVRKfJ5sEXMLJ2rZIfDWHTzk+JdrQCtJ2xOwgd51No= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599910852; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N67Bz+24f+wBD0rV7TEX/Zf0E80v4TcJaPqWQArNwlY=; b=JtJ8uXUSxG5lrgroK9zck/zKJJGqzh+b+4LMcoMsP+cKRPzObCZZT43+OKTqCC7w9+Rlln5Owb9fFn6L9bssRCnIotfm32mZZoDxGyB00NftuQnG/ekMFafPsVJPzS6L/iz83TPe0hXmO9Sru67a4Gp54o9l81zVfOqedyME0ck= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.zohomail.com with SMTPS id 1599910852027814.9531386719618; Sat, 12 Sep 2020 04:40:52 -0700 (PDT) Received: by mail-wr1-f68.google.com with SMTP id a17so13915082wrn.6 for ; Sat, 12 Sep 2020 04:40:51 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id h6sm9373895wmb.22.2020.09.12.04.40.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Sep 2020 04:40:49 -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=N67Bz+24f+wBD0rV7TEX/Zf0E80v4TcJaPqWQArNwlY=; b=r3KxYLcuUvV5lUkpg0Lhq85OYjCS6HCUPCKAyTSuwAFh/TbyHTeg+AOdnAR471PXKD FYgYUHnNUdTY8qvDpV+9dGGJWirGICJb/W4BZ+4IBU4QOFihaqAYhEBhJ0v1t8xOVaQT sBZ4zrKX7uHgKVizIIVHLKziLKKHDsmq6NrSzpKiUWO03xS0rGUIzSTUcBNyrxUCNFOk FHAoV3iB4+E0Jv2pkbBbLTnN/DG8H0gpYHDrcAGSpHhA3+im3Rwg2CLreea48VxGx9Zn wOmsC1gT3HQgZO9SN0myyI8+uP89MPTQoktWAMzwzKM80RcgAHyaQw4//UovpiqH65ep 55FA== 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=N67Bz+24f+wBD0rV7TEX/Zf0E80v4TcJaPqWQArNwlY=; b=t4Zxnoqxf9NOg/8CqtGlHgSmvAddFkZx1RXpY1hhNv8UU/i2ULjH80ZrIlOninDHL6 DPf4koH7seZYxwBDNb3gSPwtG9D2tQ01BqZ7oAV5X86IIOAFCcx9+/XctHkaQ9rveNZa RnP+gICJUaOlDkYu10OPa7LWERGHZ00v1jz+uvupy01uQGJZANAVisNViBrqYK6cw4pZ or/RnbWCONITnCKSJ83nzkzmn1OWXJufNmNRci7h1/kgzxeNDnr3vhCyNU5A5eUTw7hM tbRalp/dlcpndXJXjL1y8k5rjAGRZ8UpbhmRcxwSzy9jmNYvKRnP/evK4bppfhaunqFD 6rTw== X-Gm-Message-State: AOAM530uGE65XkS2IXUv/1YQJWVzT41Pl+hhj4R68LK/KT/3WyxrYYES 0OAJkHFCiDFXeDjNmMrN2Yo= X-Google-Smtp-Source: ABdhPJzZAm4pWL8H6baPYXXgcOzlWCXgOnzB4LqyQPJZG6W+h6+NwoQLRu18srNripdb1hp2adChEA== X-Received: by 2002:adf:fb87:: with SMTP id a7mr7020429wrr.390.1599910850109; Sat, 12 Sep 2020 04:40:50 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Paolo Bonzini , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 6/7] hw/char/serial: Alias QDEV properties from generic serial object Date: Sat, 12 Sep 2020 13:40:39 +0200 Message-Id: <20200912114040.918464-7-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200912114040.918464-1-f4bug@amsat.org> References: <20200912114040.918464-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 X-ZohoMail-DKIM: pass (identity @gmail.com) Instead of overwritting the properties of the generic 'state' object, alias them. Note we can now propagate the "baudbase" property (except on the PCI multi-UART device). Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial-isa.c | 4 ++-- hw/char/serial-pci.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index 7e1b36c3f67..c0607476c22 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -118,8 +118,6 @@ static Property serial_isa_properties[] =3D { DEFINE_PROP_UINT32("index", ISASerialState, index, -1), DEFINE_PROP_UINT32("iobase", ISASerialState, iobase, -1), DEFINE_PROP_UINT32("irq", ISASerialState, isairq, -1), - DEFINE_PROP_CHR("chardev", ISASerialState, state.chr), - DEFINE_PROP_BOOL("wakeup", ISASerialState, state.wakeup, false), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -140,6 +138,8 @@ static void serial_isa_initfn(Object *o) ISASerialState *self =3D ISA_SERIAL(o); =20 object_initialize_child(o, "serial", &self->state, TYPE_SERIAL); + + qdev_alias_all_properties(DEVICE(&self->state), o); } =20 static const TypeInfo serial_isa_info =3D { diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c index f68948154e0..81da2783f9e 100644 --- a/hw/char/serial-pci.c +++ b/hw/char/serial-pci.c @@ -84,7 +84,6 @@ static const VMStateDescription vmstate_pci_serial =3D { }; =20 static Property serial_pci_properties[] =3D { - DEFINE_PROP_CHR("chardev", PCISerialState, state.chr), DEFINE_PROP_UINT8("prog_if", PCISerialState, prog_if, 0x02), DEFINE_PROP_END_OF_LIST(), }; @@ -109,6 +108,8 @@ static void serial_pci_init(Object *o) PCISerialState *ps =3D PCI_SERIAL(o); =20 object_initialize_child(o, "serial", &ps->state, TYPE_SERIAL); + + qdev_alias_all_properties(DEVICE(&ps->state), o); } =20 static const TypeInfo serial_pci_info =3D { --=20 2.26.2 From nobody Sun May 5 15:55:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) client-ip=209.85.221.45; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f45.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1599910853; cv=none; d=zohomail.com; s=zohoarc; b=jv+EvLxTX29GT+SvQfUw5vkYjwyS7vlbJNYpbEKRh0SeihsoROpVSXvzRUgedxgq+KTx+SMlErGXeHOKVQO9mXYLCzehlqQ9WDY7oBV4/IKq/5nsCaSOJAWdjeoDyVOwODlzZ+tKHw492/qu2STOP+VAMneIaG44hiI+8nDNVy8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599910853; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=35kCXBDtnMec8kuPKS3wvw6fy2OiC9y7NvX9kclUQjI=; b=jzBG6HWP+tDaHgtuMzP5aLjGeoyRpQukJoRef5ZT3iWDczNURDfWBj7sPQ62vwRek4HRTJI86EzN1CP9KXNbS5Hqe+/43kWys0JOuSznD6i/t9Ysbd7XlZWW2F28xfIbtpVhJE41M5V7eR+e+ylAQywZ+WhVzot1y7zu7mClheM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mx.zohomail.com with SMTPS id 1599910853310480.0337626298227; Sat, 12 Sep 2020 04:40:53 -0700 (PDT) Received: by mail-wr1-f45.google.com with SMTP id o5so13852173wrn.13 for ; Sat, 12 Sep 2020 04:40:52 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id h6sm9373895wmb.22.2020.09.12.04.40.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Sep 2020 04:40:50 -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=35kCXBDtnMec8kuPKS3wvw6fy2OiC9y7NvX9kclUQjI=; b=gv8ltJMU8gV6Y02r9nk0SvAUp9rw6fxRnmqomBT/gBt0StIou5U9UK+PfPcV8xPE2q C5l7mnNwx1J4ny1HQKlUvipYxK60P7LUN2o224YZ/kF4Q7UBtWVAFOZ25NTbbUa99X6s ZesuLFPAKVHbpx14Qj/+jRKC5PBBxAQSwoXXLihY+KDqWeLLvo8lazZFG9x6qSwJft2o z6rt2Xi9jU+kLH8QG8OuUR2cTbPZtLZI6P30lThSf3baw9iAUsD2wTLFLyHkB5UT3L/g R5IbnF+crqkf0K2h5LfI88N6esfxxbyC9oh1g63VDB7zCr7PWJzcA1ZzPigFOh4vO5cd ix5Q== 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=35kCXBDtnMec8kuPKS3wvw6fy2OiC9y7NvX9kclUQjI=; b=ItDzvd+qh6MtNBqwQAbhzRlgPRMmnT7U/N1S0kVNF9CO3KdEWIgnHjZuQVfGoKwJ/Z 2LBM4FsX7ep5iZ+rZcU9XDLXYQ7I1PUgHRu3rsiMPw7fYM0Nu0+3E4lm6B/71kYt4VFF 1zTOVrHteds5b+y+/PLbgie2VNp5oBlQqFuQeLmun9vv935acbEj9no6HZMC7+SGqXOW O0bo8CBk63I8iW3cP0/VjapzI1If15w++4bj+4rwnh1nGiQT2w8HEWseCzwTEwcNbYEj xBWvzeeGBJ6rKKdpZfGFT/hgQYGNEM5k2hz68PR2Azo5Or0Va7guG9/RVbIDdSaszajv kewQ== X-Gm-Message-State: AOAM531490dn2YI4dvhgsntZO9Ln6sL6U+e6UkX2ZnnL/1drU1U0gXfH mkNBVC9KvTzG2xW5wsSyc1U= X-Google-Smtp-Source: ABdhPJxMSZRTKYXxVtJ45ZoIyzmkLQCLLNdSmvGlRtXypDArkBdhgPKu5akuYxeiwaiZpCTfpzW6VA== X-Received: by 2002:a05:6000:12c3:: with SMTP id l3mr6864624wrx.164.1599910851330; Sat, 12 Sep 2020 04:40:51 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Paolo Bonzini , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 7/7] hw/char/serial: Let SerialState have an 'id' field Date: Sat, 12 Sep 2020 13:40:40 +0200 Message-Id: <20200912114040.918464-8-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200912114040.918464-1-f4bug@amsat.org> References: <20200912114040.918464-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 X-ZohoMail-DKIM: pass (identity @gmail.com) 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. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/char/serial.h | 1 + hw/char/serial-pci-multi.c | 1 + hw/char/serial.c | 7 ++++--- hw/char/trace-events | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 09845721384..a0aaa319a93 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -76,6 +76,7 @@ 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; }; diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 2cf3e441773..53e0c6e25c0 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -105,6 +105,7 @@ static void multi_serial_pci_realize(PCIDevice *dev, Er= ror **errp) =20 for (i =3D 0; i < nports; i++) { s =3D pci->state + i; + qdev_prop_set_uint8(s, "id", i); if (!qdev_realize(DEVICE(s), NULL, errp)) { multi_serial_pci_exit(dev); return; diff --git a/hw/char/serial.c b/hw/char/serial.c index ade89fadb44..e5a6b939f13 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 assert(size =3D=3D 1 && addr < 8); - trace_serial_write(addr, val); + trace_serial_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_read(addr, ret); + trace_serial_read(s->id, addr, ret); return ret; } =20 @@ -1013,6 +1013,7 @@ static const TypeInfo serial_io_info =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_BOOL("wakeup", SerialState, wakeup, false), diff --git a/hw/char/trace-events b/hw/char/trace-events index 609df10fed4..45b8eaab655 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_read(uint16_t addr, uint8_t value) "read addr 0x%02x val 0x%02x" -serial_write(uint16_t addr, uint8_t value) "write addr 0x%02x val 0x%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_read(uint8_t id, uint8_t addr, uint8_t value) "id#%u read addr 0x%x= val 0x%02x" +serial_write(uint8_t id, uint8_t addr, uint8_t value) "id#%u write addr 0x= %x 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.26.2