From patchwork Mon Jun 10 16:23:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 803014 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp2027276wro; Mon, 10 Jun 2024 09:24:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWvzXD69K2MbUQlSdbpv7SOvOARf8Lp07c+WK63mit1d9c6m8NDYJfbGJFA33SQP6SFP0pI2jjSc9ak2xrUZ6tG X-Google-Smtp-Source: AGHT+IEcxwThZKrh1EmLgdpfGu5MHOwESXlXUQxFZ7YWg3fOYhmmL/v9nE2PFIGT4tOLdmmmV+xF X-Received: by 2002:a05:6214:5d13:b0:6b0:6a57:c982 with SMTP id 6a1803df08f44-6b06a57ca4cmr78026276d6.28.1718036685830; Mon, 10 Jun 2024 09:24:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718036685; cv=none; d=google.com; s=arc-20160816; b=n9Q+8gBCQQC4TZsib3tX96hYDMXLkwC+USgLqnNNWKf1O9NB9dhhBoPQDKkV9CsOT7 1oA1wZwBsnn8tSQGMS+OaJgebIKw4hU71UWPa+ysmuoAnWriMXTE36j3CJQTkVW0UYrQ iFlN7gLbCuVByBhmUs0G1RG0jepBn+Mnn3EO9p3Y22oo3W7w5VDngVPbJQBIgjNwfvcg Zc95l7MMnoFVBiJ3hg4JADzy0FSUX/T1n3DOD66cNPx+oJ/gPv56hYKY7Qs4OOCOvKDm ACjXevg+NILvvYI36U51/1pzbElibTO5NqItgIswNxROLOl15d0ok7+5kvsExk2I52pt 529A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:to:from :dkim-signature; bh=/dekw1Nq/R1iKuokZ48Fce0bxwVPPxY2BoQfPyzI3c4=; fh=ju0ao5qpIPOgNChj+9VWHlPDBxQXQCaaH5ZKIXTrZaQ=; b=XXcBAomQe8yW4xnfMsUTyKtMwbJvTmsApDwrQRHOM1sOOX0RnOKxDrTX5/E5AzVFLD /r4PDDc1WBwr2YPJpVVR2iNAMT91EQrl/lcYSIS4FXM1W83Hw9uW7rSJ+ajLoI2RXY6J T+2SqIHwbtxABTzDqZWpi0JFKHMfm81IJjP4cyDS9bUQKKoeVDvtY6Eem493fzAc9JUB /VqHvMMyd4D+aTpAaz1gShWW/Tixxw2m1lSWcfwCdV2QDnrFbuDwWu+6+k1Hlv0xerZB EmLIs338FxSee88okBZDrIUzReCqWbasLQxAce3oZG4UsZSKXy+PFaG0GA++sbpg/vym nfAg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fOBfi8B7; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b087d4b872si7222366d6.325.2024.06.10.09.24.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Jun 2024 09:24:45 -0700 (PDT) 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=fOBfi8B7; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sGhoG-000461-NC; Mon, 10 Jun 2024 12:23:52 -0400 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 1sGhoE-00044n-KH for qemu-devel@nongnu.org; Mon, 10 Jun 2024 12:23:51 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sGhoC-0005l5-4K for qemu-devel@nongnu.org; Mon, 10 Jun 2024 12:23:50 -0400 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-52bc274f438so177369e87.0 for ; Mon, 10 Jun 2024 09:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718036626; x=1718641426; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=/dekw1Nq/R1iKuokZ48Fce0bxwVPPxY2BoQfPyzI3c4=; b=fOBfi8B7GXoFWoHSywI7b3jCkXMTdpEsZib6V+vwXdB7/8BotbGb8qHU7oNe1aXwIV XWux1YIA5DiK1RukgpP7VceXuaGKwZp6/m4eyNxOPr0YV8LLsCRP6PVnsM+tPOEWj/I2 QRmbjtv5SDHFU+M9oQkaRepumMDY458eRNFnxJIqI5AhQM/s5ASyc+PNoKYm4o9TjGQP TjxLn4LWUOIZn+k3o2fHX9u/bD6BxvoObGUZiknJ/dBeauO2OiBc/RQfj+zXlpJ03bAZ CT4hRTYV4/Ii+wLB0b1K8FTHUh9XSUSvVEIWbnl/l39TT8QVA3APnQaL0ujj1B7aWQWa W0hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718036626; x=1718641426; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/dekw1Nq/R1iKuokZ48Fce0bxwVPPxY2BoQfPyzI3c4=; b=h+2Hw6IskL/O57q7cNX/sboutCI0u7NQcKKmgEKcczEH8QTVmCGnIK1Mb+u1A5Rwfq Ad4uKQbW43iGWG7zogZTalFZZ8YlnP0qZkTzRg12tBYO9/MfPmkgsJNtTZbcgDmoSR6g KFmeyVJhSV/IIw3R8/te8xiF0TjbdiH5mq/9j44SmeZ9tQdOsrK7644CuTd5dpMvi3W9 LFqyGKnbq14JLL9DpNCswrxAZVo+3fZufWDAM63H+iCGFZeW6QonpWZoOso7R0ClGSvL Vx2wybTZ5YEQcThk2MG7fa30bTnUezJ7sS5/b++PTHgQCAnt9gF/ia7PPoXf1nuQQ23q jxlA== X-Forwarded-Encrypted: i=1; AJvYcCXXE9cygrEmGrROotS6v942PPrzRVvg5W14ZKdJujA8FpJAznnapgTRU/vlkmeXfKMzFQGeUWyhZAQpVW4YgN4GsWbhOXU= X-Gm-Message-State: AOJu0YwE5WodCMbHqYELzY/4PWJGBKQJLjnDMS0mehahTTYj2gp80iuk RbdXp1vjm73im0iJ/+Vw3SToCI6wyI//7PMtD5667Z52kdhLbO1WaTZUqY2cQ0PUmG1/wyf6dlb d X-Received: by 2002:a19:641a:0:b0:516:cc2d:f6a1 with SMTP id 2adb3069b0e04-52bb9fc572cmr5544207e87.51.1718036626155; Mon, 10 Jun 2024 09:23:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c2a6225sm147250405e9.25.2024.06.10.09.23.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 09:23:45 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 1/3] hw/arm/virt: Add serial aliases in DTB Date: Mon, 10 Jun 2024 17:23:41 +0100 Message-Id: <20240610162343.2131524-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240610162343.2131524-1-peter.maydell@linaro.org> References: <20240610162343.2131524-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x12e.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, T_SCC_BODY_TEXT_LINE=-0.01 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 If there is more than one UART in the DTB, then there is no guarantee on which order a guest is supposed to initialise them. The standard solution to this is "serialN" entries in the "/aliases" node of the dtb which give the nodename of the UARTs. At the moment we only have two UARTs in the DTB when one is for the Secure world and one for the Non-Secure world, so this isn't really a problem. However if we want to add a second NS UART we'll need the aliases to ensure guests pick the right one. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé --- hw/arm/virt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 3c93c0c0a61..0c1dab67c00 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -284,6 +284,8 @@ static void create_fdt(VirtMachineState *vms) } } + qemu_fdt_add_subnode(fdt, "/aliases"); + /* Clock node, for the benefit of the UART. The kernel device tree * binding documentation claims the PL011 node clock properties are * optional but in practice if you omit them the kernel refuses to @@ -939,7 +941,9 @@ static void create_uart(const VirtMachineState *vms, int uart, if (uart == VIRT_UART) { qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", nodename); + qemu_fdt_setprop_string(ms->fdt, "/aliases", "serial0", nodename); } else { + qemu_fdt_setprop_string(ms->fdt, "/aliases", "serial1", nodename); /* Mark as not usable by the normal world */ qemu_fdt_setprop_string(ms->fdt, nodename, "status", "disabled"); qemu_fdt_setprop_string(ms->fdt, nodename, "secure-status", "okay");