From patchwork Wed Mar 5 01:21:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 870523 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:178f:b0:38f:210b:807b with SMTP id e15csp551369wrg; Tue, 4 Mar 2025 17:26:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWnK51aTOxBByvCURt9UsMBc5OQCQzgXlcneqjOTItCfAZiT8eCr4MNAKL3zZRkKQgIIHgx5w==@linaro.org X-Google-Smtp-Source: AGHT+IFsf3yT2CvqmLP0OdQvX1xevTlzMRz7HguEilKWFSgauHfnQcoJkIAxCCab958bd4r1/GMW X-Received: by 2002:ac8:5d4f:0:b0:472:31:851 with SMTP id d75a77b69052e-4750b448474mr17937311cf.22.1741137994913; Tue, 04 Mar 2025 17:26:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1741137994; cv=none; d=google.com; s=arc-20240605; b=ftDtdsI2wivAYIf5twXC+ozKtLvoPTo/4gWWyRgQ2fdphYZxb32ndsQ3uZpe9Vrlgw hHM6gDh98l3Y796Q96q1w2CJm2XvOywZudsmhKJrPXY2Gbt1CbAnn1/KekzYptp8P1+z hGOqJQh8W+wA4K7PaiGG0NCdoaUeIac1Gze7WU5qcFpovXvb6BXC5tDsLwY47cYMVowO KIyTtsD6hbPfl7vvnsWtnEJXFuhiCm+E5AaZrzJZLEZbQZsfawTNmsnCilqh77zyaLSs aMHjjPi7XvMx4VZ4oIyZh+hLuO8zRexvbOSaaYpBZH+8Zc5NVW8uf2T9a2k2HFJu+yVH 2XAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YXL5B5zw3pZta0/9DCa7fbyWVn6oj5wqXc+Tu2wdyGc=; fh=9DLyNDBFtS22m2yIEtfCqg2tLfqboWhSCRa/yJlXpM4=; b=iB4dUuBKyv/j4iX1qSqnLWJb2QzHCYfuJKSO9istM8dKHl7+tp/ni9EUYBWnhSbwCV +EyR8dHA76uFkCjDwHBd3rwwy1LtvT4NUxLeq7Kt2RYXAMAOyNqqtgvZOX3sBGAhyfUt cCSqc+IaM2p0rHMVMPHOCCxN/qoW27ybqA06WleenxGNg5LmC7Ist3rfpoab66xWe+6Q S0XsWl3brPlSWwiVnpHnZ1Enf2hpgCFTaiGQqCjJ0OFg4WGBb3ZwTb2Z0H/s9t2eRTXi 1hn+2EHoSC8lb2ZwOT/xNgOBZjH763/91MNPlDk7D1KUzEGc8sbKw8WmAsYmslvpf1HD 5+ag==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lPhjsJhh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-474f54c9bdfsi39037081cf.474.2025.03.04.17.26.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Mar 2025 17:26:34 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lPhjsJhh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tpdUr-00037j-Vo; Tue, 04 Mar 2025 20:24:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tpdU0-00017G-L8 for qemu-devel@nongnu.org; Tue, 04 Mar 2025 20:23:36 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tpdTy-00076h-TB for qemu-devel@nongnu.org; Tue, 04 Mar 2025 20:23:36 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43bc63876f1so21509305e9.3 for ; Tue, 04 Mar 2025 17:23:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741137813; x=1741742613; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YXL5B5zw3pZta0/9DCa7fbyWVn6oj5wqXc+Tu2wdyGc=; b=lPhjsJhh1qGpQTamOxZIoAJ6mnhtpFCBrkCBdqaVgtNDLpyk0Cb3opFylqsOTLEdWA Lp6QTM9o9im3+WoMPNwod0Nq9CwJPhoho1o+4kERSY7cBvUbcOS5if4jK8oRtlMSWG8n I6jbph/wRMWET26IMhK6CSzfaAgdrAXTi/zi02yz6A818cX0Uq0tbg2+dTWZWtkjlZ3B r35pB3c+MxSVXJNlQ5FPrV+Xjugv5qGENU/dtTQmKWw8zRdio5aayz7NkEWJncM/w37N 8InxAFZ6Ntp/EfT1QMLp8ZziXFY/2t/7rlAbMybkoM714VK1VVXVEMvTGKf8Qte2AkJi +saA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741137813; x=1741742613; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YXL5B5zw3pZta0/9DCa7fbyWVn6oj5wqXc+Tu2wdyGc=; b=sROAVgZdid3AHzqIENrRBfVvYALefCveAS2+qgS56fh/TkMYKLa9hovOn0+he52cDM W+wY8GwWwDqASmtwuujyQAgps2RoSR6AgkiliKRmRFuIRIp5LrdiC8E8mt5pHUS391FQ Jv/4Ac25IwAI2AOHrBxxBL+joz24Sh8fPb+cMixtEOmNS6QCXEu0sszyANmlDyq2fnjy cssn7GLQQLPVEj9iQ6F5kZnwXvzlAUFsvAb2aRdo+SWBrHjxIEmWez5lmbJyd4smZQt4 ukYQyz/oRzoV5VYb9tChpcTQkKm5jVI+nJvfQoedpKfpA1PntT6wHRNUhz0VPA8IJxkO Qo2A== X-Gm-Message-State: AOJu0Yx2vqg0hJtp3nbQUzxh+k1MrfecBX52Wr3rz4zNEuucD/wtaVol BTFqxpu/NQe3wOyABcUDiqqdCzqUFCkp1x30yNcronfH2y5UBv6Tq/++FeuctaA0dmC4aEX1pGJ SynI= X-Gm-Gg: ASbGncvZhYTbvLxemymL9Fqqx4DRXc272tw0dv/U+3MgtxjuxBsOn/2FlasPKpLvPoH FklUjiau4SiJIRK/7rSd4CJwyFKXo3mdhmvL6FZpb6zNY+lkWJbqH4tEFLsT+/pFHLMTlxb82tC MR6EopKPo9YiHfs+fCWnLZ83Fm+ivrXprZXoQbpyHbX0tdnxn5NjJsUAiHJpe9xE8dQVIyKxUBX EnCGCBSAWV/Zz0dsFzholFpwRLiz9JdfaNnkwdcMGfCr1CqH/hGioBn6ia2bSZhBTtGvJFiGAsf yY6OIUkrSS8D9psKJtLlDINOP4prSLaEfospGGHFy8h6d4y63fMeYfXhZ40dV6HsNsxFo27Yzps 6wP6YLRM16kdv0jaOIyA= X-Received: by 2002:a05:6000:4185:b0:391:5f:fa4e with SMTP id ffacd0b85a97d-3911f7476b5mr487607f8f.29.1741137812850; Tue, 04 Mar 2025 17:23:32 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43bd42e51e8sm1956345e9.26.2025.03.04.17.23.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 04 Mar 2025 17:23:32 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Luc Michel Subject: [PULL 19/41] hw/char/pl011: Warn when using disabled receiver Date: Wed, 5 Mar 2025 02:21:34 +0100 Message-ID: <20250305012157.96463-20-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250305012157.96463-1-philmd@linaro.org> References: <20250305012157.96463-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We shouldn't receive characters when the full UART or its receiver is disabled. However we don't want to break the possibly incomplete "my first bare metal assembly program"s, so we choose to simply display a warning when this occurs. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Luc Michel Message-Id: <20250220092903.3726-2-philmd@linaro.org> --- hw/char/pl011.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 06ce851044d..12a2d4bc7bd 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -85,6 +85,7 @@ DeviceState *pl011_create(hwaddr addr, qemu_irq irq, Chardev *chr) #define CR_OUT1 (1 << 12) #define CR_RTS (1 << 11) #define CR_DTR (1 << 10) +#define CR_RXE (1 << 9) #define CR_TXE (1 << 8) #define CR_LBE (1 << 7) #define CR_UARTEN (1 << 0) @@ -487,6 +488,14 @@ static int pl011_can_receive(void *opaque) PL011State *s = (PL011State *)opaque; int r; + if (!(s->cr & CR_UARTEN)) { + qemu_log_mask(LOG_GUEST_ERROR, + "PL011 receiving data on disabled UART\n"); + } + if (!(s->cr & CR_RXE)) { + qemu_log_mask(LOG_GUEST_ERROR, + "PL011 receiving data on disabled RX UART\n"); + } r = s->read_count < pl011_get_fifo_depth(s); trace_pl011_can_receive(s->lcr, s->read_count, r); return r;