From patchwork Fri Feb 2 15:36:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769215 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973482wrc; Fri, 2 Feb 2024 07:38:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IH0w7OlnR0UWvdqpw+6bDCoRrQnIzgK1H4G9eOyocXZSeBwdJHRP5SL/DuiI6irMXXScLFr X-Received: by 2002:a05:6808:e86:b0:3bd:59da:57ba with SMTP id k6-20020a0568080e8600b003bd59da57bamr8666321oil.59.1706888312599; Fri, 02 Feb 2024 07:38:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888312; cv=none; d=google.com; s=arc-20160816; b=rPjSdDvFvi0mMY2TWSSXVwN5VIXH3Cv5SEs5htGSAQ7j2sQGychNaSoDGouIU5YRHq 2uiAQuSrsI0LYf0TAOc4XZoJj1m3FC1EeY3eUAR5/ax7qlWwMi4MEAKwQLYrGXGRtU5I 9/TobT9nNznVXOH4YyREvbfy7bUWJIqpRgbDRHgh6PSgID6HLmX6g5A79Km8mOMfnwOj 1KKWx1rTp7gGYD3LF6HhLPLs/ug3WOIDTDJhzyZjVgtvFlxqbFWIEmNW6UfCDc2H8gv4 /+EWk8t9bZuoNvyNvzj5R2DPRWoGK1T4GM0UH5ZU0TifiThpgGAK5NDn2WMAr3qqT6nH 5aeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=QRkC6R0A/Ijw4AEfBzkD0qNh2L8zWNNbkytmxmpXoIc=; fh=zpjWRSenlUNFfzi9bj9PKUiBv/Jj4nPzMp77es8AD9Y=; b=UzGqe8MBZGT+pcIAHZFd+PZkPTFPgykW7kk49xo7RBCBvVMZ+7sbnM8mkkW7EQvnll XBY1L/a3t4Rv7XfavnbcDB3KoWnY2Nn8VMqIGW8mN6M3GEWVJCQMI8DpVb8HShZHdZdW AnV+uhRvo761+dkn/Ndlby37lVOf2jwQanfZ0iHbZTFXRV9/ht3aEEqK+PftUTpul+Io TDldEV+5Rrz9zuJcTSc43slNLZEEIvwQKJsYBqMRT/1JFFgE3RYK6A9l14FC8fV1w99d gh5mbJWPUzekFL7j9qFwFx/zuN8ym9FXKKHTFwK7nibOkllvoPVkIFCIMCtKLND51ReO eOGg==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gU2miu2P; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCVGLrY+5jz9hVK4kEQXl1uV6b04XHM8DQS+aCU71yJKGmHHmy79t/C0zPaS0qtw46+2Z9oviM5uhECunEMt8txH Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i2-20020a05620a404200b00783f710e871si2447543qko.548.2024.02.02.07.38.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:38:32 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gU2miu2P; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Jan Klötzke 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ötzke 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 +#include "qemu/bitops.h" + /* Valid Syndrome Register EC field values */ enum arm_exception_class { EC_UNCATEGORIZED = 0x00, @@ -80,6 +82,7 @@ typedef enum { SME_ET_InactiveZA, } SMEExceptionType; +#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; } +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) } if (env->exception.target_el == 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 = syn_insn_abort(arm_current_el(env) == 2, + 0, 0, 0x22); + break; + case EC_WATCHPOINT: + env->exception.syndrome = syn_set_ec(env->exception.syndrome, + EC_DATAABORT); + break; + case EC_WATCHPOINT_SAME_EL: + env->exception.syndrome = syn_set_ec(env->exception.syndrome, + EC_DATAABORT_SAME_EL); + break; + } arm_cpu_do_interrupt_aarch32_hyp(cs); return; } From patchwork Fri Feb 2 15:36:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769236 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp974106wrc; Fri, 2 Feb 2024 07:39:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGyr7amIt2mFmeJbqnOJBx5Ekjkjp176x3ib/J2q0QEaLl/nC7UPdt+d77jMcClbwess8Sj X-Received: by 2002:a05:620a:24d0:b0:785:4431:c5c9 with SMTP id m16-20020a05620a24d000b007854431c5c9mr4849625qkn.20.1706888395631; Fri, 02 Feb 2024 07:39:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888395; cv=none; d=google.com; s=arc-20160816; b=N1rvPSV1O0/z6nnFRcQMMkg6DNv919xEFfLfD2TiMBfJLERJ9Lg7EfX5AVxsC+rdZg X8Bm3OqjuuoakiDvF0qEEoHs8bpDTP+9IP1NAgtT02tJEsTH8CmOMmqiHYSeQFRAyf85 J9vzJWaaTLtVPjy+tr/jzI5QvnYBRUWA9GLg9QWG4JLioTXCCEkxluOnUbHSCN4kUHhA BZlJSh04kO9svE2JMK3RWmuL3Ezs32VpoyS7zMObWNUIN+AA+elq7mwJSR2I4VjCV4h8 JQh+pvE9S7p+ugp7OgG+rOaPlV8KtTVtNFZduOxjyNeN3oVkodEYSshHkuR/qJhyRPuB mP9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=fNKMg/ZJY1ZR/wqUXxwkSX5uKgQGaWhsDdzDVMFs6JA=; fh=h3eW00h02v+JGJuJKkuMOKNGkKRg8VhMolIWd1YWiRI=; b=MyqAnhQMz1wrh3SF2+nZdQ/c7FWCt5szFBHes6BaJQmibiLGDN11zbR7UNefrUiDZ6 Z0oiDn9OWN9VlkbAZyb1hjAvovYWDykV3dt/HXAFyVcAOYhHlqxvaA8RUVsWceSEtJJQ v18KQfa+kv2bATWxRgEQLUuFi8FUizrskGDXqrVojBujQTmEziwSQOLoYdeOu0swJ9G2 GIj2TXxIqqDMh8nrPlnKzDMFMOjc4zE7ToFUzKXvmQ3NnFu6oDGz2mVuTffVJ4bw38Fh 3XWR481KLVhvo2KRV5zL+4CsU7p4q1wuspmW/Xq+SdO1IlvYDO/rxy9Apmh6D/k557bG FAog==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eBxRUWvi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCWfdO9EUIuQVlshU9lyOgqZwD69lloKl+GrltVN8ctzSJuTrEOrRndZr14XPA6pltm+ZCHohtiMQCOPRGIVV2mh Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 20-20020a05620a04d400b00783f19d1281si2256080qks.223.2024.02.02.07.39.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:39:55 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eBxRUWvi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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édric Le Goater Tested-by: Cédric 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 = true; 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); static Property pci_props[] = { @@ -202,13 +202,15 @@ static void pci_bus_class_init(ObjectClass *klass, void *data) { BusClass *k = BUS_CLASS(klass); PCIBusClass *pbc = PCI_BUS_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); k->print_dev = pcibus_dev_print; k->get_dev_path = pcibus_get_dev_path; k->get_fw_dev_path = pcibus_get_fw_dev_path; k->realize = pci_bus_realize; k->unrealize = pci_bus_unrealize; - k->reset = pcibus_reset; + + rc->phases.hold = pcibus_reset_hold; pbc->bus_num = pcibus_num; pbc->numa_node = 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 = DO_UPCAST(PCIBus, qbus, qbus); + PCIBus *bus = PCI_BUS(obj); int i; for (i = 0; i < ARRAY_SIZE(bus->devices); ++i) { From patchwork Fri Feb 2 15:36:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769221 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973583wrc; Fri, 2 Feb 2024 07:38:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtgJwsVCpralaQqAcfG4qYpvp6pIDIQIvpr0xog+HLWDoNiEACTV/TPsb2wlOW3RLxYEIA X-Received: by 2002:a05:622a:1ba2:b0:42a:b2b1:a800 with SMTP id bp34-20020a05622a1ba200b0042ab2b1a800mr10304677qtb.26.1706888326835; Fri, 02 Feb 2024 07:38:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888326; cv=none; d=google.com; s=arc-20160816; b=kWS1Z5FAaG/vBya+0WJZpZaijnnwSsdz2K0GXHpVqNROKPqFyjKqoEO8c7ViTMgStF xHGKLAz2OS8/gwhxtiXutx1QmVGaBi7GXLbXfEYUHDjHGtpWHk5JyRBJ7VrLdS7jUD3I fy1UWScRWZFSlgqbsJUhO5k1b8H3lt4oovEqlRDzM+rD2Jum8rLnO0PMvjelMKJr+aGF 2vU1ZX7YTFWIHeisU5lfjTvFXzM6Df8HohsaS8jtZ+xUllBRAX+/Z2f1H0W59vsXeSV6 6dawrc7tYQOTJP1tfADXE7v/OTmSO/+EYNQS6fQB7CvFNU9PgAJlsLfw7FxvwSGnd1RJ Ouyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=SHSPShdHTgayZl7MMTSLF+LQqIks/NtrtDdxuxWI+Xo=; fh=RGeAH0JnDBwuOqKgFPJUnVTB6kPHvwhC9EvLzwJ+PvQ=; b=UBkW+9fnSpstj8AisWxitfgag99m1D1ENsuNYhmcA2wjfPOjifo/qsTXtuJU4x6zFz IGA8OAlVTU6eq7SC+XrCIloK/bo3LlLxKFzmY20p9cCKe2IHMzgNjp7ujezzKHSKWB4/ CdxRYIMw9B2ofa9yvwYlkvRUj1AXtMMYJyhPPOyTzNHtATVtD2MspoJaGJR63vhdQUAs NtkdXyVtZszWuxXfAB/pTmFvJeob7CKOnxZFYOwvrttEl9m1WK8XjSEYxRf3GiHV58lL a4yTpcp+NVTMLbcHF0jNM+V9IMiuzDujmpU4gIPv/Qi5QCKBTShCDWK03Uqvy1qPqK2z uRZQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TBq21Pad; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCUZj3beACi9sVVsHeYEJRa6CFTzXpXTXLEgAwgwsFS6Jp1C4w26q5YFvwuWZ7hmJLr+xDaYMoG/dZfDgKYuX8Y0 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f35-20020a05622a1a2300b0042aa7504605si2251819qtb.768.2024.02.02.07.38.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:38:46 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TBq21Pad; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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édric Le Goater Acked-by: Maciej S. Szmigiero Tested-by: Cédric 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); } -static void vmbus_reset(BusState *bus) +static void vmbus_reset_hold(Object *obj) { - vmbus_deinit(VMBUS(bus)); + vmbus_deinit(VMBUS(obj)); } 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 = BUS_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); k->get_dev_path = vmbus_get_dev_path; k->get_fw_dev_path = vmbus_get_fw_dev_path; k->realize = vmbus_realize; k->unrealize = vmbus_unrealize; - k->reset = vmbus_reset; + rc->phases.hold = vmbus_reset_hold; } static int vmbus_pre_load(void *opaque) From patchwork Fri Feb 2 15:36:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769223 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973642wrc; Fri, 2 Feb 2024 07:38:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHeSCyDrK7oSGooerRTNi3sajSnZiidSjvQks/0qH/zJ36y4gKXGo4jeDgT4sCJS8VtqCc7 X-Received: by 2002:a05:620a:102b:b0:783:d709:54a3 with SMTP id a11-20020a05620a102b00b00783d70954a3mr6248992qkk.32.1706888334566; Fri, 02 Feb 2024 07:38:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888334; cv=none; d=google.com; s=arc-20160816; b=otGhL2ImsP8XWsQZbGs45ekEP16HSbEte57F7S5+Ah/FbrohUYRwlozDX59mYz5zEw zuz8jBEXw1Iy33Yd9N69b/1sOZxEKvBudvDnbKXW0gkeLM1Y0NjFRNXpAXCNYS6hAlwM iKEkKc9uwRZAP39iAm9ruQqdI00WEHyCViE0OfGNsZDsYUI/Ho5RDhLHIwfd+QsYqi2/ euDns9zZqNifVe4Y27qu7WrsnQsJAOYk/WyojLSV74NFItnlAg1eZeietLq55f6pVz25 f4G287FNKQ2iSFlkx3sn83LFbLXzTwC/TJWtJKGlbPWLBW0xK7wIdZ4CgfKIjJlS2z7V Sk1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=90Q19bchD51USuhMKJ6oc+v8LKqSGaGapSq6FK0X6bc=; fh=zAOm7pE8lLoDsTrqWWJvoz2CkAxkhYknqfYScfMK2Z8=; b=V3aLy0tEeNv6YVy4F14ymcgz4L9B/IbuOQyRE11SzY/lBItNNoDNMJx7UNEcNG+BgU 2Ow4YzPheQmassRfuznnHbNix39N80WrCjxXhzceNK7XJhOSfYfHmskUtPbFBQkj01HN s8PF6bID/ZjIoAufFgmHsKWzFJDasGQymTCdr72j/YPzOwabxDB+YCEtTeGKaXg77ZQB s1nmHjYmf/cq+HVICSaWCfl89yEs572ccV2bFzZYljhZQGrqTdTr8j/hRsrJlDHXJvxv Yy6JWqS8iZQdcapWVa3CueRELWSakSIOJ96x5mPqEDB7GtZwOvMOb9Ubj2LYk6hlMRb2 NumA==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UlaSDmyX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCXIoy5Wkjp5MYdRkJwvCfxl3cTGRi1Au4+QLT7h9ypXw1h8VFoaL+uRxLUKzV7dEpEGuJV8cF1PMxt1UDbftdd4 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bi9-20020a05620a318900b00783efcaaeadsi2512887qkb.195.2024.02.02.07.38.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:38:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UlaSDmyX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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édric Le Goater Acked-by: Maciej S. Szmigiero Tested-by: Cédric 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 = { } }; -static void adb_bus_reset(BusState *qbus) +static void adb_bus_reset_hold(Object *obj) { - ADBBusState *adb_bus = ADB_BUS(qbus); + ADBBusState *adb_bus = ADB_BUS(obj); adb_bus->autopoll_enabled = false; adb_bus->autopoll_mask = 0xffff; @@ -262,10 +262,11 @@ static void adb_bus_unrealize(BusState *qbus) static void adb_bus_class_init(ObjectClass *klass, void *data) { BusClass *k = BUS_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); k->realize = adb_bus_realize; k->unrealize = adb_bus_unrealize; - k->reset = adb_bus_reset; + rc->phases.hold = adb_bus_reset_hold; } static const TypeInfo adb_bus_type_info = { From patchwork Fri Feb 2 15:36:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769203 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp972913wrc; Fri, 2 Feb 2024 07:37:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGMIjR4M6AMqDL6HapkAFa+1S8Rf2qlvc1RbzgJsCg4g1Qb+dkNqaB9Bo3iHsthpIAzS+rK X-Received: by 2002:a05:620a:22e1:b0:785:44c2:487 with SMTP id p1-20020a05620a22e100b0078544c20487mr5567249qki.10.1706888234615; Fri, 02 Feb 2024 07:37:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888234; cv=none; d=google.com; s=arc-20160816; b=0Mm+THat/ICEs9WbJQ0RXHTeHxaztQFw03pVmEuiai6N8DX+nEA0ixBPB9XguiLlD8 9al1exFqTvQ2pUU2wG9yiOvVeqcyGWE8r4dkhBxGmgsOcFaCROOfDHYNcWyygMvABc8r pd1tTzg3VSiT3pRfFaHY69KIuW99he6FDCN4yXCmQrFMbnPvzzzZfFZngRJQTo4FP1HX ELoMiwoAZZcE18yphtIJLNWMgMJabpnx4I/whn15HvN+QydzRn/0XX7XORgX3hA0HaBy bq9SYSI01rote/kcgoowl/CPzRP6C6McD0V/Nixx6kl6T+Pmb2ZZ8lxP1uKOCGbUiWU4 3oIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=1V7+Q0KTyYvIAHFDW7/i7eB7p3uahpOup8LdNc0Y8Zc=; fh=lX57HG0bGBGc90Zv3lVM2DpfACHa29vlfsr5RfhanBg=; b=rqZXiQTLoPgt6qKt6NY1Y3PS7MKXUtsKnD7AJgCJ3wt06bnOki5r9/P15S05Zp7W/n QjlPI59tQzMaKzKMx9fSLuWGmAsgRG6P9fnCJS+En0//1SN59IedjqFOUy9xDGkmbpaL S4VQU2y0aB2Pwbh3GP0M2T91hZUqki9v+63S7us5K8x6Nwl1a9UzgwmpvGvdo3y+bt52 VK0dd+0f5GksQ/1HJqxGtucwhzctw/GgMHSEv966bW0cajbKUAammQJLAWG7DE5WGoQ1 tPEJn7gbYd57pUiABY3/XzwkaSjsaux9TAIEvPeFgLVQBTkWc0bx79vBg8tNGpwTkfEJ 6Fuw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QS0BjLb7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCXa8UrsBNiivCxFXRY6vUBaFtY0L1Fs+lgpY5YempHbRhZCcJARXhyIIgfOWsoxnkWzgqBvwyhT1JHlMarLL3Xs Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h6-20020a37c446000000b0078404c4441bsi2188429qkm.503.2024.02.02.07.37.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:37:14 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QS0BjLb7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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édric Le Goater Acked-by: Maciej S. Szmigiero Tested-by: Cédric 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); } -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 *dev) static void virtual_css_bus_class_init(ObjectClass *klass, void *data) { BusClass *k = BUS_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); - k->reset = virtual_css_bus_reset; + rc->phases.hold = virtual_css_bus_reset_hold; k->get_dev_path = virtual_css_bus_get_dev_path; } From patchwork Fri Feb 2 15:36:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769201 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp972837wrc; Fri, 2 Feb 2024 07:37:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IEiSRn6ruyuoO2EI8gF1V3NElnSWwii5FqjzobcZYACJuh3u5SiAE7HmMa97XT7HXxaAhb2 X-Received: by 2002:a0c:de12:0:b0:68c:88f9:6696 with SMTP id t18-20020a0cde12000000b0068c88f96696mr1116624qvk.23.1706888223371; Fri, 02 Feb 2024 07:37:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888223; cv=none; d=google.com; s=arc-20160816; b=MMOTrOdUMe/JHgoNg/cMD4O+oJJngUv4zJy1+kc5RKYqfIe0Za//yiMT4QFdbzsbrp FbcwU1HERmpZoQwcChCaRWV4s77Fi7xJtmfK/XAiKEjcpwTax5vbaPYnVnwRx1qXFpGT DK3C9546r+492AZNtCqY95N60xfmcdjqyOESYl3NGxTrb5Bivl/XE9PoQLgTINV9CVPO Dwt8Av0d8lN1maO0Qwp4lQfOu07camDtqwyeT/4Hxh2Ld+Ep86xUQRFg6Fe0mtOQ+Vyt bdb/7olbDIlKIjzIdkl/iHRf07S0mpzK3p8XIdThY2KoHNqK5W+5qD+zQ5vHOxXBEJ2b 1Fyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=wyZDr1Zjb+maiQcAIaO52bka0IE0OhCst2zFuC2UbQo=; fh=NZn/1q5lIf35Etrvluokjjt3NT/evVaYVcLZK8u0xDw=; b=U7T2sTvPWEFBd/lF0BtTrIcrulc2WLAb4BAfHK9SsHaeDxcX8q1/2l7BfKfNLlXGx7 TqwH6/whkI8dMxiiZZEWKF9JO06xovFpge9nZtviJ8MrIZ/5cxwnTNfyOoPtxQ4M9/XA N0Hfv18V0EcIQPom5AYOX0o4iB2lvg/1pQgm0Smjhx1cAwRrlAmBihWwrfWEoe8PkhR5 koVnHzFTkVt846eYXbE4160rCGJUQhrhyN8KrqYl9PViRHDuJo5lQmK1CSNjwSumd10G E0Tt0OyllU9R+E5dU7NE5MP/X8hFL5G/oAOoDWZvzD8hOVmuQw7KNMPCUZJgZclvBFF5 ay3Q==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b0z5QJf5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCUEWfiz6EsSoJjn6rU1a+NkJpWhutwkR6cA4CT5dVzkKOMGsZJCabpJKstw5JNGOm5K+B1kvXGZ8MlyF+Wnpfjr Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e7-20020ad442a7000000b00681935c784asi2167309qvr.606.2024.02.02.07.37.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:37:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b0z5QJf5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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édric Le Goater Acked-by: Maciej S. Szmigiero Tested-by: Cédric 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); - 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))); } -/** - * 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 = 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 = BUS_GET_CLASS(obj); - - /* - * This will call either @bus_phases_reset (for multi-phases transitioned - * 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 = BUS_GET_CLASS(obj); - if (dc->reset != 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 = BUS_CLASS(class); @@ -293,22 +242,6 @@ static void bus_class_init(ObjectClass *class, void *data) rc->get_state = bus_get_reset_state; rc->child_foreach = 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 methods. - * + 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 function - * will be registered as the parent reset method and effectively call - * parent reset phases. - */ - bc->reset = bus_phases_reset; - rc->get_transitional_function = bus_get_transitional_reset; } static void qbus_finalize(Object *obj) From patchwork Fri Feb 2 15:36:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769216 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973494wrc; Fri, 2 Feb 2024 07:38:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvu6Fckp5TFMkuU+0uHanDXS0N6R92s/sVwyi2y5qicMbXIi2IIMsLm85Dit2s6r/M1Cv1 X-Received: by 2002:a05:620a:1098:b0:783:e05e:e874 with SMTP id g24-20020a05620a109800b00783e05ee874mr6014492qkk.25.1706888314747; Fri, 02 Feb 2024 07:38:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888314; cv=none; d=google.com; s=arc-20160816; b=HWebw+jJg8NczEHysSyQ53FBYCsKBaq9qNY4nDmbtaeabGQfktB4SxrYfS9GlnF+dA Cbpyp+NQ4jIexadsXugIohLsXJtpGdn00dZp8tCMbP6seB3ALhsYsB/feJU076dG0Ru0 7pJ9KQkfY3xffXJ0A1xBacnKyXFdRn12ZQ/YwzfgsrkUXxM6TKgkmPFGVnzdpPs5PCQR ds0SPYg8TeIpor/1/ZyqwPkp/YHqSYOASQCaI8sRBGjorKPR/8MMDD7SNXUJR2fJy+jd jweG4E6WLbrpKqODq+3AP62t2czQK4QL0clAbpxpIBGaDupQid1PFLCM6IfSmy8VXKZd Qoiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=zT33TDQSpbP682JXm0Djn4kZLyqr6gakrEoe9mM4ahM=; fh=HDBp146JQlGfDwkdJrd8L/es3g4uMHsybXHPJXGDS8g=; b=erj6j5YwXkNcH13/8c13gSYGyByMkj27W72PZtOgoH5eb5Om7/dwlTA4UDDHPU/C4v wDBv47V/nb8F9Ly12oDfTKpr9lJ+X5KLIOXyzUU5Fmcgc+6l9lmR6lwz3rmHJ3x59BMs OzAx2fPF17KR7ozIwgzP404Xt1HY7UgYu1UJxRAEZ3I2rycD59s8+ilCpmi3l8f1ncmB QoORa9GdJfe/psifSClb3Hj5u1ueY4LiOUB1uw8obdAhYavYsUUy9hFuxOBkcE2Sx2Cz ELhiywRx8ISKL7v98BFenTk8hgKu7NAzPQU/MFpBwANcPVg1MRtC18J2uSB+Wo/LxUA0 X9kw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mm6mWc1L; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCV0x5ySyBbhHMhTujyC0KugWbSRlzj5w1RgZvHkU8+B7kqaONGSuOoNxTnhMcUK7eut2kb2SXhnaa2ZT5pPRXIf Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a13-20020a05620a102d00b007817204feebsi2192031qkk.9.2024.02.02.07.38.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:38:34 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mm6mWc1L; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é 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 = num_serial_hds; - char label[32]; - if (strcmp(devname, "none") == 0) - return 0; - snprintf(label, sizeof(label), "serial%d", index); serial_hds = g_renew(Chardev *, serial_hds, index + 1); - serial_hds[index] = 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") == 0) { + /* Don't allocate a serial device for this index */ + serial_hds[index] = NULL; + } else { + char label[32]; + snprintf(label, sizeof(label), "serial%d", index); + + serial_hds[index] = 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; From patchwork Fri Feb 2 15:36:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769211 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973345wrc; Fri, 2 Feb 2024 07:38:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9g0GzFS+IG43zaRaY9bGA/rKel+khgUlUcUW3TUgIu2Gl/E92/K1MJ2EcNlOqVN7d1qME X-Received: by 2002:a05:6808:1808:b0:3bf:c0c3:c931 with SMTP id bh8-20020a056808180800b003bfc0c3c931mr1589612oib.23.1706888296432; Fri, 02 Feb 2024 07:38:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888296; cv=none; d=google.com; s=arc-20160816; b=dsB/lz8d0fyX2KM9gq1qF2yAkKh2V7oro9JMJxFPnFquqYzoF4bVoavH0zaONh4mwM NXooZqXBcuL5yXM9al4mayau+uzVxLaeEemsrrAoTRHUmNeRluXSn8fQVocx/u/xjUzS MdkOAqESWUzxcOHzql3hTq0jSSVqs9isP23Cez3s17vtCd+O94b4/83lB9cHVLGQh11m Ca80CGciZr4t4GQNsvsi4A9Xw774WhnzC8r/8i1FEgZm7GMgEsqVluXTOi0VjGR0R8oa 5tZ8hFbbecq04kEYz0DcIL26MYcOhyxVjxeyGuIR9YeZexH8ajA2a8xPcbFj1k/dCfuf 5X1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Y9n/AEkxgug8LnVgrJ59ksyGPxf9vBmtyi9ED3ze10g=; fh=9+k7+Czgh+psiTHum3D0wc+tQo1z9kvahUX7cSNUJxk=; b=nQTTf4gCAD0JTHQTFj/65jnQl/6C/gTu8Hv9HpIOMA3K5guw3f7PS+ONag5Cu2jmdz domXWhVU0uP7/8N/kR0M/UNWkcLDrBLbS08FG3MuHY0z2HZkAP5uwTeiRDjVkZz+jiaW cjbymSLFhlyVReySmWVMFBH5HLRDDK1aKJ9ussyeQ5yB+0wSNvWQsJRn5uW58LMW17M/ I+7HaN/hm/vbHs9PMafSjfLJtojsu60q3YhZQZoZOsjN8l0nfM7m8oa7hVJkKT+ER6Qq whyaMpbMLji89q4teW7dhfhXy3ahbInPXWcwWhbxzzOmSqQsGGPZO/gohzbSNdep8w95 JmQQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KtFlnEfD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCWFLUZhvuWNqzAh+40NTePbGDwLf/6B627+e5pBsrMs/K96zay3RVG5GFVSYIWYOAzh68Jbjz7QJ9+14r8Ug5/O Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d15-20020a05622a15cf00b0042a990ecec9si2218368qty.254.2024.02.02.07.38.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:38:16 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KtFlnEfD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Reviewed-by: Philippe Mathieu-Daudé 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. - Use ``-serial none`` to disable all serial ports. + You can use ``-serial none`` to suppress the creation of default + serial devices. Available character devices are: @@ -4151,10 +4152,17 @@ SRST [Linux only] Pseudo TTY (a new PTY is automatically allocated) ``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. ``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``. ``chardev:id`` Use a named character device defined with the ``-chardev`` From patchwork Fri Feb 2 15:36:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769230 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973932wrc; Fri, 2 Feb 2024 07:39:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHN8ai2xIkBzQ5Qm/id2za56JevHj6qsZFGLVAGWf8R+XZ1zpwn8DJM+B60Eilg4bpHAtA5 X-Received: by 2002:a0c:f145:0:b0:68c:539b:b493 with SMTP id y5-20020a0cf145000000b0068c539bb493mr2063358qvl.20.1706888371199; Fri, 02 Feb 2024 07:39:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888371; cv=none; d=google.com; s=arc-20160816; b=Fw24ERLrS3yq5OE/CN7Dny2QrMseWE51mXiodPPYzPoSHwJ25K/8xaIKuipQEHky5M kMJTY7nY/upbGddwp6TIXQVZI5+WvPCetHbZCBb4fBXe1dPBHGLE9ZddWqqoJj2f+Qt1 RfLZ7RPmwvbL4PwrDyw5HCUdC/9caPOb6QyEr4YikjSb2uyL0gLp9+KIXiaRCgcDhhEI NIdV9qiFMjXuBhCxPISY3gY6LhIw6B4Q5dCnCVBsUt79xi6NDWDVLr4yCVHLOQsLvJ0L 7oakFlSSr8CGfrNU/JU25DnDFPCUNN9QFXgzaQ0/Xok5Ujt0i2J2fcXGdLm6cc3gVDdj Vq9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=XXyoo0uTxQx7WIeKUGD+qu1FchhSMRmgTj+B/msMnZw=; fh=BIAG9iRQXzk5Xtgi0ho0pxVw8pXcWSys3GWppjrTcFY=; b=BppQq6CwXt79PpP3x/eFMRxV+gBRgr9ezwC7GF+PP7BF2GgA1dS6ZyYEyKMMV5oTkh gkgjEizMCfDYskn63UFT9Vbg47am98j9nOvzHzps5gH7nsgNWMlhEQhH7NiwbSd0tw4j 9LNKKvQCVqS126SAvmWKl+tp+9wk2YSzsqa0QEh7aO8qdp1CH5qsom70uU+/FPwEsrKu 0XdvTiJL7mU1PuUJFEQjGHS+du8xnw15p2F7uaS6SBZzLWNx/xAmtaoSrK7JRvFcZwnE NrkcG9HVpr4Ez7Ps8tRLKLf4QsPRjyJeakroNg/89gW4qNC6JgDbDlB3IUMC8ZPVEA/Q DURA==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EmC/UTeM"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCU6PMB9uAOKLGMczs0yVJxb10gimyKWckx/5zKpVhJVC4iBW0hztSrEwHmMv/kXP5K0KdTSj4do9h4oAYZ6naoH Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dp12-20020a05621409cc00b00686afe6edbdsi2157831qvb.74.2024.02.02.07.39.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:39:31 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EmC/UTeM"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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)); get_cpu_reg_check_zero(id_aa64afr0_el1); From patchwork Fri Feb 2 15:36:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769227 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973873wrc; Fri, 2 Feb 2024 07:39:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHub+3K3TBso+EqLv3g2FDW+s1BgIEDmOo3j1Ff7r65BmR3W2pRMQeHdIa8Qa0DA47RIb97 X-Received: by 2002:a0c:e082:0:b0:68c:35ad:4244 with SMTP id l2-20020a0ce082000000b0068c35ad4244mr2212800qvk.54.1706888364447; Fri, 02 Feb 2024 07:39:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888364; cv=none; d=google.com; s=arc-20160816; b=VgN0ansGkS1GBnOajXg73bpKyRN2myaboUxYzGUODAiVjfuF+kTrbw06O/51RJOO+x q8eHZcjAva2mm1wpDmSguFDGWayTjC/Uhy9Pq2zrrWZJcZBNkXVJMdm6at8ObycVMgGK CQQTPkuQCt6AfsfZZqseGrhYkSQDJu/P6uYorpXnn9KoS3kaH5r8mJ7VHqCKdHPjqnq8 brjJsjpuNb8MbqdZXKlfspnpAfdXTEa8poQUCNpqmiHcdBtSLsj3wqSOFiF8uPE9zOxm vrcJmTRGe2ttU123SSwkmxpmn6PUmnGr9kX5V+/0EnzTt1Hcx7gqqU6QCJULP90RhY12 m6GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=yhQX2lsO6sUMNlz849ghUPa03+uYKB43z4lr+2t+Z6I=; fh=6CNgTuOblGBWzdd4YR31N1fM6HuYZM72/xrWU043yKs=; b=gSRM3enTv6lvDx72TmpSFW7n6KBk/1ZRzNcyuHt0hjr19XZ8FC7toMoC4Ti5kBetHF FZDfJSBpgX1dDaYM5jNu2mQkB15ZEqX2pZTVZZNQmuI5pNVwdrzCeeZz4fiM5BrC+h12 Zpa0xbGaguUDbohG5vjoQNGRHkt2zwFzv4f1kcoKKDm8ngy4Tfw1tGzh/qMCZAm56bHn tkpqMSfNMPagbZYEGPHeXlXex/rIwKvs1jytDpQTNxpCSAwO6+TTMj6U9ajEoz0KUQj/ OrFs/XfrzT/NNlMEPt74xbnwIgkzzwGo/pStZ2qjKhekIu4GeVWvtSRjv7vNZC67is1G 8Pxw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="gX/lDcsE"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCWc6bR1IXRRQS4eUtdTJyqfi9JuVanizjCvR6OMYnmqyPMbHz7QcTybBa1TKoCe2u5o5/aH9r7jX2W/me6+vlpE Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s11-20020a0cf78b000000b0068c7daada1asi2297718qvn.94.2024.02.02.07.39.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:39:24 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="gX/lDcsE"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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; } +/* 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 = 512 / 32; - uint32_t rng[cnt], prng[cnt]; + const size_t cnt = TEST_DATA_WORDS; + uint32_t rng[TEST_DATA_WORDS], prng[TEST_DATA_WORDS]; size_t n; trng_reset(); @@ -343,8 +346,8 @@ static void trng_test_autogen(void) static void trng_test_oneshot(void) { - const size_t cnt = 512 / 32; - uint32_t rng[cnt]; + const size_t cnt = TEST_DATA_WORDS; + uint32_t rng[TEST_DATA_WORDS]; size_t n; trng_reset(); @@ -370,8 +373,8 @@ static void trng_test_oneshot(void) static void trng_test_per_str(void) { - const size_t cnt = 512 / 32; - uint32_t rng[cnt], prng[cnt]; + const size_t cnt = TEST_DATA_WORDS; + uint32_t rng[TEST_DATA_WORDS], prng[TEST_DATA_WORDS]; size_t n; trng_reset(); @@ -415,8 +418,8 @@ static void trng_test_forced_prng(void) const char *prop = "forced-prng"; const uint64_t seed = 0xdeadbeefbad1bad0ULL; - const size_t cnt = 512 / 32; - uint32_t rng[cnt], prng[cnt]; + const size_t cnt = TEST_DATA_WORDS; + uint32_t rng[TEST_DATA_WORDS], prng[TEST_DATA_WORDS]; size_t n; trng_reset(); From patchwork Fri Feb 2 15:36:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769222 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973593wrc; Fri, 2 Feb 2024 07:38:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFuBgdgAePOgn/w4kuo4X/ubQ3Jdz34SCqk0lUCGeZQOjjG0HMrnvj5vq4sP/suoIH8ypYf X-Received: by 2002:a05:6214:1245:b0:686:a202:ee55 with SMTP id r5-20020a056214124500b00686a202ee55mr9747682qvv.28.1706888328413; Fri, 02 Feb 2024 07:38:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888328; cv=none; d=google.com; s=arc-20160816; b=Bw9dja5oPhI6AAF3ub+7/GMwj1nyi+doD0yCQu2CON6pMyBpAOWhJ2G5Xqd6g6KA+/ D6ddySJACo46NIEEJmI0h7RqW+7PwwWjRU5PHe3EJcvDuSrCuCgboqiQLzExLDHw1Y9I Z/p2ygkQA6M8AR1WWhBIQWiBXt1zSJeiv+qPmtuDHj03XB4oaUQoiGh45HB42PLTli33 +nR8OuCu7nSIwpGEGafeIwjlel+XNDeI3R1/LmQteXAnXU/LZsruDJKzhtWN2DCb4qst Y8U86eFFX3OIZrBFmfKrVgdEO4ASfXQUOraSwx3N+RoTRfXfNs3nA8PkhYtUzSarX91q wbyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=3IztTFtTp/gI4kdSRMU2w+rciRT9b75JC4Gb/82o25A=; fh=e2uF32OVxEHbFBnirkvYkL7yZbbkhPg2E+xp+qHrKZc=; b=asdTXQ8YrnXTHAPTpoQbQ2O4X1HPSqaStZma7kTAWbG5l3BM95GkY/npbIZ3yoHMUG HfOX3zbFkmWFvGg0JV1zi0RGt7u+E7U2TPBEXpCUSIPoA0Q4xgEZjIYluVOMN15gwpQa 6C0sew6Us3pvJVLZMVxhCmgCdqkJVuldsIacjbpKi+Sa8MsJZO27QG1NT8WudNY3Ltks CR9/xIYcDNS+pTUVjosAzS9Sd6/DWfhWqc+E4xVamEtpBF4yckgx5UWYoIW5pQ1fBABn xGQxH15W2K43gew1SeUb9dhuqb1sg52QTIZ7kWMLF7MqIUwcHpidhZ/FXW1S20zxMVmU z+WQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mTRrMiMa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCV/bxMdLb+ix080ZhAw0z7krW8ucslc1HsCZLuJ4Z0QGPOh/xBeOXmf5j+YlBFFD+gdHqrXV/c41fZSjnt1+EXd Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x15-20020ae9e90f000000b00783f69d7f94si2195124qkf.367.2024.02.02.07.38.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:38:48 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mTRrMiMa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 = 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 = true; /* From patchwork Fri Feb 2 15:36:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769202 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp972861wrc; Fri, 2 Feb 2024 07:37:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEpiGObIJZQgczixz0+wRPJNvNfEV4c+Wj0sWpeoAoNa03LQQEKOcb56alP2itAxvySvaew X-Received: by 2002:a05:6358:1901:b0:178:a295:996 with SMTP id w1-20020a056358190100b00178a2950996mr9424410rwm.22.1706888228114; Fri, 02 Feb 2024 07:37:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888228; cv=none; d=google.com; s=arc-20160816; b=Ik9qsEEqGMXD/5husZDzM6JhrXNfngkn5baE+h2b+pUCRE7ChT93AVqHPDHpJSjr1r XwcuwyKJ+8sUfR1cg3YLpq3AUX/5NdfdzVVwR7vMkrJIV2odfooV1lVZd6y/JdqOlPjv LcG5zJntOYadL7uSBFq8RyfZ1WKW9aCg1cXu3IrY53oJ8AHOsoOFCV5TRYCggAXwo2pf /X+MAKByNObSjyir5q0+4iiN+UQxaIazZrTjLFMwyksQSVFHyvJWlmgxxhjXHDuvcCGf Qd2vn3QhlrFzAcB3gBgOZJN4/8J9IgyOLFu99anRTpYZIrPT6Gdm4z7FWULuk1a9fmL4 sBxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=nCqjBY1O075hml0hoLAI8QgIMrH8pjs6AsQwwZz+6WI=; fh=QxByAEu6zMrP/NXVMCQ51ftr9mZFJo6Kx9OcvrjifJ0=; b=AbDKJSHZiXar+PAkfLwAVq2ax9BKz6YZ6ShI7qXYaXsMXLo4FA0jFCjj2W2Ko8w9p9 0JEqd0twyh1F7pKe9CJcOchUfynvvvKW/QHH3rIU1QtY00iClDnVD1h4OeWxtwNSld67 00vaKaTEdCRCmU26wFstbKginR2lz+5IYOCok6nOOwbx5TSxyaE1JRconjhEZDcJOrMU BvVwMCs6WNXs6BGM/P3g1jLWJnI3tQe/4ALEqYq2YigI5CPlPHeC4ZlUjPuZVx4Uc3jn zy+li8MZCiry9DCEIrHenvMhXEreVDoeBOhKUHOG72qB3CaKhLxqiizXn0AFpsPN765y DgWw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nCLyTWnI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCUs0s0yZR+gdWQmqKmDTNQvfIXz3j7C9lCKatl/tX/YK6AUoaP+FiwIviBV8aIjwzJ1W9zsSFoa/ssh2AOdKRFd Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q2-20020a056214194200b0068c8c1d5a1csi338708qvk.314.2024.02.02.07.37.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:37:08 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nCLyTWnI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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. ``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, +````. ``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. -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) +def parse_srst(file, lnum, line): + """Handle an SRST directive""" + # The input should be either "SRST", or "SRST(label)". + match = 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 = 1 @@ -113,6 +121,14 @@ def run(self): serror(hxfile, lnum, 'expected ERST, found SRST') else: state = HxState.RST + label = parse_srst(hxfile, lnum, line) + if label: + rstlist.append("", hxfile, lnum - 1) + # Build label as _DOCNAME-HXNAME-LABEL + hx = os.path.splitext(os.path.basename(hxfile))[0] + refline = ".. _" + env.docname + "-" + hx + \ + "-" + label + ":" + rstlist.append(refline, hxfile, lnum - 1) elif directive == 'ERST': if state == 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 line 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. 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 DEF("initrd", HAS_ARG, QEMU_OPTION_initrd, \ "-initrd file use 'file' as initial ram disk\n", QEMU_ARCH_ALL) -SRST +SRST(initrd) ``-initrd file`` Use file as initial ram disk. From patchwork Fri Feb 2 15:36:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769204 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp972918wrc; Fri, 2 Feb 2024 07:37:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZJ2FUTKg6+4dL6jBzGk0zPKJg1t2xkqjBferGBzutbU1R9YHL5jjb85HnbWrmVejGSSnM X-Received: by 2002:a05:620a:c17:b0:784:af9:6fa9 with SMTP id l23-20020a05620a0c1700b007840af96fa9mr5073717qki.78.1706888234867; Fri, 02 Feb 2024 07:37:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888234; cv=none; d=google.com; s=arc-20160816; b=Wk3aGrChalHS3fO8bvjMXsApdryq8wOdmjNqZb5OdsC/cLQFFBbS5vADwQ5ISYZvYY 1ZOHpQNGSvCnBlWYtJZQvspKMeSYfRLlEY+GU/TSKkClu/NilnL9mpezNXPhe8hvvegH u0AmP1cIyxqXUTgtGcWKwAbNXT+rpKK804GcvDFET2nVS9951r1TXgtfL0s/13WN5Z9e NtaoL4mcS/3cTKF0iAsUD9o8hYNDbunHhfiN0AwTwOwJzocxfzsmk7qdW3K/2E0cmFRX nljw3OtLm3PSvfjXSyW3YA44SvAxwrqZg4z6HipF5bIAlT8mQc+Zpm53Py967DzlhO1q Zn+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=k/KtHzrgDY0sCTDgXF5o6E+FF2YFpOZCP9knTxPgJ0Q=; fh=+yC8ekPb2fibjbkqaKED94jJf1iUbZ5hvM673ggm138=; b=IJNbIvnKg7/JRJfePan/aeRGLIg4HCJJJBrqA7erVo6atkG/MyLM5E2lAFSyz/Wqeb nqkHyDv3SQ+XCdpiq9AldW8YyHiNfI78gltN5DJRFI273H79uiqGEswy2MBSneeLzuNZ kV8SkqjCvRNb7FajmLLTaHVyauxV08Ror86w+q9Fw42+Ayxd4CVi/XoVSJSuFLe0WQLG VJkZBTOvyjzzPnID8HTOCImpdDCmiAEwwrUudo9RjmYPJInp9Dijb/ug22VHcY026zKQ tUpdfcGPasAhYgD0W3ze1T2BNr7vn+zVELDLc1oYGjcIFLCLqk+Tx6c69GABBi9GN6RG 4S5Q==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OYvMROQj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCXK7dnBYZHxUhdoPYywxwpPjsRRP6y9Y2kxHm5V/l3ZTB/zJpPSqVPLx/KKQfM61NqwhS1CALQT/gQ1kvGnN54g Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f1-20020a05620a408100b0078329ba5054si2527339qko.193.2024.02.02.07.37.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:37:14 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OYvMROQj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé QDev objects created with qdev_new() need to manually add their parent relationship with object_property_add_child(). Signed-off-by: Philippe Mathieu-Daudé 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, Error **errp) for (n = 0; n < EXYNOS4210_NCPUS; n++) { Object *cpuobj = object_new(ARM_CPU_TYPE_NAME("cortex-a9")); + object_property_add_child(OBJECT(s), "cpu[*]", cpuobj); /* By default A9 CPUs have EL3 enabled. This board does not currently * support EL3 so the CPU EL3 property is disabled before realization. */ From patchwork Fri Feb 2 15:36:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769206 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973062wrc; Fri, 2 Feb 2024 07:37:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGP0vzRCjwXl/LmKv/M6RBTYTDPSFTg/8Egekxoq6GToG05zPOI9aMOK7MzY2UIFgcprTJv X-Received: by 2002:a9d:750f:0:b0:6e1:37b:5678 with SMTP id r15-20020a9d750f000000b006e1037b5678mr5708717otk.34.1706888255615; Fri, 02 Feb 2024 07:37:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888255; cv=none; d=google.com; s=arc-20160816; b=S/lEEjjEsWISOdc8U9cjPzlW+z4HF6veyKVrzZa24h6BoOoEN3YewzpYEJjvChK8Dp WSD6jgiujJcRP22MozYqBVEd08tw8oucLyGGIZrR5ocRGPTOa+JH2dW+JLokV7C8kZck Ta3ioNmxIkQ3tt84KnJJTCKGHUa3o3MM8QON5OpvUgfMpmlV9BGX97K/wslit1+1ClcT aa24YEjTd8gX/dAaU/7j2ErVufgaYCeLf7zNtFjoFXDhHjoxHzch4Ao9CUMY7uBWrhjF a+lffrJVs6xGdVJEVPwmkQUcTtl8vRjemHENvDt987NyFO4ewQeqwcDQZw7cjd6cmMGb C+VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=RvJ8JOx/rn0qluSRFPgqZoXgXfokD/UExFxdgtk19s8=; fh=Sev2t3B/2QN5GZSjMZ/rpvn4UQugm7298Fbm2SH5qMk=; b=KTBFVT0x7dIEWvKqJRJ4i/dmrV52AM2+d/b5uuJIYrDxswGRKA7Ksfhq5wWAu0CHfj DhGM7doHw4wYav2QpB/RiXBM4m6/9zgVcHyLCN5R/DYSSMuCPddohBwOu8ABetCJIEoM fjvJ0RnZHXrhoGxZG0v+vYtq9fPd34WlbSn0KHiqSFHjiRhk2NKa3VAGsZFfCk0UY0zC MqbWzSDW5/GYYrPnD1LTGXEvQ1e9E6uu7NygkM1XVZTg9CL8Ty2mHQfdz27NlQ91Vs5v jAH9y87nj7OLjeOjHnXETkVqQvgL7x2UO4JAZAscFcecDvnywsJ8MQazjq+IOjQxB/fc CRSA==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B6k48+oP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCVmqUzMY8/WB7n5/8dm3KekJ77IxMyU3Xvp/VxQRhHdePAB6YNCBDre2RZTuW4v/Z4Qlb0Q/Rbm4fQfeq6yTWa9 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c1-20020a05622a024100b0042bf960c136si2268743qtx.41.2024.02.02.07.37.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:37:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B6k48+oP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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é 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" #define SMDK_LAN9118_BASE_ADDR 0x05000000 @@ -150,12 +151,18 @@ static void smdkc210_init(MachineState *machine) arm_load_kernel(s->soc.cpu[0], machine, &exynos4_board_binfo); } +static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-a9"), + NULL +}; + static void nuri_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); mc->desc = "Samsung NURI board (Exynos4210)"; mc->init = nuri_init; + mc->valid_cpu_types = valid_cpu_types; mc->max_cpus = EXYNOS4210_NCPUS; mc->min_cpus = EXYNOS4210_NCPUS; mc->default_cpus = EXYNOS4210_NCPUS; @@ -174,6 +181,7 @@ static void smdkc210_class_init(ObjectClass *oc, void *data) mc->desc = "Samsung SMDKC210 board (Exynos4210)"; mc->init = smdkc210_init; + mc->valid_cpu_types = valid_cpu_types; mc->max_cpus = EXYNOS4210_NCPUS; mc->min_cpus = EXYNOS4210_NCPUS; mc->default_cpus = EXYNOS4210_NCPUS; From patchwork Fri Feb 2 15:36:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769233 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973988wrc; Fri, 2 Feb 2024 07:39:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFFniqib7TgIf7WULmgKqrP+hW9uQIcFxZSioPxEwmizPW6Y6fhD6AdsT7QkF2cjVUbmzz X-Received: by 2002:a05:620a:145a:b0:783:daad:3fea with SMTP id i26-20020a05620a145a00b00783daad3feamr6228749qkl.9.1706888381035; Fri, 02 Feb 2024 07:39:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888381; cv=none; d=google.com; s=arc-20160816; b=0SrmBaNIGzYxoQICVcZ5FjNTFz9l7fkT8kKpNb7/7eGB6Say4vYluvDO90+UqYHGxd zNX1+pTAHdzbVpM4ihB3YrVeCLP6i6Tiq4NOSL/wu5ZF3Xr+1ZpQBHr8euFAxkPJGTaH +RBQbBrm/0W3YrTSkzCZsfEnmFmabbdEe6xwEzAkM8GJ/RwPBdqq5kHmHunFcvl0Bkhu oUm04yYs2h5HIT7stXdpZOeTSLdKsNTXbdIj1oqYRYNP3r6nBFd+uoQTBetWao45YpHX rZEWJXomYGsX2yZWXHA8n1Iv/PX3cb2zqHHYje0nAGDt5yPxsOtwagpQG6u8LKt4QZ4S z1ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=DiMJCghid+PXdwMM48VSgNrU6KzfMReU7rheuaNV3y8=; fh=oJIfZT2GjoIKuTk95Wd13yVCIUT8Z2GZ1zXLlqlsWo8=; b=pibhViehY2vvTifGJkoxiDI1gX3GldKp5Fk4fOYmOkXGGl2tkJe0mrbNfrKoMya5ty Xb92Nsm04bkQSrJGYW4BRqF2wSPOaDhh502acZpyKGHdVA2mqH3pqQPocU5heZYnv/A9 uBCTjVuapyTNjhdmD0LtBPNCDTw2KW/7SG3XLmdnzVqE9jpHk/7ItOePQ0wiJfXVRsEo 2JWoTwI3U5oDSmrk1ZMxSLOGWZBD28SfbvqpLzE5x5GNsSoB9ap/mkrt/TdqGhEl2xPx OrD7qvOdZ+usA+iZvipiTitEW1L7yqcoQ/RdogkC197RM5GI0dkZwOhjZR8LLDDw+tN3 gfdA==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GgFwwRK4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCUBvvEbgR2zubarI5bX8F45r7nkbF04bBT/CbPnp69kzA+PFFvdWSU9r2oZ04qRJWR6GsgjB+WZ3P9CKWUPHkjT Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g9-20020ae9e109000000b00783ab4cabfesi2284402qkm.150.2024.02.02.07.39.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:39:41 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GgFwwRK4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé QDev objects created with qdev_new() need to manually add their parent relationship with object_property_add_child(). Signed-off-by: Philippe Mathieu-Daudé 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 cxmachines machine_id) cpuobj = object_new(machine->cpu_type); cpu = ARM_CPU(cpuobj); + object_property_add_child(OBJECT(machine), "cpu[*]", cpuobj); object_property_set_int(cpuobj, "psci-conduit", QEMU_PSCI_CONDUIT_SMC, &error_abort); From patchwork Fri Feb 2 15:36:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769224 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973700wrc; Fri, 2 Feb 2024 07:39:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IE994FLp7Nwwea7bL+eCsJ2xec7nIRZlmvFK1f8kK3pARhURNy/KzmNEPgegtEOA/Kp8ygv X-Received: by 2002:a0c:e7c6:0:b0:68c:5149:7619 with SMTP id c6-20020a0ce7c6000000b0068c51497619mr4301663qvo.24.1706888340326; Fri, 02 Feb 2024 07:39:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888340; cv=none; d=google.com; s=arc-20160816; b=WCyMalPK1PvWhp+GKNKsX/5kbyFUrMdDEGerajhOGYQqdEnteJf/WAHAhijOh7Yqq9 OWrPr8L2fMqRBFZQ8ETgUGJ2MOm7S8OVi5TswHBRdiatfIQFFyMJocynBMlcdlzlkNO+ 6mNlhl+8SRv2h0GQIeXzrFMDAwyZ4kUbMljMH9bo3gjJfnxDhUI2Eswn4JDeCC2LcSfH P8XrdP+XqTrSXwmEuUQ1Y7mT4MGD6gPsR6K2xrLHDeX1B/zrqA01gIH2lomTzpBHdHAx FRlyHRtCf1vHJ/0FRFFB6J3XLwvRXfdxJEHOMwgwisnPB6Atavpyhz9TJyuOrCksUl7G Hwgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=RYd3QrmHD9UKjdfu51z5VjEqtJezN+iOtcmmSJ3N4Eo=; fh=bOHHfOd6K2XayEaX1UhPG2K0PWLFrna6hzYqflqWc+g=; b=JjzXzRxObiQDl8iJHb4RQ1dfY/hZWQBCjLJbDo+iZB1/X9U9whphjchq7uXgT+tLhP Mma4N+u93mEyYhrrykrkdI3M6dzqi/O00meo2DHSTbvrcrx8EmWP1AfD9+C53/wC23VC wjkcZR3EGGw9uiIBbWNwynJvkr10uKIbw0547x2+BMgahpvBb7+pA1lNaZlu+IEtrEbE IGjgztFwsE849tq5kKZnyCGtNY/wNG+Rl2g6dc1FGoNQ4iO4OmNKCSY1BAsWVE1KZGOz eAbXa41EVLma9ZHEA4JtH+r7XgkZ3LJSjKmFcBOrNhtZaLbl3KY86ED+9OSDqqF/ELVj 3BwQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IL0+I6LW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCWukA4UwOd3Ic7peWpsrINPFZGuciA0HuNnDfTrj4C8qwkpSSDSBILrGtaqA+yqqoMGRg8AAgwtl05QEPnMrM5S Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dc12-20020a056214174c00b0068c395e62aasi2239296qvb.567.2024.02.02.07.39.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:39:00 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IL0+I6LW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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é 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) static void highbank_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-a9"), + NULL + }; MachineClass *mc = MACHINE_CLASS(oc); mc->desc = "Calxeda Highbank (ECX-1000)"; mc->init = highbank_init; + mc->valid_cpu_types = valid_cpu_types; mc->block_default_type = IF_IDE; mc->units_per_default_bus = 1; mc->max_cpus = 4; @@ -364,10 +369,15 @@ static const TypeInfo highbank_type = { static void midway_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-a15"), + NULL + }; MachineClass *mc = MACHINE_CLASS(oc); mc->desc = "Calxeda Midway (ECX-2000)"; mc->init = midway_init; + mc->valid_cpu_types = valid_cpu_types; mc->block_default_type = IF_IDE; mc->units_per_default_bus = 1; mc->max_cpus = 4; From patchwork Fri Feb 2 15:36:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769225 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973708wrc; Fri, 2 Feb 2024 07:39:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHjEYErQRh4rw2QwfpoF0o4D/bqUCHpe8XfQrWyYeIg/6Zlvxu5cymrftFJiP1sX/y6xwTQ X-Received: by 2002:ac8:5c11:0:b0:42c:7f4:94b5 with SMTP id i17-20020ac85c11000000b0042c07f494b5mr1170394qti.22.1706888341922; Fri, 02 Feb 2024 07:39:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888341; cv=none; d=google.com; s=arc-20160816; b=YcFT1TMA/EcXsMJ9avgYAfwNA5kthj8pnrF1KYr3sx6P7N211nvcxfX2VR79E5Y8XS qAqmThuJvDZ723b/YarRKAMUd/XCJXyD16gGMAlBjSM+odS/c8hkHKtAGo4YEvexdrKa zJ+x1EKmyLDAQv1WeHi8aCZP8lUVcI6w63utfqMxHDj/GMCyLE2SCv86R0sdp2IEB4u6 JS0M5QNX0PfEtVGHfIl/2jmYB2gqoe+tp4HAFDRgrW4arsDdOXq6XjD4ALpS8wI9g2E3 iDi+v7AvAyFDCJ0VSJqSzUUf/zllvbflZA6PWAb8kr3veiHjTTdLIb6AO+vkVsp07kRI P+Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ROIbqMmLLVZq9UdAkCxZXU8hJKBW1wxg/fAMDNbM68c=; fh=SVVQ1GTMiecmyEGyu/MVF3gcHTNqun6OYzU6ll1ukjk=; b=zvUuVThhWPt/BWqqxkRFBLf60k5Q/gZKtBTv05Fm8iNSEr4VuPCoMJUazk/mWgHEmY 1546HTaV2WtSdhw31gZ20GabydaUjkR1LmZju1BFwnIv3IY092keU94XHdHX23wLb3IH sA31hORxjYAuxJdZSlexmvbaZBzIbJNXth/c0uL7AM+2J9vshHnOsWMSxZVfPfdx79sx ZanGMn5xLReP5p8tcEU547+FQL0Sp979C6q7kA0eJRVYI2pktdPxkNeMYKV1iljaiQJf p7q/zikBp+4sQCtNiAo7Yz9vMqlyjt9xZVmMC/+PS+V2mAT/lu8vjf1r9OHrGkZ5BsT1 beWQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IGet7IlD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCW/wtCDPL8HOidJYsbad7lQXIML917AsBLR+1Qcrxs3eZKQjv4Q4VfldI32lUHpmOh2APyFgK/O0oa0XN+5kMok Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t18-20020a05622a149200b0042a9c45fb5esi2202735qtx.697.2024.02.02.07.39.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:39:01 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IGet7IlD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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é 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 struct MSF2State { - /*< private >*/ SysBusDevice parent_obj; - /*< public >*/ ARMv7MState armv7m; - 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, Error **errp) armv7m = 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[] = { * 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_SIZE), 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 = MACHINE_GET_CLASS(machine); DriveInfo *dinfo = 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 = 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); @@ -108,7 +105,6 @@ static void emcraft_sf2_machine_init(MachineClass *mc) mc->desc = "SmartFusion2 SOM kit from Emcraft (M2S010)"; mc->init = emcraft_sf2_s2s010_init; - mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m3"); mc->valid_cpu_types = valid_cpu_types; } From patchwork Fri Feb 2 15:36:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769220 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973555wrc; Fri, 2 Feb 2024 07:38:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IGECkLqvqGFXCmoESUAj7Kr0VMVnKLFVnVBCXaCoyMO8V2cAh+RkcMOV/8Z98w3hxb7tppA X-Received: by 2002:a05:6870:65a6:b0:218:6262:e2aa with SMTP id fp38-20020a05687065a600b002186262e2aamr43519oab.23.1706888322750; Fri, 02 Feb 2024 07:38:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888322; cv=none; d=google.com; s=arc-20160816; b=ocXjXbt1VsBCi2On/ofpzpKnwMAGrdrt431wgAHjq3QSwIvGFRmo45FTV3kf3Cny0s +EtzRYjY/0jyzQyUi8g5l9oghGMDf4prCdJdhLY2zgPaJgIBgIJiXoPagU5/9XOQzzjY GJeUXp9IDQ1hBlfcYy/ojsV5rh0phbGbW9ISoF/LPFBU4uFIWbajGVlIPZ6eE7LnxWO+ 7gNIVjT5zhkfJh6eKLKUvdDzXKbZfh0rKCqUeTZCuNDsKqD72jeCtXLChLAvQXscjnMc x68ph4ftCHMyJGIp0Xuha5YIu/ZlHjzgBMi9Q98sKFQnycikPwxObQZ9RhNYOctMid43 oJqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ZWs5NQ83i9qIQWdiDsw7uY28XWqWXL7f3H4Vv5HjyFk=; fh=fQ+w+X/wPBzDmPcuvWc4hLJR6OT7LC+oU+/15W2nN4g=; b=Qghz4ksCtdVp+RoNrHNLc7iW90WA0xuryNRooCWauDF35q/A7SDjXCsKTJTvLltY6g 2lSDpmmBikPACNf51qAL1JIvGj9vshzMIlEi3V3xdx38NDo7ITNgDuVVC22gThoglY+c XMm/qBnESX5TUawOnu6212IJEQnQCNkS6xVV/z1E9f7GB9XHe4u7LaiSCyYoHzmIYLwU pMmgGIt5AMkn3gCgnoO9QQfcyU+HBkt0l0PNXZ3HmihLPJh1BPKoNn8nyf1ureNRgkef BQOa2lw4d+jiDd4XlKEhiO9kg2NOzDyWj/7UCXskifGHsc77+43e2L7uLP5D1NB4V8P1 hV7w==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="oWy1M/0+"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCUUc4RpJionFxeQ1Y2TMZjm/tN9fTpU/OczOepkVYirLhGgWRo2lsMPYjNAEMP2fmlvpad1uLJ5NfZZLfqRT37c Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i15-20020a056214030f00b0068c45e74f4bsi2165709qvu.449.2024.02.02.07.38.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:38:42 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="oWy1M/0+"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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é 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 *data) mc->default_cpus = 2; mc->min_cpus = mc->default_cpus; mc->max_cpus = mc->default_cpus; - mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m33"); mc->valid_cpu_types = valid_cpu_types; mc->init = musca_init; } From patchwork Fri Feb 2 15:36:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769205 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp972999wrc; Fri, 2 Feb 2024 07:37:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IEnysVMpdzpr/vPRGcwPWLu6wJaMOiDzymg25d7Fxeq/rxEsd9g2aQEmVB4eiB77K6o0RGl X-Received: by 2002:a05:620a:178e:b0:785:3ffa:68a5 with SMTP id ay14-20020a05620a178e00b007853ffa68a5mr4796678qkb.5.1706888244764; Fri, 02 Feb 2024 07:37:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888244; cv=none; d=google.com; s=arc-20160816; b=0kaUZ0qe1q6mdKB+Bzy4WBJuzGsJBasg7yYBbktvaxGvTFq9kRoC5GPf5LlDQIvSpG GYMU0DA22p93xaRitQK6/YEsAdh41PGsxuOb5V47KWxyYg9GEVzspZMK8YYTb32onPxN Hzf3Sf661DjiW94lkCqG6QF9Z9QqMxxif260Faob1ChKQXFvOTuE8LYO5+gIvwgP4hv1 eoRy1RszFqjirjqVlyC5+CZuVTYLmxDJExEPU5NYXDOmdiTjTDNPGKj/QOvLDAw20Fsi NMT0+vQmAt0wK2yrRtbXNJV1abN/0iYnJk9kZ8P1RUMLb/dc7Khg9MItV0rcTknxMStO JBCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=EKrB2domJrpD/QjC1zd65Q0KKvruCC/azVIk/m6fgxM=; fh=SQ6MiDLb/VjypMmPtSWn9HaPtotBcqYxb7EtjVWE0Lo=; b=TApBk+l+Dj7xkdb3ctEAmglVf1CdGh6PkFui/2MQuBSIIjE7o3Rc7NRkbcj5ZCuGGd Zyz3CjH7KjBoQWsRfRIdaSE0ZTd4JK8fFLOiqEdXkqBS7Q1/mPSkeBqTPgAZGVd1dC37 LPbPQM7OLuzvYowoymqczQf0a1BnwbQxt/GcY6cToTLlQaI5YmyDX87l68o9UivVjM8+ ynYqzjJo0pHIrHCnrAO/tXaTGDdO1A0TvFbkHPCskGkE9pgAJ3Fq+mrUWAOUT0IJfurk X1Xbv28vGXOxEen0s8gnnOwSI5MzwhZl4EiNpDLv5eCIIoENTt2Nyl8vXsZGa5vwYAEt hL1A==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mJCr46VP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCUQgU427tfsIBQDXWftCYOq7y50S+Gbp5e2WRHXjPMsPGq9Afw4Tld5hvEFiI3ILYGJ9cToVovT53GhwiEG5jQN Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id pj31-20020a05620a1d9f00b007855d68e2aasi819029qkn.93.2024.02.02.07.37.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:37:24 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mJCr46VP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé The npcm7xx Soc is created with a Cortex-A9 core, see in hw/arm/npcm7xx.c: static void npcm7xx_init(Object *obj) { NPCM7xxState *s = NPCM7XX(obj); for (int i = 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é 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 = 1; mc->no_parallel = 1; mc->default_ram_id = "ram"; - mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9"); mc->valid_cpu_types = valid_cpu_types; } From patchwork Fri Feb 2 15:36:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769208 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973074wrc; Fri, 2 Feb 2024 07:37:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IFrx3RUEc1GiBcDbXmGI6NP5Jq2SXehZzop8MtGewXVvHeqgRpT2eTqEc0qlcNR6rS2I5/I X-Received: by 2002:a05:620a:5307:b0:783:38e3:a0f1 with SMTP id oo7-20020a05620a530700b0078338e3a0f1mr2547093qkn.4.1706888258112; Fri, 02 Feb 2024 07:37:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888258; cv=none; d=google.com; s=arc-20160816; b=ULW/D9rn1rocZJlpkDQ+V6TVKP8nSMpdVdvnzaFVNjPqR5VX5RgjM89/8GP5iB9ppu mQW8kDSDG6R1BgBORAS4/bkkzDpOAodgavPZXocQKrkVMdpf8MnXlboq32uFQK1wkhXv I3xUuz3wdN5uuSrVWBBxfAC7jCUgttM/AUFtVxVnMpWKnguFeML6Ldu7g7+2DHDyZN4c +C3d8lvaqdD5UU0ljsfXMiHNR860gD4GTy5ZCdhBM2/+VReP0zEXKOCPENzFmuHh6F7r /vG6hMcApdT1kc2gUEd9KcBfmBsi0N3aExjHJCEypwxPWVsRNsSeI0sMjKUIg+T6NCrA qSLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=5StY4SEF1HqNavbZgDZFaGtFNMi7VFPlW6TJWe8PFDk=; fh=hGCeoLa+0D82jJDvkeVub24eQ6NnHR88jibNSs+xsII=; b=tqJjxnm9ZSI8AdWqnwZhAgtPVKFPwm/ogs283eIRuhRJHQVnvM1CYsq0HEFIJ5urp3 4DT5kChSe46/aILw/GmY+ddTA08/xfU7a/UThm0J3pK9q/vYAhUP7Y9eJYLfOYOTniKi dxcqg8MVg9Btgwoq2doqOvTQBNdz7SE9rL9IipzOUtTMeGZ/KsslAdEuKinaZjS7YhqI jZ+nPs3TtnzDAyorZfGmh1CUWjiXzQiJyycIKvES3G60JQ5RqIvQKyxFppdtYfFHhi/5 pEnaZp3r/KpYoQJu02T4o7v/skPvSMzl9PtpN5D/h5Ulvh0YyR9vrYv0OulI65dYn7jc DMhw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AN3R/cLW"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCWSbdf5WA5lUxLxx3ee7jq1q/xG+gLOIsAAmGS4bBa4Go5L099SUv+mfu9MsPDvTtUOLIGCrk9k4xFX80xwS4PI Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h4-20020a05620a400400b007854a5dd4aesi2502643qko.770.2024.02.02.07.37.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:37:38 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AN3R/cLW"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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é 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) static void vexpress_a9_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-a9"), + NULL + }; MachineClass *mc = MACHINE_CLASS(oc); VexpressMachineClass *vmc = VEXPRESS_MACHINE_CLASS(oc); mc->desc = "ARM Versatile Express for Cortex-A9"; - mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9"); + mc->valid_cpu_types = valid_cpu_types; vmc->daughterboard = &a9_daughterboard; } static void vexpress_a15_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-a15"), + NULL + }; MachineClass *mc = MACHINE_CLASS(oc); VexpressMachineClass *vmc = VEXPRESS_MACHINE_CLASS(oc); mc->desc = "ARM Versatile Express for Cortex-A15"; - mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"); + mc->valid_cpu_types = valid_cpu_types; vmc->daughterboard = &a15_daughterboard; From patchwork Fri Feb 2 15:36:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769219 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973535wrc; Fri, 2 Feb 2024 07:38:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IE2VD+03LqLtGoF4f4AQrve6s5FQyL5tptMOP8DRzTNl2GZYZFzS2JyUDGNfWY4l5dzdJV4 X-Received: by 2002:a05:6358:2925:b0:176:d46c:e704 with SMTP id y37-20020a056358292500b00176d46ce704mr6593048rwb.16.1706888319137; Fri, 02 Feb 2024 07:38:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888319; cv=none; d=google.com; s=arc-20160816; b=cLqv8FZjy8vxsX0sHuDiMhO7jJz0rT7jgfm1vaDMssN2W5f6t6sDRnyfFjk8r0oQy8 EdEYFHFqRNODBI6dm0Qb+hyY341xRfF2NwTH84lDljf/VeS9WGw4b98CmB1CqOHHSeeG AlVkGILWkag1n4BGCllCp22JMQSN5GrSg7+3c1BZxd3LFVRsNjFBbgTVVVkQXdvGGCNb t0zXJxK5dC7g9tZ1ifSe7cCiK4NSfErEGXf/CPPFsd9wV4Pla8qGOTVyyDHR8B1nb7Lx psnnTLze5RaDx59pJ5meK0VyANWDQ6tQApfmkPdAEt8ys/0i/MCwL49TJXZegJQDgdzi urnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=jj7yEf/jq38/qH2Zq0rzNEWtL5ZZjFFsH6Lpx3bxpek=; fh=QSvJ2m56/Eb3hsXOFJWcin9nvQL+CYC08cdShV1r4CA=; b=bGM65d4d6ULpeSm5LsvZkDQ23mh8Ml/ZoDRsba2JIthzX5kikizpvqyqMM91AoAP8N lDYag02dIXOLts8aMkfDVxhpYIM+0wD9Bq6BZGdXIdMkbfaNrag10B04zYHR4WRpBtGx R14epGKpGcORE1tqXbUl/aCLz6ewZzg7KD/cguKtoG/YN620UpXZ2F4Dgm9N60Tz8ugH Sm0dl2rI74dwBp/vtwLue6vVTqmpscLyde4OsBZaaDFTQs+e9CSgdUI8cIbmoku4UgJw pBlzATSJPKn0nLpQ6cvqkZ+OlLL1hapTLBMT4QJ2V6H7kTkbiYCqLNN/izEYn2g0cZqg 8RBQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nZqv9uTC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCWl+R2WLMh2yVlvTqChofqfTVpVdPVZaaNp63vWpUeNUPrdiJRZ/V3g14JTBgLF+TXpFPir1BtUXZVP8dY07Let Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d11-20020a0cea8b000000b0068c88fe1959si1012803qvp.537.2024.02.02.07.38.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:38:39 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nZqv9uTC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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é 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) static void zynq_machine_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-a9"), + NULL + }; MachineClass *mc = MACHINE_CLASS(oc); mc->desc = "Xilinx Zynq Platform Baseboard for Cortex-A9"; mc->init = zynq_init; mc->max_cpus = 1; mc->no_sdcard = 1; mc->ignore_memory_transaction_failures = true; - mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9"); + mc->valid_cpu_types = valid_cpu_types; mc->default_ram_id = "zynq.ext_ram"; } From patchwork Fri Feb 2 15:36:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769228 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973917wrc; Fri, 2 Feb 2024 07:39:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9CvJ6gWreI6e1qMfwdPgcap4qAoJYw/7mcYl7GKyUWYAzsQLZ1qSfzXsP6ZKUOcJrytaJ X-Received: by 2002:a05:6808:1295:b0:3be:a7ea:3855 with SMTP id a21-20020a056808129500b003bea7ea3855mr9701398oiw.25.1706888369931; Fri, 02 Feb 2024 07:39:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888369; cv=none; d=google.com; s=arc-20160816; b=T988Bwd+sWBsyndDIg50gfDySE1kAFmgww/RvX+y034GD4xEpN84XeuganrSIhInE0 WLY3FQdFuM/67dhmd7w6pbNcSWBjm2I2SRsKRXRUzypQ5A7k+hhY7EcUHIHkrQwVDi7R x72i/hFbYep3zCFnHlM1GAxbR04tXDZuysLJIijiP7LtwMoIIDy9DQsWh3tLdmawm0UB dIsW7CH1KxXS+gzqs2xuVIhzhVxnBPfjT9w1y1gAUYAGq6syfEiiIb3mA7sQntqdm16n f2anHrHRmvFhwe0cpZ6shz91Idya5yUs7uYIiYI6LLHUxwRDCBjZTLi1I35L0VgVnJqo 5E8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=7kvYGJv6Vs1OqeEsvp2TCyEKspSHCOA1Tp8iJFztpkE=; fh=7DOx0s6NirdiRLZoH8LX7gJfz5ypDadPDaz692l0h4I=; b=FJG34EMKxuH8U+R8rTHiSLRA/jtiEReVjNYLuObb8seF18VuBQbmBkHMhGLSEf6apQ +muVvNu6Hxh0n0ZlopVJjXdLdUQgdLNlMgDiH4kItAvI6oqpyojz4juEx0FYVg/gpJDG RRZ+bLcvGzeaPWRiBhGeB8q9M5o4JG7lOzQhKMT2bUQnvus8tQc2w+6Q25vRjQOG1bKR dsBzI+jcFc4bFmXXnUOnEpnRhCjjE7I5GxcTr/pJRZoLGVJC15cYNHYdY0eI/fvgYqR2 w9V5N9HGSBm2d8lyYIl5fKGJRG3zykNyl2zAfyjNdBq3fikvLbkIlqkgFN/LTo9EN7tP TQYA==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rKo9NUzq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCXlryyUtLrgJxWR31uuwuD+K0QUWNJhaBpQYABx3FYMVAFwnBps8pYgkjXAORypVUokmhk29mbOca9bZ3/Fl4Zr Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x14-20020a05620a0ece00b00785343838a5si2114825qkm.194.2024.02.02.07.39.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:39:29 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rKo9NUzq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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: Assertion `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; case DESIGNWARE_PCIE_ATU_VIEWPORT: + val &= DESIGNWARE_PCIE_ATU_REGION_INBOUND | + (DESIGNWARE_PCIE_NUM_VIEWPORTS - 1); root->atu_viewport = val; break; From patchwork Fri Feb 2 15:36:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769210 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973278wrc; Fri, 2 Feb 2024 07:38:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGmvoVbewHvhpkDjaMHy+Yot7gh2SiZIweSIz21koaajOl2a6auARbNesVENCqIqBvO7w0 X-Received: by 2002:a05:6870:7247:b0:214:3096:1a05 with SMTP id y7-20020a056870724700b0021430961a05mr8260oaf.47.1706888285966; Fri, 02 Feb 2024 07:38:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888285; cv=none; d=google.com; s=arc-20160816; b=JV6ZXmm8wTg9+lsJpdX7Uglh7ME5fFEcKgbgIX6KoqbLYefEbEdCa68m2vvkavVlLO NyAjJGnvrxRcEeHC1P7UWB/qHICC2rTdcBF0uQkbmK2n+oh+0eEenqtpdKqRa1nOZi3/ 4/2xWjd6cj1YPUo7Fnv0LPgd7NwvOYsxug578ohbQxJdmAl8c7oHfH2ctbSLggTgX2F2 HWXPDoDPoIUha7JqvCAIhBRxoT18o/PkqWPsuTBJaekslIEDgK+KuQpfRRhl4uin96gU R3X+X9M83mytq6QTPuaG2iRHHuW5VYdcl0un35L+6j79dIgEz+GoEXRya3b5AtTsJRCN UL1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=I3JpUFeuz8JEq3ye2dfNhThlFiBiIs8gN5QDvvRsL0g=; fh=j61+e/8X7Vl0ojlApomDqA/SYFcUXV3iPndwVoBdNWM=; b=yq4CiKvU0Gv56Njh+AEpODCOwy+/LNs2Qy+gJcTTxYRlwzro7MHFVpkBkcwwXF+oFC MQtuwxb9nnJ92/Jw+Y4sBYYPa5r64KRtIv0e1OjvSere+sPD+PDGGUa9nQmTfmUWSULy OtrweoD7ckArxMqy8+n/xrtsNxx1TBWceUKPvMkcL6tJptc5T5NO+0l8DFodTE2LcqSY r8/NYGfLNc01EZdcOsIesi3/coV+q2yDGW6RTa1GjNVLvTrA+Tsxj8Hqw2CqrxaK/bLw JWvf92qinrOV36WKZUeSEJOgPn2tANdSun/9EGy616K7CHC1/TpRrf6/dmNgqXtLEJ4K YFtQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yNXji4qh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCWHTTvqGa8ECVqnc31ZqZ/ADwV6kPJWw+F+baUz7mtc6eQaN4vqzAcfvy/ovDm4g1rc6wbu0ElV02UERy8eHnIe Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f9-20020a0cf7c9000000b0068c484c7b78si2247640qvo.349.2024.02.02.07.38.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:38:05 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yNXji4qh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée Message-id: 39db71dd87bf2007cf7812f3d91dde53887f1f2f.1706544115.git.manos.pitsidianakis@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" /* TODO @@ -66,12 +65,6 @@ - Enhance UART with modem signals */ -#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, hwaddr 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, hwaddr offset, s->int_idle = (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 addr, break; 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); } } @@ -556,12 +555,12 @@ static uint64_t strongarm_gpio_read(void *opaque, hwaddr offset, 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; 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; case GRER: /* GPIO Rising-Edge Detect Enable registers */ @@ -581,7 +580,9 @@ static uint64_t strongarm_gpio_read(void *opaque, hwaddr offset, return s->status; 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); } return 0; @@ -626,7 +627,9 @@ static void strongarm_gpio_write(void *opaque, hwaddr offset, break; 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); } } @@ -782,7 +785,9 @@ static uint64_t strongarm_ppc_read(void *opaque, hwaddr offset, return s->ppfr | ~0x7f001; 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); } return 0; @@ -817,7 +822,9 @@ static void strongarm_ppc_write(void *opaque, hwaddr offset, break; 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); } } @@ -1029,8 +1036,13 @@ static void strongarm_uart_update_parameters(StrongARMUARTState *s) s->char_transmit_time = (NANOSECONDS_PER_SECOND / speed) * frame_size; qemu_chr_fe_ioctl(&s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); - DPRINTF(stderr, "%s speed=%d parity=%c data=%d stop=%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); } static void strongarm_uart_rx_to(void *opaque) @@ -1164,7 +1176,9 @@ static uint64_t strongarm_uart_read(void *opaque, hwaddr addr, return s->utsr1; 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; 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); } } @@ -1434,7 +1450,7 @@ static uint64_t strongarm_ssp_read(void *opaque, hwaddr 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, hwaddr 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] = 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 = 0; @@ -1471,7 +1489,9 @@ static void strongarm_ssp_write(void *opaque, hwaddr addr, case SSCR1: s->sscr[1] = 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; 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 SMMUNotifier node for iommu mr=%s smmuv3_notify_flag_del(const char *iommu) "DEL SMMUNotifier node for iommu mr=%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=%s asid=%d vmid=%d iova=0x%"PRIx64" tg=%d num_pages=0x%"PRIx64 +# strongarm.c +strongarm_uart_update_parameters(const char *label, int speed, char parity, int data_bits, int stop_bits) "%s speed=%d parity=%c data=%d stop=%d" +strongarm_ssp_read_underrun(void) "SSP rx underrun" From patchwork Fri Feb 2 15:36:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769229 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973924wrc; Fri, 2 Feb 2024 07:39:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGTcMZfchwhV3WeshdD0OhheIoumzE76+oUCYoA7R/8DIUtcVdV7U7oO8bN0c1ThJH9txgp X-Received: by 2002:a05:622a:28e:b0:42a:b14d:ef2b with SMTP id z14-20020a05622a028e00b0042ab14def2bmr4971886qtw.12.1706888370686; Fri, 02 Feb 2024 07:39:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888370; cv=none; d=google.com; s=arc-20160816; b=idrlbXjlCfHJYbhlxkKRUIPncE3QwAYHRE6YYNYkSS7kRa3eprOP26tzpbqBWwmDom eC7w14XMLGH5fSJ1OByM1KOQtmCmLMwQrRG024OyZGGerwiBIXDJVSsyhzXRtxRaNUvp kGo3RFkFuf4SpRJ6OyV+zhCpUfQ7AmVy1IZ2IiEBBEmzln7VDyMvmlGYsVsZmZc5asOY LsLdiIFkTOvABTXSCwJfRCOWfvdw1uo0A+3m8BTRcMJqn0CR3VoxQT/yBc82GGVwTV+6 Webw8yjyf8rAuI1tDJXDWaqaWUF7BduEks6onCkntkWwm7Fr2h2s8tqx0LrFcFyoGmap UH/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=0ckJcvEZZioCWfSyoKKpMeIjUpIBSh7xStPy/wW7duI=; fh=kimaxGpcFjQ7gYH7itOJdXRnGTSl2gl1yregEyMeQjM=; b=k7oSMGaIYzWyn0r0PSsZOq/EaUwZ72tBsjvlhGEhJelTXqRkzmBZIK8DnxwdDOpsVU vFgPapllT9hJ3wa2eCpC/ZEaNaqeuNJuOJto9jumN0LCoHlu+grnsUzrkAl3Sd+WhogE 8itRVszRVhMO1icPP+j/8G9noHrX/FE9aP2QImTdpsc2oPE2CG0EfKPxGbq+DW0R8I5h yJdVlbV9UJxJ6dhJjsDAElQdzketf/yuQ7S+YNdGc4QEOiJUBCvsVVXhO5wBAFx0UV3M LWBKo8g1upX1+wm7eTjjLD1RrVxy372COi3vg+emC1Rp6nsZ7s0Gop4HqWGVoseTanwT MBZA==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="K3/xOFgS"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCUr3eEKBKTukpK/G2elmu2au5hUvFwEkWzIRcrsSjgWi3yJqq8XeW3Vi5xBuqhfLglhZv+Y6wXEI1CkgZcVsE+6 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w11-20020a05622a190b00b0042aa69e5f37si2199020qtc.605.2024.02.02.07.39.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:39:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="K3/xOFgS"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée Message-id: 799c5141c5751cf2341e1d095349612e046424a8.1706544115.git.manos.pitsidianakis@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" static const struct keymap map[0x100] = { [0 ... 0xff] = { -1, -1 }, @@ -119,6 +113,8 @@ static uint32_t zipit_lcd_transfer(SSIPeripheral *dev, uint32_t value) { ZipitLCD *z = ZIPIT_LCD(dev); uint16_t val; + + trace_z2_lcd_reg_update(z->cur_reg, z->buf[0], z->buf[1], z->buf[2], value); if (z->selected) { z->buf[z->pos] = value & 0xff; z->pos++; @@ -126,22 +122,19 @@ static uint32_t zipit_lcd_transfer(SSIPeripheral *dev, uint32_t value) if (z->pos == 3) { switch (z->buf[0]) { case 0x74: - DPRINTF("%s: reg: 0x%.2x\n", __func__, z->buf[2]); z->cur_reg = z->buf[2]; break; case 0x76: val = z->buf[1] << 8 | z->buf[2]; - DPRINTF("%s: value: 0x%.4x\n", __func__, val); if (z->cur_reg == 0x22 && val == 0x0000) { z->enabled = 1; - printf("%s: LCD enabled\n", __func__); + trace_z2_lcd_enable_disable_result("enabled"); } else if (z->cur_reg == 0x10 && val == 0x0000) { z->enabled = 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 = 0; @@ -211,14 +204,12 @@ static int aer915_send(I2CSlave *i2c, uint8_t data) s->buf[s->len] = 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; } if (s->len == 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]); } return 0; @@ -228,14 +219,12 @@ static int aer915_event(I2CSlave *i2c, enum i2c_event event) { AER915State *s = AER915(i2c); + trace_z2_aer915_event(s->len, event); switch (event) { case I2C_START_SEND: s->len = 0; break; case I2C_START_RECV: - if (s->len != 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 asid, 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=%d parity=%c data=%d stop=%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, uint32_t value) "cur_reg = 0x%x, buf = [0x%x, 0x%x, 0x%x], value = 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 =0x%x len=%d bytes" From patchwork Fri Feb 2 15:36:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769213 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973464wrc; Fri, 2 Feb 2024 07:38:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IFqEwq4oo0awj346G6rZwm3RdEFcsZLMg0ZjFj2yk0HiaEgZ9hhjeYqgr6lMiDO9L/hI6yp X-Received: by 2002:a05:6830:100d:b0:6de:abe6:774d with SMTP id a13-20020a056830100d00b006deabe6774dmr8243285otp.32.1706888310400; Fri, 02 Feb 2024 07:38:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888310; cv=none; d=google.com; s=arc-20160816; b=0IleibCgRQwwnYuzqKan0+T9TfhdImBeyrTccfKZKlPIrnGPLhdJJ5MKN+607q9Hbr wEXKD09BDqu/FaVArv+C63xYeSctkfqJYEM9FXakM4rmfJdxj66RlBVbBsMxNppWcMYM wSHn+0qhl7hn3OBlroCphX4kQYva89IKot4JKsNrpu799/QkkUu56Zyftqgpm96vle0c O7hAIgQJGWHcaYm1f3ze7vDX8MmF/0QtU6pmIT0XchJwy+YIW9xvM2uoUb9v0b2Z7QiF Pg4qN6Luf8EwiEjDO8RTVXQ669wf60B6HGm9MpejQl/lP9WjGY/MfpH2CYGg0bsPyKsG BLEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=amHR5O3giydBqIG5HDDnvSZQyLiZ0je93DEkkg1t/tA=; fh=O41u0gNs9gmAZWs4yCcNRJuQla2O36mUYhROklwGeIs=; b=mRF88sGMoNe0tVCjb0oAPZDaIrX0fZKgEXW1JMA5eOi4/U0EGW58aOGVURyAqi9HrM 6hTgqq2C4jIokoVDPoiNfSZuvFMXJA7sHr3DQApdYcml88A0Zx9zFHUwqMAP0WfNKUj+ iILdKwZSUDHk6Wp9QT7OMNAjc4D0zVTWbRSCcS2a/FO4QMi9dtFMCcdwFxhiRT0UomTT EhwYgyKlafnProfuxxlvjqg5mQCJSiCVdO05UofQ+LEPNuX72oOG/YsP+MMWA6Q/i1cL QhKgMA+tg2zFGhrN5jud0Wn0MjUsP0vOGqnyWDn/aRmdJ9xFoMPt691IpAxYHWIcT2Tx cqyw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w8ju74AH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCVCQxAI4Z5oBcmkP950AGJb6FlQxv3BvOX5PvzWsXWCYh6wstAHaQCji7UxpMiZclz1gpTsooZnfT+k6c8L38iu Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w15-20020a05622a190f00b0042bfb698c05si2102380qtc.723.2024.02.02.07.38.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:38:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w8ju74AH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée Message-id: fe5e3bd54231abe933f95a24e0e88208cd8cfd8f.1706544115.git.manos.pitsidianakis@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" #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 *xam) sysbus_create_simple("virtio-mmio", base, irq); - 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); } } @@ -101,6 +103,7 @@ static void xen_init_ram(MachineState *machine) MemoryRegion *sysmem = get_system_memory(); ram_addr_t block_len, ram_size[GUEST_RAM_BANKS]; + trace_xen_init_ram(machine->ram_size); if (machine->ram_size <= GUEST_RAM0_SIZE) { ram_size[0] = machine->ram_size; ram_size[1] = 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]); } } @@ -158,7 +156,7 @@ static void xen_enable_tpm(XenArmState *xam) TPMBackend *be = qemu_find_tpm_be("tpm0"); if (be == NULL) { - DPRINTF("Couldn't fine the backend for tpm0\n"); + error_report("Couldn't find tmp0 backend"); return; } dev = 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); - DPRINTF("Connected tpmdev at address 0x%lx\n", xam->cfg.tpm_base_addr); + trace_xen_enable_tpm(xam->cfg.tpm_base_addr); } #endif @@ -179,8 +177,9 @@ static void xen_arm_init(MachineState *machine) xam->state = g_new0(XenIOState, 1); if (machine->ram_size == 0) { - DPRINTF("ram_size not specified. QEMU machine started without IOREQ" - "(no emulated devices including Virtio)\n"); + warn_report("%s non-zero ram size not specified. QEMU machine started" + " without IOREQ (no emulated devices including virtio)", + MACHINE_CLASS(object_get_class(OBJECT(machine)))->desc); return; } @@ -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 enabled"); } #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 =0x%x len=%d bytes" + +# xen_arm.c +xen_create_virtio_mmio_devices(int i, int irq, uint64_t base) "Created virtio-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 From patchwork Fri Feb 2 15:36:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769232 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973974wrc; Fri, 2 Feb 2024 07:39:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IFIPg4JLS1+8/XJ5kf398bKquWMm/Hi/uG1kroz0ah8+co4FLuXsz8zsp8W3ydMPXcPF3tS X-Received: by 2002:ac8:5d87:0:b0:42b:fefd:6d95 with SMTP id d7-20020ac85d87000000b0042bfefd6d95mr3896751qtx.58.1706888378734; Fri, 02 Feb 2024 07:39:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888378; cv=none; d=google.com; s=arc-20160816; b=f/HgkY4SPF8RgEp6vjivO6/gff+WLd8egzyxOBp/ygUAPpqSGdKbTDfkgatoqH19HX WGC8LeNv4IAuZfKmi1doUWRSQizu2Zd0vN8AR+DTZmyYYG1rn1F+60jw7yYHS9klva3I 7P/30U7dvWZrKKDuIi0FqB8kHQcHFvy7WDcqmvp3wD29T/6+NeWZsxyCOa4tO4G0z4uU 6UA6KM7URXySHVmPKgaLzjYrshijcG1yjOGIDYVIkPDXda1SKPOuMRkaefO5RHpNGRao XWnE/ImdVpw2pf2NiE9jayosVzhZjJk9qFt5nYwCKNusWuj36nd/aVMuTWjEjM35a60J F0fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=w0fahzk6p7Uj8He02ARe/ArkwaOEVmzA6eqTYfNKviw=; fh=YLnzj8R3bdcBhGLWsjmt7QNIQrPpad+6DtfV6EW92CY=; b=Nb0knsG7qYc9Phxagh/F456LM7YAOIODPTG6jSSvXiV75i3JImUWz7dHtTl15cxGrx BZcGgxhSxMa4I8jp1TRAhfx4BpNqprN/sfWE5iDViVhblRrHDPO7jgJd++I6E5PGv9Km GlhpqtFV2vATLIbDANsH8q4c5TjOLX9GUPxh8iqqBb6SHnzRAKjo5zXjJpamfxMXjsGQ PVAkvBE9BKDpKDZTXaVWXrV2cZ+4hCNapqbpNMdoMpMXJQhbr8chBikypKyqhi15vSi5 9OP6x4aROXIknYmlwPzrkZdotEAhC/KtICat2hFch5ZDA4HcInhVsW3VU4PIRi1JGkSj RzAA==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wnu6+r8G; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCW2Hc4dZZqVx2rwwBqBskQZmQmSqVwDJNTeCIz/KOzDnoNfIgXSzxyjYX2DlTScD02iJmPN2Yrg5DPppuut/M5q Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i17-20020ac85e51000000b0042c078c46fdsi849908qtx.482.2024.02.02.07.39.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:39:38 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wnu6+r8G; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée Message-id: 2fbe1fbc59078e384761c932e97cfa4276a53d75.1706544115.git.manos.pitsidianakis@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" -//#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 == 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) size = mapcache->nr_buckets * sizeof (MapCacheEntry); size = (size + XC_PAGE_SIZE - 1) & ~(XC_PAGE_SIZE - 1); - DPRINTF("%s, nr_buckets = %lx size %lu\n", __func__, - mapcache->nr_buckets, size); + trace_xen_map_cache_init(mapcache->nr_buckets, size); mapcache->entry = g_malloc0(size); } @@ -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 + address_offset); + trace_xen_map_cache_return( + mapcache->last_entry->vaddr_base + address_offset + ); return mapcache->last_entry->vaddr_base + address_offset; } @@ -368,7 +359,9 @@ tryagain: QTAILQ_INSERT_HEAD(&mapcache->locked_entries, reventry, next); } - 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; } @@ -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->paddr_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 = 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 = 0; } else { raddr = (reventry->paddr_index << MCACHE_BUCKET_SHIFT) + @@ -443,9 +436,12 @@ static void xen_invalidate_map_cache_entry_unlocked(uint8_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->paddr_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(uint8_t *buffer) entry = 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); } for (i = 0; i < mapcache->nr_buckets; i++) { @@ -562,24 +557,23 @@ static uint8_t *xen_replace_cache_entry_unlocked(hwaddr old_phys_addr, entry = 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; } address_index = new_phys_addr >> MCACHE_BUCKET_SHIFT; address_offset = new_phys_addr & (MCACHE_BUCKET_SIZE - 1); - 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); 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; } 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 = 0x%"PRIx64" size 0x%"PRIx64 +xen_replace_cache_entry_dummy(uint64_t old_phys_addr, uint64_t new_phys_addr) "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 unmap 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 DMA mapping while invalidating mapcache 0x%"PRIx64" -> %p is present" From patchwork Fri Feb 2 15:36:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769234 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp974003wrc; Fri, 2 Feb 2024 07:39:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2snc56omzdG7EAkFw46NSizEf8pR+ftXByLEKxPVEVLZqpcBG7griE2PO5wIxXkBUviNL X-Received: by 2002:a05:6358:2489:b0:178:6ea7:6fef with SMTP id m9-20020a056358248900b001786ea76fefmr2211551rwc.8.1706888382541; Fri, 02 Feb 2024 07:39:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888382; cv=none; d=google.com; s=arc-20160816; b=zrwY6Jlat40YKuQz+Kf8tHImGiKgN8Utk61ZHOOykK/Xf9Ab3PJFj0Zq+h28f/aY+J mNpvg3fXkvLJtAPDXe3lOaYItHyRhyzu5genzu9RHQOAv5x06HHZGo0n5k+Fz0NLqfjN 3GWvSF2U6IDZtCT2u/pxMGfEcIRon75qVuRypM5Opsi7Ff+EARlB2UKnBSceijmZcLNF DojLF7/cGGtfPMyoH8uHDRgAultYePoRBOnZtV58/t1JOdABV8GKYEkuoO1aOW2wNdBa K9ds75GO0apA0xqGGFWyF7vuS5wxFb8HcZoq2hey2OUyYaVtKr9vgj4YYwVbnGt5IaKi xqAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dM1ag+hc6Tlr+SofgNgQWcacda8AUiOk3VlHdLXApxg=; fh=h4XyLL69ueluNaAzJqqhbV9hpKbHLlbo1qHQmLufCvU=; b=GN9Wugir23/TZkXC/vBFveOx+hyp8pXGyEzEGjSGA7SYSsqRWvwlabiaNCnQun6+ci 9xHuljvJlN3U0FKpMBqWvRXT3FcMYIVKW8FUY6daP505MZrQSi5/DmS8UaqV/x6IYKco mujFeJSNEyeFQX9S4VzVkw8eUmyXkm+lmpmF0vPkWM6vq2EUsUVgWoCZG0qCIYlHxgHL OINX8x/gtcvQLVomrulcgNBpCrrEIquSVwZOzaK1Qbk3URL/bReTxXxHD8+XJltki8om 41aNqi421zGwu4pPLnms34j9avzYFTeH/Xez8bL+c1gN0KmWOV48P8jFjzPAykl0aZlf g2Sg==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KGHJBymG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCVO/6w0acZ8n9eK1YEQrF4IhJu/WT22nVqjTIypqqxEwQy6MpXIekFJhLY4rjFTZuL+JQCIVtXVbXhqCxRZGhqL Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n8-20020a0cec48000000b0068c7b64a468si2192665qvq.232.2024.02.02.07.39.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:39:42 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KGHJBymG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée Message-id: b000ab73022dfeb7a7ab0ee8fd0f41fb208adaf0.1706544115.git.manos.pitsidianakis@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(XenIOState *state, int vcpu) ioreq_t *req = xen_vcpu_ioreq(state->shared_page, vcpu); if (req->state != 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; } @@ -601,10 +602,9 @@ static void xen_main_loop_prepare(XenIOState *state) if (evtchn_fd != -1) { CPUState *cpu_state; - DPRINTF("%s: Init cpu_by_vcpu_id\n", __func__); CPU_FOREACH(cpu_state) { - DPRINTF("%s: cpu_by_vcpu_id[%d]=%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] = 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) } if (state->shared_page == NULL) { - DPRINTF("shared page at pfn %lx\n", ioreq_pfn); + trace_xen_map_ioreq_server_shared_page(ioreq_pfn); state->shared_page = xenforeignmemory_map(xen_fmem, xen_domid, PROT_READ | PROT_WRITE, @@ -693,7 +693,7 @@ static int xen_map_ioreq_server(XenIOState *state) } if (state->buffered_io_page == NULL) { - DPRINTF("buffered io page at pfn %lx\n", bufioreq_pfn); + trace_xen_map_ioreq_server_buffered_io_page(bufioreq_pfn); state->buffered_io_page = xenforeignmemory_map(xen_fmem, xen_domid, PROT_READ | PROT_WRITE, @@ -709,7 +709,7 @@ static int xen_map_ioreq_server(XenIOState *state) return -1; } - DPRINTF("buffered io evtchn is %x\n", bufioreq_evtchn); + trace_xen_map_ioreq_server_buffered_io_evtchn(bufioreq_evtchn); state->bufioreq_remote_port = bufioreq_evtchn; @@ -737,16 +737,17 @@ void destroy_hvm_domain(bool reboot) xc_handle = xc_interface_open(0, 0, 0); if (xc_handle == NULL) { - fprintf(stderr, "Cannot acquire xenctrl handle\n"); + trace_destroy_hvm_domain_cannot_acquire_handle(); } else { sts = xc_domain_shutdown(xc_handle, xen_domid, reason); if (sts != 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" -# xen-hvm.c +# xen-hvm-common.c xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: 0x%lx, size 0x%lx" xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_dirty) "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=%p type=%d dir=%d df=%d ptr=%d port=0x%"PRIx64" data=0x%"PRIx64" count=%d size=%d" @@ -55,6 +55,14 @@ cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uint32_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 size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%x" cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%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]=%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) "buffered 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 handle" +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 domain %d %s" # xen-mapcache.c xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64 From patchwork Fri Feb 2 15:36:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769237 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp974402wrc; Fri, 2 Feb 2024 07:40:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8JzqwS7uwaWfG8NBEtz8fppYuQKMtk3KCQvbuWRqvg9dpG7NqatavDwnXHd64FOh4VL+f X-Received: by 2002:a05:6214:cca:b0:685:8636:d4f2 with SMTP id 10-20020a0562140cca00b006858636d4f2mr2905129qvx.55.1706888436004; Fri, 02 Feb 2024 07:40:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888435; cv=none; d=google.com; s=arc-20160816; b=x8ddh8eXinrP+Sy8tZsRBuC6/AtFJAFKpmx95nC/JoISVKAfls05CYo4kxPOVddor/ KHS3bFcGCn3O4nBRtMHyciO/aarn3sM4nf6Im50M7tZCRWR7MNV0PXGdfUAq46HatHkX hJjgaTFshwcL7yZWn7m0RoVcge0En6HAeh136PutrOeWj7TEUILKMCT6s8Oim8HzQvF+ Hwg25sDx3f4dRq7jWZmUVPVExrr4/Jjn8chFuW+dEIG6x3vSNCLDdjoeFn3D/5xRLYws nXfE5eN2R+EE3NVYxnHr/ejXX+oa7l/zWOFWHO+DIit0HHuRBdupgfFA3hxRGppCb+rL rJwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=6766GInC0KCZwdcNkPeeQ9H7YYISDkqkH81Ih8qmKD4=; fh=6gWSyEgg7xyUGGncIMs54TefydCZueVES3xBbMmx3Ts=; b=lMSKJKJM7T0sdYdpqgnbVag2Z8lHe5oYtENyfxlVrAkozWNQfx7U57RtQpfTjCq/XT 2840VpExXiyVfF0WpKg/qfh3m3TRVdUfNsDqQlekIC6UFQ8SbgucBnqz7DDvGgP/UobZ BEV5l47ui3xrFH//KCWjm77+IY5tXjSCJdcOJvTX2icIgLWIk+DQYRKKC3rsv4tsymkW IgEdHnO74h/XPKqfXhER7z54ia8kJWFpa86NzTr3WD4eHM6Dz6SfCQZ4gsiRHZBMYrsC nU3LApaPteIgTScE9UpeGpiM1KtWYbb8GD12KNxgEQxpuFJLtRYLDz0XXnhZ1uCFx1vr WThw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Qi4o2/Be"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCVPfyBiPvr017X+1f4b4lDvDvlUM8EzqUpmkFHLj5TNt2Yvjc4d6kAQWJ4DhOpGB/81fhOJUDbRb6/x2OYPGg74 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w15-20020a05620a148f00b00783f0d6b2absi2133913qkj.390.2024.02.02.07.40.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:40:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Qi4o2/Be"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Signed-off-by: Manos Pitsidianakis Reviewed-by: Alex Bennée Message-id: 42a8953553cf68e8bacada966f93af4fbce45919.1706544115.git.manos.pitsidianakis@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, 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 INMIGRATE\n", + warn_report("%s: do not alloc "RAM_ADDR_FMT + " bytes of ram at "RAM_ADDR_FMT" when runstate is INMIGRATE", __func__, size, ram_addr); return; } @@ -552,9 +552,9 @@ static void cpu_handle_ioreq(void *opaque) req->data = copy.data; if (req->state != 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; 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 = g_new0(MapCacheRev, 1); entry->lock++; if (entry->lock == 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 = dma; From patchwork Fri Feb 2 15:36:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769217 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973496wrc; Fri, 2 Feb 2024 07:38:35 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWOIJnHttByMz4rkNknI65PkrJPTSSA1XIBCdgxmLgXXgtlRnv0UFOsuIHAVn+HRqvlDvVYX9n/2MJBgrqPkRSp X-Google-Smtp-Source: AGHT+IFywOIjmXW5zp1DB2anChWYm9Q1UcUHshHel8euEUpBkY0WwJyNmteYsmS1SVJucAtrhqmP X-Received: by 2002:a05:6808:128a:b0:3be:41d5:9510 with SMTP id a10-20020a056808128a00b003be41d59510mr7225214oiw.43.1706888314840; Fri, 02 Feb 2024 07:38:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888314; cv=none; d=google.com; s=arc-20160816; b=PMxFHphf0oNkhxD5aCaigNcNnNkMWdVyJgvuapte+yHBOsr09tA5SCbeMMcUR7iwPK TxXAldMBuwgbQV6VaTf7b+7xwbmGCe8T7bJtPBIB5XWayTFF2sm4/h8umFIsOsXyZsGg qaWWu1mXut6fHEs1UxWYUFG8/8NjZgbDuj3+1IEt5b+4vvoP6Kbzikl6K9cXjdGbGeAB ORREPKt9mCqwR1xVibDpIs/aAyQeG/Hb2+euGQd7mEX9SyP2mAEC8RGXNi2LvV2S3Q0A fQ8T0I/rDNRXU0QZQgPgkiQ4iQurxiVrzy+m4x1zZPe06Z8v02yviP3m/QpuuEnLfypG TqxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=d4Dw/zUBj8djGXGpZZ1PuJwGodEvYtT2TVETZ0aTH+E=; fh=o2PWoSRpoTFGmnFsNjL83hitfIXxmOqk06bh2IADtDQ=; b=yQ4etbSEz7vgXfYRAPEvGdDOqMhXrA4fWtpQq6EfAjA2nToqlM/pduu56qzSa7uEjb +laR3EvjeOGSq/ogs8HI1HUAx07Kuqqxmoj0Sc7ayLdFIstHnd3EFno/fSdQ598uV54d UNY/87drSQUbSRWjfWATIe/Ya72BXCY4aaGnGyIsDTpE9YsRsh0QezD3BRS6tI3LRScX /pHFHzfI8UngAcVIKJ6q3RYdOhQRCqq8Oni4vGEgoebnsfMk6sOxgTFZSlJpN/166ix5 mUPJRf+XODLGXXHzw0CmZgELbx7Dzyjwwep5sfJIX63Ni1l6j1FRsB48tVisJsXNVwuI qRmQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YsQuOv0V; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCVqqgLyth+w4/9vVZ0xUm+P85RAsoJoDkNi5dNQecKMrK8GCWQTUvR+d3xT9StdFjBlVoSlwocni3JP2tL7pELB Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id vw19-20020a05620a565300b007840b2928e5si2196384qkn.236.2024.02.02.07.38.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:38:34 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YsQuOv0V; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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] (mii_bus:phy_addr=stmmac-0:00, irq=POLL) 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 WITHOUT + * 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 = software, 1 = 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 = software, 1 = 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 WITHOUT + * 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] = { + /* Reduce version to 3.2 so that the kernel can enable interrupt. */ + [R_NPCM_GMAC_VERSION] = 0x00001032, + [R_NPCM_GMAC_TIMER_CTRL] = 0x03e80000, + [R_NPCM_GMAC_MAC0_ADDR_HI] = 0x8000ffff, + [R_NPCM_GMAC_MAC0_ADDR_LO] = 0xffffffff, + [R_NPCM_GMAC_MAC1_ADDR_HI] = 0x0000ffff, + [R_NPCM_GMAC_MAC1_ADDR_LO] = 0xffffffff, + [R_NPCM_GMAC_MAC2_ADDR_HI] = 0x0000ffff, + [R_NPCM_GMAC_MAC2_ADDR_LO] = 0xffffffff, + [R_NPCM_GMAC_MAC3_ADDR_HI] = 0x0000ffff, + [R_NPCM_GMAC_MAC3_ADDR_LO] = 0xffffffff, + [R_NPCM_GMAC_PTP_TCR] = 0x00002000, + [R_NPCM_DMA_BUS_MODE] = 0x00020101, + [R_NPCM_DMA_HW_FEATURE] = 0x100d4f37, +}; + +static const uint16_t phy_reg_init[] = { + [MII_BMCR] = MII_BMCR_AUTOEN | MII_BMCR_FD | MII_BMCR_SPEED1000, + [MII_BMSR] = MII_BMSR_100TX_FD | MII_BMSR_100TX_HD | MII_BMSR_10T_FD | + MII_BMSR_10T_HD | MII_BMSR_EXTSTAT | MII_BMSR_AUTONEG | + MII_BMSR_LINK_ST | MII_BMSR_EXTCAP, + [MII_PHYID1] = 0x0362, + [MII_PHYID2] = 0x5e6a, + [MII_ANAR] = MII_ANAR_TXFD | MII_ANAR_TX | MII_ANAR_10FD | + MII_ANAR_10 | MII_ANAR_CSMACD, + [MII_ANLPAR] = MII_ANLPAR_ACK | MII_ANLPAR_PAUSE | + MII_ANLPAR_TXFD | MII_ANLPAR_TX | MII_ANLPAR_10FD | + MII_ANLPAR_10 | MII_ANLPAR_CSMACD, + [MII_ANER] = 0x64 | MII_ANER_NWAY, + [MII_ANNP] = 0x2001, + [MII_CTRL1000] = MII_CTRL1000_FULL, + [MII_STAT1000] = MII_STAT1000_FULL, + [MII_EXTSTAT] = 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] &= ~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] |= (MII_BMSR_LINK_ST | MII_BMSR_AN_COMP); + } else { + gmac->phy_regs[0][MII_BMSR] &= ~(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] |= 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] |= NPCM_DMA_STATUS_AIS; + } + + /* Get the logical OR of both normal and abnormal interrupts */ + int level = !!((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 = 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 = v & NPCM_GMAC_MII_ADDR_BUSY; + uint8_t is_write; + uint8_t pa, gr; + uint16_t data; + + if (busy) { + is_write = v & NPCM_GMAC_MII_ADDR_WRITE; + pa = NPCM_GMAC_MII_ADDR_PA(v); + gr = 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 = gmac->regs[R_NPCM_GMAC_MII_DATA]; + /* Clear reset bit for BMCR register */ + switch (gr) { + case MII_BMCR: + data &= ~MII_BMCR_RESET; + /* Autonegotiation is a W1C bit*/ + if (data & MII_BMCR_ANRESTART) { + /* Tells autonegotiation to not restart again */ + data &= ~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] |= MII_BMSR_AN_COMP; + /* Resolve AN automatically->need to set this */ + gmac->phy_regs[0][MII_ANLPAR] = 0x0000; + } + } + gmac->phy_regs[pa][gr] = data; + } else { + data = gmac->phy_regs[pa][gr]; + gmac->regs[R_NPCM_GMAC_MII_DATA] = data; + } + trace_npcm_gmac_mdio_access(DEVICE(gmac)->canonical_path, is_write, pa, + gr, data); + } + gmac->regs[R_NPCM_GMAC_MII_ADDR] = v & ~NPCM_GMAC_MII_ADDR_BUSY; +} + +static uint64_t npcm_gmac_read(void *opaque, hwaddr offset, unsigned size) +{ + NPCMGMACState *gmac = opaque; + uint32_t v = 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_PRIx + "\n", DEVICE(gmac)->canonical_path, offset); + break; + + default: + v = 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 = 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_PRIx + ", 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)] = v; + gmac->conf.macaddr.a[0] = v >> 8; + gmac->conf.macaddr.a[1] = v >> 0; + break; + + case A_NPCM_GMAC_MAC0_ADDR_LO: + gmac->regs[offset / sizeof(uint32_t)] = v; + gmac->conf.macaddr.a[2] = v >> 24; + gmac->conf.macaddr.a[3] = v >> 16; + gmac->conf.macaddr.a[4] = v >> 8; + gmac->conf.macaddr.a[5] = 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)] = 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)] = 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)] = v; + break; + } + + gmac_update_irq(gmac); +} + +static void npcm_gmac_reset(DeviceState *dev) +{ + NPCMGMACState *gmac = 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 = { + .type = NET_CLIENT_DRIVER_NIC, + .size = sizeof(NICState), + .can_receive = gmac_can_receive, + .receive = gmac_receive, + .cleanup = gmac_cleanup, + .link_status_changed = gmac_set_link, +}; + +static const struct MemoryRegionOps npcm_gmac_ops = { + .read = npcm_gmac_read, + .write = npcm_gmac_write, + .endianness = DEVICE_LITTLE_ENDIAN, + .valid = { + .min_access_size = 4, + .max_access_size = 4, + .unaligned = false, + }, +}; + +static void npcm_gmac_realize(DeviceState *dev, Error **errp) +{ + NPCMGMACState *gmac = NPCM_GMAC(dev); + SysBusDevice *sbd = 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 = 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] = (gmac->conf.macaddr.a[0] << 8) + \ + gmac->conf.macaddr.a[1]; + gmac->regs[R_NPCM_GMAC_MAC0_ADDR_LO] = (gmac->conf.macaddr.a[2] << 24) + \ + (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 = NPCM_GMAC(dev); + + qemu_del_nic(gmac->nic); +} + +static const VMStateDescription vmstate_npcm_gmac = { + .name = TYPE_NPCM_GMAC, + .version_id = 0, + .minimum_version_id = 0, + .fields = (VMStateField[]) { + VMSTATE_UINT32_ARRAY(regs, NPCMGMACState, NPCM_GMAC_NR_REGS), + VMSTATE_END_OF_LIST(), + }, +}; + +static Property npcm_gmac_properties[] = { + DEFINE_NIC_PROPERTIES(NPCMGMACState, conf), + DEFINE_PROP_END_OF_LIST(), +}; + +static void npcm_gmac_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); + dc->desc = "NPCM GMAC Controller"; + dc->realize = npcm_gmac_realize; + dc->unrealize = npcm_gmac_unrealize; + dc->reset = npcm_gmac_reset; + dc->vmsd = &vmstate_npcm_gmac; + device_class_set_props(dc, npcm_gmac_properties); +} + +static const TypeInfo npcm_gmac_types[] = { + { + .name = TYPE_NPCM_GMAC, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(NPCMGMACState), + .class_init = 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: files('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', 'npcm_gmac.c')) 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=0x%x" npcm7xx_emc_reg_read(int emc_num, uint32_t result, const char *name, int regno) "emc%d: 0x%x = reg[%s/%d]" npcm7xx_emc_reg_write(int emc_num, const char *name, int regno, uint32_t value) "emc%d: reg[%s/%d] = 0x%x" +# 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, uint8_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=%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" PRIX32 " 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" From patchwork Fri Feb 2 15:36:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769207 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973069wrc; Fri, 2 Feb 2024 07:37:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvE2iprx3Km+XapK32A1DhJIi/hSF0r8TRpZ4/6UQjQs5hjGYniDs7WGrvTzexl1HxSiOB X-Received: by 2002:a05:6830:18fb:b0:6e0:fdc1:e66d with SMTP id d27-20020a05683018fb00b006e0fdc1e66dmr2229180otf.32.1706888256544; Fri, 02 Feb 2024 07:37:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888256; cv=none; d=google.com; s=arc-20160816; b=mVeU9RWocQxriT0ZPwer7d9kCH4hxHDqRWPaitOA4Z2o3osQ+8FJVjuAacVVPk5rbb yx/rPKDq3WbhQZdjAv0YNFblFxNauMgzB50K02Fd3puefAuuw8AUudQeQ28fj8kw6cF6 xN9/b8aVFbnylfhd/P7JHzJ9mPyTpY+T1f64jxnZfkRblJYNk4Gmol3BlEpiecz1egJF LpPNBAR2ozO6fWhJdlRCUxmX28U2rbeeEhvmTchEUFPwGt2g9vqmdAHWhUkW/H6CaNGB sU4nLwfUYQVY1om4gkTH2yTEdAa0y4eFL4lkoiZSZzL2WvBgRpLzG2kbEp4bciGPBzLb 6Raw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=N2NuZPUzpaElmLZXmhDdPQ/KTGn+fUluVp/XA+iMwnU=; fh=ShX3g+/+U9dQ8lowSGsEYHpCdNHsjNqUOmzA2UNlXiI=; b=Jhn+fAeqZRR82NEWWOdbVNuTas7dp6ArBCp76dcz28KeWu32R/bep1mgbKuCjj4ml1 YVUwHVBEYh1WHDFoNzyJc2HH6EW8RQ3MTf6DbQQVqH0sBq/K7fwjR+ocPZfKXvWa0ght +DmkjnMo2uOKBAdzudR6PHn8qVpPnCl7AQ7TEoa1X2KQvJeT7H9OiIgvt8HH9uV706mo qUP288OE63qG1/vfrGR1auiZykxNTU9lLflddNIgc0/hYZMyegFwXLxVrP74Fi52Cw3U K/RQ+exLqmHrGGJCwDF/k1UOItKUI09Et59LMcnggy5Jy4a6U4w9PuVIgvpx84AQMY+e zjcQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cssNInM2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCXEkjyF7uUqHYB19yags9vzeJpCi+2ZP+0QQlkaBzqTIooJ6Rbw4/WytaAsdFz5fwLsxc5lZMtbMvAaJWlR8Twp Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q16-20020a05622a04d000b0042bebb5874bsi2187424qtx.509.2024.02.02.07.37.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:37:36 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cssNInM2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 = 14, NPCM7XX_EMC1RX_IRQ = 15, NPCM7XX_EMC1TX_IRQ, + NPCM7XX_GMAC2_IRQ, NPCM7XX_MMC_IRQ = 26, NPCM7XX_PSPI2_IRQ = 28, NPCM7XX_PSPI1_IRQ = 31, @@ -229,6 +231,12 @@ static const hwaddr npcm7xx_pspi_addr[] = { 0xf0201000, }; +/* Register base address for each GMAC Module */ +static const hwaddr npcm7xx_gmac_addr[] = { + 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_PSPI); } + for (i = 0; i < ARRAY_SIZE(s->gmac); i++) { + object_initialize_child(obj, "gmac[*]", &s->gmac[i], TYPE_NPCM_GMAC); + } + object_initialize_child(obj, "mmc", &s->mmc, TYPE_NPCM7XX_SDHCI); } @@ -688,6 +700,29 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp) sysbus_connect_irq(sbd, 1, npcm7xx_irq(s, rx_irq)); } + /* + * GMAC Modules. Cannot fail. + */ + QEMU_BUILD_BUG_ON(ARRAY_SIZE(npcm7xx_gmac_addr) != ARRAY_SIZE(s->gmac)); + QEMU_BUILD_BUG_ON(ARRAY_SIZE(s->gmac) != 2); + for (i = 0; i < ARRAY_SIZE(s->gmac); i++) { + SysBusDevice *sbd = 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 = i == 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 selects * specified, but this is a programming error. @@ -750,8 +785,6 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp) 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); From patchwork Fri Feb 2 15:36:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769226 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973714wrc; Fri, 2 Feb 2024 07:39:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHt3HI6n+So4+N09iD9KnyLKRcfHxPKQhZpXNM6AbiUAqabo8gTO7KICYnOQ8Xj07gUiALX X-Received: by 2002:a05:6214:252d:b0:68c:4b1a:b5f7 with SMTP id gg13-20020a056214252d00b0068c4b1ab5f7mr9523000qvb.64.1706888343840; Fri, 02 Feb 2024 07:39:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888343; cv=none; d=google.com; s=arc-20160816; b=KapmhkgKt7oq1ymDndUKFIJMrroO5sIxbLJuNAMv+WyJd6GNw1714mULvcmdyAfLRO uYaWJo0auaZJypbA1cRw1SuWSOVuIy5z3yGMsQtWwtdNCmZjhSVeFMDuq7iY0G1/xMKD +iM6/uLoP8hKRs5+6xARgNLe1N0OEZECtmesDEIo+j9GBagh4/sEA/i4tp3TZoxYC3a7 ABuFfk4mtpvDiVHxnHskikFl3MsH6ZRE3TUrQm4MvJE/sx7TFlumFX7+Ww/rjHTNcq8o A5n0mwainLl0r858NBMTq7GWAMAg7wqf8IcMFOeo5Fpy4Y5WRawYOHnjXjqWHM2UZLdr ah6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=2Ty1T3rBfJ7VP6HS7xDAhOzK8fPZrj+w66iO5T97BjM=; fh=co+wIGS0c2jjS0l+uedGEg9cegVJDRYOBPf+qBeRjno=; b=lICCEdAelu5Pe7TinYZcfZABiHFFTnWeEEbnoyabIUVrAA3Z/H5Q/GCF309322zPhj MvoAbO0dUKDIHjJEp2gnjwQ6HHN9aEoTXR9PXKq9l4uNUIP11SICQ7vKIWZ7a6iw7VX/ 4Yz4JKCe7uZwvxBCql1eQ1c/UI+NPaocgdIHEgk+wL7ArNYIc04hooYovKtE1XfX9Ug6 WIzu3jGoW+2lOxRwpDwEw0dIP8BVeuJEceZLEFwd830O0XVzNYyy0SSaX57qVN3qDTAG 3v6cP1vy5d7+xt/qd+whmfn+tdxOgNZ1LD9JfPTiyfeA1lmdcJoZR9sygO6zABpJVC7z X1Sg==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k6h5AF2U; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCW/f/h+0FSm8ux99ZHLJlbb8gX77GywWi8+Nc90x8io9gTCK2ObqH7zDoTAQ3S3pn1BFMJu+NuJmJAy2jJHwPEX Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y10-20020a0cec0a000000b0068c8c2b1c95si206276qvo.376.2024.02.02.07.39.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:39:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k6h5AF2U; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 WITHOUT + * 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[] = { + { + .irq = 14, + .base_addr = 0xf0802000 + }, + { + .irq = 15, + .base_addr = 0xf0804000 + }, + { + .irq = 16, + .base_addr = 0xf0806000 + }, + { + .irq = 17, + .base_addr = 0xf0808000 + } +}; + +/* Returns the index of the GMAC module. */ +static int gmac_module_index(const GMACModule *mod) +{ + ptrdiff_t diff = mod - gmac_module_list; + + g_assert_true(diff >= 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 = 0x1000, + NPCM_DMA_XMT_POLL_DEMAND = 0x1004, + NPCM_DMA_RCV_POLL_DEMAND = 0x1008, + NPCM_DMA_RCV_BASE_ADDR = 0x100c, + NPCM_DMA_TX_BASE_ADDR = 0x1010, + NPCM_DMA_STATUS = 0x1014, + NPCM_DMA_CONTROL = 0x1018, + NPCM_DMA_INTR_ENA = 0x101c, + NPCM_DMA_MISSED_FRAME_CTR = 0x1020, + NPCM_DMA_HOST_TX_DESC = 0x1048, + NPCM_DMA_HOST_RX_DESC = 0x104c, + NPCM_DMA_CUR_TX_BUF_ADDR = 0x1050, + NPCM_DMA_CUR_RX_BUF_ADDR = 0x1054, + NPCM_DMA_HW_FEATURE = 0x1058, + + /* GMAC Registers */ + NPCM_GMAC_MAC_CONFIG = 0x0, + NPCM_GMAC_FRAME_FILTER = 0x4, + NPCM_GMAC_HASH_HIGH = 0x8, + NPCM_GMAC_HASH_LOW = 0xc, + NPCM_GMAC_MII_ADDR = 0x10, + NPCM_GMAC_MII_DATA = 0x14, + NPCM_GMAC_FLOW_CTRL = 0x18, + NPCM_GMAC_VLAN_FLAG = 0x1c, + NPCM_GMAC_VERSION = 0x20, + NPCM_GMAC_WAKEUP_FILTER = 0x28, + NPCM_GMAC_PMT = 0x2c, + NPCM_GMAC_LPI_CTRL = 0x30, + NPCM_GMAC_TIMER_CTRL = 0x34, + NPCM_GMAC_INT_STATUS = 0x38, + NPCM_GMAC_INT_MASK = 0x3c, + NPCM_GMAC_MAC0_ADDR_HI = 0x40, + NPCM_GMAC_MAC0_ADDR_LO = 0x44, + NPCM_GMAC_MAC1_ADDR_HI = 0x48, + NPCM_GMAC_MAC1_ADDR_LO = 0x4c, + NPCM_GMAC_MAC2_ADDR_HI = 0x50, + NPCM_GMAC_MAC2_ADDR_LO = 0x54, + NPCM_GMAC_MAC3_ADDR_HI = 0x58, + NPCM_GMAC_MAC3_ADDR_LO = 0x5c, + NPCM_GMAC_RGMII_STATUS = 0xd8, + NPCM_GMAC_WATCHDOG = 0xdc, + NPCM_GMAC_PTP_TCR = 0x700, + NPCM_GMAC_PTP_SSIR = 0x704, + NPCM_GMAC_PTP_STSR = 0x708, + NPCM_GMAC_PTP_STNSR = 0x70c, + NPCM_GMAC_PTP_STSUR = 0x710, + NPCM_GMAC_PTP_STNSUR = 0x714, + NPCM_GMAC_PTP_TAR = 0x718, + NPCM_GMAC_PTP_TTSR = 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 = test_data; + const GMACModule *mod = td->module; + QTestState *qts = qtest_init("-machine npcm845-evb"); + +#define CHECK_REG32(regno, value) \ + do { \ + g_assert_cmphex(gmac_read(qts, mod, (regno)), ==, (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 = g_strdup_printf( + "npcm7xx_gmac/gmac[%d]/%s", gmac_module_index(td->module), name); + 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 = 0; i < ARRAY_SIZE(gmac_module_list); ++i) { + TestData *td = &test_data_list[i]; + + td->module = &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 = \ (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', From patchwork Fri Feb 2 15:36:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769209 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973166wrc; Fri, 2 Feb 2024 07:37:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUzD73mL83ron4xKgeZsZSr8p4i4vtixnczbNCo0npKpZ5GvN1r4sdENsH5IcCwIimPm9m X-Received: by 2002:a05:6871:410d:b0:214:e5ed:d9e7 with SMTP id la13-20020a056871410d00b00214e5edd9e7mr59300oab.9.1706888270491; Fri, 02 Feb 2024 07:37:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888270; cv=none; d=google.com; s=arc-20160816; b=DXHmlH73BL+dsebxJzqZ26BMbyq+aYL+V6hpPurn7QBPTg2p0RXAYWOT/AKmHfy8D1 L1e9iaBoLoPF4H9I0DwYaVIZAYw9mI+Jvg+/O3MfdeuTzy0U0CRMy4a/FQ1NgLz4KaA+ mwuNMR8WoIapxXe9pPrwjKVU9osafe0A1bXgzRxb43aik6wd0rPbQGGe7jHxqm0qoPwA ETZNLdwiKsdIej6fSEuu1BBvyhilYDq1g9PEB4TBnWQoC+y6t7nDJE+FwTfY5Kp5+wdi yPgrd0xk5H4agAvYJTaSp0/QpaRRCJrybSwhGMZlzX85uYnFG2k3qhjCW8+HKnZ20cyt xJsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=wQyXfbDvDsUrvNO+g+3q6CqiwoZf9GwfcKn7/ZL2RuM=; fh=5lDxxZkZ86UKaQG1XQC716xLjhdGWlhBTkAqrzfC7dw=; b=w2iM1sQzA8RXHZPLHRi/CU8w1b2UNg+aZBXZ4xa2p8Y84KGU/lmLx72UhYN/5mYuir lTorUk4eraNeIvIczZ2QFHXM+E8xjuo0HUssry3ryU77I5MY0WpbdqigwdREuXeI5eza 3ZTBOMxhhj+Fpkr4j6nhEMUr1y+5rrnFw9kTg69q5VIRlvC8ox9qKzW9bBBATS8YzvKa LbWOXk62D6k5Nd4CrMo9gBGET40kRtT5rJdB73Lfnkldd15jhwpmrx65c7rviUd9MwJq 7o9L6LqKYhn5HTs5rbrwx9k0sYc84BYa9wNK97LzBDVY1AvG1tMbaqjby1CVznH9PWW9 gqiw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yGux69yu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCUAyv2MsyFBt1ViRAJh+DjbGasM+jN2ehK6WDbTcZqb5FSysg3UjX8hpmA8Htz/tgy45puOKLJvjJvovl/DhvcZ Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t4-20020a0cea24000000b0068c672f29cesi2282746qvp.160.2024.02.02.07.37.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:37:50 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yGux69yu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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, bool active) static bool gmac_can_receive(NetClientState *nc) { + NPCMGMACState *gmac = 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; } @@ -192,10 +207,256 @@ static void gmac_update_irq(NPCMGMACState *gmac) qemu_set_irq(gmac->irq, level); } +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 = le32_to_cpu(desc->rdes0); + desc->rdes1 = le32_to_cpu(desc->rdes1); + desc->rdes2 = le32_to_cpu(desc->rdes2); + desc->rdes3 = 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 = cpu_to_le32(desc->rdes0); + le_desc.rdes1 = cpu_to_le32(desc->rdes1); + le_desc.rdes2 = cpu_to_le32(desc->rdes2); + le_desc.rdes3 = 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 @ 0x%" + 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 >= *left_frame) { + to_transfer = *left_frame; + *eof_transferred = true; + } else { + to_transfer = 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 += to_transfer; + *left_frame -= to_transfer; + *transferred += to_transfer; + + return 0; +} + +static void gmac_dma_set_state(NPCMGMACState *gmac, int shift, uint32_t state) +{ + gmac->regs[R_NPCM_DMA_STATUS] = deposit32(gmac->regs[R_NPCM_DMA_STATUS], + 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 = NPCM_GMAC(qemu_get_nic_opaque(nc)); + uint32_t left_frame = len; + const uint8_t *frame_ptr = buf; + uint32_t desc_addr; + uint32_t rx_buf_len, rx_buf_addr; + struct NPCMGMACRxDesc rx_desc; + uint16_t transferred = 0; + bool eof_transferred = 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] = + NPCM_DMA_HOST_RX_DESC_MASK(gmac->regs[R_NPCM_DMA_RX_BASE_ADDR]); + } + desc_addr = 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_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_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] |= NPCM_DMA_STATUS_RU; + gmac->regs[R_NPCM_DMA_STATUS] |= 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 interrupts) + */ + 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 descriptor.*/ + rx_desc.rdes0 = 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 += 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 &= ~RX_DESC_RDES0_OWN; + /* Set the frame to be an IPv4/IPv6 frame. */ + rx_desc.rdes0 |= RX_DESC_RDES0_FRM_TYPE_MASK; + + /* step 4 */ + rx_buf_len = RX_DESC_RDES1_BFFR1_SZ_MASK(rx_desc.rdes1); + rx_buf_addr = rx_desc.rdes2; + gmac->regs[R_NPCM_DMA_CUR_RX_BUF_ADDR] = 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_path, + rx_buf_len, rx_buf_addr); + /* if we still have frame left and the second buffer is not chained */ + if (!(rx_desc.rdes1 & RX_DESC_RDES1_SEC_ADDR_CHND_MASK) && \ + !eof_transferred) { + /* repeat process from above on buffer 2 */ + rx_buf_len = RX_DESC_RDES1_BFFR2_SZ_MASK(rx_desc.rdes1); + rx_buf_addr = rx_desc.rdes3; + gmac->regs[R_NPCM_DMA_CUR_RX_BUF_ADDR] = 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_path, + rx_buf_len, rx_buf_addr); + } + /* update address for descriptor */ + gmac->regs[R_NPCM_DMA_HOST_RX_DESC] = rx_buf_addr; + /* Return descriptor */ + rx_desc.rdes0 &= ~RX_DESC_RDES0_OWN; + /* Update frame length transferred */ + rx_desc.rdes0 |= ((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 = gmac->regs[R_NPCM_DMA_RX_BASE_ADDR]; + } else if (rx_desc.rdes1 & RX_DESC_RDES1_SEC_ADDR_CHND_MASK) { + desc_addr = rx_desc.rdes3; + } else { + desc_addr += 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] |= 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 |= RX_DESC_RDES0_DESC_ERR_MASK; + } + eof_transferred = true; + } + /* Clear rdes0 for the incoming descriptor */ + rx_desc.rdes0 = 0; + } + } + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_RX_PROCESS_STATE_SHIFT, + NPCM_DMA_STATUS_RX_RUNNING_CLOSING_STATE); + + rx_desc.rdes0 |= RX_DESC_RDES0_LAST_DESC_MASK; + if (!(rx_desc.rdes1 & RX_DESC_RDES1_DIS_INTR_COMP_MASK)) { + gmac->regs[R_NPCM_DMA_STATUS] |= 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] |= NPCM_DMA_CONTROL_FLUSH_MASK; + + /* step 9 */ + trace_npcm_gmac_packet_received(DEVICE(gmac)->canonical_path, left_frame); + 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 = gmac->regs[R_NPCM_DMA_RX_BASE_ADDR]; + } else if (rx_desc.rdes1 & RX_DESC_RDES1_SEC_ADDR_CHND_MASK) { + desc_addr = rx_desc.rdes3; + } else { + desc_addr += sizeof(rx_desc); + } + gmac->regs[R_NPCM_DMA_HOST_RX_DESC] = desc_addr; + return len; } static void gmac_cleanup(NetClientState *nc) @@ -306,6 +567,7 @@ static void npcm_gmac_write(void *opaque, hwaddr offset, break; case A_NPCM_GMAC_MAC_CONFIG: + gmac->regs[offset / sizeof(uint32_t)] = v; break; case A_NPCM_GMAC_MII_ADDR: @@ -347,6 +609,8 @@ static void npcm_gmac_write(void *opaque, hwaddr offset, 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; case A_NPCM_DMA_STATUS: @@ -357,6 +621,14 @@ static void npcm_gmac_write(void *opaque, hwaddr offset, HWADDR_PRIx ", value: 0x%04" PRIx64 "\n", DEVICE(gmac)->canonical_path, offset, v); } + /* for W1C bits, implement W1C */ + gmac->regs[offset / sizeof(uint32_t)] &= ~NPCM_DMA_STATUS_W1C_MASK(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_SHIFT, + NPCM_DMA_STATUS_RX_RUNNING_WAITING_STATE); + qemu_flush_queued_packets(qemu_get_queue(gmac->nic)); + } break; 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_write, 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=%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" PRIX32 " IRQ Set: %d" +npcm_gmac_packet_desc_read(const char* name, uint32_t desc_addr) "%s: attempting to read descriptor @0x%04" PRIX32 +npcm_gmac_packet_receive(const char* name, uint32_t len) "%s: RX packet length: 0x%04" PRIX32 +npcm_gmac_packet_receiving_buffer(const char* name, uint32_t buf_len, uint32_t rx_buf_addr) "%s: Receiving into Buffer size: 0x%04" PRIX32 " at address 0x%04" PRIX32 +npcm_gmac_packet_received(const char* name, uint32_t len) "%s: Reception finished, packet left: 0x%04" PRIX32 +npcm_gmac_debug_desc_data(const char* name, void* addr, uint32_t des0, uint32_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 " Descriptor 3: 0x%04" PRIX32 # 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 From patchwork Fri Feb 2 15:36:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769214 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973466wrc; Fri, 2 Feb 2024 07:38:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGawXd6VYMHRCP6p6c/0WSIggWOCMgTuQtKSH4vNme1xd/g4J7QLwLKL8C2+z/514o2M39G X-Received: by 2002:a05:620a:4725:b0:785:5eed:f80a with SMTP id bs37-20020a05620a472500b007855eedf80amr658165qkb.61.1706888310620; Fri, 02 Feb 2024 07:38:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888310; cv=none; d=google.com; s=arc-20160816; b=VJEwP7GMhtwUqE0I1ZJXrQ0wa808IjTfh6RBk+tQxR0eB0STSN3/C3hnyKqojZZQAH hurK3WnM5rWq3ogr2uRK4NURJyeYL3Z/0XUSab0ZEXlTP/OzK5ty/r6FexWf1W4iPcos N/U7ap7MKXOkr1ylpK7mOI/skR3hGKi30P0q64bB93/Ghb+PW6DrZ3E9QsQOeoCuomsP RSNjbXc4VZF4Bf2giC0VGhakRFFKRJZg+gcc5sp8BzjEVStMlWsY9Ny32ra/OQ88V/F5 0N/ERL4Sk1jQwXW6xJtT0aLpk9D0G8pEsniBo0nWDDoMEoguR7p34G7eyehhkSlwX4xC ZPMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=/AEDkTvBGJa0LD/A6ZVlUM/YpBQnMTkyj2QgiWhIPMM=; fh=KP8OaHhPbn7tO0prr9d+rTwo4m16XwTC6bQF8D4d4UE=; b=hwErL+GZRfM4P+nIOUV2YhxHCK/uRkwx2QLomzcHi77xaQOAfSsYZ/9fa6G6WYf2fA qcPvtLFFKzEfUWSOfwSehJzJID0iOtkZ8o2+1ge+JXUYDWXEnGhGACHr3Rb15ImK1/r9 ixkZrRn6NALyy1mk7HV/j6nMCX3OgDAP3kaQRYlMVDmZko+M18fzlZLz5OFWngwcYPzB uVL5yHt3VBC8GRRkPilhIAZ2sh5G+tyPzmzlje9ZOl5L0vfo3C6qt1lBJvLAAn0OXA3J oGhH1Ok+Px+Eue1hdbHfll/z9GWwyyKPKnIlkMGpcYgv2K+sL1psDEtbq8lOttBsD0Up UFzA==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hCSuD43E; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCVoSA+hb5rVIjW83xoCr691xTpxOhaXJlyKXhKHw5Q25mF2W6fGAoKcOdYngAFbTat2yLzadVcZkWSC6xnyICHa Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m1-20020a05620a220100b0078323154c8esi2129696qkh.445.2024.02.02.07.38.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:38:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hCSuD43E; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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; } +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 = le32_to_cpu(desc->tdes0); + desc->tdes1 = le32_to_cpu(desc->tdes1); + desc->tdes2 = le32_to_cpu(desc->tdes2); + desc->tdes3 = 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 = cpu_to_le32(desc->tdes0); + le_desc.tdes1 = cpu_to_le32(desc->tdes1); + le_desc.tdes2 = cpu_to_le32(desc->tdes2); + le_desc.tdes3 = 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 @ 0x%" + 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; } +static int gmac_tx_get_csum(uint32_t tdes1) +{ + uint32_t mask = TX_DESC_TDES1_CHKSM_INS_CTRL_MASK(tdes1); + int csum = 0; + + if (likely(mask > 0)) { + csum |= CSUM_IP; + } + if (likely(mask > 1)) { + csum |= 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 = 2048; + g_autofree uint8_t *tx_send_buffer = g_malloc(tx_buffer_size); + uint32_t desc_addr; + struct NPCMGMACTxDesc tx_desc; + uint32_t tx_buf_addr, tx_buf_len; + uint16_t length = 0; + uint8_t *buf = tx_send_buffer; + uint32_t prev_buf_size = 0; + int csum = 0; + + /* steps 1&2 */ + if (!gmac->regs[R_NPCM_DMA_HOST_TX_DESC]) { + gmac->regs[R_NPCM_DMA_HOST_TX_DESC] = + NPCM_DMA_HOST_TX_DESC_MASK(gmac->regs[R_NPCM_DMA_TX_BASE_ADDR]); + } + desc_addr = 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 = DMA Owned, 0 = 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] |= NPCM_DMA_STATUS_TU; + gmac_dma_set_state(gmac, NPCM_DMA_STATUS_TX_PROCESS_STATE_SHIFT, + 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 &= ~TX_DESC_TDES0_OWN; + + if (tx_desc.tdes1 & TX_DESC_TDES1_FIRST_SEG_MASK) { + csum = gmac_tx_get_csum(tx_desc.tdes1); + } + + /* step 4 */ + tx_buf_addr = tx_desc.tdes2; + gmac->regs[R_NPCM_DMA_CUR_TX_BUF_ADDR] = tx_buf_addr; + tx_buf_len = TX_DESC_TDES1_BFFR1_SZ_MASK(tx_desc.tdes1); + buf = &tx_send_buffer[prev_buf_size]; + + if ((prev_buf_size + tx_buf_len) > sizeof(buf)) { + tx_buffer_size = prev_buf_size + tx_buf_len; + tx_send_buffer = g_realloc(tx_send_buffer, tx_buffer_size); + buf = &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 += tx_buf_len; + prev_buf_size += 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 = tx_desc.tdes3; + gmac->regs[R_NPCM_DMA_CUR_TX_BUF_ADDR] = tx_buf_addr; + tx_buf_len = TX_DESC_TDES1_BFFR2_SZ_MASK(tx_desc.tdes1); + buf = &tx_send_buffer[prev_buf_size]; + + if ((prev_buf_size + tx_buf_len) > sizeof(buf)) { + tx_buffer_size = prev_buf_size + tx_buf_len; + tx_send_buffer = g_realloc(tx_send_buffer, tx_buffer_size); + buf = &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 += tx_buf_len; + prev_buf_size += 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, length); + trace_npcm_gmac_packet_sent(DEVICE(gmac)->canonical_path, length); + buf = tx_send_buffer; + length = 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 = gmac->regs[R_NPCM_DMA_TX_BASE_ADDR]; + } else if (tx_desc.tdes1 & TX_DESC_TDES1_SEC_ADDR_CHND_MASK) { + desc_addr = tx_desc.tdes3; + } else { + desc_addr += sizeof(tx_desc); + } + gmac->regs[R_NPCM_DMA_HOST_TX_DESC] = desc_addr; + + /* step 7 */ + if (tx_desc.tdes1 & TX_DESC_TDES1_INTERR_COMP_MASK) { + gmac->regs[R_NPCM_DMA_STATUS] |= 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 offset, NPCM_DMA_STATUS_RX_RUNNING_WAITING_STATE); break; + 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)] = 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_SHIFT, + 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_SHIFT, + 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_SHIFT, + 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 desc_addr) "%s: attempting npcm_gmac_packet_receive(const char* name, uint32_t len) "%s: RX packet length: 0x%04" PRIX32 npcm_gmac_packet_receiving_buffer(const char* name, uint32_t buf_len, uint32_t rx_buf_addr) "%s: Receiving into Buffer size: 0x%04" PRIX32 " at address 0x%04" PRIX32 npcm_gmac_packet_received(const char* name, uint32_t len) "%s: Reception finished, 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, uint32_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 " Descriptor 3: 0x%04" PRIX32 +npcm_gmac_packet_tx_desc_data(const char* name, uint32_t tdes0, uint32_t tdes1) "%s: Tdes0: 0x%04" PRIX32 " Tdes1: 0x%04" PRIX32 # 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 From patchwork Fri Feb 2 15:36:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769231 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973949wrc; Fri, 2 Feb 2024 07:39:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEe9WrKR9O9y/eIbP3skb/p/X4d8OIw0RjYf5UQNKaoIEb19Mm9QG7k3FfxbEc4DzTIQZMf X-Received: by 2002:ac8:5803:0:b0:42b:edbe:6212 with SMTP id g3-20020ac85803000000b0042bedbe6212mr2636317qtg.5.1706888373212; Fri, 02 Feb 2024 07:39:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888373; cv=none; d=google.com; s=arc-20160816; b=m5z77G1Fi8KdCBIPDIl9yLSGepiUWgeeMMSQx4tOAjCpqQxytN/2iw2LssMa6eTK17 RokRQje6aDzyoirbanpWMpau6VOX4ABVDDcRbfB9ydUFnOgNz8r2lpOxHCtedU2jlEkC hTldX70Ft7MKhZ62voT+DjmZGNm/WXZPm6Y4ad2Y6aThwNvnXb4AB5ivvG+r0nE4akHH h7tAQ0mLe0ra1QRKqqjSm/j7gLsE7nYaBBVjT4M4qcICKToNnOr416MwdXs6HteOHqB/ gCclrdT6K70uaE4AYOB9jcHfbAgWxMM8bINlVdePrU/SQjaF2Y95t8xWX6s0thSBqGSM OVSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=hTGwIpbc1jn6nVvKdDdysPoG5TIJGaOa+CtttkLXCs0=; fh=gfpCkyNx1DI4aBlwWKv2QNXLHybNx7vF4S2/HeFUl2k=; b=vk+lLab/rO+g/3CmUERLVSm1WZMEpFPUkhrnyAZSXOScsRO0SyrepZ7YAdupTPYPn2 Lm/ucxXey5WgvqoYiiMmGnOg35edgJy8HtoCHANM3uxdxS9BMZ5vWduJd13zt2XcDNAf DlV267nYY3nK5YzhMyohnnoa6LDMS9sYL4/xr00m+7cW4CeeGDc08DDW5Ryjsn4H8nF2 RnZg9vP14Q7PaHQmpw+4x4nMNksSjnMPTGUi5XJB7bbJZIO5kk3NyaW9INzC7ql5p9fI ebn8ofJaIwKSUw2LxIk5Yuwg78qWdOiFtTXKFo1SzgyzwH6FzGV6xuo7c/fawAS+4m4i iepw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gui1JuJF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCVxXwfn9GOIKzZWUyskZwDvJ/dgCtY0tkiopGC/01xqgXQOx6AYQPjOwJWdrMYMQwX8Z5jx+QhTmCct0XkPTw3V Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w8-20020a05622a134800b0042c05147dbasi1271108qtk.331.2024.02.02.07.39.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:39:33 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gui1JuJF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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" +/* 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 = 0x714, NPCM_GMAC_PTP_TAR = 0x718, NPCM_GMAC_PTP_TTSR = 0x71c, + + /* PCS Registers */ + NPCM_PCS_SR_CTL_ID1 = 0x3c0008, + NPCM_PCS_SR_CTL_ID2 = 0x3c000a, + NPCM_PCS_SR_CTL_STS = 0x3c0010, + + NPCM_PCS_SR_MII_CTRL = 0x3e0000, + NPCM_PCS_SR_MII_STS = 0x3e0002, + NPCM_PCS_SR_MII_DEV_ID1 = 0x3e0004, + NPCM_PCS_SR_MII_DEV_ID2 = 0x3e0006, + NPCM_PCS_SR_MII_AN_ADV = 0x3e0008, + NPCM_PCS_SR_MII_LP_BABL = 0x3e000a, + NPCM_PCS_SR_MII_AN_EXPN = 0x3e000c, + NPCM_PCS_SR_MII_EXT_STS = 0x3e001e, + + NPCM_PCS_SR_TIM_SYNC_ABL = 0x3e0e10, + NPCM_PCS_SR_TIM_SYNC_TX_MAX_DLY_LWR = 0x3e0e12, + NPCM_PCS_SR_TIM_SYNC_TX_MAX_DLY_UPR = 0x3e0e14, + NPCM_PCS_SR_TIM_SYNC_TX_MIN_DLY_LWR = 0x3e0e16, + NPCM_PCS_SR_TIM_SYNC_TX_MIN_DLY_UPR = 0x3e0e18, + NPCM_PCS_SR_TIM_SYNC_RX_MAX_DLY_LWR = 0x3e0e1a, + NPCM_PCS_SR_TIM_SYNC_RX_MAX_DLY_UPR = 0x3e0e1c, + NPCM_PCS_SR_TIM_SYNC_RX_MIN_DLY_LWR = 0x3e0e1e, + NPCM_PCS_SR_TIM_SYNC_RX_MIN_DLY_UPR = 0x3e0e20, + + NPCM_PCS_VR_MII_MMD_DIG_CTRL1 = 0x3f0000, + NPCM_PCS_VR_MII_AN_CTRL = 0x3f0002, + NPCM_PCS_VR_MII_AN_INTR_STS = 0x3f0004, + NPCM_PCS_VR_MII_TC = 0x3f0006, + NPCM_PCS_VR_MII_DBG_CTRL = 0x3f000a, + NPCM_PCS_VR_MII_EEE_MCTRL0 = 0x3f000c, + NPCM_PCS_VR_MII_EEE_TXTIMER = 0x3f0010, + NPCM_PCS_VR_MII_EEE_RXTIMER = 0x3f0012, + NPCM_PCS_VR_MII_LINK_TIMER_CTRL = 0x3f0014, + NPCM_PCS_VR_MII_EEE_MCTRL1 = 0x3f0016, + NPCM_PCS_VR_MII_DIG_STS = 0x3f0020, + NPCM_PCS_VR_MII_ICG_ERRCNT1 = 0x3f0022, + NPCM_PCS_VR_MII_MISC_STS = 0x3f0030, + NPCM_PCS_VR_MII_RX_LSTS = 0x3f0040, + NPCM_PCS_VR_MII_MP_TX_BSTCTRL0 = 0x3f0070, + NPCM_PCS_VR_MII_MP_TX_LVLCTRL0 = 0x3f0074, + NPCM_PCS_VR_MII_MP_TX_GENCTRL0 = 0x3f007a, + NPCM_PCS_VR_MII_MP_TX_GENCTRL1 = 0x3f007c, + NPCM_PCS_VR_MII_MP_TX_STS = 0x3f0090, + NPCM_PCS_VR_MII_MP_RX_GENCTRL0 = 0x3f00b0, + NPCM_PCS_VR_MII_MP_RX_GENCTRL1 = 0x3f00b2, + NPCM_PCS_VR_MII_MP_RX_LOS_CTRL0 = 0x3f00ba, + NPCM_PCS_VR_MII_MP_MPLL_CTRL0 = 0x3f00f0, + NPCM_PCS_VR_MII_MP_MPLL_CTRL1 = 0x3f00f2, + NPCM_PCS_VR_MII_MP_MPLL_STS = 0x3f0110, + NPCM_PCS_VR_MII_MP_MISC_CTRL2 = 0x3f0126, + NPCM_PCS_VR_MII_MP_LVL_CTRL = 0x3f0130, + NPCM_PCS_VR_MII_MP_MISC_CTRL0 = 0x3f0132, + NPCM_PCS_VR_MII_MP_MISC_CTRL1 = 0x3f0134, + NPCM_PCS_VR_MII_DIG_CTRL2 = 0x3f01c2, + NPCM_PCS_VR_MII_DIG_ERRCNT_SEL = 0x3f01c4, } NPCMRegister; static uint32_t gmac_read(QTestState *qts, const GMACModule *mod, @@ -122,6 +182,15 @@ static uint32_t gmac_read(QTestState *qts, const GMACModule *mod, return qtest_readl(qts, mod->base_addr + regno); } +static uint16_t pcs_read(QTestState *qts, const GMACModule *mod, + NPCMRegister regno) +{ + uint32_t write_value = (regno & 0x3ffe00) >> 9; + qtest_writel(qts, PCS_BASE_ADDRESS + NPCM_PCS_IND_AC_BA, write_value); + uint32_t read_offset = 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)), ==, (value)); \ } while (0) +#define CHECK_REG_PCS(regno, value) \ + do { \ + g_assert_cmphex(pcs_read(qts, mod, (regno)), ==, (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); + /* TODO Add registers PCS */ + if (mod->base_addr == 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); } From patchwork Fri Feb 2 15:36:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769235 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp974030wrc; Fri, 2 Feb 2024 07:39:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IFkPDbV0Ut154iMCVXKWOTWTEy6VL5IseiPwy0VhYul3+A8eP7o3w9hjn5jCDS/MVopHxNW X-Received: by 2002:a05:622a:1825:b0:42a:9aa9:2d4d with SMTP id t37-20020a05622a182500b0042a9aa92d4dmr2606311qtc.62.1706888385700; Fri, 02 Feb 2024 07:39:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888385; cv=none; d=google.com; s=arc-20160816; b=F1vbu0cOUoCC6KHTJRFcxsa7kOCEtO0i0a/XthlFDCHOMxslT0Q2okFqyRNixA9D/i q5oY/e/pjmMq8IqP3LeaKyHnSLwqYImFoYJm8MIl4/qeNe9lq4WG8RMXp96FSfozeL3m ksR1uFCF4vTG66igGn7dJ6lAw3uvKHAN8SjF/K5oXJ/RGa1rJ1Y/xr7AHmgJpcu/LuV7 dl4SZd5jLhWz9FTBgiWQPyO17B6cRxZD6B+JWZaTRoA66lWTVVOvWno7gaqW0C1Z7J+D YSQfC7YLATkVc3v2NW3xeUT0cH6Or8hcf2dSeF3nR6ZNUMM7oRp7ICd4rwXaMDIt5d6X Cc+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=xUcECD2nnVhiI52zHyXo8n02AAr8/WZ9q/Hl5Mbt4mA=; fh=aNA1mFccCU3MOidixvuZciew8++fzhYP4YMW9NU/8ko=; b=yssGA6ppu5hqSm79gzjKDYX523TXfqeNeX7Olnu96Y+7JM46+nhNqY8wW35WOjdJoQ cO0LH/r9bBo9k9jMyhD0vOwrbjullRfrGR2BSHy0Cfwu1xfg5XszqJmggR8aDlO6GF1f bTY4cKM4L88cVBtG2JtPzxjavEOarKP58pSjmePMHDJwms4DV1DfkN2Cg91XrDpcpjQc d9L+9E+z3O0PTb9PZ8jKkZDRffH7WkRib1niGx34mP6PY4HTPL/ywEgCkPR6C/smmD49 XqCcTEXlScT8kFKYaTsXQzwxt3SxdPbxiRCdQQHcpcVaMJU/OecRH69MhE2y3dDOp1Ji cVEw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CJSZhFmd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCUVol2IoFZ7YvBL3KlHamGXriZbtzg8jh0ZgmhJBJWe11S7azYh1gFw5R8AqbobuTs/JDZq6RSRyosiUTqA6AHk Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l6-20020a05622a050600b0042bff2835b8si2188856qtx.579.2024.02.02.07.39.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:39:45 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CJSZhFmd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Rayhan Faizel This patch adds the SPI controller for the BCM2835. Polling and interrupt modes 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) Missing devices --------------- - * 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"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * 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 OTHER + * 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 operating + * 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"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * 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 OTHER + * 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 = 0; + + /* Interrupt on DONE */ + if (s->cs & BCM2835_SPI_CS_INTD && s->cs & BCM2835_SPI_CS_DONE) { + do_interrupt = 1; + } + /* Interrupt on RXR */ + if (s->cs & BCM2835_SPI_CS_INTR && s->cs & BCM2835_SPI_CS_RXR) { + do_interrupt = 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 |= BCM2835_SPI_CS_RXD; + } else { + s->cs &= ~BCM2835_SPI_CS_RXD; + } + + /* Set RXF if RX FIFO is full */ + if (fifo8_is_full(&s->rx_fifo)) { + s->cs |= BCM2835_SPI_CS_RXF; + } else { + s->cs &= ~BCM2835_SPI_CS_RXF; + } + + /* Set RXR if RX FIFO is 3/4th used or above */ + if (fifo8_num_used(&s->rx_fifo) >= FIFO_SIZE_3_4) { + s->cs |= BCM2835_SPI_CS_RXR; + } else { + s->cs &= ~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 &= ~BCM2835_SPI_CS_TXD; + } else { + s->cs |= 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 |= BCM2835_SPI_CS_DONE; + } else { + s->cs &= ~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 = fifo8_pop(&s->tx_fifo); + rx_byte = 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 = opaque; + uint32_t readval = 0; + + switch (addr) { + case BCM2835_SPI_CS: + readval = s->cs & 0xffffffff; + break; + case BCM2835_SPI_FIFO: + bcm2835_spi_flush_tx_fifo(s); + if (s->cs & BCM2835_SPI_CS_RXD) { + readval = fifo8_pop(&s->rx_fifo); + bcm2835_spi_update_rx_flags(s); + } + + bcm2835_spi_update_int(s); + break; + case BCM2835_SPI_CLK: + readval = s->clk & 0xffff; + break; + case BCM2835_SPI_DLEN: + readval = s->dlen & 0xffff; + break; + case BCM2835_SPI_LTOH: + readval = s->ltoh & 0xf; + break; + case BCM2835_SPI_DC: + readval = s->dc & 0xffffffff; + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad offset 0x%" HWADDR_PRIx "\n", __func__, addr); + } + return readval; +} + +static void bcm2835_spi_write(void *opaque, hwaddr addr, + uint64_t value, unsigned int size) +{ + BCM2835SPIState *s = opaque; + + switch (addr) { + case BCM2835_SPI_CS: + s->cs = (value & ~RO_MASK) | (s->cs & RO_MASK); + if (!(s->cs & BCM2835_SPI_CS_TA)) { + /* Clear DONE and RXR if TA is off */ + s->cs &= ~(BCM2835_SPI_CS_DONE); + s->cs &= ~(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 = value & 0xffff; + break; + case BCM2835_SPI_DLEN: + s->dlen = value & 0xffff; + break; + case BCM2835_SPI_LTOH: + s->ltoh = value & 0xf; + break; + case BCM2835_SPI_DC: + s->dc = value & 0xffffffff; + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Bad offset 0x%" HWADDR_PRIx "\n", __func__, addr); + } +} + +static const MemoryRegionOps bcm2835_spi_ops = { + .read = bcm2835_spi_read, + .write = bcm2835_spi_write, + .endianness = DEVICE_NATIVE_ENDIAN, +}; + +static void bcm2835_spi_realize(DeviceState *dev, Error **errp) +{ + BCM2835SPIState *s = BCM2835_SPI(dev); + s->bus = 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 = BCM2835_SPI(dev); + + fifo8_reset(&s->tx_fifo); + fifo8_reset(&s->rx_fifo); + + /* Reset values according to BCM2835 Peripheral Documentation */ + s->cs = BCM2835_SPI_CS_TXD | BCM2835_SPI_CS_REN; + s->clk = 0; + s->dlen = 0; + s->ltoh = 0x1; + s->dc = 0x30201020; +} + +static const VMStateDescription vmstate_bcm2835_spi = { + .name = TYPE_BCM2835_SPI, + .version_id = 1, + .minimum_version_id = 1, + .fields = (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 = DEVICE_CLASS(klass); + + dc->reset = bcm2835_spi_reset; + dc->realize = bcm2835_spi_realize; + dc->vmsd = &vmstate_bcm2835_spi; +} + +static const TypeInfo bcm2835_spi_info = { + .name = TYPE_BCM2835_SPI, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(BCM2835SPIState), + .class_init = 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')) From patchwork Fri Feb 2 15:36:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 769218 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp973510wrc; Fri, 2 Feb 2024 07:38:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEB5JP0bkvNuT7zOWgqquy5oKjrAGAYr/HIiyIjwssOYMZAt4ITcK+wJ0guLNE+qFEFtaNw X-Received: by 2002:a05:6830:388c:b0:6dd:e0d0:b5ec with SMTP id bq12-20020a056830388c00b006dde0d0b5ecmr10705262otb.24.1706888315982; Fri, 02 Feb 2024 07:38:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706888315; cv=none; d=google.com; s=arc-20160816; b=rWLBAUVezAKv4MxcJCtshCvmgvvU/hEVoW99dSXE89J4s7JGpyRRSX42U85tAoXlbG xrFhJxQRPmndug6KUawUMmNhix96a7wyLThKxWH/MI6h6nKTzvb08uxp51niPeWFzQM0 8+auOaQyGSJAytzdo0LsU9wZQim1K/xDpE5eiySGFrFMiuY0qs2hT9bF4R6qn9YP9jg0 FFuaRzzDuJdwaPIzMmfSHDB1B2X/irzMs4b/qEIQA2FqfKx+Wz/HXZCT4EiNPQ3D8YSY fhLiznuksnrZfGXj8nliNWpCudJSE3Q/uJCR2Z9jZRTqkpzRO2UAmxQFDz4X4dTrDD5U AAvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=e6ecdA6XprRoNkA0wb02c6VKGclESqrERe4VSdnbqBk=; fh=kHFrMyXpQOSLb5krfoQrydCT4n69rln0Th5Zd9J4E+s=; b=00+VdaFM0xyEL9awCOpuW9a32XQ2I/3t2fEGu4Xn2do3umKI+TFOxTYWkAfwcAi8jP 5DE4/jlAnjBUTyvlqxD38vlPXaRSYGrZXprfaDIAn/eRDwBOPs35sFN654wbF/uZCj4S 98vgejB4aaLQuJQ9QiFoJTHaufKacQUlJXRTSe0pzScBSVDCjJlddtgCJtjadVkiSjn2 k8SeOM7CzvrgHVd6Df/KB6oaRs8LRYlw5VJRXsxEtOwus57PwfOVTuJy+1OtUXDa3QlP 1b4ZZ+tPVIkR6X5/LyyW/0NtUVGCuPsQxkmCQFKdJUe7akp/+hW7pwO8pHETITyoqQaJ aBQg==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lzsxvyvi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=0; AJvYcCVbzTfP2t2LbTVbdD7NxEmhEE0HTStENVSTnS7dIzZGBUryTct0y3JbJJ0l8r7IkQ7hh3hnoLiYWuhxYw0ErEmh Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d18-20020a05622a15d200b0042c07844272si900040qty.359.2024.02.02.07.38.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2024 07:38:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lzsxvyvi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 does not work. Instead, dtmerge can be used to apply spi=on 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" @@ -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); } 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)); + /* 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 config STM32F100_SOC bool