From patchwork Mon Sep 7 01:55:29 2020 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: 1358522 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Ub12186l; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BlBGL133pz9sSP for ; Mon, 7 Sep 2020 11:56:26 +1000 (AEST) Received: from localhost ([::1]:33254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kF6OO-000637-2v for incoming@patchwork.ozlabs.org; Sun, 06 Sep 2020 21:56:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kF6Ni-00060X-TH; Sun, 06 Sep 2020 21:55:42 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:50254) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kF6Nh-0007IF-Dn; Sun, 06 Sep 2020 21:55:42 -0400 Received: by mail-wm1-x342.google.com with SMTP id e17so12876177wme.0; Sun, 06 Sep 2020 18:55:40 -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=xNSWRDcvmAyUx6UsL/JgHCLjynBWkV6qzS6fjCc2u/4=; b=Ub12186lydpQdjQDobPDaDVAcemBEmB5K40dMvKJkSB4NPwZe+ePaSCTfAtLdNC6FI bPKAbNK2I1GZdMocOGUEF2FmGJ+Q3UxXfYMtixrAhgaQyVzopbKZmw49NoxW+YqAZBBU hcMRo07l0cTCY+sSYslnlDHhfMkcI+j71dS+KfYkb36Nn8sTXQAZfUjIJNMGPZUMcvU3 nH67StjksCps87QX2UiWtnwqvQtwPPPplnVekeRLaGnF/eauSn5Cz8pHlLPUjLLu7XIW L254QH11I365LiZyXqtLL10amJCV9NfsB6laJDf3NHG9gOcaXwTDKTFpy+r0M7B4qh7o 5mXQ== 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=xNSWRDcvmAyUx6UsL/JgHCLjynBWkV6qzS6fjCc2u/4=; b=s2k/WFkM2woEp6JYsQtEQpqu1DboM7RewyH715a1kN/7LKeDORcqQL2aBPoLxgSgtM XfyjHhBFpNbOMOjz9twZlP2JsOdt4n4mw9rjnQOUeNU5EoWuZzAYfOiP6lyx7tF+bisi kYyqpeX4iUp3Dp3GzPHG5HQE+dQhEP7gaEE81cacvUA1a+AbwEGOx6O6BeOyh3CdSTrt FIHNGifunPjGazEa7R41x1e1gZxZNhn63uj/EG+qQ2lcegj8oXzKvyE9OtBXfhSB59DU 9idaAkKKoALecajGTjmlzFMLp27O9skga8DPmk/9hd5qFa47zTuD0quNUSPLpGjembpn hDhw== X-Gm-Message-State: AOAM531BwSUtca61HoJQryfaKhNSSqhYU60CCrh7ubXPfuYZnqmEZR5n GmoZceOoBLZeoYje9kTbyM95aMT2NPE= X-Google-Smtp-Source: ABdhPJyEeJ8ovfrWSFuAWleTJVWWUnUmlW/AmXhxIIay8RbNE7WPmBWQfXBf3cMkU1RSw28/co5dWA== X-Received: by 2002:a1c:40a:: with SMTP id 10mr18965790wme.61.1599443739377; Sun, 06 Sep 2020 18:55:39 -0700 (PDT) Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id b84sm29377773wmd.0.2020.09.06.18.55.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 18:55:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 1/7] hw/char/serial: Assert serial_ioport_read/write offset fits 8 bytes Date: Mon, 7 Sep 2020 03:55:29 +0200 Message-Id: <20200907015535.827885-2-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200907015535.827885-1-f4bug@amsat.org> References: <20200907015535.827885-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x342.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: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: qemu-trivial@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The serial device has 8 registers, each 8-bit. The MemoryRegionOps 'serial_io_ops' is initialized with max_access_size=1, 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. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- 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 addr, uint64_t val, { SerialState *s = opaque; - addr &= 7; + assert(size == 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 = opaque; uint32_t ret; - addr &= 7; + assert(size == 1 && addr < 8); switch(addr) { default: case 0: From patchwork Mon Sep 7 01:55:30 2020 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: 1358523 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=ATpKEDrJ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BlBGP3Gbmz9sSP for ; Mon, 7 Sep 2020 11:56:29 +1000 (AEST) Received: from localhost ([::1]:33326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kF6OR-000658-Ci for incoming@patchwork.ozlabs.org; Sun, 06 Sep 2020 21:56:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kF6Nk-00061i-1G; Sun, 06 Sep 2020 21:55:44 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:41857) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kF6Ni-0007Ij-GG; Sun, 06 Sep 2020 21:55:43 -0400 Received: by mail-wr1-x443.google.com with SMTP id w5so14073618wrp.8; Sun, 06 Sep 2020 18:55:41 -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=JF7kT9Jakz5MXZ7s85w029ixb/+6fikTUFTZrRv4yoU=; b=ATpKEDrJ7K9awH1N2zYTl4yBM9vwgdywoDL8jJwFb0map4kJ1wW5Z6SzgmkBLz6Di1 4+J89Zkp0QYSl/r/M91ckYgeDfnshUAdYUAwDZ3jkVqeaC5CbtrEPPKLwoHihsv1pcmG /tyiLuSpV9SCW9XFjVC1ifDvER1j9gedYUd1vK1QWQQd4onN5NYyUXPI2KEj/go04Yhp Zr4ScnsbSukE3j4I63uUQDzIW1OJlr7uwAlYA0kUv7ChD/LtZbe1m1F/jpYDX6ESedGO IOu21GsUwvi4leEM8WIe359yXNL2rInLotpGuyvnwuKHnGyQ7xGMCL0gsnLrsUJsCRX9 EmEg== 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=JF7kT9Jakz5MXZ7s85w029ixb/+6fikTUFTZrRv4yoU=; b=SaL2epDMLbMH9lxA9jrmyp18KQcN05ZMmyMh5myK5LMe5IuYjfDqKlczerMFS/oDFR fVz8cQLWWqs0dLPdt3UdaD6VP5Ku7cMR7PlFGAIEFbks/56aTDNnX3EWNubTV24ulb+i fHhbHphWn4p3DZeisWM/hyxprBPsdunG06YiabKlOUO9eyP4CXLjLlLo2Yn4F/vxg5bQ Wolw8peyTVTp2NCCSes9ffAroyNpbCYoWvc+TG9VriqysPd4cJoh9qzrLhvufgC4ZY6m 7mtsw6d1WwVmL4eSISpXSGLNESOdDlT6kYT2Ws93rpotNUSgM9+K4n06ToGCx8xAaYbY 6EGg== X-Gm-Message-State: AOAM5319pFsUpiYwZDYpJOC5J3G0pnXARzdqHteMs/UeZk6cEnkfIbFw ZlPkgpgSffaBPqokObHAkIkOgt7zQh0= X-Google-Smtp-Source: ABdhPJxdbJIbUhDSxyWa3OoBkrlsOphRHXMZU37nN6v0gCouNh4gRK5/N8Tw4mT/s7687uE4t+h37Q== X-Received: by 2002:adf:dfd1:: with SMTP id q17mr21031760wrn.347.1599443740620; Sun, 06 Sep 2020 18:55:40 -0700 (PDT) Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id b84sm29377773wmd.0.2020.09.06.18.55.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 18:55:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 2/7] hw/char/serial: Replace commented DPRINTF() by trace event Date: Mon, 7 Sep 2020 03:55:30 +0200 Message-Id: <20200907015535.827885-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200907015535.827885-1-f4bug@amsat.org> References: <20200907015535.827885-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x443.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: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: "Michael S. Tsirkin" , qemu-trivial@nongnu.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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é --- 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 = stop_bits; s->char_transmit_time = (NANOSECONDS_PER_SECOND / speed) * frame_size; qemu_chr_fe_ioctl(&s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); - - DPRINTF("speed=%.2f parity=%c data=%d stop=%d\n", - speed, parity, data_bits, stop_bits); + trace_serial_update_parameters(speed, parity, data_bits, stop_bits); } static void serial_update_msl(SerialState *s) diff --git a/hw/char/trace-events b/hw/char/trace-events index d20eafd56f8..85e39d9d62b 100644 --- a/hw/char/trace-events +++ b/hw/char/trace-events @@ -7,6 +7,7 @@ parallel_ioport_write(const char *desc, uint16_t addr, uint8_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 0x%02x" +serial_update_parameters(uint64_t baudrate, char parity, int data_bits, int stop_bits) "baudrate=%"PRIu64" parity='%c' data=%d stop=%d" # virtio-serial-bus.c virtio_serial_send_control_event(unsigned int port, uint16_t event, uint16_t value) "port %u, event %u, value %u" From patchwork Mon Sep 7 01:55:31 2020 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: 1358526 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=ZAKXwIlc; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BlBJW72PYz9sSn for ; Mon, 7 Sep 2020 11:58:19 +1000 (AEST) Received: from localhost ([::1]:43426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kF6QD-0001kI-SJ for incoming@patchwork.ozlabs.org; Sun, 06 Sep 2020 21:58:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kF6Np-0006F1-AP; Sun, 06 Sep 2020 21:55:49 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:53845) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kF6Nm-0007Ll-Oa; Sun, 06 Sep 2020 21:55:48 -0400 Received: by mail-wm1-x341.google.com with SMTP id x23so2943843wmi.3; Sun, 06 Sep 2020 18:55: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=ZAKXwIlcheRQ7uF37G0Dw/DfnyfX5wqZKGp1+82B+xSifzGM6ZyoVOImVmIi4Rpc4q RLKMsl7/hnNTi0WhrtNcucLt0F/WQNWJbD0P4RpyiGFAtGswN2Eya/MBpN59KOZbFN2/ p830v0NIPzfSaniixt1aM6PCSEl/bdp0p9N/ytv2nLHb0qYUmzL+zhwIeh1ru/TPR3t/ yAjXd1MajOZ4DC4q8nFMkMXJQQxsKBzvDVCo1kZCSFaPN+OrqV4yFLX1Y1z4I/+5iWPJ kHsoNK5qP4nW5/nD5ZqzVdzQo6PYSTtyMr5Q/x/L5NrZwEx/coQH+2clx9c3VE2XrMWa v8KQ== 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=GWpQKoGgktMz4coMInEGyuIX93paISNoPpxZC9NdpdtZyTfvU6i6eelFweo1eQBMxZ ysyzgeV1dN1LPPxYWQg3JIBlGAOHBiK9C/t6nR9vWVMfLchCYXVQIPbDTh4Uo/Ls2Cos 1D2KvdR2obNo2ewE7wnIw9nK0sT3F34Y3eNbb6+THxNFehgqu/yBmqqJot9j5lvfiGd7 dgLi5DFeR86fjZxrP9bgstLDw4Ob4hP0X1FXt+6le38Oo4VqlvwviX/klikzciQycmbf GcFvWz+QtrgQfXtPyS7YG3rgKr/yumsIP9ojsEi1AcLVfrpOPg/x5TTaRiNtcfUMPL26 n2fg== X-Gm-Message-State: AOAM533BKlF0zOTl1h6uMeDIjG8iXp/qtSp2I7S8+9/Lw5uUphG7sTIh uUL+CiQXfcpQWHcRHWAI/tPN+7HhMvw= X-Google-Smtp-Source: ABdhPJwNPzGEimfV5QOVz6vrgn92szWy9wM++PUUZin7MUiYC/kpwkBNb+m+g9zmFtBocHxJClDB3A== X-Received: by 2002:a05:600c:2317:: with SMTP id 23mr19335637wmo.183.1599443741827; Sun, 06 Sep 2020 18:55:41 -0700 (PDT) Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id b84sm29377773wmd.0.2020.09.06.18.55.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 18:55:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 3/7] hw/char/serial: Remove old DEBUG_SERIAL commented code Date: Mon, 7 Sep 2020 03:55:31 +0200 Message-Id: <20200907015535.827885-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200907015535.827885-1-f4bug@amsat.org> References: <20200907015535.827885-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::341; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x341.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: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: "Michael S. Tsirkin" , qemu-trivial@nongnu.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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é --- 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" -//#define DEBUG_SERIAL - #define UART_LCR_DLAB 0x80 /* Divisor latch access bit */ #define UART_IER_MSI 0x08 /* Enable Modem status interrupt */ @@ -102,14 +100,6 @@ #define MAX_XMIT_RETRY 4 -#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); @@ -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 = opaque; - DPRINTF("event %x\n", event); if (event == CHR_EVENT_BREAK) serial_receive_break(s); } From patchwork Mon Sep 7 01:55:32 2020 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: 1358525 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=DDB+MVtI; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BlBJG21cnz9sSP for ; Mon, 7 Sep 2020 11:58:06 +1000 (AEST) Received: from localhost ([::1]:41828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kF6Q0-00014S-7m for incoming@patchwork.ozlabs.org; Sun, 06 Sep 2020 21:58:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kF6Nm-00067B-Et; Sun, 06 Sep 2020 21:55:46 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:38514) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kF6Nk-0007LP-T8; Sun, 06 Sep 2020 21:55:46 -0400 Received: by mail-wr1-x444.google.com with SMTP id g4so14089697wrs.5; Sun, 06 Sep 2020 18:55: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=QQ3fywF3U7FMDEHRpvf9acNc1XCO6x1yzECnPG9z1Co=; b=DDB+MVtIis5U0yp6R2ic47YLBD+3fjbpRQJLkJwFHJCYLMc3mWWdHKmnSPX0tpaoTa ayue6ZuYolMfJGt029y+Dpw8ip9e7hXKiINP81BqeqJzfPkddYkCBAzpbujxisoMzviE /ku2RGwCllL8c2rMoH3ZDDvK2T2eqQeZmj0JCm1ObkFMKP5t1sWpBshEeA8XvQpIMLiu giwX+nhMn8mL3Uvkb7mW04sPOLTOA8ipXvXvGonmD+h4OyIUxVRemXT+Y7Pz54wadjZE zNpTQ8NGlJnDBy7NdIYfBI4r+M2fuWmSF4BcDVgbxdmjFxgpFFoJ7pfSk2yLP8JWV38K Mahg== 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=QQ3fywF3U7FMDEHRpvf9acNc1XCO6x1yzECnPG9z1Co=; b=CVEW+q04bJBlChv+MXhkYvvj+0c4as7LtofGxS7jIPaDId+G+kcqgxJ6/W8P7kuRPW JOqMWkA2j3pgEc5n1A2pE2q4TdLXsqy3OYCMWxel8i8Qs5Oj0FQPv8BNXjrXbj2qi9Zb DNz6ZokbhDKFfOQzAD3t9+9FxnL4ygcx59ZMtQQphyqS8Tda/by7bCeCFeJJ0aP4GkKp 5kb/w6p4+7a/fXa14OmWirELLVAjyL6vbo6jKdVBopWlMskceYweI0fxjO89PW1M+MJQ sj2EWl2TPI55xv0DgrbGNy1BRitkHFZkvExOPXxQiixnaA6F8b51cs3gLlt27nWBWRti zbfg== X-Gm-Message-State: AOAM530ehSSiBKQcn3VYcCswcnaAeSSRRLYXd1lDTkbX4NuT/lkKGoih zZE+qcssNfoXh+lT1taqWKZ1EvIBbAk= X-Google-Smtp-Source: ABdhPJyi0x0cVVoQ+7SHtYPb1M1wl81oPCisPgg8JJWhaYjB9CXUFHhVU22DLzEkwhPYgYnZ1ZdRXA== X-Received: by 2002:a5d:4e8c:: with SMTP id e12mr6280124wru.180.1599443742996; Sun, 06 Sep 2020 18:55:42 -0700 (PDT) Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id b84sm29377773wmd.0.2020.09.06.18.55.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 18:55:42 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 4/7] hw/char/serial: Rename I/O read/write trace events Date: Mon, 7 Sep 2020 03:55:32 +0200 Message-Id: <20200907015535.827885-5-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200907015535.827885-1-f4bug@amsat.org> References: <20200907015535.827885-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::444; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x444.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: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: qemu-trivial@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- 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 addr, uint64_t val, SerialState *s = opaque; assert(size == 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 = s->scr; break; } - trace_serial_ioport_read(addr, ret); + trace_serial_read(addr, ret); return ret; } diff --git a/hw/char/trace-events b/hw/char/trace-events index 85e39d9d62b..cd36b63f39d 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) "write [%s] addr 0x%02x val 0x%02x" # 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 0x%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, int stop_bits) "baudrate=%"PRIu64" parity='%c' data=%d stop=%d" # virtio-serial-bus.c From patchwork Mon Sep 7 01:55:33 2020 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: 1358524 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Nu9yn4I5; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BlBGd6d0Pz9sSP for ; Mon, 7 Sep 2020 11:56:41 +1000 (AEST) Received: from localhost ([::1]:34256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kF6Od-0006V1-R5 for incoming@patchwork.ozlabs.org; Sun, 06 Sep 2020 21:56:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kF6Nn-0006B5-V4; Sun, 06 Sep 2020 21:55:47 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:53847) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kF6Nm-0007La-Cv; Sun, 06 Sep 2020 21:55:47 -0400 Received: by mail-wm1-x344.google.com with SMTP id x23so2943833wmi.3; Sun, 06 Sep 2020 18:55: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=0L6FMvGCY7Yqd00xQ/ZxKfuTHVYGmeZNYt98i5HNRDQ=; b=Nu9yn4I572XTs2h/pxBeMKSFLjGP9QBvQ5EEsO3R1rF7zesE2dh8nvd0nrdIqqMaLp ic9oKnFgq6cR/TRt4Hdn/iHYWZaHLT+GrhyXe5nBxvuY1f1Ctu7yIeXfzB62LAbRyqDa I6HIuDYOGDPDIspKcvyQPki2OmqbC2O7KZ2rlz0AIIR05wwcMLuorORaY4ZGvhOmcBQp HTO2MfRSVVimUnQy9hVrbfclPgmuCcH7NPvhWk/5v6y0kdBgTycUkoVhKsy+2t0bNn9C E13N8BLsQt9pKPblQe4CL3U8yGPc5QuvYPP/MNg6ZQR/V4iHcCZH4Co5hAjbUmIl/5Cu 92vA== 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=0L6FMvGCY7Yqd00xQ/ZxKfuTHVYGmeZNYt98i5HNRDQ=; b=FlBQXChFP70ARsl5nvgmK48HtAYz6tgf1jd7Dwg7W8U4S2zeT5KjSSU2MqMNWG/nbx +q+RuiqapzDQv6g9aR6FcrdKHNt0QhV20V4tuqBinGclDdnJt5+Z6+aohmsALGBNSZDv 9vyLvoUzxCRjvhK3Qbt/wNe/jIIMvk68fL+EenMCKEXiPc2x3pmgnuB+2F7AyWcf41a6 ZFz1fMvJq5x0ZXxP6fFax2kExSuHWYO7ETS8e4B4CawYmoI+4Cf7cbn3DbFWVst2LUwA xVBVWZU6D0yK4OzD5CWRHN95ALGBhTgNTyBKSGnhLK5DMJtP6lrw5MK4GRz9RjMDUyny T5Rw== X-Gm-Message-State: AOAM531yiBuRAEB3WVNLHyE4Z2vtNhOiWC3DFW4mp/d3LBDSMTK8UnIt 5a7c7t20om/qHUzHxJlZYePUZnksyLE= X-Google-Smtp-Source: ABdhPJz0+Wx8FlePRpciApvzJoZqsUGQeqDUyIJzpgtF9yr1rUki+orEphbcJKcqE9s5fB3m0cYnDg== X-Received: by 2002:a1c:7c13:: with SMTP id x19mr18864165wmc.45.1599443744300; Sun, 06 Sep 2020 18:55:44 -0700 (PDT) Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id b84sm29377773wmd.0.2020.09.06.18.55.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 18:55:43 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 5/7] hw/char/serial: Make 'wakeup' property boolean Date: Mon, 7 Sep 2020 03:55:33 +0200 Message-Id: <20200907015535.827885-6-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200907015535.827885-1-f4bug@amsat.org> References: <20200907015535.827885-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x344.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: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: qemu-trivial@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- 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 535fa23a2b8..3d2a5b27e87 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -60,7 +60,7 @@ typedef struct SerialState { uint32_t baudbase; uint32_t tsr_retry; guint watch_tag; - uint32_t wakeup; + bool wakeup; /* 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 b4c65949cd8..a0c338796d5 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -116,7 +116,7 @@ static Property serial_isa_properties[] = { 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(), }; 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 = { static Property serial_properties[] = { 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(), }; From patchwork Mon Sep 7 01:55:34 2020 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: 1358528 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=TT96a143; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BlBL66k3Sz9sSn for ; Mon, 7 Sep 2020 11:59:42 +1000 (AEST) Received: from localhost ([::1]:49738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kF6RY-0004GU-Sz for incoming@patchwork.ozlabs.org; Sun, 06 Sep 2020 21:59:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kF6Np-0006FQ-Ir; Sun, 06 Sep 2020 21:55:49 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:33177) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kF6No-0007M4-2x; Sun, 06 Sep 2020 21:55:49 -0400 Received: by mail-wm1-x344.google.com with SMTP id e11so11335164wme.0; Sun, 06 Sep 2020 18:55: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=rOdtOAtfcg70s6XvC95J7b24iDolYSlhUR8qCVqx1mg=; b=TT96a1438TOU1/6XpjJ8jj2zBffaiIoSy0PrPjy/Ye7Lj+J3ZhA8EyX/9nIO75eO27 OspzVsLIAY4GzBsdrgV2/qCgv9hHMiCL/LUUC2fK74JnxksNAh3ZCVqgpYQxt4Q7pOdQ VaHrUjCCooeQSWR3kRfnDbz9K2fn4pOlyBm9xvxUkQ4D0prr0oPhH6JKO6j948TYJuGo 0AENerUpdiidW8eJgYhJF37rXkvjtHmffAQ5EcZLRR+UtOlTfXF0wWN6aRSXB2JTWHPY 1gqSeMlrCUC6nx4HRrXe3SVrdS69w4lWdklPqL0z9rtRUhQ1/zABfaWez8LkqBHlqPNb GA7A== 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=rOdtOAtfcg70s6XvC95J7b24iDolYSlhUR8qCVqx1mg=; b=k/J7waaRDhtmANu46MTOfYAaQEj5FVoc6QzwLAG7uYtfegJoCPfVtZ7mzd/z6O2L/d h+eZKBQUcUEwNTyAkHL2EFz4P2WBsbv+VO+ktj4Nho//8zmKiuCG8DNHL+fUKh+D+RpG MEPI14BrGRpYCF15lYgpyAtqVtga9PS23Z+jtQHGsCCiLdc2MBegn6z1mRLjienfijex 5QDlvspQcpKxhhDNCBLsd0rU1BIF8eklOGN+6t0mZdAOlg194vfQVT/uefVseWUsQX63 WY+Ez9wmqlKsibsHymC27z2Iujpeg+H7QyoJVm09Rvw7e+R/1vDgzsZObSS/UZJ2tlKA tI8g== X-Gm-Message-State: AOAM532AhrW484EE6AE8Zt8ArDJhp8YFWqIeYCBBE0EaCb1U3y6Yxtsp T7ArO5R3jBCU3n3szDAuV+2QzSFAdrc= X-Google-Smtp-Source: ABdhPJyp8VaHrFYgHeJQJsDHWfkSgg16a4KeNBjBfG3vUUMYvh7lgQs1hEDw1k3xQa+VU3SkLTUYAw== X-Received: by 2002:a1c:6145:: with SMTP id v66mr19218611wmb.171.1599443746206; Sun, 06 Sep 2020 18:55:46 -0700 (PDT) Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id b84sm29377773wmd.0.2020.09.06.18.55.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 18:55:44 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 6/7] hw/char/serial-isa: Alias QDEV properties from generic serial object Date: Mon, 7 Sep 2020 03:55:34 +0200 Message-Id: <20200907015535.827885-7-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200907015535.827885-1-f4bug@amsat.org> References: <20200907015535.827885-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x344.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: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: qemu-trivial@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Instead of overwritting the properties of the generic 'state' object, alias them. Note we can now propagate the "baudbase" property. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/char/serial-isa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index a0c338796d5..0626edda8d1 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -115,8 +115,6 @@ static Property serial_isa_properties[] = { 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(), }; @@ -137,6 +135,8 @@ static void serial_isa_initfn(Object *o) ISASerialState *self = ISA_SERIAL(o); object_initialize_child(o, "serial", &self->state, TYPE_SERIAL); + + qdev_alias_all_properties(DEVICE(&self->state), o); } static const TypeInfo serial_isa_info = { From patchwork Mon Sep 7 01:55:35 2020 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: 1358527 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=A+tOfRsY; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BlBJk550fz9sSP for ; Mon, 7 Sep 2020 11:58:30 +1000 (AEST) Received: from localhost ([::1]:44490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kF6QO-0002BV-KQ for incoming@patchwork.ozlabs.org; Sun, 06 Sep 2020 21:58:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kF6Nr-0006G0-0O; Sun, 06 Sep 2020 21:55:51 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:54362) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kF6Np-0007MO-G9; Sun, 06 Sep 2020 21:55:50 -0400 Received: by mail-wm1-x335.google.com with SMTP id s13so12842105wmh.4; Sun, 06 Sep 2020 18:55: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=wF4VBmCfS9zKcYQvvNCwbCMf1/hOUCUDtnmmxztSuOU=; b=A+tOfRsYi/AS2aMt6hUHW5BkWISmIH2BCCjEQWD4HndeIYLsQfqQLlIUfoFFTi1z1M rnGO5CjnV73+5YCkpwtHXHNz8VwdNie1sytnYsgLlghFjfaY5vyAvZMqqiJB8uagTeSw x6SVuuVVDThh5CV+LFSO+JGb/tlyZvKpx6GcBZkpY5BYOVqeWrk4KcZy6cwY4wIfAIok t1rZkrCwmlDV/xK0Axye3T2iUaBjQJ777GL2oHePfEAr3tuyeZMtSjr5IwAxWn008+gl YXGanU3e4qysp92XRjIS0oKo+/e2lx+mOuEGFQi/BjCOmAXONS29p86ZodboKJcvbvHB dvMQ== 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=wF4VBmCfS9zKcYQvvNCwbCMf1/hOUCUDtnmmxztSuOU=; b=hoOeWRlbjsL+UUWSdwzLkupqzKio1SbNk4NRpZdc0n8OkCL1/o0vixSx0sECb411Zn SNceheANHWFfVExPiEtUVGodva3aawyyG3C+rYPeLxUFPsm5AK+Up0Effxe3WvvZvGxT fDsn1NsunXDSrLedTH1kfrdyFVJ3s1bQ+I6PZ16ceSOAsRwzTs5ySq/zbdOR6G8DX6s6 mi6KGjdwav8P71M5VmTkvLdsByDkvxXiMCV1ZNgZr4o2mOYMoLh/mqSJ3+VD2Y2rGebM W5nNlAAH/5AbJd+naqwznyhLvQvtUkW09y6+dM6CkmyHIvjk/V0gFV4P3I5CDpgStL84 lkdw== X-Gm-Message-State: AOAM531eapm51bj8kR9wC6nQpOle1aPnIHBgVJ+boeGI+pS5YaXVkiYU tq120PwjM+rxzYbNB+TmVy8xierAsWg= X-Google-Smtp-Source: ABdhPJxMVAy0UvsXBDC0vR3bqXONvU4Jmqf0AfclvlQ0Q3fUUlWEH/DQK+/tR6IAYuCvZhosFtoE8w== X-Received: by 2002:a1c:e0d4:: with SMTP id x203mr19691036wmg.91.1599443747539; Sun, 06 Sep 2020 18:55:47 -0700 (PDT) Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id b84sm29377773wmd.0.2020.09.06.18.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 18:55:46 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 7/7] hw/char/serial: Let SerialState have an 'id' field Date: Mon, 7 Sep 2020 03:55:35 +0200 Message-Id: <20200907015535.827885-8-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200907015535.827885-1-f4bug@amsat.org> References: <20200907015535.827885-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x335.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: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: "Michael S. Tsirkin" , qemu-trivial@nongnu.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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é --- 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 3d2a5b27e87..3ee2d096a85 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; + uint8_t id; QEMUTimer *modem_status_poll; MemoryRegion io; } SerialState; 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 = stop_bits; s->char_transmit_time = (NANOSECONDS_PER_SECOND / speed) * frame_size; 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_bits); } static void serial_update_msl(SerialState *s) @@ -333,7 +333,7 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val, SerialState *s = opaque; assert(size == 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 = s->scr; break; } - trace_serial_read(addr, ret); + trace_serial_read(s->id, addr, ret); return ret; } @@ -1013,6 +1013,7 @@ static const TypeInfo serial_io_info = { }; static Property serial_properties[] = { + 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 cd36b63f39d..40800c9334c 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) "write [%s] addr 0x%02x val 0x%02x" # 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, int stop_bits) "baudrate=%"PRIu64" parity='%c' data=%d stop=%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 data_bits, int stop_bits) "id#%u baudrate=%"PRIu64" parity=%c data=%d stop=%d" # virtio-serial-bus.c virtio_serial_send_control_event(unsigned int port, uint16_t event, uint16_t value) "port %u, event %u, value %u"