From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888312; cv=none; d=zohomail.com; s=zohoarc; b=N1ud6qiXdE9O1VnLN/qigq5YHCCTgPLKow+ReDEn/uPvysMcSaZq4ltdGt0KM9Wvmv8MlSILyvxUJ5OhGIwE8I/OOmnCM1+jZwLYSQGwAYzXWqpCaldrpdTwSBCXVg0Jb9LmkHbMBb//Ol/cwMXu98zxU+1Ea/NA8WPz6rUqOwY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888312; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=QRkC6R0A/Ijw4AEfBzkD0qNh2L8zWNNbkytmxmpXoIc=; b=n20KNQi00Ydqy372i9vbtTm8XAjeQPIEIE+RSHgmz/iqzWBHAQnJpBzTLS6gNvabBz7xbeSQORSAK0xXHAIaMirLJ1+E/c3HKeayAaJ5dnl7vDymf3ng8l00Gc5ZQQtoZtIWpjrpSJxFDJGAH2VgtI7aQG+xcOHVFf6RaeMGMqc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888312958861.1778221896758; Fri, 2 Feb 2024 07:38:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvau-00008j-D5; Fri, 02 Feb 2024 10:36:44 -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 1rVvas-000067-2r for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:42 -0500 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvaq-0004Qu-Gy for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:41 -0500 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5113e895660so77666e87.0 for ; Fri, 02 Feb 2024 07:36:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888199; x=1707492999; 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=QRkC6R0A/Ijw4AEfBzkD0qNh2L8zWNNbkytmxmpXoIc=; b=gU2miu2P7k7oQubb/N2xRy5//kpVWeCfItUx0o3bso+9Kp+W/fTpYnxYpYzrKPciW1 g+EyYIurLAeP9UBM53YltsFACJnimnqehCXy1vtkBcJ/OD5UWF423wXBLie1S/g8f8Zz 52M0CnP4I58jaSMkP9BYcQnlL9jv0sOQFT9ZXDpThsSeBivKVd/N0vfTJixukNXpjqP5 HamczlptatubjCKAfXMWlGL4mZTCf5NGyHQddxc/+VKn6xCuowfncsn+Z159hKl7yK+j iztd7eN7AAztW13R4DdHa7iai8JYTV1alNHsv57Kl0G6toxK53jxVWIv1A60EnPdw4oW T7Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888199; x=1707492999; 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=QRkC6R0A/Ijw4AEfBzkD0qNh2L8zWNNbkytmxmpXoIc=; b=Mssz7xn6eKMChls9Do9TVnT8OrtRvCbn8fFapkjuxJVzkTz8ifPwFwJkup+jKKCz4A KyE5Mj2EwB6795oWxZ77z6JoN/rO6J2nHwLm3HUH120VJHgi5ROqKl/xMfSbCvuzLVK4 mCRG7iPTb5e6NaTYjinTM6XtLVm1Z/bngS5X8NLij4NLx+cf7gDon70KUIS+iMHHBmwz 7QosW3Ujs97mkYhGyAzH6g3c8DibH+87bXG4yALXvmak6Ymmwxf/SDfFoGR/XZY6Z/a0 RF6yVP9EpxmhlsfuwLnGwbZ5pHRCaxwl/Ff9IWjpu00K62aqnbOmnPPIOUVZlW36mrcZ gsWQ== X-Gm-Message-State: AOJu0YzEZh9OhSxqApQtgroglVp2p6B6mLI7TERRKr/qPpVly96OFi2x cFAQX7iCNOAsdVrSyEiiuJ78uCR3dIUsqA1wlruwLgxCq2FouTd8DTjaqB183WuWNSV/nQ1wuE+ 6 X-Google-Smtp-Source: AGHT+IHFR30meajtkVe46CiVUIqFDI83OgR7aQCJY2+NIyZbuIy9vXr5yrN321+7fWIzlPFpI5r4Xg== X-Received: by 2002:ac2:5ed9:0:b0:511:325a:948b with SMTP id d25-20020ac25ed9000000b00511325a948bmr1652424lfq.30.1706888198784; Fri, 02 Feb 2024 07:36:38 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/36] target/arm: fix exception syndrome for AArch32 bkpt insn Date: Fri, 2 Feb 2024 15:36:02 +0000 Message-Id: <20240202153637.3710444-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x134.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888313933100013 From: Jan Kl=C3=B6tzke Debug exceptions that target AArch32 Hyp mode are reported differently than on AAarch64. Internally, Qemu uses the AArch64 syndromes. Therefore such exceptions need to be either converted to a prefetch abort (breakpoints, vector catch) or a data abort (watchpoints). Cc: qemu-stable@nongnu.org Signed-off-by: Jan Kl=C3=B6tzke Reviewed-by: Richard Henderson Message-id: 20240127202758.3326381-1-jan.kloetzke@kernkonzept.com Signed-off-by: Peter Maydell --- target/arm/syndrome.h | 8 ++++++++ target/arm/helper.c | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 1a49767479f..3244e0740dd 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -25,6 +25,8 @@ #ifndef TARGET_ARM_SYNDROME_H #define TARGET_ARM_SYNDROME_H =20 +#include "qemu/bitops.h" + /* Valid Syndrome Register EC field values */ enum arm_exception_class { EC_UNCATEGORIZED =3D 0x00, @@ -80,6 +82,7 @@ typedef enum { SME_ET_InactiveZA, } SMEExceptionType; =20 +#define ARM_EL_EC_LENGTH 6 #define ARM_EL_EC_SHIFT 26 #define ARM_EL_IL_SHIFT 25 #define ARM_EL_ISV_SHIFT 24 @@ -94,6 +97,11 @@ static inline uint32_t syn_get_ec(uint32_t syn) return syn >> ARM_EL_EC_SHIFT; } =20 +static inline uint32_t syn_set_ec(uint32_t syn, uint32_t ec) +{ + return deposit32(syn, ARM_EL_EC_SHIFT, ARM_EL_EC_LENGTH, ec); +} + /* * Utility functions for constructing various kinds of syndrome value. * Note that in general we follow the AArch64 syndrome values; in a diff --git a/target/arm/helper.c b/target/arm/helper.c index 945d8571a61..a0041aa0ec7 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11015,6 +11015,24 @@ static void arm_cpu_do_interrupt_aarch32(CPUState = *cs) } =20 if (env->exception.target_el =3D=3D 2) { + /* Debug exceptions are reported differently on AArch32 */ + switch (syn_get_ec(env->exception.syndrome)) { + case EC_BREAKPOINT: + case EC_BREAKPOINT_SAME_EL: + case EC_AA32_BKPT: + case EC_VECTORCATCH: + env->exception.syndrome =3D syn_insn_abort(arm_current_el(env)= =3D=3D 2, + 0, 0, 0x22); + break; + case EC_WATCHPOINT: + env->exception.syndrome =3D syn_set_ec(env->exception.syndrome, + EC_DATAABORT); + break; + case EC_WATCHPOINT_SAME_EL: + env->exception.syndrome =3D syn_set_ec(env->exception.syndrome, + EC_DATAABORT_SAME_EL); + break; + } arm_cpu_do_interrupt_aarch32_hyp(cs); return; } --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888396; cv=none; d=zohomail.com; s=zohoarc; b=Tbs10st6x+P/XvRpTUqCL1N1ajlemBLKyhY4QTNFYFwmpyBHe3BVkMANh6YjsMdXTUQb9+UJPFd5ZcFz8V1VD66GfGJMpLaxMtMCWVMOQsrYfXZSS3se1xPNy+8GJolTIu3BdR7mJlXG7ip4XhWLHMtFrP27a88x2xz7t3lsqW8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888396; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=fNKMg/ZJY1ZR/wqUXxwkSX5uKgQGaWhsDdzDVMFs6JA=; b=kMI64f7FSs3551jqp+93KvhtWUm8Fl43NIOu26CVn7Zk/bNReVYzrnL9hrwjB4zX7gz28Uly4ujTiumFEm6ZI6AVt0fL9eEX3VFBrwNW3/vX0GT8LPI1WiewA7btiwN9z+oWc78VCdGgCiXMk1urfPUBXbK3snw+c9oxUFXiy3M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888396014726.3207379443274; Fri, 2 Feb 2024 07:39:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvav-0000Am-0p; Fri, 02 Feb 2024 10:36:45 -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 1rVvas-00006B-8j for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:42 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvaq-0004R3-LV for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:42 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40fb804e330so19839685e9.0 for ; Fri, 02 Feb 2024 07:36:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888199; x=1707492999; 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=fNKMg/ZJY1ZR/wqUXxwkSX5uKgQGaWhsDdzDVMFs6JA=; b=eBxRUWviyRJKrmMJ5jL7eI7MQG27cqRh9/OmsryNURJIYoesqwKL7LH6rdJ8aGrwsP RfQpqOTblLmJZZSRBERooG2OuPiq4P4jW43B8UGl8AvFwRPQSBmkCSUZDUgqbR9QGPtm cSG8AgB1Thk7qKLh0BysvoMngUnhfwPSGALkbNX3sgc/8NNzzS6oeO1+pO8OiBQ1GMVX yvyIZBfjUS5tS9lvRwLlPoBJH4Dg/gAQqoeP/B4JY1pwXqmSpYKAg+qJePJGN1qiU5mo mvk4l7llveiEQtozRI3xlCgmgLXHmrcIpG+B4Q5uXDD+GTopO+x1ZJX5xFJx4u1zcP8o vgfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888199; x=1707492999; 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=fNKMg/ZJY1ZR/wqUXxwkSX5uKgQGaWhsDdzDVMFs6JA=; b=l1A20Ww7LHcLQKydv6kIxsFSFsynheWUs6AADbVyPxPcCkpGuO54UYrKI2vy+XXRtL SFWhwHlDn/M7rJFUfa6RtpqQ/Ist79V1E76fhn01vSCqPvuYgvVi/w23DrHTGkWzoc9v a56RUD7DFpWaU+xRNPygiC6B4pwlgnqZtjicEeR6/mIE3DjGpbUXNuyiKDOrVjHG8x/v ddwmcmu2IBoSZSsLcAsqPK7jn1yYDtQi8tlfs4sejWKejOtrRiKqqTO+l26KgIRfQlu+ SIf4F/jDEkEdt5f7Ys4YVxAR/HTzFdtV0FJTv0/w9dyEWhgH4DwnlTEyWYy7JKNkoJdZ 3TcQ== X-Gm-Message-State: AOJu0YwEU+CADU0DwJwl4z4Ak5HwmlM9PI/R/jFixNEF7xNI/DZ+aNbX ZsDvU29DHq9Pm+1j5wwbbhr2HUni8Lput7/bkdBY2n7MMgkw0pbU+kaEhyj93juawym7Ln+Arj3 g X-Google-Smtp-Source: AGHT+IEZtUOeWfpc403KiSe8H004+a6L1umJQdBcmxFPFyn8FXGuS1fNUn6FWMDEJDsPPHEeiVOqMQ== X-Received: by 2002:a05:600c:4f95:b0:40f:b01d:6194 with SMTP id n21-20020a05600c4f9500b0040fb01d6194mr6283911wmq.30.1706888199186; Fri, 02 Feb 2024 07:36:39 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/36] pci: Switch bus reset to 3-phase-reset Date: Fri, 2 Feb 2024 15:36:03 +0000 Message-Id: <20240202153637.3710444-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888396433100001 Switch the PCI bus from using BusClass::reset to the Resettable interface. This has no behavioural change, because the BusClass code to support subclasses that use the legacy BusClass::reset will call that method in the hold phase of 3-phase reset. Signed-off-by: Peter Maydell Acked-by: Michael S. Tsirkin Acked-by: C=C3=A9dric Le Goater Tested-by: C=C3=A9dric Le Goater Reviewed-by: Zhao Liu Message-id: 20240119163512.3810301-2-peter.maydell@linaro.org --- hw/pci/pci.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 76080af580d..05c2e46bda5 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -64,7 +64,7 @@ bool pci_available =3D true; =20 static char *pcibus_get_dev_path(DeviceState *dev); static char *pcibus_get_fw_dev_path(DeviceState *dev); -static void pcibus_reset(BusState *qbus); +static void pcibus_reset_hold(Object *obj); static bool pcie_has_upstream_port(PCIDevice *dev); =20 static Property pci_props[] =3D { @@ -202,13 +202,15 @@ static void pci_bus_class_init(ObjectClass *klass, vo= id *data) { BusClass *k =3D BUS_CLASS(klass); PCIBusClass *pbc =3D PCI_BUS_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); =20 k->print_dev =3D pcibus_dev_print; k->get_dev_path =3D pcibus_get_dev_path; k->get_fw_dev_path =3D pcibus_get_fw_dev_path; k->realize =3D pci_bus_realize; k->unrealize =3D pci_bus_unrealize; - k->reset =3D pcibus_reset; + + rc->phases.hold =3D pcibus_reset_hold; =20 pbc->bus_num =3D pcibus_num; pbc->numa_node =3D pcibus_numa_node; @@ -424,9 +426,9 @@ void pci_device_reset(PCIDevice *dev) * Called via bus_cold_reset on RST# assert, after the devices * have been reset device_cold_reset-ed already. */ -static void pcibus_reset(BusState *qbus) +static void pcibus_reset_hold(Object *obj) { - PCIBus *bus =3D DO_UPCAST(PCIBus, qbus, qbus); + PCIBus *bus =3D PCI_BUS(obj); int i; =20 for (i =3D 0; i < ARRAY_SIZE(bus->devices); ++i) { --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888327; cv=none; d=zohomail.com; s=zohoarc; b=We5J3suFGlkkujdnod4KlFZbrr1V+zt5rA0tIF9sEhBvHB5OT0GwktoxOw8f4HdGGj4wmGA31VOuT9QaXhU5Pd+RLA65azQG5GVCof3gpSeQhkDy0TtJMAWWoRImYc+Qx5XtIVqO2aVUvW09RqY5Id52zUMzAIblP//UejlSFuA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888327; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=SHSPShdHTgayZl7MMTSLF+LQqIks/NtrtDdxuxWI+Xo=; b=gjLyrC2PgAqs/0GGw1NDJnV9yP1gCC7u1B+7AwTZ0OTZT9cZYAcuxfsszZhgHPbAje1ZLUSVm3Mmt0m92ViEoOixVTxyBfMkqcxq/YtiEcVqx+k/L14uphIxEYlwLI8vTTYeaFwD2mYAoYy/mHL2n0PZXTzH6j4iVDWC5KCrBkI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170688832705752.48529312685196; Fri, 2 Feb 2024 07:38:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvau-0000Aj-T2; Fri, 02 Feb 2024 10:36:44 -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 1rVvat-00008F-GF for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:43 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvar-0004R9-9Y for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:43 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40fafae5532so19305155e9.1 for ; Fri, 02 Feb 2024 07:36:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888199; x=1707492999; 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=SHSPShdHTgayZl7MMTSLF+LQqIks/NtrtDdxuxWI+Xo=; b=TBq21PaddtOAxHYpHNO+3IPnRLAE4kDz9h5U3qFyGIr3C9dr+naLxcxUbe584dS35W JzAEbaJ3teZR3UqekhcohcDxan8akgLQ7Dm5wj1Is5+qG4UPTeEUKxf/ByZAcfYRw1la VRg2Sf8Br1qTEKsm3WLGwdjw2vbdBGzFsC5DwXoxQj2zNqxuQBuS+HCYSDNAdzNltk5z 9aOk/0qj1ghIgZ7Gss28Jr5pJ8TuVM/lhYAqId0+LFZm7VJdIGAY5jjGiifWraXxA77h p6cqjmDauG4iR05OCznO3K9E83yWaAXxKCK+EGH6F9tRdy5HvYuXs8M3jHORyb+mPXd3 rQTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888199; x=1707492999; 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=SHSPShdHTgayZl7MMTSLF+LQqIks/NtrtDdxuxWI+Xo=; b=Bl1vADmx8k9nvWHJymGMH7D1n4thDKN13ldPsGy9NLI/VTSg/BdVK4rtX6H7bPRF56 Jxy9JtE+5uVX0SbJas7BLwZrZ374hu5RtFMuqFAYjAEdhq4ESZm12uuGePaPULIP8n1z 2Y3Qu6OW3phLxMQY7+azcRMGwHPCaRfDrBxhnUc3dOOeLB2fWzo9b6i0pptoOLITueRQ TQPW1oYYFu/o4HclgxDk5Eap8ie5bEMn1YC1Nigd2m/DsPTgjBqhpxMg/9KRsnnEGocO tHSdDL2+C1X6Aqq1NrOfSCRKpKO5lbL8NCiYfxyQM5sQEI9MxwrR+KL0RZJSwPxUwPJx c4YA== X-Gm-Message-State: AOJu0YyCTVAlQm82jBOTrWsEzxpWed5+BBcpDi6iyY8oTvK7FKsDazAx QmkDcrN14jW7N1y44XNtSgVkEZP2VONgeV+52CIDPDt8HF9JNuHj9cQUGtX02b6ow0UTMzWCVVD N X-Google-Smtp-Source: AGHT+IGGf07eY7CvFXzGxvc34R2T7rJNnmaFJEK4I3sVNR5A7NdWhDdJ/nGDUlUd8KSr8LXq1u7q4g== X-Received: by 2002:a05:600c:1f81:b0:40f:b283:bb00 with SMTP id je1-20020a05600c1f8100b0040fb283bb00mr6376045wmb.18.1706888199623; Fri, 02 Feb 2024 07:36:39 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/36] vmbus: Switch bus reset to 3-phase-reset Date: Fri, 2 Feb 2024 15:36:04 +0000 Message-Id: <20240202153637.3710444-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888328048100001 Switch vmbus from using BusClass::reset to the Resettable interface. This has no behavioural change, because the BusClass code to support subclasses that use the legacy BusClass::reset will call that method in the hold phase of 3-phase reset. Signed-off-by: Peter Maydell Acked-by: Michael S. Tsirkin Acked-by: C=C3=A9dric Le Goater Acked-by: Maciej S. Szmigiero Tested-by: C=C3=A9dric Le Goater Reviewed-by: Zhao Liu Message-id: 20240119163512.3810301-3-peter.maydell@linaro.org --- hw/hyperv/vmbus.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/hyperv/vmbus.c b/hw/hyperv/vmbus.c index c86d1895bae..380239af2c7 100644 --- a/hw/hyperv/vmbus.c +++ b/hw/hyperv/vmbus.c @@ -2453,9 +2453,9 @@ static void vmbus_unrealize(BusState *bus) qemu_mutex_destroy(&vmbus->rx_queue_lock); } =20 -static void vmbus_reset(BusState *bus) +static void vmbus_reset_hold(Object *obj) { - vmbus_deinit(VMBUS(bus)); + vmbus_deinit(VMBUS(obj)); } =20 static char *vmbus_get_dev_path(DeviceState *dev) @@ -2476,12 +2476,13 @@ static char *vmbus_get_fw_dev_path(DeviceState *dev) static void vmbus_class_init(ObjectClass *klass, void *data) { BusClass *k =3D BUS_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); =20 k->get_dev_path =3D vmbus_get_dev_path; k->get_fw_dev_path =3D vmbus_get_fw_dev_path; k->realize =3D vmbus_realize; k->unrealize =3D vmbus_unrealize; - k->reset =3D vmbus_reset; + rc->phases.hold =3D vmbus_reset_hold; } =20 static int vmbus_pre_load(void *opaque) --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888334; cv=none; d=zohomail.com; s=zohoarc; b=QkEqKNqebDs9Ifla51SPOD72T/lH6hkNGId4ACYHOB15E+TmqP7fQKV++2hKUh5aJ+Ga5TAlBEqbLcdEqe/X8Xk3QARc42yTjnin/FT2huO/iH9O5dwokAegrZPuKvNw/ZAWJS6RysGWzc8xknmoQICUm0DqNDi8XOj7kAf7X94= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888334; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=90Q19bchD51USuhMKJ6oc+v8LKqSGaGapSq6FK0X6bc=; b=gC0rCnusYi4WM43IndDuSefMSStarsW0oRuWbx98EobPdvHtrUlJHMNB+tCKZi8dmDe2SDBcypl3FRtUOgENUoGWV/bEc4w6okbmuGUv9BQfnXZqRD/AWsPaPyL1Aud1rcBlJQ4+QVHITX88XoGTTg7TeW2Gjb0REYGC/LvDp5U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888334845983.8237899275816; Fri, 2 Feb 2024 07:38:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvav-0000At-FV; Fri, 02 Feb 2024 10:36:45 -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 1rVvau-00008v-0T for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:44 -0500 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvas-0004RN-Bz for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:43 -0500 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-50eac018059so2770019e87.0 for ; Fri, 02 Feb 2024 07:36:41 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888200; x=1707493000; 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=90Q19bchD51USuhMKJ6oc+v8LKqSGaGapSq6FK0X6bc=; b=UlaSDmyX8ijizOgRy2fP018Ugd63Xo7W9rx3XUe8WlwUTHd1D8X8ro1mWe3kMD3wWY 3RgBDVjpQga5U2HezKazlR/IkAtO3IvnISzsCYq3ijML1xOoXi6fKRBBrFO/WGriwjz5 iLQ4WmKORkBmWuV8DQDO0+08PawOjEAccYvHvtRj27TxUZZQEKwiKqre+NtnS36sl9B1 uFZY8f+boWAKB/T5LizJi7RN6nYTSvFo1g73tLtlWyq4vExzOCH+ejvpDkz+Fi8IKPIz UoOY4lJInxHtdBKgj+X/gro3l/3TIvSsaVnAH13h9i8yv1wkKdkwodkY0UStIM2kWU8X CPLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888200; x=1707493000; 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=90Q19bchD51USuhMKJ6oc+v8LKqSGaGapSq6FK0X6bc=; b=SRjBb6zzedbscSih8zq2+Ua+Et5Ak+0g8ZkCjd6yGwm+Zuvk868PX896xolPAI/AMG kLRSywVJvhwNa5+U4PV609aN/ZafWRkr39ZAGd/julhh+zz7jNhk+lOBRATer9rnrDLz IP+Q1plasiIpaqTRqhOlQ8zNpI4Cg1SQrieDHKev6cjLD18etm/uGHkXglh5ysA8RKTl 7P6tCLFXKKcZ8+JlXJmJpIpiJwVrQI447u4casRs/kr7hpGEbnEWV1oVkAQEUL8mucM3 ozrdoU/ZSvLbpP9Jjcg9ptsdia4wrGItlSyMihBVx88n6TNEpx0osRuGp1J09G+9CxkJ Cuww== X-Gm-Message-State: AOJu0YxHxOiaWX/wvsL3hXD3Ha+bfBX30X3dm3A8WAhJTSkHCdVf++8O x+jiRlJfVqcTWDV67f8HyfHTOWgMahAUsHFUvObdUjO4P73I6QLaGg3S76XuS+cS7qNTxZ5UEYd l X-Google-Smtp-Source: AGHT+IFBDYiBD9rkr7X7DA90g1gmK9qdSHDYwfljVwgp3MpPyLu9YL36ld7IkzDw3oHk6yxAVeEz8w== X-Received: by 2002:a19:f81a:0:b0:511:e8f:45ca with SMTP id a26-20020a19f81a000000b005110e8f45camr1680573lff.31.1706888200760; Fri, 02 Feb 2024 07:36:40 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/36] adb: Switch bus reset to 3-phase-reset Date: Fri, 2 Feb 2024 15:36:05 +0000 Message-Id: <20240202153637.3710444-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x136.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888336037100001 Switch the ADB bus from using BusClass::reset to the Resettable interface. This has no behavioural change, because the BusClass code to support subclasses that use the legacy BusClass::reset will call that method in the hold phase of 3-phase reset. Signed-off-by: Peter Maydell Acked-by: Michael S. Tsirkin Acked-by: C=C3=A9dric Le Goater Acked-by: Maciej S. Szmigiero Tested-by: C=C3=A9dric Le Goater Reviewed-by: Mark Cave-Ayland Reviewed-by: Zhao Liu Message-id: 20240119163512.3810301-4-peter.maydell@linaro.org --- hw/input/adb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/input/adb.c b/hw/input/adb.c index 0f3c73d6d00..98f39b4281a 100644 --- a/hw/input/adb.c +++ b/hw/input/adb.c @@ -231,9 +231,9 @@ static const VMStateDescription vmstate_adb_bus =3D { } }; =20 -static void adb_bus_reset(BusState *qbus) +static void adb_bus_reset_hold(Object *obj) { - ADBBusState *adb_bus =3D ADB_BUS(qbus); + ADBBusState *adb_bus =3D ADB_BUS(obj); =20 adb_bus->autopoll_enabled =3D false; adb_bus->autopoll_mask =3D 0xffff; @@ -262,10 +262,11 @@ static void adb_bus_unrealize(BusState *qbus) static void adb_bus_class_init(ObjectClass *klass, void *data) { BusClass *k =3D BUS_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); =20 k->realize =3D adb_bus_realize; k->unrealize =3D adb_bus_unrealize; - k->reset =3D adb_bus_reset; + rc->phases.hold =3D adb_bus_reset_hold; } =20 static const TypeInfo adb_bus_type_info =3D { --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888234; cv=none; d=zohomail.com; s=zohoarc; b=Ut5KQrmlJjxQz2sCeosSaxFsDIrfuWxuGgM4gwFwnQ9htHvGcSUTwhuM3Z/557kq/QB8DfFosf+AuqxXPFsyNqW9AJ10Ts9Di22NzX3gGxDzoBcXuDjX4LZMlpceIJroMgEt2fx/r1tXnucFHn8vcHkOpIbZJEahErOT438FHNg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888234; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=1V7+Q0KTyYvIAHFDW7/i7eB7p3uahpOup8LdNc0Y8Zc=; b=Biaiw+Tx73H8eeuhkseHk3RTCANhp2pxa2EBc0KLRh2SjqL1cBboZ+xGLAkeTnnBwh6hWIAwPDR0POeHGjIapY6Q8RTe/O1HzRBNPWXeDoM25b8UJk2A3zQLK2fUnhvA9319LQLIa8vobrfUm4L7xEtzB2SjRV1hPhBj/XyG+HA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888234922260.851953068586; Fri, 2 Feb 2024 07:37:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvaw-0000CM-AQ; Fri, 02 Feb 2024 10:36:46 -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 1rVvau-0000AR-LC for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:44 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvas-0004RT-IX for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:44 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40fafae5532so19305315e9.1 for ; Fri, 02 Feb 2024 07:36:42 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888201; x=1707493001; 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=1V7+Q0KTyYvIAHFDW7/i7eB7p3uahpOup8LdNc0Y8Zc=; b=QS0BjLb7N2WSVl501ICpWCcR+xYQt0/Or6RbTBNuXEiQQg+qI53iirlCw5jrIwMit1 ejoq8/T+kZWotM9999k0SqoKt+UDbVZTEeR7UUkuW4Q0ElDIjutAf2XKSQigP6tVp9lE i4dqHG6D1v61Y3X8uDesM5gsr1ywvQ0KJco1FyfP0T2pZETGLlhRZIMgyTwyPBDQDTKB omcRFBwvDbEKKDSQFbajz2fTzKHs/2DZSiFGp0+R3Omg9PTF9cap6vjdjGClMrPJnkm+ gLT1GrrQ8bfr/evRpTJIAKlM2/bX2MNUAH/ooodtspB8K6PK6PBLR1Ic5CiLUHB0BIA6 7Ypg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888201; x=1707493001; 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=1V7+Q0KTyYvIAHFDW7/i7eB7p3uahpOup8LdNc0Y8Zc=; b=Nu67VZ9ogpDCSzn9hOKu8GaZ8B6hGVZSVoM591kV5dDxEaYNb7B7tEF5jYfSKFBJ82 MzdYUMXxpyZliGTapWR4/gz9TnL9jW+15UC89h5zd3v6kMEJ72wwVcDcXr78bwaHK9BT 6meNw35HBl8Z4dJKUj0eNZDm5ukABHTyqfVvUlFs5DGoQBZn/o1/1F8QF74pBYw0zpHy 532A75y9J0Sk0kh3g1KVgkVdU94vfVljChSXf5X5xbBZ/2xY8XvRXts1zOAtSoUVN45w ysjv8jCTlZllZ5jJy0/s7uFoBOSJZXxNpuSVs7nGhAMCMqdpzDnAuGVh4fKduEJ5hoIF R4AQ== X-Gm-Message-State: AOJu0YxcPbuTbcaJbL6mJRUO8gztMZCOuwhmgkW9mBPM5r7CD/hTIptj LaJJPgxRtl5cswdQFiT0zCWm8a9U2ZYeMzzP303DbMSUyoI+K/UrW42Ott3Hw1P48B7TMZqx/fZ m X-Google-Smtp-Source: AGHT+IFUtj4qWAJ6L354Y967i9IQdvvF8HqHsYKGG884+2RxmfXkG9vi0ZAHxHol6BJbGppXGA/eQw== X-Received: by 2002:a05:600c:a39e:b0:40f:b680:3e84 with SMTP id hn30-20020a05600ca39e00b0040fb6803e84mr5893811wmb.2.1706888201257; Fri, 02 Feb 2024 07:36:41 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/36] hw/s390x/css-bridge: switch virtual-css bus to 3-phase-reset Date: Fri, 2 Feb 2024 15:36:06 +0000 Message-Id: <20240202153637.3710444-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888235486100002 Switch the s390x virtual-css bus from using BusClass::reset to the Resettable interface. This has no behavioural change, because the BusClass code to support subclasses that use the legacy BusClass::reset will call that method in the hold phase of 3-phase reset. Signed-off-by: Peter Maydell Acked-by: Michael S. Tsirkin Acked-by: C=C3=A9dric Le Goater Acked-by: Maciej S. Szmigiero Tested-by: C=C3=A9dric Le Goater Reviewed-by: Halil Pasic Reviewed-by: Eric Farman Reviewed-by: Zhao Liu Message-id: 20240119163512.3810301-5-peter.maydell@linaro.org --- hw/s390x/css-bridge.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/s390x/css-bridge.c b/hw/s390x/css-bridge.c index 15d26efc951..34639f21435 100644 --- a/hw/s390x/css-bridge.c +++ b/hw/s390x/css-bridge.c @@ -56,7 +56,7 @@ static void ccw_device_unplug(HotplugHandler *hotplug_dev, qdev_unrealize(dev); } =20 -static void virtual_css_bus_reset(BusState *qbus) +static void virtual_css_bus_reset_hold(Object *obj) { /* This should actually be modelled via the generic css */ css_reset(); @@ -81,8 +81,9 @@ static char *virtual_css_bus_get_dev_path(DeviceState *de= v) static void virtual_css_bus_class_init(ObjectClass *klass, void *data) { BusClass *k =3D BUS_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); =20 - k->reset =3D virtual_css_bus_reset; + rc->phases.hold =3D virtual_css_bus_reset_hold; k->get_dev_path =3D virtual_css_bus_get_dev_path; } =20 --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888223; cv=none; d=zohomail.com; s=zohoarc; b=BdjB+XyEN5+8c6GRY/sSMDqP5lrI4d+AXFkwrxkK/n4Mjp6UXVqaakGzlGlaH2jizCUjxnXATb7aoMyHsrTomE16k6Pb/I3HsglS/1pVGMu53jU6aNVpwTALG/5ZhDr37kBTGt/ncHgfMbkrQc8uryAHV0Sg+joE/Au1O4M9OAI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888223; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=wyZDr1Zjb+maiQcAIaO52bka0IE0OhCst2zFuC2UbQo=; b=ez2omz/nPI+BovdH9Zb53mR2WRCotRbZ66ozVauiCbFbE6BCZIVCIQ3P0JC/0QOo6v0jVtM3SNYGCKSTlRmLXsnUkLJaM4Vl9p08FkPvEbRyGmqKNmJX8inj1zNa/W6hy2EZvJRQpPmxczDQbfSxwm7tlKUikRUYQy6YApki9Po= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888223545823.3001414109048; Fri, 2 Feb 2024 07:37:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvaw-0000CP-Io; Fri, 02 Feb 2024 10:36:46 -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 1rVvav-0000Ap-72 for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:45 -0500 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvat-0004Rl-8Z for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:44 -0500 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-51137c8088dso969502e87.1 for ; Fri, 02 Feb 2024 07:36:42 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888201; x=1707493001; 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=wyZDr1Zjb+maiQcAIaO52bka0IE0OhCst2zFuC2UbQo=; b=b0z5QJf5n801ia+vPvZL7ACABnaDb5foj0OyL+Ex8sLrV2C4NonUypHEeD3XoeDgoa ZmsrR8jIz8s0OzXK6qI9Pg87p226j9C+WdadVSOYZis6pB50Jsa5uJB1OTKtl4g8pDL8 p0SPr+Nm262+s6dOF9xIQsQIQdEE/I9lc8Qa2rHEBGCg7fw4rBXlN3p7zp+skJmt9RzJ q4VzS2NSmK/OKxkAXStk1y65Ze/5DEONVU4fWv4CAKET9z6Wx+WbA8zyc1KoOrCXqOof PwhWKoweG97FStyI1YXDnXfxMsvGImdmYK0sncBboYjBCNLm7nBnCDSxs2l23g7LXVrQ pD9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888201; x=1707493001; 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=wyZDr1Zjb+maiQcAIaO52bka0IE0OhCst2zFuC2UbQo=; b=fNisH3LFbtEKjebGX0HH4KxT4stJqPYRu81gLi+ZM7UCRh7onpszNaHCizTHqHaIZr D4Fszif5x1+QFrf4UKmGuOEDxS8un8T5nDEfgjqUTG/aBgmEfEpxt1HyaXtJ7DaB+G2N 3C056nl++MkvgMCPQsEvOUcBVIORQfMRl4dfUKz67FOl4VGAdgQGzhhPSsdaSBQUjQoe Jh401zIU/0iUMkpAZwMGJBU5aDpAhMzS2y8YJQqakYOHY/KBwoRTzZDioNjDMi0H0c/z F13YQCF54k+sZLR2k77vKmYKtF9eNoI/B0Ua/OlSsaerMTmnAYU/EIrtLWTDFPjvcNum 7myQ== X-Gm-Message-State: AOJu0YxLrmNTAi9uSOFkmlbSl4v84OlL5ULiJ9EHoerE4zg0jbdok0SV bvX77zyY40zJPrkukT/J5fOX4Pyh6XxLo1dIwwz5nfieNR4sFCamHvLoVBNsP4XD8GeisryTTP9 W X-Google-Smtp-Source: AGHT+IFITSKcmbr2aPKEAwhYEqRNg30i3qZZuxTmDP6+9SBvsrM4tCnLiXFcJNiect9eL6AmcpUcEQ== X-Received: by 2002:ac2:5101:0:b0:510:1b65:dd97 with SMTP id q1-20020ac25101000000b005101b65dd97mr3929634lfb.17.1706888201673; Fri, 02 Feb 2024 07:36:41 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/36] hw/core: Remove transitional infrastructure from BusClass Date: Fri, 2 Feb 2024 15:36:07 +0000 Message-Id: <20240202153637.3710444-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x12d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888225416100005 BusClass currently has transitional infrastructure to support subclasses which implement the legacy BusClass::reset method rather than the Resettable interface. We have now removed all the users of BusClass::reset in the tree, so we can remove the transitional infrastructure. Signed-off-by: Peter Maydell Acked-by: Michael S. Tsirkin Acked-by: C=C3=A9dric Le Goater Acked-by: Maciej S. Szmigiero Tested-by: C=C3=A9dric Le Goater Reviewed-by: Zhao Liu Message-id: 20240119163512.3810301-6-peter.maydell@linaro.org --- include/hw/qdev-core.h | 2 -- hw/core/bus.c | 67 ------------------------------------------ 2 files changed, 69 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 66338f479fe..d47536eadb1 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -329,8 +329,6 @@ struct BusClass { */ char *(*get_fw_dev_path)(DeviceState *dev); =20 - void (*reset)(BusState *bus); - /* * Return whether the device can be added to @bus, * based on the address that was set (via device properties) diff --git a/hw/core/bus.c b/hw/core/bus.c index c7831b5293b..b9d89495cdf 100644 --- a/hw/core/bus.c +++ b/hw/core/bus.c @@ -232,57 +232,6 @@ static char *default_bus_get_fw_dev_path(DeviceState *= dev) return g_strdup(object_get_typename(OBJECT(dev))); } =20 -/** - * bus_phases_reset: - * Transition reset method for buses to allow moving - * smoothly from legacy reset method to multi-phases - */ -static void bus_phases_reset(BusState *bus) -{ - ResettableClass *rc =3D RESETTABLE_GET_CLASS(bus); - - if (rc->phases.enter) { - rc->phases.enter(OBJECT(bus), RESET_TYPE_COLD); - } - if (rc->phases.hold) { - rc->phases.hold(OBJECT(bus)); - } - if (rc->phases.exit) { - rc->phases.exit(OBJECT(bus)); - } -} - -static void bus_transitional_reset(Object *obj) -{ - BusClass *bc =3D BUS_GET_CLASS(obj); - - /* - * This will call either @bus_phases_reset (for multi-phases transitio= ned - * buses) or a bus's specific method for not-yet transitioned buses. - * In both case, it does not reset children. - */ - if (bc->reset) { - bc->reset(BUS(obj)); - } -} - -/** - * bus_get_transitional_reset: - * check if the bus's class is ready for multi-phase - */ -static ResettableTrFunction bus_get_transitional_reset(Object *obj) -{ - BusClass *dc =3D BUS_GET_CLASS(obj); - if (dc->reset !=3D bus_phases_reset) { - /* - * dc->reset has been overridden by a subclass, - * the bus is not ready for multi phase yet. - */ - return bus_transitional_reset; - } - return NULL; -} - static void bus_class_init(ObjectClass *class, void *data) { BusClass *bc =3D BUS_CLASS(class); @@ -293,22 +242,6 @@ static void bus_class_init(ObjectClass *class, void *d= ata) =20 rc->get_state =3D bus_get_reset_state; rc->child_foreach =3D bus_reset_child_foreach; - - /* - * @bus_phases_reset is put as the default reset method below, allowing - * to do the multi-phase transition from base classes to leaf classes.= It - * allows a legacy-reset Bus class to extend a multi-phases-reset - * Bus class for the following reason: - * + If a base class B has been moved to multi-phase, then it does not - * override this default reset method and may have defined phase met= hods. - * + A child class C (extending class B) which uses - * bus_class_set_parent_reset() (or similar means) to override the - * reset method will still work as expected. @bus_phases_reset funct= ion - * will be registered as the parent reset method and effectively call - * parent reset phases. - */ - bc->reset =3D bus_phases_reset; - rc->get_transitional_function =3D bus_get_transitional_reset; } =20 static void qbus_finalize(Object *obj) --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888314; cv=none; d=zohomail.com; s=zohoarc; b=Y/1eLiObhLsnkWX+Q+BJQL6bz5Burpmtv+TFPzzfAcZMcCszAJ164r5uZsv+PPF1HQiqiORobOL/plq5shzE8uKozT6fk5OkOX1uAb2RBx1xmf1Ru/zn2p8LkCVxIF1Clu0iw/cVuerYtj1Dvyvb1+UN2sQL1wuP0SBaGlciKhw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888314; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=zT33TDQSpbP682JXm0Djn4kZLyqr6gakrEoe9mM4ahM=; b=asxC9BMI7QQjBCEs6hXm4mQeHyyd7eni32IsFvKu0lEiBESZPy3Q6BDAqNHCxLZKSZZln5oSdBm3/jYv11JbUXDj3QdcKDtFTa5NnHSyuCENfHFb1ggt9ptlbv8gDtLow1ZFeMwUbyPe7Bs4MMYSeIXVkepYS35rXjWviXUlE38= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888314703841.4109392001066; Fri, 2 Feb 2024 07:38:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvay-0000FT-QA; Fri, 02 Feb 2024 10:36:48 -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 1rVvav-0000Az-Ha for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:45 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvat-0004Rt-PJ for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:45 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40ef64d8955so19934225e9.3 for ; Fri, 02 Feb 2024 07:36:43 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888202; x=1707493002; 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=zT33TDQSpbP682JXm0Djn4kZLyqr6gakrEoe9mM4ahM=; b=mm6mWc1L1bgPHg0tfzdhYBnDCCOQ6pKKcrpkOOryFWamXhrG2ji3uRFYEBgVKyZRfO 5IJEZZHtGn0fnLNJDzOReLyh1z5WM3MB5eWVbgg+h73pTrU/rPhq0f29+bWPI4LhsFmX cVwGFIy0hsb3o/tOPREyP8RgiyapJAY8KiySCdoUnOLq8w4Ai6Ec4eAismbDOFkTH3PT wQg1Y9X5HcdXBHVZU0/bAZ/dD7VGcvH+qynGRP2NHX35tKROzMkJnglanWsOFT3kqllR 3N+FZ6wP8hdLsTXgzHvgqZvR0HqbqJ+NxEA9zH09vemP26jOHUAhOPvlvqg7Im7bUj0j e3OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888202; x=1707493002; 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=zT33TDQSpbP682JXm0Djn4kZLyqr6gakrEoe9mM4ahM=; b=l/8QvXLArPScobkvYXJ8IsaMZ7ev14sh7TEIuS/eRjNvKA4UG87OeCeMY9t/XK7gbE VOEQ0/BPL9MjXZOqa6S26OtF20nzkp3wZFaLC+Wsy6oqI9Ae1A9vfScc2pskkUBlSW9N rReRZibegjGZXTk1UbJfsB213T5pULpBNAKTGAk4IvdAQzRSyTytQKwby70FaZ+SFcBr sEVx14XR1hCmLuyoKQuv8atW2d5FWqiU651OgOLQ+kWbBa5bNQjlF0OGy/35PtYDrwyc f9Q85UalAntmytuSqb9IWP3fwIjhw7jvynYEqLIqG59IOT6winYP1y4zsn4JwVfVfBh9 iH9w== X-Gm-Message-State: AOJu0Yym8PnOFlqPS6XfS3NbnURZIeXYH9xqQH3+DAe1iJ3+NC7FacZd SUW6Q+YSoRyAGbG4qc92sZhgWsicMriOERDwaWzFwzfiYIeLuEepv0oBt30pzmshi5GG+4PM1C0 o X-Google-Smtp-Source: AGHT+IHjKEMfHHK6OQMK4cAorQm+MYbaCF9hw2XQyr9vYsc19vjLZWeqS0deCXcTTZs6h2GL5h+75w== X-Received: by 2002:a05:600c:45d1:b0:40f:b0ca:2b2d with SMTP id s17-20020a05600c45d100b0040fb0ca2b2dmr6271565wmo.1.1706888202323; Fri, 02 Feb 2024 07:36:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/36] system/vl.c: Fix handling of '-serial none -serial something' Date: Fri, 2 Feb 2024 15:36:08 +0000 Message-Id: <20240202153637.3710444-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888315903100017 Currently if the user passes multiple -serial options on the command line, we mostly treat those as applying to the different serial devices in order, so that for example -serial stdio -serial file:filename will connect the first serial port to stdio and the second to the named file. The exception to this is the '-serial none' serial device type. This means "don't allocate this serial device", but a bug means that following -serial options are not correctly handled, so that -serial none -serial stdio has the unexpected effect that stdio is connected to the first serial port, not the second. This is a very long-standing bug that dates back at least as far as commit 998bbd74b9d81 from 2009. Make the 'none' serial type move forward in the indexing of serial devices like all the other serial types, so that any subsequent -serial options are correctly handled. Note that if your commandline mistakenly had a '-serial none' that was being overridden by a following '-serial something' option, you should delete the unnecessary '-serial none'. This will give you the same behaviour as before, on QEMU versions both with and without this bug fix. Cc: qemu-stable@nongnu.org Reported-by: Bohdan Kostiv Signed-off-by: Peter Maydell Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Richard Henderson Message-id: 20240122163607.459769-2-peter.maydell@linaro.org Fixes: 998bbd74b9d81 ("default devices: core code & serial lines") Signed-off-by: Peter Maydell --- system/vl.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/system/vl.c b/system/vl.c index 60fd1e56b6b..bb959cbc440 100644 --- a/system/vl.c +++ b/system/vl.c @@ -1439,18 +1439,22 @@ static void qemu_create_default_devices(void) static int serial_parse(const char *devname) { int index =3D num_serial_hds; - char label[32]; =20 - if (strcmp(devname, "none") =3D=3D 0) - return 0; - snprintf(label, sizeof(label), "serial%d", index); serial_hds =3D g_renew(Chardev *, serial_hds, index + 1); =20 - serial_hds[index] =3D qemu_chr_new_mux_mon(label, devname, NULL); - if (!serial_hds[index]) { - error_report("could not connect serial device" - " to character backend '%s'", devname); - return -1; + if (strcmp(devname, "none") =3D=3D 0) { + /* Don't allocate a serial device for this index */ + serial_hds[index] =3D NULL; + } else { + char label[32]; + snprintf(label, sizeof(label), "serial%d", index); + + serial_hds[index] =3D qemu_chr_new_mux_mon(label, devname, NULL); + if (!serial_hds[index]) { + error_report("could not connect serial device" + " to character backend '%s'", devname); + return -1; + } } num_serial_hds++; return 0; --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888296; cv=none; d=zohomail.com; s=zohoarc; b=Q2yAel8KzmbhPscP1lZR1yxlBwNcjjzCsnChuz4NMxSES/vCN0QIWWv/jtBZEphEocQWiBEtB1CPG9AS/hgBpmNxBocg3HwMWGDUFjgqsGharjc3ZHj5mEh+gvcleuo2iEDtPjSjVzR/QmgGA+5i5MOyw4ArcPrTmiBW6Lw8Jw8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888296; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=Y9n/AEkxgug8LnVgrJ59ksyGPxf9vBmtyi9ED3ze10g=; b=dpeQChpLGhdp59oYNvt2gxQ8JCpDLjPXOqEggt6JlxtXUCiDgV0ot/X4wQDPNsOjcaZHqpEyDMVgUJumttQTWvHVdu6qrTzs9cv6srAlKVx3zIPXytNVmsTMTRsHriSYreXFBG8nvzA3iMwimQ0hIipZkxHZHDPBCvNqUoSqbqI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888296346345.8370658867809; Fri, 2 Feb 2024 07:38:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvaz-0000Ge-EO; Fri, 02 Feb 2024 10:36:49 -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 1rVvav-0000Bd-TE for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:45 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvau-0004Ry-Cz for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:45 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40e8d3b29f2so18558905e9.1 for ; Fri, 02 Feb 2024 07:36:43 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888202; x=1707493002; 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=Y9n/AEkxgug8LnVgrJ59ksyGPxf9vBmtyi9ED3ze10g=; b=KtFlnEfD0ebWGaD1JzH11fi3nzN0vd1hVmOnHbNaI4gCXo5KKK9Z+1MhLWW1BD15Zq q4Q0xyy04horfOohhW0qEASezMBKzFZtfk7VqLwjsVhb3+gJgRNZsrWs97igWjmd2QMM 5xuLxD1RrJpmguPRF5J9fE57WNTCMm44RAuTQbGLzR/HZQvRE+83DDRiPTjZBN/7mIV2 UIFPYGCKPO50gQY/IYRixZNIV8bAzi3JlyA1hbbyDZpSuENAWmfN1kUKYCxn560ZPfmL h1TQfhAmsSqAsHTuTAom+kDob1YOSPnXHPeD8jORTDmzDPUBVEGfoONHK8GcXth1si8d og/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888202; x=1707493002; 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=Y9n/AEkxgug8LnVgrJ59ksyGPxf9vBmtyi9ED3ze10g=; b=MoZzDo8VHZKHeh87mVkKZWJFwHdV7iNERouqOMvnd6KWCnM456rTpV5pHpf0OS++A5 E/QOG4iLUBx29UNH45cSKfHjAHrHTsEwN37BsbyyJ4c4tjJd62nCMtPuyn5qEtsc5KjI kj3AumEaB2C43Dp/NKKXu3bu+317aIGsuzw/HLoQY+z/qyGz52Dw1jeWi7ZbE7C8vZdB weez693gSCFSNtHpjQc6n0KVX4epzBYJRPZMJB8biOE9AB4LGTQt+5oupcfAoIAG7QYh DRHFwSrnb7x06gmELNqiw8UvwM4daJM+ph/RXJNMc4RtBU7ksgS6fX8OQq4uQnSLGI0Q nuOQ== X-Gm-Message-State: AOJu0YyRNnBJdA9Yjs+mEjAey1gTMJ5kKIV8BZDeMN3zd3geWWfiL6Lc YCcn+C4cUMO40HQLYATTlr05k+HcKipMn44TrfI10KdHhedU5a5TJnuQzryTkyJ1XawKlhUPEst k X-Google-Smtp-Source: AGHT+IEbre5vRsT8iOCWBqioeE41PYliJhhdBjr6PNNkM+ZEkY3/+QZVnyDdRZMUFAUK/JDY96orbA== X-Received: by 2002:a05:600c:314a:b0:40e:7232:bdf9 with SMTP id h10-20020a05600c314a00b0040e7232bdf9mr4624655wmo.16.1706888202722; Fri, 02 Feb 2024 07:36:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/36] qemu-options.hx: Improve -serial option documentation Date: Fri, 2 Feb 2024 15:36:09 +0000 Message-Id: <20240202153637.3710444-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888297886100001 The -serial option documentation is a bit brief about '-serial none' and '-serial null'. In particular it's not very clear about the difference between them, and it doesn't mention that it's up to the machine model whether '-serial none' means "don't create the serial port" or "don't wire the serial port up to anything". Expand on these points. Signed-off-by: Peter Maydell Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20240122163607.459769-3-peter.maydell@linaro.org --- qemu-options.hx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 484cc21c1fd..40e938c4877 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4129,7 +4129,8 @@ SRST This option can be used several times to simulate up to 4 serial ports. =20 - Use ``-serial none`` to disable all serial ports. + You can use ``-serial none`` to suppress the creation of default + serial devices. =20 Available character devices are: =20 @@ -4151,10 +4152,17 @@ SRST [Linux only] Pseudo TTY (a new PTY is automatically allocated) =20 ``none`` - No device is allocated. + No device is allocated. Note that for machine types which + emulate systems where a serial device is always present in + real hardware, this may be equivalent to the ``null`` option, + in that the serial device is still present but all output + is discarded. For boards where the number of serial ports is + truly variable, this suppresses the creation of the device. =20 ``null`` - void device + A guest will see the UART or serial device as present in the + machine, but all output is discarded, and there is no input. + Conceptually equivalent to redirecting the output to ``/dev/null``. =20 ``chardev:id`` Use a named character device defined with the ``-chardev`` --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888370; cv=none; d=zohomail.com; s=zohoarc; b=OajQe0Qq4nhKDWZMbKp5VliJmByNLoITgb5WOG2qvZpqoPcCE9EPzuRKCVc8/4qKB6EO5wMA++aNtTDqeq1h6QZAD/KIlkiw0olsDR78eIXJ9JUOvUxxSutDdDsv+rNaCvThwj/zZ8FhQQyzxQ6yARnug13tDicVwxuvUZDlXns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888370; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=XXyoo0uTxQx7WIeKUGD+qu1FchhSMRmgTj+B/msMnZw=; b=PubRCKn2cj9f8K68UTQk/MZb7nD6HQWfMCdhEbUvPg8+LOOGMHhHTFphTbSZXoSFFb79BSiMbRDzUkZuHo1hX/5KjPD9BiyUha3OTpPgO+bsaf7dvrBd9y5lgAXcOwN0QyNA5xrvqi7BpeW+/abC/JDhN16Z9SNEz2wivXFL+UI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17068883698381007.1892570344855; Fri, 2 Feb 2024 07:39:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvax-0000Cb-63; Fri, 02 Feb 2024 10:36:47 -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 1rVvav-0000Ba-Rn for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:45 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvau-0004S5-9F for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:45 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40e8fec0968so20018835e9.1 for ; Fri, 02 Feb 2024 07:36:43 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888203; x=1707493003; 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=XXyoo0uTxQx7WIeKUGD+qu1FchhSMRmgTj+B/msMnZw=; b=EmC/UTeMd9TjGy6IaNnt1SAJVwIgBxUoO+HXzXpbuuQN+uSIuQio2DKIECEJQvNGAe 9i0dtuvUs2f6d2ilYN8mCkWarD0TtI+9+mytIS465LhkROdwWSSVyZPmUpQAzu0p4ZYK f+XiFQqJdTw7/qhKPgqd1jOKLQe4z70VAXwYq4D1hBuGWK9S5aGgBkKgMFUL3XJdHEuq mWeWnp7RSMcKE6knD9G6o4RyS0eT8u+8ZdLvVXx1KZwiCg1ld1krV+dVSx9uCMxY9BNr 0kl8npRYeGw13eIS3llok32FLyr+jsXdWSrbRDpJfzFlMK2xHkfGY4rvk0YoMIolzC5s X05A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888203; x=1707493003; 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=XXyoo0uTxQx7WIeKUGD+qu1FchhSMRmgTj+B/msMnZw=; b=sT24o46trVSCtBM3vrjTVVpCtHlVI2fnedrFI7Ujo8JKz7bcEgkIHzR3qqfJDxpxkq u56bisYBr8fMdC6VRIbIA9RNUm7U25pu3hc7wNE14CT+bimI1/6H/2Z/CqmxhKu21Kzp MJfqImJ2rabGiIZ97W8Kvh3dU/cLsN/4hvFwTP3sAEXLOD4Tg/Zyipm5dKcpNmUxckwH 1T+cBQvEoKzJOkRypQXAcoR4TkZuEvIyWcRwkeLcLQ1FW1Gm+6fd1u57qzhD8FiILN3Y 2T3Ew7m8Fqgs1tYNEXCsOaabBvb7TpU41rbBVqmO4yZdJtsBVJp46B0YZN9JH3z/K4QS JoXg== X-Gm-Message-State: AOJu0YxF4O/TBRkBFzZ513goU16vUTLhvToW6gfdmQDi6MMp27HuMffr L85finve5pDixJnoBm9zVCKgSLm+vl1i+kCjGdGvdkuF8bkYsyAt0mNoiFD3Ete8JJJZQqIDQ/5 B X-Google-Smtp-Source: AGHT+IGwMhcfy7lfme8yuzsYCldGdu6eGi4FEeZk9pd4ZTXJhxIA/5d8vUZEAeFx7jpiPOFewfkDww== X-Received: by 2002:a05:600c:3b93:b0:40f:b64e:d28a with SMTP id n19-20020a05600c3b9300b0040fb64ed28amr6246744wms.10.1706888203082; Fri, 02 Feb 2024 07:36:43 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/36] target/arm: Add ID_AA64ZFR0_EL1.B16B16 to the exposed-to-userspace set Date: Fri, 2 Feb 2024 15:36:10 +0000 Message-Id: <20240202153637.3710444-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888370306100002 Content-Type: text/plain; charset="utf-8" In kernel commit 5d5b4e8c2d9ec ("arm64/sve: Report FEAT_SVE_B16B16 to userspace") Linux added ID_AA64ZFR0_el1.B16B16 to the set of ID register fields which it exposes to userspace. Update our exported_bits mask to include this. (This doesn't yet change any behaviour for us, because we don't yet have any CPUs that implement this feature, which is part of SVE2.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20240125134304.1470404-1-peter.maydell@linaro.org --- target/arm/helper.c | 1 + tests/tcg/aarch64/sysregs.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index a0041aa0ec7..d51093a7c44 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8897,6 +8897,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) R_ID_AA64ZFR0_AES_MASK | R_ID_AA64ZFR0_BITPERM_MASK | R_ID_AA64ZFR0_BFLOAT16_MASK | + R_ID_AA64ZFR0_B16B16_MASK | R_ID_AA64ZFR0_SHA3_MASK | R_ID_AA64ZFR0_SM4_MASK | R_ID_AA64ZFR0_I8MM_MASK | diff --git a/tests/tcg/aarch64/sysregs.c b/tests/tcg/aarch64/sysregs.c index f7a055f1d5f..301e61d0dd4 100644 --- a/tests/tcg/aarch64/sysregs.c +++ b/tests/tcg/aarch64/sysregs.c @@ -137,7 +137,7 @@ int main(void) /* all hidden, DebugVer fixed to 0x6 (ARMv8 debug architecture) */ get_cpu_reg_check_mask(id_aa64dfr0_el1, _m(0000,0000,0000,0006)); get_cpu_reg_check_zero(id_aa64dfr1_el1); - get_cpu_reg_check_mask(SYS_ID_AA64ZFR0_EL1, _m(0ff0,ff0f,00ff,00ff)); + get_cpu_reg_check_mask(SYS_ID_AA64ZFR0_EL1, _m(0ff0,ff0f,0fff,00ff)); get_cpu_reg_check_mask(SYS_ID_AA64SMFR0_EL1, _m(8ff1,fcff,0000,0000)); =20 get_cpu_reg_check_zero(id_aa64afr0_el1); --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888364; cv=none; d=zohomail.com; s=zohoarc; b=cZ/cNrEeO/kjmarZ5hz047FxOF03l310iCsdJluPVSu7r9FSKJhzve4WOqDSURGJUq2Rrnr7kOt3hDnrXzdfphbKte93VU7LJJQ2e3l55X0hTVpBqiZDFToyPcHuJyyzKC2mRRIeJL9hswrFBPdBWBuaDvbnSAwOuSk0Z9iCFik= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888364; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=yhQX2lsO6sUMNlz849ghUPa03+uYKB43z4lr+2t+Z6I=; b=lU7y8a1uPW5PrlHmjPxJxDktgrb5UDOi/Gnecokf5b51UKpCULdM5qT0bWFpjvIsUSjy8hbildxeJ0gmUT4SjhyntXBECwVk5umHMq6FnG8nF/uowR74QJhEIrtep1plRNgCwF0dMpzXg4tNSyTe49dZaaVfKhBTH+Df4KvDblo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888364805924.964641857392; Fri, 2 Feb 2024 07:39:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb1-0000Jz-4Y; Fri, 02 Feb 2024 10:36:51 -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 1rVvaw-0000CS-QZ for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:46 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvav-0004SQ-7D for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:46 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40fcb4ef7bcso3124685e9.0 for ; Fri, 02 Feb 2024 07:36:44 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888203; x=1707493003; 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=yhQX2lsO6sUMNlz849ghUPa03+uYKB43z4lr+2t+Z6I=; b=gX/lDcsEJwwg8hCxnTaBQ6o1cGLATxsb4aOkRP9a7AN8x01yZlR2S0LxxDZKOTJPcG wlDxk+0jdP5SX/L+Fi5tPj9bWTPYzcPgLOMiYXSL3ztOA8NRYINqjqEFZp1tiZHhS7ct PcA6HYcw6zqCZqMRvXAo0Y3Iit2id93Od/YzEygICUeohky6Okb2NVG24VErXzjaxmFH ShNVz3df2Hdo76IJBQnNHy9NRkGddEX+V5CHeOW/9jnRondXYCenhS2pqJp5dX8RW3vL THF+DLB3trSuTx7EmfvK+FIrbpRx5QTERoWoFvkbK6BpqqbVvrA0S5whwfK8Fz3tK8im C+fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888203; x=1707493003; 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=yhQX2lsO6sUMNlz849ghUPa03+uYKB43z4lr+2t+Z6I=; b=bXHYelEBKtv8bf/OCP0g6BYdz1ia/ulLU0G+guSQBPZcSBZHdcpz856MuvNR6wHTPy DE88HMXA6/UTO9HHxbq9+14nASrPcnAo+RRoMExSdW4ERTw80XQ/Qn08jjATDRKMm5ez raxsuha71w3Hg0h3tIfmPziillCbdDct6Hh4/dZPkODOOBUBoTWkUkSsSGB52BEs+unY bAI2FfvXH+78+W9jLiSSanood8V/ttn3JD7FB1ZkUab7g/bnxdm+Xr6uMYBQhx6M1PHq v64IkdjtmsZSTLZNa2J2429Um3iX/BheigOimJ5V8RWQsAinMkCN3ehivNtEgEQAnr9O p0ig== X-Gm-Message-State: AOJu0YxdSnW/n3nX2xf1J8O8dNF9PbUoO4vIsoiZjGadRFU/5OAu9jco +OAf2j6ad9flZI0w8N0ZKeLUMZ78qKsHl2F9B8fyIdjmGXVZKKiZWIIRgXj4bd4eeE1uZxEYy4N T X-Google-Smtp-Source: AGHT+IGr9rlgGS/EPQPRmOZ/rsqBL+RwLgZr17qhF4E/XsAI9DNXwPB7XoCyqI3Z6BDcapfOo7JNpA== X-Received: by 2002:a05:600c:470c:b0:40e:fa18:f888 with SMTP id v12-20020a05600c470c00b0040efa18f888mr4062171wmo.14.1706888203589; Fri, 02 Feb 2024 07:36:43 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/36] tests/qtest/xlnx-versal-trng-test.c: Drop use of variable length array Date: Fri, 2 Feb 2024 15:36:11 +0000 Message-Id: <20240202153637.3710444-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888366277100001 Content-Type: text/plain; charset="utf-8" This test program is the last use of any variable length array in the codebase. If we can get rid of all uses of VLAs we can make the compiler error on new additions. This is a defensive measure against security bugs where an on-stack dynamic allocation isn't correctly size-checked (e.g. CVE-2021-3527). In this case the test code didn't even want a variable-sized array, it was just accidentally using syntax that gave it one. (The array size for C has to be an actual constant expression, not just something that happens to be known to be constant...) Remove the VLA usage. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: Zhao Liu Message-id: 20240125173211.1786196-2-peter.maydell@linaro.org --- tests/qtest/xlnx-versal-trng-test.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/qtest/xlnx-versal-trng-test.c b/tests/qtest/xlnx-versal-= trng-test.c index cef4e575bba..ba86f39d13c 100644 --- a/tests/qtest/xlnx-versal-trng-test.c +++ b/tests/qtest/xlnx-versal-trng-test.c @@ -298,10 +298,13 @@ static size_t trng_collect(uint32_t *rnd, size_t cnt) return i; } =20 +/* These tests all generate 512 bits of random data with the device */ +#define TEST_DATA_WORDS (512 / 32) + static void trng_test_autogen(void) { - const size_t cnt =3D 512 / 32; - uint32_t rng[cnt], prng[cnt]; + const size_t cnt =3D TEST_DATA_WORDS; + uint32_t rng[TEST_DATA_WORDS], prng[TEST_DATA_WORDS]; size_t n; =20 trng_reset(); @@ -343,8 +346,8 @@ static void trng_test_autogen(void) =20 static void trng_test_oneshot(void) { - const size_t cnt =3D 512 / 32; - uint32_t rng[cnt]; + const size_t cnt =3D TEST_DATA_WORDS; + uint32_t rng[TEST_DATA_WORDS]; size_t n; =20 trng_reset(); @@ -370,8 +373,8 @@ static void trng_test_oneshot(void) =20 static void trng_test_per_str(void) { - const size_t cnt =3D 512 / 32; - uint32_t rng[cnt], prng[cnt]; + const size_t cnt =3D TEST_DATA_WORDS; + uint32_t rng[TEST_DATA_WORDS], prng[TEST_DATA_WORDS]; size_t n; =20 trng_reset(); @@ -415,8 +418,8 @@ static void trng_test_forced_prng(void) const char *prop =3D "forced-prng"; const uint64_t seed =3D 0xdeadbeefbad1bad0ULL; =20 - const size_t cnt =3D 512 / 32; - uint32_t rng[cnt], prng[cnt]; + const size_t cnt =3D TEST_DATA_WORDS; + uint32_t rng[TEST_DATA_WORDS], prng[TEST_DATA_WORDS]; size_t n; =20 trng_reset(); --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888328; cv=none; d=zohomail.com; s=zohoarc; b=GHb3pZsWh1p7/0FSpFkiCsV3GGoE3VwP/HovkX6NpM+nC0iqW3dto/+U/Si6n1ErS/+yDleyh3sRLfuI7RShr4gBhflnoFSrQ0iIBEaEir8L9/nak1+3Xg2j5RCzqqxNGfNx5SD7Lei+sGA3dgvfmmYREH+qgPF5cpjV9zT0TJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888328; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=3IztTFtTp/gI4kdSRMU2w+rciRT9b75JC4Gb/82o25A=; b=Fds52OvRDLZ8S7wGXt3VoDu3YqUwFhAor/QTUon3aLl84Ql8UslH0gCHVNocpq/ZiAe5srrC3+oapW/5g0BvX6uqimS1SOkAXTFQnq4d9gy1dx4OAwKSe93aIdtsAJrNiBbaRbBHKYIM7Rku61mzmROvwZ2ASKdZvat34Ba6yQI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17068883286927.065030621240908; Fri, 2 Feb 2024 07:38:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvay-0000FM-Ha; Fri, 02 Feb 2024 10:36:48 -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 1rVvax-0000Co-7S for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:47 -0500 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvav-0004Sc-Ib for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:46 -0500 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-51124d43943so3541082e87.2 for ; Fri, 02 Feb 2024 07:36:45 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888204; x=1707493004; 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=3IztTFtTp/gI4kdSRMU2w+rciRT9b75JC4Gb/82o25A=; b=mTRrMiMaTpkHCqF7CArygW0SRSW3VgY0bFZtEYqvzL0V/GzT5L13MXkMlYi448zWTV Jg0kK7jVDnX0k4kU8WjFgLeQ5C7758LUYpstTuPR8ikDmGZssY/NpOxI7Y86WbXeQDrf uouBzWg52zN8N6dN69EdkUc3EMxjS0nRf6IKxpoSLgbb04TOJ/LXxn9YFMpQIu/H9Cy+ HLIoRJAeIa0i8zqG8HajeQkeMkHGQm4UxGg86ahpvf4DXAa2doM+m5u1xyZheo/bweq8 jDuNg2G4/RLNq/wh2VrHM5rxEdT6vEasBQ+diuvb5URPOWbVEYuLCb3lcJr1KbmbUzHg Ru0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888204; x=1707493004; 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=3IztTFtTp/gI4kdSRMU2w+rciRT9b75JC4Gb/82o25A=; b=OIMLEJojyUBLJwB+RpjZSmylp8pJmqc40sMrlPG9sH6XYcqwq1iBSpMfzRQcivZNko bUTmiHx8BecG8pz4FeoxGC94eJUGTDOkT2DWvpsCcxHNSZHOUjLl7SQ6DAV5v07Xtw+7 32mDazIPGHxKPMhSPnW+Y1cEpppPdhnR+P9BKYSzfVpybWLAFuwZCJS2jaCo0m3ZJv0f nAO4hmOUK/ZTJBUbYL5+TM8jsHspNLlhrUMb1rv1/7/NUhOiI3ye5xkKW/mQBrWX58Oi 4RGja7f6VsOubQOW9fN5l2os6ih0cQLsMdopaMd1h/LZpRnJNOsRETkqrIyApgB8PvUQ xkPg== X-Gm-Message-State: AOJu0YwKoKzPqo4w71kg/fRam3ijg2SriZT7Ve4kX0/XqMw20/8hkESc sOcQTQ81HKQbjhb9U/XeL4ZLXypy5jaQG1218jN21MBiasMnZ89rTVW4842OqJWdtATq8LCuzQ1 4 X-Google-Smtp-Source: AGHT+IH5K5agyRF3XA0wL7daLZr55qopu1G8ldkRoZhK6UPe2SHFrLirVYF2kWK9gbGGZT+v2oH9fg== X-Received: by 2002:ac2:5049:0:b0:511:2ebe:a5f3 with SMTP id a9-20020ac25049000000b005112ebea5f3mr1653849lfm.60.1706888204042; Fri, 02 Feb 2024 07:36:44 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/36] target/arm: Reinstate "vfp" property on AArch32 CPUs Date: Fri, 2 Feb 2024 15:36:12 +0000 Message-Id: <20240202153637.3710444-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::132; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x132.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888330073100005 Content-Type: text/plain; charset="utf-8" In commit 4315f7c614743 we restructured the logic for creating the VFP related properties to avoid testing the aa32_simd_r32 feature on AArch64 CPUs. However in the process we accidentally stopped exposing the "vfp" QOM property on AArch32 TCG CPUs. This mostly hasn't had any ill effects because not many people want to disable VFP, but it wasn't intentional. Reinstate the property. Cc: qemu-stable@nongnu.org Fixes: 4315f7c614743 ("target/arm: Restructure has_vfp_d32 test") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2098 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20240126193432.2210558-1-peter.maydell@linaro.org --- target/arm/cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 6a96b245f2c..1ce26e56e32 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1627,6 +1627,10 @@ void arm_cpu_post_init(Object *obj) } } else if (cpu_isar_feature(aa32_vfp, cpu)) { cpu->has_vfp =3D true; + if (tcg_enabled() || qtest_enabled()) { + qdev_property_add_static(DEVICE(obj), + &arm_cpu_has_vfp_property); + } if (cpu_isar_feature(aa32_simd_r32, cpu)) { cpu->has_vfp_d32 =3D true; /* --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888228; cv=none; d=zohomail.com; s=zohoarc; b=MXBxT2T+u16TVd8tzErDH+S/kMM+1wNejKhtLcVDSvcm4CrTry/uQALpOsAdqbzw8lYbyGCCg11eeKnLXaojCDyTw8/l66UW2dAahnpO7wJFEnfmq/RAgfGcnwEgtBUOsA/CF0SvZxQnSNF9Ve/tIsJKNyXF4jBBMqXWL9HtuuY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888228; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=nCqjBY1O075hml0hoLAI8QgIMrH8pjs6AsQwwZz+6WI=; b=UTpQk43mfaNutSDvUommnIlVvm0PDoerfWXSbaHiopx5ysvnEnwUEBgbc9yAfZ4kQJjDRU4C8oqYw+pU56ufTsgOTuR+VQdOW0DlAW626aZ4GYKZ+TNpxYhd65lfEYAcpF1FKUZnI0xeTJPBZG5r1s+GH5p6XMLYuK3PwIQ7U4s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888228432235.39371739304636; Fri, 2 Feb 2024 07:37:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb2-0000Kr-R5; Fri, 02 Feb 2024 10:36:52 -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 1rVvb1-0000Jy-0O for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:51 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvav-0004Sh-Rl for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:50 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40fafae5532so19305655e9.1 for ; Fri, 02 Feb 2024 07:36:45 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888204; x=1707493004; 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=nCqjBY1O075hml0hoLAI8QgIMrH8pjs6AsQwwZz+6WI=; b=nCLyTWnIsyjV0cheIj1FvsDJsf+3TB27/J8OmfO40uLPSpmzTc6/1cWlqkagG1auA1 xdMaDotmy+6lF2w5YVw//DRD7oYpN0Y9xz3fm829aYf0SYOpspKcPEjjoY8bXoekXOoD xHL8l8ghBLOytZdCW4Yag+FQy4aLVO22yrRpQ5Tn9coRTtNVc2Dza8VrGIK/UR8cSxgj AL4T0e0aJhZhQ7xtAhD+TS/Lv9BIADssWdYlChN08ruYRZFPKxevXgWOTmgJGoWcCznh BYF6AvJWJ0Xp6LUpjlNcfB0FMrmsxK+9DnIS9ICmA1IFcew6+j8llzYQREbDxxh7/mfh 5wsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888204; x=1707493004; 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=nCqjBY1O075hml0hoLAI8QgIMrH8pjs6AsQwwZz+6WI=; b=EOdOZiVh8/yXNfsbYsvuXU3TbxnqUNdUpnBNHVzCq4749wooZ2Tcp1hxSo+w2hnMGb tX+e5oRPneuEotG96IYgsVgfdpxyerCnwCjz6p6TGiJq0yY+sXvR+zJAQgKwICEqKsFY ftnK2AmjIZZptEreRTFCzQ4u65kjKRgd0c5DKX8UU1UPWTY7n47Esp+xjhbVY/JMeu2x +B6+cXOIZT1RewTz1O+/I7yLqml4XBisWtM3j0jPGOKyx5vJbSjpZeR4MplumVKmo9OO h/GmBzbS4ClAPl0Z6KiMSg67i+Qf5kI/tyewpSLDcybH/+SeGTZp5qPbqyDjt/HMNir/ Mgpg== X-Gm-Message-State: AOJu0YxtRtpprdTJxjyYdrsCAqvbjkfheH3IlFNnGorgelbW2Ku63e4L GXps5DiO+liookl/D2tKAouyKpkA6oPauAATC0vXgYPpXCwja76XasZINauAajHXNIpLH6EVgKi 6 X-Google-Smtp-Source: AGHT+IGKdtrxEmf6dWADf9kCAsAGz08n7WkZf5jDMSDiv3MvJ5x41uJUcUR+IONTuV/2f10hMdLIbQ== X-Received: by 2002:a5d:4c90:0:b0:33b:1bed:a315 with SMTP id z16-20020a5d4c90000000b0033b1beda315mr2414170wrs.25.1706888204443; Fri, 02 Feb 2024 07:36:44 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/36] doc/sphinx/hxtool.py: add optional label argument to SRST directive Date: Fri, 2 Feb 2024 15:36:13 +0000 Message-Id: <20240202153637.3710444-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888229469100001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse We can't just embed labels directly into files like qemu-options.hx which are included from multiple top-level rST files, because Sphinx sees the labels as duplicate: https://github.com/sphinx-doc/sphinx/issues/9707 So add an optional argument to the SRST directive which causes a label of the form '.. _DOCNAME-HXFILE-LABEL:' to be emitted, where 'DOCNAME' is the name of the top level rST file, 'HXFILE' is the filename of the .hx file, and 'LABEL' is the text provided within the 'SRST()' directive. Using the DOCNAME of the top-level rST document means that it is unique even when the .hx file is included from two different documents, as is the case for qemu-options.hx Now where the Xen PV documentation refers to the documentation for the -initrd command line option, it can emit a link directly to it as ''. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant Reviewed-by: Peter Maydell Message-id: 20240130190348.682912-1-dwmw2@infradead.org Signed-off-by: Peter Maydell --- docs/devel/docs.rst | 12 ++++++++++-- docs/sphinx/hxtool.py | 16 ++++++++++++++++ docs/system/i386/xen.rst | 3 ++- qemu-options.hx | 2 +- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/docs/devel/docs.rst b/docs/devel/docs.rst index 7da067905b8..50ff0d67f84 100644 --- a/docs/devel/docs.rst +++ b/docs/devel/docs.rst @@ -30,6 +30,13 @@ nor the documentation output. =20 ``SRST`` starts a reStructuredText section. Following lines are put into the documentation verbatim, and discarded from the C output. +The alternative form ``SRST()`` is used to define a label which can be +referenced from elsewhere in the rST documentation. The label will take +the form ````, where ``DOCNAME`` is the name of the +top level rST file, ``HXFILE`` is the filename of the .hx file without +the ``.hx`` extension, and ``LABEL`` is the text provided within the +``SRST()`` directive. For example, +````. =20 ``ERST`` ends the documentation section started with ``SRST``, and switches back to a C code section. @@ -53,8 +60,9 @@ text, but in ``hmp-commands.hx`` the C code sections are = elements of an array of structs of type ``HMPCommand`` which define the name, behaviour and help text for each monitor command. =20 -In the file ``qemu-options.hx``, do not try to define a +In the file ``qemu-options.hx``, do not try to explicitly define a reStructuredText label within a documentation section. This file is included into two separate Sphinx documents, and some versions of Sphinx will complain about the duplicate label -that results. +that results. Use the ``SRST()`` directive documented above, to +emit an unambiguous label. diff --git a/docs/sphinx/hxtool.py b/docs/sphinx/hxtool.py index 9f6b9d87dcc..3729084a36c 100644 --- a/docs/sphinx/hxtool.py +++ b/docs/sphinx/hxtool.py @@ -78,6 +78,14 @@ def parse_archheading(file, lnum, line): serror(file, lnum, "Invalid ARCHHEADING line") return match.group(1) =20 +def parse_srst(file, lnum, line): + """Handle an SRST directive""" + # The input should be either "SRST", or "SRST(label)". + match =3D re.match(r'SRST(\((.*?)\))?', line) + if match is None: + serror(file, lnum, "Invalid SRST line") + return match.group(2) + class HxtoolDocDirective(Directive): """Extract rST fragments from the specified .hx file""" required_argument =3D 1 @@ -113,6 +121,14 @@ def run(self): serror(hxfile, lnum, 'expected ERST, found SRST') else: state =3D HxState.RST + label =3D parse_srst(hxfile, lnum, line) + if label: + rstlist.append("", hxfile, lnum - 1) + # Build label as _DOCNAME-HXNAME-LABEL + hx =3D os.path.splitext(os.path.basename(hxfil= e))[0] + refline =3D ".. _" + env.docname + "-" + hx + \ + "-" + label + ":" + rstlist.append(refline, hxfile, lnum - 1) elif directive =3D=3D 'ERST': if state =3D=3D HxState.CTEXT: serror(hxfile, lnum, 'expected SRST, found ERST') diff --git a/docs/system/i386/xen.rst b/docs/system/i386/xen.rst index 81898768baa..46db5f34c1d 100644 --- a/docs/system/i386/xen.rst +++ b/docs/system/i386/xen.rst @@ -132,7 +132,8 @@ The example above provides the guest kernel command lin= e after a separator (" ``--`` ") on the Xen command line, and does not provide the guest kernel with an actual initramfs, which would need to listed as a second multiboot module. For more complicated alternatives, see the command line -documentation for the ``-initrd`` option. +:ref:`documentation ` for the +``-initrd`` option. =20 Host OS requirements -------------------- diff --git a/qemu-options.hx b/qemu-options.hx index 40e938c4877..5adbed11013 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3994,7 +3994,7 @@ ERST =20 DEF("initrd", HAS_ARG, QEMU_OPTION_initrd, \ "-initrd file use 'file' as initial ram disk\n", QEMU_ARCH_A= LL) -SRST +SRST(initrd) =20 ``-initrd file`` Use file as initial ram disk. --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888234; cv=none; d=zohomail.com; s=zohoarc; b=mSZOGE4r9Z7ygDaVPD0uIyY5tpCs7OPBaaBccZoOJ5ECynTRbYVkxaI+S1L9xKKopl+Mp5UPP3GcQu2NrWbyOrOogELky7Ft2eIUY5wJ257Hau1YHHY1LHxdLf6BL3zWPxH6S11c4NUhrgZ32ErLbEXUB/KPhTq1xmxeU3i52kY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888234; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=k/KtHzrgDY0sCTDgXF5o6E+FF2YFpOZCP9knTxPgJ0Q=; b=au2vkc6Szr2qPB1I17OOPNlVE2L6cyInfS4XqJT8MS/XJZO+Q+bfJ8bNt8l1jtOpHz5Jt0UIdKhrrY7S51uCspO2YpPQZ7LzDRcahX3Szn4ZgUsO6WJgyUYaG54lJSZ5M7D9FSxEgWl1Mz8ZlZrbyQJweB+8K2vAbvZNDyVPK9s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888234633127.95027499176604; Fri, 2 Feb 2024 07:37:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb0-0000Iz-7B; Fri, 02 Feb 2024 10:36:50 -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 1rVvay-0000FF-6V for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:48 -0500 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvaw-0004Sz-KJ for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:47 -0500 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-511363611ceso1023933e87.2 for ; Fri, 02 Feb 2024 07:36:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888205; x=1707493005; 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=k/KtHzrgDY0sCTDgXF5o6E+FF2YFpOZCP9knTxPgJ0Q=; b=OYvMROQjjs3MpNyxgBHKaxUFfA3t0wqxT5RCFiT1oC+NH+XEnfm9Z2AAiOHAvd8loQ 2ydkWp49xM8KXZkh+uxbIpJf1cex5fAlYV/Jr0XA7Sq/LqxaEJKF74aOJCmP498NNh5t gUKhTPJcXfLXXTMFkrz3iSAuVQflHgo//NUlYNkkE4mrQASK5Q9iZMaD5nqBYWpIArIw vLGyZIgURuLUtfLM1LvY4FHOPeaioCZolhg7ASZg/5Q6WVVDzb3XoFWdfzJ1Lj4Xh+ja zXsPKelzhhHcY8xEXMcSlko30NLVgIShSaHBLkPeeqAzBU9QpiUtnLPMrNL2hfy3MHuD wcVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888205; x=1707493005; 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=k/KtHzrgDY0sCTDgXF5o6E+FF2YFpOZCP9knTxPgJ0Q=; b=Qwv1UuHqaGHI5YveoQqh3BmmIJ3U+FPv0N69gVU2M+alZ9OnwzAJPVGYIXWQCZU1Bz +QFV3oxg5tJn5ekWbRkDJTnqvivztw5/oB9ShJKhxIYURrvk+x6WGF7QZTXZ/Ij6OcOU PqvS8ifyVsALhLk0QZd6hubWmnB7Z75mz+ipf30Qj0g1KmFEHw4K6hLIPBJVEcya5U9D 8Zgcn0BuiQ9s3hi1kPairzDpfjKvaWGti92TvyOycfBd+AluCn7AObAdkkdb26Adcy4g Sd/xmFh2HTX6q922ukmnlYVa0SKdX75h2kUFIDt8/bbQ8N2AawZPd1BK46RQu01vkECm flCQ== X-Gm-Message-State: AOJu0Yx6FMdGAeo/D0G63BkxtZZImQeKG+ZaSHhATeBHrU4qQaen1Mc5 Yls/mNIQhmYAVIsUy2KfTZEpP/B7I9S5H3GQqdwHacrWccwKZhhnpm6+6j8kFWn9/E7+H8QZ6HB B X-Google-Smtp-Source: AGHT+IHeOh3s3Xg4ln4UilKZ4jGUifVQlH91Og2dl4Xcg6A8CrUCYTKOPcEOOvcsKYKMQWPo0tE0kQ== X-Received: by 2002:a05:6512:b8c:b0:511:3865:2dda with SMTP id b12-20020a0565120b8c00b0051138652ddamr1424311lfv.2.1706888204997; Fri, 02 Feb 2024 07:36:44 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/36] hw/arm/exynos: Add missing QOM parent for CPU cores Date: Fri, 2 Feb 2024 15:36:14 +0000 Message-Id: <20240202153637.3710444-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x12a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888235476100001 From: Philippe Mathieu-Daud=C3=A9 QDev objects created with qdev_new() need to manually add their parent relationship with object_property_add_child(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Gavin Shan Message-id: 20240129151828.59544-2-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/arm/exynos4210.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 6c428d8eeb4..57c77b140c2 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -556,6 +556,7 @@ static void exynos4210_realize(DeviceState *socdev, Err= or **errp) for (n =3D 0; n < EXYNOS4210_NCPUS; n++) { Object *cpuobj =3D object_new(ARM_CPU_TYPE_NAME("cortex-a9")); =20 + object_property_add_child(OBJECT(s), "cpu[*]", cpuobj); /* By default A9 CPUs have EL3 enabled. This board does not curre= ntly * support EL3 so the CPU EL3 property is disabled before realizat= ion. */ --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888255; cv=none; d=zohomail.com; s=zohoarc; b=C2D3CQw/nXmyGtthovxTBGiTTf0TuY2YgNPUnlfk+aIM45MImEfhf773GkSBDpE7b3/iuD2tA2+qHpbTzy1HevjKW0AfzDT1mGiTlxpS+BZYsdF0/ZmEJ6qMKwXCdziI3R+4/MDygN716n+R88dYwOIgX4TSpL0xR4cOxB0o86w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888255; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=RvJ8JOx/rn0qluSRFPgqZoXgXfokD/UExFxdgtk19s8=; b=BgcFpcVo95TSRAXydfFNg/eGtVStkiVmFPdc1e9/DM4P2T/OflH33vO8MX+kqBOk1Je7EsnHgNLQ+YWeFMWrzXOHIReWcpgYCFmcv8B3aAhV3/H/Fw3eSG6W45AjmnBAiJ5f0AVniqPRfo9qoDMBuuO8k+Ty+T/aQFBqZ4mBktw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888255858445.42042293060854; Fri, 2 Feb 2024 07:37:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb0-0000Jx-Tt; Fri, 02 Feb 2024 10:36:50 -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 1rVvay-0000FO-J0 for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:48 -0500 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvax-0004TF-0q for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:48 -0500 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5113a7e662aso553370e87.2 for ; Fri, 02 Feb 2024 07:36:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888205; x=1707493005; 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=RvJ8JOx/rn0qluSRFPgqZoXgXfokD/UExFxdgtk19s8=; b=B6k48+oP6HvrnzK0IBjrVFFPooGoYS1OJ5Ag02iYQLuQtZIAuejG8LzSNPUjUuQprS yFLRTW+mPcM7KoQiA4q33FmcdaG/cgyY9jAZyUKXruFWvx/N8GhdzK4qT1R8WJHEwX6A TAGRye9tToio/0FmLVWpOCx9NYz+Gsd+sQgfRF1E2hbHY2tT+hniK5RxeqHN2oLzXQKe RT1iJFo74Krpj8/fWIQLTrl2p67D1zSi1ryUk+SUOvX+FYns6vZ89SWA2/I35WAMhacY XK6PtqgthvCkizb2Yq3mUGV0A8eW96V5ugC8I2VwnHloFNcV8uw5S7mnX2s2auAIP4gi z29g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888205; x=1707493005; 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=RvJ8JOx/rn0qluSRFPgqZoXgXfokD/UExFxdgtk19s8=; b=rs90oXXxmNIc1zQkyTmilVb40QhlXgY1MOOh1JIEHA0Q3hwXbrqpWtSIz4nHwODS7v KONntziW3qyMsGxkJ5GkIqZnXchWxJqLT0ysfMt6cD6ADu2PnQL7qw0SxNlHxuFJ+L58 CU00TOTXhCHB2rQc688MDoeMFJ2bSalMs0uSvxexaalQ6HHIhO5OI4eRF6Vv486L9gQ/ LdqddDFoXa+snEKD/jX+6Ql8Y1eaFWYZVoxq+xKckdnwscuzaWnjQ6TmPuXDmQlZ1Qjg 0pyPisNIBqDz50Y4Kdpn+2L/lEfTug21+rFP5KHL7g880pTEC3HPIq+/FuCiyUK5oGR3 QFXQ== X-Gm-Message-State: AOJu0Yzy2zK9RLnrsPfoaFJx9EocYrd5vZFQCRa3pmbUHiri1ZP2EQyj OTwZVhtACHt4DUCsfb7I5E2iPVjIR7sFagbRRCf5ze70MUFChfqoexS/0FjGIiw0rHqBX4JTlEm L X-Google-Smtp-Source: AGHT+IEtzuILyFGGqdQby9UU9xTmMV412JhjllkW3pzXIv+1nfUVA/IYve38pXQyN7/UJ7MKNv57Qw== X-Received: by 2002:ac2:522b:0:b0:50e:6d96:4b27 with SMTP id i11-20020ac2522b000000b0050e6d964b27mr4256689lfl.60.1706888205391; Fri, 02 Feb 2024 07:36:45 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/36] hw/arm/exynos: Check for CPU types in machine_run_board_init() Date: Fri, 2 Feb 2024 15:36:15 +0000 Message-Id: <20240202153637.3710444-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x12b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888257578100003 From: Philippe Mathieu-Daud=C3=A9 Restrict MachineClass::valid_cpu_types[] to the single valid CPU type. Instead of ignoring invalid CPU type requested by the user: $ qemu-system-arm -M nuri -cpu cortex-a7 -S -monitor stdio QEMU 8.2.50 monitor - type 'help' for more information (qemu) info qom-tree /machine (nuri-machine) /soc (exynos4210) /cpu[0] (cortex-a9-arm-cpu) ... We now display an error: $ qemu-system-arm -M nuri -cpu cortex-a7 qemu-system-arm: Invalid CPU model: cortex-a7 The only valid type is: cortex-a9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Gavin Shan Message-id: 20240129151828.59544-3-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/arm/exynos4_boards.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c index b0e13eb4f00..01c7618a67c 100644 --- a/hw/arm/exynos4_boards.c +++ b/hw/arm/exynos4_boards.c @@ -34,6 +34,7 @@ #include "hw/qdev-properties.h" #include "hw/boards.h" #include "hw/irq.h" +#include "target/arm/cpu-qom.h" =20 #define SMDK_LAN9118_BASE_ADDR 0x05000000 =20 @@ -150,12 +151,18 @@ static void smdkc210_init(MachineState *machine) arm_load_kernel(s->soc.cpu[0], machine, &exynos4_board_binfo); } =20 +static const char * const valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-a9"), + NULL +}; + static void nuri_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); =20 mc->desc =3D "Samsung NURI board (Exynos4210)"; mc->init =3D nuri_init; + mc->valid_cpu_types =3D valid_cpu_types; mc->max_cpus =3D EXYNOS4210_NCPUS; mc->min_cpus =3D EXYNOS4210_NCPUS; mc->default_cpus =3D EXYNOS4210_NCPUS; @@ -174,6 +181,7 @@ static void smdkc210_class_init(ObjectClass *oc, void *= data) =20 mc->desc =3D "Samsung SMDKC210 board (Exynos4210)"; mc->init =3D smdkc210_init; + mc->valid_cpu_types =3D valid_cpu_types; mc->max_cpus =3D EXYNOS4210_NCPUS; mc->min_cpus =3D EXYNOS4210_NCPUS; mc->default_cpus =3D EXYNOS4210_NCPUS; --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888381; cv=none; d=zohomail.com; s=zohoarc; b=Le7pp986LL0UNiJLjIg2GkoyP2YCuLZFGNmZuG7i7yW3m9LUvUtyFwj5cVKKAt+N2CjsyHXKC/WRhEPOA2KroxZcEveglrRsp+oe6ConZy2eZpEVV/WznqbBojxfY96pjHSOQiYhO/div7//gpOXhwoR6ueEh4c9Dn+W1pUMMY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888381; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=DiMJCghid+PXdwMM48VSgNrU6KzfMReU7rheuaNV3y8=; b=OYnkanL9HdTOygaROrDk1MDyg5rKaQ67fGT8pM2F6hvYdPfMlS4+OJAAUKw3kTHxrShRMAM9ecKS+h4AT2ICIi98nXUe+N2yhHZK1poN0kvTyj2TvcYDJgVWrsmtNs7nCL4S62VWsdRDmY81Xox5tVPHzeQ++pSeKGcMEfwlmmY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888381402726.631343368178; Fri, 2 Feb 2024 07:39:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb1-0000K9-M9; Fri, 02 Feb 2024 10:36:51 -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 1rVvb0-0000In-1a for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:50 -0500 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvax-0004TM-GZ for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:49 -0500 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5111c7d40deso3554666e87.1 for ; Fri, 02 Feb 2024 07:36:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888206; x=1707493006; 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=DiMJCghid+PXdwMM48VSgNrU6KzfMReU7rheuaNV3y8=; b=GgFwwRK4vK/0V6dYjk9e+AmAJDO0pVyd4jTl5a+e6Oxe30rRnouuYXHSiknCoeA3bL wLLmFTO2LCDKHuyFpdj3H33cesOd229n5un0N2WR5ie2WEAdHKL7L+rJE6ApvI174MFM +2hbEy2C1Ch20KpNI5jkOSUEUI8bxehHD3WdnoUiTGEswm7It+8E3ONShrjCh/AW2G6B xBL0khEcO6G11f6/mnzWmUFBL5GlJV8thOOOzlz8p/OIsTIM1YhKEdOgZexJ5Znkgohs LRiMnGL2QBQV92qCwT5DB4vkhpdBdwpEpeX+IflJJEZy4ujI8ck23KwxrCqVNN5B8wf6 nL4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888206; x=1707493006; 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=DiMJCghid+PXdwMM48VSgNrU6KzfMReU7rheuaNV3y8=; b=RqmtLkiCnXLM0sk7IGpkI88+7C1HZMrHCapE+N8v8+bXBvwhYLa47X553tLPGslf/C oRZT0SegO+z2NdI+3n6m0QxzqCcwzkM+TJ0P5RS07s2MHzen1CicurpAggwYGib9K8BE xwS7YRBrU8bAkV/5NjpiTabc2VgQUdyL2hhSH0veE05Gba3sB+xzm8wApwlzr9+9Nesj biGnwWaddoh/47YKzHYESTImJBvO+heORkLx2zOwfCy2FGc33scFmCNiNzNedKMnZiCM AvnL6d9WISny+6s8/AjTgLxT3Ko+4hbfvVRL3FlDDoQejmej08rW51XcqwbgU1MvGjSy 36oQ== X-Gm-Message-State: AOJu0YwpliZGiAnFawHEni6b1vEuv6YUCGO/TB7qxsCom1zxqAgAlvt6 7chrScsZkWQ1k5wQbu97eOz8n5s9YuCh9TetoxrWH+Aw20ihLn6Gk8uWb0hn+rQE2xSKhiqNrDY x X-Google-Smtp-Source: AGHT+IEJLvLEgcsA4pX5nprkPbHNUOcG/7sAh77PIQPa73Gon1EY3vvzaQyJwZMBKb+mCIa8A/eQtw== X-Received: by 2002:a05:6512:3e05:b0:511:33d4:c99a with SMTP id i5-20020a0565123e0500b0051133d4c99amr2115502lfv.61.1706888205883; Fri, 02 Feb 2024 07:36:45 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/36] hw/arm/highbank: Add missing QOM parent for CPU cores Date: Fri, 2 Feb 2024 15:36:16 +0000 Message-Id: <20240202153637.3710444-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x131.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888382353100005 From: Philippe Mathieu-Daud=C3=A9 QDev objects created with qdev_new() need to manually add their parent relationship with object_property_add_child(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Gavin Shan Message-id: 20240129151828.59544-4-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/arm/highbank.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index e6e27d69af5..b8d702c82cc 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -209,6 +209,7 @@ static void calxeda_init(MachineState *machine, enum cx= machines machine_id) cpuobj =3D object_new(machine->cpu_type); cpu =3D ARM_CPU(cpuobj); =20 + object_property_add_child(OBJECT(machine), "cpu[*]", cpuobj); object_property_set_int(cpuobj, "psci-conduit", QEMU_PSCI_CONDUIT_= SMC, &error_abort); =20 --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888340; cv=none; d=zohomail.com; s=zohoarc; b=Qjpm7Rx27rQ9KigKNpho+/Y1vjQ63gpO4KY5kiOr3uh96NrDBK9exkNr4wV9y5B+XOr0Kao4nZjB0I4MmH4z+UQDPMjq1Cj+VUd7UilSzsEgL2HI9kMnq2NTbIdefgd/RxecFSp0RemS16egdnba49tYXna842ogExPPHyUH2+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888340; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=RYd3QrmHD9UKjdfu51z5VjEqtJezN+iOtcmmSJ3N4Eo=; b=c5EM7Zl8tRPNh3d+T5Icy1rX0joKwQRtaCTQfwVv7WwsUmQ/zY6otB3k/aOWvySxnyyQ8PytHtOOyHE7MMIVrPT8yEDBitlXIv37vyXwyYoZ5vVd9cTTN4V8qCvBip4+Ef63zC/wz6Cx4aNqxI/LGPh9O4VeoCY51t175N39MzU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888340500677.8656435263738; Fri, 2 Feb 2024 07:39:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb2-0000Kh-6n; Fri, 02 Feb 2024 10:36:52 -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 1rVvb0-0000JA-9n for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:50 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvay-0004TU-ME for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:49 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40fb020de65so19239145e9.2 for ; Fri, 02 Feb 2024 07:36:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888206; x=1707493006; 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=RYd3QrmHD9UKjdfu51z5VjEqtJezN+iOtcmmSJ3N4Eo=; b=IL0+I6LW9TtehitUbFW7SGqCZzHYkyhX126hWj3NjoTa92O8+Sl2qVL2kCfEm/N00A mOZg8jQgNzgshLOXTmPOR1mNCHM9NAsWfT9RMr1u12I3zR1KADrtFVdPXhSxEebELcrP fZXD7omcAzfPzkOW+HApdraHToTAKoV4rKXJi4dVqOSxsyYHC1QTclF6ORPh+bClEqoT MRVW/uN9A19t3Bc4u/noPiILayDnxzOT5D1Jv1L9gMyxvFp+EO6PtsfjBExa34Dhs6j1 w0NgH/le5EiPaTFlXVPXXcQlWqjUkxUJq8IV+BmXcqsizHbrwMEImVKDxGodMFSb4k6O lxIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888206; x=1707493006; 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=RYd3QrmHD9UKjdfu51z5VjEqtJezN+iOtcmmSJ3N4Eo=; b=hjmCslTMMxJv12Y2bEj+AqOU+3b6QBGg/noq0qDRaLoao7ulzltgvcXpMTBg2UcZTG 6FWJfjVnU4/5ihhuDvnZpCUQuB0cug1iIiYX64NuCE7a9tXXztVOZ60uvIRI9oIqayr6 ViQRQwxrQOCRlHu/AXcQMGp5LP9HFRVwuJ/tHA7zu1XPcbuD7WGdk3hkHenj+qp9OT7V nBiaMCrZvR8agr3CpanKUolSa7G3m0MCpXmTdZ/1Lzhf7Ns9aO6oAZlwMd45TDdeZMR+ qTt8nzJmXrAANFwRLUheijV1Idckw363hRp840Fcirmpkz46UldlXzUiWNEWIWv0rOay ox4Q== X-Gm-Message-State: AOJu0YyK5gCmSj5hFT6dEYNYMTtZTrOrfHHp1hRUv3ayLy5LBpeQk8Ld /HD3Eke7VIqyJU1vrmVSaF9G11PUkn/8MocTtXU6geaXNKvHom07Oe828cw8B6S4QOwB7L5Xwd4 p X-Google-Smtp-Source: AGHT+IG2iplXt4MJz53vrW6Dk82/noLxmrcqdxW91c4qAfwyRlwzUnkg8bja0nR+zsrWX23hwfpgaA== X-Received: by 2002:a05:600c:3152:b0:40e:7852:bc85 with SMTP id h18-20020a05600c315200b0040e7852bc85mr6665943wmo.41.1706888206343; Fri, 02 Feb 2024 07:36:46 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/36] hw/arm/highbank: Check for CPU types in machine_run_board_init() Date: Fri, 2 Feb 2024 15:36:17 +0000 Message-Id: <20240202153637.3710444-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888342068100001 From: Philippe Mathieu-Daud=C3=A9 Restrict MachineClass::valid_cpu_types[] to the single valid CPU types. Instead of ignoring invalid CPU type requested by the user: $ qemu-system-arm -M midway -cpu cortex-a7 -S -monitor stdio QEMU 8.2.50 monitor - type 'help' for more information (qemu) info qom-tree /machine (midway-machine) /cpu[0] (cortex-a15-arm-cpu) ... we now display an error: $ qemu-system-arm -M midway -cpu cortex-a7 qemu-system-arm: Invalid CPU model: cortex-a7 The only valid type is: cortex-a15 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Gavin Shan Message-id: 20240129151828.59544-5-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/arm/highbank.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index b8d702c82cc..03670506974 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -345,10 +345,15 @@ static void midway_init(MachineState *machine) =20 static void highbank_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-a9"), + NULL + }; MachineClass *mc =3D MACHINE_CLASS(oc); =20 mc->desc =3D "Calxeda Highbank (ECX-1000)"; mc->init =3D highbank_init; + mc->valid_cpu_types =3D valid_cpu_types; mc->block_default_type =3D IF_IDE; mc->units_per_default_bus =3D 1; mc->max_cpus =3D 4; @@ -364,10 +369,15 @@ static const TypeInfo highbank_type =3D { =20 static void midway_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-a15"), + NULL + }; MachineClass *mc =3D MACHINE_CLASS(oc); =20 mc->desc =3D "Calxeda Midway (ECX-2000)"; mc->init =3D midway_init; + mc->valid_cpu_types =3D valid_cpu_types; mc->block_default_type =3D IF_IDE; mc->units_per_default_bus =3D 1; mc->max_cpus =3D 4; --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888341; cv=none; d=zohomail.com; s=zohoarc; b=R7o1Er+rbIys5La8H228UuM3wD11CswgWbJj5PetUUWy9WoUmf5x7DDoMsUkt4QmzLxS0Em/QrOmjmSNiKxNfKznB5Tx3P9sTli24BiYXyi2OwUxinyZpyatOxFGrzQAOgfSEUB4ozjvyibfyRH0yB05nR9kyuf5GAukjylhosU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888341; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=ROIbqMmLLVZq9UdAkCxZXU8hJKBW1wxg/fAMDNbM68c=; b=Oc4CC7HMJx86r1Lh00HwIon90fwXb/UhG7z1tdKwpKrvdyNAU3dbuH+a1Oa6ZNAn4GcFNMH1XK7F2Taq5YBttL+7YLoZ/9h8Qr0gcab+G4SILKylT7LvSJWMsYao3v1sgZ9OsEtwn5xlqH8ztb8wVBGm7KFfOLeGY1dfb+0YnL4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888341723732.8089634741275; Fri, 2 Feb 2024 07:39:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb5-0000Nf-SS; Fri, 02 Feb 2024 10:36:55 -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 1rVvb1-0000KC-Mf for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:51 -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 1rVvaz-0004Td-2s for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:51 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40ef6bbb61fso18648525e9.1 for ; Fri, 02 Feb 2024 07:36:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888206; x=1707493006; 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=ROIbqMmLLVZq9UdAkCxZXU8hJKBW1wxg/fAMDNbM68c=; b=IGet7IlDwj4Ui/UZE57ZGCl1SS5abanvzzFkqCo1tOH4Ba7WBZczRUtCoLmJS5IVMv oK+OkfirXXGaxbgD4tFb2uz8zz+GhMBmJku4qk6Abaak6/8bWdVTM5PukkeXaATgaSzg 2QpeLcdovTXHGSIeXzLDSaoYjt2QwVng0XD7sODfMvpf6ApLB1z/Ipo5nms1wQr02m2u 6M1xgtQFGINMj1kgTDcZ5OUC64GtqFEd7z98FawEZpZ72Qyd4kuSdJJOwjqwIjbarR4f d3IwRtmTezzTqdm/RE2NfURB16JLCjCRWuc/+vm3NCuoXtMwKXUH7y85aLjHtqNe1cAs 2vyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888206; x=1707493006; 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=ROIbqMmLLVZq9UdAkCxZXU8hJKBW1wxg/fAMDNbM68c=; b=SlfBfGLsTtw4Qx4g4kVjao0kNNGkiK2SOCfG+DyRBvYgmD0BeKVb1Ld+9G0q7VIiNL fM+Oaceu8LnmprlACdM7n36bUjXXO2xwkDdO/2+nbQdmUbdCgmhyC7GDa8Jex5ovoWph ZswPQneqzFKjsP7IJRaC5Zf0HNIReCNEf57I32qjdXo5yLGLHh6ylUPNXlznfEsWtLdx s1ZYRn2eI86a30knJ9Q3Ss58OMVI9DWFNwJ+6Mkjm/OQaQ2M1JW08H9Rc9aa+fii67OB u7D6h65rmqu9YpEHTwQXxk/8+Uj+Gl3xLAr+OXXva3ut+4iakWMH7n+ieFdqryL5rP65 5wjw== X-Gm-Message-State: AOJu0YxCZgePFgvjQV4PGu2VE7Po5iAbPM9f0okyZAfe8F0sbyeDof+L nQtgiGNq4/STnLA8B2FI92yO0mqLlZ0iuQXki/iyt1zBTJ6SvDoWGFdanpFJCU/mKKVHxhvm7dX E X-Google-Smtp-Source: AGHT+IHKi0TpxKIIYngtLZ+5DBdnVqlEwkrX/qtVnN4sRNZhhdK4EjgGPtHqweEBU6Rqo6BZVki3BA== X-Received: by 2002:a05:600c:a3a5:b0:40f:c655:aaf0 with SMTP id hn37-20020a05600ca3a500b0040fc655aaf0mr1390701wmb.23.1706888206713; Fri, 02 Feb 2024 07:36:46 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/36] hw/arm/msf2: Simplify setting MachineClass::valid_cpu_types[] Date: Fri, 2 Feb 2024 15:36:18 +0000 Message-Id: <20240202153637.3710444-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@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, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888342069100002 From: Philippe Mathieu-Daud=C3=A9 The M2Sxxx SoC family can only be used with Cortex-M3. Propagating the CPU type from the board level is pointless. Hard-code the CPU type at the SoC level. Remove the now ignored MachineClass::default_cpu_type field. Use the common code introduced in commit c9cf636d48 ("machine: Add a valid_cpu_types property") to check for valid CPU type at the board level. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20240129151828.59544-6-philmd@linaro.org Signed-off-by: Peter Maydell --- include/hw/arm/msf2-soc.h | 3 --- hw/arm/msf2-soc.c | 3 +-- hw/arm/msf2-som.c | 4 ---- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/include/hw/arm/msf2-soc.h b/include/hw/arm/msf2-soc.h index ce417a6266a..9300664e8ea 100644 --- a/include/hw/arm/msf2-soc.h +++ b/include/hw/arm/msf2-soc.h @@ -47,13 +47,10 @@ OBJECT_DECLARE_SIMPLE_TYPE(MSF2State, MSF2_SOC) #define MSF2_NUM_TIMERS 2 =20 struct MSF2State { - /*< private >*/ SysBusDevice parent_obj; - /*< public >*/ =20 ARMv7MState armv7m; =20 - char *cpu_type; char *part_name; uint64_t envm_size; uint64_t esram_size; diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c index b5fe9f364d5..d6eb9ec9ac1 100644 --- a/hw/arm/msf2-soc.c +++ b/hw/arm/msf2-soc.c @@ -134,7 +134,7 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Er= ror **errp) =20 armv7m =3D DEVICE(&s->armv7m); qdev_prop_set_uint32(armv7m, "num-irq", 81); - qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type); + qdev_prop_set_string(armv7m, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3"= )); qdev_prop_set_bit(armv7m, "enable-bitband", true); qdev_connect_clock_in(armv7m, "cpuclk", s->m3clk); qdev_connect_clock_in(armv7m, "refclk", s->refclk); @@ -231,7 +231,6 @@ static Property m2sxxx_soc_properties[] =3D { * part name specifies the type of SmartFusion2 device variant(this * property is for information purpose only. */ - DEFINE_PROP_STRING("cpu-type", MSF2State, cpu_type), DEFINE_PROP_STRING("part-name", MSF2State, part_name), DEFINE_PROP_UINT64("eNVM-size", MSF2State, envm_size, MSF2_ENVM_MAX_SI= ZE), DEFINE_PROP_UINT64("eSRAM-size", MSF2State, esram_size, diff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c index a269cf044b9..5c415abe852 100644 --- a/hw/arm/msf2-som.c +++ b/hw/arm/msf2-som.c @@ -47,7 +47,6 @@ static void emcraft_sf2_s2s010_init(MachineState *machine) DeviceState *dev; DeviceState *spi_flash; MSF2State *soc; - MachineClass *mc =3D MACHINE_GET_CLASS(machine); DriveInfo *dinfo =3D drive_get(IF_MTD, 0, 0); qemu_irq cs_line; BusState *spi_bus; @@ -62,8 +61,6 @@ static void emcraft_sf2_s2s010_init(MachineState *machine) dev =3D qdev_new(TYPE_MSF2_SOC); object_property_add_child(OBJECT(machine), "soc", OBJECT(dev)); qdev_prop_set_string(dev, "part-name", "M2S010"); - qdev_prop_set_string(dev, "cpu-type", mc->default_cpu_type); - qdev_prop_set_uint64(dev, "eNVM-size", M2S010_ENVM_SIZE); qdev_prop_set_uint64(dev, "eSRAM-size", M2S010_ESRAM_SIZE); =20 @@ -108,7 +105,6 @@ static void emcraft_sf2_machine_init(MachineClass *mc) =20 mc->desc =3D "SmartFusion2 SOM kit from Emcraft (M2S010)"; mc->init =3D emcraft_sf2_s2s010_init; - mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-m3"); mc->valid_cpu_types =3D valid_cpu_types; } =20 --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888322; cv=none; d=zohomail.com; s=zohoarc; b=CzoA4gyIjyCHUNLlxi5R9JlkkxWY3Mk+Wm1iQg1evnB0tLGakweepxSOJ6zcUYe6k6BuD2cYPYFxD9x/ZDMhK3REU8N2Pnup4nOVdxWa/USwbTH60IoJvcR4rlb7JdeAbQTcQhuU/1Dgj3EWcLqY/s9S7EsUIukTtyyUQpm9tJA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888322; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=ZWs5NQ83i9qIQWdiDsw7uY28XWqWXL7f3H4Vv5HjyFk=; b=VoQ64o3H7MhGV3en0yE+m7mTefAuZF/PgtCbmUhvLXUBNoqAypkHAB3BVavPDMHWDhfjhpGHUyEiNMp0wj6GOHmdDNRoGtkXIVZ85cLc+LAn3wR5lR+XVStVb58NNX9t7emufcrb+Kr/ER7xvziVgdrjgjVdS+np/4PEMFdV3WY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888322959983.3475027379158; Fri, 2 Feb 2024 07:38:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb5-0000NN-6E; Fri, 02 Feb 2024 10:36:55 -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 1rVvb1-0000KB-M3 for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:51 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvaz-0004To-HO for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:51 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40fc22f372cso13027445e9.1 for ; Fri, 02 Feb 2024 07:36:49 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888207; x=1707493007; 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=ZWs5NQ83i9qIQWdiDsw7uY28XWqWXL7f3H4Vv5HjyFk=; b=oWy1M/0+YRXxnBTR9lTl5NwH3CaBOQO/Xo8d138qwTz6fx7QxX3Hw6t2zZaDL1fuEt k5ZCX3xfumf1hvNWqBEC+nPuqE1t08/odr5JmtzyqeVgjhDPCTapZojiqNpMQJNbxbHq PRr495DWl1Ue8gQxYTnGkMeyNb9wsqK183qg6VOj1G1YmdO9Nyq8v2Ke+p2Zx5pWN/Cl 1rcQu1Y88JzvpeF9KfQjGn9Y29j3YjhqVxuECetDH9kuF/fk/RMg/u8j4BF8Qf7jU9NJ 2mBvSb20z6yprHbWOuLfafPaoldrPYZh2AOswYa/6LU8xZ80SkbyTNw1J6Grs06I2BwT Oxeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888207; x=1707493007; 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=ZWs5NQ83i9qIQWdiDsw7uY28XWqWXL7f3H4Vv5HjyFk=; b=k1OfqBbpAzmFFyg4K3SFjesbjC/mHQL2ta078S0EHWL/5On+PEgnhgSoIrw6r88JRw xYTa+SYaJT6NhtiuTxx3RvNJ16sTuBsunuxEJfx+BZCFWaXP0YwqgegFao18wlg/zWsh rg5gNZmLMGFuxnGZrN78pLfOD3mze5+Q9zPptwvuFJz8rCdY8B1Ag9p3rICcXrxUuLR2 eDzCk6VWVYqfW0zBLhZ8gYTdjyqofKXC/ui+m3R4fupwj/3e+xYd+vuceM++RwtQBdrB fuBIbNQnNKOUvuCsbGnwrpG9RRwgsptWi0Gka9oBkXnVtV2ihKy9bCPI4WyeB1C9lccz lbMA== X-Gm-Message-State: AOJu0YzQoF6vjccjIgDEU2p8cNqdxdKyomFyR1xAz4I8TmHJk2jeLvhO KySkdZbzvcDD8w2ky31Khb+sXKY1stcUg3ZL1jhD4X+b5dW10mNBhx/9q9GZct+ldhuPL5mPWjv V X-Google-Smtp-Source: AGHT+IHYqN0mgP1AKwNRqrle4dSLA2BlefKdWaul/a4T3jBkJGdElOV+nuNrbS+ES44Jr+iPySCIqg== X-Received: by 2002:a05:600c:4f0f:b0:40f:bde5:763e with SMTP id l15-20020a05600c4f0f00b0040fbde5763emr3450154wmq.32.1706888207230; Fri, 02 Feb 2024 07:36:47 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/36] hw/arm/musca: Simplify setting MachineClass::valid_cpu_types[] Date: Fri, 2 Feb 2024 15:36:19 +0000 Message-Id: <20240202153637.3710444-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888323953100035 From: Philippe Mathieu-Daud=C3=A9 Musca boards use the embedded subsystems (SSE) tied to a specific Cortex core. Our models only use the Cortex-M33. Use the common code introduced in commit c9cf636d48 ("machine: Add a valid_cpu_types property") to check for valid CPU type at the board level. Remove the now unused MachineClass::default_cpu_type field. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20240129151828.59544-7-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/arm/musca.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/arm/musca.c b/hw/arm/musca.c index 770ec1a15ca..e2c9d49af58 100644 --- a/hw/arm/musca.c +++ b/hw/arm/musca.c @@ -605,7 +605,6 @@ static void musca_class_init(ObjectClass *oc, void *dat= a) mc->default_cpus =3D 2; mc->min_cpus =3D mc->default_cpus; mc->max_cpus =3D mc->default_cpus; - mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-m33"); mc->valid_cpu_types =3D valid_cpu_types; mc->init =3D musca_init; } --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888245; cv=none; d=zohomail.com; s=zohoarc; b=JXpXPf53oyaAy8MEgdMvECdr/zCVnKOWBbsk4ySID+yp8gp42mFBjLEDgUEJdFxrl0NoNBexq+07VZdnPnrPcF300JZoqqURS2pH85XCtiu2BG6xVcigRZtdUBoCB+xr/lXo6Gj1g2F1yysHnSWx1XxWlNcyE46iVw827a1Dzvs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888245; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=EKrB2domJrpD/QjC1zd65Q0KKvruCC/azVIk/m6fgxM=; b=GtinZjuj2EL16unM0UXO6V94Gtxf7JnrTvxz4jWRcsh+AzkaKxtouKt2vbuwOFUAj04GaRGDekUEQ7t7lrKJg/MTZhofChXgtZwUCErqq11/xYlRiED00QqRGgGoL+8A39xKJ7Xm760/R2s46vo0OGF639AzL8tUDDKjez6YY38= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888245156460.7746607023404; Fri, 2 Feb 2024 07:37:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb4-0000L8-H2; Fri, 02 Feb 2024 10:36:54 -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 1rVvb1-0000K8-KL for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:51 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvaz-0004Tu-96 for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:51 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40e8d3b29f2so18559465e9.1 for ; Fri, 02 Feb 2024 07:36:48 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888207; x=1707493007; 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=EKrB2domJrpD/QjC1zd65Q0KKvruCC/azVIk/m6fgxM=; b=mJCr46VP4EZmKK7aeFN3DBN/ptheCsAv3c1dP6OGUw6ZOUbfZKauUYcq0W8XkjUtEz FJUH7zRV4UhS+OJvOtY8k8AXJOhptnREcKWtfuHcOmEJtm2HOvHeOuPEgu1RBpe/sxmR /pgeBfv2wM/vWikawAusjR0KwLPzZEbe8wpUp/C0vhRxVPMXrnzbwrXwcUUIzDjRkQSZ IupqhE0Bo9RhfUE6yRbNFXbqrNZmkSFTnj6COXutzY9be84NBkGBwmyUVqBJGH/4c2Hi XlfAaeLNhB7Vb0AIz3xSAbU16Wz+xaPR97w02UvDfrTwD61sfPVBwLmfI1vcDMX/F0TL 4Wuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888207; x=1707493007; 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=EKrB2domJrpD/QjC1zd65Q0KKvruCC/azVIk/m6fgxM=; b=o1i4r7geRqNGwCsBIpXjsImbP3hVNikWRP/JySW3ZfFXuqGiQkBgi0eRPZjHM+QHuo M0jZsbfFvTetYdj6SFc/Rh0DXt3QNH8mF1JNmgInFuONGRsLgJE0amC7XrjZFDLUOv8p Vs4vQbW1mrar/BnV80FdPMU0m4QFKzhLob4r8/ypDIlFc+Yunh81xnDNvK8s/8b/Bi5O 9J0r+ts2vdG889AAUF8i9AGG5vN71lMsaXsHtRbQCFImfKjEsgrtPHvuCA9c7zRIMFlO oFdKYwANZNRmU8RnvdFZTqimvSozYKpl8z/sEknC4HDWFOuLZ/v5iM9ydVU2bC8FW10b GMGg== X-Gm-Message-State: AOJu0YwQlsxz1/+sTDn30YH4+fnlD6EZUtjTzvQZ4Ksm3W17m98UJLHb NCF0n22Ee8eKisMSbxn284Swi5T9bikDbyL5QD08VVRX9JKXkRVky/GxwAN0eayON0WXUtfCn40 Q X-Google-Smtp-Source: AGHT+IFP8/fGVpLiDR55y8J7sNKtTKDy+3CAaMD7nEbFOnrwAkwfuMTYH0A7yRG0SmxuwZe4FKXcfQ== X-Received: by 2002:a05:600c:1c99:b0:40f:afb9:ca10 with SMTP id k25-20020a05600c1c9900b0040fafb9ca10mr4114894wms.1.1706888207623; Fri, 02 Feb 2024 07:36:47 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/36] hw/arm/npcm7xx_boards: Simplify setting MachineClass::valid_cpu_types[] Date: Fri, 2 Feb 2024 15:36:20 +0000 Message-Id: <20240202153637.3710444-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888245489100001 From: Philippe Mathieu-Daud=C3=A9 The npcm7xx Soc is created with a Cortex-A9 core, see in hw/arm/npcm7xx.c: static void npcm7xx_init(Object *obj) { NPCM7xxState *s =3D NPCM7XX(obj); for (int i =3D 0; i < NPCM7XX_MAX_NUM_CPUS; i++) { object_initialize_child(obj, "cpu[*]", &s->cpu[i], ARM_CPU_TYPE_NAME("cortex-a9")); } The MachineClass::default_cpu_type field is ignored: delete it. Use the common code introduced in commit c9cf636d48 ("machine: Add a valid_cpu_types property") to check for valid CPU type at the board level. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20240129151828.59544-8-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/arm/npcm7xx_boards.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index 2999b8b96d0..e229efb4472 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -465,7 +465,6 @@ static void npcm7xx_machine_class_init(ObjectClass *oc,= void *data) mc->no_cdrom =3D 1; mc->no_parallel =3D 1; mc->default_ram_id =3D "ram"; - mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a9"); mc->valid_cpu_types =3D valid_cpu_types; } =20 --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888258; cv=none; d=zohomail.com; s=zohoarc; b=ORYTpfbGB5BScQDss2xG7mYQFQbEveSzmj5ecIBssuG1CKU4sPptSKlfX0fh9AKcgo+XRtKyN5A0koVYju03FEy9wiZ/6G7Q6PdI+ZO1cuhlMWVW9zWOLb22O/nTlBr/bq5O0O86pk5MzNlyxw4BqDPzO6OC3SoV4AeiklI2OvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888258; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=5StY4SEF1HqNavbZgDZFaGtFNMi7VFPlW6TJWe8PFDk=; b=Ki83qZr781bRuNR7zMX5dbcugQamn4Gw4knhNSI3BSPWbe2/iJ4xbuTEzVo+JfIxtnyHNuST0ltvZ1AFjub2AmAInWQmQMGUgDOix+n9g1We5SgwFqJirxuID1xC1jG14X+6OuKW4A7TO++MljKCWvBaktIE8pxl5oGX6udrISM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888258502233.995085076308; Fri, 2 Feb 2024 07:37:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb4-0000L6-Gb; Fri, 02 Feb 2024 10:36:54 -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 1rVvb1-0000KA-M1 for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:51 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvaz-0004Tx-CE for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:51 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40e8fec0968so20019535e9.1 for ; Fri, 02 Feb 2024 07:36:48 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888208; x=1707493008; 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=5StY4SEF1HqNavbZgDZFaGtFNMi7VFPlW6TJWe8PFDk=; b=AN3R/cLWeUNdW6G5mioLSQQWObYdw2Ic6Rpe29zIXZNHmIQp++zbGBtf/gXC/gtb2x ZV9ldLT+3PGyB1di5HtBUAfz3tM8qOyD0r4Mi7S/6zzolw60yZVf0xUvJzWWQh+UsNO4 N0dTscO6irzuI5B8AVGBZSJJUAUHSA96vM4fUVsQwFEEsFZmyXwSSJFfbpyOgR+agYBV M2JZFDXX5vp/Kjs1L60QnwHZ/ztIEGLfGNUB2BxwogFBiuXmjDT2KqWi+J76ESLpeHvv sbqlId2pwI8xHvPCdEGDtbLCZX+wXEHKyk/mqu7foksFdHByozn43txfCprFrwRSEaHB n+AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888208; x=1707493008; 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=5StY4SEF1HqNavbZgDZFaGtFNMi7VFPlW6TJWe8PFDk=; b=aJeatF2/UUlx/0xF8G/dzdPa2Lq7zuzDkPAdlWXXS1suBkY2EwXQo6KEBaHSCToLc6 Zty72gQFvI7KxhalIZQo2LiaTxlAofZYlZ2ZfsOkXYnv0fKBwkodKRsARyR9d0S+u94z VoB8wDTOFIQvPiyJBaXPBdjNYXRpCAtkc/JLsb9A2JPuyHm7Kii5tGgVsptU3+CrjFvc vjR4qp0Iz60sAKkt9VFxoISlhc86+VHVRwfhPT+3easfQVQu41BddokRbwY7EWSukq0K kAvyxbh3/z6ASlQMlxBH2LIBTlL5vaHIXXctknzVi66uYKdTl2fJiIJBrfpL6+E5eNGv G6PA== X-Gm-Message-State: AOJu0YwNTCQdllQ4prujMjiKhB9eLEOfyxkbMg4I8tbjTaWxIar0xskY 02x7mJVPPMAmJAtgtiKtqFU6N8hdg7X/HN+iWNw+UT+A243DFnW+zoat3v+C03jQKkV5sgUhz5i b X-Google-Smtp-Source: AGHT+IFRU0u0rGkIS8w66XSJYn1PYq2UtZX64tyTkgSmZprxlX7nPG2MwbWVVnCpEECGT++Uscq3ZA== X-Received: by 2002:a05:600c:3c88:b0:40e:fce3:3daf with SMTP id bg8-20020a05600c3c8800b0040efce33dafmr6802597wmb.19.1706888207980; Fri, 02 Feb 2024 07:36:47 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/36] hw/arm/vexpress: Check for CPU types in machine_run_board_init() Date: Fri, 2 Feb 2024 15:36:21 +0000 Message-Id: <20240202153637.3710444-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888259803100008 From: Philippe Mathieu-Daud=C3=A9 Leverage the common code introduced in commit c9cf636d48 ("machine: Add a valid_cpu_types property") to check for the single valid CPU type. Remove the now unused MachineClass::default_cpu_type field. Reviewed-by: Richard Henderson Reviewed-by: Gavin Shan Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20240129151828.59544-9-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/arm/vexpress.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index f1b45245d5d..1a14c1933e9 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -783,22 +783,30 @@ static void vexpress_class_init(ObjectClass *oc, void= *data) =20 static void vexpress_a9_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-a9"), + NULL + }; MachineClass *mc =3D MACHINE_CLASS(oc); VexpressMachineClass *vmc =3D VEXPRESS_MACHINE_CLASS(oc); =20 mc->desc =3D "ARM Versatile Express for Cortex-A9"; - mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a9"); + mc->valid_cpu_types =3D valid_cpu_types; =20 vmc->daughterboard =3D &a9_daughterboard; } =20 static void vexpress_a15_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-a15"), + NULL + }; MachineClass *mc =3D MACHINE_CLASS(oc); VexpressMachineClass *vmc =3D VEXPRESS_MACHINE_CLASS(oc); =20 mc->desc =3D "ARM Versatile Express for Cortex-A15"; - mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a15"); + mc->valid_cpu_types =3D valid_cpu_types; =20 vmc->daughterboard =3D &a15_daughterboard; =20 --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888319; cv=none; d=zohomail.com; s=zohoarc; b=eq/axEWgVngZW5B2oGxpFaka7rHb6Xk5H/U6VcSc6A0x4QEsHuwIT1qg+MFeeLv3BYEl8DimMJ+zvGFYkrHfKk8s81hThnq8DxzxSPDdlER4wOxObnbj9E2D36V2dl1VkziJjPTfv2uzcYb3cqaQZw/377FWpjrXVlYqtSmCDVY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888319; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=jj7yEf/jq38/qH2Zq0rzNEWtL5ZZjFFsH6Lpx3bxpek=; b=cc0wwn9KnIrgrMZizQK/w64W+zZWxoj1EGR3zYyeiXL6MLJW8vY8YfRi3xOmlJD6GEbUnOvjXfbfMKkYNsHj8gxFimwY/+wPvwbsph72VaAt5bZUYtk3JTqNziFOWvyo1uoTjYy2gnhYHX5gYwmDK/bIbu0XaZNmrkqZINVh45Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888319113744.742867340535; Fri, 2 Feb 2024 07:38:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb5-0000Ne-SO; Fri, 02 Feb 2024 10:36:55 -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 1rVvb2-0000Ki-9H for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:52 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb0-0004U8-0x for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:51 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40fcb6ebe24so2834195e9.0 for ; Fri, 02 Feb 2024 07:36:49 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888208; x=1707493008; 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=jj7yEf/jq38/qH2Zq0rzNEWtL5ZZjFFsH6Lpx3bxpek=; b=nZqv9uTCEnwzlMEPDdDaXXH101OjPynvx267T6CZ83r3icjppsH5p+6gKWmWmkwefy Ad/RmRCpCJLmnzXN/+ArC2BdXb32qqyXjZ/KZbVYE3zd/cirq+wcGRxoq7zZu1ONU5gt Iz3irEh9SX67zKPdLK6/ttom7j8VjWbXKCNWUeuPFtqd17SdSUhAMVrOzhpskhBjLeQM MQ4fYw/piPQEK0PClTIM9xd55P2bnzvS7fVefh9Byp1kh/dycReaC2Xcl2hYf5ENRspV imxrpCeCus4s6wl5tm0qq/Gf69Kn6sog3LDRnubW0kg3KgMFroAGGuzTcbi3g9Z0rYy5 cJ2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888208; x=1707493008; 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=jj7yEf/jq38/qH2Zq0rzNEWtL5ZZjFFsH6Lpx3bxpek=; b=XTJoPIt4XgrhcvRd44rEFsJMwyYrUQW47Y3JwPkCLMM5KVXD0TcmzXaP9U6FUEcn61 Ru480OBfeJiT3vvN6P6FgMIeNCzF8c2UG9Kvj60Ps1HYelXaO+YPHW+xIfCY/Awl/KlH zHW9iIXh2/G8VVQI1QMHQBRzhrBkwleJoh+EiRHOpBiV2ARa82ZCqCf2uyaBMjZ8/Pci t8tCsqs9jvV/kuFyxLT0ACzXK67VnZ7WfC1Dg23FvsNCUo16ImXLq7TeeiV0tm6hbN0k Krt8RWuFW+h2MjTQgoDC7hOaC3LN66mYskkXMKU4VcL7qoSysIGp5Dow4dRtt/ShpH4k sE7A== X-Gm-Message-State: AOJu0Yz/ToIg5tDqCyZZi/JSkgLbwfCLUDW6496Qz/facFxNZW1Hko/A bjT+iKWIsziOUfk6Vn6U7m0x9wVZxnvvyHNSb5NRYSgw1vkiTB2Hzyi04GlhBwxHwamqcp8X6Ry E X-Google-Smtp-Source: AGHT+IFxg5kW0RSP+MWlEbr/HQpDhGPLMlQ16KyNGN2nxCaRhEqBj518ti/FcL6pq0bGufBUO14dhA== X-Received: by 2002:a05:600c:19c9:b0:40e:a0a3:f358 with SMTP id u9-20020a05600c19c900b0040ea0a3f358mr6149061wmq.22.1706888208356; Fri, 02 Feb 2024 07:36:48 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/36] hw/arm/zynq: Check for CPU types in machine_run_board_init() Date: Fri, 2 Feb 2024 15:36:22 +0000 Message-Id: <20240202153637.3710444-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888319933100029 From: Philippe Mathieu-Daud=C3=A9 Leverage the common code introduced in commit c9cf636d48 ("machine: Add a valid_cpu_types property") to check for the single valid CPU type. Remove the now unused MachineClass::default_cpu_type field. Reviewed-by: Richard Henderson Reviewed-by: Gavin Shan Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20240129151828.59544-10-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/arm/xilinx_zynq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index 66d0de139f2..c57bbccb70f 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -355,13 +355,17 @@ static void zynq_init(MachineState *machine) =20 static void zynq_machine_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-a9"), + NULL + }; MachineClass *mc =3D MACHINE_CLASS(oc); mc->desc =3D "Xilinx Zynq Platform Baseboard for Cortex-A9"; mc->init =3D zynq_init; mc->max_cpus =3D 1; mc->no_sdcard =3D 1; mc->ignore_memory_transaction_failures =3D true; - mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a9"); + mc->valid_cpu_types =3D valid_cpu_types; mc->default_ram_id =3D "zynq.ext_ram"; } =20 --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888368; cv=none; d=zohomail.com; s=zohoarc; b=MX0iAWYN76p1A8zvIWaqwvTlbtSnqEgQHGqVLnWXw9+0gH4yP082nm5LF4sPo5yVgJTPkuwaZ6GBqTbIU6sEhYAw4k+eIdbQLrhvR60W2W2pTPbodVWrpAT6CcbyNL6BfIEvKxOCOVYD09k7icmn0hjYG3DIHtPk2AW7LMAp9aU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888368; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=7kvYGJv6Vs1OqeEsvp2TCyEKspSHCOA1Tp8iJFztpkE=; b=KgOuAmMLZXkPfVK4GAKg8KnbnnXCenFvj4BpTCSjVR6kvrxNNIH0+dJOT64ZXcj6C/w03/BF4RWtW1PznvuwJSnl8WEbj+ViJPoNk0IlZ6eR3/ui5UOdyOrj2kmCPc2/M7O85DIrCEaXsM5wudeyn+bF6qJRvSkQpmCesYI+Xv4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888368849741.881943612967; Fri, 2 Feb 2024 07:39:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb6-0000Nk-G0; Fri, 02 Feb 2024 10:36:56 -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 1rVvb2-0000Kq-Nn for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:52 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb0-0004UG-5W for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:52 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40fc52c2ae4so8265555e9.3 for ; Fri, 02 Feb 2024 07:36:49 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888208; x=1707493008; 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=7kvYGJv6Vs1OqeEsvp2TCyEKspSHCOA1Tp8iJFztpkE=; b=rKo9NUzqs00wPWGkjQWt7Ot2zplIsNVBU/S3u7iJop1OLAygx3f+YrzjuADIGkuxHu TfixQkK/3jRN2hwfPmGIovQZnWlOMw2Pk/abqan1Kqrt84Lsc7cHYchwQv9F7YNzxM1n JbumORK55E6p+WHxBKABvFV650KzILXqwlVpCjIF1zde+yp3Rlf3wmII2FlKdDy7D3L4 a23Pm6DFn/40M+NG1jHqiizAr0CGm0uSBLMNak8PJw3AFdATF9VkXN+VMHq74aZdyFmv Ex0NYZF2dW+AGJHilvKxaGa8FW6VN0kG+euVaGWH3kQ4uarAOBOiUSKu9k/8SdFP4Mru 1l0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888208; x=1707493008; 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=7kvYGJv6Vs1OqeEsvp2TCyEKspSHCOA1Tp8iJFztpkE=; b=NTZ6nrYw4RfK6xYTq8ORyxA7RrkUROj21MR2357rwfnOfncuN6IxG7Vu1c+Cfc6Q+C Fj2qsdWLCpqH651rU/GQPpDrOyr/9vaedlRp0Qmd7vOTVSyZ+6+PJx7lI8dbMw61EZWe 5NJd4VU+kL+2sTXDx04z9fPm5L3TTGjNQVIAstqGHeiVwY4+kmAs2/JUBun6a23gM2BS OGWgbvMqg1tVxUxu2Vy5A7pHP9EjQDJPjBkfL8RsFWyYZbiLxyRD2XYDFzalpa2kn7Xw q7foKxvbWOmfCfb776EJb9F1yNgw3yzB1pqRtCh86fvhCjyVwJwICrPQayOF1k8uvPZ2 RMqQ== X-Gm-Message-State: AOJu0YztWqsbK6NNGkTKDwOlmDUKo2fJ3D+Ji4hn7Gru3DjzzGxgSob0 HAx7a8lc9aGlhzRZYEMF+vytFzJas0/TDeojmJ0cmCyO9JKWSkH3BSxw9XsU5kgYQPdnaKPiA6d 4 X-Google-Smtp-Source: AGHT+IF+kuUqinnTX+VPiHPELLY45Jo1Wx0u8tyaSkKOQApr6A8cvDzthEMl9+JSzN/f2He9/jDDoA== X-Received: by 2002:a05:600c:3153:b0:40e:4f81:3f68 with SMTP id h19-20020a05600c315300b0040e4f813f68mr1791910wmo.16.1706888208769; Fri, 02 Feb 2024 07:36:48 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/36] pci-host: designware: Limit value range of iATU viewport register Date: Fri, 2 Feb 2024 15:36:23 +0000 Message-Id: <20240202153637.3710444-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888370304100001 Content-Type: text/plain; charset="utf-8" From: Guenter Roeck The latest version of qemu (v8.2.0-869-g7a1dc45af5) crashes when booting the mcimx7d-sabre emulation with Linux v5.11 and later. qemu-system-arm: ../system/memory.c:2750: memory_region_set_alias_offset: A= ssertion `mr->alias' failed. Problem is that the Designware PCIe emulation accepts the full value range for the iATU Viewport Register. However, both hardware and emulation only support four inbound and four outbound viewports. The Linux kernel determines the number of supported viewports by writing 0xff into the viewport register and reading the value back. The expected value when reading the register is the highest supported viewport index. Match that code by masking the supported viewport value range when the register is written. With this change, the Linux kernel reports imx6q-pcie 33800000.pcie: iATU: unroll F, 4 ob, 4 ib, align 0K, limit 4G as expected and supported. Fixes: d64e5eabc4c7 ("pci: Add support for Designware IP block") Cc: Andrey Smirnov Cc: Nikita Ostrenkov Signed-off-by: Guenter Roeck Message-id: 20240129060055.2616989-1-linux@roeck-us.net Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/pci-host/designware.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c index dd9e389c07b..c25d50f1c6b 100644 --- a/hw/pci-host/designware.c +++ b/hw/pci-host/designware.c @@ -340,6 +340,8 @@ static void designware_pcie_root_config_write(PCIDevice= *d, uint32_t address, break; =20 case DESIGNWARE_PCIE_ATU_VIEWPORT: + val &=3D DESIGNWARE_PCIE_ATU_REGION_INBOUND | + (DESIGNWARE_PCIE_NUM_VIEWPORTS - 1); root->atu_viewport =3D val; break; =20 --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888286; cv=none; d=zohomail.com; s=zohoarc; b=RjPMUOtYBPuRtC5j1aA04ve3CCMrinvdzGPgjOD58cl7YRAD739KZ4aXbVe+ahBr1CaBpvS83Y9Mp0BPMksuohGb+J5IT1k3VaWohwe6s3qD6XbCFnPJDQ6GaqvyE5IhfGzwQCZmEVMfP6BWUk9ZYbaSn24cD28tDTyQKYtGzJM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888286; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=I3JpUFeuz8JEq3ye2dfNhThlFiBiIs8gN5QDvvRsL0g=; b=AHTidaHTIyf4fazce8Ee27zaw468gEiySpJAf8DCgz+nMlkgInMR4ihTEtWB6lJLViNzSqzNA0LzC7pzx6KWymqiOkB6D3Y/xtNKMwaQ6VkYQiBGYlE8zs84Z/er4rQx1p6FHPfhZ+xKePYpFzjzMhMSd2NsTXTPqlbAHEkIZ1A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888286333742.7774761050588; Fri, 2 Feb 2024 07:38:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvbB-0000it-Cz; Fri, 02 Feb 2024 10:37:01 -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 1rVvb3-0000L1-CI for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:53 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb0-0004UZ-IJ for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:52 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40fc549ab9bso7537635e9.0 for ; Fri, 02 Feb 2024 07:36:50 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888209; x=1707493009; 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=I3JpUFeuz8JEq3ye2dfNhThlFiBiIs8gN5QDvvRsL0g=; b=yNXji4qhm1LYe/mx45v3f+8lbclOs/8GtxzTw3kGUrwI2zZdqDVbDr0V2ysr6NQWnt F+fQ9sSQEXrqNN6AgYICLai2lMI+ehcLsYHfLffJixza2TC64vFjm9gaFNB49uF1KNo9 a6tXkDLxlhefk0rDpl7J2QIlbRMW/Zj9dOZd/JY6Pb7afWV1+ixHTa+Goqj9XIGloFAf YE2P0HlscVCfHF/rdzBwRBjHZEDpqN7T+2xW550rmn3l1NW82ES6JrtZc+Wr9TUjIxj6 +2J967BPZ/oh+OJ5Xkpf5kbCF/f/Hc8IktqxAi0WRL3k4ehMAPwjEOcwu28es0pm054u g+HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888209; x=1707493009; 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=I3JpUFeuz8JEq3ye2dfNhThlFiBiIs8gN5QDvvRsL0g=; b=ECCQ+v1z6qInZne2SD/meu8U2DBAik799M+AxOKexXSCFYTyHc/ZEGpo9NqqUXwU0f TxHkRpFcJT8MCxiFzbVNEu5tYhGM7SSRuq8mmi0DzSNMSwG2JvARGY/DzI2zeqhbC3MD CIwd+B7QFDtoydU3MbTJDNWbDpV5mO2tYrRrD4K0QxOOfZjOMJu9IM0lD01jiGRmJKSp A0ddT5Aq8i9qTK7WsvTwLJ/hRjnJyQVTRQ0k66XqvDVFQhc67fFXXUcqJin/Fb3fAoIn Fx/1LQm5+9XhiQypnNpf6Z0JwBcdxlA+5PoaEQM3XPGzVroYzIWqoMY+mnxLa+9x9qpI e9uA== X-Gm-Message-State: AOJu0YztOvwu/2FxG9exCEOTW+HcPxSwDs7rNbtkYjr8coOkHhTcxAhI /sukfBsMFL8XFITQhyQA1I5BvxToSlair+wjmuc3/9HL1ZewQioCB/YRhkvLSLT+EwSgW3MyqvP + X-Google-Smtp-Source: AGHT+IHvijeREeWEfwB+wQk6zlSaRP9lSiacdiK9UNU9yVjX7IrcRZQDylI9zwfv1nq3G7xPTo7cLA== X-Received: by 2002:a05:600c:524e:b0:40e:f222:9e52 with SMTP id fc14-20020a05600c524e00b0040ef2229e52mr1677514wmb.40.1706888209179; Fri, 02 Feb 2024 07:36:49 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/36] hw/arm/strongarm.c: convert DPRINTF to trace events and guest errors Date: Fri, 2 Feb 2024 15:36:24 +0000 Message-Id: <20240202153637.3710444-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888287866100001 From: Manos Pitsidianakis Tracing DPRINTFs to stderr might not be desired. A developer that relies on trace events should be able to opt-in to each trace event and rely on QEMU's log redirection, instead of stderr by default. This commit converts DPRINTFs in this file that are used for tracing into trace events. DPRINTFs that report guest errors are logged with LOG_GUEST_ERROR.# Signed-off-by: Manos Pitsidianakis Reviewed-by: Alex Benn=C3=A9e Message-id: 39db71dd87bf2007cf7812f3d91dde53887f1f2f.1706544115.git.manos.p= itsidianakis@linaro.org Signed-off-by: Peter Maydell --- hw/arm/strongarm.c | 82 ++++++++++++++++++++++++++++----------------- hw/arm/trace-events | 3 ++ 2 files changed, 55 insertions(+), 30 deletions(-) diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c index 7fd99a0f144..823b4931b0a 100644 --- a/hw/arm/strongarm.c +++ b/hw/arm/strongarm.c @@ -46,8 +46,7 @@ #include "qemu/log.h" #include "qom/object.h" #include "target/arm/cpu-qom.h" - -//#define DEBUG +#include "trace.h" =20 /* TODO @@ -66,12 +65,6 @@ - Enhance UART with modem signals */ =20 -#ifdef DEBUG -# define DPRINTF(format, ...) printf(format , ## __VA_ARGS__) -#else -# define DPRINTF(format, ...) do { } while (0) -#endif - static struct { hwaddr io_base; int irq; @@ -151,8 +144,9 @@ static uint64_t strongarm_pic_mem_read(void *opaque, hw= addr offset, case ICPR: return s->pending; default: - printf("%s: Bad register offset 0x" HWADDR_FMT_plx "\n", - __func__, offset); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad register offset 0x"HWADDR_FMT_plx"\n", + __func__, offset); return 0; } } @@ -173,8 +167,9 @@ static void strongarm_pic_mem_write(void *opaque, hwadd= r offset, s->int_idle =3D (value & 1) ? 0 : ~0; break; default: - printf("%s: Bad register offset 0x" HWADDR_FMT_plx "\n", - __func__, offset); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad register offset 0x"HWADDR_FMT_plx"\n", + __func__, offset); break; } strongarm_pic_update(s); @@ -333,7 +328,9 @@ static uint64_t strongarm_rtc_read(void *opaque, hwaddr= addr, ((qemu_clock_get_ms(rtc_clock) - s->last_hz) << 15) / (1000 * ((s->rttr & 0xffff) + 1)); default: - printf("%s: Bad register 0x" HWADDR_FMT_plx "\n", __func__, addr); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad rtc register read 0x"HWADDR_FMT_plx"\n", + __func__, addr); return 0; } } @@ -375,7 +372,9 @@ static void strongarm_rtc_write(void *opaque, hwaddr ad= dr, break; =20 default: - printf("%s: Bad register 0x" HWADDR_FMT_plx "\n", __func__, addr); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad rtc register write 0x"HWADDR_FMT_plx"\n", + __func__, addr); } } =20 @@ -556,12 +555,12 @@ static uint64_t strongarm_gpio_read(void *opaque, hwa= ddr offset, =20 case GPSR: /* GPIO Pin-Output Set registers */ qemu_log_mask(LOG_GUEST_ERROR, - "strongarm GPIO: read from write only register GPSR\= n"); + "%s: read from write only register GPSR\n", __func__= ); return 0; =20 case GPCR: /* GPIO Pin-Output Clear registers */ qemu_log_mask(LOG_GUEST_ERROR, - "strongarm GPIO: read from write only register GPCR\= n"); + "%s: read from write only register GPCR\n", __func__= ); return 0; =20 case GRER: /* GPIO Rising-Edge Detect Enable registers */ @@ -581,7 +580,9 @@ static uint64_t strongarm_gpio_read(void *opaque, hwadd= r offset, return s->status; =20 default: - printf("%s: Bad offset 0x" HWADDR_FMT_plx "\n", __func__, offset); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad gpio read offset 0x"HWADDR_FMT_plx"\n", + __func__, offset); } =20 return 0; @@ -626,7 +627,9 @@ static void strongarm_gpio_write(void *opaque, hwaddr o= ffset, break; =20 default: - printf("%s: Bad offset 0x" HWADDR_FMT_plx "\n", __func__, offset); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad write offset 0x"HWADDR_FMT_plx"\n", + __func__, offset); } } =20 @@ -782,7 +785,9 @@ static uint64_t strongarm_ppc_read(void *opaque, hwaddr= offset, return s->ppfr | ~0x7f001; =20 default: - printf("%s: Bad offset 0x" HWADDR_FMT_plx "\n", __func__, offset); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad ppc read offset 0x"HWADDR_FMT_plx "\n", + __func__, offset); } =20 return 0; @@ -817,7 +822,9 @@ static void strongarm_ppc_write(void *opaque, hwaddr of= fset, break; =20 default: - printf("%s: Bad offset 0x" HWADDR_FMT_plx "\n", __func__, offset); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad ppc write offset 0x"HWADDR_FMT_plx"\n", + __func__, offset); } } =20 @@ -1029,8 +1036,13 @@ static void strongarm_uart_update_parameters(StrongA= RMUARTState *s) s->char_transmit_time =3D (NANOSECONDS_PER_SECOND / speed) * frame_si= ze; qemu_chr_fe_ioctl(&s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); =20 - DPRINTF(stderr, "%s speed=3D%d parity=3D%c data=3D%d stop=3D%d\n", s->= chr->label, - speed, parity, data_bits, stop_bits); + trace_strongarm_uart_update_parameters((s->chr.chr ? + s->chr.chr->label : "NULL") ?: + "NULL", + speed, + parity, + data_bits, + stop_bits); } =20 static void strongarm_uart_rx_to(void *opaque) @@ -1164,7 +1176,9 @@ static uint64_t strongarm_uart_read(void *opaque, hwa= ddr addr, return s->utsr1; =20 default: - printf("%s: Bad register 0x" HWADDR_FMT_plx "\n", __func__, addr); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad uart register read 0x"HWADDR_FMT_plx"\n", + __func__, addr); return 0; } } @@ -1221,7 +1235,9 @@ static void strongarm_uart_write(void *opaque, hwaddr= addr, break; =20 default: - printf("%s: Bad register 0x" HWADDR_FMT_plx "\n", __func__, addr); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad uart register write 0x"HWADDR_FMT_plx"\n", + __func__, addr); } } =20 @@ -1434,7 +1450,7 @@ static uint64_t strongarm_ssp_read(void *opaque, hwad= dr addr, return 0xffffffff; } if (s->rx_level < 1) { - printf("%s: SSP Rx Underrun\n", __func__); + trace_strongarm_ssp_read_underrun(); return 0xffffffff; } s->rx_level--; @@ -1443,7 +1459,9 @@ static uint64_t strongarm_ssp_read(void *opaque, hwad= dr addr, strongarm_ssp_fifo_update(s); return retval; default: - printf("%s: Bad register 0x" HWADDR_FMT_plx "\n", __func__, addr); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad ssp register read 0x"HWADDR_FMT_plx"\n", + __func__, addr); break; } return 0; @@ -1458,8 +1476,8 @@ static void strongarm_ssp_write(void *opaque, hwaddr = addr, case SSCR0: s->sscr[0] =3D value & 0xffbf; if ((s->sscr[0] & SSCR0_SSE) && SSCR0_DSS(value) < 4) { - printf("%s: Wrong data size: %i bits\n", __func__, - (int)SSCR0_DSS(value)); + qemu_log_mask(LOG_GUEST_ERROR, "%s: Wrong data size: %i bits\n= ", + __func__, (int)SSCR0_DSS(value)); } if (!(value & SSCR0_SSE)) { s->sssr =3D 0; @@ -1471,7 +1489,9 @@ static void strongarm_ssp_write(void *opaque, hwaddr = addr, case SSCR1: s->sscr[1] =3D value & 0x2f; if (value & SSCR1_LBM) { - printf("%s: Attempt to use SSP LBM mode\n", __func__); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Attempt to use SSP LBM mode\n", + __func__); } strongarm_ssp_fifo_update(s); break; @@ -1509,7 +1529,9 @@ static void strongarm_ssp_write(void *opaque, hwaddr = addr, break; =20 default: - printf("%s: Bad register 0x" HWADDR_FMT_plx "\n", __func__, addr); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad ssp register write 0x"HWADDR_FMT_plx"\n", + __func__, addr); break; } } diff --git a/hw/arm/trace-events b/hw/arm/trace-events index cdc1ea06a81..7c569432150 100644 --- a/hw/arm/trace-events +++ b/hw/arm/trace-events @@ -55,3 +55,6 @@ smmuv3_notify_flag_add(const char *iommu) "ADD SMMUNotifi= er node for iommu mr=3D%s smmuv3_notify_flag_del(const char *iommu) "DEL SMMUNotifier node for iommu= mr=3D%s" smmuv3_inv_notifiers_iova(const char *name, uint16_t asid, uint16_t vmid, = uint64_t iova, uint8_t tg, uint64_t num_pages) "iommu mr=3D%s asid=3D%d vmi= d=3D%d iova=3D0x%"PRIx64" tg=3D%d num_pages=3D0x%"PRIx64 =20 +# strongarm.c +strongarm_uart_update_parameters(const char *label, int speed, char parity= , int data_bits, int stop_bits) "%s speed=3D%d parity=3D%c data=3D%d stop= =3D%d" +strongarm_ssp_read_underrun(void) "SSP rx underrun" --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888371; cv=none; d=zohomail.com; s=zohoarc; b=fIZwJ0HwTn/A2CeNiM8KGGDKubjY7wfRMNREs47YXFEbRCnMgni/ntkIMWgSBQdzhyMwJ587Z5XQtt9BB1ew1FbdeZAOMp/umig7WUmOqcaGlMKa7M09xClpMsaX9Uc0PmKmjSvHtkfA9IOOhgEhYd90mqq7QbR0DT/s751H1xs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888371; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=0ckJcvEZZioCWfSyoKKpMeIjUpIBSh7xStPy/wW7duI=; b=YA67SIB4CYnfhdu0GIO3P0ImeZHAlSNZXTnGRbrHRUCwk5bsw8EGWz7aPNfdG2/jyBDAd27McVw57/jX72LYWG9aBIRoUzjaP9PHS0ZrKtaaXEAw3JyP5uJ4u8FcSTV84CDVxo+jl9vKR7GH6HCmgfwcaILFLNCtZqqR1GxuTJo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888371072296.11980222323234; Fri, 2 Feb 2024 07:39:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb6-0000Nj-Fl; Fri, 02 Feb 2024 10:36:56 -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 1rVvb3-0000L0-Bn for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:53 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb1-0004Vb-0k for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:52 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40ef64d8955so19935335e9.3 for ; Fri, 02 Feb 2024 07:36:50 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888209; x=1707493009; 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=0ckJcvEZZioCWfSyoKKpMeIjUpIBSh7xStPy/wW7duI=; b=K3/xOFgS7m2TX0kCCBQJ7EAfKIRUl6oZRxlCwIGps9nW34w6pWBvLl2euAj6ZPmSU3 ZPh6iLC7Ku383Jqs0BUdjTcIyjTspDaR2XOWERrP088pvTG+C8gGJ/2H6ZfxLgQ//1av lg/ENYj57fZdsqZujToAiEVsIkEu9JWrvTi2CkOR28unJUT92/i+ywBCs+/89DjFHaSn 4IEODlZX3QdkwqV03ukbhalfYRUQ5R7+GRX+ojVQ3YII+EeQT/eQ0XiiWwdW20kNypdu J4wu+UADBc83cAYFHb3x6LQMLZO7rYtSZrKDjvPEE6CXB0QfW+NMXdY/so4KRZjLAqgN UbTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888209; x=1707493009; 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=0ckJcvEZZioCWfSyoKKpMeIjUpIBSh7xStPy/wW7duI=; b=hoNzaokKff51zXcVDu0qh2eKbgj3dxIr6/Rd1thx2TT7zzvLFJYuW+tZvlKOcjDy1g RhZ4ovXYqqKELPA2tp0eZdsBllErZ3ZUmd5hWGlqxeBoINn8wSOXawwdzSbf2+LrHrbi bcUgkuSWTNhfazUiv/4AUMtRzRf1upPUXNAO1DGTqfU9sfADRxyj5nsXZHORgHDXi5vH XUQ9UN3tKatBeFEzFStxF42aCK7VpvK0lXJ2V/tg7lpTDf/Lmmr8gQsHoCsp00yfur2e QhuN7nVggDo6YMGgILBYLL1q3FinRuABMYxK8O67J96Bz/MDmR9kKMrmg7wfIrKgpnTy MF1Q== X-Gm-Message-State: AOJu0Yw5ogFTsu7W1efwhOerHIcks0IWbf2kHxrfP094KZQ/RQJjO0e4 vQl1rhC/S8DYAb6TwEsBMJA5gspfrQj1e8TeKNiIlkp3gN55tD8RjD3b1WSblCyCeaIa+vHghJL Z X-Google-Smtp-Source: AGHT+IEve3ErRb438/blgbLsuASqlGGbOAddwHvvWzX/ZxMXR2sOXKvI2DfFGfwVMUOFE8xGUn+Emw== X-Received: by 2002:a05:600c:3107:b0:40f:86:fea with SMTP id g7-20020a05600c310700b0040f00860feamr6376123wmo.13.1706888209632; Fri, 02 Feb 2024 07:36:49 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/36] hw/arm/z2: convert DPRINTF to trace events and guest errors Date: Fri, 2 Feb 2024 15:36:25 +0000 Message-Id: <20240202153637.3710444-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888372323100009 From: Manos Pitsidianakis Tracing DPRINTFs to stderr might not be desired. A developer that relies on trace events should be able to opt-in to each trace event and rely on QEMU's log redirection, instead of stderr by default. This commit converts DPRINTFs in this file that are used for tracing into trace events. DPRINTFs that report guest errors are logged with LOG_GUEST_ERROR. Signed-off-by: Manos Pitsidianakis Reviewed-by: Alex Benn=C3=A9e Message-id: 799c5141c5751cf2341e1d095349612e046424a8.1706544115.git.manos.p= itsidianakis@linaro.org Signed-off-by: Peter Maydell --- hw/arm/z2.c | 27 ++++++++------------------- hw/arm/trace-events | 7 +++++++ 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/hw/arm/z2.c b/hw/arm/z2.c index a67fba2cfd2..eb2ff8dbc84 100644 --- a/hw/arm/z2.c +++ b/hw/arm/z2.c @@ -27,13 +27,7 @@ #include "exec/address-spaces.h" #include "qom/object.h" #include "qapi/error.h" - -#ifdef DEBUG_Z2 -#define DPRINTF(fmt, ...) \ - printf(fmt, ## __VA_ARGS__) -#else -#define DPRINTF(fmt, ...) -#endif +#include "trace.h" =20 static const struct keymap map[0x100] =3D { [0 ... 0xff] =3D { -1, -1 }, @@ -119,6 +113,8 @@ static uint32_t zipit_lcd_transfer(SSIPeripheral *dev, = uint32_t value) { ZipitLCD *z =3D ZIPIT_LCD(dev); uint16_t val; + + trace_z2_lcd_reg_update(z->cur_reg, z->buf[0], z->buf[1], z->buf[2], v= alue); if (z->selected) { z->buf[z->pos] =3D value & 0xff; z->pos++; @@ -126,22 +122,19 @@ static uint32_t zipit_lcd_transfer(SSIPeripheral *dev= , uint32_t value) if (z->pos =3D=3D 3) { switch (z->buf[0]) { case 0x74: - DPRINTF("%s: reg: 0x%.2x\n", __func__, z->buf[2]); z->cur_reg =3D z->buf[2]; break; case 0x76: val =3D z->buf[1] << 8 | z->buf[2]; - DPRINTF("%s: value: 0x%.4x\n", __func__, val); if (z->cur_reg =3D=3D 0x22 && val =3D=3D 0x0000) { z->enabled =3D 1; - printf("%s: LCD enabled\n", __func__); + trace_z2_lcd_enable_disable_result("enabled"); } else if (z->cur_reg =3D=3D 0x10 && val =3D=3D 0x0000) { z->enabled =3D 0; - printf("%s: LCD disabled\n", __func__); + trace_z2_lcd_enable_disable_result("disabled"); } break; default: - DPRINTF("%s: unknown command!\n", __func__); break; } z->pos =3D 0; @@ -211,14 +204,12 @@ static int aer915_send(I2CSlave *i2c, uint8_t data) =20 s->buf[s->len] =3D data; if (s->len++ > 2) { - DPRINTF("%s: message too long (%i bytes)\n", - __func__, s->len); + trace_z2_aer915_send_too_long(s->len); return 1; } =20 if (s->len =3D=3D 2) { - DPRINTF("%s: reg %d value 0x%02x\n", __func__, - s->buf[0], s->buf[1]); + trace_z2_aer915_send(s->buf[0], s->buf[1]); } =20 return 0; @@ -228,14 +219,12 @@ static int aer915_event(I2CSlave *i2c, enum i2c_event= event) { AER915State *s =3D AER915(i2c); =20 + trace_z2_aer915_event(s->len, event); switch (event) { case I2C_START_SEND: s->len =3D 0; break; case I2C_START_RECV: - if (s->len !=3D 1) { - DPRINTF("%s: short message!?\n", __func__); - } break; case I2C_FINISH: break; diff --git a/hw/arm/trace-events b/hw/arm/trace-events index 7c569432150..0ff41e6c780 100644 --- a/hw/arm/trace-events +++ b/hw/arm/trace-events @@ -58,3 +58,10 @@ smmuv3_inv_notifiers_iova(const char *name, uint16_t asi= d, uint16_t vmid, uint64 # strongarm.c strongarm_uart_update_parameters(const char *label, int speed, char parity= , int data_bits, int stop_bits) "%s speed=3D%d parity=3D%c data=3D%d stop= =3D%d" strongarm_ssp_read_underrun(void) "SSP rx underrun" + +# z2.c +z2_lcd_reg_update(uint8_t cur, uint8_t i_0, uint8_t i_1, uint8_t i_2, uint= 32_t value) "cur_reg =3D 0x%x, buf =3D [0x%x, 0x%x, 0x%x], value =3D 0x%x" +z2_lcd_enable_disable_result(const char *result) "LCD %s" +z2_aer915_send_too_long(int8_t msg) "message too long (%i bytes)" +z2_aer915_send(uint8_t reg, uint8_t value) "reg %d value 0x%02x" +z2_aer915_event(int8_t event, int8_t len) "i2c event =3D0x%x len=3D%d byte= s" --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888310; cv=none; d=zohomail.com; s=zohoarc; b=acydCQr2SvTC1e4jnLbhAyzh83upBQPCHJVgyUoULgOASP4v7OK0sRwkTnYSjIXnLQV5c18JEHUGJ0APe3+ZG7nDkRqlkKCl9+PFw0bOsFgqo+rX+KBojtiNvCXzjyIe9vtA7a/4a39C12P82xtDRJYCAtDP2ttl9883cZE3RU8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888310; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=amHR5O3giydBqIG5HDDnvSZQyLiZ0je93DEkkg1t/tA=; b=OBy0wR+MdduFwhwYY8LLCFpEs2uk9tr0FQ6W7jZux8A0Tb7z9vZfGfukvb8hyUtQijXzvIcVMcVH8QfB3C2QQAfMd4Iznyl8ugQLPLF+N5vZLr1qKEL6zKVREEVjlE31iA6f5JnG1PF20AW4Qd7No3hy0v8rGtErv2ySuNnZxOc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888310762255.2381413760362; Fri, 2 Feb 2024 07:38:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvbB-0000iP-DF; Fri, 02 Feb 2024 10:37:01 -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 1rVvb5-0000NX-HA for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:55 -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 1rVvb1-0004WR-KD for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:55 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40e800461baso19228755e9.3 for ; Fri, 02 Feb 2024 07:36:51 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888210; x=1707493010; 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=amHR5O3giydBqIG5HDDnvSZQyLiZ0je93DEkkg1t/tA=; b=w8ju74AHvXW50ncEU+Cdawd3Yvn7JL/sTcsaoYjb+jIOAnxXNFuWejBR37BFhYDR4c 0gWo0LXPYp2nnJ5eYSz6anIqlH+0SW5O9LAe5uD++2M/L4WSjccQkPdQB87teKcEKFJI OKhjrGFj4tA4vRNK725+nuDfKn/xrwGdmXEqGrEaVQQJimRVhDrZudBxBB5yA7PM3m18 Th2BF4uBSr6shL8b98p9UIKVbhH8Dub2HYDlT9xJxF5Rg0BcR+Q8d1rEWztIA0X9JV6u tmx4ro9+0MMaZlcqEUIRO2MJuKJw1ZgfY2MrnyccNgt4174LWkLEPzHTnH+x+owQgoCV 2eUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888210; x=1707493010; 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=amHR5O3giydBqIG5HDDnvSZQyLiZ0je93DEkkg1t/tA=; b=l13rMCfZApHvCkILBwJ+nHJdfdEo71gSyPiTjz3/OMpcjV6vaZi/o1RDHASgKh+sRx dgcNtwEDmkUHgXPaPr9HIkGx0aC9lIpiXPOo6gPBRfi3m5YSfWc88QfZeOpNVMglGj+K dfAlIxxzes6ptVeDdgeBxo+Y6w2IW3AhWnWDe9vZ4lUAUMc84pEU+x87c881t6NJ7p0t 7JBFVscQgeJQmpQvoZPIBaUR0BEXoISbZzIz7POuEz+8k1iD/qVp4CEBmQYYwfjmU82J qItXRUu1DYQmmmnKetFt82En3S5l5VUNdSx3h6XF5RQcPSLvXjtDT51Nc0ckGRhAl0O+ zJug== X-Gm-Message-State: AOJu0Yz/4F1a8EMiFEzs6OMAG4unk8GTdGxTNrnq5T1ySs1Ag+5MlZFP KxP+Hu3JuS3EFz19T2GRvFYiDWBN7PiKnXXDyzWYI5rENlXl1Ah0eYOMODnL1EHvynLV0LAqYhU d X-Google-Smtp-Source: AGHT+IH7ytEEMSxthew7rK8gwnndRuqrW3Ez/AXnyQzL2TzsMcUq06kHyT0HOQUwcN65gnTcbTc2tA== X-Received: by 2002:a05:600c:3594:b0:40f:b691:d374 with SMTP id p20-20020a05600c359400b0040fb691d374mr5828583wmq.17.1706888210244; Fri, 02 Feb 2024 07:36:50 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/36] hw/arm/xen_arm.c: convert DPRINTF to trace events and error/warn reports Date: Fri, 2 Feb 2024 15:36:26 +0000 Message-Id: <20240202153637.3710444-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@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, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888312011100005 From: Manos Pitsidianakis Tracing DPRINTFs to stderr might not be desired. A developer that relies on trace events should be able to opt-in to each trace event and rely on QEMU's log redirection, instead of stderr by default. This commit converts DPRINTFs in this file that are used for tracing into trace events. Errors or warnings are converted to error_report and warn_report calls. Signed-off-by: Manos Pitsidianakis Reviewed-by: Alex Benn=C3=A9e Message-id: fe5e3bd54231abe933f95a24e0e88208cd8cfd8f.1706544115.git.manos.p= itsidianakis@linaro.org Signed-off-by: Peter Maydell --- hw/arm/xen_arm.c | 23 +++++++++++------------ hw/arm/trace-events | 5 +++++ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c index a5631529d09..32776d94dfe 100644 --- a/hw/arm/xen_arm.c +++ b/hw/arm/xen_arm.c @@ -34,6 +34,7 @@ #include "hw/xen/xen-hvm-common.h" #include "sysemu/tpm.h" #include "hw/xen/arch_hvm.h" +#include "trace.h" =20 #define TYPE_XEN_ARM MACHINE_TYPE_NAME("xenpvh") OBJECT_DECLARE_SIMPLE_TYPE(XenArmState, XEN_ARM) @@ -91,8 +92,9 @@ static void xen_create_virtio_mmio_devices(XenArmState *x= am) =20 sysbus_create_simple("virtio-mmio", base, irq); =20 - DPRINTF("Created virtio-mmio device %d: irq %d base 0x%lx\n", - i, GUEST_VIRTIO_MMIO_SPI_FIRST + i, base); + trace_xen_create_virtio_mmio_devices(i, + GUEST_VIRTIO_MMIO_SPI_FIRST += i, + base); } } =20 @@ -101,6 +103,7 @@ static void xen_init_ram(MachineState *machine) MemoryRegion *sysmem =3D get_system_memory(); ram_addr_t block_len, ram_size[GUEST_RAM_BANKS]; =20 + trace_xen_init_ram(machine->ram_size); if (machine->ram_size <=3D GUEST_RAM0_SIZE) { ram_size[0] =3D machine->ram_size; ram_size[1] =3D 0; @@ -117,15 +120,10 @@ static void xen_init_ram(MachineState *machine) memory_region_init_alias(&ram_lo, NULL, "xen.ram.lo", &ram_memory, GUEST_RAM0_BASE, ram_size[0]); memory_region_add_subregion(sysmem, GUEST_RAM0_BASE, &ram_lo); - DPRINTF("Initialized region xen.ram.lo: base 0x%llx size 0x%lx\n", - GUEST_RAM0_BASE, ram_size[0]); - if (ram_size[1] > 0) { memory_region_init_alias(&ram_hi, NULL, "xen.ram.hi", &ram_memory, GUEST_RAM1_BASE, ram_size[1]); memory_region_add_subregion(sysmem, GUEST_RAM1_BASE, &ram_hi); - DPRINTF("Initialized region xen.ram.hi: base 0x%llx size 0x%lx\n", - GUEST_RAM1_BASE, ram_size[1]); } } =20 @@ -158,7 +156,7 @@ static void xen_enable_tpm(XenArmState *xam) =20 TPMBackend *be =3D qemu_find_tpm_be("tpm0"); if (be =3D=3D NULL) { - DPRINTF("Couldn't fine the backend for tpm0\n"); + error_report("Couldn't find tmp0 backend"); return; } dev =3D qdev_new(TYPE_TPM_TIS_SYSBUS); @@ -168,7 +166,7 @@ static void xen_enable_tpm(XenArmState *xam) sysbus_realize_and_unref(busdev, &error_fatal); sysbus_mmio_map(busdev, 0, xam->cfg.tpm_base_addr); =20 - DPRINTF("Connected tpmdev at address 0x%lx\n", xam->cfg.tpm_base_addr); + trace_xen_enable_tpm(xam->cfg.tpm_base_addr); } #endif =20 @@ -179,8 +177,9 @@ static void xen_arm_init(MachineState *machine) xam->state =3D g_new0(XenIOState, 1); =20 if (machine->ram_size =3D=3D 0) { - DPRINTF("ram_size not specified. QEMU machine started without IORE= Q" - "(no emulated devices including Virtio)\n"); + warn_report("%s non-zero ram size not specified. QEMU machine star= ted" + " without IOREQ (no emulated devices including virtio)= ", + MACHINE_CLASS(object_get_class(OBJECT(machine)))->desc= ); return; } =20 @@ -194,7 +193,7 @@ static void xen_arm_init(MachineState *machine) if (xam->cfg.tpm_base_addr) { xen_enable_tpm(xam); } else { - DPRINTF("tpm-base-addr is not provided. TPM will not be enabled\n"= ); + warn_report("tpm-base-addr is not provided. TPM will not be enable= d"); } #endif } diff --git a/hw/arm/trace-events b/hw/arm/trace-events index 0ff41e6c780..fd0d92762e4 100644 --- a/hw/arm/trace-events +++ b/hw/arm/trace-events @@ -65,3 +65,8 @@ z2_lcd_enable_disable_result(const char *result) "LCD %s" z2_aer915_send_too_long(int8_t msg) "message too long (%i bytes)" z2_aer915_send(uint8_t reg, uint8_t value) "reg %d value 0x%02x" z2_aer915_event(int8_t event, int8_t len) "i2c event =3D0x%x len=3D%d byte= s" + +# xen_arm.c +xen_create_virtio_mmio_devices(int i, int irq, uint64_t base) "Created vir= tio-mmio device %d: irq %d base 0x%"PRIx64 +xen_init_ram(uint64_t machine_ram_size) "Initialized xen ram with size 0x%= "PRIx64 +xen_enable_tpm(uint64_t addr) "Connected tpmdev at address 0x%"PRIx64 --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888379; cv=none; d=zohomail.com; s=zohoarc; b=KSvtnsgYujqJaXBlPjt5KsIQm621cyU36auaGJme2bHoSmwLvvbZJepPQEhOd5n+fbN6cSt0AXHXWHVQ3p5djMdYeV2H9UOiVARciguMnATXdImqHrB+1NYSrFKq8895GGklyTgZWqvMiVr6elqKgCQ+HEkfzjYuksasBXMltUY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888379; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=w0fahzk6p7Uj8He02ARe/ArkwaOEVmzA6eqTYfNKviw=; b=Ksxi3aovN42WT1fBa6xIjnNF0ynmNsnU+Z6DMSJaNigD/2qZZfTCrWw6IQDKGD1m38LkPYR/T4fC9hI7iJyXXYYKCq5HJNZCHkOrbrYNxcWD1tjeDKQrOAnNVtfGvGPHOq/D3ZgYVg9xfUrbyBzcUG/nX6pO/1HMivx4+5qCRys= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888379642233.3011062063008; Fri, 2 Feb 2024 07:39:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb6-0000Nh-7I; Fri, 02 Feb 2024 10:36:56 -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 1rVvb4-0000Mf-JS for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:54 -0500 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb2-0004Wr-Eu for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:54 -0500 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2d07d74be60so19392301fa.3 for ; Fri, 02 Feb 2024 07:36:52 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888211; x=1707493011; 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=w0fahzk6p7Uj8He02ARe/ArkwaOEVmzA6eqTYfNKviw=; b=Wnu6+r8GvE5IDJ53s2pb5aC7dR5eqXIG5/abg6yoqM5Qk03hFwGRI7XRwi0XVND8NK 3iStqFR95a00qB1jPV4bV3hHWJ37tl5HzAj/BdXd6mHpr3w2e0fUZnAK65Zd4lktP9sm kfnKirE6FLNm40w7IiKfRXIDctJoMeAMCYgtyHXtMxTiV7wpI26yZj8PiHeks4ZJmneD Uip10XVjMcUm6zwpi+2A3aP2RvRgohxxkToaVAhn97YY6D42ori0XgFBK4OGK/X3Ba4y rLUvB6h2IwUW8DVqVlJlGvoXZJK/+48xpaxObTc93AYsLW71pDmcTogq/BIZFygezkZR iveA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888211; x=1707493011; 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=w0fahzk6p7Uj8He02ARe/ArkwaOEVmzA6eqTYfNKviw=; b=LMF9s0v8H39A78xDT+cJKaEHbQW5Jk2kJX8FZZXfWEguWuundgAEjZXPYfReB20TiL psBcZeMNXQwcrEqXE9gebukR9+jXlWSuzySiEMgd/l4qMYxCCAKzPI9Y9qkiMAqKMRi8 U5Mxu8nWKFoTDe0s+U5GcEn95PR8JHoc8NNqcVqn0yh3Ss+54OzwlRfbf0LgjJzokhex wWJ3b1OsLow8RHblrlYwKQYHKZ4GkorM2HU6j9trVjvnTODZslaR8YUUqSb2l3/4HRYP GbcJydccIN8eF5s0mYgAsHVh7HrlBK14yIsKm4lsJIHiy5rp13FXTXeh1kSCj0kz18VS e8IA== X-Gm-Message-State: AOJu0YwiBJuZyT4K/9IvoUZP3vEWYtgsentYOmH6FlKIu2S0bBLN7mX/ +jgk90gprPUEHaMNCKV4wQYjeA9IEqzEP0jQbOu+FGSZ12Vu/4AichAE1YCQBX6bhziXumNh1JA M X-Google-Smtp-Source: AGHT+IGT17CBaIEaX3yRzq7jGWA6DoOCrslONo1XwrI7bYvL93AHgRGZGREqgmRf0KJuArfofAqL3Q== X-Received: by 2002:ac2:4549:0:b0:511:34ff:2bb6 with SMTP id j9-20020ac24549000000b0051134ff2bb6mr1293871lfm.41.1706888210700; Fri, 02 Feb 2024 07:36:50 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 26/36] hw/xen/xen-mapcache.c: convert DPRINTF to tracepoints Date: Fri, 2 Feb 2024 15:36:27 +0000 Message-Id: <20240202153637.3710444-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x231.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888380416100001 From: Manos Pitsidianakis Tracing DPRINTFs to stderr might not be desired. A developer that relies on tracepoints should be able to opt-in to each tracepoint and rely on QEMU's log redirection, instead of stderr by default. This commit converts DPRINTFs in this file that are used for tracing into tracepoints. Signed-off-by: Manos Pitsidianakis Reviewed-by: Alex Benn=C3=A9e Message-id: 2fbe1fbc59078e384761c932e97cfa4276a53d75.1706544115.git.manos.p= itsidianakis@linaro.org Signed-off-by: Peter Maydell --- hw/xen/xen-mapcache.c | 54 +++++++++++++++++++------------------------ hw/xen/trace-events | 11 +++++++++ 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c index f7d974677d1..336c2123767 100644 --- a/hw/xen/xen-mapcache.c +++ b/hw/xen/xen-mapcache.c @@ -22,16 +22,6 @@ #include "trace.h" =20 =20 -//#define MAPCACHE_DEBUG - -#ifdef MAPCACHE_DEBUG -# define DPRINTF(fmt, ...) do { \ - fprintf(stderr, "xen_mapcache: " fmt, ## __VA_ARGS__); \ -} while (0) -#else -# define DPRINTF(fmt, ...) do { } while (0) -#endif - #if HOST_LONG_BITS =3D=3D 32 # define MCACHE_BUCKET_SHIFT 16 # define MCACHE_MAX_SIZE (1UL<<31) /* 2GB Cap */ @@ -145,8 +135,7 @@ void xen_map_cache_init(phys_offset_to_gaddr_t f, void = *opaque) =20 size =3D mapcache->nr_buckets * sizeof (MapCacheEntry); size =3D (size + XC_PAGE_SIZE - 1) & ~(XC_PAGE_SIZE - 1); - DPRINTF("%s, nr_buckets =3D %lx size %lu\n", __func__, - mapcache->nr_buckets, size); + trace_xen_map_cache_init(mapcache->nr_buckets, size); mapcache->entry =3D g_malloc0(size); } =20 @@ -286,7 +275,9 @@ tryagain: test_bits(address_offset >> XC_PAGE_SHIFT, test_bit_size >> XC_PAGE_SHIFT, mapcache->last_entry->valid_mapping)) { - trace_xen_map_cache_return(mapcache->last_entry->vaddr_base + addr= ess_offset); + trace_xen_map_cache_return( + mapcache->last_entry->vaddr_base + address_offset + ); return mapcache->last_entry->vaddr_base + address_offset; } =20 @@ -368,7 +359,9 @@ tryagain: QTAILQ_INSERT_HEAD(&mapcache->locked_entries, reventry, next); } =20 - trace_xen_map_cache_return(mapcache->last_entry->vaddr_base + address_= offset); + trace_xen_map_cache_return( + mapcache->last_entry->vaddr_base + address_offset + ); return mapcache->last_entry->vaddr_base + address_offset; } =20 @@ -402,10 +395,10 @@ ram_addr_t xen_ram_addr_from_mapcache(void *ptr) } } if (!found) { - fprintf(stderr, "%s, could not find %p\n", __func__, ptr); + trace_xen_ram_addr_from_mapcache_not_found(ptr); QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) { - DPRINTF(" "HWADDR_FMT_plx" -> %p is present\n", reventry->pa= ddr_index, - reventry->vaddr_req); + trace_xen_ram_addr_from_mapcache_found(reventry->paddr_index, + reventry->vaddr_req); } abort(); return 0; @@ -416,7 +409,7 @@ ram_addr_t xen_ram_addr_from_mapcache(void *ptr) entry =3D entry->next; } if (!entry) { - DPRINTF("Trying to find address %p that is not in the mapcache!\n"= , ptr); + trace_xen_ram_addr_from_mapcache_not_in_cache(ptr); raddr =3D 0; } else { raddr =3D (reventry->paddr_index << MCACHE_BUCKET_SHIFT) + @@ -443,9 +436,12 @@ static void xen_invalidate_map_cache_entry_unlocked(ui= nt8_t *buffer) } } if (!found) { - DPRINTF("%s, could not find %p\n", __func__, buffer); + trace_xen_invalidate_map_cache_entry_unlocked_not_found(buffer); QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) { - DPRINTF(" "HWADDR_FMT_plx" -> %p is present\n", reventry->pa= ddr_index, reventry->vaddr_req); + trace_xen_invalidate_map_cache_entry_unlocked_found( + reventry->paddr_index, + reventry->vaddr_req + ); } return; } @@ -463,7 +459,7 @@ static void xen_invalidate_map_cache_entry_unlocked(uin= t8_t *buffer) entry =3D entry->next; } if (!entry) { - DPRINTF("Trying to unmap address %p that is not in the mapcache!\n= ", buffer); + trace_xen_invalidate_map_cache_entry_unlocked_miss(buffer); return; } entry->lock--; @@ -502,9 +498,8 @@ void xen_invalidate_map_cache(void) if (!reventry->dma) { continue; } - fprintf(stderr, "Locked DMA mapping while invalidating mapcache!" - " "HWADDR_FMT_plx" -> %p is present\n", - reventry->paddr_index, reventry->vaddr_req); + trace_xen_invalidate_map_cache(reventry->paddr_index, + reventry->vaddr_req); } =20 for (i =3D 0; i < mapcache->nr_buckets; i++) { @@ -562,24 +557,23 @@ static uint8_t *xen_replace_cache_entry_unlocked(hwad= dr old_phys_addr, entry =3D entry->next; } if (!entry) { - DPRINTF("Trying to update an entry for "HWADDR_FMT_plx \ - "that is not in the mapcache!\n", old_phys_addr); + trace_xen_replace_cache_entry_unlocked(old_phys_addr); return NULL; } =20 address_index =3D new_phys_addr >> MCACHE_BUCKET_SHIFT; address_offset =3D new_phys_addr & (MCACHE_BUCKET_SIZE - 1); =20 - fprintf(stderr, "Replacing a dummy mapcache entry for "HWADDR_FMT_plx \ - " with "HWADDR_FMT_plx"\n", old_phys_addr, new_phys_addr); + trace_xen_replace_cache_entry_dummy(old_phys_addr, new_phys_addr); =20 xen_remap_bucket(entry, entry->vaddr_base, cache_size, address_index, false); if (!test_bits(address_offset >> XC_PAGE_SHIFT, test_bit_size >> XC_PAGE_SHIFT, entry->valid_mapping)) { - DPRINTF("Unable to update a mapcache entry for "HWADDR_FMT_plx"!\n= ", - old_phys_addr); + trace_xen_replace_cache_entry_unlocked_could_not_update_entry( + old_phys_addr + ); return NULL; } =20 diff --git a/hw/xen/trace-events b/hw/xen/trace-events index 67a6c419260..a65dc0e55fd 100644 --- a/hw/xen/trace-events +++ b/hw/xen/trace-events @@ -60,3 +60,14 @@ cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_= t reg, uint32_t size, ui xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64 xen_remap_bucket(uint64_t index) "index 0x%"PRIx64 xen_map_cache_return(void* ptr) "%p" +xen_map_cache_init(uint64_t nr_buckets, uint64_t size) "nr_buckets =3D 0x%= "PRIx64" size 0x%"PRIx64 +xen_replace_cache_entry_dummy(uint64_t old_phys_addr, uint64_t new_phys_ad= dr) "Replacing a dummy mapcache entry for 0x%"PRIx64" with 0x%"PRIx64 +xen_invalidate_map_cache_entry_unlocked_not_found(void *p) "could not find= %p" +xen_invalidate_map_cache_entry_unlocked_found(uint64_t addr, void *p) " = 0x%"PRIx64" -> %p is present" +xen_invalidate_map_cache_entry_unlocked_miss(void *buffer) "Trying to unma= p address %p that is not in the mapcache" +xen_replace_cache_entry_unlocked_could_not_update_entry(uint64_t old_phys_= addr) "Unable to update a mapcache entry for 0x%"PRIx64 +xen_ram_addr_from_mapcache_not_found(void *p) "could not find %p" +xen_ram_addr_from_mapcache_found(uint64_t addr, void *p) " 0x%"PRIx64" -= > %p is present" +xen_ram_addr_from_mapcache_not_in_cache(void *p) "Trying to find address %= p that is not in the mapcache" +xen_replace_cache_entry_unlocked(uint64_t old_phys_addr) "Trying to update= an entry for 0x%"PRIx64" that is not in the mapcache" +xen_invalidate_map_cache(uint64_t paddr_index, void *vaddr_req) "Locked DM= A mapping while invalidating mapcache 0x%"PRIx64" -> %p is present" --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888382; cv=none; d=zohomail.com; s=zohoarc; b=XdaXh3uOdJpx4A07PqTlTAnrW4djog+KdKgpAa6k++P4mEhN7zR4P2Hb5/LR5KRNLTa+6oO4/Xo31mxlySTe1VsPKZOi9d8T53VZQNBRK9aoUg2Pk4tAj6uEFlCkYw4qX0H7yFWjmmWMoT4XB9yVZvYGYDxfS073TWy129TrwKI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888382; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=dM1ag+hc6Tlr+SofgNgQWcacda8AUiOk3VlHdLXApxg=; b=JFAeyG1/7UEKWcOhBWGRIsVuT96jHrWRXLlkGqIaS0hDLVmWhFr9HNsi8NB07XQ3vWA7UE4qiXqQJpWviknpvAcfiJSS/qZsMsAs+IohTxKJmMNOXhr9iP39fWzM/8bX6Lfu2VAb00xIB6zAmVu5jQ81vZ3wDESf8LUyBgY9SCE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888382741232.98313330241115; Fri, 2 Feb 2024 07:39:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb6-0000OC-Vd; Fri, 02 Feb 2024 10:36:56 -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 1rVvb4-0000N4-Rn for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:54 -0500 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb2-0004XF-P0 for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:54 -0500 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-51121637524so3291047e87.1 for ; Fri, 02 Feb 2024 07:36:52 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888211; x=1707493011; 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=dM1ag+hc6Tlr+SofgNgQWcacda8AUiOk3VlHdLXApxg=; b=KGHJBymGGw6ISJjzXuCGcMuKUFgF0qzw2ggCMNkQVqbckwJnxTRahOWQ7krE3w3nYs lTDOGFJeJM4pinum63vtEHnKjS8vF7ZFuy7J6ZCnga4/ioS+9O6SYL1YN37M6q2rC7PP 1i0LrU1bmyH2rvntOYhJ2O18iFo/u9fqYhB+0amgmwCG2i2h508I4vvGhkzPqPmN3Yov ZhhLasjXW5KEqxtZgWFX4UYNk639D5/DYOrOesFW0bBZxF5wPQrVFmpzugAkD/WEUvS9 0o80c4mT4Y1tTyMzYlZR2D9+2+hR0c6/zogmPA/UqPnpS5wI/vDN2lCCgNSWCXgMAEHC cFFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888211; x=1707493011; 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=dM1ag+hc6Tlr+SofgNgQWcacda8AUiOk3VlHdLXApxg=; b=o6n5h70QtL2d/6nhq33Ec1HM0AxhTe9CtnwrGR81SR/iVGBU70DguSA5pEixlkyPNc HDX/zW7Qf6uDY0zqYnnmCOop//18/3WjqFKvTGIftzIecWhL0TnOwqIg+9rActaHYSDV qyESV/ml7r/gTdqr2rCdFsXcEoPNFW6pC2RorJdsf9oCWWSuVbCK02CIs8iDB2hbYh7Y zQWlutuosuVRUBXFNfFAO6ejezGNFxZAPbOv4otWdprTZmsC23eCPaOn7BRvRGOzIxAL 6V2T6FPa/Fln/0lhkgw5BmNMrV/CLASnggtshVb+hxftsaplr9ACGQI3WvcfhQSarJsI moDg== X-Gm-Message-State: AOJu0YxLnHLhWZQOGlyhLqDNVbwNAfvfU+d4t0ibRksHHc9c93JUQmda KFYwcjvFVyNmH3WBxm3d616Pe2NzgPjsFid7k7vmGXlPbEuHqfAqA0FR37Rcv0rvMzlPbrIlbj3 x X-Google-Smtp-Source: AGHT+IGcth72FjC3hPHKF5w9kt5/eyA56WGfU7aigq7z/mctndDpnIxqYUTRnAN1dckXkdCmsaKAqA== X-Received: by 2002:ac2:592d:0:b0:511:3460:925c with SMTP id v13-20020ac2592d000000b005113460925cmr1719006lfi.65.1706888211220; Fri, 02 Feb 2024 07:36:51 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 27/36] hw/xen/xen-hvm-common.c: convert DPRINTF to tracepoints Date: Fri, 2 Feb 2024 15:36:28 +0000 Message-Id: <20240202153637.3710444-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x12b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888384331100011 From: Manos Pitsidianakis Tracing DPRINTFs to stderr might not be desired. A developer that relies on tracepoints should be able to opt-in to each tracepoint and rely on QEMU's log redirection, instead of stderr by default. This commit converts DPRINTFs in this file that are used for tracing into tracepoints. Signed-off-by: Manos Pitsidianakis Reviewed-by: Alex Benn=C3=A9e Message-id: b000ab73022dfeb7a7ab0ee8fd0f41fb208adaf0.1706544115.git.manos.p= itsidianakis@linaro.org Signed-off-by: Peter Maydell --- hw/xen/xen-hvm-common.c | 35 ++++++++++++++++++----------------- hw/xen/trace-events | 10 +++++++++- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index 47e6cb1db3a..05a29c6f11a 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -169,11 +169,12 @@ static ioreq_t *cpu_get_ioreq_from_shared_memory(XenI= OState *state, int vcpu) ioreq_t *req =3D xen_vcpu_ioreq(state->shared_page, vcpu); =20 if (req->state !=3D STATE_IOREQ_READY) { - DPRINTF("I/O request not ready: " - "%x, ptr: %x, port: %"PRIx64", " - "data: %"PRIx64", count: %u, size: %u\n", - req->state, req->data_is_ptr, req->addr, - req->data, req->count, req->size); + trace_cpu_get_ioreq_from_shared_memory_req_not_ready(req->state, + req->data_is_= ptr, + req->addr, + req->data, + req->count, + req->size); return NULL; } =20 @@ -601,10 +602,9 @@ static void xen_main_loop_prepare(XenIOState *state) if (evtchn_fd !=3D -1) { CPUState *cpu_state; =20 - DPRINTF("%s: Init cpu_by_vcpu_id\n", __func__); CPU_FOREACH(cpu_state) { - DPRINTF("%s: cpu_by_vcpu_id[%d]=3D%p\n", - __func__, cpu_state->cpu_index, cpu_state); + trace_xen_main_loop_prepare_init_cpu(cpu_state->cpu_index, + cpu_state); state->cpu_by_vcpu_id[cpu_state->cpu_index] =3D cpu_state; } qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, state); @@ -681,7 +681,7 @@ static int xen_map_ioreq_server(XenIOState *state) } =20 if (state->shared_page =3D=3D NULL) { - DPRINTF("shared page at pfn %lx\n", ioreq_pfn); + trace_xen_map_ioreq_server_shared_page(ioreq_pfn); =20 state->shared_page =3D xenforeignmemory_map(xen_fmem, xen_domid, PROT_READ | PROT_WRITE, @@ -693,7 +693,7 @@ static int xen_map_ioreq_server(XenIOState *state) } =20 if (state->buffered_io_page =3D=3D NULL) { - DPRINTF("buffered io page at pfn %lx\n", bufioreq_pfn); + trace_xen_map_ioreq_server_buffered_io_page(bufioreq_pfn); =20 state->buffered_io_page =3D xenforeignmemory_map(xen_fmem, xen_dom= id, PROT_READ | PROT_WR= ITE, @@ -709,7 +709,7 @@ static int xen_map_ioreq_server(XenIOState *state) return -1; } =20 - DPRINTF("buffered io evtchn is %x\n", bufioreq_evtchn); + trace_xen_map_ioreq_server_buffered_io_evtchn(bufioreq_evtchn); =20 state->bufioreq_remote_port =3D bufioreq_evtchn; =20 @@ -737,16 +737,17 @@ void destroy_hvm_domain(bool reboot) =20 xc_handle =3D xc_interface_open(0, 0, 0); if (xc_handle =3D=3D NULL) { - fprintf(stderr, "Cannot acquire xenctrl handle\n"); + trace_destroy_hvm_domain_cannot_acquire_handle(); } else { sts =3D xc_domain_shutdown(xc_handle, xen_domid, reason); if (sts !=3D 0) { - fprintf(stderr, "xc_domain_shutdown failed to issue %s, " - "sts %d, %s\n", reboot ? "reboot" : "poweroff", - sts, strerror(errno)); + trace_destroy_hvm_domain_failed_action( + reboot ? "reboot" : "poweroff", sts, strerror(errno) + ); } else { - fprintf(stderr, "Issued domain %d %s\n", xen_domid, - reboot ? "reboot" : "poweroff"); + trace_destroy_hvm_domain_action( + xen_domid, reboot ? "reboot" : "poweroff" + ); } xc_interface_close(xc_handle); } diff --git a/hw/xen/trace-events b/hw/xen/trace-events index a65dc0e55fd..d1b27f6c11b 100644 --- a/hw/xen/trace-events +++ b/hw/xen/trace-events @@ -42,7 +42,7 @@ xs_node_vscanf(char *path, char *value) "%s %s" xs_node_watch(char *path) "%s" xs_node_unwatch(char *path) "%s" =20 -# xen-hvm.c +# xen-hvm-common.c xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: 0x%l= x, size 0x%lx" xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_di= rty) "0x%"PRIx64" size 0x%lx, log_dirty %i" handle_ioreq(void *req, uint32_t type, uint32_t dir, uint32_t df, uint32_t= data_is_ptr, uint64_t addr, uint64_t data, uint32_t count, uint32_t size) = "I/O=3D%p type=3D%d dir=3D%d df=3D%d ptr=3D%d port=3D0x%"PRIx64" data=3D0x%= "PRIx64" count=3D%d size=3D%d" @@ -55,6 +55,14 @@ cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uin= t32_t data_is_ptr, uint6 xen_map_resource_ioreq(uint32_t id, void *addr) "id: %u addr: %p" cpu_ioreq_config_read(void *req, uint32_t sbdf, uint32_t reg, uint32_t siz= e, uint32_t data) "I/O=3D%p sbdf=3D0x%x reg=3D%u size=3D%u data=3D0x%x" cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_t reg, uint32_t si= ze, uint32_t data) "I/O=3D%p sbdf=3D0x%x reg=3D%u size=3D%u data=3D0x%x" +cpu_get_ioreq_from_shared_memory_req_not_ready(int state, int data_is_ptr,= uint64_t addr, uint64_t data, uint32_t count, uint32_t size) "I/O request = not ready: 0x%x, ptr: 0x%x, port: 0x%"PRIx64", data: 0x%"PRIx64", count: %u= , size: %u" +xen_main_loop_prepare_init_cpu(int id, void *cpu) "cpu_by_vcpu_id[%d]=3D%p" +xen_map_ioreq_server_shared_page(long unsigned int ioreq_pfn) "shared page= at pfn 0x%lx" +xen_map_ioreq_server_buffered_io_page(long unsigned int ioreq_pfn) "buffer= ed io page at pfn 0x%lx" +xen_map_ioreq_server_buffered_io_evtchn(int bufioreq_evtchn) "buffered io = evtchn is 0x%x" +destroy_hvm_domain_cannot_acquire_handle(void) "Cannot acquire xenctrl han= dle" +destroy_hvm_domain_failed_action(const char *action, int sts, char *errno_= s) "xc_domain_shutdown failed to issue %s, sts %d, %s" +destroy_hvm_domain_action(int xen_domid, const char *action) "Issued domai= n %d %s" =20 # xen-mapcache.c xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64 --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888436; cv=none; d=zohomail.com; s=zohoarc; b=GzPxr3fcmK9BVwRFWyzvgLispfvSfo/UI9vuiInGG5eAF8cSexng9LBcdBZI9rKXl335IYFcpAvdSOlEDg/JwtkxkZ9fCV9/FuBgNJuc4WArRw2iLstfAfRWQDrqh7N2ghg8FuJPB7katg0q5gl6V/b3D+cLPTUOmex9Ybfpv/4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888436; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=6766GInC0KCZwdcNkPeeQ9H7YYISDkqkH81Ih8qmKD4=; b=SbkFEnCkeJajsLcL+EnwDicf06Wxsy5oi1nA7CA9JzPz9Nw80npAZmWJAJ2h8tHttt7xjlbtyzomHdPW3PeDauH2RIQWpAAcmRQRop0R2Mfc/MQ2yFWAO0UTcPPe/ZZofYlgvmVt3/3k8A/2tObCYhDNaHSdEHOil2jOdIl+w4Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888436301996.4962882999519; Fri, 2 Feb 2024 07:40:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb7-0000Ob-5M; Fri, 02 Feb 2024 10:36:57 -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 1rVvb5-0000NJ-1t for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:55 -0500 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb3-0004XR-Ba for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:54 -0500 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-511234430a4so3722073e87.3 for ; Fri, 02 Feb 2024 07:36:52 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888211; x=1707493011; 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=6766GInC0KCZwdcNkPeeQ9H7YYISDkqkH81Ih8qmKD4=; b=Qi4o2/Be5kcx5BI0OpcpQ/+vdaV/2rm9WWyD4CCf7FI55zOI77BgIGQZTkkI2yTWm3 Wuap1eIdEB7JaawS18wDOU/o/qwuTL+j0MRh4kCAADhilj44ra2xoFsHD5U3CsRCUfR5 uNA+rBaWDeRb1VpfxB2wTXcDipL5SR8y0WCuZqFl/getChVygVleoCowpQEF0pHjBHCp Yach0ppR+IGitaM4RhHVPQ6Z4fyYsQvbTHMLAIQRwP6GXBxEDPl/uLMKghIi0kBb7Plm aWZLcPLMC680o8ZNQYQslz6iHw/L4o6uBvCKHoFBE/A7csOkX9C8TpDDYARVm8KCVgub v/LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888211; x=1707493011; 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=6766GInC0KCZwdcNkPeeQ9H7YYISDkqkH81Ih8qmKD4=; b=Bopl5aFem0sPGlmx4LdPrnyciUlBGDfEht6TZ6NpqHxdp6dLFbuxeykX2C42d6rpqu BKDLm+T3AOA35KP7+HaEsF1wlT4tLzAt+a65iWVbsypZ+Z2Gf11gG16zLLgV7z2HwQ0a yyZzJj14dDIC5KxTTeFyB30uBsnBCRCJMU6sTT0u5TN3zAWDH9/T8qOuJFx031hgmYTy 7C1+5WZ66Ae7pTJw14CnDGiIu1z5mnGzC/9jk9f7W1N7dLE3uEzWJhebCD4x7iAFBiof aheO5+IRWJ9Fd6hjHc4FvEBTCsodDDb7wxmpI0wNV2tgO9OEElucWU9epfNnz2OcrsTT ihlw== X-Gm-Message-State: AOJu0YyleP/7EpA3WYzDlALJLok1bcNMNWcJglwQwXWv+mXVNvGebqMq i4c9kMOs+8Pw5NdM3ZaXYfeTzLHUl9dBPggHPIB3QN6Pk+GtgQ5wU/fzAdKqITZB4HcMVxGZEej V X-Google-Smtp-Source: AGHT+IHps3qmyOKFbxMqfyVvxJwnYfS8Z7zYNtB1W/G9B+8/paMGphTVf0/mOOfAoSG15FpzZQfrdQ== X-Received: by 2002:a19:7605:0:b0:50e:6168:c99d with SMTP id c5-20020a197605000000b0050e6168c99dmr3934626lff.27.1706888211636; Fri, 02 Feb 2024 07:36:51 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/36] hw/xen: convert stderr prints to error/warn reports Date: Fri, 2 Feb 2024 15:36:29 +0000 Message-Id: <20240202153637.3710444-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x135.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888436561100001 From: Manos Pitsidianakis According to the QEMU Coding Style document: > Do not use printf(), fprintf() or monitor_printf(). Instead, use > error_report() or error_vreport() from error-report.h. This ensures the > error is reported in the right place (current monitor or stderr), and in > a uniform format. > Use error_printf() & friends to print additional information. This commit changes fprintfs that report warnings and errors to the appropriate report functions. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Manos Pitsidianakis Reviewed-by: Alex Benn=C3=A9e Message-id: 42a8953553cf68e8bacada966f93af4fbce45919.1706544115.git.manos.p= itsidianakis@linaro.org Signed-off-by: Peter Maydell --- hw/xen/xen-hvm-common.c | 12 ++++++------ hw/xen/xen-mapcache.c | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index 05a29c6f11a..baa1adb9f23 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -20,8 +20,8 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, = MemoryRegion *mr, =20 if (runstate_check(RUN_STATE_INMIGRATE)) { /* RAM already populated in Xen */ - fprintf(stderr, "%s: do not alloc "RAM_ADDR_FMT - " bytes of ram at "RAM_ADDR_FMT" when runstate is INMIGRAT= E\n", + warn_report("%s: do not alloc "RAM_ADDR_FMT + " bytes of ram at "RAM_ADDR_FMT" when runstate is INMIGRAT= E", __func__, size, ram_addr); return; } @@ -552,9 +552,9 @@ static void cpu_handle_ioreq(void *opaque) req->data =3D copy.data; =20 if (req->state !=3D STATE_IOREQ_INPROCESS) { - fprintf(stderr, "Badness in I/O request ... not in service?!: " + warn_report("Badness in I/O request ... not in service?!: " "%x, ptr: %x, port: %"PRIx64", " - "data: %"PRIx64", count: %u, size: %u, type: %u\n", + "data: %"PRIx64", count: %u, size: %u, type: %u", req->state, req->data_is_ptr, req->addr, req->data, req->count, req->size, req->type); destroy_hvm_domain(false); @@ -758,9 +758,9 @@ void xen_shutdown_fatal_error(const char *fmt, ...) va_list ap; =20 va_start(ap, fmt); - vfprintf(stderr, fmt, ap); + error_vreport(fmt, ap); va_end(ap); - fprintf(stderr, "Will destroy the domain.\n"); + error_report("Will destroy the domain."); /* destroy the domain */ qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_ERROR); } diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c index 336c2123767..4f956d048ee 100644 --- a/hw/xen/xen-mapcache.c +++ b/hw/xen/xen-mapcache.c @@ -347,9 +347,8 @@ tryagain: MapCacheRev *reventry =3D g_new0(MapCacheRev, 1); entry->lock++; if (entry->lock =3D=3D 0) { - fprintf(stderr, - "mapcache entry lock overflow: "HWADDR_FMT_plx" -> %p\= n", - entry->paddr_index, entry->vaddr_base); + error_report("mapcache entry lock overflow: "HWADDR_FMT_plx" -= > %p", + entry->paddr_index, entry->vaddr_base); abort(); } reventry->dma =3D dma; --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888314; cv=none; d=zohomail.com; s=zohoarc; b=LlNSFED0neutc8QXyHwISwquTddwi8W4b/TGs94XfFOV1Ukqd8AwUErgQFV74G6XKKBy74CzCJWC4eN04ME9ejnxm+DEAhLgzx8zW+udG+9eVBt/p5u0uvhq5NX1vR5kXeg5dKSU6EloCBIanXcZsEyQNAOHWHyxbNp4gtDoOtA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888314; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=d4Dw/zUBj8djGXGpZZ1PuJwGodEvYtT2TVETZ0aTH+E=; b=ULz6fqWurLcLy008g+OJSuOnjfq6xrf2WQlg2yayyDbMtxMDwREa08NS9r8tK82Tph/PmZPuCbo+CHu6kGgIsNt0oQk88zm+Q0r9kTIIus5xd4MVY0TPpoR3dwE1GdFnwYWVylnBocaqBvOU76+ErCSeN/BJylQDUoMpky9+nCQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888314812829.9838872679096; Fri, 2 Feb 2024 07:38:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvbB-0000hh-7A; Fri, 02 Feb 2024 10:37:01 -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 1rVvb7-0000Oq-Ah for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:57 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb3-0004Xl-Q3 for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:57 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40ef6bbb61fso18649085e9.1 for ; Fri, 02 Feb 2024 07:36:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888212; x=1707493012; 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=d4Dw/zUBj8djGXGpZZ1PuJwGodEvYtT2TVETZ0aTH+E=; b=YsQuOv0VtNcGpnDI9QafVXkv87/tSNajJwkq4b6NcOUpExm+gnyy1tsS//xro/WPFA 15r2GboivFVXYGNRjq/VIDDUFsylgSf1vYVo5Kz64ZU/0tPTzimNg/6bxdqvzQqaZ4Um Mg7K/mmlWGV+D4Wl3nVsDqucJ/x7H/VNqh05Vpr08XmjZ18X/hQPgoOLkJ3O3n7Ak0Wr red5r+J1TqE6c8InRHCi3gTamijQYs+gsi5jzZ2O/L7c7Ogt8WvYRX7cO3dGjtEbU+bA gws94pzNCmYXTKFWFGC2tA+hYIXEfhw0aXbbd9b4I810U2K5vxLfmvUU8LlKYqK0b2kD F5YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888212; x=1707493012; 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=d4Dw/zUBj8djGXGpZZ1PuJwGodEvYtT2TVETZ0aTH+E=; b=cRB6GqpfbFGyobTUEY4SOWKud96gs4wPxqQRfFuWIigtXltRj+Ge08kX9eh7DjIy/O SMCNtTKBDENnRyIzh/1o5lGzzcKGUKs24VoLkQPAkGDYD2xZAWHIBPY6ZoB82DORRcYD tUTnni2cDmgbeFM5kMyh51jGw3Dour8EqOPE+gMr5C6CceMr4UJnrZQCPUGCK4uXhWEr BNYAJLLPab2Ab1uPhDHfDAM9+YqihsjOGBaMt7rYU3Glw4Yvrv3juA23iR2/TimeGEf1 96PE9CjXZzlqYZ2WBsYRqx9CujgA5CyPXG8mGehzlq4uVlv1dxx/cUtOgpvOXmIwWs+5 utcQ== X-Gm-Message-State: AOJu0Yyqzb8g+ZqmvV6zdluOsGJbpBrYDCm+gF50xbsOCv6Sog6hvIOM Ft5Ibv2KKnzpWGmXezW3fnLlqFs87Qu1bBuCLuYoxAZYzT2PNT0ZTxEycfDZP7GM0DxQ/gCXI0g h X-Google-Smtp-Source: AGHT+IGy3upOuyToh5107HDZfc1ovB1dMWQfHvUH1gqAtwJ9XpyKnYzHTGrUEssBILeNnFVjd6jrcg== X-Received: by 2002:a05:600c:b9a:b0:40f:cb4b:dfe3 with SMTP id fl26-20020a05600c0b9a00b0040fcb4bdfe3mr763210wmb.16.1706888212104; Fri, 02 Feb 2024 07:36:52 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/36] hw/net: Add NPCMXXX GMAC device Date: Fri, 2 Feb 2024 15:36:30 +0000 Message-Id: <20240202153637.3710444-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888315954100018 Content-Type: text/plain; charset="utf-8" From: Hao Wu This patch implements the basic registers of GMAC device and sets registers for networking functionalities. Squashed IRQ Implementation patch into this one for compliation. Tested: The following message shows up with the change: Broadcom BCM54612E stmmac-0:00: attached PHY driver [Broadcom BCM54612E] (m= ii_bus:phy_addr=3Dstmmac-0:00, irq=3DPOLL) stmmaceth f0802000.eth eth0: Link is Up - 1Gbps/Full - flow control rx/tx Change-Id: If71c6d486b95edcccba109ba454870714d7e0940 Signed-off-by: Hao Wu Signed-off-by: Nabih Estefan Diaz Reviewed-by: Tyrone Ting Message-id: 20240131002800.989285-2-nabihestefan@google.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/net/npcm_gmac.h | 343 +++++++++++++++++++++++++++ hw/net/npcm_gmac.c | 467 +++++++++++++++++++++++++++++++++++++ hw/net/meson.build | 2 +- hw/net/trace-events | 12 + 4 files changed, 823 insertions(+), 1 deletion(-) create mode 100644 include/hw/net/npcm_gmac.h create mode 100644 hw/net/npcm_gmac.c diff --git a/include/hw/net/npcm_gmac.h b/include/hw/net/npcm_gmac.h new file mode 100644 index 00000000000..f2d9f08ec1a --- /dev/null +++ b/include/hw/net/npcm_gmac.h @@ -0,0 +1,343 @@ +/* + * Nuvoton NPCM7xx/8xx GMAC Module + * + * Copyright 2024 Google LLC + * Authors: + * Hao Wu + * Nabih Estefan + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WIT= HOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#ifndef NPCM_GMAC_H +#define NPCM_GMAC_H + +#include "hw/irq.h" +#include "hw/sysbus.h" +#include "net/net.h" + +#define NPCM_GMAC_NR_REGS (0x1060 / sizeof(uint32_t)) + +#define NPCM_GMAC_MAX_PHYS 32 +#define NPCM_GMAC_MAX_PHY_REGS 32 + +struct NPCMGMACRxDesc { + uint32_t rdes0; + uint32_t rdes1; + uint32_t rdes2; + uint32_t rdes3; +}; + +/* NPCMGMACRxDesc.flags values */ +/* RDES2 and RDES3 are buffer addresses */ +/* Owner: 0 =3D software, 1 =3D dma */ +#define RX_DESC_RDES0_OWN BIT(31) +/* Destination Address Filter Fail */ +#define RX_DESC_RDES0_DEST_ADDR_FILT_FAIL BIT(30) +/* Frame length */ +#define RX_DESC_RDES0_FRAME_LEN_MASK(word) extract32(word, 16, 14) +/* Frame length Shift*/ +#define RX_DESC_RDES0_FRAME_LEN_SHIFT 16 +/* Error Summary */ +#define RX_DESC_RDES0_ERR_SUMM_MASK BIT(15) +/* Descriptor Error */ +#define RX_DESC_RDES0_DESC_ERR_MASK BIT(14) +/* Source Address Filter Fail */ +#define RX_DESC_RDES0_SRC_ADDR_FILT_FAIL_MASK BIT(13) +/* Length Error */ +#define RX_DESC_RDES0_LEN_ERR_MASK BIT(12) +/* Overflow Error */ +#define RX_DESC_RDES0_OVRFLW_ERR_MASK BIT(11) +/* VLAN Tag */ +#define RX_DESC_RDES0_VLAN_TAG_MASK BIT(10) +/* First Descriptor */ +#define RX_DESC_RDES0_FIRST_DESC_MASK BIT(9) +/* Last Descriptor */ +#define RX_DESC_RDES0_LAST_DESC_MASK BIT(8) +/* IPC Checksum Error/Giant Frame */ +#define RX_DESC_RDES0_IPC_CHKSM_ERR_GNT_FRM_MASK BIT(7) +/* Late Collision */ +#define RX_DESC_RDES0_LT_COLL_MASK BIT(6) +/* Frame Type */ +#define RX_DESC_RDES0_FRM_TYPE_MASK BIT(5) +/* Receive Watchdog Timeout */ +#define RX_DESC_RDES0_REC_WTCHDG_TMT_MASK BIT(4) +/* Receive Error */ +#define RX_DESC_RDES0_RCV_ERR_MASK BIT(3) +/* Dribble Bit Error */ +#define RX_DESC_RDES0_DRBL_BIT_ERR_MASK BIT(2) +/* Cyclcic Redundancy Check Error */ +#define RX_DESC_RDES0_CRC_ERR_MASK BIT(1) +/* Rx MAC Address/Payload Checksum Error */ +#define RC_DESC_RDES0_RCE_MASK BIT(0) + +/* Disable Interrupt on Completion */ +#define RX_DESC_RDES1_DIS_INTR_COMP_MASK BIT(31) +/* Recieve end of ring */ +#define RX_DESC_RDES1_RC_END_RING_MASK BIT(25) +/* Second Address Chained */ +#define RX_DESC_RDES1_SEC_ADDR_CHND_MASK BIT(24) +/* Receive Buffer 2 Size */ +#define RX_DESC_RDES1_BFFR2_SZ_SHIFT 11 +#define RX_DESC_RDES1_BFFR2_SZ_MASK(word) extract32(word, \ + RX_DESC_RDES1_BFFR2_SZ_SHIFT, 11) +/* Receive Buffer 1 Size */ +#define RX_DESC_RDES1_BFFR1_SZ_MASK(word) extract32(word, 0, 11) + + +struct NPCMGMACTxDesc { + uint32_t tdes0; + uint32_t tdes1; + uint32_t tdes2; + uint32_t tdes3; +}; + +/* NPCMGMACTxDesc.flags values */ +/* TDES2 and TDES3 are buffer addresses */ +/* Owner: 0 =3D software, 1 =3D gmac */ +#define TX_DESC_TDES0_OWN BIT(31) +/* Tx Time Stamp Status */ +#define TX_DESC_TDES0_TTSS_MASK BIT(17) +/* IP Header Error */ +#define TX_DESC_TDES0_IP_HEAD_ERR_MASK BIT(16) +/* Error Summary */ +#define TX_DESC_TDES0_ERR_SUMM_MASK BIT(15) +/* Jabber Timeout */ +#define TX_DESC_TDES0_JBBR_TMT_MASK BIT(14) +/* Frame Flushed */ +#define TX_DESC_TDES0_FRM_FLSHD_MASK BIT(13) +/* Payload Checksum Error */ +#define TX_DESC_TDES0_PYLD_CHKSM_ERR_MASK BIT(12) +/* Loss of Carrier */ +#define TX_DESC_TDES0_LSS_CARR_MASK BIT(11) +/* No Carrier */ +#define TX_DESC_TDES0_NO_CARR_MASK BIT(10) +/* Late Collision */ +#define TX_DESC_TDES0_LATE_COLL_MASK BIT(9) +/* Excessive Collision */ +#define TX_DESC_TDES0_EXCS_COLL_MASK BIT(8) +/* VLAN Frame */ +#define TX_DESC_TDES0_VLAN_FRM_MASK BIT(7) +/* Collision Count */ +#define TX_DESC_TDES0_COLL_CNT_MASK(word) extract32(word, 3, 4) +/* Excessive Deferral */ +#define TX_DESC_TDES0_EXCS_DEF_MASK BIT(2) +/* Underflow Error */ +#define TX_DESC_TDES0_UNDRFLW_ERR_MASK BIT(1) +/* Deferred Bit */ +#define TX_DESC_TDES0_DFRD_BIT_MASK BIT(0) + +/* Interrupt of Completion */ +#define TX_DESC_TDES1_INTERR_COMP_MASK BIT(31) +/* Last Segment */ +#define TX_DESC_TDES1_LAST_SEG_MASK BIT(30) +/* First Segment */ +#define TX_DESC_TDES1_FIRST_SEG_MASK BIT(29) +/* Checksum Insertion Control */ +#define TX_DESC_TDES1_CHKSM_INS_CTRL_MASK(word) extract32(word, 27, 2) +/* Disable Cyclic Redundancy Check */ +#define TX_DESC_TDES1_DIS_CDC_MASK BIT(26) +/* Transmit End of Ring */ +#define TX_DESC_TDES1_TX_END_RING_MASK BIT(25) +/* Secondary Address Chained */ +#define TX_DESC_TDES1_SEC_ADDR_CHND_MASK BIT(24) +/* Transmit Buffer 2 Size */ +#define TX_DESC_TDES1_BFFR2_SZ_MASK(word) extract32(word, 11, 11) +/* Transmit Buffer 1 Size */ +#define TX_DESC_TDES1_BFFR1_SZ_MASK(word) extract32(word, 0, 11) + +typedef struct NPCMGMACState { + SysBusDevice parent; + + MemoryRegion iomem; + qemu_irq irq; + + NICState *nic; + NICConf conf; + + uint32_t regs[NPCM_GMAC_NR_REGS]; + uint16_t phy_regs[NPCM_GMAC_MAX_PHYS][NPCM_GMAC_MAX_PHY_REGS]; +} NPCMGMACState; + +#define TYPE_NPCM_GMAC "npcm-gmac" +OBJECT_DECLARE_SIMPLE_TYPE(NPCMGMACState, NPCM_GMAC) + +/* Mask for RO bits in Status */ +#define NPCM_DMA_STATUS_RO_MASK(word) (word & 0xfffe0000) +/* Mask for RO bits in Status */ +#define NPCM_DMA_STATUS_W1C_MASK(word) (word & 0x1e7ff) + +/* Transmit Process State */ +#define NPCM_DMA_STATUS_TX_PROCESS_STATE_SHIFT 20 +/* Transmit States */ +#define NPCM_DMA_STATUS_TX_STOPPED_STATE \ + (0b000) +#define NPCM_DMA_STATUS_TX_RUNNING_FETCHING_STATE \ + (0b001) +#define NPCM_DMA_STATUS_TX_RUNNING_WAITING_STATE \ + (0b010) +#define NPCM_DMA_STATUS_TX_RUNNING_READ_STATE \ + (0b011) +#define NPCM_DMA_STATUS_TX_SUSPENDED_STATE \ + (0b110) +#define NPCM_DMA_STATUS_TX_RUNNING_CLOSING_STATE \ + (0b111) +/* Transmit Process State */ +#define NPCM_DMA_STATUS_RX_PROCESS_STATE_SHIFT 17 +/* Receive States */ +#define NPCM_DMA_STATUS_RX_STOPPED_STATE \ + (0b000) +#define NPCM_DMA_STATUS_RX_RUNNING_FETCHING_STATE \ + (0b001) +#define NPCM_DMA_STATUS_RX_RUNNING_WAITING_STATE \ + (0b011) +#define NPCM_DMA_STATUS_RX_SUSPENDED_STATE \ + (0b100) +#define NPCM_DMA_STATUS_RX_RUNNING_CLOSING_STATE \ + (0b101) +#define NPCM_DMA_STATUS_RX_RUNNING_TRANSFERRING_STATE \ + (0b111) + + +/* Early Receive Interrupt */ +#define NPCM_DMA_STATUS_ERI BIT(14) +/* Fatal Bus Error Interrupt */ +#define NPCM_DMA_STATUS_FBI BIT(13) +/* Early transmit Interrupt */ +#define NPCM_DMA_STATUS_ETI BIT(10) +/* Receive Watchdog Timout */ +#define NPCM_DMA_STATUS_RWT BIT(9) +/* Receive Process Stopped */ +#define NPCM_DMA_STATUS_RPS BIT(8) +/* Receive Buffer Unavailable */ +#define NPCM_DMA_STATUS_RU BIT(7) +/* Receive Interrupt */ +#define NPCM_DMA_STATUS_RI BIT(6) +/* Transmit Underflow */ +#define NPCM_DMA_STATUS_UNF BIT(5) +/* Receive Overflow */ +#define NPCM_DMA_STATUS_OVF BIT(4) +/* Transmit Jabber Timeout */ +#define NPCM_DMA_STATUS_TJT BIT(3) +/* Transmit Buffer Unavailable */ +#define NPCM_DMA_STATUS_TU BIT(2) +/* Transmit Process Stopped */ +#define NPCM_DMA_STATUS_TPS BIT(1) +/* Transmit Interrupt */ +#define NPCM_DMA_STATUS_TI BIT(0) + +/* Normal Interrupt Summary */ +#define NPCM_DMA_STATUS_NIS BIT(16) +/* Interrupts enabled by NIE */ +#define NPCM_DMA_STATUS_NIS_BITS (NPCM_DMA_STATUS_TI | \ + NPCM_DMA_STATUS_TU | \ + NPCM_DMA_STATUS_RI | \ + NPCM_DMA_STATUS_ERI) +/* Abnormal Interrupt Summary */ +#define NPCM_DMA_STATUS_AIS BIT(15) +/* Interrupts enabled by AIE */ +#define NPCM_DMA_STATUS_AIS_BITS (NPCM_DMA_STATUS_TPS | \ + NPCM_DMA_STATUS_TJT | \ + NPCM_DMA_STATUS_OVF | \ + NPCM_DMA_STATUS_UNF | \ + NPCM_DMA_STATUS_RU | \ + NPCM_DMA_STATUS_RPS | \ + NPCM_DMA_STATUS_RWT | \ + NPCM_DMA_STATUS_ETI | \ + NPCM_DMA_STATUS_FBI) + +/* Early Receive Interrupt Enable */ +#define NPCM_DMA_INTR_ENAB_ERE BIT(14) +/* Fatal Bus Error Interrupt Enable */ +#define NPCM_DMA_INTR_ENAB_FBE BIT(13) +/* Early transmit Interrupt Enable */ +#define NPCM_DMA_INTR_ENAB_ETE BIT(10) +/* Receive Watchdog Timout Enable */ +#define NPCM_DMA_INTR_ENAB_RWE BIT(9) +/* Receive Process Stopped Enable */ +#define NPCM_DMA_INTR_ENAB_RSE BIT(8) +/* Receive Buffer Unavailable Enable */ +#define NPCM_DMA_INTR_ENAB_RUE BIT(7) +/* Receive Interrupt Enable */ +#define NPCM_DMA_INTR_ENAB_RIE BIT(6) +/* Transmit Underflow Enable */ +#define NPCM_DMA_INTR_ENAB_UNE BIT(5) +/* Receive Overflow Enable */ +#define NPCM_DMA_INTR_ENAB_OVE BIT(4) +/* Transmit Jabber Timeout Enable */ +#define NPCM_DMA_INTR_ENAB_TJE BIT(3) +/* Transmit Buffer Unavailable Enable */ +#define NPCM_DMA_INTR_ENAB_TUE BIT(2) +/* Transmit Process Stopped Enable */ +#define NPCM_DMA_INTR_ENAB_TSE BIT(1) +/* Transmit Interrupt Enable */ +#define NPCM_DMA_INTR_ENAB_TIE BIT(0) + +/* Normal Interrupt Summary Enable */ +#define NPCM_DMA_INTR_ENAB_NIE BIT(16) +/* Interrupts enabled by NIE Enable */ +#define NPCM_DMA_INTR_ENAB_NIE_BITS (NPCM_DMA_INTR_ENAB_TIE | \ + NPCM_DMA_INTR_ENAB_TUE | \ + NPCM_DMA_INTR_ENAB_RIE | \ + NPCM_DMA_INTR_ENAB_ERE) +/* Abnormal Interrupt Summary Enable */ +#define NPCM_DMA_INTR_ENAB_AIE BIT(15) +/* Interrupts enabled by AIE Enable */ +#define NPCM_DMA_INTR_ENAB_AIE_BITS (NPCM_DMA_INTR_ENAB_TSE | \ + NPCM_DMA_INTR_ENAB_TJE | \ + NPCM_DMA_INTR_ENAB_OVE | \ + NPCM_DMA_INTR_ENAB_UNE | \ + NPCM_DMA_INTR_ENAB_RUE | \ + NPCM_DMA_INTR_ENAB_RSE | \ + NPCM_DMA_INTR_ENAB_RWE | \ + NPCM_DMA_INTR_ENAB_ETE | \ + NPCM_DMA_INTR_ENAB_FBE) + +/* Flushing Disabled */ +#define NPCM_DMA_CONTROL_FLUSH_MASK BIT(24) +/* Start/stop Transmit */ +#define NPCM_DMA_CONTROL_START_STOP_TX BIT(13) +/* Start/stop Receive */ +#define NPCM_DMA_CONTROL_START_STOP_RX BIT(1) +/* Next receive descriptor start address */ +#define NPCM_DMA_HOST_RX_DESC_MASK(word) ((uint32_t) (word) & ~3u) +/* Next transmit descriptor start address */ +#define NPCM_DMA_HOST_TX_DESC_MASK(word) ((uint32_t) (word) & ~3u) + +/* Receive enable */ +#define NPCM_GMAC_MAC_CONFIG_RX_EN BIT(2) +/* Transmit enable */ +#define NPCM_GMAC_MAC_CONFIG_TX_EN BIT(3) + +/* Frame Receive All */ +#define NPCM_GMAC_FRAME_FILTER_REC_ALL_MASK BIT(31) +/* Frame HPF Filter*/ +#define NPCM_GMAC_FRAME_FILTER_HPF_MASK BIT(10) +/* Frame SAF Filter*/ +#define NPCM_GMAC_FRAME_FILTER_SAF_MASK BIT(9) +/* Frame SAIF Filter*/ +#define NPCM_GMAC_FRAME_FILTER_SAIF_MASK BIT(8) +/* Frame PCF Filter*/ +#define NPCM_GMAC_FRAME_FILTER_PCF_MASK BIT(word) extract32((word), 6, 2) +/* Frame DBF Filter*/ +#define NPCM_GMAC_FRAME_FILTER_DBF_MASK BIT(5) +/* Frame PM Filter*/ +#define NPCM_GMAC_FRAME_FILTER_PM_MASK BIT(4) +/* Frame DAIF Filter*/ +#define NPCM_GMAC_FRAME_FILTER_DAIF_MASK BIT(3) +/* Frame HMC Filter*/ +#define NPCM_GMAC_FRAME_FILTER_HMC_MASK BIT(2) +/* Frame HUC Filter*/ +#define NPCM_GMAC_FRAME_FILTER_HUC_MASK BIT(1) +/* Frame PR Filter*/ +#define NPCM_GMAC_FRAME_FILTER_PR_MASK BIT(0) + +#endif /* NPCM_GMAC_H */ diff --git a/hw/net/npcm_gmac.c b/hw/net/npcm_gmac.c new file mode 100644 index 00000000000..7118b4c7c78 --- /dev/null +++ b/hw/net/npcm_gmac.c @@ -0,0 +1,467 @@ +/* + * Nuvoton NPCM7xx/8xx GMAC Module + * + * Copyright 2024 Google LLC + * Authors: + * Hao Wu + * Nabih Estefan + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WIT= HOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * Unsupported/unimplemented features: + * - MII is not implemented, MII_ADDR.BUSY and MII_DATA always return zero + * - Precision timestamp (PTP) is not implemented. + */ + +#include "qemu/osdep.h" + +#include "hw/registerfields.h" +#include "hw/net/mii.h" +#include "hw/net/npcm_gmac.h" +#include "migration/vmstate.h" +#include "qemu/log.h" +#include "qemu/units.h" +#include "sysemu/dma.h" +#include "trace.h" + +REG32(NPCM_DMA_BUS_MODE, 0x1000) +REG32(NPCM_DMA_XMT_POLL_DEMAND, 0x1004) +REG32(NPCM_DMA_RCV_POLL_DEMAND, 0x1008) +REG32(NPCM_DMA_RX_BASE_ADDR, 0x100c) +REG32(NPCM_DMA_TX_BASE_ADDR, 0x1010) +REG32(NPCM_DMA_STATUS, 0x1014) +REG32(NPCM_DMA_CONTROL, 0x1018) +REG32(NPCM_DMA_INTR_ENA, 0x101c) +REG32(NPCM_DMA_MISSED_FRAME_CTR, 0x1020) +REG32(NPCM_DMA_HOST_TX_DESC, 0x1048) +REG32(NPCM_DMA_HOST_RX_DESC, 0x104c) +REG32(NPCM_DMA_CUR_TX_BUF_ADDR, 0x1050) +REG32(NPCM_DMA_CUR_RX_BUF_ADDR, 0x1054) +REG32(NPCM_DMA_HW_FEATURE, 0x1058) + +REG32(NPCM_GMAC_MAC_CONFIG, 0x0) +REG32(NPCM_GMAC_FRAME_FILTER, 0x4) +REG32(NPCM_GMAC_HASH_HIGH, 0x8) +REG32(NPCM_GMAC_HASH_LOW, 0xc) +REG32(NPCM_GMAC_MII_ADDR, 0x10) +REG32(NPCM_GMAC_MII_DATA, 0x14) +REG32(NPCM_GMAC_FLOW_CTRL, 0x18) +REG32(NPCM_GMAC_VLAN_FLAG, 0x1c) +REG32(NPCM_GMAC_VERSION, 0x20) +REG32(NPCM_GMAC_WAKEUP_FILTER, 0x28) +REG32(NPCM_GMAC_PMT, 0x2c) +REG32(NPCM_GMAC_LPI_CTRL, 0x30) +REG32(NPCM_GMAC_TIMER_CTRL, 0x34) +REG32(NPCM_GMAC_INT_STATUS, 0x38) +REG32(NPCM_GMAC_INT_MASK, 0x3c) +REG32(NPCM_GMAC_MAC0_ADDR_HI, 0x40) +REG32(NPCM_GMAC_MAC0_ADDR_LO, 0x44) +REG32(NPCM_GMAC_MAC1_ADDR_HI, 0x48) +REG32(NPCM_GMAC_MAC1_ADDR_LO, 0x4c) +REG32(NPCM_GMAC_MAC2_ADDR_HI, 0x50) +REG32(NPCM_GMAC_MAC2_ADDR_LO, 0x54) +REG32(NPCM_GMAC_MAC3_ADDR_HI, 0x58) +REG32(NPCM_GMAC_MAC3_ADDR_LO, 0x5c) +REG32(NPCM_GMAC_RGMII_STATUS, 0xd8) +REG32(NPCM_GMAC_WATCHDOG, 0xdc) +REG32(NPCM_GMAC_PTP_TCR, 0x700) +REG32(NPCM_GMAC_PTP_SSIR, 0x704) +REG32(NPCM_GMAC_PTP_STSR, 0x708) +REG32(NPCM_GMAC_PTP_STNSR, 0x70c) +REG32(NPCM_GMAC_PTP_STSUR, 0x710) +REG32(NPCM_GMAC_PTP_STNSUR, 0x714) +REG32(NPCM_GMAC_PTP_TAR, 0x718) +REG32(NPCM_GMAC_PTP_TTSR, 0x71c) + +/* Register Fields */ +#define NPCM_GMAC_MII_ADDR_BUSY BIT(0) +#define NPCM_GMAC_MII_ADDR_WRITE BIT(1) +#define NPCM_GMAC_MII_ADDR_GR(rv) extract16((rv), 6, 5) +#define NPCM_GMAC_MII_ADDR_PA(rv) extract16((rv), 11, 5) + +#define NPCM_GMAC_INT_MASK_LPIIM BIT(10) +#define NPCM_GMAC_INT_MASK_PMTM BIT(3) +#define NPCM_GMAC_INT_MASK_RGIM BIT(0) + +#define NPCM_DMA_BUS_MODE_SWR BIT(0) + +static const uint32_t npcm_gmac_cold_reset_values[NPCM_GMAC_NR_REGS] =3D { + /* Reduce version to 3.2 so that the kernel can enable interrupt. */ + [R_NPCM_GMAC_VERSION] =3D 0x00001032, + [R_NPCM_GMAC_TIMER_CTRL] =3D 0x03e80000, + [R_NPCM_GMAC_MAC0_ADDR_HI] =3D 0x8000ffff, + [R_NPCM_GMAC_MAC0_ADDR_LO] =3D 0xffffffff, + [R_NPCM_GMAC_MAC1_ADDR_HI] =3D 0x0000ffff, + [R_NPCM_GMAC_MAC1_ADDR_LO] =3D 0xffffffff, + [R_NPCM_GMAC_MAC2_ADDR_HI] =3D 0x0000ffff, + [R_NPCM_GMAC_MAC2_ADDR_LO] =3D 0xffffffff, + [R_NPCM_GMAC_MAC3_ADDR_HI] =3D 0x0000ffff, + [R_NPCM_GMAC_MAC3_ADDR_LO] =3D 0xffffffff, + [R_NPCM_GMAC_PTP_TCR] =3D 0x00002000, + [R_NPCM_DMA_BUS_MODE] =3D 0x00020101, + [R_NPCM_DMA_HW_FEATURE] =3D 0x100d4f37, +}; + +static const uint16_t phy_reg_init[] =3D { + [MII_BMCR] =3D MII_BMCR_AUTOEN | MII_BMCR_FD | MII_BMCR_SPEED1000, + [MII_BMSR] =3D MII_BMSR_100TX_FD | MII_BMSR_100TX_HD | MII_BMSR_1= 0T_FD | + MII_BMSR_10T_HD | MII_BMSR_EXTSTAT | MII_BMSR_AUTONE= G | + MII_BMSR_LINK_ST | MII_BMSR_EXTCAP, + [MII_PHYID1] =3D 0x0362, + [MII_PHYID2] =3D 0x5e6a, + [MII_ANAR] =3D MII_ANAR_TXFD | MII_ANAR_TX | MII_ANAR_10FD | + MII_ANAR_10 | MII_ANAR_CSMACD, + [MII_ANLPAR] =3D MII_ANLPAR_ACK | MII_ANLPAR_PAUSE | + MII_ANLPAR_TXFD | MII_ANLPAR_TX | MII_ANLPAR_10FD | + MII_ANLPAR_10 | MII_ANLPAR_CSMACD, + [MII_ANER] =3D 0x64 | MII_ANER_NWAY, + [MII_ANNP] =3D 0x2001, + [MII_CTRL1000] =3D MII_CTRL1000_FULL, + [MII_STAT1000] =3D MII_STAT1000_FULL, + [MII_EXTSTAT] =3D 0x3000, /* 1000BASTE_T full-duplex capable */ +}; + +static void npcm_gmac_soft_reset(NPCMGMACState *gmac) +{ + memcpy(gmac->regs, npcm_gmac_cold_reset_values, + NPCM_GMAC_NR_REGS * sizeof(uint32_t)); + /* Clear reset bits */ + gmac->regs[R_NPCM_DMA_BUS_MODE] &=3D ~NPCM_DMA_BUS_MODE_SWR; +} + +static void gmac_phy_set_link(NPCMGMACState *gmac, bool active) +{ + /* Autonegotiation status mirrors link status. */ + if (active) { + gmac->phy_regs[0][MII_BMSR] |=3D (MII_BMSR_LINK_ST | MII_BMSR_AN_C= OMP); + } else { + gmac->phy_regs[0][MII_BMSR] &=3D ~(MII_BMSR_LINK_ST | MII_BMSR_AN_= COMP); + } +} + +static bool gmac_can_receive(NetClientState *nc) +{ + return true; +} + +/* + * Function that updates the GMAC IRQ + * It find the logical OR of the enabled bits for NIS (if enabled) + * It find the logical OR of the enabled bits for AIS (if enabled) + */ +static void gmac_update_irq(NPCMGMACState *gmac) +{ + /* + * Check if the normal interrupts summary is enabled + * if so, add the bits for the summary that are enabled + */ + if (gmac->regs[R_NPCM_DMA_INTR_ENA] & gmac->regs[R_NPCM_DMA_STATUS] & + (NPCM_DMA_INTR_ENAB_NIE_BITS)) { + gmac->regs[R_NPCM_DMA_STATUS] |=3D NPCM_DMA_STATUS_NIS; + } + /* + * Check if the abnormal interrupts summary is enabled + * if so, add the bits for the summary that are enabled + */ + if (gmac->regs[R_NPCM_DMA_INTR_ENA] & gmac->regs[R_NPCM_DMA_STATUS] & + (NPCM_DMA_INTR_ENAB_AIE_BITS)) { + gmac->regs[R_NPCM_DMA_STATUS] |=3D NPCM_DMA_STATUS_AIS; + } + + /* Get the logical OR of both normal and abnormal interrupts */ + int level =3D !!((gmac->regs[R_NPCM_DMA_STATUS] & + gmac->regs[R_NPCM_DMA_INTR_ENA] & + NPCM_DMA_STATUS_NIS) | + (gmac->regs[R_NPCM_DMA_STATUS] & + gmac->regs[R_NPCM_DMA_INTR_ENA] & + NPCM_DMA_STATUS_AIS)); + + /* Set the IRQ */ + trace_npcm_gmac_update_irq(DEVICE(gmac)->canonical_path, + gmac->regs[R_NPCM_DMA_STATUS], + gmac->regs[R_NPCM_DMA_INTR_ENA], + level); + qemu_set_irq(gmac->irq, level); +} + +static ssize_t gmac_receive(NetClientState *nc, const uint8_t *buf, size_t= len) +{ + /* Placeholder. Function will be filled in following patches */ + return 0; +} + +static void gmac_cleanup(NetClientState *nc) +{ + /* Nothing to do yet. */ +} + +static void gmac_set_link(NetClientState *nc) +{ + NPCMGMACState *gmac =3D qemu_get_nic_opaque(nc); + + trace_npcm_gmac_set_link(!nc->link_down); + gmac_phy_set_link(gmac, !nc->link_down); +} + +static void npcm_gmac_mdio_access(NPCMGMACState *gmac, uint16_t v) +{ + bool busy =3D v & NPCM_GMAC_MII_ADDR_BUSY; + uint8_t is_write; + uint8_t pa, gr; + uint16_t data; + + if (busy) { + is_write =3D v & NPCM_GMAC_MII_ADDR_WRITE; + pa =3D NPCM_GMAC_MII_ADDR_PA(v); + gr =3D NPCM_GMAC_MII_ADDR_GR(v); + /* Both pa and gr are 5 bits, so they are less than 32. */ + g_assert(pa < NPCM_GMAC_MAX_PHYS); + g_assert(gr < NPCM_GMAC_MAX_PHY_REGS); + + + if (v & NPCM_GMAC_MII_ADDR_WRITE) { + data =3D gmac->regs[R_NPCM_GMAC_MII_DATA]; + /* Clear reset bit for BMCR register */ + switch (gr) { + case MII_BMCR: + data &=3D ~MII_BMCR_RESET; + /* Autonegotiation is a W1C bit*/ + if (data & MII_BMCR_ANRESTART) { + /* Tells autonegotiation to not restart again */ + data &=3D ~MII_BMCR_ANRESTART; + } + if ((data & MII_BMCR_AUTOEN) && + !(gmac->phy_regs[pa][MII_BMSR] & MII_BMSR_AN_COMP)) { + /* sets autonegotiation as complete */ + gmac->phy_regs[pa][MII_BMSR] |=3D MII_BMSR_AN_COMP; + /* Resolve AN automatically->need to set this */ + gmac->phy_regs[0][MII_ANLPAR] =3D 0x0000; + } + } + gmac->phy_regs[pa][gr] =3D data; + } else { + data =3D gmac->phy_regs[pa][gr]; + gmac->regs[R_NPCM_GMAC_MII_DATA] =3D data; + } + trace_npcm_gmac_mdio_access(DEVICE(gmac)->canonical_path, is_write= , pa, + gr, data); + } + gmac->regs[R_NPCM_GMAC_MII_ADDR] =3D v & ~NPCM_GMAC_MII_ADDR_BUSY; +} + +static uint64_t npcm_gmac_read(void *opaque, hwaddr offset, unsigned size) +{ + NPCMGMACState *gmac =3D opaque; + uint32_t v =3D 0; + + switch (offset) { + /* Write only registers */ + case A_NPCM_DMA_XMT_POLL_DEMAND: + case A_NPCM_DMA_RCV_POLL_DEMAND: + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Read of write-only reg: offset: 0x%04" HWADDR_P= RIx + "\n", DEVICE(gmac)->canonical_path, offset); + break; + + default: + v =3D gmac->regs[offset / sizeof(uint32_t)]; + } + + trace_npcm_gmac_reg_read(DEVICE(gmac)->canonical_path, offset, v); + return v; +} + +static void npcm_gmac_write(void *opaque, hwaddr offset, + uint64_t v, unsigned size) +{ + NPCMGMACState *gmac =3D opaque; + + trace_npcm_gmac_reg_write(DEVICE(gmac)->canonical_path, offset, v); + + switch (offset) { + /* Read only registers */ + case A_NPCM_GMAC_VERSION: + case A_NPCM_GMAC_INT_STATUS: + case A_NPCM_GMAC_RGMII_STATUS: + case A_NPCM_GMAC_PTP_STSR: + case A_NPCM_GMAC_PTP_STNSR: + case A_NPCM_DMA_MISSED_FRAME_CTR: + case A_NPCM_DMA_HOST_TX_DESC: + case A_NPCM_DMA_HOST_RX_DESC: + case A_NPCM_DMA_CUR_TX_BUF_ADDR: + case A_NPCM_DMA_CUR_RX_BUF_ADDR: + case A_NPCM_DMA_HW_FEATURE: + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Write of read-only reg: offset: 0x%04" HWADDR_P= RIx + ", value: 0x%04" PRIx64 "\n", + DEVICE(gmac)->canonical_path, offset, v); + break; + + case A_NPCM_GMAC_MAC_CONFIG: + break; + + case A_NPCM_GMAC_MII_ADDR: + npcm_gmac_mdio_access(gmac, v); + break; + + case A_NPCM_GMAC_MAC0_ADDR_HI: + gmac->regs[offset / sizeof(uint32_t)] =3D v; + gmac->conf.macaddr.a[0] =3D v >> 8; + gmac->conf.macaddr.a[1] =3D v >> 0; + break; + + case A_NPCM_GMAC_MAC0_ADDR_LO: + gmac->regs[offset / sizeof(uint32_t)] =3D v; + gmac->conf.macaddr.a[2] =3D v >> 24; + gmac->conf.macaddr.a[3] =3D v >> 16; + gmac->conf.macaddr.a[4] =3D v >> 8; + gmac->conf.macaddr.a[5] =3D v >> 0; + break; + + case A_NPCM_GMAC_MAC1_ADDR_HI: + case A_NPCM_GMAC_MAC1_ADDR_LO: + case A_NPCM_GMAC_MAC2_ADDR_HI: + case A_NPCM_GMAC_MAC2_ADDR_LO: + case A_NPCM_GMAC_MAC3_ADDR_HI: + case A_NPCM_GMAC_MAC3_ADDR_LO: + gmac->regs[offset / sizeof(uint32_t)] =3D v; + qemu_log_mask(LOG_UNIMP, + "%s: Only MAC Address 0 is supported. This request " + "is ignored.\n", DEVICE(gmac)->canonical_path); + break; + + case A_NPCM_DMA_BUS_MODE: + gmac->regs[offset / sizeof(uint32_t)] =3D v; + if (v & NPCM_DMA_BUS_MODE_SWR) { + npcm_gmac_soft_reset(gmac); + } + break; + + case A_NPCM_DMA_RCV_POLL_DEMAND: + /* We dont actually care about the value */ + break; + + case A_NPCM_DMA_STATUS: + /* Check that RO bits are not written to */ + if (NPCM_DMA_STATUS_RO_MASK(v)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Write of read-only bits of reg: offset: 0x%= 04" + HWADDR_PRIx ", value: 0x%04" PRIx64 "\n", + DEVICE(gmac)->canonical_path, offset, v); + } + break; + + default: + gmac->regs[offset / sizeof(uint32_t)] =3D v; + break; + } + + gmac_update_irq(gmac); +} + +static void npcm_gmac_reset(DeviceState *dev) +{ + NPCMGMACState *gmac =3D NPCM_GMAC(dev); + + npcm_gmac_soft_reset(gmac); + memcpy(gmac->phy_regs[0], phy_reg_init, sizeof(phy_reg_init)); + + trace_npcm_gmac_reset(DEVICE(gmac)->canonical_path, + gmac->phy_regs[0][MII_BMSR]); +} + +static NetClientInfo net_npcm_gmac_info =3D { + .type =3D NET_CLIENT_DRIVER_NIC, + .size =3D sizeof(NICState), + .can_receive =3D gmac_can_receive, + .receive =3D gmac_receive, + .cleanup =3D gmac_cleanup, + .link_status_changed =3D gmac_set_link, +}; + +static const struct MemoryRegionOps npcm_gmac_ops =3D { + .read =3D npcm_gmac_read, + .write =3D npcm_gmac_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .valid =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + .unaligned =3D false, + }, +}; + +static void npcm_gmac_realize(DeviceState *dev, Error **errp) +{ + NPCMGMACState *gmac =3D NPCM_GMAC(dev); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); + + memory_region_init_io(&gmac->iomem, OBJECT(gmac), &npcm_gmac_ops, gmac, + TYPE_NPCM_GMAC, 8 * KiB); + sysbus_init_mmio(sbd, &gmac->iomem); + sysbus_init_irq(sbd, &gmac->irq); + + qemu_macaddr_default_if_unset(&gmac->conf.macaddr); + + gmac->nic =3D qemu_new_nic(&net_npcm_gmac_info, &gmac->conf, TYPE_NPCM= _GMAC, + dev->id, &dev->mem_reentrancy_guard, gmac); + qemu_format_nic_info_str(qemu_get_queue(gmac->nic), gmac->conf.macaddr= .a); + gmac->regs[R_NPCM_GMAC_MAC0_ADDR_HI] =3D (gmac->conf.macaddr.a[0] << 8= ) + \ + gmac->conf.macaddr.a[1]; + gmac->regs[R_NPCM_GMAC_MAC0_ADDR_LO] =3D (gmac->conf.macaddr.a[2] << 2= 4) + \ + (gmac->conf.macaddr.a[3] << 16)= + \ + (gmac->conf.macaddr.a[4] << 8) = + \ + gmac->conf.macaddr.a[5]; +} + +static void npcm_gmac_unrealize(DeviceState *dev) +{ + NPCMGMACState *gmac =3D NPCM_GMAC(dev); + + qemu_del_nic(gmac->nic); +} + +static const VMStateDescription vmstate_npcm_gmac =3D { + .name =3D TYPE_NPCM_GMAC, + .version_id =3D 0, + .minimum_version_id =3D 0, + .fields =3D (VMStateField[]) { + VMSTATE_UINT32_ARRAY(regs, NPCMGMACState, NPCM_GMAC_NR_REGS), + VMSTATE_END_OF_LIST(), + }, +}; + +static Property npcm_gmac_properties[] =3D { + DEFINE_NIC_PROPERTIES(NPCMGMACState, conf), + DEFINE_PROP_END_OF_LIST(), +}; + +static void npcm_gmac_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); + dc->desc =3D "NPCM GMAC Controller"; + dc->realize =3D npcm_gmac_realize; + dc->unrealize =3D npcm_gmac_unrealize; + dc->reset =3D npcm_gmac_reset; + dc->vmsd =3D &vmstate_npcm_gmac; + device_class_set_props(dc, npcm_gmac_properties); +} + +static const TypeInfo npcm_gmac_types[] =3D { + { + .name =3D TYPE_NPCM_GMAC, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(NPCMGMACState), + .class_init =3D npcm_gmac_class_init, + }, +}; +DEFINE_TYPES(npcm_gmac_types) diff --git a/hw/net/meson.build b/hw/net/meson.build index 9afceb06191..d4e1dc98389 100644 --- a/hw/net/meson.build +++ b/hw/net/meson.build @@ -38,7 +38,7 @@ system_ss.add(when: 'CONFIG_I82596_COMMON', if_true: file= s('i82596.c')) system_ss.add(when: 'CONFIG_SUNHME', if_true: files('sunhme.c')) system_ss.add(when: 'CONFIG_FTGMAC100', if_true: files('ftgmac100.c')) system_ss.add(when: 'CONFIG_SUNGEM', if_true: files('sungem.c')) -system_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_emc.c')) +system_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_emc.c', 'npc= m_gmac.c')) =20 system_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_eth.c')) system_ss.add(when: 'CONFIG_COLDFIRE', if_true: files('mcf_fec.c')) diff --git a/hw/net/trace-events b/hw/net/trace-events index 387e32e1533..56057de47f3 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -467,6 +467,18 @@ npcm7xx_emc_rx_done(uint32_t crxdsa) "RX done, CRXDSA= =3D0x%x" npcm7xx_emc_reg_read(int emc_num, uint32_t result, const char *name, int r= egno) "emc%d: 0x%x =3D reg[%s/%d]" npcm7xx_emc_reg_write(int emc_num, const char *name, int regno, uint32_t v= alue) "emc%d: reg[%s/%d] =3D 0x%x" =20 +# npcm_gmac.c +npcm_gmac_reg_read(const char *name, uint64_t offset, uint32_t value) "%s:= offset: 0x%04" PRIx64 " value: 0x%04" PRIx32 +npcm_gmac_reg_write(const char *name, uint64_t offset, uint32_t value) "%s= : offset: 0x%04" PRIx64 " value: 0x%04" PRIx32 +npcm_gmac_mdio_access(const char *name, uint8_t is_write, uint8_t pa, uint= 8_t gr, uint16_t val) "%s: is_write: %" PRIu8 " pa: %" PRIu8 " gr: %" PRIu8= " val: 0x%04" PRIx16 +npcm_gmac_reset(const char *name, uint16_t value) "%s: phy_regs[0][1]: 0x%= 04" PRIx16 +npcm_gmac_set_link(bool active) "Set link: active=3D%u" +npcm_gmac_update_irq(const char *name, uint32_t status, uint32_t intr_en, = int level) "%s: Status Reg: 0x%04" PRIX32 " Interrupt Enable Reg: 0x%04" PR= IX32 " IRQ Set: %d" + +# npcm_pcs.c +npcm_pcs_reg_read(const char *name, uint16_t indirect_access_baes, uint64_= t offset, uint16_t value) "%s: IND: 0x%02" PRIx16 " offset: 0x%04" PRIx64 "= value: 0x%04" PRIx16 +npcm_pcs_reg_write(const char *name, uint16_t indirect_access_baes, uint64= _t offset, uint16_t value) "%s: IND: 0x%02" PRIx16 " offset: 0x%04" PRIx64 = " value: 0x%04" PRIx16 + # dp8398x.c dp8393x_raise_irq(int isr) "raise irq, isr is 0x%04x" dp8393x_lower_irq(void) "lower irq" --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888257; cv=none; d=zohomail.com; s=zohoarc; b=hKcvzUbELl3RxexZY8SOpLVoKJBrYRW6PtKiPHLskVCdtQGxm6bo1XCf8s7Fjs3MCfL6lcrC8igE0K9blGVuE1XF3M+MFK9+nBloqsayk1JLXKRWCXUh7H0AzzQQdGRzVuVqqwiqV9lxO9CN9mLamQFZ8kugg2xuZNaCCTqwOuw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888257; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=N2NuZPUzpaElmLZXmhDdPQ/KTGn+fUluVp/XA+iMwnU=; b=gP9TIe6KiKNe2VlesQn/HYChVGWWMAbXTcSvvmlV2vbdKguC+kmpQppmXApahFIwnJaePnootCLkrO7jOXygw2nKIkZkRlVE9QsXg5KLdqR+P9JCYzg/PZS1+kOYYk+1Xprp/SG8w3Fl/Ds+D/QvrHB78r0R+x83vvgjQsKQHJw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888257885828.3234726151502; Fri, 2 Feb 2024 07:37:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb9-0000Wa-Ls; Fri, 02 Feb 2024 10:36:59 -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 1rVvb6-0000Ni-E9 for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:56 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb4-0004Xr-PI for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:56 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40e80046246so5453885e9.1 for ; Fri, 02 Feb 2024 07:36:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888212; x=1707493012; 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=N2NuZPUzpaElmLZXmhDdPQ/KTGn+fUluVp/XA+iMwnU=; b=cssNInM2L+Z9U6BolKS9doMzY3z+NWkXnGE5pGGqmKdpx+yHdIPvHKZGLWV/Fht7AI enhnNnOcfKAOB2XagoZNMZ8hEkf7c4q/Z2mlcqNKfYzfV4ntV/9/gcQiLZL+JLln3pEd z8JeqUK5ZESruHJG2x1qi9/0kE2tLye0RMtc5/PgnDWtBhTt+d9S2IrMpv/eJ4l8C7vh /IuLKU1i1tYsXsMO+6Xvp+H2Y2N8NvLg/ATK+cVWnN/Lb7AK3JNfbHsx+eR3LoEkNOUq Iek7+nrtCMckUvRA7Vu+6urGhkv9wFj9OozpVep4a5DYhumki+zp+tpbYEOY0/5DmW+5 jJ8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888212; x=1707493012; 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=N2NuZPUzpaElmLZXmhDdPQ/KTGn+fUluVp/XA+iMwnU=; b=vnmLxWMLPWProJ1x5Q8Fjh2JWzu9jKDjQgpDbISPdLBjk2VgKRBX8B3pi5lFeGa42o 1Wp5KWjWXlLMiC/Y4ljKPJblT2x8R1E4ZI9HOkEmzq2HpsYXdvzsccZflCoFiIInPCUy Wlq6kMLApslwOQ6yLVw1W4j4r8FfHP8WwS0FzMXUBq7a+j3rw97hWBuJi3ZcYWwI5A99 qlEUhXOV+Fpj6OLXVT76LA4003RgHIjebKToHJxcQVrc58FGwwNPXm4g/D0V3gFXqohm BaLP6W+YKal9XU5pRP+5TnWmsIyTykjTFzqwHRuMgkBPR84oUfkJGYWVJSJhw5IN5d/0 4pxQ== X-Gm-Message-State: AOJu0Yxn+Ly/rqX4YluDI7aICvJAEE2iTus75EJTVGb9amP3v1JUwiPE id4FY6B9WjY6HyNoWFqB9NYgLqKrEuLA2reX1IoikPQOve/y/WZ0R6BS4eN0kzftc62iU5ZwTrs m X-Google-Smtp-Source: AGHT+IF6m2BSDq6wwrIBeeTFYdr5LdfI6dD60b7ElW8150FKyFUFeLYI1s4PQDo8cnnr2GoDoukwXA== X-Received: by 2002:a05:600c:458f:b0:40f:b2ba:b893 with SMTP id r15-20020a05600c458f00b0040fb2bab893mr2217169wmo.1.1706888212504; Fri, 02 Feb 2024 07:36:52 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/36] hw/arm: Add GMAC devices to NPCM7XX SoC Date: Fri, 2 Feb 2024 15:36:31 +0000 Message-Id: <20240202153637.3710444-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888259803100007 Content-Type: text/plain; charset="utf-8" From: Hao Wu Change-Id: Id8a3461fb5042adc4c3fd6f4fbd1ca0d33e22565 Signed-off-by: Hao Wu Signed-off-by: Nabih Estefan Reviewed-by: Tyrone Ting Message-id: 20240131002800.989285-3-nabihestefan@google.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/arm/npcm7xx.h | 2 ++ hw/arm/npcm7xx.c | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/include/hw/arm/npcm7xx.h b/include/hw/arm/npcm7xx.h index 72c77220964..4e0d2101885 100644 --- a/include/hw/arm/npcm7xx.h +++ b/include/hw/arm/npcm7xx.h @@ -29,6 +29,7 @@ #include "hw/misc/npcm7xx_pwm.h" #include "hw/misc/npcm7xx_rng.h" #include "hw/net/npcm7xx_emc.h" +#include "hw/net/npcm_gmac.h" #include "hw/nvram/npcm7xx_otp.h" #include "hw/timer/npcm7xx_timer.h" #include "hw/ssi/npcm7xx_fiu.h" @@ -104,6 +105,7 @@ struct NPCM7xxState { OHCISysBusState ohci; NPCM7xxFIUState fiu[2]; NPCM7xxEMCState emc[2]; + NPCMGMACState gmac[2]; NPCM7xxSDHCIState mmc; NPCMPSPIState pspi[2]; }; diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c index e3243a520d8..d9dfdfcd51a 100644 --- a/hw/arm/npcm7xx.c +++ b/hw/arm/npcm7xx.c @@ -84,8 +84,10 @@ enum NPCM7xxInterrupt { NPCM7XX_UART1_IRQ, NPCM7XX_UART2_IRQ, NPCM7XX_UART3_IRQ, + NPCM7XX_GMAC1_IRQ =3D 14, NPCM7XX_EMC1RX_IRQ =3D 15, NPCM7XX_EMC1TX_IRQ, + NPCM7XX_GMAC2_IRQ, NPCM7XX_MMC_IRQ =3D 26, NPCM7XX_PSPI2_IRQ =3D 28, NPCM7XX_PSPI1_IRQ =3D 31, @@ -229,6 +231,12 @@ static const hwaddr npcm7xx_pspi_addr[] =3D { 0xf0201000, }; =20 +/* Register base address for each GMAC Module */ +static const hwaddr npcm7xx_gmac_addr[] =3D { + 0xf0802000, + 0xf0804000, +}; + static const struct { hwaddr regs_addr; uint32_t unconnected_pins; @@ -457,6 +465,10 @@ static void npcm7xx_init(Object *obj) object_initialize_child(obj, "pspi[*]", &s->pspi[i], TYPE_NPCM_PSP= I); } =20 + for (i =3D 0; i < ARRAY_SIZE(s->gmac); i++) { + object_initialize_child(obj, "gmac[*]", &s->gmac[i], TYPE_NPCM_GMA= C); + } + object_initialize_child(obj, "mmc", &s->mmc, TYPE_NPCM7XX_SDHCI); } =20 @@ -688,6 +700,29 @@ static void npcm7xx_realize(DeviceState *dev, Error **= errp) sysbus_connect_irq(sbd, 1, npcm7xx_irq(s, rx_irq)); } =20 + /* + * GMAC Modules. Cannot fail. + */ + QEMU_BUILD_BUG_ON(ARRAY_SIZE(npcm7xx_gmac_addr) !=3D ARRAY_SIZE(s->gma= c)); + QEMU_BUILD_BUG_ON(ARRAY_SIZE(s->gmac) !=3D 2); + for (i =3D 0; i < ARRAY_SIZE(s->gmac); i++) { + SysBusDevice *sbd =3D SYS_BUS_DEVICE(&s->gmac[i]); + + /* + * The device exists regardless of whether it's connected to a QEMU + * netdev backend. So always instantiate it even if there is no + * backend. + */ + sysbus_realize(sbd, &error_abort); + sysbus_mmio_map(sbd, 0, npcm7xx_gmac_addr[i]); + int irq =3D i =3D=3D 0 ? NPCM7XX_GMAC1_IRQ : NPCM7XX_GMAC2_IRQ; + /* + * N.B. The values for the second argument sysbus_connect_irq are + * chosen to match the registration order in npcm7xx_emc_realize. + */ + sysbus_connect_irq(sbd, 0, npcm7xx_irq(s, irq)); + } + /* * Flash Interface Unit (FIU). Can fail if incorrect number of chip se= lects * specified, but this is a programming error. @@ -750,8 +785,6 @@ static void npcm7xx_realize(DeviceState *dev, Error **e= rrp) create_unimplemented_device("npcm7xx.siox[2]", 0xf0102000, 4 * = KiB); create_unimplemented_device("npcm7xx.ahbpci", 0xf0400000, 1 * = MiB); create_unimplemented_device("npcm7xx.mcphy", 0xf05f0000, 64 * = KiB); - create_unimplemented_device("npcm7xx.gmac1", 0xf0802000, 8 * = KiB); - create_unimplemented_device("npcm7xx.gmac2", 0xf0804000, 8 * = KiB); create_unimplemented_device("npcm7xx.vcd", 0xf0810000, 64 * = KiB); create_unimplemented_device("npcm7xx.ece", 0xf0820000, 8 * = KiB); create_unimplemented_device("npcm7xx.vdma", 0xf0822000, 8 * = KiB); --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888344; cv=none; d=zohomail.com; s=zohoarc; b=hlYJqmOj1+kSGjrHMUcSGBBS5PxltiRkzZYU/f/55A1ldGva9PcoNsYQi66g9YF8ieH6K4s2UeaElvVEfy+wrKrV//rQY/rNZja7ooDof7Z6N2P1Mk9/GjkwsFiuzFtD6d+coHdFbjXm12Oh9GWicnaqinStKgCKqEM6rje/s8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888344; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=2Ty1T3rBfJ7VP6HS7xDAhOzK8fPZrj+w66iO5T97BjM=; b=k+L5myiqnAo/RS+Na2u76rtpQ6+Udb1uFQkBv2tZhRjq4ZyoaNB4/FafiXO0CdYiBSyibee+NpFk0+ONv7rjWi42xNbaS7gUbHoIBABlEIivObt0nME4QY6C5NjG989rNyMYDUb8FpcU3BoC3YYQ/DD74dCGkRQo7XRArRcKx7k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170688834420097.04208503718394; Fri, 2 Feb 2024 07:39:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvbC-0000lU-F8; Fri, 02 Feb 2024 10:37:02 -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 1rVvb7-0000Ox-Cy for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:57 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb5-0004Y7-D5 for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:57 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40e7e2e04f0so19509855e9.1 for ; Fri, 02 Feb 2024 07:36:54 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888213; x=1707493013; 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=2Ty1T3rBfJ7VP6HS7xDAhOzK8fPZrj+w66iO5T97BjM=; b=k6h5AF2UDPkZJZbxK70gHsWAJlhhUyb3kWPZ7aZb7EB5CprfSOfKdvlkk0qbZWv6Cy Ji0lNaBmCHswJQbfbuSZx6Q/66AYDlIAmSKYnmRbyEAPbXP1j6mNIZo3RdA109c8o1U7 la1YxvbLdnFvZDRE/UexJ+XLCm5gLS4lq8yVluWgokuVMa4dtDp1IRfw6oshVsvbA09J 5EYLdjr1ppWPnkyY0kvlujj1kMzGR6FE30/8zd9B9yC7IEGCWNKMSTsz9PLyTQ73EaeC VjqSbe40qQcggcYTX+pWWEWVQv+vaHPuA4DskrsGSrXtEm03vcS8VBpx3GF4/wDj0CTk go/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888213; x=1707493013; 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=2Ty1T3rBfJ7VP6HS7xDAhOzK8fPZrj+w66iO5T97BjM=; b=AwNdq636A89UTLzZ2wssB/tb0wd04VEsEbHtZTrlAO12a135nx+HhBfwiw44/Q2034 DvFgyMsexF7z/G/GHpdTUc8BnQr5r0Ftw/zK8IYAruc4uYhvSt3ZZlmGiELLaLUTrRwz kJVhkVcyysU+pm72mJbUm6MBKqfU6nkvyvTFYkD6TzxtlJF/cFfKibFbNW+iguySIp09 ic75g9aLE8Zh4jDnvZzJL9Jix8/sAPnf9tQVq+qASqf0Jt6HlUy+fTLSxSG8m4F+gQmt G08DXkBmb2EaaS6Kf6MS6Aocd/Gas4SGYYiuLf1CFo9dA5XWwmxafy5kwutIdW8Jow6/ Tg3g== X-Gm-Message-State: AOJu0YwZCqc4Wk/6FdtHIjupdpIPU+uT1gnRDoXZ7Lbn9bxDWsiQpUNZ Js+UaSbjewugCbBsxv0/t3FJY45OiTfC98DRtclvACANwAGCywjgPP2afI8reV70q7lyj97r8kY v X-Google-Smtp-Source: AGHT+IGrkllliFUHeRJr5sVFGNMCWvqKtrveZIeKiAabptKBQ6Y0xrp4pkDQHrQflxKZHGnK/LTbAQ== X-Received: by 2002:a05:600c:45c8:b0:40f:b03d:86b8 with SMTP id s8-20020a05600c45c800b0040fb03d86b8mr1794117wmo.28.1706888212956; Fri, 02 Feb 2024 07:36:52 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 31/36] tests/qtest: Creating qtest for GMAC Module Date: Fri, 2 Feb 2024 15:36:32 +0000 Message-Id: <20240202153637.3710444-32-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888346101100001 Content-Type: text/plain; charset="utf-8" From: Nabih Estefan Diaz - Created qtest to check initialization of registers in GMAC Module. - Implemented test into Build File. Change-Id: I8b2fe152d3987a7eec4cf6a1d25ba92e75a5391d Signed-off-by: Nabih Estefan Reviewed-by: Tyrone Ting Message-id: 20240131002800.989285-4-nabihestefan@google.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- tests/qtest/npcm_gmac-test.c | 212 +++++++++++++++++++++++++++++++++++ tests/qtest/meson.build | 1 + 2 files changed, 213 insertions(+) create mode 100644 tests/qtest/npcm_gmac-test.c diff --git a/tests/qtest/npcm_gmac-test.c b/tests/qtest/npcm_gmac-test.c new file mode 100644 index 00000000000..72c68874dfa --- /dev/null +++ b/tests/qtest/npcm_gmac-test.c @@ -0,0 +1,212 @@ +/* + * QTests for Nuvoton NPCM7xx/8xx GMAC Modules. + * + * Copyright 2024 Google LLC + * Authors: + * Hao Wu + * Nabih Estefan + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WIT= HOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "qemu/osdep.h" +#include "libqos/libqos.h" + +/* Name of the GMAC Device */ +#define TYPE_NPCM_GMAC "npcm-gmac" + +typedef struct GMACModule { + int irq; + uint64_t base_addr; +} GMACModule; + +typedef struct TestData { + const GMACModule *module; +} TestData; + +/* Values extracted from hw/arm/npcm8xx.c */ +static const GMACModule gmac_module_list[] =3D { + { + .irq =3D 14, + .base_addr =3D 0xf0802000 + }, + { + .irq =3D 15, + .base_addr =3D 0xf0804000 + }, + { + .irq =3D 16, + .base_addr =3D 0xf0806000 + }, + { + .irq =3D 17, + .base_addr =3D 0xf0808000 + } +}; + +/* Returns the index of the GMAC module. */ +static int gmac_module_index(const GMACModule *mod) +{ + ptrdiff_t diff =3D mod - gmac_module_list; + + g_assert_true(diff >=3D 0 && diff < ARRAY_SIZE(gmac_module_list)); + + return diff; +} + +/* 32-bit register indices. Taken from npcm_gmac.c */ +typedef enum NPCMRegister { + /* DMA Registers */ + NPCM_DMA_BUS_MODE =3D 0x1000, + NPCM_DMA_XMT_POLL_DEMAND =3D 0x1004, + NPCM_DMA_RCV_POLL_DEMAND =3D 0x1008, + NPCM_DMA_RCV_BASE_ADDR =3D 0x100c, + NPCM_DMA_TX_BASE_ADDR =3D 0x1010, + NPCM_DMA_STATUS =3D 0x1014, + NPCM_DMA_CONTROL =3D 0x1018, + NPCM_DMA_INTR_ENA =3D 0x101c, + NPCM_DMA_MISSED_FRAME_CTR =3D 0x1020, + NPCM_DMA_HOST_TX_DESC =3D 0x1048, + NPCM_DMA_HOST_RX_DESC =3D 0x104c, + NPCM_DMA_CUR_TX_BUF_ADDR =3D 0x1050, + NPCM_DMA_CUR_RX_BUF_ADDR =3D 0x1054, + NPCM_DMA_HW_FEATURE =3D 0x1058, + + /* GMAC Registers */ + NPCM_GMAC_MAC_CONFIG =3D 0x0, + NPCM_GMAC_FRAME_FILTER =3D 0x4, + NPCM_GMAC_HASH_HIGH =3D 0x8, + NPCM_GMAC_HASH_LOW =3D 0xc, + NPCM_GMAC_MII_ADDR =3D 0x10, + NPCM_GMAC_MII_DATA =3D 0x14, + NPCM_GMAC_FLOW_CTRL =3D 0x18, + NPCM_GMAC_VLAN_FLAG =3D 0x1c, + NPCM_GMAC_VERSION =3D 0x20, + NPCM_GMAC_WAKEUP_FILTER =3D 0x28, + NPCM_GMAC_PMT =3D 0x2c, + NPCM_GMAC_LPI_CTRL =3D 0x30, + NPCM_GMAC_TIMER_CTRL =3D 0x34, + NPCM_GMAC_INT_STATUS =3D 0x38, + NPCM_GMAC_INT_MASK =3D 0x3c, + NPCM_GMAC_MAC0_ADDR_HI =3D 0x40, + NPCM_GMAC_MAC0_ADDR_LO =3D 0x44, + NPCM_GMAC_MAC1_ADDR_HI =3D 0x48, + NPCM_GMAC_MAC1_ADDR_LO =3D 0x4c, + NPCM_GMAC_MAC2_ADDR_HI =3D 0x50, + NPCM_GMAC_MAC2_ADDR_LO =3D 0x54, + NPCM_GMAC_MAC3_ADDR_HI =3D 0x58, + NPCM_GMAC_MAC3_ADDR_LO =3D 0x5c, + NPCM_GMAC_RGMII_STATUS =3D 0xd8, + NPCM_GMAC_WATCHDOG =3D 0xdc, + NPCM_GMAC_PTP_TCR =3D 0x700, + NPCM_GMAC_PTP_SSIR =3D 0x704, + NPCM_GMAC_PTP_STSR =3D 0x708, + NPCM_GMAC_PTP_STNSR =3D 0x70c, + NPCM_GMAC_PTP_STSUR =3D 0x710, + NPCM_GMAC_PTP_STNSUR =3D 0x714, + NPCM_GMAC_PTP_TAR =3D 0x718, + NPCM_GMAC_PTP_TTSR =3D 0x71c, +} NPCMRegister; + +static uint32_t gmac_read(QTestState *qts, const GMACModule *mod, + NPCMRegister regno) +{ + return qtest_readl(qts, mod->base_addr + regno); +} + +/* Check that GMAC registers are reset to default value */ +static void test_init(gconstpointer test_data) +{ + const TestData *td =3D test_data; + const GMACModule *mod =3D td->module; + QTestState *qts =3D qtest_init("-machine npcm845-evb"); + +#define CHECK_REG32(regno, value) \ + do { \ + g_assert_cmphex(gmac_read(qts, mod, (regno)), =3D=3D, (value)); \ + } while (0) + + CHECK_REG32(NPCM_DMA_BUS_MODE, 0x00020100); + CHECK_REG32(NPCM_DMA_XMT_POLL_DEMAND, 0); + CHECK_REG32(NPCM_DMA_RCV_POLL_DEMAND, 0); + CHECK_REG32(NPCM_DMA_RCV_BASE_ADDR, 0); + CHECK_REG32(NPCM_DMA_TX_BASE_ADDR, 0); + CHECK_REG32(NPCM_DMA_STATUS, 0); + CHECK_REG32(NPCM_DMA_CONTROL, 0); + CHECK_REG32(NPCM_DMA_INTR_ENA, 0); + CHECK_REG32(NPCM_DMA_MISSED_FRAME_CTR, 0); + CHECK_REG32(NPCM_DMA_HOST_TX_DESC, 0); + CHECK_REG32(NPCM_DMA_HOST_RX_DESC, 0); + CHECK_REG32(NPCM_DMA_CUR_TX_BUF_ADDR, 0); + CHECK_REG32(NPCM_DMA_CUR_RX_BUF_ADDR, 0); + CHECK_REG32(NPCM_DMA_HW_FEATURE, 0x100d4f37); + + CHECK_REG32(NPCM_GMAC_MAC_CONFIG, 0); + CHECK_REG32(NPCM_GMAC_FRAME_FILTER, 0); + CHECK_REG32(NPCM_GMAC_HASH_HIGH, 0); + CHECK_REG32(NPCM_GMAC_HASH_LOW, 0); + CHECK_REG32(NPCM_GMAC_MII_ADDR, 0); + CHECK_REG32(NPCM_GMAC_MII_DATA, 0); + CHECK_REG32(NPCM_GMAC_FLOW_CTRL, 0); + CHECK_REG32(NPCM_GMAC_VLAN_FLAG, 0); + CHECK_REG32(NPCM_GMAC_VERSION, 0x00001032); + CHECK_REG32(NPCM_GMAC_WAKEUP_FILTER, 0); + CHECK_REG32(NPCM_GMAC_PMT, 0); + CHECK_REG32(NPCM_GMAC_LPI_CTRL, 0); + CHECK_REG32(NPCM_GMAC_TIMER_CTRL, 0x03e80000); + CHECK_REG32(NPCM_GMAC_INT_STATUS, 0); + CHECK_REG32(NPCM_GMAC_INT_MASK, 0); + CHECK_REG32(NPCM_GMAC_MAC0_ADDR_HI, 0x8000ffff); + CHECK_REG32(NPCM_GMAC_MAC0_ADDR_LO, 0xffffffff); + CHECK_REG32(NPCM_GMAC_MAC1_ADDR_HI, 0x0000ffff); + CHECK_REG32(NPCM_GMAC_MAC1_ADDR_LO, 0xffffffff); + CHECK_REG32(NPCM_GMAC_MAC2_ADDR_HI, 0x0000ffff); + CHECK_REG32(NPCM_GMAC_MAC2_ADDR_LO, 0xffffffff); + CHECK_REG32(NPCM_GMAC_MAC3_ADDR_HI, 0x0000ffff); + CHECK_REG32(NPCM_GMAC_MAC3_ADDR_LO, 0xffffffff); + CHECK_REG32(NPCM_GMAC_RGMII_STATUS, 0); + CHECK_REG32(NPCM_GMAC_WATCHDOG, 0); + CHECK_REG32(NPCM_GMAC_PTP_TCR, 0x00002000); + CHECK_REG32(NPCM_GMAC_PTP_SSIR, 0); + CHECK_REG32(NPCM_GMAC_PTP_STSR, 0); + CHECK_REG32(NPCM_GMAC_PTP_STNSR, 0); + CHECK_REG32(NPCM_GMAC_PTP_STSUR, 0); + CHECK_REG32(NPCM_GMAC_PTP_STNSUR, 0); + CHECK_REG32(NPCM_GMAC_PTP_TAR, 0); + CHECK_REG32(NPCM_GMAC_PTP_TTSR, 0); + + qtest_quit(qts); +} + +static void gmac_add_test(const char *name, const TestData* td, + GTestDataFunc fn) +{ + g_autofree char *full_name =3D g_strdup_printf( + "npcm7xx_gmac/gmac[%d]/%s", gmac_module_index(td->module), nam= e); + qtest_add_data_func(full_name, td, fn); +} + +int main(int argc, char **argv) +{ + TestData test_data_list[ARRAY_SIZE(gmac_module_list)]; + + g_test_init(&argc, &argv, NULL); + + for (int i =3D 0; i < ARRAY_SIZE(gmac_module_list); ++i) { + TestData *td =3D &test_data_list[i]; + + td->module =3D &gmac_module_list[i]; + + gmac_add_test("init", td, test_init); + } + + return g_test_run(); +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 663338ae124..39557d5ecbb 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -231,6 +231,7 @@ qtests_aarch64 =3D \ (config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : [])= + \ (config_all_accel.has_key('CONFIG_TCG') and = \ config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test']= : []) + \ + (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \ ['arm-cpu-features', 'numa-test', 'boot-serial-test', --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888270; cv=none; d=zohomail.com; s=zohoarc; b=nPkAwuAIU8ECbDbqEQ3HrTyJARTtlEvvenImXvURZ6oIVUX59kRtcJHjUtd/u4Dg+sf8DcysAMipKO+Dqy+YKyEvliYhCc/96qhhEsiWJwFXxIjQ8Ln9A/9MnmvhZittmcvbdUz9BylBZ6BYQdKeujgEKM0qnCQNr92+i+GgddA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888270; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=wQyXfbDvDsUrvNO+g+3q6CqiwoZf9GwfcKn7/ZL2RuM=; b=Kvr/HFB38u5gKw9d768IHfsrWAYV/x8/XDTE3NK5NrAZgXi+t7Kv+r/6n2Bd+uRHKvdqKslcCUjhRqQPK99MRHCECftBEbylI267QuqpVN6U7DsD7xjMLLt3tGeiyVGaTS0WXDLXmsOndikUgpS2PyiB9V2uKPI1g+hrFUeDnWk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888270749857.0085474480948; Fri, 2 Feb 2024 07:37:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb9-0000Vo-H9; Fri, 02 Feb 2024 10:36:59 -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 1rVvb8-0000RT-G4 for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:58 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb4-0004YG-PU for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:58 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40e8fec0968so20020395e9.1 for ; Fri, 02 Feb 2024 07:36:54 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888213; x=1707493013; 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=wQyXfbDvDsUrvNO+g+3q6CqiwoZf9GwfcKn7/ZL2RuM=; b=yGux69yurK7Cm8xVtF7pRU1/LGJwbz1nQbx2BLuOKst3B4SlsBedkRuQ8+4mU/G9cM e8CYoRCDrw8ISDiCL5madKyUPHjc8VpgfFc/9tyBy6jFNMFP7/7mo0DZyZDAkdmuR/MV QxML1ABASONYMlFStI+/3S3zYGlm1HS5d0+33ui7sx5XmhidR+MOroJUolnttsAZNMTw qvYwlUZwJhN01zaLtf3iKFNP7IZBZLm3GB4DIM4o7WcUbSD5xsEKuN/J7Uqj17kG7AI4 sbuKhLol7XnfwRx4HBSGbi8lV9k41zyrbaO2d7wnQyUipiVpQzqmtZQlafZ4NqXFS1VP nJ7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888213; x=1707493013; 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=wQyXfbDvDsUrvNO+g+3q6CqiwoZf9GwfcKn7/ZL2RuM=; b=eZoHz/LVtejJVYHFG/XgFKUd8TzsR+h9HQR27chmWocAu0Q3cJC839yLsQ4Jx0DwM7 Avox6M0BA1UkBmOGgAQfm4JTqkPVRnvZSvR3UTU3I1lYwZ28WDSWtygT27rrMSpfwvn4 sctZfVEDiI8KYvSI7q+9a5oYSh0SfaAEac/Y2FtJkijQfFn5op0Td9guTvl+8C391g3u 2EYjD8e4IDQWrsvbaR9HQsZPodNO7gwDZt5zdofBlvRAUCFPy7mJAz3gLDbiCboHoDDT If9XcPt1XvLB+lHxyydH1mdIjbUiq/xjYEJorxG74L788bpm7GBWT2eM4W5QQEMBEP+n hCkw== X-Gm-Message-State: AOJu0YyGuvb6GBAzQy9cktWQOXcQq+3duUtN/SK6xbc7DzZV2AJyKxS4 445isF6TLQVJg8foiUByjFkjHjZ9f2sWQRjlgA8UQLE5ZAq+3mHcJdUVS8W5Ts45pWESMyUl+Ld F X-Google-Smtp-Source: AGHT+IEamYF80lPiTKdHoIfnyMzSINBMDrTIQLPg5HzUV88A1/o+WpU3oetYA4Em31r0/awscvVqOA== X-Received: by 2002:a05:600c:4f4b:b0:40f:bba7:3552 with SMTP id m11-20020a05600c4f4b00b0040fbba73552mr4396456wmq.12.1706888213431; Fri, 02 Feb 2024 07:36:53 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 32/36] hw/net: GMAC Rx Implementation Date: Fri, 2 Feb 2024 15:36:33 +0000 Message-Id: <20240202153637.3710444-33-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888271667100001 Content-Type: text/plain; charset="utf-8" From: Nabih Estefan Diaz - Implementation of Receive function for packets - Implementation for reading and writing from and to descriptors in memory for Rx When RX starts, we need to flush the queued packets so that they can be received by the GMAC device. Without this it won't work with TAP NIC device. When RX descriptor list is full, it returns a DMA_STATUS for software to handle it. But there's no way to indicate the software has handled all RX descriptors and the whole pipeline stalls. We do something similar to NPCM7XX EMC to handle this case. 1. Return packet size when RX descriptor is full, effectively dropping these packets in such a case. 2. When software clears RX descriptor full bit, continue receiving further packets by flushing QEMU packet queue. Added relevant trace-events Change-Id: I132aa254a94cda1a586aba2ea33bbfc74ecdb831 Signed-off-by: Hao Wu Signed-off-by: Nabih Estefan Reviewed-by: Tyrone Ting Message-id: 20240131002800.989285-5-nabihestefan@google.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/net/npcm_gmac.c | 276 +++++++++++++++++++++++++++++++++++++++++++- hw/net/trace-events | 5 + 2 files changed, 279 insertions(+), 2 deletions(-) diff --git a/hw/net/npcm_gmac.c b/hw/net/npcm_gmac.c index 7118b4c7c78..a3c626e1b83 100644 --- a/hw/net/npcm_gmac.c +++ b/hw/net/npcm_gmac.c @@ -27,6 +27,10 @@ #include "hw/net/mii.h" #include "hw/net/npcm_gmac.h" #include "migration/vmstate.h" +#include "net/checksum.h" +#include "net/eth.h" +#include "net/net.h" +#include "qemu/cutils.h" #include "qemu/log.h" #include "qemu/units.h" #include "sysemu/dma.h" @@ -149,6 +153,17 @@ static void gmac_phy_set_link(NPCMGMACState *gmac, boo= l active) =20 static bool gmac_can_receive(NetClientState *nc) { + NPCMGMACState *gmac =3D NPCM_GMAC(qemu_get_nic_opaque(nc)); + + /* If GMAC receive is disabled. */ + if (!(gmac->regs[R_NPCM_GMAC_MAC_CONFIG] & NPCM_GMAC_MAC_CONFIG_RX_EN)= ) { + return false; + } + + /* If GMAC DMA RX is stopped. */ + if (!(gmac->regs[R_NPCM_DMA_CONTROL] & NPCM_DMA_CONTROL_START_STOP_RX)= ) { + return false; + } return true; } =20 @@ -192,10 +207,256 @@ static void gmac_update_irq(NPCMGMACState *gmac) qemu_set_irq(gmac->irq, level); } =20 +static int gmac_read_rx_desc(dma_addr_t addr, struct NPCMGMACRxDesc *desc) +{ + if (dma_memory_read(&address_space_memory, addr, desc, + sizeof(*desc), MEMTXATTRS_UNSPECIFIED)) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: Failed to read descriptor @ 0x= %" + HWADDR_PRIx "\n", __func__, addr); + return -1; + } + desc->rdes0 =3D le32_to_cpu(desc->rdes0); + desc->rdes1 =3D le32_to_cpu(desc->rdes1); + desc->rdes2 =3D le32_to_cpu(desc->rdes2); + desc->rdes3 =3D le32_to_cpu(desc->rdes3); + return 0; +} + +static int gmac_write_rx_desc(dma_addr_t addr, struct NPCMGMACRxDesc *desc) +{ + struct NPCMGMACRxDesc le_desc; + le_desc.rdes0 =3D cpu_to_le32(desc->rdes0); + le_desc.rdes1 =3D cpu_to_le32(desc->rdes1); + le_desc.rdes2 =3D cpu_to_le32(desc->rdes2); + le_desc.rdes3 =3D cpu_to_le32(desc->rdes3); + if (dma_memory_write(&address_space_memory, addr, &le_desc, + sizeof(le_desc), MEMTXATTRS_UNSPECIFIED)) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: Failed to write descriptor @ 0= x%" + HWADDR_PRIx "\n", __func__, addr); + return -1; + } + return 0; +} + +static int gmac_rx_transfer_frame_to_buffer(uint32_t rx_buf_len, + uint32_t *left_frame, + uint32_t rx_buf_addr, + bool *eof_transferred, + const uint8_t **frame_ptr, + uint16_t *transferred) +{ + uint32_t to_transfer; + /* + * Check that buffer is bigger than the frame being transfered + * If bigger then transfer only whats left of frame + * Else, fill frame with all the content possible + */ + if (rx_buf_len >=3D *left_frame) { + to_transfer =3D *left_frame; + *eof_transferred =3D true; + } else { + to_transfer =3D rx_buf_len; + } + + /* write frame part to memory */ + if (dma_memory_write(&address_space_memory, (uint64_t) rx_buf_addr, + *frame_ptr, to_transfer, MEMTXATTRS_UNSPECIFIED))= { + return -1; + } + + /* update frame pointer and size of whats left of frame */ + *frame_ptr +=3D to_transfer; + *left_frame -=3D to_transfer; + *transferred +=3D to_transfer; + + return 0; +} + +static void gmac_dma_set_state(NPCMGMACState *gmac, int shift, uint32_t st= ate) +{ + gmac->regs[R_NPCM_DMA_STATUS] =3D deposit32(gmac->regs[R_NPCM_DMA_STAT= US], + shift, 3, state); +} + static ssize_t gmac_receive(NetClientState *nc, const uint8_t *buf, size_t= len) { - /* Placeholder. Function will be filled in following patches */ - return 0; + /* + * Comments have steps that relate to the + * receiving process steps in pg 386 + */ + NPCMGMACState *gmac =3D NPCM_GMAC(qemu_get_nic_opaque(nc)); + uint32_t left_frame =3D len; + const uint8_t *frame_ptr =3D buf; + uint32_t desc_addr; + uint32_t rx_buf_len, rx_buf_addr; + struct NPCMGMACRxDesc rx_desc; + uint16_t transferred =3D 0; + bool eof_transferred =3D false; + + trace_npcm_gmac_packet_receive(DEVICE(gmac)->canonical_path, len); + if (!gmac_can_receive(nc)) { + qemu_log_mask(LOG_GUEST_ERROR, "GMAC Currently is not able for Rx"= ); + return -1; + } + if (!gmac->regs[R_NPCM_DMA_HOST_RX_DESC]) { + gmac->regs[R_NPCM_DMA_HOST_RX_DESC] =3D + NPCM_DMA_HOST_RX_DESC_MASK(gmac->regs[R_NPCM_DMA_RX_BASE_ADDR]= ); + } + desc_addr =3D NPCM_DMA_HOST_RX_DESC_MASK(gmac->regs[R_NPCM_DMA_HOST_RX= _DESC]); + + /* step 1 */ + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_RX_PROCESS_STATE_SHIFT, + NPCM_DMA_STATUS_RX_RUNNING_FETCHING_STATE); + trace_npcm_gmac_packet_desc_read(DEVICE(gmac)->canonical_path, desc_ad= dr); + if (gmac_read_rx_desc(desc_addr, &rx_desc)) { + qemu_log_mask(LOG_GUEST_ERROR, "RX Descriptor @ 0x%x cant be read\= n", + desc_addr); + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_RX_PROCESS_STATE_SHIFT, + NPCM_DMA_STATUS_RX_SUSPENDED_STATE); + return -1; + } + + /* step 2 */ + if (!(rx_desc.rdes0 & RX_DESC_RDES0_OWN)) { + qemu_log_mask(LOG_GUEST_ERROR, + "RX Descriptor @ 0x%x is owned by software\n", + desc_addr); + gmac->regs[R_NPCM_DMA_STATUS] |=3D NPCM_DMA_STATUS_RU; + gmac->regs[R_NPCM_DMA_STATUS] |=3D NPCM_DMA_STATUS_RI; + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_RX_PROCESS_STATE_SHIFT, + NPCM_DMA_STATUS_RX_SUSPENDED_STATE); + gmac_update_irq(gmac); + return len; + } + /* step 3 */ + /* + * TODO -- + * Implement all frame filtering and processing (with its own interrup= ts) + */ + trace_npcm_gmac_debug_desc_data(DEVICE(gmac)->canonical_path, &rx_desc, + rx_desc.rdes0, rx_desc.rdes1, rx_desc.= rdes2, + rx_desc.rdes3); + /* Clear rdes0 for the incoming descriptor and set FS in first descrip= tor.*/ + rx_desc.rdes0 =3D RX_DESC_RDES0_FIRST_DESC_MASK; + + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_RX_PROCESS_STATE_SHIFT, + NPCM_DMA_STATUS_RX_RUNNING_TRANSFERRING_STATE); + + /* Pad the frame with FCS as the kernel driver will strip it away. */ + left_frame +=3D ETH_FCS_LEN; + + /* repeat while we still have frame to transfer to memory */ + while (!eof_transferred) { + /* Return descriptor no matter what happens */ + rx_desc.rdes0 &=3D ~RX_DESC_RDES0_OWN; + /* Set the frame to be an IPv4/IPv6 frame. */ + rx_desc.rdes0 |=3D RX_DESC_RDES0_FRM_TYPE_MASK; + + /* step 4 */ + rx_buf_len =3D RX_DESC_RDES1_BFFR1_SZ_MASK(rx_desc.rdes1); + rx_buf_addr =3D rx_desc.rdes2; + gmac->regs[R_NPCM_DMA_CUR_RX_BUF_ADDR] =3D rx_buf_addr; + gmac_rx_transfer_frame_to_buffer(rx_buf_len, &left_frame, rx_buf_a= ddr, + &eof_transferred, &frame_ptr, + &transferred); + + trace_npcm_gmac_packet_receiving_buffer(DEVICE(gmac)->canonical_pa= th, + rx_buf_len, rx_buf_addr); + /* if we still have frame left and the second buffer is not chaine= d */ + if (!(rx_desc.rdes1 & RX_DESC_RDES1_SEC_ADDR_CHND_MASK) && \ + !eof_transferred) { + /* repeat process from above on buffer 2 */ + rx_buf_len =3D RX_DESC_RDES1_BFFR2_SZ_MASK(rx_desc.rdes1); + rx_buf_addr =3D rx_desc.rdes3; + gmac->regs[R_NPCM_DMA_CUR_RX_BUF_ADDR] =3D rx_buf_addr; + gmac_rx_transfer_frame_to_buffer(rx_buf_len, &left_frame, + rx_buf_addr, &eof_transferred, + &frame_ptr, &transferred); + trace_npcm_gmac_packet_receiving_buffer( \ + DEVICE(gmac)->canonical_pa= th, + rx_buf_len, rx_buf_addr); + } + /* update address for descriptor */ + gmac->regs[R_NPCM_DMA_HOST_RX_DESC] =3D rx_buf_addr; + /* Return descriptor */ + rx_desc.rdes0 &=3D ~RX_DESC_RDES0_OWN; + /* Update frame length transferred */ + rx_desc.rdes0 |=3D ((uint32_t)transferred) + << RX_DESC_RDES0_FRAME_LEN_SHIFT; + trace_npcm_gmac_debug_desc_data(DEVICE(gmac)->canonical_path, &rx_= desc, + rx_desc.rdes0, rx_desc.rdes1, + rx_desc.rdes2, rx_desc.rdes3); + + /* step 5 */ + gmac_write_rx_desc(desc_addr, &rx_desc); + trace_npcm_gmac_debug_desc_data(DEVICE(gmac)->canonical_path, + &rx_desc, rx_desc.rdes0, + rx_desc.rdes1, rx_desc.rdes2, + rx_desc.rdes3); + /* read new descriptor into rx_desc if needed*/ + if (!eof_transferred) { + /* Get next descriptor address (chained or sequential) */ + if (rx_desc.rdes1 & RX_DESC_RDES1_RC_END_RING_MASK) { + desc_addr =3D gmac->regs[R_NPCM_DMA_RX_BASE_ADDR]; + } else if (rx_desc.rdes1 & RX_DESC_RDES1_SEC_ADDR_CHND_MASK) { + desc_addr =3D rx_desc.rdes3; + } else { + desc_addr +=3D sizeof(rx_desc); + } + trace_npcm_gmac_packet_desc_read(DEVICE(gmac)->canonical_path, + desc_addr); + if (gmac_read_rx_desc(desc_addr, &rx_desc)) { + qemu_log_mask(LOG_GUEST_ERROR, + "RX Descriptor @ 0x%x cant be read\n", + desc_addr); + gmac->regs[R_NPCM_DMA_STATUS] |=3D NPCM_DMA_STATUS_RU; + gmac_update_irq(gmac); + return len; + } + + /* step 6 */ + if (!(rx_desc.rdes0 & RX_DESC_RDES0_OWN)) { + if (!(gmac->regs[R_NPCM_DMA_CONTROL] & \ + NPCM_DMA_CONTROL_FLUSH_MASK)) { + rx_desc.rdes0 |=3D RX_DESC_RDES0_DESC_ERR_MASK; + } + eof_transferred =3D true; + } + /* Clear rdes0 for the incoming descriptor */ + rx_desc.rdes0 =3D 0; + } + } + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_RX_PROCESS_STATE_SHIFT, + NPCM_DMA_STATUS_RX_RUNNING_CLOSING_STATE); + + rx_desc.rdes0 |=3D RX_DESC_RDES0_LAST_DESC_MASK; + if (!(rx_desc.rdes1 & RX_DESC_RDES1_DIS_INTR_COMP_MASK)) { + gmac->regs[R_NPCM_DMA_STATUS] |=3D NPCM_DMA_STATUS_RI; + gmac_update_irq(gmac); + } + trace_npcm_gmac_debug_desc_data(DEVICE(gmac)->canonical_path, &rx_desc, + rx_desc.rdes0, rx_desc.rdes1, rx_desc.= rdes2, + rx_desc.rdes3); + + /* step 8 */ + gmac->regs[R_NPCM_DMA_CONTROL] |=3D NPCM_DMA_CONTROL_FLUSH_MASK; + + /* step 9 */ + trace_npcm_gmac_packet_received(DEVICE(gmac)->canonical_path, left_fra= me); + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_RX_PROCESS_STATE_SHIFT, + NPCM_DMA_STATUS_RX_RUNNING_WAITING_STATE); + gmac_write_rx_desc(desc_addr, &rx_desc); + + /* Get next descriptor address (chained or sequential) */ + if (rx_desc.rdes1 & RX_DESC_RDES1_RC_END_RING_MASK) { + desc_addr =3D gmac->regs[R_NPCM_DMA_RX_BASE_ADDR]; + } else if (rx_desc.rdes1 & RX_DESC_RDES1_SEC_ADDR_CHND_MASK) { + desc_addr =3D rx_desc.rdes3; + } else { + desc_addr +=3D sizeof(rx_desc); + } + gmac->regs[R_NPCM_DMA_HOST_RX_DESC] =3D desc_addr; + return len; } =20 static void gmac_cleanup(NetClientState *nc) @@ -306,6 +567,7 @@ static void npcm_gmac_write(void *opaque, hwaddr offset, break; =20 case A_NPCM_GMAC_MAC_CONFIG: + gmac->regs[offset / sizeof(uint32_t)] =3D v; break; =20 case A_NPCM_GMAC_MII_ADDR: @@ -347,6 +609,8 @@ static void npcm_gmac_write(void *opaque, hwaddr offset, =20 case A_NPCM_DMA_RCV_POLL_DEMAND: /* We dont actually care about the value */ + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_RX_PROCESS_STATE_SHIFT, + NPCM_DMA_STATUS_RX_RUNNING_WAITING_STATE); break; =20 case A_NPCM_DMA_STATUS: @@ -357,6 +621,14 @@ static void npcm_gmac_write(void *opaque, hwaddr offse= t, HWADDR_PRIx ", value: 0x%04" PRIx64 "\n", DEVICE(gmac)->canonical_path, offset, v); } + /* for W1C bits, implement W1C */ + gmac->regs[offset / sizeof(uint32_t)] &=3D ~NPCM_DMA_STATUS_W1C_MA= SK(v); + if (v & NPCM_DMA_STATUS_RU) { + /* Clearing RU bit indicates descriptor is owned by DMA again.= */ + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_RX_PROCESS_STATE_SHIF= T, + NPCM_DMA_STATUS_RX_RUNNING_WAITING_STATE); + qemu_flush_queued_packets(qemu_get_queue(gmac->nic)); + } break; =20 default: diff --git a/hw/net/trace-events b/hw/net/trace-events index 56057de47f3..f91b1a4a3de 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -474,6 +474,11 @@ npcm_gmac_mdio_access(const char *name, uint8_t is_wri= te, uint8_t pa, uint8_t gr npcm_gmac_reset(const char *name, uint16_t value) "%s: phy_regs[0][1]: 0x%= 04" PRIx16 npcm_gmac_set_link(bool active) "Set link: active=3D%u" npcm_gmac_update_irq(const char *name, uint32_t status, uint32_t intr_en, = int level) "%s: Status Reg: 0x%04" PRIX32 " Interrupt Enable Reg: 0x%04" PR= IX32 " IRQ Set: %d" +npcm_gmac_packet_desc_read(const char* name, uint32_t desc_addr) "%s: atte= mpting to read descriptor @0x%04" PRIX32 +npcm_gmac_packet_receive(const char* name, uint32_t len) "%s: RX packet le= ngth: 0x%04" PRIX32 +npcm_gmac_packet_receiving_buffer(const char* name, uint32_t buf_len, uint= 32_t rx_buf_addr) "%s: Receiving into Buffer size: 0x%04" PRIX32 " at addre= ss 0x%04" PRIX32 +npcm_gmac_packet_received(const char* name, uint32_t len) "%s: Reception f= inished, packet left: 0x%04" PRIX32 +npcm_gmac_debug_desc_data(const char* name, void* addr, uint32_t des0, uin= t32_t des1, uint32_t des2, uint32_t des3)"%s: Address: %p Descriptor 0: 0x%= 04" PRIX32 " Descriptor 1: 0x%04" PRIX32 "Descriptor 2: 0x%04" PRIX32 " Des= criptor 3: 0x%04" PRIX32 =20 # npcm_pcs.c npcm_pcs_reg_read(const char *name, uint16_t indirect_access_baes, uint64_= t offset, uint16_t value) "%s: IND: 0x%02" PRIx16 " offset: 0x%04" PRIx64 "= value: 0x%04" PRIx16 --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888310; cv=none; d=zohomail.com; s=zohoarc; b=Am+HqzqmqjuO3TjdCo9WXRZ/cSXHnlg7zKDvjdInwVOd5HNO7DqYIrispusb0mCcLyFUyCuTyPlyhOU/tCPnvOwuUVCC7c/ZQZEwE4k2ZsONuHtB3CX8VYTLd5qz3Tmd1DQxMEF52hC33dJPp74fR1RGRdGf3AjXG9NRha8fOqo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888310; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=/AEDkTvBGJa0LD/A6ZVlUM/YpBQnMTkyj2QgiWhIPMM=; b=f6xjEKKzcapb2gOrEldtpdazX6fT77yYb+vxyHPQ8SNvZPGBI2O51ohXGkzTbSy9OPklimKKCHS0aGltU1IERq2AjD91sTGcHudrMk2rFKPz4/3vq3Hr9UuFdw3NsJSqiCiP8y6942IRGh3z3Cij141heSucax+ocz1N68wRV4A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170688831096284.04533158938705; Fri, 2 Feb 2024 07:38:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvbC-0000l9-5G; Fri, 02 Feb 2024 10:37:03 -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 1rVvb7-0000Ow-Ct for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:57 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb5-0004YQ-AT for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:57 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40efcb37373so19953235e9.2 for ; Fri, 02 Feb 2024 07:36:54 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888214; x=1707493014; 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=/AEDkTvBGJa0LD/A6ZVlUM/YpBQnMTkyj2QgiWhIPMM=; b=hCSuD43E3N6nyJHj7OZK8jHJdGv4DM6drEgf5Du1YShBP2gzZPbIUyaVAV2K+Y47/W T/tU6JQzMXjHPO8N/Nb1H1Olahi7nV5uCssqHVepRWEAOCSFQaKF4pfZw9I7VhiZ5EnG i6enKlXwNBjgCw8N6cSuC27tfPJGk6vSr9yfgbY3y+LQBkWTNj69io42b+61q5REsNdM Qzxw2LoiJ76tXUnQOmH2BIqW60V+qwumQmJcOpjfs9HzFFA+g4U5jeT+S5Ai0MjrNZJT m3jc3FIoLtsz0/RdhdUcGnt41JsMxK3shvIAPp1viMlcvQYnzkS64exTvPe1SKuIj4Jd JYNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888214; x=1707493014; 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=/AEDkTvBGJa0LD/A6ZVlUM/YpBQnMTkyj2QgiWhIPMM=; b=J9QfqsX/OZrksfOXXhAih/vsVhr69Bz9tza5gcpfiieOTA1MiF9foP5Cq8nY8YxPUX 6cxEM7jRH9+quVzBa7K6T6QKl/6PuqrrQgAdf+AKYbhSV8XeLAIDQaU3soTLOfudqgXV 4ddh+mLIv2BGzusiicjJcIo7f0V9SB76XfqXxvTKuesMx9k5fgBzj4xnqVeDjvqjCHZd oQuVPuA1E2/wUq3S5Cy7CRmaGiavolktgkuU+NdX3qEpGrsymvyz+se7Hl3PCnW2jjGN diEeuVUhIgOZj4MRLKxQ7WgdBWCXegsXwVkQ66KDQtrMn1yLcRFayKHUmZFlXURFOBFo iOrQ== X-Gm-Message-State: AOJu0YwXZz/0mBdoM0y2cxKiwjoYQYdAOZpWRkG0EMiEXpoHV6pgspax QmnUuGHRwLx4ZOwkeDbjV1d9j8YPUeSESBMh7AcWNf6oLNKeEOUwkeW+ztuuriqEbw5YMvYae7W / X-Google-Smtp-Source: AGHT+IGbnZgifw5HkoPC3MH7mT3Xj7ys7qv4cvq630v55E3tk+a+VraiDs+LHRayC96PLBwhQiGY5A== X-Received: by 2002:a7b:cd97:0:b0:40e:f6f2:1706 with SMTP id y23-20020a7bcd97000000b0040ef6f21706mr6481637wmj.22.1706888213897; Fri, 02 Feb 2024 07:36:53 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 33/36] hw/net: GMAC Tx Implementation Date: Fri, 2 Feb 2024 15:36:34 +0000 Message-Id: <20240202153637.3710444-34-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888311913100003 Content-Type: text/plain; charset="utf-8" From: Nabih Estefan Diaz - Implementation of Transmit function for packets - Implementation for reading and writing from and to descriptors in memory for Tx Added relevant trace-events NOTE: This function implements the steps detailed in the datasheet for transmitting messages from the GMAC. Change-Id: Icf14f9fcc6cc7808a41acd872bca67c9832087e6 Signed-off-by: Nabih Estefan Reviewed-by: Tyrone Ting Message-id: 20240131002800.989285-6-nabihestefan@google.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/net/npcm_gmac.c | 203 ++++++++++++++++++++++++++++++++++++++++++++ hw/net/trace-events | 2 + 2 files changed, 205 insertions(+) diff --git a/hw/net/npcm_gmac.c b/hw/net/npcm_gmac.c index a3c626e1b83..1b71e2526e3 100644 --- a/hw/net/npcm_gmac.c +++ b/hw/net/npcm_gmac.c @@ -238,6 +238,37 @@ static int gmac_write_rx_desc(dma_addr_t addr, struct = NPCMGMACRxDesc *desc) return 0; } =20 +static int gmac_read_tx_desc(dma_addr_t addr, struct NPCMGMACTxDesc *desc) +{ + if (dma_memory_read(&address_space_memory, addr, desc, + sizeof(*desc), MEMTXATTRS_UNSPECIFIED)) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: Failed to read descriptor @ 0x= %" + HWADDR_PRIx "\n", __func__, addr); + return -1; + } + desc->tdes0 =3D le32_to_cpu(desc->tdes0); + desc->tdes1 =3D le32_to_cpu(desc->tdes1); + desc->tdes2 =3D le32_to_cpu(desc->tdes2); + desc->tdes3 =3D le32_to_cpu(desc->tdes3); + return 0; +} + +static int gmac_write_tx_desc(dma_addr_t addr, struct NPCMGMACTxDesc *desc) +{ + struct NPCMGMACTxDesc le_desc; + le_desc.tdes0 =3D cpu_to_le32(desc->tdes0); + le_desc.tdes1 =3D cpu_to_le32(desc->tdes1); + le_desc.tdes2 =3D cpu_to_le32(desc->tdes2); + le_desc.tdes3 =3D cpu_to_le32(desc->tdes3); + if (dma_memory_write(&address_space_memory, addr, &le_desc, + sizeof(le_desc), MEMTXATTRS_UNSPECIFIED)) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: Failed to write descriptor @ 0= x%" + HWADDR_PRIx "\n", __func__, addr); + return -1; + } + return 0; +} + static int gmac_rx_transfer_frame_to_buffer(uint32_t rx_buf_len, uint32_t *left_frame, uint32_t rx_buf_addr, @@ -459,6 +490,155 @@ static ssize_t gmac_receive(NetClientState *nc, const= uint8_t *buf, size_t len) return len; } =20 +static int gmac_tx_get_csum(uint32_t tdes1) +{ + uint32_t mask =3D TX_DESC_TDES1_CHKSM_INS_CTRL_MASK(tdes1); + int csum =3D 0; + + if (likely(mask > 0)) { + csum |=3D CSUM_IP; + } + if (likely(mask > 1)) { + csum |=3D CSUM_TCP | CSUM_UDP; + } + + return csum; +} + +static void gmac_try_send_next_packet(NPCMGMACState *gmac) +{ + /* + * Comments about steps refer to steps for + * transmitting in page 384 of datasheet + */ + uint16_t tx_buffer_size =3D 2048; + g_autofree uint8_t *tx_send_buffer =3D g_malloc(tx_buffer_size); + uint32_t desc_addr; + struct NPCMGMACTxDesc tx_desc; + uint32_t tx_buf_addr, tx_buf_len; + uint16_t length =3D 0; + uint8_t *buf =3D tx_send_buffer; + uint32_t prev_buf_size =3D 0; + int csum =3D 0; + + /* steps 1&2 */ + if (!gmac->regs[R_NPCM_DMA_HOST_TX_DESC]) { + gmac->regs[R_NPCM_DMA_HOST_TX_DESC] =3D + NPCM_DMA_HOST_TX_DESC_MASK(gmac->regs[R_NPCM_DMA_TX_BASE_ADDR]= ); + } + desc_addr =3D gmac->regs[R_NPCM_DMA_HOST_TX_DESC]; + + while (true) { + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_TX_PROCESS_STATE_SHIFT, + NPCM_DMA_STATUS_TX_RUNNING_FETCHING_STATE); + if (gmac_read_tx_desc(desc_addr, &tx_desc)) { + qemu_log_mask(LOG_GUEST_ERROR, + "TX Descriptor @ 0x%x can't be read\n", + desc_addr); + return; + } + /* step 3 */ + + trace_npcm_gmac_packet_desc_read(DEVICE(gmac)->canonical_path, + desc_addr); + trace_npcm_gmac_debug_desc_data(DEVICE(gmac)->canonical_path, &tx_= desc, + tx_desc.tdes0, tx_desc.tdes1, tx_desc.tdes2, tx_desc.tdes3); + + /* 1 =3D DMA Owned, 0 =3D Software Owned */ + if (!(tx_desc.tdes0 & TX_DESC_TDES0_OWN)) { + qemu_log_mask(LOG_GUEST_ERROR, + "TX Descriptor @ 0x%x is owned by software\n", + desc_addr); + gmac->regs[R_NPCM_DMA_STATUS] |=3D NPCM_DMA_STATUS_TU; + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_TX_PROCESS_STATE_SHIF= T, + NPCM_DMA_STATUS_TX_SUSPENDED_STATE); + gmac_update_irq(gmac); + return; + } + + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_TX_PROCESS_STATE_SHIFT, + NPCM_DMA_STATUS_TX_RUNNING_READ_STATE); + /* Give the descriptor back regardless of what happens. */ + tx_desc.tdes0 &=3D ~TX_DESC_TDES0_OWN; + + if (tx_desc.tdes1 & TX_DESC_TDES1_FIRST_SEG_MASK) { + csum =3D gmac_tx_get_csum(tx_desc.tdes1); + } + + /* step 4 */ + tx_buf_addr =3D tx_desc.tdes2; + gmac->regs[R_NPCM_DMA_CUR_TX_BUF_ADDR] =3D tx_buf_addr; + tx_buf_len =3D TX_DESC_TDES1_BFFR1_SZ_MASK(tx_desc.tdes1); + buf =3D &tx_send_buffer[prev_buf_size]; + + if ((prev_buf_size + tx_buf_len) > sizeof(buf)) { + tx_buffer_size =3D prev_buf_size + tx_buf_len; + tx_send_buffer =3D g_realloc(tx_send_buffer, tx_buffer_size); + buf =3D &tx_send_buffer[prev_buf_size]; + } + + /* step 5 */ + if (dma_memory_read(&address_space_memory, tx_buf_addr, buf, + tx_buf_len, MEMTXATTRS_UNSPECIFIED)) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: Failed to read packet @ 0x= %x\n", + __func__, tx_buf_addr); + return; + } + length +=3D tx_buf_len; + prev_buf_size +=3D tx_buf_len; + + /* If not chained we'll have a second buffer. */ + if (!(tx_desc.tdes1 & TX_DESC_TDES1_SEC_ADDR_CHND_MASK)) { + tx_buf_addr =3D tx_desc.tdes3; + gmac->regs[R_NPCM_DMA_CUR_TX_BUF_ADDR] =3D tx_buf_addr; + tx_buf_len =3D TX_DESC_TDES1_BFFR2_SZ_MASK(tx_desc.tdes1); + buf =3D &tx_send_buffer[prev_buf_size]; + + if ((prev_buf_size + tx_buf_len) > sizeof(buf)) { + tx_buffer_size =3D prev_buf_size + tx_buf_len; + tx_send_buffer =3D g_realloc(tx_send_buffer, tx_buffer_siz= e); + buf =3D &tx_send_buffer[prev_buf_size]; + } + + if (dma_memory_read(&address_space_memory, tx_buf_addr, buf, + tx_buf_len, MEMTXATTRS_UNSPECIFIED)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Failed to read packet @ 0x%x\n", + __func__, tx_buf_addr); + return; + } + length +=3D tx_buf_len; + prev_buf_size +=3D tx_buf_len; + } + if (tx_desc.tdes1 & TX_DESC_TDES1_LAST_SEG_MASK) { + net_checksum_calculate(tx_send_buffer, length, csum); + qemu_send_packet(qemu_get_queue(gmac->nic), tx_send_buffer, le= ngth); + trace_npcm_gmac_packet_sent(DEVICE(gmac)->canonical_path, leng= th); + buf =3D tx_send_buffer; + length =3D 0; + } + + /* step 6 */ + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_TX_PROCESS_STATE_SHIFT, + NPCM_DMA_STATUS_TX_RUNNING_CLOSING_STATE); + gmac_write_tx_desc(desc_addr, &tx_desc); + if (tx_desc.tdes1 & TX_DESC_TDES1_TX_END_RING_MASK) { + desc_addr =3D gmac->regs[R_NPCM_DMA_TX_BASE_ADDR]; + } else if (tx_desc.tdes1 & TX_DESC_TDES1_SEC_ADDR_CHND_MASK) { + desc_addr =3D tx_desc.tdes3; + } else { + desc_addr +=3D sizeof(tx_desc); + } + gmac->regs[R_NPCM_DMA_HOST_TX_DESC] =3D desc_addr; + + /* step 7 */ + if (tx_desc.tdes1 & TX_DESC_TDES1_INTERR_COMP_MASK) { + gmac->regs[R_NPCM_DMA_STATUS] |=3D NPCM_DMA_STATUS_TI; + gmac_update_irq(gmac); + } + } +} + static void gmac_cleanup(NetClientState *nc) { /* Nothing to do yet. */ @@ -613,6 +793,29 @@ static void npcm_gmac_write(void *opaque, hwaddr offse= t, NPCM_DMA_STATUS_RX_RUNNING_WAITING_STATE); break; =20 + case A_NPCM_DMA_XMT_POLL_DEMAND: + /* We dont actually care about the value */ + gmac_try_send_next_packet(gmac); + break; + + case A_NPCM_DMA_CONTROL: + gmac->regs[offset / sizeof(uint32_t)] =3D v; + if (v & NPCM_DMA_CONTROL_START_STOP_TX) { + gmac_try_send_next_packet(gmac); + } else { + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_TX_PROCESS_STATE_SHIF= T, + NPCM_DMA_STATUS_TX_STOPPED_STATE); + } + if (v & NPCM_DMA_CONTROL_START_STOP_RX) { + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_RX_PROCESS_STATE_SHIF= T, + NPCM_DMA_STATUS_RX_RUNNING_WAITING_STATE); + qemu_flush_queued_packets(qemu_get_queue(gmac->nic)); + } else { + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_RX_PROCESS_STATE_SHIF= T, + NPCM_DMA_STATUS_RX_STOPPED_STATE); + } + break; + case A_NPCM_DMA_STATUS: /* Check that RO bits are not written to */ if (NPCM_DMA_STATUS_RO_MASK(v)) { diff --git a/hw/net/trace-events b/hw/net/trace-events index f91b1a4a3de..78efa2ec2cc 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -478,7 +478,9 @@ npcm_gmac_packet_desc_read(const char* name, uint32_t d= esc_addr) "%s: attempting npcm_gmac_packet_receive(const char* name, uint32_t len) "%s: RX packet le= ngth: 0x%04" PRIX32 npcm_gmac_packet_receiving_buffer(const char* name, uint32_t buf_len, uint= 32_t rx_buf_addr) "%s: Receiving into Buffer size: 0x%04" PRIX32 " at addre= ss 0x%04" PRIX32 npcm_gmac_packet_received(const char* name, uint32_t len) "%s: Reception f= inished, packet left: 0x%04" PRIX32 +npcm_gmac_packet_sent(const char* name, uint16_t len) "%s: TX packet sent!= , length: 0x%04" PRIX16 npcm_gmac_debug_desc_data(const char* name, void* addr, uint32_t des0, uin= t32_t des1, uint32_t des2, uint32_t des3)"%s: Address: %p Descriptor 0: 0x%= 04" PRIX32 " Descriptor 1: 0x%04" PRIX32 "Descriptor 2: 0x%04" PRIX32 " Des= criptor 3: 0x%04" PRIX32 +npcm_gmac_packet_tx_desc_data(const char* name, uint32_t tdes0, uint32_t t= des1) "%s: Tdes0: 0x%04" PRIX32 " Tdes1: 0x%04" PRIX32 =20 # npcm_pcs.c npcm_pcs_reg_read(const char *name, uint16_t indirect_access_baes, uint64_= t offset, uint16_t value) "%s: IND: 0x%02" PRIx16 " offset: 0x%04" PRIx64 "= value: 0x%04" PRIx16 --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888372; cv=none; d=zohomail.com; s=zohoarc; b=Um8XFCb+aMlpdBkJlgrbL8vFvwqCUJvEnOcQJQtCh5F3Cz7sClbSdAqmlvKt1D6pte3d/Yqm67vEOskTM+kDP3Bkkse2uB/wP0NjEBUKb1xb4Fm++ECyRVTocvMystvnpBlORqp6bIuutQdFKjViIHKE+dJ/X4y652cdTyuZ6eU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888372; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=hTGwIpbc1jn6nVvKdDdysPoG5TIJGaOa+CtttkLXCs0=; b=VninEY0COCXeuASmlLIUTpS6G94YkjXVGF5WwDap8tee6SVBdJS/a/p/YTq3tWyM/PtO7odfSImS4gwxRknNNoYpSWO1a5QjWBBT8YfVcGbMzcHF7jxtxnJbHOkX8zxO5j4Ln+gSaplN3k5akvV0cwrfABNzJnIFWbt/kIvzh/8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888372559356.33913586274764; Fri, 2 Feb 2024 07:39:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvbE-0000qt-6N; Fri, 02 Feb 2024 10:37:04 -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 1rVvb8-0000Rc-NV for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:58 -0500 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb6-0004Yf-35 for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:58 -0500 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5113e895660so78025e87.0 for ; Fri, 02 Feb 2024 07:36:55 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888214; x=1707493014; 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=hTGwIpbc1jn6nVvKdDdysPoG5TIJGaOa+CtttkLXCs0=; b=gui1JuJFSzyCl2YkTL6wjl79Z0fIinCJ0nD7O2EmWQEjSw+S/Xc3tV6bSdyPiGAXzM U9NpDLfYVtQhd5digPXofewWWufZMqvIYQ/BYBFQLzzPW3/ZpSmyXGBybvgJqhJ4+PO4 0DIBUUdvFnOkddT/rsAUfgNh6dyeAblw2SYnUrWZl/2b1N/mImdJVyo+7pn8IPNNPE9t /3spNhLdqNBFaZP6uXZH4b0hmKVQtj7Vq2wVw6ojI7bZfzIw7ELU7qLYpiBeQfw1NM70 /h+1ITK3egJjZqaDlafZ085RYjoFI0HJyagGX7bW5GNHf4PrZZkEhLGGCJIeU1ftGtos V0+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888214; x=1707493014; 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=hTGwIpbc1jn6nVvKdDdysPoG5TIJGaOa+CtttkLXCs0=; b=XjWz/p4qdsYIgjrDcdxcnrJj8lW4fv0gd8jlnnViW/tC7UkVTOVEqm3knKYujJXwmQ OHKpoR9CPiBp5gmdDozYc1sRSc1CbK5foll1bEM4FeDDbBEMc3TwC4x3b+yuFKPI6Dly 2NcD8BN75klKQ3B/HPIyvlDcTk0U5UVKsGt+2ZDNp1drAYL57RcxgHLWixWc1HqSYROm hNKnHeqYpsDiHt6nlYbigp5AVWuZNupfkvdkqHRpnSRD2fFTLjviqEdRFD9tDv7xrtd2 xV8Hjrdw+sd9uVD5cRMDRp8DSYDkiulB0OFny+zn8Xq8VlUvOk0WyfQKNm1oQV4+X2Os jwaQ== X-Gm-Message-State: AOJu0YzSmbRx9keZbJk/X/GKkC4C6kJYniyf7VT/Glfb3E/1wRXvxyls E71DeJ9QUExul5HivAA/WouILVmIv98IohxYXOBNKuBmPICLUMoEOZ+91veunyWW8/4FRnoBSi8 2 X-Google-Smtp-Source: AGHT+IGrSD3MLVE8UPOK6xH1TFgLdtSLqotP9eG/2O4NfvsTt0Xuv5A2MbVp1+AVNFoXp4cs5woRMQ== X-Received: by 2002:ac2:4d08:0:b0:510:1016:d7e4 with SMTP id r8-20020ac24d08000000b005101016d7e4mr1703617lfi.7.1706888214356; Fri, 02 Feb 2024 07:36:54 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 34/36] tests/qtest: Adding PCS Module test to GMAC Qtest Date: Fri, 2 Feb 2024 15:36:35 +0000 Message-Id: <20240202153637.3710444-35-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x134.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, UPPERCASE_50_75=0.008 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888374350100015 Content-Type: text/plain; charset="utf-8" From: Nabih Estefan Diaz - Add PCS Register check to npcm_gmac-test Change-Id: I34821beb5e0b1e89e2be576ab58eabe41545af12 Signed-off-by: Nabih Estefan Reviewed-by: Tyrone Ting Message-id: 20240131002800.989285-7-nabihestefan@google.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- tests/qtest/npcm_gmac-test.c | 132 +++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/tests/qtest/npcm_gmac-test.c b/tests/qtest/npcm_gmac-test.c index 72c68874dfa..9e58b15ca1c 100644 --- a/tests/qtest/npcm_gmac-test.c +++ b/tests/qtest/npcm_gmac-test.c @@ -23,6 +23,10 @@ /* Name of the GMAC Device */ #define TYPE_NPCM_GMAC "npcm-gmac" =20 +/* Address of the PCS Module */ +#define PCS_BASE_ADDRESS 0xf0780000 +#define NPCM_PCS_IND_AC_BA 0x1fe + typedef struct GMACModule { int irq; uint64_t base_addr; @@ -114,6 +118,62 @@ typedef enum NPCMRegister { NPCM_GMAC_PTP_STNSUR =3D 0x714, NPCM_GMAC_PTP_TAR =3D 0x718, NPCM_GMAC_PTP_TTSR =3D 0x71c, + + /* PCS Registers */ + NPCM_PCS_SR_CTL_ID1 =3D 0x3c0008, + NPCM_PCS_SR_CTL_ID2 =3D 0x3c000a, + NPCM_PCS_SR_CTL_STS =3D 0x3c0010, + + NPCM_PCS_SR_MII_CTRL =3D 0x3e0000, + NPCM_PCS_SR_MII_STS =3D 0x3e0002, + NPCM_PCS_SR_MII_DEV_ID1 =3D 0x3e0004, + NPCM_PCS_SR_MII_DEV_ID2 =3D 0x3e0006, + NPCM_PCS_SR_MII_AN_ADV =3D 0x3e0008, + NPCM_PCS_SR_MII_LP_BABL =3D 0x3e000a, + NPCM_PCS_SR_MII_AN_EXPN =3D 0x3e000c, + NPCM_PCS_SR_MII_EXT_STS =3D 0x3e001e, + + NPCM_PCS_SR_TIM_SYNC_ABL =3D 0x3e0e10, + NPCM_PCS_SR_TIM_SYNC_TX_MAX_DLY_LWR =3D 0x3e0e12, + NPCM_PCS_SR_TIM_SYNC_TX_MAX_DLY_UPR =3D 0x3e0e14, + NPCM_PCS_SR_TIM_SYNC_TX_MIN_DLY_LWR =3D 0x3e0e16, + NPCM_PCS_SR_TIM_SYNC_TX_MIN_DLY_UPR =3D 0x3e0e18, + NPCM_PCS_SR_TIM_SYNC_RX_MAX_DLY_LWR =3D 0x3e0e1a, + NPCM_PCS_SR_TIM_SYNC_RX_MAX_DLY_UPR =3D 0x3e0e1c, + NPCM_PCS_SR_TIM_SYNC_RX_MIN_DLY_LWR =3D 0x3e0e1e, + NPCM_PCS_SR_TIM_SYNC_RX_MIN_DLY_UPR =3D 0x3e0e20, + + NPCM_PCS_VR_MII_MMD_DIG_CTRL1 =3D 0x3f0000, + NPCM_PCS_VR_MII_AN_CTRL =3D 0x3f0002, + NPCM_PCS_VR_MII_AN_INTR_STS =3D 0x3f0004, + NPCM_PCS_VR_MII_TC =3D 0x3f0006, + NPCM_PCS_VR_MII_DBG_CTRL =3D 0x3f000a, + NPCM_PCS_VR_MII_EEE_MCTRL0 =3D 0x3f000c, + NPCM_PCS_VR_MII_EEE_TXTIMER =3D 0x3f0010, + NPCM_PCS_VR_MII_EEE_RXTIMER =3D 0x3f0012, + NPCM_PCS_VR_MII_LINK_TIMER_CTRL =3D 0x3f0014, + NPCM_PCS_VR_MII_EEE_MCTRL1 =3D 0x3f0016, + NPCM_PCS_VR_MII_DIG_STS =3D 0x3f0020, + NPCM_PCS_VR_MII_ICG_ERRCNT1 =3D 0x3f0022, + NPCM_PCS_VR_MII_MISC_STS =3D 0x3f0030, + NPCM_PCS_VR_MII_RX_LSTS =3D 0x3f0040, + NPCM_PCS_VR_MII_MP_TX_BSTCTRL0 =3D 0x3f0070, + NPCM_PCS_VR_MII_MP_TX_LVLCTRL0 =3D 0x3f0074, + NPCM_PCS_VR_MII_MP_TX_GENCTRL0 =3D 0x3f007a, + NPCM_PCS_VR_MII_MP_TX_GENCTRL1 =3D 0x3f007c, + NPCM_PCS_VR_MII_MP_TX_STS =3D 0x3f0090, + NPCM_PCS_VR_MII_MP_RX_GENCTRL0 =3D 0x3f00b0, + NPCM_PCS_VR_MII_MP_RX_GENCTRL1 =3D 0x3f00b2, + NPCM_PCS_VR_MII_MP_RX_LOS_CTRL0 =3D 0x3f00ba, + NPCM_PCS_VR_MII_MP_MPLL_CTRL0 =3D 0x3f00f0, + NPCM_PCS_VR_MII_MP_MPLL_CTRL1 =3D 0x3f00f2, + NPCM_PCS_VR_MII_MP_MPLL_STS =3D 0x3f0110, + NPCM_PCS_VR_MII_MP_MISC_CTRL2 =3D 0x3f0126, + NPCM_PCS_VR_MII_MP_LVL_CTRL =3D 0x3f0130, + NPCM_PCS_VR_MII_MP_MISC_CTRL0 =3D 0x3f0132, + NPCM_PCS_VR_MII_MP_MISC_CTRL1 =3D 0x3f0134, + NPCM_PCS_VR_MII_DIG_CTRL2 =3D 0x3f01c2, + NPCM_PCS_VR_MII_DIG_ERRCNT_SEL =3D 0x3f01c4, } NPCMRegister; =20 static uint32_t gmac_read(QTestState *qts, const GMACModule *mod, @@ -122,6 +182,15 @@ static uint32_t gmac_read(QTestState *qts, const GMACM= odule *mod, return qtest_readl(qts, mod->base_addr + regno); } =20 +static uint16_t pcs_read(QTestState *qts, const GMACModule *mod, + NPCMRegister regno) +{ + uint32_t write_value =3D (regno & 0x3ffe00) >> 9; + qtest_writel(qts, PCS_BASE_ADDRESS + NPCM_PCS_IND_AC_BA, write_value); + uint32_t read_offset =3D regno & 0x1ff; + return qtest_readl(qts, PCS_BASE_ADDRESS + read_offset); +} + /* Check that GMAC registers are reset to default value */ static void test_init(gconstpointer test_data) { @@ -134,6 +203,11 @@ static void test_init(gconstpointer test_data) g_assert_cmphex(gmac_read(qts, mod, (regno)), =3D=3D, (value)); \ } while (0) =20 +#define CHECK_REG_PCS(regno, value) \ + do { \ + g_assert_cmphex(pcs_read(qts, mod, (regno)), =3D=3D, (value)); \ + } while (0) + CHECK_REG32(NPCM_DMA_BUS_MODE, 0x00020100); CHECK_REG32(NPCM_DMA_XMT_POLL_DEMAND, 0); CHECK_REG32(NPCM_DMA_RCV_POLL_DEMAND, 0); @@ -183,6 +257,64 @@ static void test_init(gconstpointer test_data) CHECK_REG32(NPCM_GMAC_PTP_TAR, 0); CHECK_REG32(NPCM_GMAC_PTP_TTSR, 0); =20 + /* TODO Add registers PCS */ + if (mod->base_addr =3D=3D 0xf0802000) { + CHECK_REG_PCS(NPCM_PCS_SR_CTL_ID1, 0x699e); + CHECK_REG_PCS(NPCM_PCS_SR_CTL_ID2, 0); + CHECK_REG_PCS(NPCM_PCS_SR_CTL_STS, 0x8000); + + CHECK_REG_PCS(NPCM_PCS_SR_MII_CTRL, 0x1140); + CHECK_REG_PCS(NPCM_PCS_SR_MII_STS, 0x0109); + CHECK_REG_PCS(NPCM_PCS_SR_MII_DEV_ID1, 0x699e); + CHECK_REG_PCS(NPCM_PCS_SR_MII_DEV_ID2, 0x0ced0); + CHECK_REG_PCS(NPCM_PCS_SR_MII_AN_ADV, 0x0020); + CHECK_REG_PCS(NPCM_PCS_SR_MII_LP_BABL, 0); + CHECK_REG_PCS(NPCM_PCS_SR_MII_AN_EXPN, 0); + CHECK_REG_PCS(NPCM_PCS_SR_MII_EXT_STS, 0xc000); + + CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_ABL, 0x0003); + CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_TX_MAX_DLY_LWR, 0x0038); + CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_TX_MAX_DLY_UPR, 0); + CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_TX_MIN_DLY_LWR, 0x0038); + CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_TX_MIN_DLY_UPR, 0); + CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_RX_MAX_DLY_LWR, 0x0058); + CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_RX_MAX_DLY_UPR, 0); + CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_RX_MIN_DLY_LWR, 0x0048); + CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_RX_MIN_DLY_UPR, 0); + + CHECK_REG_PCS(NPCM_PCS_VR_MII_MMD_DIG_CTRL1, 0x2400); + CHECK_REG_PCS(NPCM_PCS_VR_MII_AN_CTRL, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_AN_INTR_STS, 0x000a); + CHECK_REG_PCS(NPCM_PCS_VR_MII_TC, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_DBG_CTRL, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_EEE_MCTRL0, 0x899c); + CHECK_REG_PCS(NPCM_PCS_VR_MII_EEE_TXTIMER, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_EEE_RXTIMER, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_LINK_TIMER_CTRL, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_EEE_MCTRL1, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_DIG_STS, 0x0010); + CHECK_REG_PCS(NPCM_PCS_VR_MII_ICG_ERRCNT1, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MISC_STS, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_RX_LSTS, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_BSTCTRL0, 0x00a); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_LVLCTRL0, 0x007f); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_GENCTRL0, 0x0001); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_GENCTRL1, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_STS, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_RX_GENCTRL0, 0x0100); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_RX_GENCTRL1, 0x1100); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_RX_LOS_CTRL0, 0x000e); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MPLL_CTRL0, 0x0100); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MPLL_CTRL1, 0x0032); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MPLL_STS, 0x0001); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MISC_CTRL2, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_LVL_CTRL, 0x0019); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MISC_CTRL0, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MISC_CTRL1, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_DIG_CTRL2, 0); + CHECK_REG_PCS(NPCM_PCS_VR_MII_DIG_ERRCNT_SEL, 0); + } + qtest_quit(qts); } =20 --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888386; cv=none; d=zohomail.com; s=zohoarc; b=PIYOkUTYCCvid5eyTIRUTJIQzENbqloYCv8jp29lIn3ZwTTjKNFUDak2P5l8yE4e7EN0bMfgHpJuiA06cuzDkXADUZaUE2YdsBgmwCx+zl/tE77k8hmGvxfJPPhNRg7o2/K44UOlBY8VgFC5FKUwnAHnf6rx9nSSzpkBwM7hgwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888386; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=xUcECD2nnVhiI52zHyXo8n02AAr8/WZ9q/Hl5Mbt4mA=; b=AIEQihib+/wEfv/EPJm4eMDljKh5GHlcWZfxgw9MCr1RU78Ro8wIG3jTBeMH2SYu2aP8v3tKr6C+uJIKest4uXMQsHw/y/VjXUuvE7gccU35GcRkz5PTFqnHoyGvqVQNJB34ETP7fRib7DktaSd8aBBVdjtjQywtF6kRxgAQf1k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170688838603119.034776362678485; Fri, 2 Feb 2024 07:39:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvbE-0000qT-2J; Fri, 02 Feb 2024 10:37:04 -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 1rVvb9-0000Uw-Ds for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:59 -0500 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb6-0004Yt-R8 for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:59 -0500 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-5113a8ab4ceso588652e87.1 for ; Fri, 02 Feb 2024 07:36:56 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888215; x=1707493015; 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=xUcECD2nnVhiI52zHyXo8n02AAr8/WZ9q/Hl5Mbt4mA=; b=CJSZhFmdm9P+Oygy0/UVZdnjpy275ZXFgjnsRgUkdrWibJ9LHxK+I/033ZmHlceTn5 ctjjTMlKyKUlV00b3yzGAXtJoSVzAb/PvpgEJjtD/FRAbX1lVluJR/2wWQfmO/5TXajA GrWiO5izuWQdXEb9GjfA2k7j1/ViULJ1nZDm5+06FdULdh1yFJMV9aMaQqPMQStE88xq CgikJyToBprQb/yJ2jnMm+BXLKIR4X8ZKUGJSrh42rWu/UjoXcsd9nijQDfWYg0NckW0 Im0HBWeFwTz+qd7Ehls/h191vA1dkFRCUrhw8WB5hm4Mi8yTLaejqszCzOO6GmxiG3hg tj3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888215; x=1707493015; 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=xUcECD2nnVhiI52zHyXo8n02AAr8/WZ9q/Hl5Mbt4mA=; b=CNFTRsDCPVA6IZiHMigjx3hS2urScEVjb//oEPbTjoO/e1xYfTMdbIK4TSMRF7v4jI tzYQJpN/6TYOLYknvpdJJBdZtwhQ83ScUh2k/2ub4Ns4XQbdJ59geaAL9xc8Lq4+WaAs 2h8lREY094I8nAEPZMJYi5l05bzNXo/327NQ2f+lk22Rb5t7k3sE9K8ebPIRNhuntBLX MAyuBBuim+AbD6Nw8VR/CgC43cND9KPcQMXwXSLUOZaE5lFOwrIkeiRoSGYx85JpZAM5 Dlyafdkb9TBN1kwKBHF/awEYQjItdkjhlOXcsNypjV9MX75pxiuOe1hmCf/YEIhqEibM gafQ== X-Gm-Message-State: AOJu0Yw5dFMsQrYsK8bpmKizjViRZ2enmS19Scyl8YXvtHzrsbc6yv2O xRE3lyWhCrsgskaa7B9jEGKy2OUQRpntz8ZtBBmsBECRCBbiTD9tbX+ykjJb7YSfgm7OuRb1z3/ R X-Google-Smtp-Source: AGHT+IHeenSVOpscS/JpTHuHjj/cTB6Yl77oO4EHtPD4T1y7u6Z4hq44JAc9mfSJw0dMk5MFSaCewg== X-Received: by 2002:a05:6512:476:b0:50e:700:bdbb with SMTP id x22-20020a056512047600b0050e0700bdbbmr4269353lfd.21.1706888214828; Fri, 02 Feb 2024 07:36:54 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 35/36] hw/ssi: Implement BCM2835 SPI Controller Date: Fri, 2 Feb 2024 15:36:36 +0000 Message-Id: <20240202153637.3710444-36-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x130.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888386422100013 Content-Type: text/plain; charset="utf-8" From: Rayhan Faizel This patch adds the SPI controller for the BCM2835. Polling and interrupt m= odes of transfer are supported. DMA and LoSSI modes are currently unimplemented. Signed-off-by: Rayhan Faizel Message-id: 20240129221807.2983148-2-rayhan.faizel@gmail.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- docs/system/arm/raspi.rst | 2 +- include/hw/ssi/bcm2835_spi.h | 81 ++++++++++ hw/ssi/bcm2835_spi.c | 288 +++++++++++++++++++++++++++++++++++ hw/ssi/Kconfig | 4 + hw/ssi/meson.build | 1 + 5 files changed, 375 insertions(+), 1 deletion(-) create mode 100644 include/hw/ssi/bcm2835_spi.h create mode 100644 hw/ssi/bcm2835_spi.c diff --git a/docs/system/arm/raspi.rst b/docs/system/arm/raspi.rst index 922fe375a67..d0a6f08b2b9 100644 --- a/docs/system/arm/raspi.rst +++ b/docs/system/arm/raspi.rst @@ -33,11 +33,11 @@ Implemented devices * USB2 host controller (DWC2 and MPHI) * MailBox controller (MBOX) * VideoCore firmware (property) + * Peripheral SPI controller (SPI) =20 =20 Missing devices --------------- =20 - * Peripheral SPI controller (SPI) * Analog to Digital Converter (ADC) * Pulse Width Modulation (PWM) diff --git a/include/hw/ssi/bcm2835_spi.h b/include/hw/ssi/bcm2835_spi.h new file mode 100644 index 00000000000..d3f8cec1119 --- /dev/null +++ b/include/hw/ssi/bcm2835_spi.h @@ -0,0 +1,81 @@ +/* + * BCM2835 SPI Master Controller + * + * Copyright (c) 2024 Rayhan Faizel + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#include "hw/sysbus.h" +#include "hw/ssi/ssi.h" +#include "qom/object.h" +#include "qemu/fifo8.h" + +#define TYPE_BCM2835_SPI "bcm2835-spi" +OBJECT_DECLARE_SIMPLE_TYPE(BCM2835SPIState, BCM2835_SPI) + +/* + * Though BCM2835 documentation says FIFOs have a capacity of 16, + * FIFOs are actually 16 words in size or effectively 64 bytes when operat= ing + * in non DMA mode. + */ +#define FIFO_SIZE 64 +#define FIFO_SIZE_3_4 48 + +#define RO_MASK 0x1f0000 + +#define BCM2835_SPI_CS 0x00 +#define BCM2835_SPI_FIFO 0x04 +#define BCM2835_SPI_CLK 0x08 +#define BCM2835_SPI_DLEN 0x0c +#define BCM2835_SPI_LTOH 0x10 +#define BCM2835_SPI_DC 0x14 + +#define BCM2835_SPI_CS_RXF BIT(20) +#define BCM2835_SPI_CS_RXR BIT(19) +#define BCM2835_SPI_CS_TXD BIT(18) +#define BCM2835_SPI_CS_RXD BIT(17) +#define BCM2835_SPI_CS_DONE BIT(16) +#define BCM2835_SPI_CS_LEN BIT(13) +#define BCM2835_SPI_CS_REN BIT(12) +#define BCM2835_SPI_CS_INTR BIT(10) +#define BCM2835_SPI_CS_INTD BIT(9) +#define BCM2835_SPI_CS_DMAEN BIT(8) +#define BCM2835_SPI_CS_TA BIT(7) +#define BCM2835_SPI_CLEAR_RX BIT(5) +#define BCM2835_SPI_CLEAR_TX BIT(4) + +struct BCM2835SPIState { + /* */ + SysBusDevice parent_obj; + + /* */ + SSIBus *bus; + MemoryRegion iomem; + qemu_irq irq; + + uint32_t cs; + uint32_t clk; + uint32_t dlen; + uint32_t ltoh; + uint32_t dc; + + Fifo8 tx_fifo; + Fifo8 rx_fifo; +}; diff --git a/hw/ssi/bcm2835_spi.c b/hw/ssi/bcm2835_spi.c new file mode 100644 index 00000000000..6ecb42d4e3b --- /dev/null +++ b/hw/ssi/bcm2835_spi.c @@ -0,0 +1,288 @@ +/* + * BCM2835 SPI Master Controller + * + * Copyright (c) 2024 Rayhan Faizel + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "qemu/fifo8.h" +#include "hw/ssi/bcm2835_spi.h" +#include "hw/irq.h" +#include "migration/vmstate.h" + +static void bcm2835_spi_update_int(BCM2835SPIState *s) +{ + int do_interrupt =3D 0; + + /* Interrupt on DONE */ + if (s->cs & BCM2835_SPI_CS_INTD && s->cs & BCM2835_SPI_CS_DONE) { + do_interrupt =3D 1; + } + /* Interrupt on RXR */ + if (s->cs & BCM2835_SPI_CS_INTR && s->cs & BCM2835_SPI_CS_RXR) { + do_interrupt =3D 1; + } + qemu_set_irq(s->irq, do_interrupt); +} + +static void bcm2835_spi_update_rx_flags(BCM2835SPIState *s) +{ + /* Set RXD if RX FIFO is non empty */ + if (!fifo8_is_empty(&s->rx_fifo)) { + s->cs |=3D BCM2835_SPI_CS_RXD; + } else { + s->cs &=3D ~BCM2835_SPI_CS_RXD; + } + + /* Set RXF if RX FIFO is full */ + if (fifo8_is_full(&s->rx_fifo)) { + s->cs |=3D BCM2835_SPI_CS_RXF; + } else { + s->cs &=3D ~BCM2835_SPI_CS_RXF; + } + + /* Set RXR if RX FIFO is 3/4th used or above */ + if (fifo8_num_used(&s->rx_fifo) >=3D FIFO_SIZE_3_4) { + s->cs |=3D BCM2835_SPI_CS_RXR; + } else { + s->cs &=3D ~BCM2835_SPI_CS_RXR; + } +} + +static void bcm2835_spi_update_tx_flags(BCM2835SPIState *s) +{ + /* Set TXD if TX FIFO is not full */ + if (fifo8_is_full(&s->tx_fifo)) { + s->cs &=3D ~BCM2835_SPI_CS_TXD; + } else { + s->cs |=3D BCM2835_SPI_CS_TXD; + } + + /* Set DONE if in TA mode and TX FIFO is empty */ + if (fifo8_is_empty(&s->tx_fifo) && s->cs & BCM2835_SPI_CS_TA) { + s->cs |=3D BCM2835_SPI_CS_DONE; + } else { + s->cs &=3D ~BCM2835_SPI_CS_DONE; + } +} + +static void bcm2835_spi_flush_tx_fifo(BCM2835SPIState *s) +{ + uint8_t tx_byte, rx_byte; + + while (!fifo8_is_empty(&s->tx_fifo) && !fifo8_is_full(&s->rx_fifo)) { + tx_byte =3D fifo8_pop(&s->tx_fifo); + rx_byte =3D ssi_transfer(s->bus, tx_byte); + fifo8_push(&s->rx_fifo, rx_byte); + } + + bcm2835_spi_update_tx_flags(s); + bcm2835_spi_update_rx_flags(s); +} + +static uint64_t bcm2835_spi_read(void *opaque, hwaddr addr, unsigned size) +{ + BCM2835SPIState *s =3D opaque; + uint32_t readval =3D 0; + + switch (addr) { + case BCM2835_SPI_CS: + readval =3D s->cs & 0xffffffff; + break; + case BCM2835_SPI_FIFO: + bcm2835_spi_flush_tx_fifo(s); + if (s->cs & BCM2835_SPI_CS_RXD) { + readval =3D fifo8_pop(&s->rx_fifo); + bcm2835_spi_update_rx_flags(s); + } + + bcm2835_spi_update_int(s); + break; + case BCM2835_SPI_CLK: + readval =3D s->clk & 0xffff; + break; + case BCM2835_SPI_DLEN: + readval =3D s->dlen & 0xffff; + break; + case BCM2835_SPI_LTOH: + readval =3D s->ltoh & 0xf; + break; + case BCM2835_SPI_DC: + readval =3D s->dc & 0xffffffff; + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad offset 0x%" HWADDR_PRIx "\n", __func__, add= r); + } + return readval; +} + +static void bcm2835_spi_write(void *opaque, hwaddr addr, + uint64_t value, unsigned int size) +{ + BCM2835SPIState *s =3D opaque; + + switch (addr) { + case BCM2835_SPI_CS: + s->cs =3D (value & ~RO_MASK) | (s->cs & RO_MASK); + if (!(s->cs & BCM2835_SPI_CS_TA)) { + /* Clear DONE and RXR if TA is off */ + s->cs &=3D ~(BCM2835_SPI_CS_DONE); + s->cs &=3D ~(BCM2835_SPI_CS_RXR); + } + + /* Clear RX FIFO */ + if (s->cs & BCM2835_SPI_CLEAR_RX) { + fifo8_reset(&s->rx_fifo); + bcm2835_spi_update_rx_flags(s); + } + + /* Clear TX FIFO*/ + if (s->cs & BCM2835_SPI_CLEAR_TX) { + fifo8_reset(&s->tx_fifo); + bcm2835_spi_update_tx_flags(s); + } + + /* Set Transfer Active */ + if (s->cs & BCM2835_SPI_CS_TA) { + bcm2835_spi_update_tx_flags(s); + } + + if (s->cs & BCM2835_SPI_CS_DMAEN) { + qemu_log_mask(LOG_UNIMP, "%s: " \ + "DMA not supported\n", __func__); + } + + if (s->cs & BCM2835_SPI_CS_LEN) { + qemu_log_mask(LOG_UNIMP, "%s: " \ + "LoSSI not supported\n", __func__); + } + + bcm2835_spi_update_int(s); + break; + case BCM2835_SPI_FIFO: + /* + * According to documentation, writes to FIFO without TA controls + * CS and DLEN registers. This is supposed to be used in DMA mode + * which is currently unimplemented. Moreover, Linux does not make + * use of this and directly modifies the CS and DLEN registers. + */ + if (s->cs & BCM2835_SPI_CS_TA) { + if (s->cs & BCM2835_SPI_CS_TXD) { + fifo8_push(&s->tx_fifo, value & 0xff); + bcm2835_spi_update_tx_flags(s); + } + + bcm2835_spi_flush_tx_fifo(s); + bcm2835_spi_update_int(s); + } + break; + case BCM2835_SPI_CLK: + s->clk =3D value & 0xffff; + break; + case BCM2835_SPI_DLEN: + s->dlen =3D value & 0xffff; + break; + case BCM2835_SPI_LTOH: + s->ltoh =3D value & 0xf; + break; + case BCM2835_SPI_DC: + s->dc =3D value & 0xffffffff; + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad offset 0x%" HWADDR_PRIx "\n", __func__, add= r); + } +} + +static const MemoryRegionOps bcm2835_spi_ops =3D { + .read =3D bcm2835_spi_read, + .write =3D bcm2835_spi_write, + .endianness =3D DEVICE_NATIVE_ENDIAN, +}; + +static void bcm2835_spi_realize(DeviceState *dev, Error **errp) +{ + BCM2835SPIState *s =3D BCM2835_SPI(dev); + s->bus =3D ssi_create_bus(dev, "spi"); + + memory_region_init_io(&s->iomem, OBJECT(dev), &bcm2835_spi_ops, s, + TYPE_BCM2835_SPI, 0x18); + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); + sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq); + + fifo8_create(&s->tx_fifo, FIFO_SIZE); + fifo8_create(&s->rx_fifo, FIFO_SIZE); +} +static void bcm2835_spi_reset(DeviceState *dev) +{ + BCM2835SPIState *s =3D BCM2835_SPI(dev); + + fifo8_reset(&s->tx_fifo); + fifo8_reset(&s->rx_fifo); + + /* Reset values according to BCM2835 Peripheral Documentation */ + s->cs =3D BCM2835_SPI_CS_TXD | BCM2835_SPI_CS_REN; + s->clk =3D 0; + s->dlen =3D 0; + s->ltoh =3D 0x1; + s->dc =3D 0x30201020; +} + +static const VMStateDescription vmstate_bcm2835_spi =3D { + .name =3D TYPE_BCM2835_SPI, + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (const VMStateField[]) { + VMSTATE_FIFO8(tx_fifo, BCM2835SPIState), + VMSTATE_FIFO8(rx_fifo, BCM2835SPIState), + VMSTATE_UINT32(cs, BCM2835SPIState), + VMSTATE_UINT32(clk, BCM2835SPIState), + VMSTATE_UINT32(dlen, BCM2835SPIState), + VMSTATE_UINT32(ltoh, BCM2835SPIState), + VMSTATE_UINT32(dc, BCM2835SPIState), + VMSTATE_END_OF_LIST() + } +}; + +static void bcm2835_spi_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->reset =3D bcm2835_spi_reset; + dc->realize =3D bcm2835_spi_realize; + dc->vmsd =3D &vmstate_bcm2835_spi; +} + +static const TypeInfo bcm2835_spi_info =3D { + .name =3D TYPE_BCM2835_SPI, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(BCM2835SPIState), + .class_init =3D bcm2835_spi_class_init, +}; + +static void bcm2835_spi_register_types(void) +{ + type_register_static(&bcm2835_spi_info); +} + +type_init(bcm2835_spi_register_types) diff --git a/hw/ssi/Kconfig b/hw/ssi/Kconfig index 7d90a02181e..83ee53c1d08 100644 --- a/hw/ssi/Kconfig +++ b/hw/ssi/Kconfig @@ -20,3 +20,7 @@ config XILINX_SPIPS config STM32F2XX_SPI bool select SSI + +config BCM2835_SPI + bool + select SSI diff --git a/hw/ssi/meson.build b/hw/ssi/meson.build index 0aebcdd6142..b999aeb027c 100644 --- a/hw/ssi/meson.build +++ b/hw/ssi/meson.build @@ -11,3 +11,4 @@ system_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files(= 'xlnx-versal-ospi.c')) system_ss.add(when: 'CONFIG_IMX', if_true: files('imx_spi.c')) system_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_spi.c')) system_ss.add(when: 'CONFIG_IBEX', if_true: files('ibex_spi_host.c')) +system_ss.add(when: 'CONFIG_BCM2835_SPI', if_true: files('bcm2835_spi.c')) --=20 2.34.1 From nobody Tue Nov 26 13:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706888316; cv=none; d=zohomail.com; s=zohoarc; b=jamb5Hvff0tA4qRYnsoyz4TOiZPVnSvVb3PXGOcs47jxqcj9HlolK+Ax0088TMsItEI54MwGnQEiKudQkoSTTfT3qsS8ji6oBd7c1B4h6uJlAZAoA2da9FctRLXWlNS9EMn42RodUrtlj+pGOEXadMdrJ/bGMdLlZdaUWUV2ONo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888316; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=e6ecdA6XprRoNkA0wb02c6VKGclESqrERe4VSdnbqBk=; b=mVSoCdVhOaX0dJDf05n/uURrHUrUpCEe6Ayl6GuZ65VE7fgpZS8XNgUPYCPkBfz8NXYZAhMJVQnMmJUpIiPHDSw8bMTC5M3mo6T4KD3xtioo60Wxv5Or8X013p1uyuU0h7Ss7Z34cMwMcOl1jRDJL/w7lucqtBnUJlE/t+a23BE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706888316241910.5463868749509; Fri, 2 Feb 2024 07:38:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvbD-0000oi-44; Fri, 02 Feb 2024 10:37:03 -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 1rVvb8-0000Re-PP for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:58 -0500 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvb6-0004Z2-VS for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:58 -0500 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5112a04c7acso3670821e87.3 for ; Fri, 02 Feb 2024 07:36:56 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888215; x=1707493015; 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=e6ecdA6XprRoNkA0wb02c6VKGclESqrERe4VSdnbqBk=; b=LzsxvyviCi2kTBG/iVhLeILp2s+n2VAjVzl7/HEvuglzogZxrrLndYa6QL/eWURllq nOc5w2LhNIJuLuPprSgahdFMOO5nhIBD/UpOGaxCXRkyfTB4i9mQCbPGp9jd41bK3MQG cHDmnvLf92vMsiZiPSdySlAhp9b/eabOPIfTr/+NP0BjGwmDU8lsupNFbvP4Vt9wNm8G MMMxk6LzqPRTJW1rQki711ikpPVPvy9Uj7OyWwYlhp2H7bxdquNLDpb+inWOGi4F6a8Z I3dsVj8eMoHk7I5SkOkwTUFl43bcNVU1iKI3YZkP969wxr9y6pzrHAAlbLcPim6grrNl BUTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888215; x=1707493015; 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=e6ecdA6XprRoNkA0wb02c6VKGclESqrERe4VSdnbqBk=; b=ju3XJfONWi/Om/Xb7+Acgqx/nVUoJXNhDBKSLcwNkdz2DmamKYIb5Q0KZYGs+jmjn1 G1cZSMibxGWclkouOc2hFmEXDMTinGCtDwrDcFa1LsN5eYCgkq9M4sXii0CBRqtxqyAZ dbN+oDXofXF5x7jwvqZHdri+jETd4c5dJ1vdVNum5U4UMGZLVcjoDZjYlRXfWMz7XXPg AlxjmwX5JAwhSzskFNhtJhmiiNGGjulPg/Ivdm8Xwn6fs6NolidEJeRlOc5xKtRhsz5+ kW+cwrsOBQCTjQXMmkknAIP0hDG3wfw1Vuph8WiKWw4HfyxnhbIBTEgVc82V2hgRVyuz lS2g== X-Gm-Message-State: AOJu0YzKjX/z3I+DfGozMFwBItN82n4K6ludfAu6fciV1jv13V9DEQz7 qeWICQKJpn9yAXipJLnQlhfhkV5S/+EcqQILX798/nvJ+B6b6u6P9lx/LX22cdeARnjqKwRgfgx R X-Google-Smtp-Source: AGHT+IHavksK5pw5zPNT6iQaJcvadijdzn84/FbwsSXNS9NyNYmaZRrpENdNaueSB0IXmxYtChtJww== X-Received: by 2002:a19:6912:0:b0:50e:50ee:f378 with SMTP id e18-20020a196912000000b0050e50eef378mr1492125lfc.65.1706888215271; Fri, 02 Feb 2024 07:36:55 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 36/36] hw/arm: Connect SPI Controller to BCM2835 Date: Fri, 2 Feb 2024 15:36:37 +0000 Message-Id: <20240202153637.3710444-37-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x12b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706888317917100027 Content-Type: text/plain; charset="utf-8" From: Rayhan Faizel This patch will allow the SPI controller to be accessible from BCM2835 based boards as SPI0. SPI driver is usually disabled by default and config.txt do= es not work. Instead, dtmerge can be used to apply spi=3Don on a bcm2835 dtb file. Signed-off-by: Rayhan Faizel Message-id: 20240129221807.2983148-3-rayhan.faizel@gmail.com [PMM: indent tweak] Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/arm/bcm2835_peripherals.h | 3 ++- hw/arm/bcm2835_peripherals.c | 17 ++++++++++++++++- hw/arm/Kconfig | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/hw/arm/bcm2835_peripherals.h b/include/hw/arm/bcm2835_= peripherals.h index d724a2fc28a..0203bb79d8c 100644 --- a/include/hw/arm/bcm2835_peripherals.h +++ b/include/hw/arm/bcm2835_peripherals.h @@ -31,6 +31,7 @@ #include "hw/gpio/bcm2835_gpio.h" #include "hw/timer/bcm2835_systmr.h" #include "hw/usb/hcd-dwc2.h" +#include "hw/ssi/bcm2835_spi.h" #include "hw/misc/unimp.h" #include "qom/object.h" =20 @@ -66,7 +67,7 @@ struct BCM2835PeripheralState { BCM2835GpioState gpio; Bcm2835ThermalState thermal; UnimplementedDeviceState i2s; - UnimplementedDeviceState spi[1]; + BCM2835SPIState spi[1]; UnimplementedDeviceState i2c[3]; UnimplementedDeviceState otp; UnimplementedDeviceState dbus; diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index 0233038b957..d5573fd9545 100644 --- a/hw/arm/bcm2835_peripherals.c +++ b/hw/arm/bcm2835_peripherals.c @@ -144,6 +144,10 @@ static void bcm2835_peripherals_init(Object *obj) /* Power Management */ object_initialize_child(obj, "powermgt", &s->powermgt, TYPE_BCM2835_POWERMGT); + + /* SPI */ + object_initialize_child(obj, "bcm2835-spi0", &s->spi[0], + TYPE_BCM2835_SPI); } =20 static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) @@ -402,11 +406,22 @@ static void bcm2835_peripherals_realize(DeviceState *= dev, Error **errp) memory_region_add_subregion(&s->peri_mr, PM_OFFSET, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->powermgt), 0)); =20 + /* SPI */ + if (!sysbus_realize(SYS_BUS_DEVICE(&s->spi[0]), errp)) { + return; + } + + memory_region_add_subregion(&s->peri_mr, SPI0_OFFSET, + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->spi[0]), 0)); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[0]), 0, + qdev_get_gpio_in_named(DEVICE(&s->ic), + BCM2835_IC_GPU_IRQ, + INTERRUPT_SPI)); + create_unimp(s, &s->txp, "bcm2835-txp", TXP_OFFSET, 0x1000); create_unimp(s, &s->armtmr, "bcm2835-sp804", ARMCTRL_TIMER0_1_OFFSET, = 0x40); create_unimp(s, &s->i2s, "bcm2835-i2s", I2S_OFFSET, 0x100); create_unimp(s, &s->smi, "bcm2835-smi", SMI_OFFSET, 0x100); - create_unimp(s, &s->spi[0], "bcm2835-spi0", SPI0_OFFSET, 0x20); create_unimp(s, &s->bscsl, "bcm2835-spis", BSC_SL_OFFSET, 0x100); create_unimp(s, &s->i2c[0], "bcm2835-i2c0", BSC0_OFFSET, 0x20); create_unimp(s, &s->i2c[1], "bcm2835-i2c1", BSC1_OFFSET, 0x20); diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index db08a00a45b..980b14d58dc 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -429,6 +429,7 @@ config RASPI select PL011 # UART select SDHCI select USB_DWC2 + select BCM2835_SPI =20 config STM32F100_SOC bool --=20 2.34.1