From patchwork Tue Feb 27 13:32:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776193 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp155565wro; Tue, 27 Feb 2024 05:34:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUk/lI5PSj+NQCCnbAnbkpYV8fUN5wchKsXJM6SPttp1KQCNa1jqwnnqrxIFZoEP5eU08ZFMu22pAq6C4fOut6Z X-Google-Smtp-Source: AGHT+IGKdADTnfhsyztmbPS93kaXpgmExe5alPRDEjWB/KJaD+B6Y2CUQ8PRzqbYljALP4165W0l X-Received: by 2002:ad4:5d6a:0:b0:68f:a58f:6582 with SMTP id fn10-20020ad45d6a000000b0068fa58f6582mr2405736qvb.12.1709040841032; Tue, 27 Feb 2024 05:34:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709040841; cv=none; d=google.com; s=arc-20160816; b=VQlU/j1dkNy/g0DNqYnPvEWrsn2LIFCX91OMVDyyDLGSB023+9RCf9ku7mPvOFkb2u GAtXa7KYjaTo9P9DEBXWgPcGwAzdd2thT13VdY4l5zfIn48WbMJXw4YH5xmcP1Q7lMFF CEMYmTuYhtpMgrbc36ZTF4iyh6mkSymnH2h+59NKYwx+bdR+n9Dz053EQI0+0dlzFtQK odCW4Ou8T9aGxL/PKgLR/7YjQyIBMt2vY9rpMqg/9YAf1V/znWsqNLlUC82TNHB8n8OO 2X/cMEVsvrmhjwrBXGqgdfOw4qljWb75rr+Z1mnddEzRCcH62PQ0QG3597PgrVP0PNdV SR/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=HnAhjwsLeVDki2L/dt5NeuP6uPlgrzrYPZ3yiJ+bVUI=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ofPeZYncJDXUdqk2Vti+hgGiNwFDBU5w/dIyu93OQsobdT4AYzqORICUnW73qz0sLq VjGoLHyXRtunHahVtJ18i/H1Q1T35cyBzWZLjbZ9vKJY0mF7l4ACZHfdF7s581FAaQcm OnCdI71mjxyV3LRB+ecoja9xVnnPTFM1zwcBh6dXgcQXIGDBA8vLbfBXjjr2VtaaAJI9 uXVIR7ef8NYuYd49CTFMM5wlQKL6ssA+ITlIAdVHSts/6FMrlb1Ey0IUofuGTnUhn6cZ kuJuhrdECo+56BjQU6h8rnZoY7G1fAAMLKfUo9qNoLN3ziNKF9Qx8e+6KA1mRT1DtamJ JDaA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="DnON/gmS"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6-20020ad45ba6000000b00690079f84bbsi4772924qvq.562.2024.02.27.05.34.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:34: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="DnON/gmS"; 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 1rexaD-0000gA-JE; Tue, 27 Feb 2024 08:33:21 -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 1rexaC-0000fg-7k for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:20 -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 1rexaA-0002pZ-Mf for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:19 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-412af664954so3095865e9.0 for ; Tue, 27 Feb 2024 05:33:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040796; x=1709645596; 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=HnAhjwsLeVDki2L/dt5NeuP6uPlgrzrYPZ3yiJ+bVUI=; b=DnON/gmSoxwumDZLHdcn4hXFbVV9C1NrkczKnNSDJvAe6xfGmvRa1dhlMNLsMB4eFc 2t9MrRFXfhTorqdkMyTrdfkInIgRyDhcxXkyK2LpywqScGSI1CfGowDAvlWSPjr8YrvB w4ygDaXWmJi0tNxk2+0pxdtEi26AemXCLMbfvBojoRSCNwb6MOc7PrqFHvqktKo71kOY A1Q1puwOYDD81WuCA1sluDNFohXx71xnCBX+bMbzOQzcd4KmExBHFjDKZTfP0COSGW01 ghRiVcqCO6QE7Y9WmyLTVM+w66ofXq5dY/wKo/dIK3iCpOjNYSFgk9F+ZaQpbRRxyE56 c0Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040796; x=1709645596; 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=HnAhjwsLeVDki2L/dt5NeuP6uPlgrzrYPZ3yiJ+bVUI=; b=vnqRZKc7KF/CTkasa5E0S9eUb4j+d2CgIFKBMkPZS6VP+Sbe0ttP5HtByiCgdvPe+H H8kZpyBuRBtrW7zY3ptbmdPq/221DRYefpXMrdiFCshZiNuzT3O61a5bCal4RA856iJ1 c8/ckVvyeKaLpaAcsakEpLup9uzCGQPmieBiC5A6+trk82virZ9099SIB9HpNAZ0+AP8 YDplFu3yHrmmuAyKmqRqOAqf5DbuZZxhfuk1KzL1ReIM33JG9xhbdApB8M8v+8xZrzbj OGWT7iRhWSujZpypF0yu0fbwfkJDDxhiA1icYkHPh194Q2X+6yl1q1I2OAfOfJ5EUvpt Vqqw== X-Gm-Message-State: AOJu0YzHKZ+5jde2/dBmxd43e6/MHNIHWwvmPyi3/xu/tra/JIfG6RZv thcqaMfxoyd9Mznw6hT2BsyWNHRfilxwp/OU8yA8j0EJl1tNeCWWwQRhXZ+dFgqRA6BBuDNJg1X v X-Received: by 2002:a05:600c:5114:b0:412:9830:a259 with SMTP id o20-20020a05600c511400b004129830a259mr7500297wms.25.1709040796713; Tue, 27 Feb 2024 05:33:16 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:16 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/45] hw/arm/sbsa-ref: Simplify init since PCIe is always enabled Date: Tue, 27 Feb 2024 13:32:30 +0000 Message-Id: <20240227133314.1721857-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-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 From: Marcin Juszkiewicz There is no point in checking do we have PCIe if first thing after check is adding PCIe card without checking. Signed-off-by: Marcin Juszkiewicz Reviewed-by: Philippe Mathieu-Daudé Message-id: 20240215153311.186772-1-marcin.juszkiewicz@linaro.org Signed-off-by: Peter Maydell --- hw/arm/sbsa-ref.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 13dde50cba2..f5709d6c141 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -664,9 +664,8 @@ static void create_pcie(SBSAMachineState *sms) } pci = PCI_HOST_BRIDGE(dev); - if (pci->bus) { - pci_init_nic_devices(pci->bus, mc->default_nic); - } + + pci_init_nic_devices(pci->bus, mc->default_nic); pci_create_simple(pci->bus, -1, "bochs-display"); From patchwork Tue Feb 27 13:32: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: 776198 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp156155wro; Tue, 27 Feb 2024 05:35:11 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVyVBSTC27l9e7ZWCbIHBvLJOGFWqvrgqaqtm5N6/Q6I19MS2GGrfWER+0cebzMvWYnRPC1lNykx3oOY1J+38uo X-Google-Smtp-Source: AGHT+IEFA9DAKXAig6GFEGJvGlHDhWfzsY0IlUNHtizd+JlRQEbhDmncflhEpXtsuik37wa1pDVn X-Received: by 2002:a05:6808:221a:b0:3c1:6d6c:2e3f with SMTP id bd26-20020a056808221a00b003c16d6c2e3fmr2374416oib.14.1709040910737; Tue, 27 Feb 2024 05:35:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709040910; cv=none; d=google.com; s=arc-20160816; b=xqqQJlcG2GyviG4tMGF36dep6odzlMHU94pb3ahm5/tN58hcKTtvxkxCqFaTrz+Glp wovdYyYkbRntw1XoZkploCphO485/J6RhNfFxd7E4rEeTrP4kzcIfMtKUUtJbpr2TYlf gV4G6ROjm+gZu0EUCw7cjeHaiaNdP1RAF4TtjbTAFSLKcCe5w40nBu5drirnJDIVd3Sy 1wqus4CptiB0P6dXxkuYWkkCWKNo0AY0NZeI4rLAZeKnNOfGqyMPLuREgMvjZGOxpozG 34SZ+w/0mp1w+1Kv2aa+YFJh+5P4MOxyAkum436GpA2G9wHjnyWwzFDezVeQ2reHTo4m g1xw== 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=rLfVBib6moPM6Xgbon/d2611Q9D6RHvJCoxeaZ9C+Eo=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=p2Iu1ME+PsxH3tYathJQxa5YjLSSAvlGOXgmyY3Y/jOmY5a/1sgyxO+8uPnjatlYAe 9d8evuIzPv+0qy4BfRhGzGDWOLMIrA++mOwDBWRm1oJ+lBqspbKDarvJUG5zYawMM/CU Yr1G6Nq5Ss4JbgCNg+VXI8GNb0RVUBLiCDVXtPM5IlRjDmyRh+GsgQAj0IVwOGP1pubK gwPod6VGN9Sqw5fh1md00Bkd8s2qVsTIplrOVj3my8nceD6MjjWG7wuCYe7cS5tnFA0d pFlHy4ocuAni7yaNK9jVq5trqOMaFv+//icNeqwg+3NF2QVVvFyEwQfTYz9S+vkWitSj uVZw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AzT5G/VU"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p13-20020ac8740d000000b0042e3bf2af6bsi7312891qtq.796.2024.02.27.05.35.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:35:10 -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="AzT5G/VU"; 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 1rexaF-0000hJ-2z; Tue, 27 Feb 2024 08:33:23 -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 1rexaD-0000g9-Dq for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:21 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaB-0002pl-2y for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:21 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3392b045e0aso3543412f8f.2 for ; Tue, 27 Feb 2024 05:33:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040797; x=1709645597; 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=rLfVBib6moPM6Xgbon/d2611Q9D6RHvJCoxeaZ9C+Eo=; b=AzT5G/VU/PtEfYVqA2PQNx17QTMUI233vkd6AvAODvP5lqoX6bPeGYElPz77blJInN cwf51Xt/3vIeUfJxDKO705r6NfW8G3RipwpSGFoMK/FDBs2eWFBk2kkuuT7x2ze7Aqui yshzEwmmWIJTtfOnYSVzkXE6f+d6yovE/TuVobZrptZWisPANojA6L/NLHaof5Wmz55c ypu9mITIDFLS3qscRBlQk0D7d8+9Do/HzcFoALd8vegQ5NVc7+3zKjwzTToIy+ExQJ+k OyRFcAac/Yq75xM1nmth/cpMEhf+2Km+epbaW+sc8fI/zYlvHudNU5ZiLQusx0wV58mn TwWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040797; x=1709645597; 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=rLfVBib6moPM6Xgbon/d2611Q9D6RHvJCoxeaZ9C+Eo=; b=o3kF+Tz28BibIvHRug358I8jmnxriPc0MKfdmea32909LFYDHuFAd9L0EvCWFa4ug7 /ozQEqXy7o+ed46b1GeX/BOtQ3oo3d2J3XZJNKa1J4dbdK+PNfLsZ6RTBaSbBGMPUr0o n9+7uFhRJs33RiEXhrMEGKE/6igJ4v6vlbl1BBqJ9nzTr9/DG9SgLu9g4pq8BhKrN7dv aUJ0J/L0L/dNzi2wsX5lQ9nk9vPN7Pkd5MQlqD2raZY5Qm27dvjX1ZhrmWyx/k7605kl FFnH4ffzYMufLBqQU3rFWxAfH1TwNkDo07ZIyZXD3EmtvMJ/VsU2s8DJjRAPclmuttyo kU/A== X-Gm-Message-State: AOJu0YxQKW1n2R8TkoKupAIc9PWDhH61+5E000JvUIdyqE6o1umM7OM6 eQoOiatGOGcM3PgP7la6wPJcZo3DVIm4wLnHLUy4xr6rQkiDhF1I+i7GNbeKEmDBoN6X3bVRDNa O X-Received: by 2002:a5d:6d85:0:b0:33d:da6e:b7db with SMTP id l5-20020a5d6d85000000b0033dda6eb7dbmr4149387wrs.62.1709040797355; Tue, 27 Feb 2024 05:33:17 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:17 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/45] target/arm: Advertise Cortex-A53 erratum #843419 fix via REVIDR Date: Tue, 27 Feb 2024 13:32:31 +0000 Message-Id: <20240227133314.1721857-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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: Ard Biesheuvel The Cortex-A53 r0p4 revision that QEMU emulates is affected by a CatA erratum #843419 (i.e., the most severe), which requires workarounds in the toolchain as well as the OS. Since the emulation is obviously not affected in the same way, we can indicate this via REVIDR bit #8, which on r0p4 has the meaning that no workarounds for erratum #843419 are needed. Signed-off-by: Ard Biesheuvel Reviewed-by: Richard Henderson Message-id: 20240215160202.2803452-1-ardb+git@google.com Signed-off-by: Peter Maydell --- target/arm/cpu64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 8e30a7993ea..0f7a44a28f5 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -663,7 +663,7 @@ static void aarch64_a53_initfn(Object *obj) set_feature(&cpu->env, ARM_FEATURE_PMU); cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A53; cpu->midr = 0x410fd034; - cpu->revidr = 0x00000000; + cpu->revidr = 0x00000100; cpu->reset_fpsid = 0x41034070; cpu->isar.mvfr0 = 0x10110222; cpu->isar.mvfr1 = 0x12111111; From patchwork Tue Feb 27 13:32:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776194 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp155778wro; Tue, 27 Feb 2024 05:34:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU9EN8ufygzTnkaZI8j9IJi3Xw6RpmXKvh1f4x/oD3oTTU2S87aChmcNxZGKvdLIBnGThB/qW7d1DpHWyFCEYAa X-Google-Smtp-Source: AGHT+IF7W1lAUNBldy2tFKJWDb7slvVCa9DB0pkqtqen7fiCTIwI4ggGFfpcAdM2ojjGn30OntgJ X-Received: by 2002:a1f:4985:0:b0:4c8:90e5:6792 with SMTP id w127-20020a1f4985000000b004c890e56792mr6498509vka.7.1709040867803; Tue, 27 Feb 2024 05:34:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709040867; cv=none; d=google.com; s=arc-20160816; b=awrYX60qd/6khaydKA/a8+aXuF5FiLBHGkxUlTRoxT0i86iMoMRXXmL3ZWZELpUnag 5f8qjM6r+XM4BdOL8nwoYLcXGGiKKgSRuycxfM9x/T/Z0dY8LPzH0zZkKtj+l/uy3jau vfdirpVvByQUW0ZnYJ1ZuPWhw6j6tyCs9iH++OxRj4I0F4tBHwYQ/K9tzwTOrB88dx4V JPxjDgU4lFzkVGhHPg4XwrUoTXb6BsNwDFOKRh/iAbFJ9pCLjrO6fhOzuKtFqseAwf5J yb6XJ6HV/3IR4/t5kCIRaCYS5WYKHTFGr/mtWcRHXENxp2886TbPMTvsYpRBVzXZ6l2V gbiA== 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=jgYHzr2hRg8T/6O9OXdsZJKVALA3Fedt0qDTwO0O3lA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=K071MD51nYaSyjrGEUuuOqQSUm2PGS2Fr1YbA+4qxGeCscc4yp/oLL07ql0pFPmoEq jixJTD8CJ2CS+I4lBhg4knjcLNrUiWJfY+W723n6o6FBqLseKE0qvboxmTmgT9hp6lgD DczW5hSIYxsxB1gRwmOxJptmJ/iwqJlTEWdFPazi/V1IY6eJD1cC4cT/3QPzPHJE6ylM obaBqn+ujWRv77JWT2rE9ojIPPgNNLWRHqzv4fWGCvnrs4Lxx6PsXPuXR+3jke0vRBk5 vSOzDO7r00USR2VybWfWg3FnlqoezFEY7BkB0hUcsrEmGhJVmgxrCzdoMLyb+9pJGocX rLrQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uy6Q5icn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l18-20020a05622a175200b0042e67d14d98si8030262qtk.680.2024.02.27.05.34.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:34:27 -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=uy6Q5icn; 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 1rexaH-0000is-JG; Tue, 27 Feb 2024 08:33:25 -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 1rexaF-0000hK-3d for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:23 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaD-0002pn-9h for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:22 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-33d26da3e15so2419407f8f.1 for ; Tue, 27 Feb 2024 05:33:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040798; x=1709645598; 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=jgYHzr2hRg8T/6O9OXdsZJKVALA3Fedt0qDTwO0O3lA=; b=uy6Q5icnOkbqTLJmvql6tWpz7izYpDU/XYINQG3kneaQvSt7CtpLZekUeetr7Y0DpN +t0rlj9rKGug71RAdWJIS+SJtJ8/m9A9s+RfOMzmQCFQcpCe6keyN88nuBdioHU1TpqG OvVuOwg8sLHFoWlvktOKN1act9ZfAsArzevdaiye1BVF3Vj9oIjZlUQ7WntGtQBiENOp X/mNUPLM65a5xd/10qZDlcJztPSq6qW3PCI3FPlak32aWCi0Sy/nSlUdUWB3LtMXgalj AEvP/i9ClS/bh/TcBjqw3vVBdPQym+m5M/0f0vDBUa42aehbCC/OZf+qmffRNmVbFvmN y4aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040798; x=1709645598; 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=jgYHzr2hRg8T/6O9OXdsZJKVALA3Fedt0qDTwO0O3lA=; b=TFunh/D4TDDaMkkDJy5bMWUUM1WN8mABgCeIenzHZ7LVdoDnW7IrhBezy3mxJJJYVh tEBedbAUTcEnG2102n6tOfjF7tcgDdD3ROz2JGjPizwMNiGG+3LF6mqEWPEZ5zxjAQxr SootpYNWb+Lrsy6I8OugjiHtwJznQp+8Oy4kFU2HuzndbmwbGg+M2/No/NU7Oy8dLmFe NTtuy47UFdPRWVoUwQkOp0qwbACJ0SAdAFdb1TlDOhLHvK++PyiYavwe9g4v7QCiQ8Gb hAk0krRYZmPOZTndBprr6+0+6g25IawOus1sXLfa6DXCMI/BB1Y/4F0L6KU8nbgn+uTE iKZw== X-Gm-Message-State: AOJu0YwhKL+PahUcVGy/KE86GnB8mBfuUW7GV4oOKoGhsLezhqOjHP/a XfBafM/ME/59h6SFhlbm6GJb+shiDoIYvv47tofzd3XR7lRZVR51U9ngJnlfJJC7n7iCcbCfXHs w X-Received: by 2002:a5d:5f51:0:b0:33d:9d51:9942 with SMTP id cm17-20020a5d5f51000000b0033d9d519942mr10019763wrb.17.1709040797790; Tue, 27 Feb 2024 05:33:17 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:17 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/45] MAINTAINERS: Cover hw/ide/ahci-allwinner.c with AllWinner A10 machine Date: Tue, 27 Feb 2024 13:32:32 +0000 Message-Id: <20240227133314.1721857-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.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é This code -- which was moved many times around -- was added in commit 377e214539 ("ahci: Add allwinner AHCI") and belong to the AllWinner machines. See also commit dca625768a ("arm: allwinner-a10: Add SATA"). Signed-off-by: Philippe Mathieu-Daudé Message-id: 20240215160713.80409-1-philmd@linaro.org Signed-off-by: Peter Maydell --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 992799171f4..ca97b627188 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -642,6 +642,7 @@ R: Strahinja Jankovic L: qemu-arm@nongnu.org S: Odd Fixes F: hw/*/allwinner* +F: hw/ide/ahci-allwinner.c F: include/hw/*/allwinner* F: hw/arm/cubieboard.c F: docs/system/arm/cubieboard.rst From patchwork Tue Feb 27 13:32: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: 776211 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp158438wro; Tue, 27 Feb 2024 05:40:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWnVkESHNXvDKtDVgbpYlFXkMs3Wp4WcEJDxCkTHkTmP4S6s2e54CFT2tEGHyVLoF9iHfYr1GJIwD7xTVCFsjfa X-Google-Smtp-Source: AGHT+IEIvd+CjuTDBFHyZQs/sFAC0/hu6qggCAahXnWRdXafBrzjhGDYIRS+p0qTNQVLZ+fsFQM6 X-Received: by 2002:a05:6808:1804:b0:3c1:5444:1af4 with SMTP id bh4-20020a056808180400b003c154441af4mr2431918oib.10.1709041223908; Tue, 27 Feb 2024 05:40:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041223; cv=none; d=google.com; s=arc-20160816; b=Q9onlusA1irfik2ANDdJSqeDzIIJ0QH7/xgJrIxZGEZ3J25jaWaBwSaGTcNybUuMQw iqYv+ZhbzE5eRDDYnRGO1M+UD7VUl1NsnnSr0/ulxBSIjHwadmPuPwoAy4yx0fkwVeov cOZ91z9udqfh9ZD0bBHLvRt+FHJFPJAVW371dqYZCTHu+ro9VF0IZJfawGs0VOasIgWz dudavmY3TqHzaAlqIdNkEA75lQ4ra05iIShQ/a/14v9Otydbz1+Pxed17MtM86fm9BK6 EnTLQUGHv70ayyZET82cYNGLLx3/0A+SFlzzmQJxSD0Dys5VAhpzUW5V8arIzRrDTQof gmkQ== 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=kMD34DyY/ZeshF/T8UgjYoZ3X8l62qcwB00+lmo6Dxg=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=VArAWX01CAqsbgc9LiM9B4U6SNnWkjI2PWNZ8eXpNlK560nxZGbtK/LRMQ5yrEbmnY VHSrqOE1A6AJmmj5rTqu8JXBceCNJDx2IjK3f98ajsBE5wrbWNTVCguFGWVBDQePC22N e6MhlpvO1RBPqdLzsmV26R2IeEQDLdJioqVZ16XJDneCQ7agnj+1qY3nZo7m+HVynrSA u7PH4WDQ6j+OPLWsL8HeruEoGHSgP9d3pAQvK6/NvQdMeoS6u3HYcir+YZPuH3o3WrgX 3/FO5TuOKSL+AZydJXhp6uOBlFb9Y7GHbhSTdf3I2f3AoucIbKzxqiQEd/yKUoTl66Zj I24g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W7wBwB57; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j9-20020ac85c49000000b0042e5c55d702si8158275qtj.31.2024.02.27.05.40.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:40:23 -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=W7wBwB57; 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 1rexaU-0000mR-3y; Tue, 27 Feb 2024 08:33:39 -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 1rexaG-0000iR-Uc for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:25 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaB-0002ps-I3 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:24 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-33ddebaf810so959238f8f.2 for ; Tue, 27 Feb 2024 05:33:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040798; x=1709645598; 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=kMD34DyY/ZeshF/T8UgjYoZ3X8l62qcwB00+lmo6Dxg=; b=W7wBwB57cKwhUnYBCPkkBhW+n6NlCVzuyctRhBlYKsaOUw4QVLVIN5TzSl5ij8pZtF EYosPDW4kmVZooqShY1ac7tuA0ynqrLPFQSLZ/rvOh863OtIbeCGjhBZFP0Af6WT8PvK iWe0gwNZtlP9Cw3JIvWbvG9irL0awaqtm1G1z8C0Z/5XtkfFRKNUy6pfsFoAZZbfaPiA 6gaV2rDws0HNMilvB2TQmZENDEyd4/h7aEiMFqqO2Y9K8IA5mGHIbS7/ey7LkhyvaAlB fr5Lv2xb/ZEX/+xjfN/8+Fq2y8p87HXlPFopWP/wvN8FqSSBbPrZnOV0KL9fpAiFbrSe ucTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040798; x=1709645598; 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=kMD34DyY/ZeshF/T8UgjYoZ3X8l62qcwB00+lmo6Dxg=; b=T7dZQWEIt6/WgfNDk9WkF38wAAKE8Blg6wHSn66sUmNL+gzc6A3kutXWIjPsk9d9SM pwuxA7HtedvA3ROaWF8+kl3V6tFi1IeMwbNCEssSzkRfSYfpjTdpXOC8T+6FN5gOFpVU knun/iNJIth2pOlPpiT4d5AtS93zk0uHF91rzufQiINYMbkMSPHbqljJgpUtwWBfeAgg SZPmW18NtAoKqw/lHzbgCGqGsMjG4PH+hHfKaEGtPTHEKumD/jqXb1HBQfc2MMCWsXgB ovyPbVnt6lnTnU7B5oNcy9QaawdQzUL9PUIMbcOcSO9tBQyZP5NSNG/0qYGaE8O1Keqj mObg== X-Gm-Message-State: AOJu0Yy3f1SYEMdrkAGfJvdBjwc4TSD8aQK+sB3Ne8m/LTtIs5fQJR+B MJGRlxxLpp/DfZnY1PYlWgHgiCbXWr0pYcrr+mhMFrrJvsCR4tcaUtKMTmpVsW3brD0a5SrxNhn e X-Received: by 2002:a5d:658b:0:b0:33d:2848:79b6 with SMTP id q11-20020a5d658b000000b0033d284879b6mr7204218wru.45.1709040798218; Tue, 27 Feb 2024 05:33:18 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:18 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/45] misc: m48t59: replace qemu_system_reset_request() call with watchdog_perform_action() Date: Tue, 27 Feb 2024 13:32:33 +0000 Message-Id: <20240227133314.1721857-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_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: Abhiram Tilak A few watchdog devices use qemu_system_reset_request(). This is not ideal since behaviour of watchdog-expiry can't be changed by QMP using `watchdog_action`. As stated in BiteSizedTasks wiki page, instead of using qemu_system_reset_request() to reset when a watchdog timer expires, let watchdog_perform_action() decide what to do. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2124 Signed-off-by: Abhiram Tilak Message-id: 20240216192612.30838-4-atp.exp@gmail.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/rtc/m48t59.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/rtc/m48t59.c b/hw/rtc/m48t59.c index aa44c4b20c4..1585a2d3997 100644 --- a/hw/rtc/m48t59.c +++ b/hw/rtc/m48t59.c @@ -36,6 +36,7 @@ #include "qemu/bcd.h" #include "qemu/module.h" #include "trace.h" +#include "sysemu/watchdog.h" #include "m48t59-internal.h" #include "migration/vmstate.h" @@ -163,8 +164,7 @@ static void watchdog_cb (void *opaque) if (NVRAM->buffer[0x1FF7] & 0x80) { NVRAM->buffer[0x1FF7] = 0x00; NVRAM->buffer[0x1FFC] &= ~0x40; - /* May it be a hw CPU Reset instead ? */ - qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); + watchdog_perform_action(); } else { qemu_set_irq(NVRAM->IRQ, 1); qemu_set_irq(NVRAM->IRQ, 0); From patchwork Tue Feb 27 13:32: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: 776232 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp160881wro; Tue, 27 Feb 2024 05:46:17 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVn76BaQ8jqWj/Sq8Ea6Ubo9SAkB6EpKJLDIvijo45QBj/pNT/MY+WKYn3rWGyt+nalA1JApJAs9pqChtgsmQoZ X-Google-Smtp-Source: AGHT+IEtjy8c5l78cpTpukQNeNENaSAyMT2T3p+li55CEsZ3ogrA4P06id/JexKo1h1u9lF/YLiJ X-Received: by 2002:adf:eb4f:0:b0:33d:ca5d:e082 with SMTP id u15-20020adfeb4f000000b0033dca5de082mr5300267wrn.35.1709041577511; Tue, 27 Feb 2024 05:46:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041577; cv=none; d=google.com; s=arc-20160816; b=TC0WPIvwEkkuR429bXnm+Lpf1/fT7t+4VImK/SeWdRiZHRLJplD7k8JO7xiC2uVn5u YfFsjLgjhRXS9zOT3OwaxEH+FL2SvIiOnKlIET9gTcFhszYCYHml5hp8VnZbe07CUQ5p hnl87qJG8QOc2uXcyDWbjexa24F5fDZdBRGbR0lkjcuqLdz+/YDblZsyHy/DBLQJ0TSd abt5zYEKzgjfP8F+7Sn2+ya6Z20vIUPbkzN4q1JFLvM/ZzFJrW7C9caHPaV4nPdk/zqo XyqMRU+pXVev9xQ0d8qTnDLFuGLA2BnuS0Ltrip9l+TTlF2qzg5nZIGG5bzWViYaB1xd Lc0w== 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=PUYripAJz/Vt0PNsUQO402Dv2ocPrItdLSWvRd1GdNE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=tVAW5/i9E15/0+4xEqJSE/AN5qh4F+GMqjEjITtsYTerJfqIEuB6tFOpXJwOR19Ujw FYmQtBXOloZ17W8bwGRUP6t85jUwSuXkvex76k4zYYbQ7bfJA1W9ALNFIIGZ+evUyQBP EB+CG+Px07eYAcXuBpW5zgxYLDly3tDEBGljHIv1C5wg+S1PYgiOqakbEa6EOh74hxNA OX5xBJ/Frf/gd67yWRB5b1+R4YNQaSLiQfhABljVJRM1rv7OHnBZyexdiEGJFeOKhPsS aaRXr7NrXgsSeWHf1zER6IO3X+zHJfw+NyW9ooqmn2zwStmzwFlAT/AFlM12uczGzWnP 1lbA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cwGCi443; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bf3-20020a0560001cc300b0033b7b5a78cbsi3867661wrb.925.2024.02.27.05.46.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:46:17 -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=cwGCi443; 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 1rexax-00015N-Ff; Tue, 27 Feb 2024 08:34:07 -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 1rexaG-0000hv-CN for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:24 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaE-0002py-5F for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:24 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-33d18931a94so3296056f8f.1 for ; Tue, 27 Feb 2024 05:33:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040798; x=1709645598; 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=PUYripAJz/Vt0PNsUQO402Dv2ocPrItdLSWvRd1GdNE=; b=cwGCi443ily7XVIVWp59KAq7nRcAzmQM+FccY0XWArin7gBExrRdBFPpILhY/w2wbe VV09vcppShog/HGQ+EXVaemyYprhK2zHvCMwqsTNtP3cOwyj+G3iyGynvyHQZwmCfMxN kssTdPKDF0qoUh0aOpIdUk/TEOEF3PJOpcM9+qR56qUouZJWWxQI3Lp9bD5uQr1IbN21 r1sN1Amxa84gb8tQD8a5w5fNVj9dKuayL5PIegi5HHbJAbc/ahGh8JRunekrSZe3GN6Y WALq/AM/Ch98/xbnFWI6+or6S59B19kXoayuY0jYosYmPe3sWk19SCLG9wcPF//oOtWf BCGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040798; x=1709645598; 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=PUYripAJz/Vt0PNsUQO402Dv2ocPrItdLSWvRd1GdNE=; b=oKMDklf1nkfjEmNVit25xkTQ+mm2ZVNdgIvrOENjiEiwkQHNxeNjcS4RFCQv4ROxqG Xot8CS1YH/DxIsWqd88FMz1PVc66HwqC0SOScQ8GYCzoBPmJPJ5BXDAvJy1A0GAbIiCr 8hij5gb1NiYNHj3RqH71Bv/o+Ofqcu+QZGfl5pSMlWNNJuvd61JWO0+oyTEp6WxrmGys F3XcC4Zg9cBtZnZ43Qvnqb5nkgfmbvqcY6S2wW9ihR3iCJVpcY1/WGyyOB4sCFAR/pM5 eSYTSiLrordvF+HLtR/yyT3LEZrO4RO3C97IO5V7D2IJf5Um4qaLN0VIO5oorlyZTe1v urZg== X-Gm-Message-State: AOJu0YzdmByJFkz8qimY5urp5vzv3RI5smeNGCMpzcnPivSl9aBtwj1B /Vn1kLxLdEgjoCx6x3vGHqFglQ1R+AWBsIDNER/lvC0CmDDb2y3CacorQ8n77CeWpMF9Q8BwpxA + X-Received: by 2002:adf:efc5:0:b0:33d:746b:f377 with SMTP id i5-20020adfefc5000000b0033d746bf377mr6914174wrp.45.1709040798714; Tue, 27 Feb 2024 05:33:18 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:18 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/45] misc: pxa2xx_timer: replace qemu_system_reset_request() call with watchdog_perform_action() Date: Tue, 27 Feb 2024 13:32:34 +0000 Message-Id: <20240227133314.1721857-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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: Abhiram Tilak A few watchdog devices use qemu_system_reset_request(). This is not ideal since behaviour of watchdog-expiry can't be changed by QMP using `watchdog_action`. As stated in BiteSizedTasks wiki page, instead of using qemu_system_reset_request() to reset when a watchdog timer expires, let watchdog_perform_action() decide what to do. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2124 Signed-off-by: Abhiram Tilak Message-id: 20240216192612.30838-5-atp.exp@gmail.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/timer/pxa2xx_timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/timer/pxa2xx_timer.c b/hw/timer/pxa2xx_timer.c index 6a7d5551f43..6479ab1a8b3 100644 --- a/hw/timer/pxa2xx_timer.c +++ b/hw/timer/pxa2xx_timer.c @@ -18,6 +18,7 @@ #include "qemu/log.h" #include "qemu/module.h" #include "qom/object.h" +#include "sysemu/watchdog.h" #define OSMR0 0x00 #define OSMR1 0x04 @@ -417,7 +418,7 @@ static void pxa2xx_timer_tick(void *opaque) if (t->num == 3) if (i->reset3 & 1) { i->reset3 = 0; - qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); + watchdog_perform_action(); } } From patchwork Tue Feb 27 13:32: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: 776208 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp157940wro; Tue, 27 Feb 2024 05:39:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX1mZ1KvqU8llPiQjdQr/qOqMIbsl1fXE9uTxK9MHw97c5z8VyV/c5Q6U58VBdod6a7PjF2rwQWvkeukA1zF5TL X-Google-Smtp-Source: AGHT+IG7Lvo2QE8J7SvnV7IoyWE3t8cLpqsXeGZHxQOoJf/a25jsQVXHknVYAsFOjhzH2PKrfsl4 X-Received: by 2002:a05:6358:10b:b0:17b:78f1:b4ea with SMTP id f11-20020a056358010b00b0017b78f1b4eamr13667114rwa.28.1709041157782; Tue, 27 Feb 2024 05:39:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041157; cv=none; d=google.com; s=arc-20160816; b=GGOkpbxnU8YtJ0GDpX44y7E6qRLDWI5rqF4eFTOI6aUzq8xMk026iPMalZFhX6SLe9 3ZFgCHVwlksg1MQ7uz8OvffFjMNhRZgRWTEbC6g8EyP/GwrTgRD93+8mufUJBmyKsU3V nuLlQR4W2KIk3f6KBsLuUPN3Bxdrm3cSvgITg+CJ22bB9n/Peyvha1ZOX1YNG+czZNpW tQSIpwDYmuOavGQXF61FXB/TDL8vy587pxKxSD01PCb/IJupG8ZHEFKF02OBJy/mVlK8 gMO2Ofbi5yJi2K1pzghvOYZ1JFHPxUhdmUUtLWSrIIz/Rb+OW9/dDqx9S/gHR7Lv4ALg UBvg== 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=9IFvga9TEIpbS3l7g132YG09cqdoQ9m/RM6KmiHkvO0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=GkHhGxKahlypDbZljymqzWs4qTuZeNQEs4MH4q2MEEhyOtR0i58Q7vUKBDZrjGgJoL M7JSjRyw7LsQ0MMgsazchB/EfyaV6+Wbb+/GKLtevm3dSl4/q6zL52f8apB/GLR9ZIfd zIeE6RkWQZSkgETnxHrP5DnjeJ4jvVaqnoo1qB5q+DjVwx2SLgQaP035xUziuHcSJxty ZLuayfauUq7Y3vADKsniv/8rhHkFoALHoVHx6p3daP46Em7UZFmI4APMEx77VSdmCRSI RmemWb/a5SRLBkGo9WYlipIlBVeB4EPBaq5kUyxSM/YiFw6DvVTlBcurzsvN76XIQn6Q IIDA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OFVaL6AP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fq14-20020a056214258e00b0068fb8232dc1si7610365qvb.519.2024.02.27.05.39.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:39:17 -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=OFVaL6AP; 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 1rexaU-0000mQ-3X; Tue, 27 Feb 2024 08:33:39 -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 1rexaD-0000gL-W5 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:22 -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 1rexaC-0002q2-E9 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:21 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4129e8bc6c8so23956285e9.2 for ; Tue, 27 Feb 2024 05:33:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040799; x=1709645599; 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=9IFvga9TEIpbS3l7g132YG09cqdoQ9m/RM6KmiHkvO0=; b=OFVaL6APoHlGUG5oqHrhrlKGAWH4UuKAVs7Y58nRs5jEV4rIFYCjpvb1n6Ry1zF6F8 l306yvAAP6aQI8EGBkiZsAiUlRMFKJg+o7jwMyr2eZ3QbL+NiZSJ0pEfHrlH3E5lP3pA 4n/h9ytTGUPdwp43ntB4qYi9lywEiExEjSwE9nAUKUSFx036ST1xo6TdJQ6bR7MG4PNx fgp0MZdCyOvxJnqLSUDm3FY0HvmZWuYOklOPSo2mc/Mn2cvsCNrpAoXYhWLe5lLGJySm +57UCrwciySfynlqJnbA5gI+dj/98Bim4cFpqJ/WzHn9JN2mhdEapL4aFaLg6Yp11TDn FcuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040799; x=1709645599; 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=9IFvga9TEIpbS3l7g132YG09cqdoQ9m/RM6KmiHkvO0=; b=ryH02KfHF1uPx0kyV+jrPYnXgBMmduZnCgwrW/kyS2EKhln4ku6FywfSy+AQW9nXwP ygNT6MLSpUT08DOqDkvzmjNUs8gQsmLtj58UoSh7R5jycPizqYMHi1T4iiZOmae/+maf 2FPIiFipVltwAn5JKpzJ//1hVU7gs03u6FwC6T8qZynRDQdkSX0QCKTS3sNSywCVq8od IaqRn1BtakyE65vKrmTL58M0ijEIaNdTPCi7ieLi/6S1rGjdWKb2Fw5JJBNPIzyU7HIX yX4KzWSziYTN5j0qFUOGiQvdpNtDNOVhV27O8NKKSh3MonNfBhtbLloNfD6tAjdLTUSb GW8A== X-Gm-Message-State: AOJu0Yw0NUOVVl4IhYDwK/hRNaqIeiNrK5KHphptfo99EQqOPI/ijyqA Cp4XwRRDBf3kG+/Jbygmc7MmFn3YlxyAsv1LAr/y6AnOE4wYFkrYvdHXo9igYjQTgFILrodObG/ D X-Received: by 2002:a5d:6d85:0:b0:33d:e174:2232 with SMTP id l5-20020a5d6d85000000b0033de1742232mr4022367wrs.6.1709040799121; Tue, 27 Feb 2024 05:33:19 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:18 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/45] xlnx-versal-ospi: disable reentrancy detection for iomem_dac Date: Tue, 27 Feb 2024 13:32:35 +0000 Message-Id: <20240227133314.1721857-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-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: Sai Pavan Boddu The OSPI DMA reads flash data through the OSPI linear address space (the iomem_dac region), because of this the reentrancy guard introduced in commit a2e1753b ("memory: prevent dma-reentracy issues") is disabled for the memory region. Signed-off-by: Sai Pavan Boddu Message-id: 20240219105637.65052-1-sai.pavan.boddu@amd.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/ssi/xlnx-versal-ospi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/ssi/xlnx-versal-ospi.c b/hw/ssi/xlnx-versal-ospi.c index c7b95b1f377..c479138ec1c 100644 --- a/hw/ssi/xlnx-versal-ospi.c +++ b/hw/ssi/xlnx-versal-ospi.c @@ -1772,6 +1772,12 @@ static void xlnx_versal_ospi_init(Object *obj) memory_region_init_io(&s->iomem_dac, obj, &ospi_dac_ops, s, TYPE_XILINX_VERSAL_OSPI "-dac", 0x20000000); sysbus_init_mmio(sbd, &s->iomem_dac); + /* + * The OSPI DMA reads flash data through the OSPI linear address space (the + * iomem_dac region), because of this the reentrancy guard needs to be + * disabled. + */ + s->iomem_dac.disable_reentrancy_guard = true; sysbus_init_irq(sbd, &s->irq); From patchwork Tue Feb 27 13:32:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776230 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp160695wro; Tue, 27 Feb 2024 05:45:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXTXStz+nwv0nZSO/cWu3nFj3JJTPGXt4iz3UsMcMY62Vzegl4EPBp/OxWL7mSvSEJGl12hpSaBfB4DvH0Db06d X-Google-Smtp-Source: AGHT+IFQ6xxQg4H5DndxFMXPO6DZ9WaSwRDYtwVMU9Eb1fhFkiLqO/TCKhtRqq9Fe3jeRxb7dBjv X-Received: by 2002:a1f:4843:0:b0:4cb:2662:3656 with SMTP id v64-20020a1f4843000000b004cb26623656mr5732260vka.0.1709041554078; Tue, 27 Feb 2024 05:45:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041554; cv=none; d=google.com; s=arc-20160816; b=J+U+XGf9unNpmP54h442oSrZDLH9g/DkABG6NaEZgRyVOXcOt+t/H07SCes0joS8zy xYwmlQvbspSWfohHO11VxBOIkNMVgeZlMjfM+KTENHg7cU4pmmJ7PEaFOz6nmbtRkIY1 7XIOjs4/cf9HJAweAO6vnG00fmOHXD5Wk6qiIZyad0zRtYdFn1WIGZKEZLNKaP0h1+CQ uAoQGYV36uqklGco0tBdQ5BbqC/ultAaSEexB0QfKjwo58NrhAiswIq7NbTp7yWgNTgA +JGVhHVeMYYwPR6ek0uf9HFKWty86SqGpGsoJ3ala69y3GmzONXsdXRmYytu+lCmi1zb h3jQ== 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=HUk8DGkkhSQV5DGWlGNjwA127IMsouq73vscyBxur68=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=hrCHDYVxKPiyUO0MGpXJGSj8+f/rm8y96PRQ1F82oXAaeFjW+uL2httESlUvnBfaXO Q4q4YQYaKE5vSlmtK/WuZxFUXVyJijFUjpHeaL7a0xQyMfXUIlGi6Btow710CiXnXCA2 8QQFnBpu/RRkoei5vRjBaxDsGu3k0m37pTbHtV6SmUXSrVfcxszF0SLHONDlI60wPTRc TJ6mIRLFXFjAUKDXa9SVZLVYhmlwFv9sS3kIg4g5bMhNyoA9zVkP36Keb7zJywIl1Fv3 9aELaEqj9QK3EKG+tX0gjJa9BaD76e8EJ42wFrSGOfP07NGWmpUDulJrPfFJOgJbolGJ KEAw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GfVPf8nZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z15-20020a056122148f00b004c06c066267si788065vkp.27.2024.02.27.05.45.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:45: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=GfVPf8nZ; 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 1rexau-00013G-Ds; Tue, 27 Feb 2024 08:34: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 1rexaF-0000hM-5N for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:23 -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 1rexaD-0002q5-5b for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:22 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4129e8bc6c8so23956395e9.2 for ; Tue, 27 Feb 2024 05:33:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040799; x=1709645599; 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=HUk8DGkkhSQV5DGWlGNjwA127IMsouq73vscyBxur68=; b=GfVPf8nZYAU2zYCoYZOCblCweK7y+fVEhCFDXgomSYrt3w5yyxBDpb2hoh0QM9MOlj kw+5uYY+pJ9+hlXMfRLP1ttNZ2G9SDSvYfUYx1AtfpkHP0vL1W1ztpV1Rt1njTtd/RUX rtA4swz0JLgESCE0SWV/1yZQyypTSJaMJy1j+1B6eKJw+iHa5eWLqHIWjdl+QGi99sGh em8nIQ+qMPJ/ygJ8ozp8ySVO/AC4L93o68hpWMm7rPAXLwXF8l8cUkR/rNk6zNQYNT2a Bevuna6LN48+wAIe1gEaFhyFJ3IWZSjgk4hQLRTfXfyacrTHmZ20EYTyi3zrvgHvrLF8 Ma4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040799; x=1709645599; 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=HUk8DGkkhSQV5DGWlGNjwA127IMsouq73vscyBxur68=; b=OjTQAucsGoY2uaoZHQZdGxa68ng5kCewMm6TsxBFBtzbzw1ZDZJdWphWhXKIVlONUd gfW8remvgxMhv6eTuDLhtiP5o0uoYs3jYiilelChv2KqUa+FYLFKU7QsGIGDn7sTL8G4 a1epjO4MkBLGqWJOB98KheFiJtxrg84goKXpGtNyfM9dWvREzCCk+5l9RKrhrebBVu+J UU2U7/SkvJhnLo3uQ7qsaZt/VBcP5+xe6JCJ3A/EpTUZaclpe+dCsudlZbCm/cxdSntk 9TwW8ctqAGvg0HnoShmRgIO12ISVveefxJS82Re2aisusk0EPT6It1/eUAqmK/p6F6zc pvZw== X-Gm-Message-State: AOJu0Ywvz0bkbg4mDAzu4K92SESWtjQc6TJEPMAPjbQUzIhE6MtPlgSg RWxHft/7PCrG6jia1FfGnkfTw7LcEUC293B7vKpLWP/aogmWT+j8AZzbgq4wi6pTvXy0sX4eTAI S X-Received: by 2002:adf:f486:0:b0:33d:3089:a840 with SMTP id l6-20020adff486000000b0033d3089a840mr7042643wro.49.1709040799527; Tue, 27 Feb 2024 05:33:19 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:19 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/45] hw/arm: Use TYPE_OR_IRQ when connecting STM32L4x5 EXTI fan-in IRQs Date: Tue, 27 Feb 2024 13:32:36 +0000 Message-Id: <20240227133314.1721857-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-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: Inès Varhol Fixes: 52671f69f7a4 ("[PATCH v8 0/3] Add device STM32L4x5 EXTI") Signed-off-by: Inès Varhol Message-id: 20240220184145.106107-2-ines.varhol@telecom-paris.fr Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Peter Maydell --- include/hw/arm/stm32l4x5_soc.h | 4 ++ hw/arm/stm32l4x5_soc.c | 80 +++++++++++++++++++++++++++++----- 2 files changed, 74 insertions(+), 10 deletions(-) diff --git a/include/hw/arm/stm32l4x5_soc.h b/include/hw/arm/stm32l4x5_soc.h index baf70410b5f..4f314b7a933 100644 --- a/include/hw/arm/stm32l4x5_soc.h +++ b/include/hw/arm/stm32l4x5_soc.h @@ -26,6 +26,7 @@ #include "exec/memory.h" #include "hw/arm/armv7m.h" +#include "hw/or-irq.h" #include "hw/misc/stm32l4x5_syscfg.h" #include "hw/misc/stm32l4x5_exti.h" #include "qom/object.h" @@ -36,12 +37,15 @@ #define TYPE_STM32L4X5XG_SOC "stm32l4x5xg-soc" OBJECT_DECLARE_TYPE(Stm32l4x5SocState, Stm32l4x5SocClass, STM32L4X5_SOC) +#define NUM_EXTI_OR_GATES 4 + struct Stm32l4x5SocState { SysBusDevice parent_obj; ARMv7MState armv7m; Stm32l4x5ExtiState exti; + OrIRQState exti_or_gates[NUM_EXTI_OR_GATES]; Stm32l4x5SyscfgState syscfg; MemoryRegion sram1; diff --git a/hw/arm/stm32l4x5_soc.c b/hw/arm/stm32l4x5_soc.c index f470ff74ec7..d1786e0da1c 100644 --- a/hw/arm/stm32l4x5_soc.c +++ b/hw/arm/stm32l4x5_soc.c @@ -26,6 +26,7 @@ #include "qapi/error.h" #include "exec/address-spaces.h" #include "sysemu/sysemu.h" +#include "hw/or-irq.h" #include "hw/arm/stm32l4x5_soc.h" #include "hw/qdev-clock.h" #include "hw/misc/unimp.h" @@ -42,21 +43,24 @@ #define NUM_EXTI_IRQ 40 /* Match exti line connections with their CPU IRQ number */ /* See Vector Table (Reference Manual p.396) */ +/* + * Some IRQs are connected to the same CPU IRQ (denoted by -1) + * and require an intermediary OR gate to function correctly. + */ static const int exti_irq[NUM_EXTI_IRQ] = { 6, /* GPIO[0] */ 7, /* GPIO[1] */ 8, /* GPIO[2] */ 9, /* GPIO[3] */ 10, /* GPIO[4] */ - 23, 23, 23, 23, 23, /* GPIO[5..9] */ - 40, 40, 40, 40, 40, 40, /* GPIO[10..15] */ - 1, /* PVD */ + -1, -1, -1, -1, -1, /* GPIO[5..9] OR gate 23 */ + -1, -1, -1, -1, -1, -1, /* GPIO[10..15] OR gate 40 */ + -1, /* PVD OR gate 1 */ 67, /* OTG_FS_WKUP, Direct */ 41, /* RTC_ALARM */ 2, /* RTC_TAMP_STAMP2/CSS_LSE */ 3, /* RTC wakeup timer */ - 63, /* COMP1 */ - 63, /* COMP2 */ + -1, -1, /* COMP[1..2] OR gate 63 */ 31, /* I2C1 wakeup, Direct */ 33, /* I2C2 wakeup, Direct */ 72, /* I2C3 wakeup, Direct */ @@ -69,18 +73,39 @@ static const int exti_irq[NUM_EXTI_IRQ] = { 65, /* LPTIM1, Direct */ 66, /* LPTIM2, Direct */ 76, /* SWPMI1 wakeup, Direct */ - 1, /* PVM1 wakeup */ - 1, /* PVM2 wakeup */ - 1, /* PVM3 wakeup */ - 1, /* PVM4 wakeup */ + -1, -1, -1, -1, /* PVM[1..4] OR gate 1 */ 78 /* LCD wakeup, Direct */ }; +static const int exti_or_gates_out[NUM_EXTI_OR_GATES] = { + 23, 40, 63, 1, +}; + +static const int exti_or_gates_num_lines_in[NUM_EXTI_OR_GATES] = { + 5, 6, 2, 5, +}; + +/* 3 OR gates with consecutive inputs */ +#define NUM_EXTI_SIMPLE_OR_GATES 3 +static const int exti_or_gates_first_line_in[NUM_EXTI_SIMPLE_OR_GATES] = { + 5, 10, 21, +}; + +/* 1 OR gate with non-consecutive inputs */ +#define EXTI_OR_GATE1_NUM_LINES_IN 5 +static const int exti_or_gate1_lines_in[EXTI_OR_GATE1_NUM_LINES_IN] = { + 16, 35, 36, 37, 38, +}; + static void stm32l4x5_soc_initfn(Object *obj) { Stm32l4x5SocState *s = STM32L4X5_SOC(obj); object_initialize_child(obj, "exti", &s->exti, TYPE_STM32L4X5_EXTI); + for (unsigned i = 0; i < NUM_EXTI_OR_GATES; i++) { + object_initialize_child(obj, "exti_or_gates[*]", &s->exti_or_gates[i], + TYPE_OR_IRQ); + } object_initialize_child(obj, "syscfg", &s->syscfg, TYPE_STM32L4X5_SYSCFG); s->sysclk = qdev_init_clock_in(DEVICE(s), "sysclk", NULL, NULL, 0); @@ -175,8 +200,43 @@ static void stm32l4x5_soc_realize(DeviceState *dev_soc, Error **errp) return; } sysbus_mmio_map(busdev, 0, EXTI_ADDR); + + /* IRQs with fan-in that require an OR gate */ + for (unsigned i = 0; i < NUM_EXTI_OR_GATES; i++) { + if (!object_property_set_int(OBJECT(&s->exti_or_gates[i]), "num-lines", + exti_or_gates_num_lines_in[i], errp)) { + return; + } + if (!qdev_realize(DEVICE(&s->exti_or_gates[i]), NULL, errp)) { + return; + } + + qdev_connect_gpio_out(DEVICE(&s->exti_or_gates[i]), 0, + qdev_get_gpio_in(armv7m, exti_or_gates_out[i])); + + if (i < NUM_EXTI_SIMPLE_OR_GATES) { + /* consecutive inputs for OR gates 23, 40, 63 */ + for (unsigned j = 0; j < exti_or_gates_num_lines_in[i]; j++) { + sysbus_connect_irq(SYS_BUS_DEVICE(&s->exti), + exti_or_gates_first_line_in[i] + j, + qdev_get_gpio_in(DEVICE(&s->exti_or_gates[i]), j)); + } + } else { + /* non-consecutive inputs for OR gate 1 */ + for (unsigned j = 0; j < EXTI_OR_GATE1_NUM_LINES_IN; j++) { + sysbus_connect_irq(SYS_BUS_DEVICE(&s->exti), + exti_or_gate1_lines_in[j], + qdev_get_gpio_in(DEVICE(&s->exti_or_gates[i]), j)); + } + } + } + + /* IRQs that don't require fan-in */ for (unsigned i = 0; i < NUM_EXTI_IRQ; i++) { - sysbus_connect_irq(busdev, i, qdev_get_gpio_in(armv7m, exti_irq[i])); + if (exti_irq[i] != -1) { + sysbus_connect_irq(busdev, i, + qdev_get_gpio_in(armv7m, exti_irq[i])); + } } for (unsigned i = 0; i < 16; i++) { From patchwork Tue Feb 27 13:32:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776192 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp155567wro; Tue, 27 Feb 2024 05:34:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVWZLorFKwwSV8TL2q0sNJmKDik4UNsCv2SQiayioc5xizjDFsxwJeJiCYklBV0ukx9HaBq9JrJgcLEnaEzFQJL X-Google-Smtp-Source: AGHT+IEHjRBs/cWs73AOOYeSENa6wVtb2r1fcu+WtfqZZHPTa4TxEQlnUQOsVuis1iDHTYLAZQ07 X-Received: by 2002:a05:6214:5298:b0:68f:9ce7:e6a with SMTP id kj24-20020a056214529800b0068f9ce70e6amr2162598qvb.57.1709040841204; Tue, 27 Feb 2024 05:34:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709040841; cv=none; d=google.com; s=arc-20160816; b=usYH6osprlHRnTApElK5JwLLS8S/Fkzp79JzZAtbSLgRTu7bGrntXnpfJ/HnEAMXNs uzmt4ygDmIafouCn0ZyD3p/cdMis1O9X00PSjhFA5yO/9I7eRbTH3PKCBEkYYmBg/ai7 0fMhaavum15COwbW/zvhZ/MgCTnEQAQ7S1mnt2YmhQKVCvyW8XAuKg58drxRWGFLU7T/ IrJYs3O7YULKObWyDgQ50GOfV1jjUn4GE1nqiuk6OzNU1RvL18pd6gRnpAuF4ZMlOQnH /H1losYnwuCxUgEIJXYNu2j4oOfWKpbCgaOVyM5KtEEINLuO/f0qP23g5H6XPDz608K5 NCyw== 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=oFeKXeW31Su0U94AYEZ3ImMqkHFM46i1mg2K/MGn0p4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ohso+uvH5rQu7oXds3c79S53HtlZt+uDLXKQU3y1JnuWsFgw0OKM+OB2Y2ICRYipPx BU35zWzmSmxnWlUKlU0TOTV8KHM9ECEMHMqYjP7Xhyn9bw9yd0JCXrgH3nF7n5G630pG 7EVeDLXFxcD6COnuC13YTnOQzBuSUi9oHICNEEyXykA+8da20QoWTyO8yzXMzfI73x4y tr6To3kC+b/yafvAsj6xU5s6asyZtpKSu2/0b3JRVxfDHZE3UBVljp75KX79ZciChAn1 3DIjZmGIBDHqqY5Hi/fySqLoxfNeoVDCNLARU81/C+d99Kvub+QaJ2Xn+Vvc8su/+j68 17JA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IKo9Xfbq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 3-20020a05621420a300b0068fd5b2888fsi7341000qvd.543.2024.02.27.05.34.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:34: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=IKo9Xfbq; 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 1rexaI-0000jS-HO; Tue, 27 Feb 2024 08:33:26 -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 1rexaF-0000hS-9B for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:23 -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 1rexaD-0002qH-IX for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:23 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-41241f64c6bso33249095e9.0 for ; Tue, 27 Feb 2024 05:33:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040800; x=1709645600; 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=oFeKXeW31Su0U94AYEZ3ImMqkHFM46i1mg2K/MGn0p4=; b=IKo9Xfbqd6xBBFW2ES10/te3r9MPNLAbDh64E/nD/EynTB9XPfFf4ot4hIFV9AQ7Pi z44GH8oIF5A2/A0Thjl2Zh+eULztx5uSocmwO2UqQ/nfw7X9w2RwzuYuLWm0EcjksCf6 lGxxGf2Raz3EjE4QIkeaOS1x488N8A/zCKRQCQcImnOizMhnhCAI3zHU4jQDN7yYx95u W7Fl922jPHtH4nkmsWoOYqkkeWwJUz4aNZ9LRCYb5jV03FwDr2YrEpMmtl4mb65qlKIv ota1QrDVzf1brLxDO4hyhNb/3LHAvBqp+1i/y/mzdsEyhmRKKO9cPgGKYFunMWEvt9ZB /c8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040800; x=1709645600; 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=oFeKXeW31Su0U94AYEZ3ImMqkHFM46i1mg2K/MGn0p4=; b=jAHOJQU/qy0bUAS0g9LFTn8Ac4UrBUCnFF873GLtw7IA6iLwL9lKUrDnoGgKh4TjeA 9DLUWjhDszca0Bdh7vgA61Iojq7re+AuRfSM8Da+/X97pfzB3ns4DAZ1YPgWVo9rMfYB ukup7RPnD9YzVebOWcX6PH4oOC28F6BcErLijikpFr9IpALxHMPtALN9QAKHyPB8EZlM CyJ+FMiIkU9v4n72JUtrn3YFPOlKK6jf0SViSSRv9CuYj4HZCzrFZcLon/9LBOSJx2al AIx5D7c6pY5y8igE5vTB105/m50cAcQtLSJZKCogZ7ALDXLDXKkJl7EV+LoNzAnT9x4M Es1g== X-Gm-Message-State: AOJu0YxvSr7N93i9ldw3Wvy4x4L5XWc/ALbdoTk/3XFEXI8Q0N/efy6z 5QwJUkBJrVSk3XzfrdoAHjx3tSZ0otJc82LhJ5PttLVglLbxbIcCjAqGp+Ducd3sCePt9mouPOv 6 X-Received: by 2002:adf:f3c4:0:b0:33d:5a6f:a856 with SMTP id g4-20020adff3c4000000b0033d5a6fa856mr7517558wrp.30.1709040799974; Tue, 27 Feb 2024 05:33:19 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:19 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/45] tests/qtest: Check that EXTI fan-in irqs are correctly connected Date: Tue, 27 Feb 2024 13:32:37 +0000 Message-Id: <20240227133314.1721857-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-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: Inès Varhol This commit adds a QTest that verifies each input line of a specific EXTI OR gate can influence the output line. Signed-off-by: Inès Varhol Reviewed-by: Peter Maydell Message-id: 20240220184145.106107-3-ines.varhol@telecom-paris.fr Signed-off-by: Peter Maydell --- tests/qtest/stm32l4x5_exti-test.c | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/qtest/stm32l4x5_exti-test.c b/tests/qtest/stm32l4x5_exti-test.c index c3900777139..81830be8aea 100644 --- a/tests/qtest/stm32l4x5_exti-test.c +++ b/tests/qtest/stm32l4x5_exti-test.c @@ -31,6 +31,7 @@ #define EXTI0_IRQ 6 #define EXTI1_IRQ 7 +#define EXTI5_9_IRQ 23 #define EXTI35_IRQ 1 static void enable_nvic_irq(unsigned int n) @@ -499,6 +500,40 @@ static void test_interrupt(void) g_assert_false(check_nvic_pending(EXTI1_IRQ)); } +static void test_orred_interrupts(void) +{ + /* + * For lines EXTI5..9 (fanned-in to NVIC irq 23), + * test that raising the line pends interrupt + * 23 in NVIC. + */ + enable_nvic_irq(EXTI5_9_IRQ); + /* Check that there are no interrupts already pending in PR */ + g_assert_cmpuint(exti_readl(EXTI_PR1), ==, 0x00000000); + /* Check that this specific interrupt isn't pending in NVIC */ + g_assert_false(check_nvic_pending(EXTI5_9_IRQ)); + + /* Enable interrupt lines EXTI[5..9] */ + exti_writel(EXTI_IMR1, (0x1F << 5)); + + /* Configure interrupt on rising edge */ + exti_writel(EXTI_RTSR1, (0x1F << 5)); + + /* Raise GPIO line i, check that the interrupt is pending */ + for (unsigned i = 5; i < 10; i++) { + exti_set_irq(i, 1); + g_assert_cmpuint(exti_readl(EXTI_PR1), ==, 1 << i); + g_assert_true(check_nvic_pending(EXTI5_9_IRQ)); + + exti_writel(EXTI_PR1, 1 << i); + g_assert_cmpuint(exti_readl(EXTI_PR1), ==, 0x00000000); + g_assert_true(check_nvic_pending(EXTI5_9_IRQ)); + + unpend_nvic_irq(EXTI5_9_IRQ); + g_assert_false(check_nvic_pending(EXTI5_9_IRQ)); + } +} + int main(int argc, char **argv) { int ret; @@ -515,6 +550,8 @@ int main(int argc, char **argv) qtest_add_func("stm32l4x5/exti/masked_interrupt", test_masked_interrupt); qtest_add_func("stm32l4x5/exti/interrupt", test_interrupt); qtest_add_func("stm32l4x5/exti/test_edge_selector", test_edge_selector); + qtest_add_func("stm32l4x5/exti/test_orred_interrupts", + test_orred_interrupts); qtest_start("-machine b-l475e-iot01a"); ret = g_test_run(); From patchwork Tue Feb 27 13:32:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776215 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp159679wro; Tue, 27 Feb 2024 05:43:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUYrO45sSHU5dUfK3sDMPaWNsCKFhe5NqeZIvod/3ylNFbqBVMtoN1i5SxA6Qiq79X/S1hakKdYh8NEgfI/U+V1 X-Google-Smtp-Source: AGHT+IF6IA4N0jIR0z+SJqK8Uix4tHCKucSfMIpIa0HhvgTYdIqfUFlMIfRnu2420/jbfOsbRNdc X-Received: by 2002:a67:f5d4:0:b0:470:5080:451 with SMTP id t20-20020a67f5d4000000b0047050800451mr6293296vso.16.1709041408193; Tue, 27 Feb 2024 05:43:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041408; cv=none; d=google.com; s=arc-20160816; b=hf50ZaEwKzxPx0T0s+5JK/bIZjRqa7OHmZPs3Fva4m73C+XvUXLGIRD++EWBezvSW7 Fns03pWE4evmV/6zfgUvD5m3uZH1S6lmMiRou0MtxvxplJyY7DN4107HqtL4Xyyq7SgO C7jv143gAmGVjUBjfdmGr1k6OgFbxqs4ZK7JY8FRjKEZ934T8grPxooA5d2T/bNITq7e XI3ZzC4tOQKUravBbdew7sPIWgD5Y8BRMCrqjv6eVHiL0Dd+FHw0/hbQaBxKO9QQLAnR Wi5WWuNo368X2bbfZuIWCpy90hJ1if/xV9bguzsAocXT3sLAcAMwlOrX678H/fa0o3v7 kVwA== 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=joGUYxBf+AHBPVlumJel18CoFaqnsq9/5R/fva28MLs=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=jct7Kg9Xe9mQcorGA/6wBR0NXTYQskAi7AmG6iJ5oK+xLvRdJ7XB6UnUO9AcLbusGB PxoNkrKUtBE4QlGpZz13X35EvGhqggSzlcKMeDX0MgbY+Uw5NLNaSlOTZpGxwGB7S+L1 minkN08PhJVoq2XGCFYHAkgxJHT1NTxmxfhaHZ3PJUIEOhUcKcEKCOyp9+PEEWovYNMJ n5rTqiQDl1TI7xQe4Pf8ZbR4owqIJgkaAjF3bvbeQE5rXEQsKU7uMjfH3QArjWtqXfSp OfmFVkwW/gxRuoRDvQog5OGxgscgEIVBJlR0HHmBS9wkzvPNIGhOljCeyp3gAkNnmYGG YI/g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SvGM7GFF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c5-20020ac853c5000000b0042e6b29aaa4si7279337qtq.337.2024.02.27.05.43.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:43:28 -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=SvGM7GFF; 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 1rexb0-000187-JY; Tue, 27 Feb 2024 08:34:10 -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 1rexaF-0000hT-AC for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:23 -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 1rexaD-0002qP-M9 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:23 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-412a14299a4so21618515e9.1 for ; Tue, 27 Feb 2024 05:33:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040800; x=1709645600; 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=joGUYxBf+AHBPVlumJel18CoFaqnsq9/5R/fva28MLs=; b=SvGM7GFFl5uFII2d0L7WcjouzXmjkmx/amw6Q7S65ISrhqO216Qr8oqRa8TqyactUo O68R3U1vd7SFvXzqf6A1Vp139GafNnLzqLTPVwIT70foRkR3KOb5AXBmGgDwthOa/AvV ajnV17CVAmOXl6n47iMX4pormd8UgIDdMd0VTo6dgXAjs+kFbUQslHC20Vu52ZXVdFlV arfBgV4j39jKaDac0chsIdKf6mrJkCtxchnNF4YfYU/A6hsFVipO4YzGPNGw6FAP++rq MlOk4JZUYyKd1fCKg0OseErmpjTMhZ38wcQ8u3TxQytuCSCfh9/U+EJXl6O5wCL1MF3u lslQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040800; x=1709645600; 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=joGUYxBf+AHBPVlumJel18CoFaqnsq9/5R/fva28MLs=; b=vIMJQKLqUPV7yVNlqHpGQfZmil0IrQKMGzfu+kbE5yqZ/xPvSqhYUZgFpXgAg9rlLT ULflz+ilr//QtSbzzjbq0ok+kMXJGRDMwEx+fiEv9RBYZh+d57Ct9SlYQYNIzyJbYr4r zp6xayCA1c6AlqbqeZV/jGcwE6pb/+km0QK59lJ9ZjlQSwyH34MhCodG8x4O9lGGQBof lLveC5MsC+BSbXA0xRYVnhyvX2gM0V+VGxGV4RHU/Ey5ktBLay6KgWdAvyaImwe+jBkL LmxWB2CgLQPL977mFu2jmr2+y4md5O7ksUOe7LcazEkYC6SR/zE6mnNlIJE3dDg4ooZA qP8w== X-Gm-Message-State: AOJu0YzxUi2/BvHFwMv1nfIgl93tnFoXrZAmk4BhvvEaFOnhUNkRMjVu BcQxVbZDZ0FAmAtbRNJGpJMyhxDodXp2c7bdAEnSyQ3mRn9KP8mvymfH5U8h9+MU2FBW77UM2mT o X-Received: by 2002:a5d:64e9:0:b0:33d:db7a:f8c1 with SMTP id g9-20020a5d64e9000000b0033ddb7af8c1mr4125271wri.48.1709040800397; Tue, 27 Feb 2024 05:33:20 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:20 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/45] pl031: Update last RTCLR value on write in case it's read back Date: Tue, 27 Feb 2024 13:32:38 +0000 Message-Id: <20240227133314.1721857-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-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: Jessica Clarke The PL031 allows you to read RTCLR, which is meant to give you the last value written. PL031State has an lr field which is used when reading from RTCLR, and is present in the VM migration state, but we never actually update it, so it always reads as its initial 0 value. Cc: qemu-stable@nongnu.org Signed-off-by: Jessica Clarke Reviewed-by: Alex Bennée Message-id: 20240222000341.1562443-1-jrtc27@jrtc27.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/rtc/pl031.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/rtc/pl031.c b/hw/rtc/pl031.c index 837b0bdf9bd..563bb4b446e 100644 --- a/hw/rtc/pl031.c +++ b/hw/rtc/pl031.c @@ -141,6 +141,7 @@ static void pl031_write(void * opaque, hwaddr offset, g_autofree const char *qom_path = object_get_canonical_path(opaque); struct tm tm; + s->lr = value; s->tick_offset += value - pl031_get_count(s); qemu_get_timedate(&tm, s->tick_offset); From patchwork Tue Feb 27 13:32:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776233 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp160888wro; Tue, 27 Feb 2024 05:46:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWLK5/Gya8FgAxrE3HvVPv5xr4qP9XRgWjz2qCLr7thoVrrkP0wn9kTPeAm3iJJT0UUVev5o/O33Fk0ChiDABbF X-Google-Smtp-Source: AGHT+IGziZ53rE1nGhg9t/5Y1Rgmj6QmfY6LaYxd9VStkcfsGJQnlstllhC1DHSEBZvNl16oQro4 X-Received: by 2002:a5d:4b4f:0:b0:33d:81ca:532e with SMTP id w15-20020a5d4b4f000000b0033d81ca532emr7745686wrs.47.1709041577798; Tue, 27 Feb 2024 05:46:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041577; cv=none; d=google.com; s=arc-20160816; b=PFbMPIlsrQIhUbq4+VATTua9SDKWBtn8UWyBy1P0Wzl6BWlpG9UrvJGNixgZJXSmTm aHA/pw8DwOC0/KJUWIY+hmE484KqkEkwNJzUtdGe2KmVbEW9GmQDTmc5YJoxV/liss2u pGZBE34lme5e6JmhRMBWF9IK+9FUr7fk4Yz+wI9MFbpUk8xTweBggF1gOXGgyQdOZtDj kPUpa9xj9uS3GEgarUNIayowwARHaQ3jun4/TduE8b3PTTB1Sdh+N2q/uKFvMY/n7tyh VncV6BDXx01WnGT1aLQ9BfFjmizVr5xscUJk8SQrQS4oewf3FRIFDFXbOniIU5nkylz8 lohA== 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=ghfytIikIlf01WoNBDAZGxwpGh2RY6aESDQERQrWq0o=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=NcnH/l4MmJodlGDFd516Sm5GQkBo9B6TUHGpDzNSAh/NJCMyiK2I+SmNDc6H4p4EHl VSNH9SUwdnjib/fhOAMOupiUl/4v8VYfEMXq8UA8A7UqMWTS9kLyiRhMvChNKNDKllQr MYWWfncRkiw1loSDrNbr7v2WQQrFVHXGnlgzeX6oqnHpw0/cj4oyvh9DVh8AtKdNtZoX WZqKBR30HF0NOwTesZ/eVbE1nq8AFT1Ye9uwAMLMPenMM41u7CHGdnInkSKaP3KefXt4 nubzrHJuuB+fAuABTfdjgtRxTwdZqtkS9OOVYuMH4fUbxrvDNZu8oh6isWQFWTlVB1Yd P6/w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rogXWil7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u16-20020a5d4690000000b0033d855c9e8esi3647525wrq.1032.2024.02.27.05.46.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:46:17 -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=rogXWil7; 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 1rexaR-0000ke-Bm; Tue, 27 Feb 2024 08:33:36 -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 1rexaG-0000hy-Ih for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:24 -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 1rexaE-0002qi-5U for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:24 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-412a3371133so16586115e9.2 for ; Tue, 27 Feb 2024 05:33:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040801; x=1709645601; 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=ghfytIikIlf01WoNBDAZGxwpGh2RY6aESDQERQrWq0o=; b=rogXWil7udjuPMqLArXZ6eV7E3LOT4ReBQkOBRkQPTL8nkyHFMWdz9D258mrnWIize HuShu26yDKwaID/xo94EfJfIIPH+CrjNdtb+w/CPMZJsQE/5cR/QvxVBL439Wzwba3pK d585QmB2tvHssT6c1t+LosWCbshFKVzESyxGf83hPGZznqHWPxFppSWW0pNCkvXyOv/J BMdf15B/ONJfX2vVjR008F/2ppod3AzYr7s8AMIM/u6E81eOiMEfFjRVopegWI9zE2LK 3cZSg/bqItKpMuAIGAE6zkFn6uR6suw+8ze5I6rkSp+Xo1DDl4b/K/pCwwMmaOXY8qDz iHtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040801; x=1709645601; 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=ghfytIikIlf01WoNBDAZGxwpGh2RY6aESDQERQrWq0o=; b=E0LtNkF83Bo5hHhflXwCHgdcwcKdhHxhDbzQsl9mIl7gOd4LaUS5hBOR6X7LYc0WZ5 0xnV1M6f4tnA11nVBxDbTlMech/AxuKiEr//1Bmd2VxxgAvlqg3TBOW6yoexPf9tOyoC mtIeh+cWZXFyU4N0gXHU0BwiIsJPZPY+fhF2Nh0YtYl7H8+937kl03DcQupr8+BLzGIE GO36cMzMUD9vjkH1IXCYkgfifmempScG/d84DVOVxL8RTLlLZm8teMA43q5vibOyFZ6W G8SNFIFxM2PXCzlxApA/FNQZ/oTWK2hFCLd1rD6soTBJdo6x7Kr+9HKSMo7PPc10IiZf RH0g== X-Gm-Message-State: AOJu0YxxCRoHhMitkenrXkBPo10M84W39/cWCSG3/vXttSSMnRl4neCs pV8Ft7+bHnzU6F/fF8Sj1uwLSk3y+3j4bkTe/xWgHMutOm+c29+WHRoyNtFXtnrOOWNKfGHX4p4 x X-Received: by 2002:a05:600c:548e:b0:412:a109:5005 with SMTP id iv14-20020a05600c548e00b00412a1095005mr5589092wmb.0.1709040800835; Tue, 27 Feb 2024 05:33:20 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:20 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/45] block: m25p80: Add support of mt35xu02gbba Date: Tue, 27 Feb 2024 13:32:39 +0000 Message-Id: <20240227133314.1721857-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-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 From: Sai Pavan Boddu Add Micro 2Gb OSPI flash part with sfdp data. Signed-off-by: Sai Pavan Boddu Reviewed-by: Francisco Iglesias Message-id: 20240220091721.82954-2-sai.pavan.boddu@amd.com Signed-off-by: Peter Maydell --- hw/block/m25p80_sfdp.h | 1 + hw/block/m25p80.c | 3 +++ hw/block/m25p80_sfdp.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.h index 011a880f66a..1733b569508 100644 --- a/hw/block/m25p80_sfdp.h +++ b/hw/block/m25p80_sfdp.h @@ -16,6 +16,7 @@ #define M25P80_SFDP_MAX_SIZE (1 << 24) uint8_t m25p80_sfdp_n25q256a(uint32_t addr); +uint8_t m25p80_sfdp_mt35xu02g(uint32_t addr); uint8_t m25p80_sfdp_mx25l25635e(uint32_t addr); uint8_t m25p80_sfdp_mx25l25635f(uint32_t addr); diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index 0a12030a3a1..08a00a6d9b8 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -267,6 +267,9 @@ static const FlashPartInfo known_devices[] = { { INFO("mt25ql512ab", 0x20ba20, 0x1044, 64 << 10, 1024, ER_4K | ER_32K) }, { INFO_STACKED("mt35xu01g", 0x2c5b1b, 0x104100, 128 << 10, 1024, ER_4K | ER_32K, 2) }, + { INFO_STACKED("mt35xu02gbba", 0x2c5b1c, 0x104100, 128 << 10, 2048, + ER_4K | ER_32K, 4), + .sfdp_read = m25p80_sfdp_mt35xu02g }, { INFO_STACKED("n25q00", 0x20ba21, 0x1000, 64 << 10, 2048, ER_4K, 4) }, { INFO_STACKED("n25q00a", 0x20bb21, 0x1000, 64 << 10, 2048, ER_4K, 4) }, { INFO_STACKED("mt25ql01g", 0x20ba21, 0x1040, 64 << 10, 2048, ER_4K, 2) }, diff --git a/hw/block/m25p80_sfdp.c b/hw/block/m25p80_sfdp.c index b33811a4f5e..6ee2cfaf119 100644 --- a/hw/block/m25p80_sfdp.c +++ b/hw/block/m25p80_sfdp.c @@ -57,6 +57,42 @@ static const uint8_t sfdp_n25q256a[] = { }; define_sfdp_read(n25q256a); +static const uint8_t sfdp_mt35xu02g[] = { + 0x53, 0x46, 0x44, 0x50, 0x06, 0x01, 0x01, 0xff, + 0x00, 0x06, 0x01, 0x10, 0x30, 0x00, 0x00, 0xff, + 0x84, 0x00, 0x01, 0x02, 0x80, 0x00, 0x00, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe5, 0x20, 0x8a, 0xff, 0xff, 0xff, 0xff, 0x7f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, + 0xff, 0xff, 0x00, 0x00, 0x0c, 0x20, 0x11, 0xd8, + 0x0f, 0x52, 0x00, 0x00, 0x24, 0x5a, 0x99, 0x00, + 0x8b, 0x8e, 0x03, 0xe1, 0xac, 0x01, 0x27, 0x38, + 0x7a, 0x75, 0x7a, 0x75, 0xfb, 0xbd, 0xd5, 0x5c, + 0x00, 0x00, 0x70, 0xff, 0x81, 0xb0, 0x38, 0x36, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x43, 0x0e, 0xff, 0xff, 0x21, 0xdc, 0x5c, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +}; + +define_sfdp_read(mt35xu02g); /* * Matronix From patchwork Tue Feb 27 13:32:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776197 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp155937wro; Tue, 27 Feb 2024 05:34:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVypaC56MjOEBdhLUQugIgzSHK9i5RLOHZl6XRXHDNvuwDd2bZDfNGwES3yi3p880zh8b01j7A/Mo7wfuzjhYFU X-Google-Smtp-Source: AGHT+IGmxJ2PZgfyC9A+pZqWpJp64FKl6d0oswXgYSFbFqSyLH8Nilpwx/UJFaicu3VxbbBRv6TV X-Received: by 2002:a05:6214:130f:b0:68f:418e:5651 with SMTP id pn15-20020a056214130f00b0068f418e5651mr462034qvb.60.1709040888220; Tue, 27 Feb 2024 05:34:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709040888; cv=none; d=google.com; s=arc-20160816; b=JKIRJbtIKGKNNLsGBwS9/nNcgVpyxxTpO12wH8V9rwoEjFGHZTdWPUDN99DS6AJ0pz 13vYFGlZzeulvPZEJ5/WNXMdN8Ibrf0fi0Nm+sWigFylg4ZmYapIAOnIOJS/btZKSUlm z3nJudMkDPehygxjsJgQXhExsRdN87a2whocvF+guAD1jUVQdCK8TJnnoNtVs9xn8jCs 8nbPnhuEih14pL9H9uZQWdELPCMeH5nO4zHqVYvta6BW7bua5IZchk1KqrTORmJ3pnvU oy/UV8bQgO3RZZxN0Q6ICceqh1S6ZznzNyGsUjDuE8HYtHjzhjhqxvS9GoMoaRBwpV9/ gMuw== 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=ew4Z8LeQFT3auV97++3nsulAkoTYVN/ntWXGduMaWl4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Ta96088Rjh877IBd2TfyFZ7H6ndGj1VpOtC+4cIbzrmUaY7x1GejHE0c3tcLW5bu/r jZVcNtbHLzgVzRuw+LHvzAr/m3KvLzo31UNqg0uwIA0uQk8b+dGVRigDuwuk8xNZT9wO Q7j2heHYFwCj0+Dq9S+/vlZE/8n1mzhoi7asV8ny6umLBMxEdtZUTzqesNcOvbs6OGfU /anFokYG1aP1oa6Ve59chjvLOoESApZQ5Tel/p/GoBATXJtpgPzk09xcfLWjLylNghTY MgGuJUND1e6VEMp4z8LWoDDrPE8p/MnjH/8d7JizzarQcto9eEQtyugiHgaQW2lXsPBt CStQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EH1pFjcP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 1-20020a0562140d6100b0069004e8b5acsi4944415qvs.79.2024.02.27.05.34.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:34: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=EH1pFjcP; 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 1rexaK-0000jp-TI; Tue, 27 Feb 2024 08:33:33 -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 1rexaG-0000i0-Lw for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:24 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaE-0002qt-Rk for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:24 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-412a14299a4so21618635e9.1 for ; Tue, 27 Feb 2024 05:33:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040801; x=1709645601; 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=ew4Z8LeQFT3auV97++3nsulAkoTYVN/ntWXGduMaWl4=; b=EH1pFjcP/9FGu+H95v3rt24m4CqE5i6kKx2EtWpmt0fWGf2FNG+6eaWMwm/oklw5OM LWlSLe4Lf4PRF5HIjsdGzwFmQ1osH8z9a/OvcIzs1qbgBI3cLzbkyOLGQ+BJSuptwB0B HVOvFHhPkhSjDOJuRQ383RPMcisGyhfa00lVD2U1+7Q9272HiPiNYs+PAkGuHBZxmzIv +04RbIyeJtBv4XYKjLcN2wu+Wxng/rwFHskdlr90KykydbCvYAQpfLhEn+pKbcKJp0+p KC4pUwZjWXdH1CdCETstVqmsBDhihulEzgKfAgE3DXww2E1S5szDIfK76/aqWRqXyOJ4 GDew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040801; x=1709645601; 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=ew4Z8LeQFT3auV97++3nsulAkoTYVN/ntWXGduMaWl4=; b=K5ZPdwQPyJpGiIyY6asBdhawMlf0AVyj5G91/2I2QP5BNDG7JcrG9K8SN82VLbXuFy 0f7wHhYw1LGUIv0MCYL6i7ktOqgT7sCU4F4Yl14fTc4xzWnCNKz06taGmDQOWF6IdDzU +SO47cbqevLCbEfvC+Ir8pSlOTqyydAJbqBPxmMBy9m2lPDig5KK9HlkoEQmuEF++HNc dq+FstCjprZjWEMRYl3Dg959+/C64NF8VjZQyUAS30QZzepKjXYTHxMsyoRj3Z1nFyix v6yJeCZ9YK+m223puYiP++bWM7fauOeD6i8WKyQPCJ8PiGaf1ID6P4EbSE03Wj7iePgb sCbg== X-Gm-Message-State: AOJu0YxfX/siyOiCP0uqIposmbRrlP+MR+HYrnONXXxb56kRZcJjqpiw hCpzdUPhAnI2mOqH9qCT7MMHxwCppWPYMx2EI9D2bjPYW37IFy4ZaDzfTetAUl4WedCtkFXZBFy X X-Received: by 2002:a05:6000:71b:b0:33d:c652:7c41 with SMTP id bs27-20020a056000071b00b0033dc6527c41mr7279561wrb.71.1709040801284; Tue, 27 Feb 2024 05:33:21 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:21 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/45] arm: xlnx-versal-virt: Add machine property ospi-flash Date: Tue, 27 Feb 2024 13:32:40 +0000 Message-Id: <20240227133314.1721857-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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: Sai Pavan Boddu This property allows users to change flash model on command line as below. ex: "-M xlnx-versal-virt,ospi-flash=mt35xu02gbba" Signed-off-by: Sai Pavan Boddu Message-id: 20240220091721.82954-3-sai.pavan.boddu@amd.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/xlnx-versal-virt.c | 44 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 94942c55dff..bfaed1aebfc 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -49,6 +49,7 @@ struct VersalVirt { struct { bool secure; } cfg; + char *ospi_model; }; static void fdt_create(VersalVirt *s) @@ -638,6 +639,22 @@ static void sd_plugin_card(SDHCIState *sd, DriveInfo *di) &error_fatal); } +static char *versal_get_ospi_model(Object *obj, Error **errp) +{ + VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(obj); + + return g_strdup(s->ospi_model); +} + +static void versal_set_ospi_model(Object *obj, const char *value, Error **errp) +{ + VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(obj); + + g_free(s->ospi_model); + s->ospi_model = g_strdup(value); +} + + static void versal_virt_init(MachineState *machine) { VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(machine); @@ -732,12 +749,25 @@ static void versal_virt_init(MachineState *machine) for (i = 0; i < XLNX_VERSAL_NUM_OSPI_FLASH; i++) { BusState *spi_bus; DeviceState *flash_dev; + ObjectClass *flash_klass; qemu_irq cs_line; DriveInfo *dinfo = drive_get(IF_MTD, 0, i); spi_bus = qdev_get_child_bus(DEVICE(&s->soc.pmc.iou.ospi), "spi0"); - flash_dev = qdev_new("mt35xu01g"); + if (s->ospi_model) { + flash_klass = object_class_by_name(s->ospi_model); + if (!flash_klass || + object_class_is_abstract(flash_klass) || + !object_class_dynamic_cast(flash_klass, "m25p80-generic")) { + error_setg(&error_fatal, "'%s' is either abstract or" + " not a subtype of m25p80", s->ospi_model); + return; + } + } + + flash_dev = qdev_new(s->ospi_model ? s->ospi_model : "mt35xu01g"); + if (dinfo) { qdev_prop_set_drive_err(flash_dev, "drive", blk_by_legacy_dinfo(dinfo), &error_fatal); @@ -770,6 +800,13 @@ static void versal_virt_machine_instance_init(Object *obj) 0); } +static void versal_virt_machine_finalize(Object *obj) +{ + VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(obj); + + g_free(s->ospi_model); +} + static void versal_virt_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -781,6 +818,10 @@ static void versal_virt_machine_class_init(ObjectClass *oc, void *data) mc->default_cpus = XLNX_VERSAL_NR_ACPUS + XLNX_VERSAL_NR_RCPUS; mc->no_cdrom = true; mc->default_ram_id = "ddr"; + object_class_property_add_str(oc, "ospi-flash", versal_get_ospi_model, + versal_set_ospi_model); + object_class_property_set_description(oc, "ospi-flash", + "Change the OSPI Flash model"); } static const TypeInfo versal_virt_machine_init_typeinfo = { @@ -789,6 +830,7 @@ static const TypeInfo versal_virt_machine_init_typeinfo = { .class_init = versal_virt_machine_class_init, .instance_init = versal_virt_machine_instance_init, .instance_size = sizeof(VersalVirt), + .instance_finalize = versal_virt_machine_finalize, }; static void versal_virt_machine_init_register_types(void) From patchwork Tue Feb 27 13:32:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776195 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp155797wro; Tue, 27 Feb 2024 05:34:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXQIGYew6Ly0oPfv7R5XK5g3OGxbFBL1KwUYjTnI/psJkMCral85ab+RCnaC/RVhHRIagfSNN152EAjTePCMgOW X-Google-Smtp-Source: AGHT+IHYhMofjmBCQNFQD03KoeRMFHpO3AD/owDouGnKblGk6BIYbygYdU6Tn0dm4AeGlSGDG9ch X-Received: by 2002:a81:e90a:0:b0:607:ca2e:f23e with SMTP id d10-20020a81e90a000000b00607ca2ef23emr2212399ywm.30.1709040869759; Tue, 27 Feb 2024 05:34:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709040869; cv=none; d=google.com; s=arc-20160816; b=HlFkzDz7mLEnB18K6FHXn03FkOT6JDkZs2HDY2KTWKbBKK5AMx5CPLAr0ygfe3Xpnk hscrkfSleaNeCWsA/dh39PAuAOvvTRiFNNJ6vBA2cc4/f8spVkpXrYqRh4jAaaxKFfr+ 8T/mi1fFd0r0uRbLRHuPfePcO2g3SlPcokWN28OHc+cJc3TkY6tgFTpkHWBC9Hn3TBij kYa99+FOcPa3fZJyVCU9IlWTb+gm15NOSXznQCQv8r37Z4dCRvCjIkdmw2dNQCD9CyxH zheS3l2e+fkXv8Oa2oVAbPkXoJR9uGuvNMOLFJjF9abYzqvHAXWVI09sOIAULD8N12km zmiQ== 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=no1yxF9QVzDWCiPK1PcrjBYtl68uz4bzwyJtwJFIo0s=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=B6v59j/JsAbc50CtAiFujNROKrgy0UYsXWJ/GF2PWxxNqHk1pELVCRxYE+19Wz5t+X f1dDT0lAh+GdZf+Y5MhRj1txZPj9e19Y19YqUZBmoCR8edSPZSG7Uu3np4wbtyaRaqUr CzcMdRSicH4JqB8lE+O40n4isqNwDxpb849oHOPDTxOBkfLmsUy14wj7JDSNKF6jYY4m z+AP+dyV8MTN4T+F2xFe8vUqfcLV5g9Z6ZYqEoKwoIS0/lAVofr3HlOT31PVBgOKJOro xqssoU7mOxJejYNYL9IkZvOdr1uKmP7U1N0LVMYv/B6taty7H9AEvXz4mgqQI3LopPVb vK5Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qAkMtt9Y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g17-20020ac84691000000b0042e6f32da95si7113280qto.711.2024.02.27.05.34.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:34: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=qAkMtt9Y; 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 1rexaX-0000oU-UZ; Tue, 27 Feb 2024 08:33:42 -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 1rexaI-0000jU-Ny for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:27 -0500 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaG-0002rk-U9 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:26 -0500 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2d27fef509eso38015811fa.3 for ; Tue, 27 Feb 2024 05:33:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040803; x=1709645603; 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=no1yxF9QVzDWCiPK1PcrjBYtl68uz4bzwyJtwJFIo0s=; b=qAkMtt9YeVMkY7NqDuwUEFs1X/walUnQBlsN5wXcN/owHivp1GrrMQlRLjLGxmYb5E Z3kvBbReG336hskZ7QTsnpaHaPbzDlwGjnnLoZZe/LqQqwVHMROAdRPpnbGtmVxMjm6z 8VMN6milsiExrbaW6rYzYb5aZk7fyBUfZ6pEaTcRbLSgDC0Anh4ZNuf7WTxmHwdc4Abw En4m0+IsaUC/1zgjIzQJiaB5RkX7pBBwkhslWtcH5lGCGhqS+JkI4t0pP42/Xt1KWikr fPl0gyfF+VZ34hOWNb+ZGXlar6oHYUbEmeFg9l2enIOppFWBANKIuoYDkEazMfaaIgwF Hb8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040803; x=1709645603; 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=no1yxF9QVzDWCiPK1PcrjBYtl68uz4bzwyJtwJFIo0s=; b=eyXn9sg/qfBU/hirxre4sgBA//2hCKDM30DlrZUOZw/8cv0zknFi+NP+cQ/Gq4FzOQ rkr327EqcCfT5cmd7yUI6uczk/grlLEDCZfbOlKzEooM4/NcAa38KQD82gHmt0XkUXAb Fguv/qOlY4gKibC4CDcknR/hSJBseLrAqUuodL9rGvPYOFdMRmB7vkBS4kw97UQccaVi +OTIeJapzxNIwtb5/Tk/R3DJfARKPnqD1w5K5pTAc2g5b1erDrlQcHv1FqvKy6wUKRZm Ae0+6ovpclgIAaQJQDJs4CMvjkcRY129RaHRbBb5ERnPO6s2Eb3vaLgsh/kT0+dtkGlI QTjA== X-Gm-Message-State: AOJu0Yy0sygK8FvGdIIg0/kA1LvLD85BT0KjsMATR4Jf3r8MJxvonlGy maS9TlMbY1ynylEqzPNcXOR7AfIDAkqsKVZ5y1P7DBEEcqxYAMnEK16at9wdAZ14AYn3CWu1xSo r X-Received: by 2002:a05:651c:556:b0:2d2:a443:9c64 with SMTP id q22-20020a05651c055600b002d2a4439c64mr851055ljp.45.1709040801748; Tue, 27 Feb 2024 05:33:21 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:21 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/45] arm/ptw: Handle atomic updates of page tables entries in MMIO during PTW. Date: Tue, 27 Feb 2024 13:32:41 +0000 Message-Id: <20240227133314.1721857-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::234; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x234.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: Jonathan Cameron I'm far from confident this handling here is correct. Hence RFC. In particular not sure on what locks I should hold for this to be even moderately safe. The function already appears to be inconsistent in what it returns as the CONFIG_ATOMIC64 block returns the endian converted 'eventual' value of the cmpxchg whereas the TCG_OVERSIZED_GUEST case returns the previous value. Signed-off-by: Jonathan Cameron Message-id: 20240219161229.11776-1-Jonathan.Cameron@huawei.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/ptw.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 5eb3577bcd5..ba1a27ca2b5 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -711,8 +711,68 @@ static uint64_t arm_casq_ptw(CPUARMState *env, uint64_t old_val, void *host = ptw->out_host; if (unlikely(!host)) { - fi->type = ARMFault_UnsuppAtomicUpdate; - return 0; + /* Page table in MMIO Memory Region */ + CPUState *cs = env_cpu(env); + MemTxAttrs attrs = { + .space = ptw->out_space, + .secure = arm_space_is_secure(ptw->out_space), + }; + AddressSpace *as = arm_addressspace(cs, attrs); + MemTxResult result = MEMTX_OK; + bool need_lock = !bql_locked(); + + if (need_lock) { + bql_lock(); + } + if (ptw->out_be) { + cur_val = address_space_ldq_be(as, ptw->out_phys, attrs, &result); + if (unlikely(result != MEMTX_OK)) { + fi->type = ARMFault_SyncExternalOnWalk; + fi->ea = arm_extabort_type(result); + if (need_lock) { + bql_unlock(); + } + return old_val; + } + if (cur_val == old_val) { + address_space_stq_be(as, ptw->out_phys, new_val, attrs, &result); + if (unlikely(result != MEMTX_OK)) { + fi->type = ARMFault_SyncExternalOnWalk; + fi->ea = arm_extabort_type(result); + if (need_lock) { + bql_unlock(); + } + return old_val; + } + cur_val = new_val; + } + } else { + cur_val = address_space_ldq_le(as, ptw->out_phys, attrs, &result); + if (unlikely(result != MEMTX_OK)) { + fi->type = ARMFault_SyncExternalOnWalk; + fi->ea = arm_extabort_type(result); + if (need_lock) { + bql_unlock(); + } + return old_val; + } + if (cur_val == old_val) { + address_space_stq_le(as, ptw->out_phys, new_val, attrs, &result); + if (unlikely(result != MEMTX_OK)) { + fi->type = ARMFault_SyncExternalOnWalk; + fi->ea = arm_extabort_type(result); + if (need_lock) { + bql_unlock(); + } + return old_val; + } + cur_val = new_val; + } + } + if (need_lock) { + bql_unlock(); + } + return cur_val; } /* From patchwork Tue Feb 27 13:32:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776212 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp158804wro; Tue, 27 Feb 2024 05:41:15 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXC5zdTLfCrB5M5iZO5lxNGhxYsaRrwyhRZeL65W2/+rW62m1LRUbGSXToxhUXmu2ndsy6+I4M91kwVeQ2I4qfY X-Google-Smtp-Source: AGHT+IGDBjv1JKAzxAd0WHCn31b5bSA/Hdkj9lripdmoK9zOzUwFvh3Y9d82X06sasQJO3PHZgdd X-Received: by 2002:a05:620a:1595:b0:785:c9d1:547d with SMTP id d21-20020a05620a159500b00785c9d1547dmr1924514qkk.78.1709041275013; Tue, 27 Feb 2024 05:41:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041274; cv=none; d=google.com; s=arc-20160816; b=C1igNgag5K4rp5itSUYK9cTyKHmUNj7mawzKhhtKnOo60rqYSvW/KecoOrz1GkAKzv aGBFbpncKRlYz4e5hCMziaPDZa/FHoiMwfA6nVxFg3RxVC3y1kKqI64pCTYKKE06HB43 cYSJ73YgBFLw60oLhBrnb3J6nVr0bLnGknHdxJQ1T2pcH21Pg9yQ4Gjkf//+Wp6Bi12e LIfZ5YLd+twd9NyrATTNHH8794/0k2sNuee61ApM5Eoh69LbH7gpRPBnO14EPgJTcLBF 6gNHfh2il4JQhA8BzEMC11z2WH3uSkgQhocAV73fKKMJ6LGehDPiqs0xGhO0lvwp5ge4 TJJQ== 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=mH020CujZ7OZ2w++F6q5td/qRwav+t8/vo2MNxQRXSs=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=eFZD2Dm37ZLE+Tzyv30+1WtsjGvwucHue5OSj7GV+8u4nOQsrf0hmOE0hwVU6csiX1 jmCturjfSed1NNtlHHsm9Zoh8+EDUp4EP1yySivGg4TLsiHeTS3FlGqY9eWQwrbHQv0K Bq3LMCclwpC6KIxnwpFlT4nj9piuWCLW9nK+ub6y+bqqJPgVYFxi+00OcrY+6G8cVgPy 6BN0OGlqEELtzf9CimcCJlwGKpOyFQpzJdAXkbdrjoBSSPXVMCI289Mu95/SMoSbtkfP 0Z/dkTuMhHkallHUogryXeGp896zFTrDB5d2JIov09vIV3oGdzPwn867Ku9CyDJNnWHy 3wZw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=amTantS4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s18-20020a05620a16b200b00787428d0ddcsi7599182qkj.99.2024.02.27.05.41.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:41: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=amTantS4; 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 1rexaY-0000oj-5Y; Tue, 27 Feb 2024 08:33:42 -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 1rexaI-0000jV-Ps for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:27 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaG-0002ro-TA for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:26 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-33de4d3483eso1073926f8f.3 for ; Tue, 27 Feb 2024 05:33:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040803; x=1709645603; 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=mH020CujZ7OZ2w++F6q5td/qRwav+t8/vo2MNxQRXSs=; b=amTantS4Is5UCyNHvJ/lpdbwSns0SxVhi7Kl8Cy+SCawVVhkZHahZuXVllCk88/VOO S2z9K9BlI7GQYotBAFOn4yLohvdXOv5fWhHxBeosZ+tlwv4EdfFBGxh+2H3bEW0t7ZK+ 88CY6HwpH7k3hH04698ta/mIOZKrAovuXAvmFVvuAoV/TK0bIk5GopyxkCXUrx+U4ly6 +q53LfPzGj3kzwgypNPqJELcqWzs3z1HjeuQgrLwti0og78tc2vvccmiUUA2GVtw/fFP uNohvFnn9sV/NwQt7PyaBMxq2+L0mi5yPlQ6NHxQlG0SL2u7I815jRAAtytCyrKDhHJa HxFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040803; x=1709645603; 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=mH020CujZ7OZ2w++F6q5td/qRwav+t8/vo2MNxQRXSs=; b=uOxUEN3i/aX6SYcd887iTCfoXp9Xn3Sr3UwNkg5lSfj4a3Z+qz+3YR0MURmctYZrK9 07QyYRA1K2/tBzjZv7ljXgxfbSbLYH7sjb9AiR6GoEA7gEoW1G0XRLDIHm6HxZdU9gFD pjb0rFY97c/agMiQE2RVYXHEi6+jWq/Kw9ivXhg9CDBxLin8qzMIBHTAgT++ghL+IQ2Z d8QjgbzkIQiPSwzpiUlxCdiO3YI134hCj10eItk+/utXEcxJWsKqPnzHpCL9Qw2ZLg37 iQNF/HYib5uq8Ipqf6wQnXiwdawEQh3QvfRQql+/G2fbLwk4cfTawGtEGA6aPhZ53vlb oscQ== X-Gm-Message-State: AOJu0YyJcRmUm7DSzuJR8QJQPXE1ERkGbW2LwsHvlQ9YQzZhGgmSuXnB +xSeG/7bU+bA6eLNhBNMNFTViK1TTnawGjlXQ4xLKbata5YNsFwurL0slPMzM1sCiUGiWAi3TJ8 y X-Received: by 2002:a5d:6a0f:0:b0:33d:64dd:4b2e with SMTP id m15-20020a5d6a0f000000b0033d64dd4b2emr7717795wru.7.1709040803461; Tue, 27 Feb 2024 05:33:23 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:23 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/45] system/bootdevice: Don't unregister reset handler in restore_boot_order() Date: Tue, 27 Feb 2024 13:32:42 +0000 Message-Id: <20240227133314.1721857-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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 the qemu_register_reset() API permits the reset handler functions registered with it to remove themselves from within the callback function. This is fine with our current implementation, but is a bit odd, because generally reset is supposed to be idempotent, and doesn't fit well in a three-phase-reset world where a resettable object will get multiple callbacks as the system is reset. We now have only one user of qemu_register_reset() which makes use of the ability to unregister itself within the callback: restore_boot_order(). We want to change our implementation of qemu_register_reset() to something where it would be awkward to maintain the "can self-unregister" feature. Rather than making that reimplementation complicated, change restore_boot_order() so that it doesn't unregister itself but instead returns doing nothing for any calls after it has done the "restore the boot order" work. Signed-off-by: Peter Maydell Reviewed-by: Michael S. Tsirkin Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Acked-by: Richard Henderson Message-id: 20240220160622.114437-4-peter.maydell@linaro.org Reviewed-by: Zhao Liu --- system/bootdevice.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/system/bootdevice.c b/system/bootdevice.c index 2106f1026ff..2579b26dc8b 100644 --- a/system/bootdevice.c +++ b/system/bootdevice.c @@ -101,20 +101,23 @@ void validate_bootdevices(const char *devices, Error **errp) void restore_boot_order(void *opaque) { char *normal_boot_order = opaque; - static int first = 1; + static int bootcount; - /* Restore boot order and remove ourselves after the first boot */ - if (first) { - first = 0; + switch (bootcount++) { + case 0: + /* First boot: use the one-time config */ + return; + case 1: + /* Second boot: restore normal boot order */ + if (boot_set_handler) { + qemu_boot_set(normal_boot_order, &error_abort); + } + g_free(normal_boot_order); + return; + default: + /* Subsequent boots: keep using normal boot order */ return; } - - if (boot_set_handler) { - qemu_boot_set(normal_boot_order, &error_abort); - } - - qemu_unregister_reset(restore_boot_order, normal_boot_order); - g_free(normal_boot_order); } void check_boot_index(int32_t bootindex, Error **errp) From patchwork Tue Feb 27 13:32:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776231 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp160847wro; Tue, 27 Feb 2024 05:46:13 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVFti5Vgkx7NmHzND2Kmfrd9LtzAjZ+Tbuk5MZVyh+qVPaRXXC8REomDwOH2HQnGMvqA1hIHy08QAYf951rv5nc X-Google-Smtp-Source: AGHT+IGuIXa6f+RO06vMzh2oZAvN6Ot5NW0RltwP0SXRMsR+qUTwTxJKPjv8e9icYeT/ejD6nKvC X-Received: by 2002:a2e:7d09:0:b0:2d2:3a31:c39f with SMTP id y9-20020a2e7d09000000b002d23a31c39fmr6031763ljc.35.1709041573681; Tue, 27 Feb 2024 05:46:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041573; cv=none; d=google.com; s=arc-20160816; b=NvvDFyo3IEpK0PsWvq7cw9HvQc2pw5P4E7WxclnM8ZGG26vjVs1F97jWKff4UgA84s WHnWZ85iUuKRRcoETWHCcTFdYgtWTzNf7NkiJ8FDfkimxdHIzYEeV2NAhhpZ+6kTI22T VnoFtoCEkJ2wMw8jPu6ZHxZVXdXn6KblIzO6dy0RU74dPfNuU1O/6G+/mYprwJNlbkKF Z1U5QsLUfUERsg7UPRxBewTy1toq8HiBFnKDXJZ/9IfC001e2oQP9DSI9OS+6z5tDzI/ T4HHIoCBmlxqGZllmNk3RwwDywrfFujNKbh9P78vo89eaiXgGV8pit4zt6tWEBy6ePBv FABw== 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=jxc8/xw8HbL3/iKLwnbteK+6UR1x1Co6Kq8B2A/9ru8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=c6HDpp24lmcsQG0zzzVajXL3E8wuEQKvba1r2z9I7PkF+z2ruhJVJhJK7mX4IGMVWZ IV9oGHSrEhJ7FLA8EcL83MqDTFNOhI4zHZTpCEKCoL+eD7iOVxXwIl/cDaVaXvyBrNxH yy+ApLlEh40GlAEVZO1lUHa8wWJrFsfPosgq/r/qYLlpWjkmVDwVDbkAsl9bS7tVHmIf SUeKvwj9rByajyNDeAQLIuyE3/pHttsIZLGlx23e/fnnvlYdlANEZ17bOkVyGZw0sXAU pS0sRXq8vyeR4gPkw0/YuP/uMQN8dRSyfKadeRy0wVdp5vU2c9SLnJJUNsdWESXjm0Fw gV0w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j7ePvglt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g18-20020a05600c4ed200b0041273ead60esi5143204wmq.176.2024.02.27.05.46.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:46:13 -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=j7ePvglt; 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 1rexau-00013x-Sz; Tue, 27 Feb 2024 08:34: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 1rexaJ-0000jo-QU for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:28 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaH-0002s6-DI for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:27 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-33d36736d4eso2665450f8f.1 for ; Tue, 27 Feb 2024 05:33:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040804; x=1709645604; 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=jxc8/xw8HbL3/iKLwnbteK+6UR1x1Co6Kq8B2A/9ru8=; b=j7ePvglteQFwOBPZXaNmDDoG7AqqZl5kZ31zqH0HlsbMe1MD0n9vo0bkk+6kDIU8um loexIIaReHIsfj2vvEPoy0oqkhrX4GikS3NUdIqD6/vbbMNDbKDV1llrxrVQ7GmoNxh7 vMd6S11y4Aome2tvdLpGxgOKJxTMGJQwk7Q+ZR0QB8uLIu1sh9sZEQyEy3XQkEMMkS7+ wpzWU5ZAAvsETFJ8nnhAPB7C309FrV0+rWXTVO1Fh4ryat7soVbwLFuAe9gG5oouq7CZ mgMZ5IXafYHHxkcVv2TLM7I2lGwL7g65BCQM30Nd+L5oQvimZrAGt1iwW9iT7ykN7JVW xI9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040804; x=1709645604; 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=jxc8/xw8HbL3/iKLwnbteK+6UR1x1Co6Kq8B2A/9ru8=; b=fJx1aXAZZDbTjenXenQDx7rzjXd9MdfREwjDIOeyykENJeUkqgVxIH6g9bne+I73Oj ouTdMnRQwZ1hIYdK6MhWD1ilM4bP7o+Tsry9qvdm3IqOiM/0lEEKqeoEwwqjrY3+hD0i CtqjeMyuvIyIpVVz3eOLPRuQi+wi/PmDc5V4kOcNnHKEHq5R5/jcEpcqp7yOp4XfYiFC g5zaeOcCqlvalvf9qpNxXL6x/gcTEP90wKtZpQG7kbNIiuZeM4zi8s/z0jvAEXQKYv+B TxbkPoYtF+2+N08j+/EqniinSDI/owt/lWTi+s6nhwVHry5YSwzdrxyK4IBAD2Q1fKug fKtQ== X-Gm-Message-State: AOJu0Yz38Zh2ODo6rZ8hJunwsa/66UJuQjLd8l80AOFQcb4LPh8C4IsF psCMwcNiT8ukAHKt0/jHd6By8TTuoG+cwFoXFsgA/3SMPIfVdL3qCPH7Y8ToHZHh2zy65bahqHE I X-Received: by 2002:adf:ffcd:0:b0:33d:887c:fe04 with SMTP id x13-20020adfffcd000000b0033d887cfe04mr6512152wrs.19.1709040803925; Tue, 27 Feb 2024 05:33:23 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:23 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/45] include/qom/object.h: New OBJECT_DEFINE_SIMPLE_TYPE{, _WITH_INTERFACES} macros Date: Tue, 27 Feb 2024 13:32:43 +0000 Message-Id: <20240227133314.1721857-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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 We have an OBJECT_DEFINE_TYPE_EXTENDED macro, plus several variations on it, which emits the boilerplate for the TypeInfo and ensures it is registered with the type system. However, all the existing macros insist that the type being defined has its own FooClass struct, so they aren't useful for the common case of a simple leaf class which doesn't have any new methods or any other need for its own class struct (that is, for the kind of type that OBJECT_DECLARE_SIMPLE_TYPE declares). Pull the actual implementation of OBJECT_DEFINE_TYPE_EXTENDED out into a new DO_OBJECT_DEFINE_TYPE_EXTENDED which parameterizes the value we use for the class_size field. This lets us add a new OBJECT_DEFINE_SIMPLE_TYPE which does the same job as the various existing OBJECT_DEFINE_*_TYPE_* family macros for this kind of simple type, and the variant OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES for when the type will implement some interfaces. Reviewed-by: Daniel P. Berrangé Signed-off-by: Peter Maydell Reviewed-by: Michael S. Tsirkin Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-id: 20240220160622.114437-5-peter.maydell@linaro.org Reviewed-by: Zhao Liu --- docs/devel/qom.rst | 34 +++++++++++-- include/qom/object.h | 114 +++++++++++++++++++++++++++++++++---------- 2 files changed, 117 insertions(+), 31 deletions(-) diff --git a/docs/devel/qom.rst b/docs/devel/qom.rst index 9918fac7f21..0889ca949c1 100644 --- a/docs/devel/qom.rst +++ b/docs/devel/qom.rst @@ -348,12 +348,14 @@ used. This does the same as OBJECT_DECLARE_SIMPLE_TYPE(), but without the 'struct MyDeviceClass' definition. To implement the type, the OBJECT_DEFINE macro family is available. -In the simple case the OBJECT_DEFINE_TYPE macro is suitable: +For the simplest case of a leaf class which doesn't need any of its +own virtual functions (i.e. which was declared with OBJECT_DECLARE_SIMPLE_TYPE) +the OBJECT_DEFINE_SIMPLE_TYPE macro is suitable: .. code-block:: c :caption: Defining a simple type - OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) + OBJECT_DEFINE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) This is equivalent to the following: @@ -370,7 +372,6 @@ This is equivalent to the following: .instance_size = sizeof(MyDevice), .instance_init = my_device_init, .instance_finalize = my_device_finalize, - .class_size = sizeof(MyDeviceClass), .class_init = my_device_class_init, }; @@ -385,13 +386,36 @@ This is sufficient to get the type registered with the type system, and the three standard methods now need to be implemented along with any other logic required for the type. +If the class needs its own virtual methods, or has some other +per-class state it needs to store in its own class struct, +then you can use the OBJECT_DEFINE_TYPE macro. This does the +same thing as OBJECT_DEFINE_SIMPLE_TYPE, but it also sets the +class_size of the type to the size of the class struct. + +.. code-block:: c + :caption: Defining a type which needs a class struct + + OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) + If the type needs to implement one or more interfaces, then the -OBJECT_DEFINE_TYPE_WITH_INTERFACES() macro can be used instead. -This accepts an array of interface type names. +OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES() and +OBJECT_DEFINE_TYPE_WITH_INTERFACES() macros can be used instead. +These accept an array of interface type names. The difference between +them is that the former is for simple leaf classes that don't need +a class struct, and the latter is for when you will be defining +a class struct. .. code-block:: c :caption: Defining a simple type implementing interfaces + OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(MyDevice, my_device, + MY_DEVICE, DEVICE, + { TYPE_USER_CREATABLE }, + { NULL }) + +.. code-block:: c + :caption: Defining a type implementing interfaces + OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device, MY_DEVICE, DEVICE, { TYPE_USER_CREATABLE }, diff --git a/include/qom/object.h b/include/qom/object.h index e9ed9550f05..13d3a655ddf 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -258,6 +258,51 @@ struct Object DECLARE_INSTANCE_CHECKER(InstanceType, MODULE_OBJ_NAME, TYPE_##MODULE_OBJ_NAME) +/** + * DO_OBJECT_DEFINE_TYPE_EXTENDED: + * @ModuleObjName: the object name with initial caps + * @module_obj_name: the object name in lowercase with underscore separators + * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators + * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore + * separators + * @ABSTRACT: boolean flag to indicate whether the object can be instantiated + * @CLASS_SIZE: size of the type's class + * @...: list of initializers for "InterfaceInfo" to declare implemented interfaces + * + * This is the base macro used to implement all the OBJECT_DEFINE_* + * macros. It should never be used directly in a source file. + */ +#define DO_OBJECT_DEFINE_TYPE_EXTENDED(ModuleObjName, module_obj_name, \ + MODULE_OBJ_NAME, \ + PARENT_MODULE_OBJ_NAME, \ + ABSTRACT, CLASS_SIZE, ...) \ + static void \ + module_obj_name##_finalize(Object *obj); \ + static void \ + module_obj_name##_class_init(ObjectClass *oc, void *data); \ + static void \ + module_obj_name##_init(Object *obj); \ + \ + static const TypeInfo module_obj_name##_info = { \ + .parent = TYPE_##PARENT_MODULE_OBJ_NAME, \ + .name = TYPE_##MODULE_OBJ_NAME, \ + .instance_size = sizeof(ModuleObjName), \ + .instance_align = __alignof__(ModuleObjName), \ + .instance_init = module_obj_name##_init, \ + .instance_finalize = module_obj_name##_finalize, \ + .class_size = CLASS_SIZE, \ + .class_init = module_obj_name##_class_init, \ + .abstract = ABSTRACT, \ + .interfaces = (InterfaceInfo[]) { __VA_ARGS__ } , \ + }; \ + \ + static void \ + module_obj_name##_register_types(void) \ + { \ + type_register_static(&module_obj_name##_info); \ + } \ + type_init(module_obj_name##_register_types); + /** * OBJECT_DEFINE_TYPE_EXTENDED: * @ModuleObjName: the object name with initial caps @@ -284,32 +329,10 @@ struct Object #define OBJECT_DEFINE_TYPE_EXTENDED(ModuleObjName, module_obj_name, \ MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME, \ ABSTRACT, ...) \ - static void \ - module_obj_name##_finalize(Object *obj); \ - static void \ - module_obj_name##_class_init(ObjectClass *oc, void *data); \ - static void \ - module_obj_name##_init(Object *obj); \ - \ - static const TypeInfo module_obj_name##_info = { \ - .parent = TYPE_##PARENT_MODULE_OBJ_NAME, \ - .name = TYPE_##MODULE_OBJ_NAME, \ - .instance_size = sizeof(ModuleObjName), \ - .instance_align = __alignof__(ModuleObjName), \ - .instance_init = module_obj_name##_init, \ - .instance_finalize = module_obj_name##_finalize, \ - .class_size = sizeof(ModuleObjName##Class), \ - .class_init = module_obj_name##_class_init, \ - .abstract = ABSTRACT, \ - .interfaces = (InterfaceInfo[]) { __VA_ARGS__ } , \ - }; \ - \ - static void \ - module_obj_name##_register_types(void) \ - { \ - type_register_static(&module_obj_name##_info); \ - } \ - type_init(module_obj_name##_register_types); + DO_OBJECT_DEFINE_TYPE_EXTENDED(ModuleObjName, module_obj_name, \ + MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME, \ + ABSTRACT, sizeof(ModuleObjName##Class), \ + __VA_ARGS__) /** * OBJECT_DEFINE_TYPE: @@ -368,6 +391,45 @@ struct Object MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME, \ true, { NULL }) +/** + * OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES: + * @ModuleObjName: the object name with initial caps + * @module_obj_name: the object name in lowercase with underscore separators + * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators + * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore + * separators + * + * This is a variant of OBJECT_DEFINE_TYPE_EXTENDED, which is suitable for + * the case of a non-abstract type, with interfaces, and with no requirement + * for a class struct. + */ +#define OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(ModuleObjName, \ + module_obj_name, \ + MODULE_OBJ_NAME, \ + PARENT_MODULE_OBJ_NAME, ...) \ + DO_OBJECT_DEFINE_TYPE_EXTENDED(ModuleObjName, module_obj_name, \ + MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME, \ + false, 0, __VA_ARGS__) + +/** + * OBJECT_DEFINE_SIMPLE_TYPE: + * @ModuleObjName: the object name with initial caps + * @module_obj_name: the object name in lowercase with underscore separators + * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators + * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore + * separators + * + * This is a variant of OBJECT_DEFINE_TYPE_EXTENDED, which is suitable for + * the common case of a non-abstract type, without any interfaces, and with + * no requirement for a class struct. If you declared your type with + * OBJECT_DECLARE_SIMPLE_TYPE then this is probably the right choice for + * defining it. + */ +#define OBJECT_DEFINE_SIMPLE_TYPE(ModuleObjName, module_obj_name, \ + MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME) \ + OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(ModuleObjName, module_obj_name, \ + MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME, { NULL }) + /** * struct TypeInfo: * @name: The name of the type. From patchwork Tue Feb 27 13:32:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776203 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp157073wro; Tue, 27 Feb 2024 05:37:10 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX2tN6k0a/6JNTDquTn1DVjDmhKQZgn1Y8qiQiJdDwTq4hvYW4gNyMG7gLBMSvG/NkcyKiIJlayFPaLBnepsBp/ X-Google-Smtp-Source: AGHT+IF44MmJlEc7U55YYZhZxf3Db2O8BnIcNr2RLBBwmd0hFA60bk8mSkuqISxJR0Yw4UgE1sio X-Received: by 2002:a1f:c642:0:b0:4cb:2662:3651 with SMTP id w63-20020a1fc642000000b004cb26623651mr6129732vkf.6.1709041030223; Tue, 27 Feb 2024 05:37:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041030; cv=none; d=google.com; s=arc-20160816; b=DpMb+gEavjLkI6IPaV1TjZW889cUvn9BSMD0H2k0nn09kyr/l6gknPlhaFx0mHx0Of r+/M00B44LFiKa9fwtxVxmZoKU4ehQBZkQ8kOVuS/4SEuA7oqXfpOHSJFvYofZBmZd0o 9run3nn4TIU3k9YQM7zVpNRJhh9s0PWsG+DNwW7OPFih7QMiCA3sjeZ9F93IsmjC/jQP VHAMeQr8BbS5OQ6R6GJHaXY2TJ98UpVwjiMJwUmLuKgItgk/Pe+oZHxfS/I7EIvs9b81 cLkzNJ/q969+6yuSNOXdwexAQOwu362bPzAyngASXT3hipfPOrY7EiXLroxjna+rVys1 gnFA== 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=uw8kJ1LxwsE/kFsD2cs5NZmvm6BAwgqD/ImRlmAAIm8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=dvJ6kdWhybPOIZLUwcBgbuyoDwQX3VTBK3JTQSNXB+CdeUYMFu6LGqLP7YV/dDhkUw Msem1lHuWD0RY+tX9/urWzmVdiQwHxr2ty9q+MymLNNX+jhdWWlqjEQUD01gWwV5v8xP NZ2VkuoKDGgmm62JoFAoK9hkmJFTS35ZUF24mWy++pF8srnmJyLKbV6Gd58k5lViVRhC PDRlKp9hz/vwbWHErAgTKxYlydnezEcLez5pcyr711L3ZP5P4UPEaTxYJvmQT1vAbjKf Eqg8zdBiHuCjTnAA4x8/4X96MRRv2ahoX1Y9O0f3tAsv4fzQTKS/XyyrYkN7+YvUz5mc p/8w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WzJI6X+8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a12-20020ac8720c000000b0042c73eda258si7206228qtp.72.2024.02.27.05.37.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:37:10 -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=WzJI6X+8; 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 1rexaj-0000rj-0M; Tue, 27 Feb 2024 08:33: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 1rexaM-0000kG-E1 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:33 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaH-0002sQ-Px for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:28 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-33dc3fe739aso1658912f8f.0 for ; Tue, 27 Feb 2024 05:33:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040804; x=1709645604; 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=uw8kJ1LxwsE/kFsD2cs5NZmvm6BAwgqD/ImRlmAAIm8=; b=WzJI6X+8UNB6N+N4rDnw8fxjuRrzwy6h2rNkxH2I8WRofVD20lFDRDrD8oYCCBa0iC 7rYdcUwNZamz6gsnf4CUXfgq2PoW+yGHzP8MpCLjESJuMf9NpvQPyUWRb9PFdPjltlae HmpHuZ6KxCjgXoq7u4gkVQF8tZNm/PgAfI9+4AVo0PNrHrMduG0MsME/nYAdPnlxNsgz 3Gc5X//tCTTLMAAAdlaOb888ruSBe+tjGnNmkiNHHC4Op8BGEjLK+x4AW2M8vqNlGXv0 LSVVTTxq3bV1UiO2h7f3HI0KaeSpiWJsHvfbB9tTv7R6KYEA0PUbob4Qx3E0A02q07xY inJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040804; x=1709645604; 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=uw8kJ1LxwsE/kFsD2cs5NZmvm6BAwgqD/ImRlmAAIm8=; b=I7hpEv3Z5lj0TsdPzTsdSZzQ0Ef6CKW4k4jyMrdYdQJvzQndnW8ESkbpI7ILsTeXv2 Wc/Go1FtOPd2P4qiMaw12zlxiwBuYUulmnP62KRioVHx43hHWcAGT2fN2vkGPWEQ1CCt maifrE2jcof3zi5+I1vrhIqtYlRgM/gvHuqh5nr6GXrBUKU5VpRstsRj8XFx4qowjvDS OPCqhvceh71M4WsLXiA+OITus9D1s11fycQ26tc36Pg5ouam2EyuJYGvzZfZexRnCL3g saY7wPpNPb9zmolQFhiTtR6vQQdVh2MYlyw7es27EBCYrdZKQPbGpb17U+CIX350rH35 wHpg== X-Gm-Message-State: AOJu0YwIjoTucJZlJ+2r3Z9g8Mh1rQcVpxQzLK8byp+I84p30pmtDMkl 5IpSog9Uk3cZV71u0LITjS3gfkyddPX7nL3JQRT1QqaYEamqYIkNWNe2m2LKe7AIl/DSCB+d1RV M X-Received: by 2002:adf:edc2:0:b0:33d:8c9d:419 with SMTP id v2-20020adfedc2000000b0033d8c9d0419mr9457057wro.24.1709040804424; Tue, 27 Feb 2024 05:33:24 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:24 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/45] hw/core: Add documentation and license comments to reset.h Date: Tue, 27 Feb 2024 13:32:44 +0000 Message-Id: <20240227133314.1721857-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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 Add the usual boilerplate license/copyright comment to reset.h (using the text from reset.c), and document the existing functions. Signed-off-by: Peter Maydell Reviewed-by: Michael S. Tsirkin Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé Message-id: 20240220160622.114437-6-peter.maydell@linaro.org --- include/sysemu/reset.h | 79 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/include/sysemu/reset.h b/include/sysemu/reset.h index 609e4d50c26..658a7e091e6 100644 --- a/include/sysemu/reset.h +++ b/include/sysemu/reset.h @@ -1,3 +1,29 @@ +/* + * Reset handlers. + * + * Copyright (c) 2003-2008 Fabrice Bellard + * Copyright (c) 2016 Red Hat, Inc. + * Copyright (c) 2024 Linaro, Ltd. + * + * 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. + */ + #ifndef QEMU_SYSEMU_RESET_H #define QEMU_SYSEMU_RESET_H @@ -5,9 +31,62 @@ typedef void QEMUResetHandler(void *opaque); +/** + * qemu_register_reset: Register a callback for system reset + * @func: function to call + * @opaque: opaque data to pass to @func + * + * Register @func on the list of functions which are called when the + * entire system is reset. The functions are called in the order in + * which they are registered. + * + * In general this function should not be used in new code where possible; + * for instance, device model reset is better accomplished using the + * methods on DeviceState. + * + * It is not permitted to register or unregister reset functions from + * within the @func callback. + * + * We assume that the caller holds the BQL. + */ void qemu_register_reset(QEMUResetHandler *func, void *opaque); + +/** + * qemu_register_reset_nosnapshotload: Register a callback for system reset + * @func: function to call + * @opaque: opaque data to pass to @func + * + * This is the same as qemu_register_reset(), except that @func is + * not called if the reason that the system is being reset is to + * put it into a clean state prior to loading a snapshot (i.e. for + * SHUTDOWN_CAUSE_SNAPSHOT_LOAD). + */ void qemu_register_reset_nosnapshotload(QEMUResetHandler *func, void *opaque); + +/** + * qemu_unregister_reset: Unregister a system reset callback + * @func: function registered with qemu_register_reset() + * @opaque: the same opaque data that was passed to qemu_register_reset() + * + * Undo the effects of a qemu_register_reset(). The @func and @opaque + * must both match the arguments originally used with qemu_register_reset(). + * + * We assume that the caller holds the BQL. + */ void qemu_unregister_reset(QEMUResetHandler *func, void *opaque); + +/** + * qemu_devices_reset: Perform a complete system reset + * @reason: reason for the reset + * + * This function performs the low-level work needed to do a complete reset + * of the system (calling all the callbacks registered with + * qemu_register_reset()). It should only be called by the code in a + * MachineClass reset method. + * + * If you want to trigger a system reset from, for instance, a device + * model, don't use this function. Use qemu_system_reset_request(). + */ void qemu_devices_reset(ShutdownCause reason); #endif From patchwork Tue Feb 27 13:32:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776201 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp156806wro; Tue, 27 Feb 2024 05:36:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXHU7Q77tIfo5o11zMcZdSQ1lJozMW2Oh3pQqSsOkkrDRMu5k8zXC48psqRC52FIu1lKcXaE+/BKNqzksw2/088 X-Google-Smtp-Source: AGHT+IHDUzrt9OCzlaMmo+PMQ0PpNP3cALYLY+6+uC4Oqg11hGZ6HN0GIAV18eE5CY2NvzpiwsG1 X-Received: by 2002:a05:6871:750c:b0:21e:3d6e:bb85 with SMTP id ny12-20020a056871750c00b0021e3d6ebb85mr10056864oac.0.1709040996643; Tue, 27 Feb 2024 05:36:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709040996; cv=none; d=google.com; s=arc-20160816; b=kxO914+lEwGUAncqyQU5pIzl6sEl3+wtFU2iTdPO9VXZKnlXNkAIGt4HKWeJ1R1Mgy sIQXcci8pQEiPwtxtPscA4PFA4F6uCokif8sghSFRMmHiWl1MSNt8c2nCWhCfXUKRoI4 QEQyRA5LzuOxwsLk5FIlvnuD3O1JQ7eCKQySzFfDt0ksxfVAOkgK8yQ+PgRCo5Li5d/G +yHAJY/hRavx7jQ/ahkw0/ot9AdTKQ5oQJksTNjdUk+z5c82HjVhnObmaR44uuZUMBaI 6noi1KGb+dXvzdRP20fD4uyrKB8M/cYN956cOVHBT2V6ckbyp/I05STxGgWpMJbiRUme A+Kg== 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=EOihe31CmPAbuzzjsksYd8G0LxILYXs9z7dL8tuuTcw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=UsI6ON6Enc3NAnGSGNdqbadCQqFL594tIJpAoL+KpdhUeM2rLfH51zzP0YhnsPYu8o Y8pmUYWS4jNbbHlt4w2KtPA3GGSc8e+feP0+heAvkUHO2d+2TqS22LDs8UuXVS10QbdQ M1LgwuoJvs2gPIBOvQlzqWJmqK+5yq4fRh9YMvrKiU08GIExp5+9iXOyE3riiv3tKTs1 yaf/uUakmxHXiNFj3yqeYyCMhL5juMehvewon8iP+5VZV6Occjfazc8sdDq1O8Ot/yul av3s55k34suLuKaAtPrX+LnQ/mRlGH053Q75D71KEYKflSbzojvd7TXGkHFMIzIKhF+A CpeA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bj1XwZEM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y10-20020ae9f40a000000b007879c17eb3asi7481089qkl.699.2024.02.27.05.36.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:36: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=bj1XwZEM; 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 1rexad-0000pI-7b; Tue, 27 Feb 2024 08:33: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 1rexaM-0000kJ-Gv for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:33 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaI-0002sX-4E for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:28 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-33d754746c3so2868729f8f.1 for ; Tue, 27 Feb 2024 05:33:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040805; x=1709645605; 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=EOihe31CmPAbuzzjsksYd8G0LxILYXs9z7dL8tuuTcw=; b=bj1XwZEMZsuU7ZcZZAx2EEnJKi/6l950+9o0dCOc8fQrtutRC2d8T6wW0oNoogS+cC 57Ey2Dhz+Xi9wqQO194CIBfMx7r25QigCLloX0/RJS1CuLu86+q0IEZp+/k3B8km7bLE a2FyLOU3Vv4V6FA3r38+Yx4+OJsFuGZ8uMaUwTFxoICg5q57hjvZSERlg0tOiM+4WqJX tixrpTsYoOqtCYoFtlkc37HdnfDUssM1pKRoOu38a+uoYDG8hm8Iq5ycAZ2x8Wn3AVtI eJe9aJayrd03hBQ83mIWXy+JcO9p5tuPOnF1jhi4t4yODYSd+VhaPGwYeSxHIN9RUxCJ vuPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040805; x=1709645605; 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=EOihe31CmPAbuzzjsksYd8G0LxILYXs9z7dL8tuuTcw=; b=vcLFx7ESgzIYOsF4b0kcITN/cWUcKbMBdQpkIXza/boMv6EDdK0DbgMGsd1Nrbxd+9 cIiZRroGGIJ95MAEUT04BertBHccm1EyAJF6ReqjdG9qqj1tWKhrJdnRqIxupu1CWpLH on8dqHdZl0Aq8GT8p8UwLhEU3sE01i22DVvdc2KYJXogn05jMWu2UbAflTnsyvRZD3LI rV6SFsxkcwy8s5fY2nvllS4iWYAfp69dICDKBI/S0a41lK5tU0yO+5ZkZB9UVcLxmXci PnJyYOaEDpZw/qS7blqo+pm/goHRXWpCN//C5idl40XivoGAhqN04YtrYA/WF/gIfTnw jxPg== X-Gm-Message-State: AOJu0Yz+C036iXPpTOvB4G8irtSae9B6GbmeEGPsVPm1Jt7xzfEAbS1n 5z1RwQaKhfMs9/LpR3El+Gu7YMpWwceY4t/WcodgeAcRjt33z53Zoj/oGAmxD1iRklirUSeR/3a 3 X-Received: by 2002:adf:ef87:0:b0:33d:a011:ae42 with SMTP id d7-20020adfef87000000b0033da011ae42mr6830316wro.38.1709040804860; Tue, 27 Feb 2024 05:33:24 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:24 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/45] hw/core: Add ResetContainer which holds objects implementing Resettable Date: Tue, 27 Feb 2024 13:32:45 +0000 Message-Id: <20240227133314.1721857-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.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 Implement a ResetContainer. This is a subclass of Object, and it implements the Resettable interface. The container holds a list of arbitrary other objects which implement Resettable, and when the container is reset, all the objects it contains are also reset. This will allow us to have a 3-phase-reset equivalent of the old qemu_register_reset() API: we will have a single "simulation reset" top level ResetContainer, and objects in it are the equivalent of the old QEMUResetHandler functions. The qemu_register_reset() API manages its list of callbacks using a QTAILQ, but here we use a GPtrArray for our list of Resettable children: we expect the "remove" operation (which will need to do an iteration through the list) to be fairly uncommon, and we get simpler code with fewer memory allocations. Since there is currently no listed owner in MAINTAINERS for the existing reset-related source files, create a new section for them, and add these new files there also. Signed-off-by: Peter Maydell Reviewed-by: Michael S. Tsirkin Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé Message-id: 20240220160622.114437-7-peter.maydell@linaro.org Reviewed-by: Zhao Liu --- MAINTAINERS | 10 +++++ include/hw/core/resetcontainer.h | 48 ++++++++++++++++++++ hw/core/resetcontainer.c | 77 ++++++++++++++++++++++++++++++++ hw/core/meson.build | 1 + 4 files changed, 136 insertions(+) create mode 100644 include/hw/core/resetcontainer.h create mode 100644 hw/core/resetcontainer.c diff --git a/MAINTAINERS b/MAINTAINERS index ca97b627188..65dfdc9677e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3676,6 +3676,16 @@ F: hw/core/clock-vmstate.c F: hw/core/qdev-clock.c F: docs/devel/clocks.rst +Reset framework +M: Peter Maydell +S: Maintained +F: include/hw/resettable.h +F: include/hw/core/resetcontainer.h +F: include/sysemu/reset.h +F: hw/core/reset.c +F: hw/core/resettable.c +F: hw/core/resetcontainer.c + Usermode Emulation ------------------ Overall usermode emulation diff --git a/include/hw/core/resetcontainer.h b/include/hw/core/resetcontainer.h new file mode 100644 index 00000000000..23db0c7a880 --- /dev/null +++ b/include/hw/core/resetcontainer.h @@ -0,0 +1,48 @@ +/* + * Reset container + * + * Copyright (c) 2024 Linaro, Ltd + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef HW_RESETCONTAINER_H +#define HW_RESETCONTAINER_H + +/* + * The "reset container" is an object which implements the Resettable + * interface. It contains a list of arbitrary other objects which also + * implement Resettable. Resetting the reset container resets all the + * objects in it. + */ + +#include "qom/object.h" + +#define TYPE_RESETTABLE_CONTAINER "resettable-container" +OBJECT_DECLARE_TYPE(ResettableContainer, ResettableContainerClass, RESETTABLE_CONTAINER) + +/** + * resettable_container_add: Add a resettable object to the container + * @rc: container + * @obj: object to add to the container + * + * Add @obj to the ResettableContainer @rc. @obj must implement the + * Resettable interface. + * + * When @rc is reset, it will reset every object that has been added + * to it, in the order they were added. + */ +void resettable_container_add(ResettableContainer *rc, Object *obj); + +/** + * resettable_container_remove: Remove an object from the container + * @rc: container + * @obj: object to remove from the container + * + * Remove @obj from the ResettableContainer @rc. @obj must have been + * previously added to this container. + */ +void resettable_container_remove(ResettableContainer *rc, Object *obj); + +#endif diff --git a/hw/core/resetcontainer.c b/hw/core/resetcontainer.c new file mode 100644 index 00000000000..e4ece68e83a --- /dev/null +++ b/hw/core/resetcontainer.c @@ -0,0 +1,77 @@ +/* + * Reset container + * + * Copyright (c) 2024 Linaro, Ltd + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +/* + * The "reset container" is an object which implements the Resettable + * interface. It contains a list of arbitrary other objects which also + * implement Resettable. Resetting the reset container resets all the + * objects in it. + */ + +#include "qemu/osdep.h" +#include "hw/resettable.h" +#include "hw/core/resetcontainer.h" + +struct ResettableContainer { + Object parent; + ResettableState reset_state; + GPtrArray *children; +}; + +OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(ResettableContainer, resettable_container, RESETTABLE_CONTAINER, OBJECT, { TYPE_RESETTABLE_INTERFACE }, { }) + +void resettable_container_add(ResettableContainer *rc, Object *obj) +{ + INTERFACE_CHECK(void, obj, TYPE_RESETTABLE_INTERFACE); + g_ptr_array_add(rc->children, obj); +} + +void resettable_container_remove(ResettableContainer *rc, Object *obj) +{ + g_ptr_array_remove(rc->children, obj); +} + +static ResettableState *resettable_container_get_state(Object *obj) +{ + ResettableContainer *rc = RESETTABLE_CONTAINER(obj); + return &rc->reset_state; +} + +static void resettable_container_child_foreach(Object *obj, + ResettableChildCallback cb, + void *opaque, ResetType type) +{ + ResettableContainer *rc = RESETTABLE_CONTAINER(obj); + unsigned int len = rc->children->len; + + for (unsigned int i = 0; i < len; i++) { + cb(g_ptr_array_index(rc->children, i), opaque, type); + /* Detect callbacks trying to unregister themselves */ + assert(len == rc->children->len); + } +} + +static void resettable_container_init(Object *obj) +{ + ResettableContainer *rc = RESETTABLE_CONTAINER(obj); + + rc->children = g_ptr_array_new(); +} + +static void resettable_container_finalize(Object *obj) +{ +} + +static void resettable_container_class_init(ObjectClass *klass, void *data) +{ + ResettableClass *rc = RESETTABLE_CLASS(klass); + + rc->get_state = resettable_container_get_state; + rc->child_foreach = resettable_container_child_foreach; +} diff --git a/hw/core/meson.build b/hw/core/meson.build index 67dad04de55..e26f2e088c3 100644 --- a/hw/core/meson.build +++ b/hw/core/meson.build @@ -4,6 +4,7 @@ hwcore_ss.add(files( 'qdev-properties.c', 'qdev.c', 'reset.c', + 'resetcontainer.c', 'resettable.c', 'vmstate-if.c', # irq.c needed for qdev GPIO handling: From patchwork Tue Feb 27 13:32:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776223 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp160001wro; Tue, 27 Feb 2024 05:44:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWb+TvPS3yHzw1LaSL+SN1500WbnEmR4fBs8ueGjmCIvA8pNPcwlH7iJ5oqg397SezY1ftZtAa0pq2FCmBFiPKp X-Google-Smtp-Source: AGHT+IHJZPvZE7pLi+vFlZLzySI3S02o7NFcWbRnL7/KOw+y6QHJ8MCzJi5gUr3xTF6YOyE0lcRW X-Received: by 2002:a05:6214:230c:b0:68f:ee80:b899 with SMTP id gc12-20020a056214230c00b0068fee80b899mr2715153qvb.5.1709041462755; Tue, 27 Feb 2024 05:44:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041462; cv=none; d=google.com; s=arc-20160816; b=PTlzXn7RCV58m0YlmS1jwN0B4zk8Tul6Uh+8GvcFo57tsGu7odi77G9burlqO+wOVe +4yHI9ics6LeIEVyuEkQHWVCy+zNfZyxGwg/QSKUYY650LEFBBfCpxQTcSwwo8R4ndCA Zjvxqhc0gGft3OKpYee3FqscYbE3kykvq/6ve1Pd+iQAUHQn9KaNZFALFDaVVJ9ow4CO 0upfLoJiT6e67nx6hbAsJCK74NsUqHjWpd6fdVXdg/ESDOw1zHSo9pPNqhlVgvOUIpUX nhU0mETWmpq92UyDH7JHjUmLN0GQSgtRajzY1DJrf6coKV6kOxJ0gzYjygp/8c0y8A5e pXzw== 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=ilSh+qPOLb6HK3mUSSVYVVmXM5u7PDBEkPrdcgdTkNQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=w6WzGNNPofLf2y7Vkm41cLtf8sDL9YDhAxGOGG5vJM5GYb86VSrCOK2h0iq3wTtKPq DOqXSrFH4Z7Bz6p9Yu4nqhltK/k3mgI4ptLZ2+2NPLBBDqZoRPXQztQmR1sZNeficPzN bsVJsKTHIJJ1A07wyGfh/3HeOeXxzyn31MT6Kz3q/HbcOuEUJnVJOxj2tKIbo/2WhEAc Geqxg+BM8R/rLvSKm5JpTyVHKfGKHB6UwW1hjqb/3L9RMiacUnPDokXX1w1QqXMno9zM MW/JLUSFPMV3GgW+EUUatmA0sw65i6jxxIiswibsbqe1rkzNbP1ZwOCaopR5tyv7j1Ix z4UQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ww+SsUrw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u12-20020a0562141c0c00b0068f59455cf3si7478884qvc.606.2024.02.27.05.44.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:44:22 -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=Ww+SsUrw; 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 1rexas-0000z0-2z; Tue, 27 Feb 2024 08:34: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 1rexaM-0000kK-HX for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:33 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaI-0002se-L7 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:28 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-33d9c3f36c2so2335310f8f.2 for ; Tue, 27 Feb 2024 05:33:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040805; x=1709645605; 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=ilSh+qPOLb6HK3mUSSVYVVmXM5u7PDBEkPrdcgdTkNQ=; b=Ww+SsUrwP7Pjwc0E6rL0ieuKhQPMlKsgoe6+jGglfmoZMEUWPJ3JUrSslvCcapAaIp 0JOWYJ77XOiMmzK6od/CXvVlaiorUdIuWMOMuQBsROS4F8FQAUNTafUDT2U7l79gxBqm naR8F+6ZZaM9rzaytgk8OjzGr/QtbIr8MRwmm+3FioBBlyNEN3TXsFbzxmjcDeqMzfm3 KMNjmjdPK3MtWC2hLqUKwQv8TnuIabRdnCSWdd5iXLQZRr/glsS1LfznydJIYt9GmA3i XTLar/l4x0zrIQ6gyT75HIRVXYsfamPTdy1KiTIv4+8xTzh9sr0BhyurnmeHvdUz6lJI RJUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040805; x=1709645605; 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=ilSh+qPOLb6HK3mUSSVYVVmXM5u7PDBEkPrdcgdTkNQ=; b=Y49xTqRrt2jznjInu+Et3vnpYsZ1AuSpal2KsRQHZE61qXR9PzUIMaB8cQ9sgKXjSd bhaIWi+kTI0LhCA0YDgnkGJZEUMooMpwB3TB0WSAxsKssaUNl26kciPevAYvth2jdNEt RBg3c+qxKc4mfltB9BUTxCgjRUCLW1WlxhWwEGOUU2/zloHOEecdHAxpM1V/+u3MIEAt dSx8veKBWIGI7QN2PAeUrIByM+PTePHboaT6amVqvbAcNC6p2rmskzl7NNvGVCTe8C/M HiiwHV4+4qbBSVNkSxNiGWHEOhTF9eqEn1xX2xcJnqT9RIx9Wo45EhlRXRwdS0XDbuXd or5g== X-Gm-Message-State: AOJu0YwGSoONjtij97ZHp2QaxXGzIoKyLsR/3wjXpIpBPiVwubPW6LEZ +BVJT8cVSnf2lkii+YOFAx2kogkFGHB036O2aa4PbUHv9gDavxtrOTOXrA/4iXhbby/N07Ybfpl I X-Received: by 2002:a5d:6e01:0:b0:33d:19fc:c4e9 with SMTP id h1-20020a5d6e01000000b0033d19fcc4e9mr6964005wrz.50.1709040805272; Tue, 27 Feb 2024 05:33:25 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:25 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/45] hw/core/reset: Add qemu_{register, unregister}_resettable() Date: Tue, 27 Feb 2024 13:32:46 +0000 Message-Id: <20240227133314.1721857-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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 Implement new functions qemu_register_resettable() and qemu_unregister_resettable(). These are intended to be three-phase-reset aware equivalents of the old qemu_register_reset() and qemu_unregister_reset(). Instead of passing in a function pointer and opaque, you register any QOM object that implements the Resettable interface. The implementation is simple: we have a single global instance of a ResettableContainer, which we reset in qemu_devices_reset(), and the Resettable objects passed to qemu_register_resettable() are added to it. Signed-off-by: Peter Maydell Reviewed-by: Michael S. Tsirkin Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé Message-id: 20240220160622.114437-8-peter.maydell@linaro.org Reviewed-by: Zhao Liu --- include/sysemu/reset.h | 37 ++++++++++++++++++++++++++++++++++--- hw/core/reset.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 63 insertions(+), 5 deletions(-) diff --git a/include/sysemu/reset.h b/include/sysemu/reset.h index 658a7e091e6..ef2c595e296 100644 --- a/include/sysemu/reset.h +++ b/include/sysemu/reset.h @@ -31,6 +31,36 @@ typedef void QEMUResetHandler(void *opaque); +/** + * qemu_register_resettable: Register an object to be reset + * @obj: object to be reset: it must implement the Resettable interface + * + * Register @obj on the list of objects which will be reset when the + * simulation is reset. These objects will be reset in the order + * they were added, using the three-phase Resettable protocol, + * so first all objects go through the enter phase, then all objects + * go through the hold phase, and then finally all go through the + * exit phase. + * + * It is not permitted to register or unregister reset functions or + * resettable objects from within any of the reset phase methods of @obj. + * + * We assume that the caller holds the BQL. + */ +void qemu_register_resettable(Object *obj); + +/** + * qemu_unregister_resettable: Unregister an object to be reset + * @obj: object to unregister + * + * Remove @obj from the list of objects which are reset when the + * simulation is reset. It must have been previously added to + * the list via qemu_register_resettable(). + * + * We assume that the caller holds the BQL. + */ +void qemu_unregister_resettable(Object *obj); + /** * qemu_register_reset: Register a callback for system reset * @func: function to call @@ -44,8 +74,8 @@ typedef void QEMUResetHandler(void *opaque); * for instance, device model reset is better accomplished using the * methods on DeviceState. * - * It is not permitted to register or unregister reset functions from - * within the @func callback. + * It is not permitted to register or unregister reset functions or + * resettable objects from within the @func callback. * * We assume that the caller holds the BQL. */ @@ -81,7 +111,8 @@ void qemu_unregister_reset(QEMUResetHandler *func, void *opaque); * * This function performs the low-level work needed to do a complete reset * of the system (calling all the callbacks registered with - * qemu_register_reset()). It should only be called by the code in a + * qemu_register_reset() and resetting all the Resettable objects registered + * with qemu_register_resettable()). It should only be called by the code in a * MachineClass reset method. * * If you want to trigger a system reset from, for instance, a device diff --git a/hw/core/reset.c b/hw/core/reset.c index d3263b613e6..a9b30e705fe 100644 --- a/hw/core/reset.c +++ b/hw/core/reset.c @@ -26,8 +26,23 @@ #include "qemu/osdep.h" #include "qemu/queue.h" #include "sysemu/reset.h" +#include "hw/resettable.h" +#include "hw/core/resetcontainer.h" -/* reset/shutdown handler */ +/* + * Return a pointer to the singleton container that holds all the Resettable + * items that will be reset when qemu_devices_reset() is called. + */ +static ResettableContainer *get_root_reset_container(void) +{ + static ResettableContainer *root_reset_container; + + if (!root_reset_container) { + root_reset_container = + RESETTABLE_CONTAINER(object_new(TYPE_RESETTABLE_CONTAINER)); + } + return root_reset_container; +} typedef struct QEMUResetEntry { QTAILQ_ENTRY(QEMUResetEntry) entry; @@ -71,6 +86,16 @@ void qemu_unregister_reset(QEMUResetHandler *func, void *opaque) } } +void qemu_register_resettable(Object *obj) +{ + resettable_container_add(get_root_reset_container(), obj); +} + +void qemu_unregister_resettable(Object *obj) +{ + resettable_container_remove(get_root_reset_container(), obj); +} + void qemu_devices_reset(ShutdownCause reason) { QEMUResetEntry *re, *nre; @@ -83,5 +108,7 @@ void qemu_devices_reset(ShutdownCause reason) } re->func(re->opaque); } -} + /* Reset the simulation */ + resettable_reset(OBJECT(get_root_reset_container()), RESET_TYPE_COLD); +} From patchwork Tue Feb 27 13:32:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776206 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp157154wro; Tue, 27 Feb 2024 05:37:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUUKSWaQsEFiQhQ/n5whALch9SPAy5PmvLAihyKx1JRT34YZszptF2XISHxada9kdVhVfbwamgqr7qk46oSOxpg X-Google-Smtp-Source: AGHT+IF8YRYsd/pC5Ge7WjeywsNhPEhy6+IxHKTD9Nzn5rs6U4tA63g5IDsD+jAj6EwwHW4jnywu X-Received: by 2002:a1f:ed41:0:b0:4c0:1bb6:322 with SMTP id l62-20020a1fed41000000b004c01bb60322mr6186463vkh.15.1709041042325; Tue, 27 Feb 2024 05:37:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041042; cv=none; d=google.com; s=arc-20160816; b=iUtxmbqO+0Z8SAuf/ek4PdrD9EhMWMJjb+w1jyym76WXsWggo9cSsmbYDdbjQGA1eC RPTdqoCzVo/Bkj7i4z7Tj60qtQuD/mLl9jQ41Qrqd8xRxEILkwCgXVa0pQV/Dxx+zaC2 LutIC+ttkGVVHBulT33fEKT95oOfx5gfXlsxeszLAJ7Wm31QzIWLl4LOrbY2v1ObU3+j tBwi5e9bF5xfmt/npr9TNxNqVwC+nzC0Okpxuwma5q+VLLh4Xm6q8xl9TrzLoFcRoaVZ H+18g5CMHSlOWlOp6z9RmIYe11WNgWTmt43XajoH0znM2VV4l9zLQRQ1Z4pUxyFVMAur rtNQ== 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=Y0yOvXCmZjPRMPfLqhxtD1iVg8DnBwRGVH5ryw6y7R8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=UgK695ylukDeL41wY2HaD2MfZBtILZxAd7Hp39HeHkWHkU9+AyCSnJz5+ZrkCyaqgn ysOrIRB1Gf59OaTi+hxG05z9nZMFh+fI3YR5zQeETj7p/Hff7ZV97MVOkdCnQ5GzLteV 0DsYKy49+RVgE2Ay6Q/sJacE6ichaCjs43zJp/atIQqH7fQNoxUHGApmVXrZrAJO4Hof c08MuPVxfjMv9QO3xLjdvdLqMk/v2koNPOrRAqCw3Tr4lydkmyi+VsYTZOrKgfzwME63 fjw1+aDKFDbFgTvxDrzVtvRD7VPFUjqHV4Zbx9cCNDRGUlGCpf7PRn9DIXb2/uJtIig2 HAdw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NEpGAj9D; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f39-20020a05622a1a2700b0042e977c051fsi2134542qtb.537.2024.02.27.05.37.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:37:22 -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=NEpGAj9D; 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 1rexaV-0000md-Ls; Tue, 27 Feb 2024 08:33:39 -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 1rexaM-0000kL-Hw for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:33 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaJ-0002sm-Gu for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:29 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-33da51fd636so2564828f8f.3 for ; Tue, 27 Feb 2024 05:33:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040806; x=1709645606; 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=Y0yOvXCmZjPRMPfLqhxtD1iVg8DnBwRGVH5ryw6y7R8=; b=NEpGAj9DECeE8LBYbtQ18Q6AQNxtZl+9X1sSDJyo7OrC9AGJtIr3Ve6Gsn0oY/KVXN I7O1kXPq0LetunyjA6HQndzWutE+TvofMoJ9soTxsTU3hWnuXm8nQM3EzN7S0pgpN6LJ j5CUTRfuOIEm0eG+moUR6q/oh2bIqySAu6EOvNhn+ncEkogbSER1+/IxP6mR2LHQ8cI0 HX+UyB8EZ5xe811OiGy66GovcRvBkCKawB44fF17SBn3YxFtu8LtY0pW8CCiTS0WHtvc ThkuNxEXhUa4JTcHiurmiyRIvpwscDFEjisblxuleCCeVt94TUMNx42puTbeCAN4gBP9 /D4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040806; x=1709645606; 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=Y0yOvXCmZjPRMPfLqhxtD1iVg8DnBwRGVH5ryw6y7R8=; b=Ujr34ncF6zwNyfxhUzPrDU8AHaj8ctqbVN2lvj07Pz7bh7vOboiz0cLhxaZ706FZN3 z3aIAqVAuFycTR82Mmv/t+J+Wp5BNTPhXuNOPm+LdawM2K/S5+O6jmbeptRvOGkMCrR8 R+wUlDglZQCnRz2qbYU1ycAHLIN+CGyKy8hZb4k8RWkU9zmQMEHIZpd1c76cCluWTtRs 18St2+rzvTW+j7cVVsO65Ed0kCjDKLlcTscrFskbviMeJOdQ0vvbHin2cfDw/eUZVV4A TX1Ga594eocJEgI3mx8x9BzkLry7zQs6yY4E06cIdNaAjUwADDTHObjneAtMt7w1Hbow grDA== X-Gm-Message-State: AOJu0YxBXesvhJbkATtcYycxuoplTKnyTz6ivvA89AQ1MBMbeLSaYYfL vab4bs6B3AM/Y7ITXd7DtILO/8Qwy3N3XZghSypdJlABLfxqRjCqgMmvJfZjGJlpHscU9hzjJ7O H X-Received: by 2002:a5d:6346:0:b0:33b:302:c08 with SMTP id b6-20020a5d6346000000b0033b03020c08mr6739890wrw.43.1709040805783; Tue, 27 Feb 2024 05:33:25 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:25 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/45] hw/core/reset: Implement qemu_register_reset via qemu_register_resettable Date: Tue, 27 Feb 2024 13:32:47 +0000 Message-Id: <20240227133314.1721857-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.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 Reimplement qemu_register_reset() via qemu_register_resettable(). We define a new LegacyReset object which implements Resettable and defines its reset hold phase method to call a QEMUResetHandler function. When qemu_register_reset() is called, we create a new LegacyReset object and add it to the simulation_reset ResettableContainer. When qemu_unregister_reset() is called, we find the LegacyReset object in the container and remove it. This implementation of qemu_unregister_reset() means we'll end up scanning the ResetContainer's list of child objects twice, once to find the LegacyReset object, and once in g_ptr_array_remove(). In theory we could avoid this by having the ResettableContainer interface include a resettable_container_remove_with_equal_func() that took a callback method so that we could use g_ptr_array_find_with_equal_func() and g_ptr_array_remove_index(). But we don't expect qemu_unregister_reset() to be called frequently or in hot paths, and we expect the simulation_reset container to usually not have many children. Signed-off-by: Peter Maydell Reviewed-by: Michael S. Tsirkin Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé Message-id: 20240220160622.114437-9-peter.maydell@linaro.org Reviewed-by: Zhao Liu --- include/sysemu/reset.h | 7 ++- hw/core/reset.c | 137 +++++++++++++++++++++++++++++++---------- 2 files changed, 110 insertions(+), 34 deletions(-) diff --git a/include/sysemu/reset.h b/include/sysemu/reset.h index ef2c595e296..ae436044a92 100644 --- a/include/sysemu/reset.h +++ b/include/sysemu/reset.h @@ -67,8 +67,11 @@ void qemu_unregister_resettable(Object *obj); * @opaque: opaque data to pass to @func * * Register @func on the list of functions which are called when the - * entire system is reset. The functions are called in the order in - * which they are registered. + * entire system is reset. Functions registered with this API and + * Resettable objects registered with qemu_register_resettable() are + * handled together, in the order in which they were registered. + * Functions registered with this API are called in the 'hold' phase + * of the 3-phase reset. * * In general this function should not be used in new code where possible; * for instance, device model reset is better accomplished using the diff --git a/hw/core/reset.c b/hw/core/reset.c index a9b30e705fe..d50da7e3041 100644 --- a/hw/core/reset.c +++ b/hw/core/reset.c @@ -24,7 +24,6 @@ */ #include "qemu/osdep.h" -#include "qemu/queue.h" #include "sysemu/reset.h" #include "hw/resettable.h" #include "hw/core/resetcontainer.h" @@ -44,45 +43,128 @@ static ResettableContainer *get_root_reset_container(void) return root_reset_container; } -typedef struct QEMUResetEntry { - QTAILQ_ENTRY(QEMUResetEntry) entry; +/* + * Reason why the currently in-progress qemu_devices_reset() was called. + * If we made at least SHUTDOWN_CAUSE_SNAPSHOT_LOAD have a corresponding + * ResetType we could perhaps avoid the need for this global. + */ +static ShutdownCause device_reset_reason; + +/* + * This is an Object which implements Resettable simply to call the + * callback function in the hold phase. + */ +#define TYPE_LEGACY_RESET "legacy-reset" +OBJECT_DECLARE_SIMPLE_TYPE(LegacyReset, LEGACY_RESET) + +struct LegacyReset { + Object parent; + ResettableState reset_state; QEMUResetHandler *func; void *opaque; bool skip_on_snapshot_load; -} QEMUResetEntry; +}; -static QTAILQ_HEAD(, QEMUResetEntry) reset_handlers = - QTAILQ_HEAD_INITIALIZER(reset_handlers); +OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(LegacyReset, legacy_reset, LEGACY_RESET, OBJECT, { TYPE_RESETTABLE_INTERFACE }, { }) + +static ResettableState *legacy_reset_get_state(Object *obj) +{ + LegacyReset *lr = LEGACY_RESET(obj); + return &lr->reset_state; +} + +static void legacy_reset_hold(Object *obj) +{ + LegacyReset *lr = LEGACY_RESET(obj); + + if (device_reset_reason == SHUTDOWN_CAUSE_SNAPSHOT_LOAD && + lr->skip_on_snapshot_load) { + return; + } + lr->func(lr->opaque); +} + +static void legacy_reset_init(Object *obj) +{ +} + +static void legacy_reset_finalize(Object *obj) +{ +} + +static void legacy_reset_class_init(ObjectClass *klass, void *data) +{ + ResettableClass *rc = RESETTABLE_CLASS(klass); + + rc->get_state = legacy_reset_get_state; + rc->phases.hold = legacy_reset_hold; +} void qemu_register_reset(QEMUResetHandler *func, void *opaque) { - QEMUResetEntry *re = g_new0(QEMUResetEntry, 1); + Object *obj = object_new(TYPE_LEGACY_RESET); + LegacyReset *lr = LEGACY_RESET(obj); - re->func = func; - re->opaque = opaque; - QTAILQ_INSERT_TAIL(&reset_handlers, re, entry); + lr->func = func; + lr->opaque = opaque; + qemu_register_resettable(obj); } void qemu_register_reset_nosnapshotload(QEMUResetHandler *func, void *opaque) { - QEMUResetEntry *re = g_new0(QEMUResetEntry, 1); + Object *obj = object_new(TYPE_LEGACY_RESET); + LegacyReset *lr = LEGACY_RESET(obj); - re->func = func; - re->opaque = opaque; - re->skip_on_snapshot_load = true; - QTAILQ_INSERT_TAIL(&reset_handlers, re, entry); + lr->func = func; + lr->opaque = opaque; + lr->skip_on_snapshot_load = true; + qemu_register_resettable(obj); +} + +typedef struct FindLegacyInfo { + QEMUResetHandler *func; + void *opaque; + LegacyReset *lr; +} FindLegacyInfo; + +static void find_legacy_reset_cb(Object *obj, void *opaque, ResetType type) +{ + LegacyReset *lr; + FindLegacyInfo *fli = opaque; + + /* Not everything in the ResettableContainer will be a LegacyReset */ + lr = LEGACY_RESET(object_dynamic_cast(obj, TYPE_LEGACY_RESET)); + if (lr && lr->func == fli->func && lr->opaque == fli->opaque) { + fli->lr = lr; + } +} + +static LegacyReset *find_legacy_reset(QEMUResetHandler *func, void *opaque) +{ + /* + * Find the LegacyReset with the specified func and opaque, + * by getting the ResettableContainer to call our callback for + * every item in it. + */ + ResettableContainer *rootcon = get_root_reset_container(); + ResettableClass *rc = RESETTABLE_GET_CLASS(rootcon); + FindLegacyInfo fli; + + fli.func = func; + fli.opaque = opaque; + fli.lr = NULL; + rc->child_foreach(OBJECT(rootcon), find_legacy_reset_cb, + &fli, RESET_TYPE_COLD); + return fli.lr; } void qemu_unregister_reset(QEMUResetHandler *func, void *opaque) { - QEMUResetEntry *re; + Object *obj = OBJECT(find_legacy_reset(func, opaque)); - QTAILQ_FOREACH(re, &reset_handlers, entry) { - if (re->func == func && re->opaque == opaque) { - QTAILQ_REMOVE(&reset_handlers, re, entry); - g_free(re); - return; - } + if (obj) { + qemu_unregister_resettable(obj); + object_unref(obj); } } @@ -98,16 +180,7 @@ void qemu_unregister_resettable(Object *obj) void qemu_devices_reset(ShutdownCause reason) { - QEMUResetEntry *re, *nre; - - /* reset all devices */ - QTAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) { - if (reason == SHUTDOWN_CAUSE_SNAPSHOT_LOAD && - re->skip_on_snapshot_load) { - continue; - } - re->func(re->opaque); - } + device_reset_reason = reason; /* Reset the simulation */ resettable_reset(OBJECT(get_root_reset_container()), RESET_TYPE_COLD); From patchwork Tue Feb 27 13:32:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776221 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp159931wro; Tue, 27 Feb 2024 05:44:12 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXvoB7nt5PKALm0wwS/3RsU2VsrQQVxSOK0oSy8JILnJfhibFLxIpcgi5Z/CF0J9FQ6SkFMJxbEMnxP2dZj5ISh X-Google-Smtp-Source: AGHT+IE0YZeEvXOrHnIWXcxnlZWloYCmzcGjqZaQWM4FRKNdcmJ3DvficCR93/4AzGo/ZwQvJkar X-Received: by 2002:a05:620a:29c8:b0:787:e5ed:4fb7 with SMTP id s8-20020a05620a29c800b00787e5ed4fb7mr1914314qkp.25.1709041452335; Tue, 27 Feb 2024 05:44:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041452; cv=none; d=google.com; s=arc-20160816; b=Qr4ml5o3v9M8JKci+ze2eqaRw/n4CCxu0SmccJ0PfhWneqLuwKwPKDcP15fAxzMYth pDtXJZD0S0NMhSZpEMtzLIhsdf78cMEKNoVLE5WssornWMOlrSqq2cQFY/CtGCaaurr7 wjDb8o489jjucXLl8kRmAunFaLG0CAtlONrORb913Tqp+NQ9wKG7QWbts7N2gd/r+ggl roEjK8EH/xiRm5EllUDVZ5Npm4Djq5XW9ta2bsDWsaeLFIskV68jAa/RsFD0HPqpoo+T vfSeGh8gNDfPK3xHeWWVfFHiZuDWhzU6ttN3+apKpmPMW4CIAaxtheqZvfwENBxlOtgL 514g== 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=Ot/DCCzfEEMRuguhLsrlbJKXVHIQGJaIdaEMWlsQRG0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=eYYorrnez42WrNTEWThBs7OVqq9VUWOEt+3hlC9ba7YP6ihrRZCE7U28sVDe8z++sl L6/k/GFSJJG3k0A02L7iVOb6ZGIKN2z37RoeayyurdTqCf2LodJRUxNXVElZxeGZD+g+ /OFWXM4N5i0V8FYp5+gV89AIkik4W3e/d356hNaqZHMDFBM3SUzjUJF7kkUaKDoS+DO9 vI/P80naqDtdhUdcEpOhO4NAJJMhy6TBuMr3Q2jI0bzu8vp8rdADI1m/kiijVf26x9hV xtoibdky8+RVJW1qcDs0zG2QxfX1fVxglPahgwPtdQFF55xKUq6h7Vse58Xhxa77HPx/ Dakg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pCudQqde; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c27-20020a05620a135b00b00787b9fa616bsi7445279qkl.441.2024.02.27.05.44.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:44:12 -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=pCudQqde; 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 1rexap-0000uD-7a; Tue, 27 Feb 2024 08:34:00 -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 1rexaO-0000ki-Os for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:33 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaJ-0002sv-QZ for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:32 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-33aeb088324so2734232f8f.2 for ; Tue, 27 Feb 2024 05:33:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040806; x=1709645606; 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=Ot/DCCzfEEMRuguhLsrlbJKXVHIQGJaIdaEMWlsQRG0=; b=pCudQqdelax8+ox6iak4SBF2V2rVDwKPaTxVXr9RY5xadj/CB6ho0uXE/HDno54h6Y JnX6EHnDq/+sAJXex5jfqET8cVs4vHy9bf5cMwy6FMyRpbOwqOpxyh+zn3HDHcuVkCmz 3Vji4VP1hGWHCC04Pi5drTwFE5c8cqEWkZP775wFMWvD+LPWCIBOlpblr8S83xIG9Ghh hG18Bi9JZH+01c8PkdrpcI1nPy7JDkWp8uuF9HJKrkk+nfV4MeenY3pBNclHwZ5C0DKi rWInY18FVkOJCPbB4eBwFQrBQOIA6FgHd/SFBdg+HhWIhKCm1fsLQRqtawIS7u0JFj7T FI/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040806; x=1709645606; 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=Ot/DCCzfEEMRuguhLsrlbJKXVHIQGJaIdaEMWlsQRG0=; b=UKfzFobq2Y5J1Syh1vet1IbP6KjX4o4JIxa9mxvydqgTHtS1NRqp+vAt/CKJUtrngj 8JfSh2kMWC6LBiXk5sovhGEessLS2qsJhyHLJwdeUc5+J+zTtqy+Wr9Ry5C5u3jHDW5z L/R0rNfx4eb6aBS9j5VdhS/WmAg1gMe2JsrAuX/mlT4urd7OcvmkYvo+YtgGoeaKR5DE c84p5IvkAcDnIhLrJ9zb9woyzKin0BPr1wRA7u1PInL9i/6e9FmG5k56+73weJADR4lh vioNzT+kNacnfroq+SkmTsv8xdaOULVbyyACgptouYtpygceyUGJpI8SeFL8Dvlpjxep aEwQ== X-Gm-Message-State: AOJu0YzvWqXamI0beG2XbSoZm6p3PqxUalbqXNJtqvGLApoSnkuAoH7+ 3YbvFlq5cjo+H40pVd+zlUBHTbjQjK+LsMER2g5xSG6zjNCVpyFc7yHg9jHTaf/msIR9w6xfMMh X X-Received: by 2002:adf:d1ca:0:b0:33d:f46f:6384 with SMTP id b10-20020adfd1ca000000b0033df46f6384mr994495wrd.23.1709040806229; Tue, 27 Feb 2024 05:33:26 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:26 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/45] hw/core/machine: Use qemu_register_resettable for sysbus reset Date: Tue, 27 Feb 2024 13:32:48 +0000 Message-Id: <20240227133314.1721857-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_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 Move the reset of the sysbus (and thus all devices and buses anywhere on the qbus tree) from qemu_register_reset() to qemu_register_resettable(). This is a behaviour change: because qemu_register_resettable() is aware of three-phase reset, this now means that: * 'enter' phase reset methods of devices and buses are called before any legacy reset callbacks registered with qemu_register_reset() * 'exit' phase reset methods of devices and buses are called after any legacy qemu_register_reset() callbacks Put another way, a qemu_register_reset() callback is now correctly ordered in the 'hold' phase along with any other 'hold' phase methods. The motivation for doing this is that we will now be able to resolve some reset-ordering issues using the three-phase mechanism, because the 'exit' phase is always after the 'hold' phase, even when the 'hold' phase function was registered with qemu_register_reset(). Signed-off-by: Peter Maydell Reviewed-by: Michael S. Tsirkin Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé Message-id: 20240220160622.114437-10-peter.maydell@linaro.org Reviewed-by: Zhao Liu --- hw/core/machine.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index fb5afdcae4c..9ac5d5389a6 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1577,14 +1577,13 @@ void qdev_machine_creation_done(void) /* TODO: once all bus devices are qdevified, this should be done * when bus is created by qdev.c */ /* - * TODO: If we had a main 'reset container' that the whole system - * lived in, we could reset that using the multi-phase reset - * APIs. For the moment, we just reset the sysbus, which will cause + * This is where we arrange for the sysbus to be reset when the + * whole simulation is reset. In turn, resetting the sysbus will cause * all devices hanging off it (and all their child buses, recursively) * to be reset. Note that this will *not* reset any Device objects * which are not attached to some part of the qbus tree! */ - qemu_register_reset(resettable_cold_reset_fn, sysbus_get_default()); + qemu_register_resettable(OBJECT(sysbus_get_default())); notifier_list_notify(&machine_init_done_notifiers, NULL); From patchwork Tue Feb 27 13:32:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776199 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp156294wro; Tue, 27 Feb 2024 05:35:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWK5hvrfJBzCFRpGPh10URvePGgA8NVG8gazR8Mg7KWZ77vR3SUGZEI1brO0HkL3nD1qXE2J0e0RYbqoEFhlRY3 X-Google-Smtp-Source: AGHT+IFWXO9+Qt+sVkRLgY4X+8oIiI5sZ77l9Z7gb7QoBwN0Bif06Y1uqB0EIqlcApX7NL7dSRoQ X-Received: by 2002:a05:6358:2a1:b0:178:c7e1:52ba with SMTP id w33-20020a05635802a100b00178c7e152bamr11983636rwj.20.1709040928307; Tue, 27 Feb 2024 05:35:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709040928; cv=none; d=google.com; s=arc-20160816; b=T6OFrhf1/c5c7quqq1m3PAccZ2sYvQUWm732lHolPbXnJVWaUwVOGXUKUO6m7DJUwd aSiBV/X4mE0sDhSmVyRoc+/mAUjRqNqsCuqGheaPml0ZLD8gATrrLaFcZNw7WDj2Jh/e 1+vXW7/vr6oax8nQZjbs4ckOOK7uTaLqw0n2GLpDVgqYSMpLNMlUtlXeRFmpNDe3m5Eh 6eCaZ5T1YA9fOwAWbUfpo0Qz1Ca1tzwPDXO+TPGEam3WSPte/ZVBzcoP7S2N7fBMiH82 8S028Rp3ndb1eVEVTbfNlRSpzWEpk4Sv3BiBNyHtKqvIybHMkdgv1VXmU8fy8dQ4eKYN djMg== 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=3VIFnDGKGpENbZj1Zia/ChGLWB8xWLzUdNndb0QJxO4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Znb2cWtOAo8imwoCE38JLB7J+O1hxB4Oj2J+ZCS0b7y8xjVLe2kPgNjAVfj50kZ6xj epCUjBZHaOHPlMyWdQTieASUGf9vALcoILzamK1V6UfuDOLvgLyZugk57UhczRVxfUdV +yFTuSmY9LgaNakqupggX2akRKtFXtMEc6IR/mq4duGlWRED2rbkMIzT8lG2dp0UbGFt Ys9aIOdgXSDCLJ5UwO0stl07vrFVGq7bDo40rUHk6UOPZJTQ25KJ1OknGiuYlogyLj6G dnGgYieH68uNgNG3/2+josWH0rKP8mDhQHOJT8/yk+Vptt8VYVFjD8MN8PM6apC7Zcd+ hh8w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IFGCbVLk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f30-20020a05620a20de00b007856e7734e9si7467498qka.366.2024.02.27.05.35.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:35:28 -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=IFGCbVLk; 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 1rexaj-0000rn-1m; Tue, 27 Feb 2024 08:33: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 1rexaU-0000mJ-O7 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:39 -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 1rexaK-0002t6-T0 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:36 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-412a14299a4so21619595e9.1 for ; Tue, 27 Feb 2024 05:33:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040806; x=1709645606; 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=3VIFnDGKGpENbZj1Zia/ChGLWB8xWLzUdNndb0QJxO4=; b=IFGCbVLk00rMQQuJ1Zs404pbIJPnhSqUHuM2ri6FN0jejX8UyYYAvnBe/21nfPtz28 I3+AElqqJXM7MjnM8IQwBAoBuCa/XexK2fCdtEcKWVE4e9mAMZANtTO8J+i0OGnOszRW myzDyH6tDic0icNGEi+bH9vsIeY16ArOxGiWbkwHLoQnSKujYD3rjqiJhsKDjiYU6nsv wKGybBvjFlPpYxOUiMqPEcBILnM2Gpystzx0rfhjlwTQvXbgVUzFPWF9YtKTRzKMRiW5 giKJYn775zWsLVNjalNPGCgaMa3M0fNINdkM/zJaV+9kkHPfspQiWXwfn6Yf1luvfhUb 4smA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040806; x=1709645606; 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=3VIFnDGKGpENbZj1Zia/ChGLWB8xWLzUdNndb0QJxO4=; b=h2IiZxC5MsXddv/PFlB3yE4JuXBBmQWZ2g54c9DY3gql5bd+yNXQXamvIeP+0icas0 zWO6a0tGOKyKYbQGu09cBEmzY3FkippzGRSo3Ro2HUOgu6IebHj0kcalbzYI/qd0Sidw 8mp3ennH1/2fLl5NfAdVTftu/G0VQDkGP0NR5rGfFsR9k8YZSWNviclmQwbGKdpEUD7a ydQNkFu5NHQHT25COaMLyFNtG8hhT2sUJZVPYsmpmGz2wiF3EYuzI6CbN0v+joLEJs84 toQaISotqClwVWt0zNOcxxXm9Rsj5/uj33N9LDJ4IAtPankx5Y9qETei2I5DdXmwmeEU 84OQ== X-Gm-Message-State: AOJu0Yy6DODepD/J4NagwitJ+CApz1e1x3BRPFpHCIaFO4HCcE5oQHag EIz6CkJ2mLknkNfJD0QdBmO3XFR3rv+SW1v99TEBTfkxWkHx3qB7qA4k4TbJ19xv9QNk44jr/mS j X-Received: by 2002:a05:6000:229:b0:33d:2f2f:b135 with SMTP id l9-20020a056000022900b0033d2f2fb135mr5913823wrz.46.1709040806651; Tue, 27 Feb 2024 05:33:26 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:26 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/45] docs/devel/reset: Update to discuss system reset Date: Tue, 27 Feb 2024 13:32:49 +0000 Message-Id: <20240227133314.1721857-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-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 Now that system reset uses a three-phase-reset, update the reset documentation to include a section describing how this works. Include documentation of the current major beartrap in reset, which is that only devices on the qbus tree will get automatically reset. Signed-off-by: Peter Maydell Reviewed-by: Michael S. Tsirkin Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé Message-id: 20240220160622.114437-11-peter.maydell@linaro.org Reviewed-by: Zhao Liu --- docs/devel/reset.rst | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/docs/devel/reset.rst b/docs/devel/reset.rst index d4e79718bac..2ea85e7779b 100644 --- a/docs/devel/reset.rst +++ b/docs/devel/reset.rst @@ -11,8 +11,8 @@ whole group can be reset consistently. Each individual member object does not have to care about others; in particular, problems of order (which object is reset first) are addressed. -As of now DeviceClass and BusClass implement this interface. - +The main object types which implement this interface are DeviceClass +and BusClass. Triggering reset ---------------- @@ -288,3 +288,43 @@ There is currently 2 cases where this function is used: 2. *hot bus change*; it means an existing live device is added, moved or removed in the bus hierarchy. At the moment, it occurs only in the raspi machines for changing the sdbus used by sd card. + +Reset of the complete system +---------------------------- + +Reset of the complete system is a little complicated. The typical +flow is: + +1. Code which wishes to reset the entire system does so by calling + ``qemu_system_reset_request()``. This schedules a reset, but the + reset will happen asynchronously after the function returns. + That makes this safe to call from, for example, device models. + +2. The function which is called to make the reset happen is + ``qemu_system_reset()``. Generally only core system code should + call this directly. + +3. ``qemu_system_reset()`` calls the ``MachineClass::reset`` method of + the current machine, if it has one. That method must call + ``qemu_devices_reset()``. If the machine has no reset method, + ``qemu_system_reset()`` calls ``qemu_devices_reset()`` directly. + +4. ``qemu_devices_reset()`` performs a reset of the system, using + the three-phase mechanism listed above. It resets all objects + that were registered with it using ``qemu_register_resettable()``. + It also calls all the functions registered with it using + ``qemu_register_reset()``. Those functions are called during the + "hold" phase of this reset. + +5. The most important object that this reset resets is the + 'sysbus' bus. The sysbus bus is the root of the qbus tree. This + means that all devices on the sysbus are reset, and all their + child buses, and all the devices on those child buses. + +6. Devices which are not on the qbus tree are *not* automatically + reset! (The most obvious example of this is CPU objects, but + anything that directly inherits from ``TYPE_OBJECT`` or ``TYPE_DEVICE`` + rather than from ``TYPE_SYS_BUS_DEVICE`` or some other plugs-into-a-bus + type will be in this category.) You need to therefore arrange for these + to be reset in some other way (e.g. using ``qemu_register_resettable()`` + or ``qemu_register_reset()``). From patchwork Tue Feb 27 13:32:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776225 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp160256wro; Tue, 27 Feb 2024 05:44:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUA4+guEFS4y1L/1FHNjGW4ecaHPB0cOMsTOCWh/0C7SH7B+mSOIbXuSKYi1pu5AImdtUqfm0/ulvG3oQOea35q X-Google-Smtp-Source: AGHT+IEaViY/m10ZgKlt1qIbLW4t84z+55b/bcsJFr//RazqWZ9t/HrTaKB+6/UDU86eFTRVbi8X X-Received: by 2002:a05:620a:4905:b0:785:9f2e:d171 with SMTP id vy5-20020a05620a490500b007859f2ed171mr1960389qkn.74.1709041495686; Tue, 27 Feb 2024 05:44:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041495; cv=none; d=google.com; s=arc-20160816; b=wLVKQJT4RC0ejQp7szPWqouY3gkjl0OALuqed2gC36uaFyYLVaih3huOMB4TZyNwM6 k9WNdB9mX/F+c9mttBBYXw2eCbqUYXQTksSHTO/3nX/ASMrzRsuXtbE6Q+2Au2EqKaUW 41cMdOrOTzUrnirmoWEJin6qeSWppxZ2oixgV7UROztSdyUCehCNxZh0IrcJT2EvrXFl ELQ0xM12YKj/Xw174MPV45ByN7nres44Ke/lJRoyyJgM7sOnybyhsyLKu7jM5UrfrP7e hnj98KIJgjn8TxgqtYw638PTgpfnIi+AnwBOLwnemeqVJOIeUjAg23IbvuAP5IBVpmH7 y1gA== 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=nhQiuyLJpAq1vLwFSWusjZL3a6cFkvxC3fYX6R+2IFw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=QEyXkVYk4puMDyrKi8Ig7Mafdh0hKM6v0MrRAm0/wu6hWB2G48SppLP63MARCcrC0O VJ8zrq4hEUR8iTvDfB4eX/kjIJ7AB2VjJkuXrlyJmp1TA97/sBvYF0NvRMRWIuWwP9wf 4DTvQs3LF6fcal2mjnbmF0MDz11uVWuDD8WdWP01Y0S84Op01zXCsoGoqpEz4KpKm3bb TdWdpl4TfO9NREDbZtATjnMQcnDlC+U14IrTTclQshbl9AbpFxAIFcMA225ag+KJ5Khm wr9zSgA/kxJ7W1PvaJLJiHbUqzynMR1TOvpsWDi8+8KvRNpIE0ZN5TMAhrQMqx/vSr27 xvQw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jUWCzlVJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g10-20020a05620a108a00b007871f6a476fsi7301514qkk.402.2024.02.27.05.44.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:44: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=jUWCzlVJ; 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 1rexaq-0000vG-N5; Tue, 27 Feb 2024 08:34:00 -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 1rexaO-0000kh-Nz for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:33 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaM-0002tM-A5 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:32 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-33de64c91abso799118f8f.1 for ; Tue, 27 Feb 2024 05:33:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040807; x=1709645607; 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=nhQiuyLJpAq1vLwFSWusjZL3a6cFkvxC3fYX6R+2IFw=; b=jUWCzlVJfa1h6uqgdvpaCbJEU375/pEZthQ7bBCeuencVsqrvquVMxKt3KZ9gLtQdx zzg0xTavRe0Q9QoqLaCN4logge1a9PGiifoXRpJcaYJ4EBJ8/lazf1fME3rZ1uo0NPc3 m5MtZHUkJeQKLykze7eMFvSJr2oOUbTQ2Mm+F9NxY//azCZvDYarvmkRZWJYxMaSBNti Wa8GAKF9GfY4gqrjRFA+r2PmgUM3R3zv27hbLcJee8UvHfZeGQOVwej1ndki/O0W8jVt hM8RrDuIVD3cQCOhwIMVg0rh2w8Jwlp4/P/Gf4SkXUzFS8uy77YJkA4cJp+bYHKL4tQ6 ShxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040807; x=1709645607; 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=nhQiuyLJpAq1vLwFSWusjZL3a6cFkvxC3fYX6R+2IFw=; b=JteZViazJuGTstZmv6kFmv6BhlqaPBeOfApZCiGwppIegdO6pKata4y8Z+FMYBURIg DDEHbPix/vrIkDdJT6Fo7BLN7iVDQHRNg8eWlOssk/WPCju3l91Zjb/iIp8bYvthEzEO 9pHWDzY6SoaYZTcWGp0VkKSIHyWOSWiFkO+XbMKApn17eHNjuJ8BzPVfjpludUkYhqGO cpVM9Gyphcea0mIraHOootM+9Y1faTulBd3LEnXc8lXPa1P3EaikIDX/VGbeO8PA5zhX cmXFycAVuR+AClXaP3cfgvhz4pXQIyjR59zkbZZfJDh9Qsg2m3eDlKM9p/PZRU+gtcGk UPgQ== X-Gm-Message-State: AOJu0YxnoSZlPyRrdWqkk8qxFKWtjj7veWI7zwN9Q2NWjm/6Kq1aGLKa uyy8QYIi6F5iHjSY6L0JMJQ7fNTCx/WV/Iqorm/rNJIHfzD0itx9e568NEiFj37qG6VL0FEHZp5 o X-Received: by 2002:adf:f891:0:b0:33d:82c5:3b76 with SMTP id u17-20020adff891000000b0033d82c53b76mr7233100wrp.14.1709040807097; Tue, 27 Feb 2024 05:33:27 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:26 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/45] hw/arm/bcm2836: Split out common part of BCM283X classes Date: Tue, 27 Feb 2024 13:32:50 +0000 Message-Id: <20240227133314.1721857-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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: Sergey Kambalin Pre setup for BCM2838 introduction Signed-off-by: Sergey Kambalin Reviewed-by: Peter Maydell Message-id: 20240226000259.2752893-2-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell --- include/hw/arm/bcm2836.h | 26 +++++++++- hw/arm/bcm2836.c | 103 ++++++++++++++++++++++----------------- hw/arm/raspi.c | 2 +- 3 files changed, 84 insertions(+), 47 deletions(-) diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h index 6f90cabfa3a..5a6717ca91e 100644 --- a/include/hw/arm/bcm2836.h +++ b/include/hw/arm/bcm2836.h @@ -17,8 +17,10 @@ #include "target/arm/cpu.h" #include "qom/object.h" +#define TYPE_BCM283X_BASE "bcm283x-base" +OBJECT_DECLARE_TYPE(BCM283XBaseState, BCM283XBaseClass, BCM283X_BASE) #define TYPE_BCM283X "bcm283x" -OBJECT_DECLARE_TYPE(BCM283XState, BCM283XClass, BCM283X) +OBJECT_DECLARE_SIMPLE_TYPE(BCM283XState, BCM283X) #define BCM283X_NCPUS 4 @@ -30,7 +32,7 @@ OBJECT_DECLARE_TYPE(BCM283XState, BCM283XClass, BCM283X) #define TYPE_BCM2836 "bcm2836" #define TYPE_BCM2837 "bcm2837" -struct BCM283XState { +struct BCM283XBaseState { /*< private >*/ DeviceState parent_obj; /*< public >*/ @@ -41,7 +43,27 @@ struct BCM283XState { ARMCPU core; } cpu[BCM283X_NCPUS]; BCM2836ControlState control; +}; + +struct BCM283XBaseClass { + /*< private >*/ + DeviceClass parent_class; + /*< public >*/ + const char *name; + const char *cpu_type; + unsigned core_count; + hwaddr peri_base; /* Peripheral base address seen by the CPU */ + hwaddr ctrl_base; /* Interrupt controller and mailboxes etc. */ + int clusterid; +}; + +struct BCM283XState { + /*< private >*/ + BCM283XBaseState parent_obj; + /*< public >*/ BCM2835PeripheralState peripherals; }; +bool bcm283x_common_realize(DeviceState *dev, Error **errp); + #endif /* BCM2836_H */ diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index e3ba18a8ec1..e9768f2ab96 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -31,12 +31,12 @@ struct BCM283XClass { }; static Property bcm2836_enabled_cores_property = - DEFINE_PROP_UINT32("enabled-cpus", BCM283XState, enabled_cpus, 0); + DEFINE_PROP_UINT32("enabled-cpus", BCM283XBaseState, enabled_cpus, 0); -static void bcm2836_init(Object *obj) +static void bcm283x_base_init(Object *obj) { - BCM283XState *s = BCM283X(obj); - BCM283XClass *bc = BCM283X_GET_CLASS(obj); + BCM283XBaseState *s = BCM283X_BASE(obj); + BCM283XBaseClass *bc = BCM283X_BASE_GET_CLASS(obj); int n; for (n = 0; n < bc->core_count; n++) { @@ -52,6 +52,11 @@ static void bcm2836_init(Object *obj) object_initialize_child(obj, "control", &s->control, TYPE_BCM2836_CONTROL); } +} + +static void bcm283x_init(Object *obj) +{ + BCM283XState *s = BCM283X(obj); object_initialize_child(obj, "peripherals", &s->peripherals, TYPE_BCM2835_PERIPHERALS); @@ -63,10 +68,11 @@ static void bcm2836_init(Object *obj) "vcram-size"); } -static bool bcm283x_common_realize(DeviceState *dev, Error **errp) +bool bcm283x_common_realize(DeviceState *dev, Error **errp) { BCM283XState *s = BCM283X(dev); - BCM283XClass *bc = BCM283X_GET_CLASS(dev); + BCM283XBaseState *s_base = BCM283X_BASE(dev); + BCM283XBaseClass *bc = BCM283X_BASE_GET_CLASS(dev); Object *obj; /* common peripherals from bcm2835 */ @@ -79,90 +85,93 @@ static bool bcm283x_common_realize(DeviceState *dev, Error **errp) return false; } - object_property_add_alias(OBJECT(s), "sd-bus", OBJECT(&s->peripherals), - "sd-bus"); + object_property_add_alias(OBJECT(s_base), "sd-bus", + OBJECT(&s->peripherals), "sd-bus"); - sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->peripherals), 0, - bc->peri_base, 1); + sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->peripherals), + 0, bc->peri_base, 1); return true; } static void bcm2835_realize(DeviceState *dev, Error **errp) { BCM283XState *s = BCM283X(dev); + BCM283XBaseState *s_base = BCM283X_BASE(dev); if (!bcm283x_common_realize(dev, errp)) { return; } - if (!qdev_realize(DEVICE(&s->cpu[0].core), NULL, errp)) { + if (!qdev_realize(DEVICE(&s_base->cpu[0].core), NULL, errp)) { return; } /* Connect irq/fiq outputs from the interrupt controller. */ sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 0, - qdev_get_gpio_in(DEVICE(&s->cpu[0].core), ARM_CPU_IRQ)); + qdev_get_gpio_in(DEVICE(&s_base->cpu[0].core), ARM_CPU_IRQ)); sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 1, - qdev_get_gpio_in(DEVICE(&s->cpu[0].core), ARM_CPU_FIQ)); + qdev_get_gpio_in(DEVICE(&s_base->cpu[0].core), ARM_CPU_FIQ)); } static void bcm2836_realize(DeviceState *dev, Error **errp) { - BCM283XState *s = BCM283X(dev); - BCM283XClass *bc = BCM283X_GET_CLASS(dev); int n; + BCM283XState *s = BCM283X(dev); + BCM283XBaseState *s_base = BCM283X_BASE(dev); + BCM283XBaseClass *bc = BCM283X_BASE_GET_CLASS(dev); if (!bcm283x_common_realize(dev, errp)) { return; } /* bcm2836 interrupt controller (and mailboxes, etc.) */ - if (!sysbus_realize(SYS_BUS_DEVICE(&s->control), errp)) { + if (!sysbus_realize(SYS_BUS_DEVICE(&s_base->control), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->control), 0, bc->ctrl_base); + sysbus_mmio_map(SYS_BUS_DEVICE(&s_base->control), 0, bc->ctrl_base); sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 0, - qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-irq", 0)); + qdev_get_gpio_in_named(DEVICE(&s_base->control), "gpu-irq", 0)); sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 1, - qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-fiq", 0)); + qdev_get_gpio_in_named(DEVICE(&s_base->control), "gpu-fiq", 0)); for (n = 0; n < BCM283X_NCPUS; n++) { - object_property_set_int(OBJECT(&s->cpu[n].core), "mp-affinity", + object_property_set_int(OBJECT(&s_base->cpu[n].core), "mp-affinity", (bc->clusterid << 8) | n, &error_abort); /* set periphbase/CBAR value for CPU-local registers */ - object_property_set_int(OBJECT(&s->cpu[n].core), "reset-cbar", + object_property_set_int(OBJECT(&s_base->cpu[n].core), "reset-cbar", bc->peri_base, &error_abort); /* start powered off if not enabled */ - object_property_set_bool(OBJECT(&s->cpu[n].core), "start-powered-off", - n >= s->enabled_cpus, &error_abort); + object_property_set_bool(OBJECT(&s_base->cpu[n].core), + "start-powered-off", + n >= s_base->enabled_cpus, &error_abort); - if (!qdev_realize(DEVICE(&s->cpu[n].core), NULL, errp)) { + if (!qdev_realize(DEVICE(&s_base->cpu[n].core), NULL, errp)) { return; } /* Connect irq/fiq outputs from the interrupt controller. */ - qdev_connect_gpio_out_named(DEVICE(&s->control), "irq", n, - qdev_get_gpio_in(DEVICE(&s->cpu[n].core), ARM_CPU_IRQ)); - qdev_connect_gpio_out_named(DEVICE(&s->control), "fiq", n, - qdev_get_gpio_in(DEVICE(&s->cpu[n].core), ARM_CPU_FIQ)); + qdev_connect_gpio_out_named(DEVICE(&s_base->control), "irq", n, + qdev_get_gpio_in(DEVICE(&s_base->cpu[n].core), ARM_CPU_IRQ)); + qdev_connect_gpio_out_named(DEVICE(&s_base->control), "fiq", n, + qdev_get_gpio_in(DEVICE(&s_base->cpu[n].core), ARM_CPU_FIQ)); /* Connect timers from the CPU to the interrupt controller */ - qdev_connect_gpio_out(DEVICE(&s->cpu[n].core), GTIMER_PHYS, - qdev_get_gpio_in_named(DEVICE(&s->control), "cntpnsirq", n)); - qdev_connect_gpio_out(DEVICE(&s->cpu[n].core), GTIMER_VIRT, - qdev_get_gpio_in_named(DEVICE(&s->control), "cntvirq", n)); - qdev_connect_gpio_out(DEVICE(&s->cpu[n].core), GTIMER_HYP, - qdev_get_gpio_in_named(DEVICE(&s->control), "cnthpirq", n)); - qdev_connect_gpio_out(DEVICE(&s->cpu[n].core), GTIMER_SEC, - qdev_get_gpio_in_named(DEVICE(&s->control), "cntpsirq", n)); + qdev_connect_gpio_out(DEVICE(&s_base->cpu[n].core), GTIMER_PHYS, + qdev_get_gpio_in_named(DEVICE(&s_base->control), "cntpnsirq", n)); + qdev_connect_gpio_out(DEVICE(&s_base->cpu[n].core), GTIMER_VIRT, + qdev_get_gpio_in_named(DEVICE(&s_base->control), "cntvirq", n)); + qdev_connect_gpio_out(DEVICE(&s_base->cpu[n].core), GTIMER_HYP, + qdev_get_gpio_in_named(DEVICE(&s_base->control), "cnthpirq", n)); + qdev_connect_gpio_out(DEVICE(&s_base->cpu[n].core), GTIMER_SEC, + qdev_get_gpio_in_named(DEVICE(&s_base->control), "cntpsirq", n)); } } -static void bcm283x_class_init(ObjectClass *oc, void *data) +static void bcm283x_base_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); @@ -173,7 +182,7 @@ static void bcm283x_class_init(ObjectClass *oc, void *data) static void bcm2835_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); - BCM283XClass *bc = BCM283X_CLASS(oc); + BCM283XBaseClass *bc = BCM283X_BASE_CLASS(oc); bc->cpu_type = ARM_CPU_TYPE_NAME("arm1176"); bc->core_count = 1; @@ -184,7 +193,7 @@ static void bcm2835_class_init(ObjectClass *oc, void *data) static void bcm2836_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); - BCM283XClass *bc = BCM283X_CLASS(oc); + BCM283XBaseClass *bc = BCM283X_BASE_CLASS(oc); bc->cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"); bc->core_count = BCM283X_NCPUS; @@ -198,7 +207,7 @@ static void bcm2836_class_init(ObjectClass *oc, void *data) static void bcm2837_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); - BCM283XClass *bc = BCM283X_CLASS(oc); + BCM283XBaseClass *bc = BCM283X_BASE_CLASS(oc); bc->cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"); bc->core_count = BCM283X_NCPUS; @@ -226,11 +235,17 @@ static const TypeInfo bcm283x_types[] = { #endif }, { .name = TYPE_BCM283X, - .parent = TYPE_DEVICE, + .parent = TYPE_BCM283X_BASE, .instance_size = sizeof(BCM283XState), - .instance_init = bcm2836_init, - .class_size = sizeof(BCM283XClass), - .class_init = bcm283x_class_init, + .instance_init = bcm283x_init, + .abstract = true, + }, { + .name = TYPE_BCM283X_BASE, + .parent = TYPE_DEVICE, + .instance_size = sizeof(BCM283XBaseState), + .instance_init = bcm283x_base_init, + .class_size = sizeof(BCM283XBaseClass), + .class_init = bcm283x_base_class_init, .abstract = true, } }; diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index cc4c4ec9bfc..af866ebce29 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -252,7 +252,7 @@ static void setup_boot(MachineState *machine, RaspiProcessorId processor_id, s->binfo.firmware_loaded = true; } - arm_load_kernel(&s->soc.cpu[0].core, machine, &s->binfo); + arm_load_kernel(&s->soc.parent_obj.cpu[0].core, machine, &s->binfo); } static void raspi_machine_init(MachineState *machine) From patchwork Tue Feb 27 13:32:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776218 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp159890wro; Tue, 27 Feb 2024 05:44:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWaMRkI/1UVGpM9KkiLfsPsx3M7RD1bJJbBuKqRWVyYJvy2oYBPYk7G3YGYM9mtAYRrQW/aTyT4Z0ENnPq29yv7 X-Google-Smtp-Source: AGHT+IHEJppWnujVfta/TcZ7BkqEgKJp7Cl9x3Ak9tExJpMjucMjk3xIrxyQUSKnRdA/2QSZsqBl X-Received: by 2002:a81:d30a:0:b0:604:9262:4a4c with SMTP id y10-20020a81d30a000000b0060492624a4cmr2198949ywi.28.1709041447377; Tue, 27 Feb 2024 05:44:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041447; cv=none; d=google.com; s=arc-20160816; b=hvtcLq5WVU95sX/6Qs46/PFLiq/IC+dny8l/ELWgn+M62Lu+CmGWUvpL94BCLZAML8 z5/F9XX5luA45H5sXCBW9hYj/u4XHGU9Amry0L7yMSpptsqOcp1F5BY9D8uMqA0xcIzt ee/m/JIJEuzOLJz+ybbLwcnKIwEeCBItzBN6cWzjs9/geG+3Fq5O3kqOm+ifKhsuf77Z G/4/Retyd69Zmu7Qcw2l3BUgXMvkXW9xxMOjr0wkeG1OMJXKr18j72z7ha1tUCJEPFCa sgLUyWF7oclH+crSo1tKDjvU6yy7TlfFFxGqLhjYCn4NbvqXZSMs6loZ6JWfvTmdS556 DWkg== 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=+u19NxduId3LkBZhgtLn+B43jbfMKvvN4h7CCw7jvfE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=wTATw0yVYmNWzDEi7l1xJ7hm7PigPs1ZPzdhWqwrOdM+joWJyhdETdQfnnJaVp7vcF aTDZDoXw77H/YRMAn+u1SowWcf7GwrN4fMkos512BFwhQutwrtGlXxBNZt3v9mT10key bg6RG48YHsEIajys0y8An/Uik6FpWwkpORxTL5QJEGBoQTgHQ3+MgW1AwEk+/EhsS1d7 bEr4dFLK67gvYdAR5DlqsjwDaroPRasxR9KYQpiIU5SXJ/3K4aexhIAlKBJURshQuhqf bCcaqhYoxcXlUh64s6cgUvyWxvtol8Tei1SKVP2zQqW1Y6+EWh7M+iCbvFwM2wafA9v1 5h8w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FvtYA+Zd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c3-20020ac86e83000000b0042c41edcf47si7210494qtv.685.2024.02.27.05.44.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:44:07 -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=FvtYA+Zd; 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 1rexas-0000z1-3C; Tue, 27 Feb 2024 08:34: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 1rexab-0000pl-Ft for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:47 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaM-0002tQ-Ak for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:43 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-33d146737e6so3209308f8f.0 for ; Tue, 27 Feb 2024 05:33:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040808; x=1709645608; 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=+u19NxduId3LkBZhgtLn+B43jbfMKvvN4h7CCw7jvfE=; b=FvtYA+ZdSWYuC17e+FEnbSuxtYiZlACXMh8q64rHZRWl8Y53BKVG2aXfZl52OEDHdp aloabu//gJR1xbuj/fGoyb6dQrI6WKjGbiZvY497fCXc5ffmNtZUBA/nzOm7gCAUVNJK P9llGFElfzgOJ/Cqs/UAo3KW0IV/Q04A+1TsQ7l6k5NYT8WPeifWZYqLY1s5ABgrT6tQ 5H3RRH6Kd8HrtZhDW/al7jZooCkulvQMf9AU0d5TEcK7FZn4FHoRh9Vk1PyZoZMPzWeY hTDNtyRtskowXteyKe2kcuPEBugJ+/bMX31XT8nfeuTOWfvNCf1nKsv7MIu59hnkQ1KJ GdAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040808; x=1709645608; 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=+u19NxduId3LkBZhgtLn+B43jbfMKvvN4h7CCw7jvfE=; b=YYruv951oeL8aGYIBAEpL3LLJgljaaxMNweNETKBfSO+kdyw7epaJ/T75wDWsnfFTV aWq56HmsFTRGP4EvTxqAZN5nL+++a817oiBQpsyY+Km5Rd5vyT6NUk7AqdVEwdzSp9B+ qCmh5/IduZcEcjKyHIaqinfF7eOGif65n1YTeLjMpCAQIuTfgfg3CQcHAatU6+CTfMQ2 Ip9bOEovLVp0ISne4lXA453eTHXBgm51o1WpTLNuMnHyX4bWLNdBekXp0z3gLh/HpRgO xSDlba1w8hQ61sDZ42HTVDYjt3QHQiq6tMWYc+BIUiHsjCn9beiyJTh0nhDUspaYguc6 aiPQ== X-Gm-Message-State: AOJu0YzIAyPYxpHVSfM443IEq7+goN4SICRZm4skLayhkCKl+ZZw7DgF UFoKhxm4Tekhw0yIhNoHp8afJBcm2SE5rk1u2edD7GxpbZhwFJoZrlTziRtYum2a/Mef+QPqFYN 3 X-Received: by 2002:a5d:4443:0:b0:33d:31dc:cff7 with SMTP id x3-20020a5d4443000000b0033d31dccff7mr6925215wrr.32.1709040807642; Tue, 27 Feb 2024 05:33:27 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:27 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/45] hw/arm/bcm2853_peripherals: Split out common part of peripherals Date: Tue, 27 Feb 2024 13:32:51 +0000 Message-Id: <20240227133314.1721857-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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: Sergey Kambalin Pre-setup for BCM2838 introduction Signed-off-by: Sergey Kambalin Reviewed-by: Peter Maydell Message-id: 20240226000259.2752893-3-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell --- include/hw/arm/bcm2835_peripherals.h | 29 +++- include/hw/arm/bcm2836.h | 3 +- hw/arm/bcm2835_peripherals.c | 198 +++++++++++++++------------ hw/arm/bcm2836.c | 24 ++-- 4 files changed, 154 insertions(+), 100 deletions(-) diff --git a/include/hw/arm/bcm2835_peripherals.h b/include/hw/arm/bcm2835_peripherals.h index 0203bb79d8c..1fc96218f82 100644 --- a/include/hw/arm/bcm2835_peripherals.h +++ b/include/hw/arm/bcm2835_peripherals.h @@ -35,10 +35,13 @@ #include "hw/misc/unimp.h" #include "qom/object.h" +#define TYPE_BCM_SOC_PERIPHERALS_BASE "bcm-soc-peripherals-base" +OBJECT_DECLARE_TYPE(BCMSocPeripheralBaseState, BCMSocPeripheralBaseClass, + BCM_SOC_PERIPHERALS_BASE) #define TYPE_BCM2835_PERIPHERALS "bcm2835-peripherals" OBJECT_DECLARE_SIMPLE_TYPE(BCM2835PeripheralState, BCM2835_PERIPHERALS) -struct BCM2835PeripheralState { +struct BCMSocPeripheralBaseState { /*< private >*/ SysBusDevice parent_obj; /*< public >*/ @@ -60,12 +63,9 @@ struct BCM2835PeripheralState { OrIRQState orgated_dma_irq; BCM2835ICState ic; BCM2835PropertyState property; - BCM2835RngState rng; BCM2835MboxState mboxes; SDHCIState sdhci; BCM2835SDHostState sdhost; - BCM2835GpioState gpio; - Bcm2835ThermalState thermal; UnimplementedDeviceState i2s; BCM2835SPIState spi[1]; UnimplementedDeviceState i2c[3]; @@ -79,4 +79,25 @@ struct BCM2835PeripheralState { UnimplementedDeviceState sdramc; }; +struct BCMSocPeripheralBaseClass { + /*< private >*/ + SysBusDeviceClass parent_class; + /*< public >*/ + uint64_t peri_size; /* Peripheral range size */ +}; + +struct BCM2835PeripheralState { + /*< private >*/ + BCMSocPeripheralBaseState parent_obj; + /*< public >*/ + BCM2835RngState rng; + Bcm2835ThermalState thermal; + BCM2835GpioState gpio; +}; + +void create_unimp(BCMSocPeripheralBaseState *ps, + UnimplementedDeviceState *uds, + const char *name, hwaddr ofs, hwaddr size); +void bcm_soc_peripherals_common_realize(DeviceState *dev, Error **errp); + #endif /* BCM2835_PERIPHERALS_H */ diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h index 5a6717ca91e..918fb3bf142 100644 --- a/include/hw/arm/bcm2836.h +++ b/include/hw/arm/bcm2836.h @@ -64,6 +64,7 @@ struct BCM283XState { BCM2835PeripheralState peripherals; }; -bool bcm283x_common_realize(DeviceState *dev, Error **errp); +bool bcm283x_common_realize(DeviceState *dev, BCMSocPeripheralBaseState *ps, + Error **errp); #endif /* BCM2836_H */ diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index d5573fd9545..ed38a08a577 100644 --- a/hw/arm/bcm2835_peripherals.c +++ b/hw/arm/bcm2835_peripherals.c @@ -30,9 +30,9 @@ #define SEPARATE_DMA_IRQ_MAX 10 #define ORGATED_DMA_IRQ_COUNT 4 -static void create_unimp(BCM2835PeripheralState *ps, - UnimplementedDeviceState *uds, - const char *name, hwaddr ofs, hwaddr size) +void create_unimp(BCMSocPeripheralBaseState *ps, + UnimplementedDeviceState *uds, + const char *name, hwaddr ofs, hwaddr size) { object_initialize_child(OBJECT(ps), name, uds, TYPE_UNIMPLEMENTED_DEVICE); qdev_prop_set_string(DEVICE(uds), "name", name); @@ -45,9 +45,36 @@ static void create_unimp(BCM2835PeripheralState *ps, static void bcm2835_peripherals_init(Object *obj) { BCM2835PeripheralState *s = BCM2835_PERIPHERALS(obj); + BCMSocPeripheralBaseState *s_base = BCM_SOC_PERIPHERALS_BASE(obj); + + /* Random Number Generator */ + object_initialize_child(obj, "rng", &s->rng, TYPE_BCM2835_RNG); + + /* Thermal */ + object_initialize_child(obj, "thermal", &s->thermal, TYPE_BCM2835_THERMAL); + + /* GPIO */ + object_initialize_child(obj, "gpio", &s->gpio, TYPE_BCM2835_GPIO); + + object_property_add_const_link(OBJECT(&s->gpio), "sdbus-sdhci", + OBJECT(&s_base->sdhci.sdbus)); + object_property_add_const_link(OBJECT(&s->gpio), "sdbus-sdhost", + OBJECT(&s_base->sdhost.sdbus)); + + /* Gated DMA interrupts */ + object_initialize_child(obj, "orgated-dma-irq", + &s_base->orgated_dma_irq, TYPE_OR_IRQ); + object_property_set_int(OBJECT(&s_base->orgated_dma_irq), "num-lines", + ORGATED_DMA_IRQ_COUNT, &error_abort); +} + +static void raspi_peripherals_base_init(Object *obj) +{ + BCMSocPeripheralBaseState *s = BCM_SOC_PERIPHERALS_BASE(obj); + BCMSocPeripheralBaseClass *bc = BCM_SOC_PERIPHERALS_BASE_GET_CLASS(obj); /* Memory region for peripheral devices, which we export to our parent */ - memory_region_init(&s->peri_mr, obj,"bcm2835-peripherals", 0x1000000); + memory_region_init(&s->peri_mr, obj, "bcm2835-peripherals", bc->peri_size); sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->peri_mr); /* Internal memory region for peripheral bus addresses (not exported) */ @@ -98,9 +125,6 @@ static void bcm2835_peripherals_init(Object *obj) object_property_add_const_link(OBJECT(&s->property), "dma-mr", OBJECT(&s->gpu_bus_mr)); - /* Random Number Generator */ - object_initialize_child(obj, "rng", &s->rng, TYPE_BCM2835_RNG); - /* Extended Mass Media Controller */ object_initialize_child(obj, "sdhci", &s->sdhci, TYPE_SYSBUS_SDHCI); @@ -110,25 +134,9 @@ static void bcm2835_peripherals_init(Object *obj) /* DMA Channels */ object_initialize_child(obj, "dma", &s->dma, TYPE_BCM2835_DMA); - object_initialize_child(obj, "orgated-dma-irq", - &s->orgated_dma_irq, TYPE_OR_IRQ); - object_property_set_int(OBJECT(&s->orgated_dma_irq), "num-lines", - ORGATED_DMA_IRQ_COUNT, &error_abort); - object_property_add_const_link(OBJECT(&s->dma), "dma-mr", OBJECT(&s->gpu_bus_mr)); - /* Thermal */ - object_initialize_child(obj, "thermal", &s->thermal, TYPE_BCM2835_THERMAL); - - /* GPIO */ - object_initialize_child(obj, "gpio", &s->gpio, TYPE_BCM2835_GPIO); - - object_property_add_const_link(OBJECT(&s->gpio), "sdbus-sdhci", - OBJECT(&s->sdhci.sdbus)); - object_property_add_const_link(OBJECT(&s->gpio), "sdbus-sdhost", - OBJECT(&s->sdhost.sdbus)); - /* Mphi */ object_initialize_child(obj, "mphi", &s->mphi, TYPE_BCM2835_MPHI); @@ -152,7 +160,72 @@ static void bcm2835_peripherals_init(Object *obj) static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) { + MemoryRegion *mphi_mr; BCM2835PeripheralState *s = BCM2835_PERIPHERALS(dev); + BCMSocPeripheralBaseState *s_base = BCM_SOC_PERIPHERALS_BASE(dev); + int n; + + bcm_soc_peripherals_common_realize(dev, errp); + + /* Extended Mass Media Controller */ + sysbus_connect_irq(SYS_BUS_DEVICE(&s_base->sdhci), 0, + qdev_get_gpio_in_named(DEVICE(&s_base->ic), BCM2835_IC_GPU_IRQ, + INTERRUPT_ARASANSDIO)); + + /* Connect DMA 0-12 to the interrupt controller */ + for (n = 0; n <= SEPARATE_DMA_IRQ_MAX; n++) { + sysbus_connect_irq(SYS_BUS_DEVICE(&s_base->dma), n, + qdev_get_gpio_in_named(DEVICE(&s_base->ic), + BCM2835_IC_GPU_IRQ, + INTERRUPT_DMA0 + n)); + } + + if (!qdev_realize(DEVICE(&s_base->orgated_dma_irq), NULL, errp)) { + return; + } + for (n = 0; n < ORGATED_DMA_IRQ_COUNT; n++) { + sysbus_connect_irq(SYS_BUS_DEVICE(&s_base->dma), + SEPARATE_DMA_IRQ_MAX + 1 + n, + qdev_get_gpio_in(DEVICE(&s_base->orgated_dma_irq), n)); + } + qdev_connect_gpio_out(DEVICE(&s_base->orgated_dma_irq), 0, + qdev_get_gpio_in_named(DEVICE(&s_base->ic), + BCM2835_IC_GPU_IRQ, + INTERRUPT_DMA0 + SEPARATE_DMA_IRQ_MAX + 1)); + + /* Random Number Generator */ + if (!sysbus_realize(SYS_BUS_DEVICE(&s->rng), errp)) { + return; + } + memory_region_add_subregion( + &s_base->peri_mr, RNG_OFFSET, + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->rng), 0)); + + /* THERMAL */ + if (!sysbus_realize(SYS_BUS_DEVICE(&s->thermal), errp)) { + return; + } + memory_region_add_subregion(&s_base->peri_mr, THERMAL_OFFSET, + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->thermal), 0)); + + /* Map MPHI to the peripherals memory map */ + mphi_mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s_base->mphi), 0); + memory_region_add_subregion(&s_base->peri_mr, MPHI_OFFSET, mphi_mr); + + /* GPIO */ + if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) { + return; + } + memory_region_add_subregion( + &s_base->peri_mr, GPIO_OFFSET, + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gpio), 0)); + + object_property_add_alias(OBJECT(s), "sd-bus", OBJECT(&s->gpio), "sd-bus"); +} + +void bcm_soc_peripherals_common_realize(DeviceState *dev, Error **errp) +{ + BCMSocPeripheralBaseState *s = BCM_SOC_PERIPHERALS_BASE(dev); Object *obj; MemoryRegion *ram; Error *err = NULL; @@ -285,14 +358,6 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) sysbus_connect_irq(SYS_BUS_DEVICE(&s->property), 0, qdev_get_gpio_in(DEVICE(&s->mboxes), MBOX_CHAN_PROPERTY)); - /* Random Number Generator */ - if (!sysbus_realize(SYS_BUS_DEVICE(&s->rng), errp)) { - return; - } - - memory_region_add_subregion(&s->peri_mr, RNG_OFFSET, - sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->rng), 0)); - /* Extended Mass Media Controller * * Compatible with: @@ -315,9 +380,6 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) memory_region_add_subregion(&s->peri_mr, EMMC1_OFFSET, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->sdhci), 0)); - sysbus_connect_irq(SYS_BUS_DEVICE(&s->sdhci), 0, - qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ, - INTERRUPT_ARASANSDIO)); /* SDHOST */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->sdhost), errp)) { @@ -340,49 +402,11 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) memory_region_add_subregion(&s->peri_mr, DMA15_OFFSET, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->dma), 1)); - for (n = 0; n <= SEPARATE_DMA_IRQ_MAX; n++) { - sysbus_connect_irq(SYS_BUS_DEVICE(&s->dma), n, - qdev_get_gpio_in_named(DEVICE(&s->ic), - BCM2835_IC_GPU_IRQ, - INTERRUPT_DMA0 + n)); - } - if (!qdev_realize(DEVICE(&s->orgated_dma_irq), NULL, errp)) { - return; - } - for (n = 0; n < ORGATED_DMA_IRQ_COUNT; n++) { - sysbus_connect_irq(SYS_BUS_DEVICE(&s->dma), - SEPARATE_DMA_IRQ_MAX + 1 + n, - qdev_get_gpio_in(DEVICE(&s->orgated_dma_irq), n)); - } - qdev_connect_gpio_out(DEVICE(&s->orgated_dma_irq), 0, - qdev_get_gpio_in_named(DEVICE(&s->ic), - BCM2835_IC_GPU_IRQ, - INTERRUPT_DMA0 + SEPARATE_DMA_IRQ_MAX + 1)); - - /* THERMAL */ - if (!sysbus_realize(SYS_BUS_DEVICE(&s->thermal), errp)) { - return; - } - memory_region_add_subregion(&s->peri_mr, THERMAL_OFFSET, - sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->thermal), 0)); - - /* GPIO */ - if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) { - return; - } - - memory_region_add_subregion(&s->peri_mr, GPIO_OFFSET, - sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gpio), 0)); - - object_property_add_alias(OBJECT(s), "sd-bus", OBJECT(&s->gpio), "sd-bus"); - /* Mphi */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->mphi), errp)) { return; } - memory_region_add_subregion(&s->peri_mr, MPHI_OFFSET, - sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mphi), 0)); sysbus_connect_irq(SYS_BUS_DEVICE(&s->mphi), 0, qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ, INTERRUPT_HOSTPORT)); @@ -436,21 +460,27 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) static void bcm2835_peripherals_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); + BCMSocPeripheralBaseClass *bc = BCM_SOC_PERIPHERALS_BASE_CLASS(oc); + bc->peri_size = 0x1000000; dc->realize = bcm2835_peripherals_realize; } -static const TypeInfo bcm2835_peripherals_type_info = { - .name = TYPE_BCM2835_PERIPHERALS, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(BCM2835PeripheralState), - .instance_init = bcm2835_peripherals_init, - .class_init = bcm2835_peripherals_class_init, +static const TypeInfo bcm2835_peripherals_types[] = { + { + .name = TYPE_BCM2835_PERIPHERALS, + .parent = TYPE_BCM_SOC_PERIPHERALS_BASE, + .instance_size = sizeof(BCM2835PeripheralState), + .instance_init = bcm2835_peripherals_init, + .class_init = bcm2835_peripherals_class_init, + }, { + .name = TYPE_BCM_SOC_PERIPHERALS_BASE, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(BCMSocPeripheralBaseState), + .instance_init = raspi_peripherals_base_init, + .class_size = sizeof(BCMSocPeripheralBaseClass), + .abstract = true, + } }; -static void bcm2835_peripherals_register_types(void) -{ - type_register_static(&bcm2835_peripherals_type_info); -} - -type_init(bcm2835_peripherals_register_types) +DEFINE_TYPES(bcm2835_peripherals_types) diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index e9768f2ab96..7e4c60dd804 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -68,10 +68,10 @@ static void bcm283x_init(Object *obj) "vcram-size"); } -bool bcm283x_common_realize(DeviceState *dev, Error **errp) +bool bcm283x_common_realize(DeviceState *dev, BCMSocPeripheralBaseState *ps, + Error **errp) { - BCM283XState *s = BCM283X(dev); - BCM283XBaseState *s_base = BCM283X_BASE(dev); + BCM283XBaseState *s = BCM283X_BASE(dev); BCM283XBaseClass *bc = BCM283X_BASE_GET_CLASS(dev); Object *obj; @@ -79,17 +79,15 @@ bool bcm283x_common_realize(DeviceState *dev, Error **errp) obj = object_property_get_link(OBJECT(dev), "ram", &error_abort); - object_property_add_const_link(OBJECT(&s->peripherals), "ram", obj); + object_property_add_const_link(OBJECT(ps), "ram", obj); - if (!sysbus_realize(SYS_BUS_DEVICE(&s->peripherals), errp)) { + if (!sysbus_realize(SYS_BUS_DEVICE(ps), errp)) { return false; } - object_property_add_alias(OBJECT(s_base), "sd-bus", - OBJECT(&s->peripherals), "sd-bus"); + object_property_add_alias(OBJECT(s), "sd-bus", OBJECT(ps), "sd-bus"); - sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->peripherals), - 0, bc->peri_base, 1); + sysbus_mmio_map_overlap(SYS_BUS_DEVICE(ps), 0, bc->peri_base, 1); return true; } @@ -97,8 +95,10 @@ static void bcm2835_realize(DeviceState *dev, Error **errp) { BCM283XState *s = BCM283X(dev); BCM283XBaseState *s_base = BCM283X_BASE(dev); + BCMSocPeripheralBaseState *ps_base + = BCM_SOC_PERIPHERALS_BASE(&s->peripherals); - if (!bcm283x_common_realize(dev, errp)) { + if (!bcm283x_common_realize(dev, ps_base, errp)) { return; } @@ -119,8 +119,10 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) BCM283XState *s = BCM283X(dev); BCM283XBaseState *s_base = BCM283X_BASE(dev); BCM283XBaseClass *bc = BCM283X_BASE_GET_CLASS(dev); + BCMSocPeripheralBaseState *ps_base + = BCM_SOC_PERIPHERALS_BASE(&s->peripherals); - if (!bcm283x_common_realize(dev, errp)) { + if (!bcm283x_common_realize(dev, ps_base, errp)) { return; } From patchwork Tue Feb 27 13:32:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776204 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp157112wro; Tue, 27 Feb 2024 05:37:16 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUrKibltf3NU74IxSAwxEntnwNb7kdFPNnvrEbEySzxPw5Bn8VFFpGXYvE0HPvDz0wvqUvsOFzULOT2U8yyS/rH X-Google-Smtp-Source: AGHT+IHWoSDvsINahCloIWmun5pSUHpYo+Yx2d48jhFs4J86CwfINWbqS1nYasTkHZvnmEDdLL0l X-Received: by 2002:a05:620a:3a4c:b0:787:eb87:25e7 with SMTP id sk12-20020a05620a3a4c00b00787eb8725e7mr754334qkn.30.1709041036167; Tue, 27 Feb 2024 05:37:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041036; cv=none; d=google.com; s=arc-20160816; b=Q7Sjw6OeWslbcYGLt6/DzkyXrRVg82befDvEiO7EwrYUxFBeAZezNpcWCTkVHmGXhB coMFUCjfBHCbFGtso0h6DDycQbEbimgM+qDJUZuFW0c5aU9YQYXMrhpGmq3mauKqKbwr BwrZZFiRlQfei4TnfSPWKeNiZLHi2xQgZJ47ahdDbgw105lHDNI6qBn07NQcscW0eN7m JUyyuRQ1fWp1Lf3H9skxJaXkYWygNMYwNemHIvZ64/ZQnRAx2SwLG2QmIrRrJKeRNiUx smmsz4vSKlQMEf7MWJZEPQHPM7NhXGkBMt1JkceBqL2ySUWGzyGMvr59c/OA5PZzRacy kSCg== 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=7K8+4o46TBVEWx0jf+c03adLKg6p9seb2Wq/JYGfaT0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=xhBiEU/8OanHG+4Y4Wq7jjmAx2jTuUrnYleKZcQ0lZ4xS07VHMY2NGEa1sXzpQzfur /isANqvtsHXNQ+yfGhxjkDNAFYGcxo+3mUGFaUgfGjaJ8rLVOqGdsUQu0oYEqOuJ3e/y HToZ4/1uiuVBysLWfO5dPMIJoPkCMI0ts5TC+PJpX7+mE0vC8ejnp82JFEt6iSp+psix z3OreTE1M34nPO7EoprjY5MzXf0fpKpWkVV97eA1n9gBB8ojlg2atYVoasMWEpbh6iAD VBkjWvpIdOJIP51UM5vOCE/ZpEVRBbmvCswu9qJDI0tP841f3Ve0HPbJjUIqB4EDmKQK 417Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z7JuU5SC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b19-20020a05620a127300b00787b85281e7si7294250qkl.714.2024.02.27.05.37.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:37: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=Z7JuU5SC; 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 1rexb1-000190-DH; Tue, 27 Feb 2024 08:34:11 -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 1rexaU-0000mq-Ib for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:39 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaM-0002tU-9f for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:38 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-33d066f8239so3104719f8f.1 for ; Tue, 27 Feb 2024 05:33:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040808; x=1709645608; 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=7K8+4o46TBVEWx0jf+c03adLKg6p9seb2Wq/JYGfaT0=; b=Z7JuU5SC459lCKaLFg7xAgfsd8qrO1wYxYzb7SwA6N/7Th7q0KD9LAiE5YPyRZbo3P 730J8quMb0jo6jmFRZp6T7nNbSEmHx9xpDGIp+tGxWnXRR5YWWEmv2ao0s1dFe952iN/ RrqOMqIrSldfrA62q9/0orLtndbESGonKqoQjAEJ7AiTucuAUbOJCGDKSQqiomIa+GwC WZVKN1doQhaR10rwdIOO10zufClXTaxsN1pOG0k04P9iM2/2H7lVvEjIqdGcRjB0mbVU NYg73CCXBf7BkwKdSmTsj+LDCPOaKSl5rdVOFErxZFCObRPnzTxxwg40hoA/6vq0ekEj wuHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040808; x=1709645608; 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=7K8+4o46TBVEWx0jf+c03adLKg6p9seb2Wq/JYGfaT0=; b=Q0Lxq0/1hua1TMZmkOMpVBQZE2d7hKmx7C8S2P05WQfatO9CRHWAwMvTURNgnuDeuc gERENIi0CoEbOIQy+WhCtbRuAPiZ9TTMeu6f8+EG3AEdJjnxlCY54UodlMnccBWHlfwq Hcaa3sQLb3jfwNULy9c3eaqQnqbO0MNXZO99VQHFOS3wWMewHsg/pqsWtmEJStWkYpMv qIKV33+OpnPTKoPlJYtF6kFuP7gex102xaTt0ox2GwyJhJwpcIqe5TBGU/map6bI0M88 BNi2roXi+dN1zfxJ9TlSEHM5KTCQCfy3Q+h9ZFVFg4qVKCYG5kCNfNegCAiarAhjdWpS iA2A== X-Gm-Message-State: AOJu0YxrOA1CoXP1Nf1YLttI7xkPzCTg3HXy8O9Eu7OcQ6dWBurQ8xcX /9anamv0AqA9Vz4J4t2BBi4XSBF6gtZrdOZ4fTa83hY9DRoCyMsqsHjRgzWClZ192rgUcmkl3FG E X-Received: by 2002:a05:6000:4ed:b0:33d:6be8:bb61 with SMTP id cr13-20020a05600004ed00b0033d6be8bb61mr7626868wrb.35.1709040808218; Tue, 27 Feb 2024 05:33:28 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:27 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/45] hw/arm/raspi: Split out raspi machine common part Date: Tue, 27 Feb 2024 13:32:52 +0000 Message-Id: <20240227133314.1721857-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_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: Sergey Kambalin Pre-setup for raspberry pi 4 introduction Signed-off-by: Sergey Kambalin Reviewed-by: Peter Maydell Message-id: 20240226000259.2752893-4-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell --- include/hw/arm/raspi_platform.h | 21 ++++++ hw/arm/raspi.c | 112 ++++++++++++++++++-------------- 2 files changed, 85 insertions(+), 48 deletions(-) diff --git a/include/hw/arm/raspi_platform.h b/include/hw/arm/raspi_platform.h index ede98e63c33..3018e8fcf3e 100644 --- a/include/hw/arm/raspi_platform.h +++ b/include/hw/arm/raspi_platform.h @@ -28,6 +28,27 @@ #ifndef HW_ARM_RASPI_PLATFORM_H #define HW_ARM_RASPI_PLATFORM_H +#include "hw/boards.h" +#include "hw/arm/boot.h" + +#define TYPE_RASPI_BASE_MACHINE MACHINE_TYPE_NAME("raspi-base") +OBJECT_DECLARE_TYPE(RaspiBaseMachineState, RaspiBaseMachineClass, + RASPI_BASE_MACHINE) + +struct RaspiBaseMachineState { + /*< private >*/ + MachineState parent_obj; + /*< public >*/ + struct arm_boot_info binfo; +}; + +struct RaspiBaseMachineClass { + /*< private >*/ + MachineClass parent_obj; + /*< public >*/ + uint32_t board_rev; +}; + #define MSYNC_OFFSET 0x0000 /* Multicore Sync Block */ #define CCPT_OFFSET 0x1000 /* Compact Camera Port 2 TX */ #define INTE_OFFSET 0x2000 /* VC Interrupt controller */ diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index af866ebce29..7d04734cd23 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -18,6 +18,7 @@ #include "qapi/error.h" #include "hw/arm/boot.h" #include "hw/arm/bcm2836.h" +#include "hw/arm/raspi_platform.h" #include "hw/registerfields.h" #include "qemu/error-report.h" #include "hw/boards.h" @@ -25,6 +26,9 @@ #include "hw/arm/boot.h" #include "qom/object.h" +#define TYPE_RASPI_MACHINE MACHINE_TYPE_NAME("raspi-common") +OBJECT_DECLARE_SIMPLE_TYPE(RaspiMachineState, RASPI_MACHINE) + #define SMPBOOT_ADDR 0x300 /* this should leave enough space for ATAGS */ #define MVBAR_ADDR 0x400 /* secure vectors */ #define BOARDSETUP_ADDR (MVBAR_ADDR + 0x20) /* board setup code */ @@ -37,25 +41,10 @@ struct RaspiMachineState { /*< private >*/ - MachineState parent_obj; + RaspiBaseMachineState parent_obj; /*< public >*/ BCM283XState soc; - struct arm_boot_info binfo; }; -typedef struct RaspiMachineState RaspiMachineState; - -struct RaspiMachineClass { - /*< private >*/ - MachineClass parent_obj; - /*< public >*/ - uint32_t board_rev; -}; -typedef struct RaspiMachineClass RaspiMachineClass; - -#define TYPE_RASPI_MACHINE MACHINE_TYPE_NAME("raspi-common") -DECLARE_OBJ_CHECKERS(RaspiMachineState, RaspiMachineClass, - RASPI_MACHINE, TYPE_RASPI_MACHINE) - /* * Board revision codes: @@ -83,6 +72,11 @@ static const struct { [PROCESSOR_ID_BCM2837] = {TYPE_BCM2837, BCM283X_NCPUS}, }; +static void raspi_base_machine_init(MachineState *machine, + BCM283XBaseState *soc); +static void raspi_machine_class_common_init(MachineClass *mc, + uint32_t board_rev); + static uint64_t board_ram_size(uint32_t board_rev) { assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */ @@ -200,13 +194,12 @@ static void reset_secondary(ARMCPU *cpu, const struct arm_boot_info *info) cpu_set_pc(cs, info->smp_loader_start); } -static void setup_boot(MachineState *machine, RaspiProcessorId processor_id, - size_t ram_size) +static void setup_boot(MachineState *machine, ARMCPU *cpu, + RaspiProcessorId processor_id, size_t ram_size) { - RaspiMachineState *s = RASPI_MACHINE(machine); + RaspiBaseMachineState *s = RASPI_BASE_MACHINE(machine); int r; - s->binfo.board_id = MACH_TYPE_BCM2708; s->binfo.ram_size = ram_size; if (processor_id <= PROCESSOR_ID_BCM2836) { @@ -252,13 +245,13 @@ static void setup_boot(MachineState *machine, RaspiProcessorId processor_id, s->binfo.firmware_loaded = true; } - arm_load_kernel(&s->soc.parent_obj.cpu[0].core, machine, &s->binfo); + arm_load_kernel(cpu, machine, &s->binfo); } -static void raspi_machine_init(MachineState *machine) +static void raspi_base_machine_init(MachineState *machine, + BCM283XBaseState *soc) { - RaspiMachineClass *mc = RASPI_MACHINE_GET_CLASS(machine); - RaspiMachineState *s = RASPI_MACHINE(machine); + RaspiBaseMachineClass *mc = RASPI_BASE_MACHINE_GET_CLASS(machine); uint32_t board_rev = mc->board_rev; uint64_t ram_size = board_ram_size(board_rev); uint32_t vcram_size; @@ -279,19 +272,17 @@ static void raspi_machine_init(MachineState *machine) machine->ram, 0); /* Setup the SOC */ - object_initialize_child(OBJECT(machine), "soc", &s->soc, - board_soc_type(board_rev)); - object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(machine->ram)); - object_property_set_int(OBJECT(&s->soc), "board-rev", board_rev, + object_property_add_const_link(OBJECT(soc), "ram", OBJECT(machine->ram)); + object_property_set_int(OBJECT(soc), "board-rev", board_rev, &error_abort); - object_property_set_str(OBJECT(&s->soc), "command-line", + object_property_set_str(OBJECT(soc), "command-line", machine->kernel_cmdline, &error_abort); - qdev_realize(DEVICE(&s->soc), NULL, &error_fatal); + qdev_realize(DEVICE(soc), NULL, &error_fatal); /* Create and plug in the SD cards */ di = drive_get(IF_SD, 0, 0); blk = di ? blk_by_legacy_dinfo(di) : NULL; - bus = qdev_get_child_bus(DEVICE(&s->soc), "sd-bus"); + bus = qdev_get_child_bus(DEVICE(soc), "sd-bus"); if (bus == NULL) { error_report("No SD bus found in SOC object"); exit(1); @@ -300,19 +291,32 @@ static void raspi_machine_init(MachineState *machine) qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); qdev_realize_and_unref(carddev, bus, &error_fatal); - vcram_size = object_property_get_uint(OBJECT(&s->soc), "vcram-size", + vcram_size = object_property_get_uint(OBJECT(soc), "vcram-size", &error_abort); - setup_boot(machine, board_processor_id(mc->board_rev), + setup_boot(machine, &soc->cpu[0].core, board_processor_id(board_rev), machine->ram_size - vcram_size); } -static void raspi_machine_class_common_init(MachineClass *mc, - uint32_t board_rev) +static void raspi_machine_init(MachineState *machine) +{ + RaspiMachineState *s = RASPI_MACHINE(machine); + RaspiBaseMachineState *s_base = RASPI_BASE_MACHINE(machine); + RaspiBaseMachineClass *mc = RASPI_BASE_MACHINE_GET_CLASS(machine); + BCM283XState *soc = &s->soc; + + s_base->binfo.board_id = MACH_TYPE_BCM2708; + + object_initialize_child(OBJECT(machine), "soc", soc, + board_soc_type(mc->board_rev)); + raspi_base_machine_init(machine, &soc->parent_obj); +} + +void raspi_machine_class_common_init(MachineClass *mc, + uint32_t board_rev) { mc->desc = g_strdup_printf("Raspberry Pi %s (revision 1.%u)", board_type(board_rev), FIELD_EX32(board_rev, REV_CODE, REVISION)); - mc->init = raspi_machine_init; mc->block_default_type = IF_SD; mc->no_parallel = 1; mc->no_floppy = 1; @@ -322,50 +326,57 @@ static void raspi_machine_class_common_init(MachineClass *mc, mc->default_ram_id = "ram"; }; +static void raspi_machine_class_init(MachineClass *mc, + uint32_t board_rev) +{ + raspi_machine_class_common_init(mc, board_rev); + mc->init = raspi_machine_init; +}; + static void raspi0_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); - RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); + RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc); rmc->board_rev = 0x920092; /* Revision 1.2 */ - raspi_machine_class_common_init(mc, rmc->board_rev); + raspi_machine_class_init(mc, rmc->board_rev); }; static void raspi1ap_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); - RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); + RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc); rmc->board_rev = 0x900021; /* Revision 1.1 */ - raspi_machine_class_common_init(mc, rmc->board_rev); + raspi_machine_class_init(mc, rmc->board_rev); }; static void raspi2b_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); - RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); + RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc); rmc->board_rev = 0xa21041; - raspi_machine_class_common_init(mc, rmc->board_rev); + raspi_machine_class_init(mc, rmc->board_rev); }; #ifdef TARGET_AARCH64 static void raspi3ap_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); - RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); + RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc); rmc->board_rev = 0x9020e0; /* Revision 1.0 */ - raspi_machine_class_common_init(mc, rmc->board_rev); + raspi_machine_class_init(mc, rmc->board_rev); }; static void raspi3b_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); - RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); + RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc); rmc->board_rev = 0xa02082; - raspi_machine_class_common_init(mc, rmc->board_rev); + raspi_machine_class_init(mc, rmc->board_rev); }; #endif /* TARGET_AARCH64 */ @@ -394,9 +405,14 @@ static const TypeInfo raspi_machine_types[] = { #endif }, { .name = TYPE_RASPI_MACHINE, - .parent = TYPE_MACHINE, + .parent = TYPE_RASPI_BASE_MACHINE, .instance_size = sizeof(RaspiMachineState), - .class_size = sizeof(RaspiMachineClass), + .abstract = true, + }, { + .name = TYPE_RASPI_BASE_MACHINE, + .parent = TYPE_MACHINE, + .instance_size = sizeof(RaspiBaseMachineState), + .class_size = sizeof(RaspiBaseMachineClass), .abstract = true, } }; From patchwork Tue Feb 27 13:32:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776209 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp157942wro; Tue, 27 Feb 2024 05:39:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVJ2j44VclCm1lVHOBFT7nqOSnCP24uEEQ0+vUD+xxYV9Y1Nq9spThjlDVfB6S15yUYQsLACGZ0tNYFhVJTFY7d X-Google-Smtp-Source: AGHT+IGOrV/uZPlVywfiVejgAvYvtYDSc5gZGVxLzpXpYSiOOw5dRQgRpy29ICt6MjMKgXhmYCFm X-Received: by 2002:a05:620a:14a9:b0:787:a692:9824 with SMTP id x9-20020a05620a14a900b00787a6929824mr2126173qkj.9.1709041157930; Tue, 27 Feb 2024 05:39:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041157; cv=none; d=google.com; s=arc-20160816; b=a27rYGJRipkOW8u2KLyeGbwggwZX+DzZGMI3xXMzpUBsXrEpw/C8rfl6s6QYZo3/0R dm7hd6HAXJgdQRZsRq7e7NE6tiAXUH6vVkPaPZ0ET/vz0vaACJ35xssZeHq2AKW0oDPw tdFdFxaDtMdEF/00+QvOpby0fG9v08/J5UL2LM81v3niYmYzjwIzRlZM6QhrFDMECuhh 3SypFol1n2NNFRk9FRtljCcvnLYRIFsU7nfRbFQni09efC04UWsv1eGLgZCz0lLFTEbt wLr5XJMBdiFMRk3yQWemzWksJj5kdQU/0UdcYEpeb5ufRzWR2//Mg3LuBx72c9bGWD/B PG8g== 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=nQnB+AajkqUMtKF1ZeDIPH96ZWKHiQBABJWH1qjr8Ts=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=jPTGPXnA8UOKfb2tO50n8BouyO3ykEjqgNZ01U5pE3+L6yXS5xi0omf1FvKi0XQMLq sCcKLjGj1v9MnRn4HkgPc5ebbBFxdTiEEPa3HDoR1AjwpRUH+AycpmEgG4iJqdvDtgHc eZi2aIRzeU33/91zjV4rxCmKThvKABuWYoFj4uY/EgOLj0waaJWPtJoESOtWEKlGLYy7 JxJywb/XlMOcPKFHiGeNkl46LO5D5kZicXnEX0SP54YxOqPoCIsiDTN4VSIdlFES2l7M QGMxltBzKgWqeVIjvOZDJ6xaqSaquibvkjVBXOpBJjS8hLToX5BgnrEIH+aWmsTrO0wy pvwg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BOM/alxY"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id cz53-20020a05620a36f500b00787de4be444si2916358qkb.419.2024.02.27.05.39.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:39:17 -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="BOM/alxY"; 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 1rexas-00011X-Ru; Tue, 27 Feb 2024 08:34: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 1rexaT-0000mM-QT for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:37 -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 1rexaM-0002tc-9v for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:37 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4129e8bc6c8so23957715e9.2 for ; Tue, 27 Feb 2024 05:33:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040809; x=1709645609; 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=nQnB+AajkqUMtKF1ZeDIPH96ZWKHiQBABJWH1qjr8Ts=; b=BOM/alxY+9nX4a6qbUnhhW9oVFpWv6et75nijjJ+G83XfdUrS+5ApZ71vhZ+PzhV+Q 92+I3EKXItGwBdbpc3dQFJJnbCOMOtYodnOponvDAtf48HukvzKvhx8EatsgZRY7njfT TwxGDq6/dBjn+cQam+I+QNPusBwPsYGK/I/oIoFpBNds2TDOvu7/KceEKcw9FsHnpDy5 Pr4UWqaIzCWjupWaLwBc8R9KzcEqb3CcxRMfTFguDoWUSI/TXPZ2eOX3QhwvgmafchGY DU97NlYZ5LuLIsE87bgEZahZ09nHtbVJIIZ+JltPpK6dZWyoMWEp6QuyZLht91R4S1vn er3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040809; x=1709645609; 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=nQnB+AajkqUMtKF1ZeDIPH96ZWKHiQBABJWH1qjr8Ts=; b=Qil6uQ/qlZA0vvjnXmwksmRpbAFFNi3MpExKt2OzpbM5kCzPwYwrAbBW10NumQw+Kq Q8f1LnEm09OSVXaqaYW2hcwNBmcpdDUXEZuU/7J/dChc7dzqkLB8gXfQEw9m9hVznUpZ DPKwfMnp7+pRO0qwKgoNhocda9RRpOQCsq2P/lnI7kH/iTKhfgRIQvNHrv431eFtmJkd MHVe+JDL5viN6APF0JTcc8te0U7n0F6q9iBdleHPk7VHz12rcagaNY1l+RqpgmMj70d8 gKQKdp16y6rw8u4oc6Xr95n2i+f0DKwPy2g8dfDj8naT+sr6kzUEBgQHcKMsWnLvYyZU 2IGQ== X-Gm-Message-State: AOJu0YzlRhkX2uLFHiGw6wJ8r6YpcZne7X7QofW2WhG5iOUgU2Cq8+Rn 6Y/vDViGw1wxIGavubMw2pL45z6+0XBNcFzP9BF9tPicFBG7BQ6XGCM5U2mycsahqflwR02OkuO W X-Received: by 2002:a5d:64e3:0:b0:33d:862c:1598 with SMTP id g3-20020a5d64e3000000b0033d862c1598mr9691534wri.50.1709040808779; Tue, 27 Feb 2024 05:33:28 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:28 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/45] hw/arm: Introduce BCM2838 SoC Date: Tue, 27 Feb 2024 13:32:53 +0000 Message-Id: <20240227133314.1721857-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-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: Sergey Kambalin Signed-off-by: Sergey Kambalin Reviewed-by: Peter Maydell Message-id: 20240226000259.2752893-5-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell --- include/hw/arm/bcm2838.h | 29 ++++++++ include/hw/arm/bcm2838_peripherals.h | 36 ++++++++++ hw/arm/bcm2838.c | 98 ++++++++++++++++++++++++++++ hw/arm/bcm2838_peripherals.c | 72 ++++++++++++++++++++ hw/arm/meson.build | 2 + 5 files changed, 237 insertions(+) create mode 100644 include/hw/arm/bcm2838.h create mode 100644 include/hw/arm/bcm2838_peripherals.h create mode 100644 hw/arm/bcm2838.c create mode 100644 hw/arm/bcm2838_peripherals.c diff --git a/include/hw/arm/bcm2838.h b/include/hw/arm/bcm2838.h new file mode 100644 index 00000000000..bddc25ca9af --- /dev/null +++ b/include/hw/arm/bcm2838.h @@ -0,0 +1,29 @@ +/* + * BCM2838 SoC emulation + * + * Copyright (C) 2022 Ovchinnikov Vitalii + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef BCM2838_H +#define BCM2838_H + +#include "hw/arm/bcm2836.h" +#include "hw/arm/bcm2838_peripherals.h" + +#define BCM2838_PERI_LOW_BASE 0xfc000000 +#define BCM2838_GIC_BASE 0x40000 + +#define TYPE_BCM2838 "bcm2838" + +OBJECT_DECLARE_TYPE(BCM2838State, BCM2838Class, BCM2838) + +struct BCM2838State { + /*< private >*/ + BCM283XBaseState parent_obj; + /*< public >*/ + BCM2838PeripheralState peripherals; +}; + +#endif /* BCM2838_H */ diff --git a/include/hw/arm/bcm2838_peripherals.h b/include/hw/arm/bcm2838_peripherals.h new file mode 100644 index 00000000000..7039b67cc96 --- /dev/null +++ b/include/hw/arm/bcm2838_peripherals.h @@ -0,0 +1,36 @@ +/* + * BCM2838 peripherals emulation + * + * Copyright (C) 2022 Ovchinnikov Vitalii + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef BCM2838_PERIPHERALS_H +#define BCM2838_PERIPHERALS_H + +#include "hw/arm/bcm2835_peripherals.h" + + +#define TYPE_BCM2838_PERIPHERALS "bcm2838-peripherals" +OBJECT_DECLARE_TYPE(BCM2838PeripheralState, BCM2838PeripheralClass, + BCM2838_PERIPHERALS) + +struct BCM2838PeripheralState { + /*< private >*/ + BCMSocPeripheralBaseState parent_obj; + + /*< public >*/ + MemoryRegion peri_low_mr; + MemoryRegion peri_low_mr_alias; + MemoryRegion mphi_mr_alias; +}; + +struct BCM2838PeripheralClass { + /*< private >*/ + BCMSocPeripheralBaseClass parent_class; + /*< public >*/ + uint64_t peri_low_size; /* Peripheral lower range size */ +}; + +#endif /* BCM2838_PERIPHERALS_H */ diff --git a/hw/arm/bcm2838.c b/hw/arm/bcm2838.c new file mode 100644 index 00000000000..05281e247fe --- /dev/null +++ b/hw/arm/bcm2838.c @@ -0,0 +1,98 @@ +/* + * BCM2838 SoC emulation + * + * Copyright (C) 2022 Ovchinnikov Vitalii + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu/module.h" +#include "hw/arm/raspi_platform.h" +#include "hw/sysbus.h" +#include "hw/arm/bcm2838.h" +#include "trace.h" + +#define VIRTUAL_PMU_IRQ 7 + +static void bcm2838_init(Object *obj) +{ + BCM2838State *s = BCM2838(obj); + + object_initialize_child(obj, "peripherals", &s->peripherals, + TYPE_BCM2838_PERIPHERALS); + object_property_add_alias(obj, "board-rev", OBJECT(&s->peripherals), + "board-rev"); + object_property_add_alias(obj, "vcram-size", OBJECT(&s->peripherals), + "vcram-size"); + object_property_add_alias(obj, "command-line", OBJECT(&s->peripherals), + "command-line"); +} + +static void bcm2838_realize(DeviceState *dev, Error **errp) +{ + int n; + BCM2838State *s = BCM2838(dev); + BCM283XBaseState *s_base = BCM283X_BASE(dev); + BCM283XBaseClass *bc_base = BCM283X_BASE_GET_CLASS(dev); + BCM2838PeripheralState *ps = BCM2838_PERIPHERALS(&s->peripherals); + BCMSocPeripheralBaseState *ps_base = + BCM_SOC_PERIPHERALS_BASE(&s->peripherals); + + if (!bcm283x_common_realize(dev, ps_base, errp)) { + return; + } + sysbus_mmio_map_overlap(SYS_BUS_DEVICE(ps), 1, BCM2838_PERI_LOW_BASE, 1); + + /* bcm2836 interrupt controller (and mailboxes, etc.) */ + if (!sysbus_realize(SYS_BUS_DEVICE(&s_base->control), errp)) { + return; + } + sysbus_mmio_map(SYS_BUS_DEVICE(&s_base->control), 0, bc_base->ctrl_base); + + /* Create cores */ + for (n = 0; n < bc_base->core_count; n++) { + + object_property_set_int(OBJECT(&s_base->cpu[n].core), "mp-affinity", + (bc_base->clusterid << 8) | n, &error_abort); + + /* start powered off if not enabled */ + object_property_set_bool(OBJECT(&s_base->cpu[n].core), + "start-powered-off", + n >= s_base->enabled_cpus, &error_abort); + + if (!qdev_realize(DEVICE(&s_base->cpu[n].core), NULL, errp)) { + return; + } + } +} + +static void bcm2838_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(oc); + BCM283XBaseClass *bc_base = BCM283X_BASE_CLASS(oc); + + bc_base->cpu_type = ARM_CPU_TYPE_NAME("cortex-a72"); + bc_base->core_count = BCM283X_NCPUS; + bc_base->peri_base = 0xfe000000; + bc_base->ctrl_base = 0xff800000; + bc_base->clusterid = 0x0; + dc->realize = bcm2838_realize; +} + +static const TypeInfo bcm2838_type = { + .name = TYPE_BCM2838, + .parent = TYPE_BCM283X_BASE, + .instance_size = sizeof(BCM2838State), + .instance_init = bcm2838_init, + .class_size = sizeof(BCM283XBaseClass), + .class_init = bcm2838_class_init, +}; + +static void bcm2838_register_types(void) +{ + type_register_static(&bcm2838_type); +} + +type_init(bcm2838_register_types); diff --git a/hw/arm/bcm2838_peripherals.c b/hw/arm/bcm2838_peripherals.c new file mode 100644 index 00000000000..06110c724f8 --- /dev/null +++ b/hw/arm/bcm2838_peripherals.c @@ -0,0 +1,72 @@ +/* + * BCM2838 peripherals emulation + * + * Copyright (C) 2022 Ovchinnikov Vitalii + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu/module.h" +#include "hw/arm/raspi_platform.h" +#include "hw/arm/bcm2838_peripherals.h" + +/* Lower peripheral base address on the VC (GPU) system bus */ +#define BCM2838_VC_PERI_LOW_BASE 0x7c000000 + +static void bcm2838_peripherals_init(Object *obj) +{ + BCM2838PeripheralState *s = BCM2838_PERIPHERALS(obj); + BCM2838PeripheralClass *bc = BCM2838_PERIPHERALS_GET_CLASS(obj); + + /* Lower memory region for peripheral devices (exported to the Soc) */ + memory_region_init(&s->peri_low_mr, obj, "bcm2838-peripherals", + bc->peri_low_size); + sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->peri_low_mr); + +} + +static void bcm2838_peripherals_realize(DeviceState *dev, Error **errp) +{ + BCM2838PeripheralState *s = BCM2838_PERIPHERALS(dev); + BCMSocPeripheralBaseState *s_base = BCM_SOC_PERIPHERALS_BASE(dev); + + bcm_soc_peripherals_common_realize(dev, errp); + + /* Map lower peripherals into the GPU address space */ + memory_region_init_alias(&s->peri_low_mr_alias, OBJECT(s), + "bcm2838-peripherals", &s->peri_low_mr, 0, + memory_region_size(&s->peri_low_mr)); + memory_region_add_subregion_overlap(&s_base->gpu_bus_mr, + BCM2838_VC_PERI_LOW_BASE, + &s->peri_low_mr_alias, 1); + +} + +static void bcm2838_peripherals_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(oc); + BCM2838PeripheralClass *bc = BCM2838_PERIPHERALS_CLASS(oc); + BCMSocPeripheralBaseClass *bc_base = BCM_SOC_PERIPHERALS_BASE_CLASS(oc); + + bc->peri_low_size = 0x2000000; + bc_base->peri_size = 0x1800000; + dc->realize = bcm2838_peripherals_realize; +} + +static const TypeInfo bcm2838_peripherals_type_info = { + .name = TYPE_BCM2838_PERIPHERALS, + .parent = TYPE_BCM_SOC_PERIPHERALS_BASE, + .instance_size = sizeof(BCM2838PeripheralState), + .instance_init = bcm2838_peripherals_init, + .class_size = sizeof(BCM2838PeripheralClass), + .class_init = bcm2838_peripherals_class_init, +}; + +static void bcm2838_peripherals_register_types(void) +{ + type_register_static(&bcm2838_peripherals_type_info); +} + +type_init(bcm2838_peripherals_register_types) diff --git a/hw/arm/meson.build b/hw/arm/meson.build index a16d3479055..1390a9d7b51 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -30,6 +30,7 @@ arm_ss.add(when: 'CONFIG_ALLWINNER_A10', if_true: files('allwinner-a10.c', 'cubi arm_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3.c', 'orangepi.c')) arm_ss.add(when: 'CONFIG_ALLWINNER_R40', if_true: files('allwinner-r40.c', 'bananapi_m2u.c')) arm_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2836.c', 'raspi.c')) +arm_ss.add(when: ['CONFIG_RASPI', 'TARGET_AARCH64'], if_true: files('bcm2838.c')) arm_ss.add(when: 'CONFIG_STM32F100_SOC', if_true: files('stm32f100_soc.c')) arm_ss.add(when: 'CONFIG_STM32F205_SOC', if_true: files('stm32f205_soc.c')) arm_ss.add(when: 'CONFIG_STM32F405_SOC', if_true: files('stm32f405_soc.c')) @@ -67,6 +68,7 @@ system_ss.add(when: 'CONFIG_GUMSTIX', if_true: files('gumstix.c')) system_ss.add(when: 'CONFIG_NETDUINO2', if_true: files('netduino2.c')) system_ss.add(when: 'CONFIG_OMAP', if_true: files('omap2.c')) system_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_peripherals.c')) +system_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2838_peripherals.c')) system_ss.add(when: 'CONFIG_SPITZ', if_true: files('spitz.c')) system_ss.add(when: 'CONFIG_STRONGARM', if_true: files('strongarm.c')) system_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c')) From patchwork Tue Feb 27 13:32:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776220 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp159905wro; Tue, 27 Feb 2024 05:44:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU77urfaopBxduvvAmCXIodoryvedcZkxeuIfwL3UWlK5qCVo3TzthoI9DdPpvdTtmw7b16M3w9WMsugiErN1MZ X-Google-Smtp-Source: AGHT+IHE3/SD7A0WfXOWiaIQhpOT2TpJBC9L0CPHyPvgtTQmKeobBx3jD69gsUQtLxE6118teB14 X-Received: by 2002:a05:622a:64c:b0:42e:a059:671a with SMTP id a12-20020a05622a064c00b0042ea059671amr1441765qtb.21.1709041448671; Tue, 27 Feb 2024 05:44:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041448; cv=none; d=google.com; s=arc-20160816; b=INTizhC9Wfr1NSTd3xA6Mb10mgLpmPUONNed7vnQcK8mt9PdwpNem27ApkRl5ulMSA FY6K6a3rcOhB02ofo41uTt/JehaTlPPi5EpdIRDBoGZAg3wx0bzp3oDyWzZVs2rbEULd OAiWRt9lO2FTomJyYTEX5Q7+1a67Mfb1oBRCyinpiCsIhx/jCEGdpcf5O5wyyvkqHacX 8KuC6anhDpiWBUoRbUnufXfJtWh9hUB9dR74LvhJaf+OmLynA3D8O9YHaH111VhTRnaf LXD/qJnnoBj+ihPVY1iLv7hugUrczS1FyYdhvnZYvz6xVxFxvqVEfBWyaCipE2tHCL8q CInw== 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=ommNmOrQ47/Ozr7tANJi0FPpzUehs1D2sJfCH09Bk8A=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=HOKem36tDhbMbarkYNS/j58/2fnJNc231QKq2sRWrqn+sEp1u1u8G8C+h9cQ131DF6 v4nTwlhttzajw+f+xh6Z4d1ev++7z8VZtYMm24iSeksnRmD/jqw0mVKNPoPdNr4EnBJe 8nGQJWmHRFDn0l76MUkRt0qf1pG3xFx4rnZ5eAtT23zMYPqSZlQUjBfQGGyJuK00DIwk HV/Vg9OZYDZN2jMW4RX0gZ1HDdTU7KAxP4ltJL812i/zjYZToJateft344EnIohl3We6 c1wQSOKC3w8larsEZdJoOvs9XOpy1cclyVQlRIVcxvv3LK4PXKRSjrjIc6kkVNWybaNm 5dpg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OPU9TV9r; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z24-20020ac87118000000b0042e165bf31dsi7307714qto.93.2024.02.27.05.44.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:44: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=OPU9TV9r; 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 1rexaw-00014w-4u; Tue, 27 Feb 2024 08:34:06 -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 1rexaT-0000mK-Pr for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:37 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaN-0002tj-Am for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:35 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-33de64c91abso799153f8f.1 for ; Tue, 27 Feb 2024 05:33:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040809; x=1709645609; 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=ommNmOrQ47/Ozr7tANJi0FPpzUehs1D2sJfCH09Bk8A=; b=OPU9TV9rAwg2YuIwloba8i1qzCrSfiqOWLKY/BSysYlyXAq+Y7JhUU5Sjm4PBCjQJw in3p63vhMwuSPXlOvx0bxMcIVdcN9yCWxQNY6lM2iJZ7Agns1LO8OoomGu/juCRjm7KK IZtPK+yf077ABPLRQLpBYnU0vSmbdT/Ir/tYlnkirK1tOxd510JQVOCW+PCIN9haINNL xYDbG8+LfvUkVaScDMFhARB4ubVjsljUQ7m4yqccJrgikUp+OEH7PwOMKZTj5h5F+3WQ rg+e7yMdAcdltrmzVDrvoYe9sZtv4cprOlaEg+Euo+9tD/PGQ0VNSG/xUmdsXY+40KOL WGTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040809; x=1709645609; 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=ommNmOrQ47/Ozr7tANJi0FPpzUehs1D2sJfCH09Bk8A=; b=XT9xYWNjIGNNlmGDrdZ1RDfiUcW41sQL4ULWCuHl4WyGjshaVkwPEXRtkDeq6zbihA rBP2TTYjQLBhVzx3J88HpJHL8NwO39QhArXFyEAcOBc/Sb76IwU5WSgieAowJFSDhDtQ 2mCBeroNwtrnCLe+Dz0SL9HHYSl3ZS9ERbBMM0W2TFZAPa7geWxton43Lo+vYRn05jB7 1ejoZ51P1b+ncYCcNuhjidwjPb7Wj/k6Qd55CnmaDV2BfGWnL2xy9dPPz46/TsN7OGh9 MaIjeJSeDQC6fnb4fREaElR05lmxDLdStivVHI4RxIL3VYXXH1UhyYB1VT//egHd5Xnl 7wrQ== X-Gm-Message-State: AOJu0YzgqA3mQKIcb2Jg0Cfx3v9/2IZ1KOPMu+GhYw79h44UhTcStme5 i1myn5v7zE5eTN6fSlf2ejCYcvPotCSQ40e/QYfxlDsILr+RPrbCwOKv93aJ9HfwwnR2vgtXpkN 3 X-Received: by 2002:adf:fd8e:0:b0:33d:af84:2a59 with SMTP id d14-20020adffd8e000000b0033daf842a59mr6371499wrr.28.1709040809215; Tue, 27 Feb 2024 05:33:29 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:29 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/45] hw/arm/bcm2838: Add GIC-400 to BCM2838 SoC Date: Tue, 27 Feb 2024 13:32:54 +0000 Message-Id: <20240227133314.1721857-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.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: Sergey Kambalin Signed-off-by: Sergey Kambalin Reviewed-by: Peter Maydell Message-id: 20240226000259.2752893-6-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell --- include/hw/arm/bcm2838.h | 2 + include/hw/arm/bcm2838_peripherals.h | 37 ++++++ hw/arm/bcm2838.c | 167 ++++++++++++++++++++++++++- hw/arm/trace-events | 3 + 4 files changed, 207 insertions(+), 2 deletions(-) diff --git a/include/hw/arm/bcm2838.h b/include/hw/arm/bcm2838.h index bddc25ca9af..e53c7bedf92 100644 --- a/include/hw/arm/bcm2838.h +++ b/include/hw/arm/bcm2838.h @@ -10,6 +10,7 @@ #define BCM2838_H #include "hw/arm/bcm2836.h" +#include "hw/intc/arm_gic.h" #include "hw/arm/bcm2838_peripherals.h" #define BCM2838_PERI_LOW_BASE 0xfc000000 @@ -24,6 +25,7 @@ struct BCM2838State { BCM283XBaseState parent_obj; /*< public >*/ BCM2838PeripheralState peripherals; + GICState gic; }; #endif /* BCM2838_H */ diff --git a/include/hw/arm/bcm2838_peripherals.h b/include/hw/arm/bcm2838_peripherals.h index 7039b67cc96..d07831753ab 100644 --- a/include/hw/arm/bcm2838_peripherals.h +++ b/include/hw/arm/bcm2838_peripherals.h @@ -11,6 +11,39 @@ #include "hw/arm/bcm2835_peripherals.h" +/* SPI */ +#define GIC_SPI_INTERRUPT_MBOX 33 +#define GIC_SPI_INTERRUPT_MPHI 40 +#define GIC_SPI_INTERRUPT_DWC2 73 +#define GIC_SPI_INTERRUPT_DMA_0 80 +#define GIC_SPI_INTERRUPT_DMA_6 86 +#define GIC_SPI_INTERRUPT_DMA_7_8 87 +#define GIC_SPI_INTERRUPT_DMA_9_10 88 +#define GIC_SPI_INTERRUPT_AUX_UART1 93 +#define GIC_SPI_INTERRUPT_SDHOST 120 +#define GIC_SPI_INTERRUPT_UART0 121 +#define GIC_SPI_INTERRUPT_RNG200 125 +#define GIC_SPI_INTERRUPT_EMMC_EMMC2 126 +#define GIC_SPI_INTERRUPT_PCI_INT_A 143 +#define GIC_SPI_INTERRUPT_GENET_A 157 +#define GIC_SPI_INTERRUPT_GENET_B 158 + + +/* GPU (legacy) DMA interrupts */ +#define GPU_INTERRUPT_DMA0 16 +#define GPU_INTERRUPT_DMA1 17 +#define GPU_INTERRUPT_DMA2 18 +#define GPU_INTERRUPT_DMA3 19 +#define GPU_INTERRUPT_DMA4 20 +#define GPU_INTERRUPT_DMA5 21 +#define GPU_INTERRUPT_DMA6 22 +#define GPU_INTERRUPT_DMA7_8 23 +#define GPU_INTERRUPT_DMA9_10 24 +#define GPU_INTERRUPT_DMA11 25 +#define GPU_INTERRUPT_DMA12 26 +#define GPU_INTERRUPT_DMA13 27 +#define GPU_INTERRUPT_DMA14 28 +#define GPU_INTERRUPT_DMA15 31 #define TYPE_BCM2838_PERIPHERALS "bcm2838-peripherals" OBJECT_DECLARE_TYPE(BCM2838PeripheralState, BCM2838PeripheralClass, @@ -24,6 +57,10 @@ struct BCM2838PeripheralState { MemoryRegion peri_low_mr; MemoryRegion peri_low_mr_alias; MemoryRegion mphi_mr_alias; + + OrIRQState mmc_irq_orgate; + OrIRQState dma_7_8_irq_orgate; + OrIRQState dma_9_10_irq_orgate; }; struct BCM2838PeripheralClass { diff --git a/hw/arm/bcm2838.c b/hw/arm/bcm2838.c index 05281e247fe..332e906a84f 100644 --- a/hw/arm/bcm2838.c +++ b/hw/arm/bcm2838.c @@ -14,8 +14,36 @@ #include "hw/arm/bcm2838.h" #include "trace.h" +#define GIC400_MAINTENANCE_IRQ 9 +#define GIC400_TIMER_NS_EL2_IRQ 10 +#define GIC400_TIMER_VIRT_IRQ 11 +#define GIC400_LEGACY_FIQ 12 +#define GIC400_TIMER_S_EL1_IRQ 13 +#define GIC400_TIMER_NS_EL1_IRQ 14 +#define GIC400_LEGACY_IRQ 15 + +/* Number of external interrupt lines to configure the GIC with */ +#define GIC_NUM_IRQS 192 + +#define PPI(cpu, irq) (GIC_NUM_IRQS + (cpu) * GIC_INTERNAL + GIC_NR_SGIS + irq) + +#define GIC_BASE_OFS 0x0000 +#define GIC_DIST_OFS 0x1000 +#define GIC_CPU_OFS 0x2000 +#define GIC_VIFACE_THIS_OFS 0x4000 +#define GIC_VIFACE_OTHER_OFS(cpu) (0x5000 + (cpu) * 0x200) +#define GIC_VCPU_OFS 0x6000 + #define VIRTUAL_PMU_IRQ 7 +static void bcm2838_gic_set_irq(void *opaque, int irq, int level) +{ + BCM2838State *s = (BCM2838State *)opaque; + + trace_bcm2838_gic_set_irq(irq, level); + qemu_set_irq(qdev_get_gpio_in(DEVICE(&s->gic), irq), level); +} + static void bcm2838_init(Object *obj) { BCM2838State *s = BCM2838(obj); @@ -28,11 +56,12 @@ static void bcm2838_init(Object *obj) "vcram-size"); object_property_add_alias(obj, "command-line", OBJECT(&s->peripherals), "command-line"); + + object_initialize_child(obj, "gic", &s->gic, TYPE_ARM_GIC); } static void bcm2838_realize(DeviceState *dev, Error **errp) { - int n; BCM2838State *s = BCM2838(dev); BCM283XBaseState *s_base = BCM283X_BASE(dev); BCM283XBaseClass *bc_base = BCM283X_BASE_GET_CLASS(dev); @@ -40,6 +69,8 @@ static void bcm2838_realize(DeviceState *dev, Error **errp) BCMSocPeripheralBaseState *ps_base = BCM_SOC_PERIPHERALS_BASE(&s->peripherals); + DeviceState *gicdev = NULL; + if (!bcm283x_common_realize(dev, ps_base, errp)) { return; } @@ -52,11 +83,15 @@ static void bcm2838_realize(DeviceState *dev, Error **errp) sysbus_mmio_map(SYS_BUS_DEVICE(&s_base->control), 0, bc_base->ctrl_base); /* Create cores */ - for (n = 0; n < bc_base->core_count; n++) { + for (int n = 0; n < bc_base->core_count; n++) { object_property_set_int(OBJECT(&s_base->cpu[n].core), "mp-affinity", (bc_base->clusterid << 8) | n, &error_abort); + /* set periphbase/CBAR value for CPU-local registers */ + object_property_set_int(OBJECT(&s_base->cpu[n].core), "reset-cbar", + bc_base->peri_base, &error_abort); + /* start powered off if not enabled */ object_property_set_bool(OBJECT(&s_base->cpu[n].core), "start-powered-off", @@ -66,6 +101,134 @@ static void bcm2838_realize(DeviceState *dev, Error **errp) return; } } + + if (!object_property_set_uint(OBJECT(&s->gic), "revision", 2, errp)) { + return; + } + + if (!object_property_set_uint(OBJECT(&s->gic), "num-cpu", BCM283X_NCPUS, + errp)) { + return; + } + + if (!object_property_set_uint(OBJECT(&s->gic), "num-irq", + GIC_NUM_IRQS + GIC_INTERNAL, errp)) { + return; + } + + if (!object_property_set_bool(OBJECT(&s->gic), + "has-virtualization-extensions", true, + errp)) { + return; + } + + if (!sysbus_realize(SYS_BUS_DEVICE(&s->gic), errp)) { + return; + } + + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 0, + bc_base->ctrl_base + BCM2838_GIC_BASE + GIC_DIST_OFS); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 1, + bc_base->ctrl_base + BCM2838_GIC_BASE + GIC_CPU_OFS); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 2, + bc_base->ctrl_base + BCM2838_GIC_BASE + GIC_VIFACE_THIS_OFS); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 3, + bc_base->ctrl_base + BCM2838_GIC_BASE + GIC_VCPU_OFS); + + for (int n = 0; n < BCM283X_NCPUS; n++) { + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 4 + n, + bc_base->ctrl_base + BCM2838_GIC_BASE + + GIC_VIFACE_OTHER_OFS(n)); + } + + gicdev = DEVICE(&s->gic); + + for (int n = 0; n < BCM283X_NCPUS; n++) { + DeviceState *cpudev = DEVICE(&s_base->cpu[n]); + + /* Connect the GICv2 outputs to the CPU */ + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), n, + qdev_get_gpio_in(cpudev, ARM_CPU_IRQ)); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), n + BCM283X_NCPUS, + qdev_get_gpio_in(cpudev, ARM_CPU_FIQ)); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), n + 2 * BCM283X_NCPUS, + qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ)); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), n + 3 * BCM283X_NCPUS, + qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ)); + + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), n + 4 * BCM283X_NCPUS, + qdev_get_gpio_in(gicdev, + PPI(n, GIC400_MAINTENANCE_IRQ))); + + /* Connect timers from the CPU to the interrupt controller */ + qdev_connect_gpio_out(cpudev, GTIMER_PHYS, + qdev_get_gpio_in(gicdev, PPI(n, GIC400_TIMER_NS_EL1_IRQ))); + qdev_connect_gpio_out(cpudev, GTIMER_VIRT, + qdev_get_gpio_in(gicdev, PPI(n, GIC400_TIMER_VIRT_IRQ))); + qdev_connect_gpio_out(cpudev, GTIMER_HYP, + qdev_get_gpio_in(gicdev, PPI(n, GIC400_TIMER_NS_EL2_IRQ))); + qdev_connect_gpio_out(cpudev, GTIMER_SEC, + qdev_get_gpio_in(gicdev, PPI(n, GIC400_TIMER_S_EL1_IRQ))); + /* PMU interrupt */ + qdev_connect_gpio_out_named(cpudev, "pmu-interrupt", 0, + qdev_get_gpio_in(gicdev, PPI(n, VIRTUAL_PMU_IRQ))); + } + + /* Connect UART0 to the interrupt controller */ + sysbus_connect_irq(SYS_BUS_DEVICE(&ps_base->uart0), 0, + qdev_get_gpio_in(gicdev, GIC_SPI_INTERRUPT_UART0)); + + /* Connect AUX / UART1 to the interrupt controller */ + sysbus_connect_irq(SYS_BUS_DEVICE(&ps_base->aux), 0, + qdev_get_gpio_in(gicdev, GIC_SPI_INTERRUPT_AUX_UART1)); + + /* Connect VC mailbox to the interrupt controller */ + sysbus_connect_irq(SYS_BUS_DEVICE(&ps_base->mboxes), 0, + qdev_get_gpio_in(gicdev, GIC_SPI_INTERRUPT_MBOX)); + + /* Connect SD host to the interrupt controller */ + sysbus_connect_irq(SYS_BUS_DEVICE(&ps_base->sdhost), 0, + qdev_get_gpio_in(gicdev, GIC_SPI_INTERRUPT_SDHOST)); + + /* According to DTS, EMMC and EMMC2 share one irq */ + DeviceState *mmc_irq_orgate = DEVICE(&ps->mmc_irq_orgate); + + /* Connect EMMC and EMMC2 to the interrupt controller */ + qdev_connect_gpio_out(mmc_irq_orgate, 0, + qdev_get_gpio_in(gicdev, GIC_SPI_INTERRUPT_EMMC_EMMC2)); + + /* Connect USB OTG and MPHI to the interrupt controller */ + sysbus_connect_irq(SYS_BUS_DEVICE(&ps_base->mphi), 0, + qdev_get_gpio_in(gicdev, GIC_SPI_INTERRUPT_MPHI)); + sysbus_connect_irq(SYS_BUS_DEVICE(&ps_base->dwc2), 0, + qdev_get_gpio_in(gicdev, GIC_SPI_INTERRUPT_DWC2)); + + /* Connect DMA 0-6 to the interrupt controller */ + for (int n = GIC_SPI_INTERRUPT_DMA_0; n <= GIC_SPI_INTERRUPT_DMA_6; n++) { + sysbus_connect_irq(SYS_BUS_DEVICE(&ps_base->dma), + n - GIC_SPI_INTERRUPT_DMA_0, + qdev_get_gpio_in(gicdev, n)); + } + + /* According to DTS, DMA 7 and 8 share one irq */ + DeviceState *dma_7_8_irq_orgate = DEVICE(&ps->dma_7_8_irq_orgate); + + /* Connect DMA 7-8 to the interrupt controller */ + qdev_connect_gpio_out(dma_7_8_irq_orgate, 0, + qdev_get_gpio_in(gicdev, GIC_SPI_INTERRUPT_DMA_7_8)); + + /* According to DTS, DMA 9 and 10 share one irq */ + DeviceState *dma_9_10_irq_orgate = DEVICE(&ps->dma_9_10_irq_orgate); + + /* Connect DMA 9-10 to the interrupt controller */ + qdev_connect_gpio_out(dma_9_10_irq_orgate, 0, + qdev_get_gpio_in(gicdev, GIC_SPI_INTERRUPT_DMA_9_10)); + + /* Pass through inbound GPIO lines to the GIC */ + qdev_init_gpio_in(dev, bcm2838_gic_set_irq, GIC_NUM_IRQS); + + /* Pass through outbound IRQ lines from the GIC */ + qdev_pass_gpios(DEVICE(&s->gic), DEVICE(&s->peripherals), NULL); } static void bcm2838_class_init(ObjectClass *oc, void *data) diff --git a/hw/arm/trace-events b/hw/arm/trace-events index fd0d92762e4..f1a54a02dfc 100644 --- a/hw/arm/trace-events +++ b/hw/arm/trace-events @@ -70,3 +70,6 @@ z2_aer915_event(int8_t event, int8_t len) "i2c event =0x%x len=%d bytes" 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 + +# bcm2838.c +bcm2838_gic_set_irq(int irq, int level) "gic irq:%d lvl:%d" From patchwork Tue Feb 27 13:32:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776217 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp159888wro; Tue, 27 Feb 2024 05:44:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX0iniCFNLPIoVdYbWWYd82iV2jdTiNLs+hDHgP1lK7CdewGYtcVX5OnQKQWiKo8jkhTuspjYjTLi4QshyIhbdM X-Google-Smtp-Source: AGHT+IFoGq/SnMvTQuiPBPUmHOWNeUGRsnKxjbzlmSHPxjBe91AINCV9hdWHE1RWPTYyCt8thXfJ X-Received: by 2002:a05:6214:5188:b0:68f:3453:7bf1 with SMTP id kl8-20020a056214518800b0068f34537bf1mr2303265qvb.28.1709041446834; Tue, 27 Feb 2024 05:44:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041446; cv=none; d=google.com; s=arc-20160816; b=Pv2XgFfbc6dgBd5t5aiSH+IWJsP1nCoBVqBxGxj34PuLZvh4rkIHC4mVSj3VIC+qCl C6pGytEg2rMRU/3PE32M5COI0AsHDibzLBQ8L+D4f6hUVkfvbsLH7k/qhdrwZPxzX8nu zuQfN95JD8JGs5OZhCgE+te5XvMoDjP+WJLCXDCjt15X/w9mNMuWWVw4+g46vcwkBQHD 3VZk4JC0HC76SWmqAbEs5SaRjNiU0eJJyYpJA+lls0CuuhT57S1yXs1iKXyu0PMSal/6 VthXi3aCs4pSgtOVJCqeDwRlRjlfEpkCGhvwCUmY0I1Pq/8bSOrYWqF1++iJlv2LJePW VATw== 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=et9wQQONF7VZ2a7S3QKT8lccx9rqc3WZuS0iWjrpOdw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ARhPH9XRaUOc1c1tJpxD3WVQIGN2U861C3tVbLGFnb70fr3uoh621WpwdKqhQmeGqs GEEEXZbDPG2UaNGf+vNuAtxadlyCim+gDl0UPR8LYR+2efmrgY9DyQi6NQw/Q+YOlLg8 RJcDviA1lR1lRePGdeG3WAQktIVow4WzsLZPIdjNEe3f59Whezf8IhlzE063fW/ad1hF 5bknDyiR6/p0kQUwQh8kr8MPP8zOele2NLFDIZJDt8ZO2qJn8FmvXKMajwUD1LkFMZWK uZZi4zL5IKRm1T+KSTKf/uPG10Bmt+TaEPjy2ehdG+GHqZ1VMqN5H0NXSe04rjlkUtPX Rg/A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IVqQYTJk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dv4-20020ad44ee4000000b0068fe7f88fa3si7529471qvb.499.2024.02.27.05.44.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:44:06 -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=IVqQYTJk; 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 1rexaw-00014y-FM; Tue, 27 Feb 2024 08:34:06 -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 1rexaU-0000mr-Jn for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:39 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaO-0002to-Dx for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:38 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-33ddd1624beso1083911f8f.1 for ; Tue, 27 Feb 2024 05:33:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040809; x=1709645609; 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=et9wQQONF7VZ2a7S3QKT8lccx9rqc3WZuS0iWjrpOdw=; b=IVqQYTJkwFPY88q4EbjhxckEGWjf9xe2YuX3gKCBZQoB7sTNFGOJ8jJNBXgdre29an qoEu1VRGeqUo9F7SWTjeTRmnBdAUUtYv5QK6nCUWT7xgCeVpMKPjdOcgrjU5OuK4/eSg dY96oAqu2X8+336RD9Z6EUlQ5uiOpVwQuPdJ5vknxPyjIYAtGDVe64f9e+P+0L2wB02D iTtyD+VNiAooeAGaOjv95ydGFm/jK7uf21QXe3jP37m2cFkkYdAqC+M3xkUMK0iSLkut sc3MmQizYTn5WWMDrgyUqxiW/tfO8kcSJo8uU0scQEOYizrY5Bl398gqUalbdO6qOLLw 6crA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040809; x=1709645609; 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=et9wQQONF7VZ2a7S3QKT8lccx9rqc3WZuS0iWjrpOdw=; b=eTMfGYn2OxKCY6R8vmyGpJOMfz7R6t5T55IRC25Dpm8RCI25rfRN5Qbu26l54O0zwZ NAgOzeLiSLsk8s5cECl7AN6nr90BmRy13Gat7qnleAbrjoFytzvSFet1Y16rDbtSenUr X4tOGwoZu8GNhhOF6tD2KMB0yqCvK6sPqbHqE2dIPpGIj4vsM8GzaRRBFlf9VkXm5Cba Y/RyI4sL5LuidkLIHDZjCDN0tSMG9h96xvoDi5U3i5pNOfVbJF6WjNjCAiJE4+AOMCIn rLnvgWcFhkZoeK46cUQKTQXM8pbdOxdCpwFoLoWC7chHrlDwelz9v0XigefarIG83OMV hiLQ== X-Gm-Message-State: AOJu0YwlJj9zYES4osYyjqgn44dU0N2RVVA0dgeSv5+apkFqp2amKssq Cod9uHTOs33vD9C/eldxhAS8cGO/q1qRjq9rOY59U3b4cqDuVIbNuIYWlOhDrrvULrF5Zc8LEbk r X-Received: by 2002:a5d:64e4:0:b0:33d:d843:ecd2 with SMTP id g4-20020a5d64e4000000b0033dd843ecd2mr7044120wri.24.1709040809676; Tue, 27 Feb 2024 05:33:29 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:29 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 26/45] hw/gpio: Add BCM2838 GPIO stub Date: Tue, 27 Feb 2024 13:32:55 +0000 Message-Id: <20240227133314.1721857-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.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: Sergey Kambalin Signed-off-by: Sergey Kambalin Reviewed-by: Peter Maydell Message-id: 20240226000259.2752893-7-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell --- include/hw/gpio/bcm2838_gpio.h | 40 +++++++++ hw/gpio/bcm2838_gpio.c | 153 +++++++++++++++++++++++++++++++++ hw/gpio/meson.build | 5 +- 3 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 include/hw/gpio/bcm2838_gpio.h create mode 100644 hw/gpio/bcm2838_gpio.c diff --git a/include/hw/gpio/bcm2838_gpio.h b/include/hw/gpio/bcm2838_gpio.h new file mode 100644 index 00000000000..06d48e0c191 --- /dev/null +++ b/include/hw/gpio/bcm2838_gpio.h @@ -0,0 +1,40 @@ +/* + * Raspberry Pi (BCM2838) GPIO Controller + * This implementation is based on bcm2835_gpio (hw/gpio/bcm2835_gpio.c) + * + * Copyright (c) 2022 Auriga LLC + * + * Authors: + * Lotosh, Aleksey + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef BCM2838_GPIO_H +#define BCM2838_GPIO_H + +#include "hw/sysbus.h" +#include "qom/object.h" + +#define TYPE_BCM2838_GPIO "bcm2838-gpio" +OBJECT_DECLARE_SIMPLE_TYPE(BCM2838GpioState, BCM2838_GPIO) + +#define BCM2838_GPIO_REGS_SIZE 0x1000 +#define BCM2838_GPIO_NUM 58 +#define GPIO_PUP_PDN_CNTRL_NUM 4 + +struct BCM2838GpioState { + SysBusDevice parent_obj; + + MemoryRegion iomem; + + + uint8_t fsel[BCM2838_GPIO_NUM]; + uint32_t lev0, lev1; + uint8_t sd_fsel; + qemu_irq out[BCM2838_GPIO_NUM]; + uint32_t pup_cntrl_reg[GPIO_PUP_PDN_CNTRL_NUM]; +}; + +#endif diff --git a/hw/gpio/bcm2838_gpio.c b/hw/gpio/bcm2838_gpio.c new file mode 100644 index 00000000000..a312490bbd0 --- /dev/null +++ b/hw/gpio/bcm2838_gpio.c @@ -0,0 +1,153 @@ +/* + * Raspberry Pi (BCM2838) GPIO Controller + * This implementation is based on bcm2835_gpio (hw/gpio/bcm2835_gpio.c) + * + * Copyright (c) 2022 Auriga LLC + * + * Authors: + * Lotosh, Aleksey + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "qemu/timer.h" +#include "qapi/error.h" +#include "hw/sysbus.h" +#include "migration/vmstate.h" +#include "hw/gpio/bcm2838_gpio.h" + +#define GPFSEL0 0x00 +#define GPFSEL1 0x04 +#define GPFSEL2 0x08 +#define GPFSEL3 0x0C +#define GPFSEL4 0x10 +#define GPFSEL5 0x14 +#define GPSET0 0x1C +#define GPSET1 0x20 +#define GPCLR0 0x28 +#define GPCLR1 0x2C +#define GPLEV0 0x34 +#define GPLEV1 0x38 +#define GPEDS0 0x40 +#define GPEDS1 0x44 +#define GPREN0 0x4C +#define GPREN1 0x50 +#define GPFEN0 0x58 +#define GPFEN1 0x5C +#define GPHEN0 0x64 +#define GPHEN1 0x68 +#define GPLEN0 0x70 +#define GPLEN1 0x74 +#define GPAREN0 0x7C +#define GPAREN1 0x80 +#define GPAFEN0 0x88 +#define GPAFEN1 0x8C + +#define GPIO_PUP_PDN_CNTRL_REG0 0xE4 +#define GPIO_PUP_PDN_CNTRL_REG1 0xE8 +#define GPIO_PUP_PDN_CNTRL_REG2 0xEC +#define GPIO_PUP_PDN_CNTRL_REG3 0xF0 + +#define RESET_VAL_CNTRL_REG0 0xAAA95555 +#define RESET_VAL_CNTRL_REG1 0xA0AAAAAA +#define RESET_VAL_CNTRL_REG2 0x50AAA95A +#define RESET_VAL_CNTRL_REG3 0x00055555 + +#define BYTES_IN_WORD 4 + +static uint64_t bcm2838_gpio_read(void *opaque, hwaddr offset, unsigned size) +{ + uint64_t value = 0; + + qemu_log_mask(LOG_UNIMP, "%s: %s: not implemented for %"HWADDR_PRIx"\n", + TYPE_BCM2838_GPIO, __func__, offset); + + return value; +} + +static void bcm2838_gpio_write(void *opaque, hwaddr offset, uint64_t value, + unsigned size) +{ + qemu_log_mask(LOG_UNIMP, "%s: %s: not implemented for %"HWADDR_PRIx"\n", + TYPE_BCM2838_GPIO, __func__, offset); +} + +static void bcm2838_gpio_reset(DeviceState *dev) +{ + BCM2838GpioState *s = BCM2838_GPIO(dev); + + s->lev0 = 0; + s->lev1 = 0; + + memset(s->fsel, 0, sizeof(s->fsel)); + + s->pup_cntrl_reg[0] = RESET_VAL_CNTRL_REG0; + s->pup_cntrl_reg[1] = RESET_VAL_CNTRL_REG1; + s->pup_cntrl_reg[2] = RESET_VAL_CNTRL_REG2; + s->pup_cntrl_reg[3] = RESET_VAL_CNTRL_REG3; +} + +static const MemoryRegionOps bcm2838_gpio_ops = { + .read = bcm2838_gpio_read, + .write = bcm2838_gpio_write, + .endianness = DEVICE_NATIVE_ENDIAN, +}; + +static const VMStateDescription vmstate_bcm2838_gpio = { + .name = "bcm2838_gpio", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT8_ARRAY(fsel, BCM2838GpioState, BCM2838_GPIO_NUM), + VMSTATE_UINT32(lev0, BCM2838GpioState), + VMSTATE_UINT32(lev1, BCM2838GpioState), + VMSTATE_UINT8(sd_fsel, BCM2838GpioState), + VMSTATE_UINT32_ARRAY(pup_cntrl_reg, BCM2838GpioState, + GPIO_PUP_PDN_CNTRL_NUM), + VMSTATE_END_OF_LIST() + } +}; + +static void bcm2838_gpio_init(Object *obj) +{ + BCM2838GpioState *s = BCM2838_GPIO(obj); + DeviceState *dev = DEVICE(obj); + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); + + memory_region_init_io(&s->iomem, obj, &bcm2838_gpio_ops, s, + "bcm2838_gpio", BCM2838_GPIO_REGS_SIZE); + sysbus_init_mmio(sbd, &s->iomem); + qdev_init_gpio_out(dev, s->out, BCM2838_GPIO_NUM); +} + +static void bcm2838_gpio_realize(DeviceState *dev, Error **errp) +{ + /* Temporary stub. Do nothing */ +} + +static void bcm2838_gpio_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + dc->vmsd = &vmstate_bcm2838_gpio; + dc->realize = &bcm2838_gpio_realize; + dc->reset = &bcm2838_gpio_reset; +} + +static const TypeInfo bcm2838_gpio_info = { + .name = TYPE_BCM2838_GPIO, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(BCM2838GpioState), + .instance_init = bcm2838_gpio_init, + .class_init = bcm2838_gpio_class_init, +}; + +static void bcm2838_gpio_register_types(void) +{ + type_register_static(&bcm2838_gpio_info); +} + +type_init(bcm2838_gpio_register_types) diff --git a/hw/gpio/meson.build b/hw/gpio/meson.build index 066ea96480f..8a8d03d885b 100644 --- a/hw/gpio/meson.build +++ b/hw/gpio/meson.build @@ -9,6 +9,9 @@ system_ss.add(when: 'CONFIG_IMX', if_true: files('imx_gpio.c')) system_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_gpio.c')) system_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_gpio.c')) system_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_gpio.c')) -system_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_gpio.c')) +system_ss.add(when: 'CONFIG_RASPI', if_true: files( + 'bcm2835_gpio.c', + 'bcm2838_gpio.c' +)) system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_gpio.c')) system_ss.add(when: 'CONFIG_SIFIVE_GPIO', if_true: files('sifive_gpio.c')) From patchwork Tue Feb 27 13:32:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776235 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp160906wro; Tue, 27 Feb 2024 05:46:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWFToBp3rSwuSMYVIZTWleQfTD0+rpAk8FWseclQXFm3URXd0WSv9XrpnxDgYU6pzkwZU5Yhk+61cCpY+OnFW7M X-Google-Smtp-Source: AGHT+IGOr68ZOSiFyi5B9bZsQJq+jx8q+14xt1V6PRxAton64GKHSslByOu5U8cebU5lyzOthxJG X-Received: by 2002:a05:600c:190f:b0:412:9dfb:967 with SMTP id j15-20020a05600c190f00b004129dfb0967mr8613102wmq.6.1709041579750; Tue, 27 Feb 2024 05:46:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041579; cv=none; d=google.com; s=arc-20160816; b=obIQu+HtRKDK7c1jqi8Tsfpj9V9KWu/ifBJvNXt4lAoOykMEIkEBCkmRWzciotgGSk bpUhKNvWtH7S5k7zv0RtvyK1hk7VUPEuOqBfrPInBI8Rf41EfQV5L2M8SqhGH8bokSSg /UbF3Ze9kXuCNc6kP+nQ5C8kWRdmjcU4g/iw2TLlmFmb3qECVX/z59OvUUwYWIiqjzj0 gmsnFj0ukCClxKGZyw2qtITPnDwInn6NHTHJGYG+0MMrJ5TEyVdWQ5k0E8lw2aXUR4Wf 47aHjbcORfCtn1zUQQGlGLRHKMr0aH4xq2Q3L2lwLZaKvFfZZkUve/TnlsNVkpmtzG3Y lE8w== 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=UqJsGHoyojPBIzuvBfuCvHTajH0a8XiofV/mSv/UonE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=nj6C3DGTAIaLhNs5sYnTlYCZaNcsM1qhRQdXiLG+W+N9skvfG8bh/E9kFaG3s54wLL imqvKiz7Fb9tlN2QmZDtbIurxzy9ixRtmx9qgC2b/ol8Raaj9HtrDXjjW0WC5PzM46oK hc9OuKG1O2Mwa7+8s5BBIhtALsFDKrM9fArv+tjCVyEW8oCZrU9xq3OLR7EedUJxSl0J VU88ZBtqOgWNlv0C7pIycj4FjucJpA4yUfzmq9qmcNhw7mLsLKAqCDCd9s8zmTHGHYyB S1FuuYHEXkr1ov2y2q81tgeSXhjvwsR3mVtJQxgD6okxHvBGLzXtbajhNZ6/3E6bgqmY cDFw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QzrT8REC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k23-20020a5d5257000000b0033de8f5b2ccsi996841wrc.83.2024.02.27.05.46.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:46:19 -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=QzrT8REC; 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 1rexax-00015C-4X; Tue, 27 Feb 2024 08:34:07 -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 1rexaU-0000mt-UA for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:39 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaO-0002uL-E2 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:38 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-33dc3fe739aso1659013f8f.0 for ; Tue, 27 Feb 2024 05:33:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040810; x=1709645610; 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=UqJsGHoyojPBIzuvBfuCvHTajH0a8XiofV/mSv/UonE=; b=QzrT8RECL48KHUU596vTocnPf3NIl/fWYaAgY8sy5vRAt103dhMyRFvPU/Q7dVdsQv 6L+FyjCtNKUKAD6FFpPvU/qcbobMs2QS/IKtzWJ1M3DqgeB0hCCZAJURaELKIpPQkOz7 E6I7hbeytL3vbgQ0jFKGqoyuhfwpBcsfgzBwXltarMIki8XCn3ZCC4KQpkqHHwCw4lUa ut2PrKL9ae46Bre2pDi2PgbH6g49GHl3licfXo0XjFWuhur9ZyPVJpfp0lQ90gDtsD1A VSspemPqIP0SekwNPEhGOBbeJup1sK0MthlhbWJpLiYKHPZnN5gpiMISVpq3lnnJ6+72 CUZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040810; x=1709645610; 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=UqJsGHoyojPBIzuvBfuCvHTajH0a8XiofV/mSv/UonE=; b=YiTlgdlSkCpmhfIa/MUusCBvGLLZl2sG2lKVVXESH9qNLkyCM+9tNIdcpaNBm758D8 vD+P/OE5OtP7Fo6dZ3bT+hWTGxyWXPEyQ+1iZNPtRxNOEyKZRiBKyG/obkuK3mscyLhj QiuU6VvfXwjzHHvs2K9EW3UIY/Gul8o9ymJjMN3dipQ7oZkTbGeo0lH88IubnzgMNn6i ljY4TJP9ahMnw9DVEpgdAsZckIwt6mWXya5dbwAN3y65prQKeiVatcZASoDIIvjzC/Uj uPtEr15VXeIOtz9q19DtLepemXrnbI606Qf5u/iMGQyzdsfXsM9C9lV+P56wWGCh9oIV Jr1g== X-Gm-Message-State: AOJu0YyS+d2+sy6uiVxotM2a31TucpHgz97p7miRR01Rm2xoSF6oKLY8 c/1GF267B/Lvjqh6Yua4fS/fXTdYYUiUIcMaMumSRz4ZipZ+lPkFhPqndXSHFML5DqwXAGPIiUw 8 X-Received: by 2002:a05:6000:120a:b0:33d:2567:995c with SMTP id e10-20020a056000120a00b0033d2567995cmr7833867wrx.1.1709040810114; Tue, 27 Feb 2024 05:33:30 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:29 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 27/45] hw/gpio: Implement BCM2838 GPIO functionality Date: Tue, 27 Feb 2024 13:32:56 +0000 Message-Id: <20240227133314.1721857-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.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: Sergey Kambalin Signed-off-by: Sergey Kambalin Reviewed-by: Peter Maydell Message-id: 20240226000259.2752893-8-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell --- hw/gpio/bcm2838_gpio.c | 193 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 190 insertions(+), 3 deletions(-) diff --git a/hw/gpio/bcm2838_gpio.c b/hw/gpio/bcm2838_gpio.c index a312490bbd0..69d15dbb497 100644 --- a/hw/gpio/bcm2838_gpio.c +++ b/hw/gpio/bcm2838_gpio.c @@ -18,6 +18,7 @@ #include "hw/sysbus.h" #include "migration/vmstate.h" #include "hw/gpio/bcm2838_gpio.h" +#include "hw/irq.h" #define GPFSEL0 0x00 #define GPFSEL1 0x04 @@ -56,14 +57,139 @@ #define RESET_VAL_CNTRL_REG2 0x50AAA95A #define RESET_VAL_CNTRL_REG3 0x00055555 +#define NUM_FSELN_IN_GPFSELN 10 +#define NUM_BITS_FSELN 3 +#define MASK_FSELN 0x7 + #define BYTES_IN_WORD 4 +static uint32_t gpfsel_get(BCM2838GpioState *s, uint8_t reg) +{ + int i; + uint32_t value = 0; + for (i = 0; i < NUM_FSELN_IN_GPFSELN; i++) { + uint32_t index = NUM_FSELN_IN_GPFSELN * reg + i; + if (index < sizeof(s->fsel)) { + value |= (s->fsel[index] & MASK_FSELN) << (NUM_BITS_FSELN * i); + } + } + return value; +} + +static void gpfsel_set(BCM2838GpioState *s, uint8_t reg, uint32_t value) +{ + int i; + for (i = 0; i < NUM_FSELN_IN_GPFSELN; i++) { + uint32_t index = NUM_FSELN_IN_GPFSELN * reg + i; + if (index < sizeof(s->fsel)) { + int fsel = (value >> (NUM_BITS_FSELN * i)) & MASK_FSELN; + s->fsel[index] = fsel; + } + } +} + +static int gpfsel_is_out(BCM2838GpioState *s, int index) +{ + if (index >= 0 && index < BCM2838_GPIO_NUM) { + return s->fsel[index] == 1; + } + return 0; +} + +static void gpset(BCM2838GpioState *s, uint32_t val, uint8_t start, + uint8_t count, uint32_t *lev) +{ + uint32_t changes = val & ~*lev; + uint32_t cur = 1; + + int i; + for (i = 0; i < count; i++) { + if ((changes & cur) && (gpfsel_is_out(s, start + i))) { + qemu_set_irq(s->out[start + i], 1); + } + cur <<= 1; + } + + *lev |= val; +} + +static void gpclr(BCM2838GpioState *s, uint32_t val, uint8_t start, + uint8_t count, uint32_t *lev) +{ + uint32_t changes = val & *lev; + uint32_t cur = 1; + + int i; + for (i = 0; i < count; i++) { + if ((changes & cur) && (gpfsel_is_out(s, start + i))) { + qemu_set_irq(s->out[start + i], 0); + } + cur <<= 1; + } + + *lev &= ~val; +} + static uint64_t bcm2838_gpio_read(void *opaque, hwaddr offset, unsigned size) { + BCM2838GpioState *s = (BCM2838GpioState *)opaque; uint64_t value = 0; - qemu_log_mask(LOG_UNIMP, "%s: %s: not implemented for %"HWADDR_PRIx"\n", - TYPE_BCM2838_GPIO, __func__, offset); + switch (offset) { + case GPFSEL0: + case GPFSEL1: + case GPFSEL2: + case GPFSEL3: + case GPFSEL4: + case GPFSEL5: + value = gpfsel_get(s, offset / BYTES_IN_WORD); + break; + case GPSET0: + case GPSET1: + case GPCLR0: + case GPCLR1: + /* Write Only */ + qemu_log_mask(LOG_GUEST_ERROR, "%s: %s: Attempt reading from write only" + " register. 0x%"PRIx64" will be returned." + " Address 0x%"HWADDR_PRIx", size %u\n", + TYPE_BCM2838_GPIO, __func__, value, offset, size); + break; + case GPLEV0: + value = s->lev0; + break; + case GPLEV1: + value = s->lev1; + break; + case GPEDS0: + case GPEDS1: + case GPREN0: + case GPREN1: + case GPFEN0: + case GPFEN1: + case GPHEN0: + case GPHEN1: + case GPLEN0: + case GPLEN1: + case GPAREN0: + case GPAREN1: + case GPAFEN0: + case GPAFEN1: + /* Not implemented */ + qemu_log_mask(LOG_UNIMP, "%s: %s: not implemented for %"HWADDR_PRIx"\n", + TYPE_BCM2838_GPIO, __func__, offset); + break; + case GPIO_PUP_PDN_CNTRL_REG0: + case GPIO_PUP_PDN_CNTRL_REG1: + case GPIO_PUP_PDN_CNTRL_REG2: + case GPIO_PUP_PDN_CNTRL_REG3: + value = s->pup_cntrl_reg[(offset - GPIO_PUP_PDN_CNTRL_REG0) + / sizeof(s->pup_cntrl_reg[0])]; + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, "%s: %s: bad offset %"HWADDR_PRIx"\n", + TYPE_BCM2838_GPIO, __func__, offset); + break; + } return value; } @@ -71,14 +197,75 @@ static uint64_t bcm2838_gpio_read(void *opaque, hwaddr offset, unsigned size) static void bcm2838_gpio_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { - qemu_log_mask(LOG_UNIMP, "%s: %s: not implemented for %"HWADDR_PRIx"\n", + BCM2838GpioState *s = (BCM2838GpioState *)opaque; + + switch (offset) { + case GPFSEL0: + case GPFSEL1: + case GPFSEL2: + case GPFSEL3: + case GPFSEL4: + case GPFSEL5: + gpfsel_set(s, offset / BYTES_IN_WORD, value); + break; + case GPSET0: + gpset(s, value, 0, 32, &s->lev0); + break; + case GPSET1: + gpset(s, value, 32, 22, &s->lev1); + break; + case GPCLR0: + gpclr(s, value, 0, 32, &s->lev0); + break; + case GPCLR1: + gpclr(s, value, 32, 22, &s->lev1); + break; + case GPLEV0: + case GPLEV1: + /* Read Only */ + qemu_log_mask(LOG_GUEST_ERROR, "%s: %s: Attempt writing 0x%"PRIx64"" + " to read only register. Ignored." + " Address 0x%"HWADDR_PRIx", size %u\n", + TYPE_BCM2838_GPIO, __func__, value, offset, size); + break; + case GPEDS0: + case GPEDS1: + case GPREN0: + case GPREN1: + case GPFEN0: + case GPFEN1: + case GPHEN0: + case GPHEN1: + case GPLEN0: + case GPLEN1: + case GPAREN0: + case GPAREN1: + case GPAFEN0: + case GPAFEN1: + /* Not implemented */ + qemu_log_mask(LOG_UNIMP, "%s: %s: not implemented for %"HWADDR_PRIx"\n", + TYPE_BCM2838_GPIO, __func__, offset); + break; + case GPIO_PUP_PDN_CNTRL_REG0: + case GPIO_PUP_PDN_CNTRL_REG1: + case GPIO_PUP_PDN_CNTRL_REG2: + case GPIO_PUP_PDN_CNTRL_REG3: + s->pup_cntrl_reg[(offset - GPIO_PUP_PDN_CNTRL_REG0) + / sizeof(s->pup_cntrl_reg[0])] = value; + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, "%s: %s: bad offset %"HWADDR_PRIx"\n", TYPE_BCM2838_GPIO, __func__, offset); + } + return; } static void bcm2838_gpio_reset(DeviceState *dev) { BCM2838GpioState *s = BCM2838_GPIO(dev); + memset(s->fsel, 0, sizeof(s->fsel)); + s->lev0 = 0; s->lev1 = 0; From patchwork Tue Feb 27 13:32:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776214 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp159308wro; Tue, 27 Feb 2024 05:42:34 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUD4Z6q89dAuIJ92LuhsWWpU34vXoaiCpjl4WnGEst6INeFkJTr1d11g4AOQqLeC0+4PN1GnitsUgPnxfcjUE2a X-Google-Smtp-Source: AGHT+IFWYnjg3rVJNIfeV1fpNBFxnNLPR4yNAaycaH/O16O5Jyx7TCDrQK3h+cYDKNts3BUpFu9K X-Received: by 2002:a05:6358:7251:b0:17b:5635:454e with SMTP id i17-20020a056358725100b0017b5635454emr11812206rwa.32.1709041354282; Tue, 27 Feb 2024 05:42:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041354; cv=none; d=google.com; s=arc-20160816; b=vVW+Ewfcj69p+ORYzEuyaA6yiIsGgHHU0N3ANNO3q0wBQrJo7cxm5TowaPdMZ6eSys NxmyphKIeAtFxZSk3jmlblP6cxLz2eVW+vmXnq5q6jlunHDswDgXz3nF7MhuMKuZtDZo TO3svL4uE/+8ggRrOU1N5ciFt+Rqfql2+oQJY1VVg4q4c4IFpC4+glTHb1FLgKUOuI+B oVOUnR/DXICduq8wXDKWNqh4tgk7GZMM50q3Su5Azvo1KUv55bWl7+vNYUnWKyLC8+HL dKF/YKPIy06+BkzE/2+Z0YwrQK8RWBFGtNjo+530RNMw0Q+STuVhRklbQlKJ2o3vITXW VqTg== 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=KGqC5ypYFTpj73/g0BzMEjHLRiV0ye31/N/3xIe2N+0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=U24jzW8vfN1P2cDrVe2yj39YKGJjJf2GWboQfxgrftboOC4CQyq3hk+7AiKjp/3lz9 7/+t5tsfW/rj0EqZ1moh+4PYxH5OCqnh76TOAzRPlUikElu9Z2pqHIFbBhzAxOHVav23 WqwHGhnlu5p9d7yYKNd0eS+UC5hLSkUNrZkhW8AXLWJ7FlfthRzWe1N3lyYrZRivjGAu d4kutaN6fZOYhDkdWi+2SMsuGIkfGU2K+iUYrKlQSQRcgBsWmwe7OwHyth5iXuqzbAkh 1VwCjK/YulkhX4gqhisvh48VeUKiHBjlVh9t/42YB6clOKdxNC56pDd9xfWSjxqnNzyg yaXg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LeSqz6ou; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m9-20020a0562141bc900b0068f4553e43dsi7690055qvc.39.2024.02.27.05.42.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:42: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=LeSqz6ou; 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 1rexaw-00014z-Fs; Tue, 27 Feb 2024 08:34:06 -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 1rexaT-0000mN-Ro for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:37 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaO-0002uP-EA for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:37 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-33da51fd636so2564887f8f.3 for ; Tue, 27 Feb 2024 05:33:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040810; x=1709645610; 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=KGqC5ypYFTpj73/g0BzMEjHLRiV0ye31/N/3xIe2N+0=; b=LeSqz6ouiBiA311Y9iJpd/ReqGP43NnoVb91ASMogJbiDkVk2vr0mATBQeX4UmHqwp sIbqgr7uhPDx/hkmZECMX8l3rIYWfDfEedTkeVu8Zc1fPLlC43JkI3lHFMN8akQYhVcO 6zC0SqYppU4p++YejOwyaBY2YoB3BBAyYDBYZL+VS1oIAhhAeJQTsUCZ+NDUs9iJNDRr AB/Dim+nRycNPvPRnaUTO9Iko9yvFqwpryG7VlApr71d2/+qntIwWV90c2NcA80sUjJO EEQt8BjbjK7EmMxwibCO0gRWIF74G24wdXZTTBk8PpIxIzJeELFL0Dym3YEu/K+M3bih MT+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040810; x=1709645610; 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=KGqC5ypYFTpj73/g0BzMEjHLRiV0ye31/N/3xIe2N+0=; b=e7sOwJq18TluJK6Mg/cPRSGcK/pDnEt864fCE27UtqNGIqd0kD+XEhuCz+Sxu1T57g a3sqfJsJp004K3IJaRcBA1zB+Vu6i6NRoeCZ44aN/C8YC6n+9mwbLSs5x7f098tvb+5N em/qjXA29bjLGxpPJAWvkCHNzGiXCRWaRPakxT+7eikT28HvnGOmEH2EVaXlJFMm14nM ATz+Sk0q3TpPoPN6Ot4NrQBRnK1sfe4Elvcl3ReIWDOYMQoTJAaNX50HnOK8260HAIcr 5fMvQQZCqG3+Gfm61DEpO0n3X7czk4XCSQNYSTU7Myn4cTlFu9TsvBVfW5hY9yrX0phh HMsg== X-Gm-Message-State: AOJu0YwS13KyWKVUaEYVChRJ+5fSZXuMjnK6PkHsoqv32YOW60WLwFY6 yFBDc/1St65OTYnoTBb8eGd28LLUDkP8R9j7m7RcuEpxnQ2dzrpBV/b8L2Ob0i2YHF62ydXrtPr P X-Received: by 2002:a5d:42c1:0:b0:33d:11e1:47d9 with SMTP id t1-20020a5d42c1000000b0033d11e147d9mr6202495wrr.68.1709040810526; Tue, 27 Feb 2024 05:33:30 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:30 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/45] hw/gpio: Connect SD controller to BCM2838 GPIO Date: Tue, 27 Feb 2024 13:32:57 +0000 Message-Id: <20240227133314.1721857-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.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: Sergey Kambalin Signed-off-by: Sergey Kambalin Reviewed-by: Peter Maydell Message-id: 20240226000259.2752893-9-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell --- include/hw/gpio/bcm2838_gpio.h | 5 ++++ hw/gpio/bcm2838_gpio.c | 52 +++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/include/hw/gpio/bcm2838_gpio.h b/include/hw/gpio/bcm2838_gpio.h index 06d48e0c191..f2a57a697f2 100644 --- a/include/hw/gpio/bcm2838_gpio.h +++ b/include/hw/gpio/bcm2838_gpio.h @@ -14,6 +14,7 @@ #ifndef BCM2838_GPIO_H #define BCM2838_GPIO_H +#include "hw/sd/sd.h" #include "hw/sysbus.h" #include "qom/object.h" @@ -29,6 +30,10 @@ struct BCM2838GpioState { MemoryRegion iomem; + /* SDBus selector */ + SDBus sdbus; + SDBus *sdbus_sdhci; + SDBus *sdbus_sdhost; uint8_t fsel[BCM2838_GPIO_NUM]; uint32_t lev0, lev1; diff --git a/hw/gpio/bcm2838_gpio.c b/hw/gpio/bcm2838_gpio.c index 69d15dbb497..2ddf62f6959 100644 --- a/hw/gpio/bcm2838_gpio.c +++ b/hw/gpio/bcm2838_gpio.c @@ -17,6 +17,7 @@ #include "qapi/error.h" #include "hw/sysbus.h" #include "migration/vmstate.h" +#include "hw/sd/sd.h" #include "hw/gpio/bcm2838_gpio.h" #include "hw/irq.h" @@ -63,6 +64,16 @@ #define BYTES_IN_WORD 4 +/* bcm,function property */ +#define BCM2838_FSEL_GPIO_IN 0 +#define BCM2838_FSEL_GPIO_OUT 1 +#define BCM2838_FSEL_ALT5 2 +#define BCM2838_FSEL_ALT4 3 +#define BCM2838_FSEL_ALT0 4 +#define BCM2838_FSEL_ALT1 5 +#define BCM2838_FSEL_ALT2 6 +#define BCM2838_FSEL_ALT3 7 + static uint32_t gpfsel_get(BCM2838GpioState *s, uint8_t reg) { int i; @@ -86,6 +97,31 @@ static void gpfsel_set(BCM2838GpioState *s, uint8_t reg, uint32_t value) s->fsel[index] = fsel; } } + + /* SD controller selection (48-53) */ + if (s->sd_fsel != BCM2838_FSEL_GPIO_IN + && (s->fsel[48] == BCM2838_FSEL_GPIO_IN) + && (s->fsel[49] == BCM2838_FSEL_GPIO_IN) + && (s->fsel[50] == BCM2838_FSEL_GPIO_IN) + && (s->fsel[51] == BCM2838_FSEL_GPIO_IN) + && (s->fsel[52] == BCM2838_FSEL_GPIO_IN) + && (s->fsel[53] == BCM2838_FSEL_GPIO_IN) + ) { + /* SDHCI controller selected */ + sdbus_reparent_card(s->sdbus_sdhost, s->sdbus_sdhci); + s->sd_fsel = BCM2838_FSEL_GPIO_IN; + } else if (s->sd_fsel != BCM2838_FSEL_ALT0 + && (s->fsel[48] == BCM2838_FSEL_ALT0) /* SD_CLK_R */ + && (s->fsel[49] == BCM2838_FSEL_ALT0) /* SD_CMD_R */ + && (s->fsel[50] == BCM2838_FSEL_ALT0) /* SD_DATA0_R */ + && (s->fsel[51] == BCM2838_FSEL_ALT0) /* SD_DATA1_R */ + && (s->fsel[52] == BCM2838_FSEL_ALT0) /* SD_DATA2_R */ + && (s->fsel[53] == BCM2838_FSEL_ALT0) /* SD_DATA3_R */ + ) { + /* SDHost controller selected */ + sdbus_reparent_card(s->sdbus_sdhci, s->sdbus_sdhost); + s->sd_fsel = BCM2838_FSEL_ALT0; + } } static int gpfsel_is_out(BCM2838GpioState *s, int index) @@ -266,6 +302,11 @@ static void bcm2838_gpio_reset(DeviceState *dev) memset(s->fsel, 0, sizeof(s->fsel)); + s->sd_fsel = 0; + + /* SDHCI is selected by default */ + sdbus_reparent_card(&s->sdbus, s->sdbus_sdhci); + s->lev0 = 0; s->lev1 = 0; @@ -304,6 +345,8 @@ static void bcm2838_gpio_init(Object *obj) DeviceState *dev = DEVICE(obj); SysBusDevice *sbd = SYS_BUS_DEVICE(obj); + qbus_init(&s->sdbus, sizeof(s->sdbus), TYPE_SD_BUS, DEVICE(s), "sd-bus"); + memory_region_init_io(&s->iomem, obj, &bcm2838_gpio_ops, s, "bcm2838_gpio", BCM2838_GPIO_REGS_SIZE); sysbus_init_mmio(sbd, &s->iomem); @@ -312,7 +355,14 @@ static void bcm2838_gpio_init(Object *obj) static void bcm2838_gpio_realize(DeviceState *dev, Error **errp) { - /* Temporary stub. Do nothing */ + BCM2838GpioState *s = BCM2838_GPIO(dev); + Object *obj; + + obj = object_property_get_link(OBJECT(dev), "sdbus-sdhci", &error_abort); + s->sdbus_sdhci = SD_BUS(obj); + + obj = object_property_get_link(OBJECT(dev), "sdbus-sdhost", &error_abort); + s->sdbus_sdhost = SD_BUS(obj); } static void bcm2838_gpio_class_init(ObjectClass *klass, void *data) From patchwork Tue Feb 27 13:32:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776222 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp159941wro; Tue, 27 Feb 2024 05:44:13 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVoxJ0uqo4+RDtU4dRBurWpDZDMILBkgxYeY4TLhWOiIZH2UqwhpUs+JtHxMaKqScxsPO81sZRINhCKo9a8kztg X-Google-Smtp-Source: AGHT+IExuUqSynnQ6mLqZHuXscIfsD5nEa+5Pmvoy1CX5WnJAM8n6MeLozBNaxzK3FUlMkKIk4Cs X-Received: by 2002:a67:ead7:0:b0:471:c4ad:4119 with SMTP id s23-20020a67ead7000000b00471c4ad4119mr6386312vso.8.1709041453647; Tue, 27 Feb 2024 05:44:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041453; cv=none; d=google.com; s=arc-20160816; b=jxt8upPx8fczH4HOlLA1dJlXH16URpZFJmrMMqTw3yT+f9FNiubH243/Xn6cfXGFyl CPeheCtwm2wdwaoLDrOO/3C8Haky+UktES5bwf0csTU3S2NGeKuq7up+L8CwJUmuXmoi xNEqqnTsuvIZSbtwm5txJ2JliyrhgSrpiDEDFKTxn8h9Eotb0b8RqqG7GJXtllEcJylb hJ9Yx9Vpo89sDzdgM+dWEAcD/6HDJR6MHfy+Phvdc5ohqmmHAknwGX3GS4rIGD0HHOoH ZCMr9x1F1gGFI07a07lpGe0W9DLoUvJ+s8OlFBC70E0mIvrjOHd28P2WRy0QjlvgIzVn d8Lg== 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=bnsDuxpc/9b0o5hbfDhwh9os93CNP+sIRCB+KuakBY0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=YTrj2EwzD0FiWZxm/CS62CnSG3bzk2ZYW3mIjGDLSUcmuMVnonXd4nx2DZv4AFw2Z8 bU1c7f/qWLS9efNasSSyZEocZpqOUsK1n+DCECBZn3PfgOxBIGVP09W0bXNpm5jM5hl8 AxZlK+JIpXVh1iZMiA/LJ+80oTFbY8px1ot4qIe5zvoTZnBH9vrfVbgoWuklk4QCIKoq gRcjaov6GbztBLZnldSLtAmWC+sLoaOYhi1+5ZRQMxcp2s7w8vT0365qSHwP3SkTdOyl Rrq7Wrx6tbpFeGoXoff7XlT6tObFqu3eTVn4Hku5kBm0HbrbptNEsiiJYDWnlLD9nJI2 7zbA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=btp6LAY+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m15-20020ac8688f000000b0042e6dab52f2si7277067qtq.430.2024.02.27.05.44.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:44:13 -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=btp6LAY+; 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 1rexam-0000te-Tm; Tue, 27 Feb 2024 08:33: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 1rexaX-0000oV-Dx for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:41 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaQ-0002uS-Ne for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:41 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-33de6da5565so805065f8f.2 for ; Tue, 27 Feb 2024 05:33:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040811; x=1709645611; 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=bnsDuxpc/9b0o5hbfDhwh9os93CNP+sIRCB+KuakBY0=; b=btp6LAY+vXYimAmMXIpd4wSnwV0bClwiGWlO1OXj9saGm6MHGS+5GOHEQZgZb/v6ub uoctr1IRzMs0JRTH4j0TDKcBxc6FzgZE8Ix84eqM8PUyi42dVZl6sB7CVr0upfP+J9nm lpV+XBsr3g4gej51SsU3iJ/w/9jx7qNRKvvmAHx2NuD5AZv0eKzE/wDUdu3gt2xE/+qj q1eVVmGMn4hrEYotANX8eQNtRxHbJHSOt3aKcYqqo4FY9OR8zYRA3SG2oQ1l4MzWtFVg J1rtd/PKSNrtP+BSKdMfglTZOCu910rgpbqBqWHAH2brd2p6NJ+Rsk+yYW1+6KTsqb5v 1+QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040811; x=1709645611; 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=bnsDuxpc/9b0o5hbfDhwh9os93CNP+sIRCB+KuakBY0=; b=M8HVYBlT8NnlqmpIPluZy4MrlMXFWoPg6haxH1xCAagSY8QpVeiDl9WmXvUcWxvXRZ C88+0cG/lH2g5Cg37MQbl4GJVfuFybQ5rSXbT3VhvMt5nTBqC+ljlb/JTEMXeSmDcUfO V85Y+p3GWluB2YfbNROZAJ6OnqrSmhlmDwhYLrn0MtdIYpD1BQfZHoKti0kiot2UAQSq Tia/2pu6BP0j45N84BMHOJc+QGlEdw9mofWN344ROz3eMmhiNj/5cjcZRXF23ztf3PVw dA8eRJa4HdBoBARKtcWzXH9LxB+XoV1+RZ9TovQxosJ+MZeh14lrGu01VwqtI21u9EMa coFw== X-Gm-Message-State: AOJu0Yz0VjaJFER7YiNvVnAZfQ/UVWkC2553gnq5mWWmAa1WID+kE3HZ HZBD9DwZRbbhnLmQIGog95dLfZUuwVIuzS+o15YHJF1bvtTj3Xor0l9UyMpnFIDzg8G2BrpB6Ob w X-Received: by 2002:adf:f684:0:b0:33d:6bd3:9e24 with SMTP id v4-20020adff684000000b0033d6bd39e24mr7247269wrp.1.1709040810966; Tue, 27 Feb 2024 05:33:30 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:30 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/45] hw/arm: Add GPIO and SD to BCM2838 periph Date: Tue, 27 Feb 2024 13:32:58 +0000 Message-Id: <20240227133314.1721857-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.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: Sergey Kambalin Signed-off-by: Sergey Kambalin Reviewed-by: Peter Maydell Message-id: 20240226000259.2752893-10-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell --- include/hw/arm/bcm2838_peripherals.h | 8 ++ hw/arm/bcm2838_peripherals.c | 143 +++++++++++++++++++++++++++ 2 files changed, 151 insertions(+) diff --git a/include/hw/arm/bcm2838_peripherals.h b/include/hw/arm/bcm2838_peripherals.h index d07831753ab..86b0d96944e 100644 --- a/include/hw/arm/bcm2838_peripherals.h +++ b/include/hw/arm/bcm2838_peripherals.h @@ -10,6 +10,8 @@ #define BCM2838_PERIPHERALS_H #include "hw/arm/bcm2835_peripherals.h" +#include "hw/sd/sdhci.h" +#include "hw/gpio/bcm2838_gpio.h" /* SPI */ #define GIC_SPI_INTERRUPT_MBOX 33 @@ -45,6 +47,9 @@ #define GPU_INTERRUPT_DMA14 28 #define GPU_INTERRUPT_DMA15 31 +#define BCM2838_MPHI_OFFSET 0xb200 +#define BCM2838_MPHI_SIZE 0x200 + #define TYPE_BCM2838_PERIPHERALS "bcm2838-peripherals" OBJECT_DECLARE_TYPE(BCM2838PeripheralState, BCM2838PeripheralClass, BCM2838_PERIPHERALS) @@ -58,6 +63,9 @@ struct BCM2838PeripheralState { MemoryRegion peri_low_mr_alias; MemoryRegion mphi_mr_alias; + SDHCIState emmc2; + BCM2838GpioState gpio; + OrIRQState mmc_irq_orgate; OrIRQState dma_7_8_irq_orgate; OrIRQState dma_9_10_irq_orgate; diff --git a/hw/arm/bcm2838_peripherals.c b/hw/arm/bcm2838_peripherals.c index 06110c724f8..55ae56733f4 100644 --- a/hw/arm/bcm2838_peripherals.c +++ b/hw/arm/bcm2838_peripherals.c @@ -15,22 +15,56 @@ /* Lower peripheral base address on the VC (GPU) system bus */ #define BCM2838_VC_PERI_LOW_BASE 0x7c000000 +/* Capabilities for SD controller: no DMA, high-speed, default clocks etc. */ +#define BCM2835_SDHC_CAPAREG 0x52134b4 + static void bcm2838_peripherals_init(Object *obj) { BCM2838PeripheralState *s = BCM2838_PERIPHERALS(obj); BCM2838PeripheralClass *bc = BCM2838_PERIPHERALS_GET_CLASS(obj); + BCMSocPeripheralBaseState *s_base = BCM_SOC_PERIPHERALS_BASE(obj); /* Lower memory region for peripheral devices (exported to the Soc) */ memory_region_init(&s->peri_low_mr, obj, "bcm2838-peripherals", bc->peri_low_size); sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->peri_low_mr); + /* Extended Mass Media Controller 2 */ + object_initialize_child(obj, "emmc2", &s->emmc2, TYPE_SYSBUS_SDHCI); + + /* GPIO */ + object_initialize_child(obj, "gpio", &s->gpio, TYPE_BCM2838_GPIO); + + object_property_add_const_link(OBJECT(&s->gpio), "sdbus-sdhci", + OBJECT(&s_base->sdhci.sdbus)); + object_property_add_const_link(OBJECT(&s->gpio), "sdbus-sdhost", + OBJECT(&s_base->sdhost.sdbus)); + + object_initialize_child(obj, "mmc_irq_orgate", &s->mmc_irq_orgate, + TYPE_OR_IRQ); + object_property_set_int(OBJECT(&s->mmc_irq_orgate), "num-lines", 2, + &error_abort); + + object_initialize_child(obj, "dma_7_8_irq_orgate", &s->dma_7_8_irq_orgate, + TYPE_OR_IRQ); + object_property_set_int(OBJECT(&s->dma_7_8_irq_orgate), "num-lines", 2, + &error_abort); + + object_initialize_child(obj, "dma_9_10_irq_orgate", &s->dma_9_10_irq_orgate, + TYPE_OR_IRQ); + object_property_set_int(OBJECT(&s->dma_9_10_irq_orgate), "num-lines", 2, + &error_abort); } static void bcm2838_peripherals_realize(DeviceState *dev, Error **errp) { + DeviceState *mmc_irq_orgate; + DeviceState *dma_7_8_irq_orgate; + DeviceState *dma_9_10_irq_orgate; + MemoryRegion *mphi_mr; BCM2838PeripheralState *s = BCM2838_PERIPHERALS(dev); BCMSocPeripheralBaseState *s_base = BCM_SOC_PERIPHERALS_BASE(dev); + int n; bcm_soc_peripherals_common_realize(dev, errp); @@ -42,6 +76,115 @@ static void bcm2838_peripherals_realize(DeviceState *dev, Error **errp) BCM2838_VC_PERI_LOW_BASE, &s->peri_low_mr_alias, 1); + /* Extended Mass Media Controller 2 */ + object_property_set_uint(OBJECT(&s->emmc2), "sd-spec-version", 3, + &error_abort); + object_property_set_uint(OBJECT(&s->emmc2), "capareg", + BCM2835_SDHC_CAPAREG, &error_abort); + object_property_set_bool(OBJECT(&s->emmc2), "pending-insert-quirk", true, + &error_abort); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->emmc2), errp)) { + return; + } + + memory_region_add_subregion(&s_base->peri_mr, EMMC2_OFFSET, + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->emmc2), + 0)); + + /* According to DTS, EMMC and EMMC2 share one irq */ + if (!qdev_realize(DEVICE(&s->mmc_irq_orgate), NULL, errp)) { + return; + } + + mmc_irq_orgate = DEVICE(&s->mmc_irq_orgate); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->emmc2), 0, + qdev_get_gpio_in(mmc_irq_orgate, 0)); + + sysbus_connect_irq(SYS_BUS_DEVICE(&s_base->sdhci), 0, + qdev_get_gpio_in(mmc_irq_orgate, 1)); + + /* Connect EMMC and EMMC2 to the interrupt controller */ + qdev_connect_gpio_out(mmc_irq_orgate, 0, + qdev_get_gpio_in_named(DEVICE(&s_base->ic), + BCM2835_IC_GPU_IRQ, + INTERRUPT_ARASANSDIO)); + + /* Connect DMA 0-6 to the interrupt controller */ + for (n = 0; n < 7; n++) { + sysbus_connect_irq(SYS_BUS_DEVICE(&s_base->dma), n, + qdev_get_gpio_in_named(DEVICE(&s_base->ic), + BCM2835_IC_GPU_IRQ, + GPU_INTERRUPT_DMA0 + n)); + } + + /* According to DTS, DMA 7 and 8 share one irq */ + if (!qdev_realize(DEVICE(&s->dma_7_8_irq_orgate), NULL, errp)) { + return; + } + dma_7_8_irq_orgate = DEVICE(&s->dma_7_8_irq_orgate); + + /* Connect DMA 7-8 to the interrupt controller */ + sysbus_connect_irq(SYS_BUS_DEVICE(&s_base->dma), 7, + qdev_get_gpio_in(dma_7_8_irq_orgate, 0)); + sysbus_connect_irq(SYS_BUS_DEVICE(&s_base->dma), 8, + qdev_get_gpio_in(dma_7_8_irq_orgate, 1)); + + qdev_connect_gpio_out(dma_7_8_irq_orgate, 0, + qdev_get_gpio_in_named(DEVICE(&s_base->ic), + BCM2835_IC_GPU_IRQ, + GPU_INTERRUPT_DMA7_8)); + + /* According to DTS, DMA 9 and 10 share one irq */ + if (!qdev_realize(DEVICE(&s->dma_9_10_irq_orgate), NULL, errp)) { + return; + } + dma_9_10_irq_orgate = DEVICE(&s->dma_9_10_irq_orgate); + + /* Connect DMA 9-10 to the interrupt controller */ + sysbus_connect_irq(SYS_BUS_DEVICE(&s_base->dma), 9, + qdev_get_gpio_in(dma_9_10_irq_orgate, 0)); + sysbus_connect_irq(SYS_BUS_DEVICE(&s_base->dma), 10, + qdev_get_gpio_in(dma_9_10_irq_orgate, 1)); + + qdev_connect_gpio_out(dma_9_10_irq_orgate, 0, + qdev_get_gpio_in_named(DEVICE(&s_base->ic), + BCM2835_IC_GPU_IRQ, + GPU_INTERRUPT_DMA9_10)); + + /* Connect DMA 11-14 to the interrupt controller */ + for (n = 11; n < 15; n++) { + sysbus_connect_irq(SYS_BUS_DEVICE(&s_base->dma), n, + qdev_get_gpio_in_named(DEVICE(&s_base->ic), + BCM2835_IC_GPU_IRQ, + GPU_INTERRUPT_DMA11 + n + - 11)); + } + + /* + * Connect DMA 15 to the interrupt controller, it is physically removed + * from other DMA channels and exclusively used by the GPU + */ + sysbus_connect_irq(SYS_BUS_DEVICE(&s_base->dma), 15, + qdev_get_gpio_in_named(DEVICE(&s_base->ic), + BCM2835_IC_GPU_IRQ, + GPU_INTERRUPT_DMA15)); + + /* Map MPHI to BCM2838 memory map */ + mphi_mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s_base->mphi), 0); + memory_region_init_alias(&s->mphi_mr_alias, OBJECT(s), "mphi", mphi_mr, 0, + BCM2838_MPHI_SIZE); + memory_region_add_subregion(&s_base->peri_mr, BCM2838_MPHI_OFFSET, + &s->mphi_mr_alias); + + /* GPIO */ + if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) { + return; + } + memory_region_add_subregion( + &s_base->peri_mr, GPIO_OFFSET, + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gpio), 0)); + + object_property_add_alias(OBJECT(s), "sd-bus", OBJECT(&s->gpio), "sd-bus"); } static void bcm2838_peripherals_class_init(ObjectClass *oc, void *data) From patchwork Tue Feb 27 13:32:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776228 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp160594wro; Tue, 27 Feb 2024 05:45:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWMZDQaaArA0dDDEro4/6sOdYZjEQCF9afEzhuv/SiQ1K3IyAnpWx/SxfKRWJc8gVWA6adnrxRmnVtLL2wEKouG X-Google-Smtp-Source: AGHT+IEdadFsSfvK+d/RUWvdBjxa0fCtGvVobcKz4zWQQd+Re7KkJgK9kR3wnoWK6Othi/34xcFM X-Received: by 2002:a05:6102:1609:b0:471:fc99:51a2 with SMTP id cu9-20020a056102160900b00471fc9951a2mr3236246vsb.17.1709041540908; Tue, 27 Feb 2024 05:45:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041540; cv=none; d=google.com; s=arc-20160816; b=jW8K3u9gXEiCY608RZqjFr6pO1Uki/4WPCcMKzFfZrrg4AWcWwCkNyXhC8GvG6EO8m OmhNj80FqoARfrC+HUxINE8r1V4sYY9sD7sNfy8Aj8H9XIcLSgTkjwe7QO8GvJ3MCLQv Y6H+QGMJxVwJN7HuS1bWEriG20GNV41RWQHd0MAWJo2CFNIO+vN4UoRMLA2nQeWlNB4R EZix1EQ3/BdhYxnKra/L//M0RMDe1dEfIQx5XiDr/BbYS0HTuDWDYCdZuEtjz7aFfr3+ e/CylD+0PwTpYVDwvbhMsx8EgPjxaTN0Gq1Fk32GVLvJBLzsSu6w4wL0VpaqMIbsmtDJ iCMA== 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=q35YcF1YF7GYvOT4t2N1QC44pCmMfpb9rbcmh1O9UAs=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=GiaYABbzUOseFYmjyJIbRnLxSTbAk7+oZUJ+TTTB0qOZuJHkh/BGj8H/gxo1pmphU5 BdKE8O8a8yr+OHpL46j0WsEdJMW6mbzdWVvGWqhaSRf8GwQmqws+67dREp50mMG/8k+Z 3Y3lOdBRFUe8G4+0kpU/5qZKZWJ4wPTuZCZr3f6H3ENze27SDSX5QgOP9wrsQCLqFkdI k0CUJesLe4PSJnGi6WrpXdDxmX1OFcGMhhpw63YPw8kRdSjuzn8dduRVlHnl/Yy0E8Yq EjSlW8QhZn7SjdazSrBHgU7APU/fB4KyV0yv4GUxTOw4ls9esPb9HL8kLXAcgL71PzNF dGMQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Eoo8Gq/1"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jj3-20020a05610218c300b0046ee866b14bsi745572vsb.535.2024.02.27.05.45.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:45:40 -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="Eoo8Gq/1"; 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 1rexat-00012a-JD; Tue, 27 Feb 2024 08:34: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 1rexaW-0000nf-53 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:40 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaO-0002uX-Ni for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:39 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-33d26da3e15so2419590f8f.1 for ; Tue, 27 Feb 2024 05:33:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040811; x=1709645611; 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=q35YcF1YF7GYvOT4t2N1QC44pCmMfpb9rbcmh1O9UAs=; b=Eoo8Gq/1RW6Fo3i7OVfQXC5Pdpx5RWa/IHTGcQ1itr88k3cYeXcq/Mn5mwiXoqFrfJ WsOD2+N54CaFyzdK/1V/yVLRtH4Z0lh8Vzh7jpT1g8FgqEDhcEbIGg3CHzTDoogxlk5R qyZF9S/tAoH5ovte91d4TMMy5qRQcmWzVjXiS16h/H7wkcSAdVha3tkmkBMSTOEksBTf Gf4GLfC3Giqf3PUtF45d4D2ImAzKDSjpzLEiSXZclvBHqrV/zhl/5Sq2/ZBj7SYINMEi 12/DAOvC8jVvuTO++IIpRXzSAiL4ebbWCP0O7fIsz/N2RKZXfDu2BdCIh9eKlBIuSFhr QDaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040811; x=1709645611; 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=q35YcF1YF7GYvOT4t2N1QC44pCmMfpb9rbcmh1O9UAs=; b=Nfr94YEU33mhT3rbcW6cikpSZtbK30Ec3RMeCkVMawg0gSqn5182Jm+t4nSobq8I7M 3W8KzQqs5BM86l4xgERiglaKeGoMedMj/mF769GxYT/9ezeJGsFoTYYc5MRaI1kOEXFc bA1VtgbIyhFTcZ/XD9aNw0+wVKUx0VTIkE/AkSdzppyHefzuGQX9UaPHlRBiYuX/FHK8 iFIvA8IcJSiunPdTMj7hZPDWsiPeJMCocz1Po67VnKrZUya6n7vSGTn9hlFQwspj4k3b XKwoSrT8LzAC2kdq2jm+gWcNdGFfct5l6X1OfkdK7By+qRHsWCHgN2X25oSVmcuwv8Ts akDg== X-Gm-Message-State: AOJu0YxMbqTxe1r6YhXWZnB07PI/C3zf8m3T+svCLW0TYnmEkZhGw3TS RQ29jbteAVeD4xzPZMGFIQ8FY3F5mTscRPTqaEEfTZtMKAQoHVY5XQzVtu38NqImd3u3UqHf4Xl E X-Received: by 2002:adf:ed0b:0:b0:33d:2872:2437 with SMTP id a11-20020adfed0b000000b0033d28722437mr8278795wro.31.1709040811392; Tue, 27 Feb 2024 05:33:31 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:31 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/45] hw/arm: Introduce Raspberry PI 4 machine Date: Tue, 27 Feb 2024 13:32:59 +0000 Message-Id: <20240227133314.1721857-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.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: Sergey Kambalin Signed-off-by: Sergey Kambalin Reviewed-by: Peter Maydell Message-id: 20240226000259.2752893-11-sergey.kambalin@auriga.com [PMM: Change name to 'raspi4b', not 'raspi4b-2g'] Signed-off-by: Peter Maydell --- include/hw/arm/raspi_platform.h | 11 ++++++ include/hw/display/bcm2835_fb.h | 2 + hw/arm/bcm2835_peripherals.c | 17 ++++++-- hw/arm/bcm2836.c | 2 + hw/arm/bcm2838.c | 2 + hw/arm/raspi.c | 27 ++++++++----- hw/arm/raspi4b.c | 70 +++++++++++++++++++++++++++++++++ hw/arm/meson.build | 2 +- 8 files changed, 119 insertions(+), 14 deletions(-) create mode 100644 hw/arm/raspi4b.c diff --git a/include/hw/arm/raspi_platform.h b/include/hw/arm/raspi_platform.h index 3018e8fcf3e..45003e24258 100644 --- a/include/hw/arm/raspi_platform.h +++ b/include/hw/arm/raspi_platform.h @@ -49,6 +49,17 @@ struct RaspiBaseMachineClass { uint32_t board_rev; }; +/* Common functions for raspberry pi machines */ +const char *board_soc_type(uint32_t board_rev); +void raspi_machine_init(MachineState *machine); + +typedef struct BCM283XBaseState BCM283XBaseState; +void raspi_base_machine_init(MachineState *machine, + BCM283XBaseState *soc); + +void raspi_machine_class_common_init(MachineClass *mc, + uint32_t board_rev); + #define MSYNC_OFFSET 0x0000 /* Multicore Sync Block */ #define CCPT_OFFSET 0x1000 /* Compact Camera Port 2 TX */ #define INTE_OFFSET 0x2000 /* VC Interrupt controller */ diff --git a/include/hw/display/bcm2835_fb.h b/include/hw/display/bcm2835_fb.h index 38671afffd5..49541bf08f4 100644 --- a/include/hw/display/bcm2835_fb.h +++ b/include/hw/display/bcm2835_fb.h @@ -16,6 +16,8 @@ #include "ui/console.h" #include "qom/object.h" +#define UPPER_RAM_BASE 0x40000000 + #define TYPE_BCM2835_FB "bcm2835-fb" OBJECT_DECLARE_SIMPLE_TYPE(BCM2835FBState, BCM2835_FB) diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index ed38a08a577..a0bbe76f264 100644 --- a/hw/arm/bcm2835_peripherals.c +++ b/hw/arm/bcm2835_peripherals.c @@ -108,6 +108,7 @@ static void raspi_peripherals_base_init(Object *obj) /* Framebuffer */ object_initialize_child(obj, "fb", &s->fb, TYPE_BCM2835_FB); object_property_add_alias(obj, "vcram-size", OBJECT(&s->fb), "vcram-size"); + object_property_add_alias(obj, "vcram-base", OBJECT(&s->fb), "vcram-base"); object_property_add_const_link(OBJECT(&s->fb), "dma-mr", OBJECT(&s->gpu_bus_mr)); @@ -229,7 +230,7 @@ void bcm_soc_peripherals_common_realize(DeviceState *dev, Error **errp) Object *obj; MemoryRegion *ram; Error *err = NULL; - uint64_t ram_size, vcram_size; + uint64_t ram_size, vcram_size, vcram_base; int n; obj = object_property_get_link(OBJECT(dev), "ram", &error_abort); @@ -333,11 +334,21 @@ void bcm_soc_peripherals_common_realize(DeviceState *dev, Error **errp) return; } - if (!object_property_set_uint(OBJECT(&s->fb), "vcram-base", - ram_size - vcram_size, errp)) { + vcram_base = object_property_get_uint(OBJECT(s), "vcram-base", &err); + if (err) { + error_propagate(errp, err); return; } + if (vcram_base == 0) { + vcram_base = ram_size - vcram_size; + } + vcram_base = MIN(vcram_base, UPPER_RAM_BASE - vcram_size); + + if (!object_property_set_uint(OBJECT(&s->fb), "vcram-base", vcram_base, + errp)) { + return; + } if (!sysbus_realize(SYS_BUS_DEVICE(&s->fb), errp)) { return; } diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 7e4c60dd804..db191661f29 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -66,6 +66,8 @@ static void bcm283x_init(Object *obj) "command-line"); object_property_add_alias(obj, "vcram-size", OBJECT(&s->peripherals), "vcram-size"); + object_property_add_alias(obj, "vcram-base", OBJECT(&s->peripherals), + "vcram-base"); } bool bcm283x_common_realize(DeviceState *dev, BCMSocPeripheralBaseState *ps, diff --git a/hw/arm/bcm2838.c b/hw/arm/bcm2838.c index 332e906a84f..ddb7c5f757a 100644 --- a/hw/arm/bcm2838.c +++ b/hw/arm/bcm2838.c @@ -54,6 +54,8 @@ static void bcm2838_init(Object *obj) "board-rev"); object_property_add_alias(obj, "vcram-size", OBJECT(&s->peripherals), "vcram-size"); + object_property_add_alias(obj, "vcram-base", OBJECT(&s->peripherals), + "vcram-base"); object_property_add_alias(obj, "command-line", OBJECT(&s->peripherals), "command-line"); diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 7d04734cd23..8b1a046912c 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -18,6 +18,7 @@ #include "qapi/error.h" #include "hw/arm/boot.h" #include "hw/arm/bcm2836.h" +#include "hw/arm/bcm2838.h" #include "hw/arm/raspi_platform.h" #include "hw/registerfields.h" #include "qemu/error-report.h" @@ -61,6 +62,7 @@ typedef enum RaspiProcessorId { PROCESSOR_ID_BCM2835 = 0, PROCESSOR_ID_BCM2836 = 1, PROCESSOR_ID_BCM2837 = 2, + PROCESSOR_ID_BCM2838 = 3, } RaspiProcessorId; static const struct { @@ -70,13 +72,9 @@ static const struct { [PROCESSOR_ID_BCM2835] = {TYPE_BCM2835, 1}, [PROCESSOR_ID_BCM2836] = {TYPE_BCM2836, BCM283X_NCPUS}, [PROCESSOR_ID_BCM2837] = {TYPE_BCM2837, BCM283X_NCPUS}, + [PROCESSOR_ID_BCM2838] = {TYPE_BCM2838, BCM283X_NCPUS}, }; -static void raspi_base_machine_init(MachineState *machine, - BCM283XBaseState *soc); -static void raspi_machine_class_common_init(MachineClass *mc, - uint32_t board_rev); - static uint64_t board_ram_size(uint32_t board_rev) { assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */ @@ -93,7 +91,7 @@ static RaspiProcessorId board_processor_id(uint32_t board_rev) return proc_id; } -static const char *board_soc_type(uint32_t board_rev) +const char *board_soc_type(uint32_t board_rev) { return soc_property[board_processor_id(board_rev)].type; } @@ -248,13 +246,14 @@ static void setup_boot(MachineState *machine, ARMCPU *cpu, arm_load_kernel(cpu, machine, &s->binfo); } -static void raspi_base_machine_init(MachineState *machine, +void raspi_base_machine_init(MachineState *machine, BCM283XBaseState *soc) { RaspiBaseMachineClass *mc = RASPI_BASE_MACHINE_GET_CLASS(machine); uint32_t board_rev = mc->board_rev; uint64_t ram_size = board_ram_size(board_rev); - uint32_t vcram_size; + uint32_t vcram_base, vcram_size; + size_t boot_ram_size; DriveInfo *di; BlockBackend *blk; BusState *bus; @@ -293,11 +292,19 @@ static void raspi_base_machine_init(MachineState *machine, vcram_size = object_property_get_uint(OBJECT(soc), "vcram-size", &error_abort); + vcram_base = object_property_get_uint(OBJECT(soc), "vcram-base", + &error_abort); + + if (vcram_base == 0) { + vcram_base = ram_size - vcram_size; + } + boot_ram_size = MIN(vcram_base, UPPER_RAM_BASE - vcram_size); + setup_boot(machine, &soc->cpu[0].core, board_processor_id(board_rev), - machine->ram_size - vcram_size); + boot_ram_size); } -static void raspi_machine_init(MachineState *machine) +void raspi_machine_init(MachineState *machine) { RaspiMachineState *s = RASPI_MACHINE(machine); RaspiBaseMachineState *s_base = RASPI_BASE_MACHINE(machine); diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c new file mode 100644 index 00000000000..f1e91f7c98f --- /dev/null +++ b/hw/arm/raspi4b.c @@ -0,0 +1,70 @@ +/* + * Raspberry Pi 4B emulation + * + * Copyright (C) 2022 Ovchinnikov Vitalii + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/units.h" +#include "qemu/cutils.h" +#include "qapi/error.h" +#include "qapi/visitor.h" +#include "hw/arm/raspi_platform.h" +#include "hw/display/bcm2835_fb.h" +#include "hw/registerfields.h" +#include "qemu/error-report.h" +#include "sysemu/device_tree.h" +#include "hw/boards.h" +#include "hw/loader.h" +#include "hw/arm/boot.h" +#include "qom/object.h" +#include "hw/arm/bcm2838.h" + +#define TYPE_RASPI4B_MACHINE MACHINE_TYPE_NAME("raspi4b") +OBJECT_DECLARE_SIMPLE_TYPE(Raspi4bMachineState, RASPI4B_MACHINE) + +struct Raspi4bMachineState { + RaspiBaseMachineState parent_obj; + BCM2838State soc; +}; + +static void raspi4b_machine_init(MachineState *machine) +{ + Raspi4bMachineState *s = RASPI4B_MACHINE(machine); + RaspiBaseMachineState *s_base = RASPI_BASE_MACHINE(machine); + RaspiBaseMachineClass *mc = RASPI_BASE_MACHINE_GET_CLASS(machine); + BCM2838State *soc = &s->soc; + + s_base->binfo.board_id = mc->board_rev; + + object_initialize_child(OBJECT(machine), "soc", soc, + board_soc_type(mc->board_rev)); + + raspi_base_machine_init(machine, &soc->parent_obj); +} + +static void raspi4b_machine_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc = MACHINE_CLASS(oc); + RaspiBaseMachineClass *rmc = RASPI_BASE_MACHINE_CLASS(oc); + + rmc->board_rev = 0xb03115; /* Revision 1.5, 2 Gb RAM */ + raspi_machine_class_common_init(mc, rmc->board_rev); + mc->init = raspi4b_machine_init; +} + +static const TypeInfo raspi4b_machine_type = { + .name = TYPE_RASPI4B_MACHINE, + .parent = TYPE_RASPI_BASE_MACHINE, + .instance_size = sizeof(Raspi4bMachineState), + .class_init = raspi4b_machine_class_init, +}; + +static void raspi4b_machine_register_type(void) +{ + type_register_static(&raspi4b_machine_type); +} + +type_init(raspi4b_machine_register_type) diff --git a/hw/arm/meson.build b/hw/arm/meson.build index 1390a9d7b51..6808135c1f7 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -30,7 +30,7 @@ arm_ss.add(when: 'CONFIG_ALLWINNER_A10', if_true: files('allwinner-a10.c', 'cubi arm_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3.c', 'orangepi.c')) arm_ss.add(when: 'CONFIG_ALLWINNER_R40', if_true: files('allwinner-r40.c', 'bananapi_m2u.c')) arm_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2836.c', 'raspi.c')) -arm_ss.add(when: ['CONFIG_RASPI', 'TARGET_AARCH64'], if_true: files('bcm2838.c')) +arm_ss.add(when: ['CONFIG_RASPI', 'TARGET_AARCH64'], if_true: files('bcm2838.c', 'raspi4b.c')) arm_ss.add(when: 'CONFIG_STM32F100_SOC', if_true: files('stm32f100_soc.c')) arm_ss.add(when: 'CONFIG_STM32F205_SOC', if_true: files('stm32f205_soc.c')) arm_ss.add(when: 'CONFIG_STM32F405_SOC', if_true: files('stm32f405_soc.c')) From patchwork Tue Feb 27 13:33:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776229 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp160674wro; Tue, 27 Feb 2024 05:45:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX6Q+O/nqtjo2fL+xl3TTTIIZZ7C2WlHTgp3fgrmwjaM/oHfBn8h0vZ0Xr+187Rx2BlZzkVm9VgDJGkQvJljagT X-Google-Smtp-Source: AGHT+IFHF+YtPGjhWS9C0AcFO05DPR8SYdbXw+uoZC5quz96U8EjS+kLYozRpP0lWEyqb5eSalGI X-Received: by 2002:a05:6122:8ca:b0:4d3:2f29:fdf4 with SMTP id 10-20020a05612208ca00b004d32f29fdf4mr980907vkg.2.1709041550990; Tue, 27 Feb 2024 05:45:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041550; cv=none; d=google.com; s=arc-20160816; b=jUKHRS9xm2cdphkfi1slP46Rp9xrEuJ9DJZ9I/PXHugj0Fn33B1kvfjs6FNwQEn3s3 LeD0TJH987GLlsVitvs8ZcVPVTP3Vf9tOS0llbqftZnVZ3RPME8VMliw/EN0dkEvzAbt AqoYD+YgH1q58CO0wI47+nkB7ce5VWwNzge9N6zpUaDbgwg/ILM5+0wjNITkUYOKRFnP mbZQr9XN1hH+JFmPQgwuNqzg+SrTMnBV94q+2+33QVUx5PlZHwnYSfNIbMYLMb4lUb3L x+AlNHGM/RBqEWrW+rySF9SCCkVw2mRjDJcXKS94ApaQUmSYt+vnDlSYaUhpr0SKG8Y9 dXSg== 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=QNvLoArRpYe6FOh3Nx+eEEIbesoQAZTPkpdQB+34Ov4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=xQwjXgNKXxxzYjcuP4LyFYr6DwHfCU0ZRYWUTz3X4xpixc0MXkBEch+Zzbwsm5uFVe QWz5gMgRwZojv1hrMU8oKoU388FOfCmPbJ540Wy4B51VTBV617bXfjVcTCOhrEWCBXwd FtEXzBR5swTyiQS3vh66KMaBWqNnZg/YlVaIVIheKB5JR5ALy+W0tXS0RvLAICftQx4t DoVZvsNFOZaBOOYHeWQ8T2lJ16TbvRkJ6+YlikCtmaRvs77Kx0KqHGG+Ov9qp0IjC2EF kGuLxzSvcqYAyxeCJ8xFWGMUYzYaEOakpsS38lU6CDzOMgmEQhPd5Ce039lxIfZiN6jT tkpg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="l/O7EUV6"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fi8-20020a0561224d0800b004c8bfff5f8dsi858082vkb.287.2024.02.27.05.45.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:45: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="l/O7EUV6"; 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 1rexau-00013X-IT; Tue, 27 Feb 2024 08:34: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 1rexaW-0000nh-5g for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:40 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaP-0002ub-2O for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:39 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-33d6f26ff33so3022306f8f.0 for ; Tue, 27 Feb 2024 05:33:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040812; x=1709645612; 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=QNvLoArRpYe6FOh3Nx+eEEIbesoQAZTPkpdQB+34Ov4=; b=l/O7EUV6KWDNA4lcA+MA3X9SOAPINsfk/2ocoaSh5R3TX3aoIbTSsJ/tmGxceqfZU9 o4sScWlBAAJcWkSveHAqoGQumByDcuC+U8N9kBBqXO91w3JAZKoxOyQszPeU+9Umxcwi UUyY0dfnWJ086knXZaE1BIoBQQTn72hn034uOQKn5Bl/LQMkbevZtHnbZt3JEIR9T9KG +b+AK5wc0QkwvodIdE/CEtoGEcSbiPlCfX1CAFTdnf+afSkN71VafaIfD0ftb+4fkaI9 RaYZAf+FgGZcbUVhIVMXeGE3pdJSsfj0JJC5+23tEppx7zaGfSHlJ8sqOYjBsZGi+ENz pg1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040812; x=1709645612; 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=QNvLoArRpYe6FOh3Nx+eEEIbesoQAZTPkpdQB+34Ov4=; b=RuBi1jV7FWFgmLhYms3yuOcBoueLjJDuqETxYltf8wJNOKWJYfPIcyhGu8kf5KNFLa h+my6sms0YnxgRGQFLRCwLAcq9qz9r3Vhnqs0i8KzPQR6Fr/SLwXHc8LdIvx25pQCXnj SfkNDm4cQSIlfsQlAb/7fgfMxcaYd3tQY1MT3uE06DzqWqQUVJcdLhAETD7ouiTb3m2v oNvrC3yMY7bhHOSR12cufC1jdkO5PtCxi87LVsIi5jq6DkUqRqvC+uIX1TfirFpTqVH+ Kqhjs35asxdYKJans1szms9VJxJkOqp5rXZw/k7f7KSrwdH3tsa8FAWSY6okuAL/Ten0 Nt+g== X-Gm-Message-State: AOJu0YydOep1LpMK7KzSavQLnSqdelABuuhlhHXc0cCSBf/7t8DmxVY3 97QMeWr0bAEhtcTg7LPfXFeb/WJ8eXu/aaVrx9bEPgx+CPBkJb9PE5RRhHdW9K0Nd3jtBWL+gtg P X-Received: by 2002:a5d:6502:0:b0:33d:e74b:e41 with SMTP id x2-20020a5d6502000000b0033de74b0e41mr1649465wru.66.1709040811800; Tue, 27 Feb 2024 05:33:31 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:31 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 31/45] hw/arm/raspi4b: Temporarily disable unimplemented rpi4b devices Date: Tue, 27 Feb 2024 13:33:00 +0000 Message-Id: <20240227133314.1721857-32-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.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: Sergey Kambalin This commit adds RPi4B device tree modifications: - disable pcie, rng200, thermal sensor and genet devices (they're going to be re-enabled in the following commits) - create additional memory region in device tree if RAM amount exceeds VC base address. Signed-off-by: Sergey Kambalin Reviewed-by: Peter Maydell Message-id: 20240226000259.2752893-12-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell --- include/hw/arm/raspi_platform.h | 4 +++ hw/arm/raspi.c | 5 +-- hw/arm/raspi4b.c | 62 +++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 4 deletions(-) diff --git a/include/hw/arm/raspi_platform.h b/include/hw/arm/raspi_platform.h index 45003e24258..0db146e5920 100644 --- a/include/hw/arm/raspi_platform.h +++ b/include/hw/arm/raspi_platform.h @@ -31,6 +31,9 @@ #include "hw/boards.h" #include "hw/arm/boot.h" +/* Registered machine type (matches RPi Foundation bootloader and U-Boot) */ +#define MACH_TYPE_BCM2708 3138 + #define TYPE_RASPI_BASE_MACHINE MACHINE_TYPE_NAME("raspi-base") OBJECT_DECLARE_TYPE(RaspiBaseMachineState, RaspiBaseMachineClass, RASPI_BASE_MACHINE) @@ -59,6 +62,7 @@ void raspi_base_machine_init(MachineState *machine, void raspi_machine_class_common_init(MachineClass *mc, uint32_t board_rev); +uint64_t board_ram_size(uint32_t board_rev); #define MSYNC_OFFSET 0x0000 /* Multicore Sync Block */ #define CCPT_OFFSET 0x1000 /* Compact Camera Port 2 TX */ diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 8b1a046912c..a7a662f40db 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -37,9 +37,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(RaspiMachineState, RASPI_MACHINE) #define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default */ #define SPINTABLE_ADDR 0xd8 /* Pi 3 bootloader spintable */ -/* Registered machine type (matches RPi Foundation bootloader and U-Boot) */ -#define MACH_TYPE_BCM2708 3138 - struct RaspiMachineState { /*< private >*/ RaspiBaseMachineState parent_obj; @@ -75,7 +72,7 @@ static const struct { [PROCESSOR_ID_BCM2838] = {TYPE_BCM2838, BCM283X_NCPUS}, }; -static uint64_t board_ram_size(uint32_t board_rev) +uint64_t board_ram_size(uint32_t board_rev) { assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */ return 256 * MiB << FIELD_EX32(board_rev, REV_CODE, MEMORY_SIZE); diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c index f1e91f7c98f..cb1b1f2f147 100644 --- a/hw/arm/raspi4b.c +++ b/hw/arm/raspi4b.c @@ -21,6 +21,7 @@ #include "hw/arm/boot.h" #include "qom/object.h" #include "hw/arm/bcm2838.h" +#include #define TYPE_RASPI4B_MACHINE MACHINE_TYPE_NAME("raspi4b") OBJECT_DECLARE_SIMPLE_TYPE(Raspi4bMachineState, RASPI4B_MACHINE) @@ -30,6 +31,66 @@ struct Raspi4bMachineState { BCM2838State soc; }; +/* + * Add second memory region if board RAM amount exceeds VC base address + * (see https://datasheets.raspberrypi.com/bcm2711/bcm2711-peripherals.pdf + * 1.2 Address Map) + */ +static int raspi_add_memory_node(void *fdt, hwaddr mem_base, hwaddr mem_len) +{ + int ret; + uint32_t acells, scells; + char *nodename = g_strdup_printf("/memory@%" PRIx64, mem_base); + + acells = qemu_fdt_getprop_cell(fdt, "/", "#address-cells", + NULL, &error_fatal); + scells = qemu_fdt_getprop_cell(fdt, "/", "#size-cells", + NULL, &error_fatal); + if (acells == 0 || scells == 0) { + fprintf(stderr, "dtb file invalid (#address-cells or #size-cells 0)\n"); + ret = -1; + } else { + qemu_fdt_add_subnode(fdt, nodename); + qemu_fdt_setprop_string(fdt, nodename, "device_type", "memory"); + ret = qemu_fdt_setprop_sized_cells(fdt, nodename, "reg", + acells, mem_base, + scells, mem_len); + } + + g_free(nodename); + return ret; +} + +static void raspi4_modify_dtb(const struct arm_boot_info *info, void *fdt) +{ + uint64_t ram_size; + + /* Temporarily disable following devices until they are implemented */ + const char *nodes_to_remove[] = { + "brcm,bcm2711-pcie", + "brcm,bcm2711-rng200", + "brcm,bcm2711-thermal", + "brcm,bcm2711-genet-v5", + }; + + for (int i = 0; i < ARRAY_SIZE(nodes_to_remove); i++) { + const char *dev_str = nodes_to_remove[i]; + + int offset = fdt_node_offset_by_compatible(fdt, -1, dev_str); + if (offset >= 0) { + if (!fdt_nop_node(fdt, offset)) { + warn_report("bcm2711 dtc: %s has been disabled!", dev_str); + } + } + } + + ram_size = board_ram_size(info->board_id); + + if (info->ram_size > UPPER_RAM_BASE) { + raspi_add_memory_node(fdt, UPPER_RAM_BASE, ram_size - UPPER_RAM_BASE); + } +} + static void raspi4b_machine_init(MachineState *machine) { Raspi4bMachineState *s = RASPI4B_MACHINE(machine); @@ -37,6 +98,7 @@ static void raspi4b_machine_init(MachineState *machine) RaspiBaseMachineClass *mc = RASPI_BASE_MACHINE_GET_CLASS(machine); BCM2838State *soc = &s->soc; + s_base->binfo.modify_dtb = raspi4_modify_dtb; s_base->binfo.board_id = mc->board_rev; object_initialize_child(OBJECT(machine), "soc", soc, From patchwork Tue Feb 27 13:33:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776219 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp159899wro; Tue, 27 Feb 2024 05:44:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVUmfuhEoi8XELQWB//oaSE9eVKFoPKwYbVRvy6w1RiLfA0v37x7U0TzvlQSpjPfIpwZJN4dhNza3SFC0wgKUB3 X-Google-Smtp-Source: AGHT+IFqUzPitdWy4FIGz2T575nZFE56JT3SC3mV01MC3CWoUFIotDWdNa6JqYqtgd3ETNSz6IXa X-Received: by 2002:a81:e249:0:b0:607:8196:9d69 with SMTP id z9-20020a81e249000000b0060781969d69mr2104414ywl.30.1709041448303; Tue, 27 Feb 2024 05:44:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041448; cv=none; d=google.com; s=arc-20160816; b=xLlfjqEYwq3hpjOt4bJhZSfHXJAyHZ8XSZg8UMYSSabgn+xh3QSDY+p1poCdzjq+8n 7ZddAZh1JPzAlMOZefmvoppu+BvUsKapAdDWxCuEQTHU/ireW0qE43HD+HIrbSgkm8Oh sN1YlTALA+eaF9kcBoW1TY7d4pGD3go3BZbLMwrcfhwufw1lzipN6oQzKxV+7PQBAlc1 hSTRgiHdQ8+KoTNH2xn/ysUpPXChxCYc0gqAq04EsnCM0MTAEheyjZLxeWGkjwbu+ctp Abdtecdaydklif71YhF2gT3B6omf4QBCKaCgAJiTuCintPYwdNtNweSsK8QMdBVjmzWj M0Ng== 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=uwmzSpK9oNER9eZ+AlpbFKclBhof2k/XtIYq2ahmcKc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=N7gHeW+HjyZPCaSyuNGv/iz6GJ76SCZT/rfLrAe/bmZMjth8AWRoD698NhSBKjjF/T ll1UVj9dMoZlxXQOee/6TdfanEjIo9ezaftb4SLrocS5uL+cY++0anG715ic3x4b8w6v fiNmu5kaRb9BOqrEdszb+vfT4IFRHt5IkAS/cIetTz63NZUR+UpE4wPIX5dr0Gd3+mF3 Gxun+eqxopCTc5KhlaEi97nCljbzA6le8GiMs3FmH//jQXDLBp/9Zo61p4fQL3UjbcHD jsR+j3/fkqG1VYhytFnmhNv1C2GJNpFUVHCshjq8A8Ta3TBi748VD5UzFRfUtp5bYtwf cY+A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aUhqAZiS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h7-20020a05622a170700b0042e47c67394si8039480qtk.761.2024.02.27.05.44.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:44: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=aUhqAZiS; 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 1rexb2-0001A2-ML; Tue, 27 Feb 2024 08:34:12 -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 1rexaW-0000ng-5v for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:40 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaP-0002un-Rj for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:39 -0500 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-33d6f26ff33so3022307f8f.0 for ; Tue, 27 Feb 2024 05:33:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040812; x=1709645612; 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=uwmzSpK9oNER9eZ+AlpbFKclBhof2k/XtIYq2ahmcKc=; b=aUhqAZiSxzuxJ2lxUAGqEv2vBe0dCQzMSrs4UMjQ5DHlf/TYjkGR39z/Kg3zGbPUxY kpTKtoGM6qESB8nbm/HqnW5zNWbiO14lCNHDhuMdj0UyC8OYhgYB3vwdKXjh8TwfXwqW zzWKSeQVfOYIoBhIbvzBKrCnY6uiAI9T7uyNDzRw62S0Jex/0DjiyVwiqqqrxOISHNut UP1n81mqAOVmNkInbCrQJs/EA00g9IvngF/WoCbThdlC16uc/XPSzANiZdV+Is//QYD2 vWrRe6z7QO3/w5+Ek1tzAyHh02MvkTCpdYs3XrtfNfZ5WvxLmCcMvI7cekLYfCHmExmR 48uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040812; x=1709645612; 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=uwmzSpK9oNER9eZ+AlpbFKclBhof2k/XtIYq2ahmcKc=; b=v/EmazjdlDMQ5PCFGgN9wmgO0OCHBocyVQYnlybpAT1Nc+8iyCRKSvJkmg3ND96WQ6 a4wsUfxsu0lrAR+486GbJF5Lahk2t6hkSuILudPvtG+LpUZ2BbzU03gX0fOXI9rk3SMj CEL6cKqvL2Lnuh56nkkqekNhn1wqJBiJlTl7ff+z1966HiZHy54qI5nRAz7aORCMrYJM t85mLyitBZoZvJiH+u7ZdQE+ge4Z7CthOWn65QYnEDXjbPlUq5Fra2SD9eHCBYgOM5Kp 0y/RscFu0HdVceH/A1SbwkShL3CM36FuPIqzpkkgeTsV2ieqtFEE9oO9TVfztKmByTDX fXKg== X-Gm-Message-State: AOJu0YxH0iKk1b6GAPw2z/fGoZjk8jlkMAEjfgfD7tVgsW+AGXwlwIvV yR29y8YKdI56MXdgvUVktX8pDMDqKBmDIyZKKRJZB798dH/CaTWdVlhVc4Q1KO0uLHfJu1ORKBc 8 X-Received: by 2002:a5d:526a:0:b0:33d:f3c4:6002 with SMTP id l10-20020a5d526a000000b0033df3c46002mr941875wrc.1.1709040812214; Tue, 27 Feb 2024 05:33:32 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:32 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 32/45] hw/arm: Add memory region for BCM2837 RPiVid ASB Date: Tue, 27 Feb 2024 13:33:01 +0000 Message-Id: <20240227133314.1721857-33-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.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: Sergey Kambalin Signed-off-by: Sergey Kambalin Reviewed-by: Peter Maydell Message-id: 20240226000259.2752893-13-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell --- include/hw/arm/bcm2838_peripherals.h | 2 ++ include/hw/arm/raspi_platform.h | 2 +- hw/arm/bcm2838_peripherals.c | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/hw/arm/bcm2838_peripherals.h b/include/hw/arm/bcm2838_peripherals.h index 86b0d96944e..af085934c92 100644 --- a/include/hw/arm/bcm2838_peripherals.h +++ b/include/hw/arm/bcm2838_peripherals.h @@ -69,6 +69,8 @@ struct BCM2838PeripheralState { OrIRQState mmc_irq_orgate; OrIRQState dma_7_8_irq_orgate; OrIRQState dma_9_10_irq_orgate; + + UnimplementedDeviceState asb; }; struct BCM2838PeripheralClass { diff --git a/include/hw/arm/raspi_platform.h b/include/hw/arm/raspi_platform.h index 0db146e5920..7bc4807fa51 100644 --- a/include/hw/arm/raspi_platform.h +++ b/include/hw/arm/raspi_platform.h @@ -73,7 +73,7 @@ uint64_t board_ram_size(uint32_t board_rev); #define MPHI_OFFSET 0x6000 /* Message-based Parallel Host Intf. */ #define DMA_OFFSET 0x7000 /* DMA controller, channels 0-14 */ #define ARBA_OFFSET 0x9000 -#define BRDG_OFFSET 0xa000 +#define BRDG_OFFSET 0xa000 /* RPiVid ASB for BCM2838 (BCM2711) */ #define ARM_OFFSET 0xB000 /* ARM control block */ #define ARMCTRL_OFFSET (ARM_OFFSET + 0x000) #define ARMCTRL_IC_OFFSET (ARM_OFFSET + 0x200) /* Interrupt controller */ diff --git a/hw/arm/bcm2838_peripherals.c b/hw/arm/bcm2838_peripherals.c index 55ae56733f4..ca2f37b2606 100644 --- a/hw/arm/bcm2838_peripherals.c +++ b/hw/arm/bcm2838_peripherals.c @@ -185,6 +185,9 @@ static void bcm2838_peripherals_realize(DeviceState *dev, Error **errp) sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gpio), 0)); object_property_add_alias(OBJECT(s), "sd-bus", OBJECT(&s->gpio), "sd-bus"); + + /* BCM2838 RPiVid ASB must be mapped to prevent kernel crash */ + create_unimp(s_base, &s->asb, "bcm2838-asb", BRDG_OFFSET, 0x24); } static void bcm2838_peripherals_class_init(ObjectClass *oc, void *data) From patchwork Tue Feb 27 13:33: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: 776210 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp157979wro; Tue, 27 Feb 2024 05:39:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXRAdQTOfvCOv7ea/R076njMRCqxs/pidLR/MJQ++j3eCR8K8Z1/rSV7Wl5UnKLhnN74AA/1T/WbytyyBC271oz X-Google-Smtp-Source: AGHT+IFl94jAndu80+Glu7CkE3Vr3WrPp529KMS0fhsK3N5Uh1XNuNj7z9toaAih9LVARfHSph7a X-Received: by 2002:a05:620a:81b:b0:787:eb7b:26e7 with SMTP id s27-20020a05620a081b00b00787eb7b26e7mr641138qks.0.1709041164593; Tue, 27 Feb 2024 05:39:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041164; cv=none; d=google.com; s=arc-20160816; b=yoCLLFX56BOegboCUtL/jod+N2GR2zGH+8D6ZzvCC34u9fzmUaV7biOVWBUwiHRcf2 QIsiMSDBYhaPgLz4FSFICwIuOx6dvO36HnCoBG1GBvb7lnxjCntbB+3Y4junRC6MwYrl 3oTRyiO+hL1wntsdgDTScRxrKafOjp3c/dYFQOvDE/xwtcDDz/1XiZ/mP6y73F4Lco34 7+Z5/bHdo7+dTbchp5M+G2M7SCj55z2oCUS+cpz9YMtLjMnHElH1GMuz9eSEIG5XJL+w Amg7gGh0d+gELKtvnsUp9Ej3yPGNSeIDXeA6wQ8Z93Hupfm3LrFM/GVKpllHJbXYorx4 dLQw== 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=Hiu0b1foynOipsz23GrR3xzwd+X8RGGDCKc8WBE7RBE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=XyJ0RHFTngWvu4jPE91XsG1NHegGW8WzpgQTDRO+jd5xG5qZpNXmgdPdpzZqhWQGJp XqnT/K3Wi5CJwrGwoNTJkxJdODdt8VgqcjO9FX9qAPDA0w+c0GgPyXaEFnFAGQVevEG6 gODD2kjubVtQcvw0VfFKu4o0xLBrHxoSjtWLCviFrqatOyHqREQReUQcmnT2q54fBvim qxO+o9Z5rYrSooTpkIJRkodCTO39Xx2ERoq6Lveo/YfoxzxYGUV3Gt5Lt1PgaFQC2t6K jTjkU0WHzrjVvsKku38p4JaQjXkqBNaPu/fx+UfzxhDsLOIHWD3fNR+IO/EVD8+VwaAK yGYw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Shs4pVEU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g11-20020a05620a40cb00b00787e1c35482si1897549qko.432.2024.02.27.05.39.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05: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=Shs4pVEU; 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 1rexaz-000160-N4; Tue, 27 Feb 2024 08:34:09 -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 1rexaY-0000pB-A7 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:47 -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 1rexaS-0002uv-3U for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:41 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-412a390347dso17645935e9.3 for ; Tue, 27 Feb 2024 05:33:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040812; x=1709645612; 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=Hiu0b1foynOipsz23GrR3xzwd+X8RGGDCKc8WBE7RBE=; b=Shs4pVEUvEGCFVZkYyIxTxQRqyFZrV0MhpVko8svk1oBiYgRaasm0SW41LBEajPUGH ppN1zRGksl7rBWjdiamLcmHhp86T0khtDfni/QfL/cq0RIuCrNGFv6F/aYFaqoCDMx3l 2Zgb0kg26b45Ne2POybaUzFVpCUhIdzcvBpkIIs4CYsBTciD0sdC7/QCnLswuMFXmztI KGzztvQ52+Gl0oNtKiPkBcjA/aZ0b5Hf2QKICwi95yVlg89VMBYc1169kfpTUj0rZtR5 vlrdhEX223F46aRIIAb0qONcjAlg8V9QoGTjOHxvNq27QeM0WX6MHoqlHplxWzBTsCQE sAKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040812; x=1709645612; 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=Hiu0b1foynOipsz23GrR3xzwd+X8RGGDCKc8WBE7RBE=; b=bOkC6AiG70O6rhO6JXkZK4Qh11ocOoeD7c7LSoP1HyxspM7uH9RTc+y+taV6hXIgT2 CwdSXrRrzUQK/orL6+ankKu6M8FliWU4bynVj7ejxFBqJxP/HMDfv5wBRglUiSkJRPwh GIbY8ZGCI+tQGx/xOEBMV42JthQFSGylOJtUnzjs1gnTFST4NyQBmk/F31WrYVd7POQN vvXzg51pvwn5i1dQf3yk4RZxOfneJT9zl78Njs9byOztXAQcza6Ja15Xn3Sd4oakV+fI 2cC/kN9CR4QPRLo/HEx+zYu64MtDZHzNF802e0eim5zu+ub78uCjwwerAMPU121y5+WO dXyA== X-Gm-Message-State: AOJu0YyglIAme/rFcfepcFwj7xSA9e20FKT9998TwYlaR3Fum0pxUS7v vHgaKnijjXoiN71l7v2aJO4tfe/dKGezCI+vQTPjYTWV31MRyAe/5kZkepCN0O/0abaEDrvPJw3 r X-Received: by 2002:a05:6000:543:b0:33d:1cc1:bb08 with SMTP id b3-20020a056000054300b0033d1cc1bb08mr7063269wrf.22.1709040812609; Tue, 27 Feb 2024 05:33:32 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:32 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 33/45] hw/arm/bcm2838_peripherals: Add clock_isp stub Date: Tue, 27 Feb 2024 13:33:02 +0000 Message-Id: <20240227133314.1721857-34-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-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: Sergey Kambalin Signed-off-by: Sergey Kambalin Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Peter Maydell --- include/hw/arm/bcm2838_peripherals.h | 1 + hw/arm/bcm2838_peripherals.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/hw/arm/bcm2838_peripherals.h b/include/hw/arm/bcm2838_peripherals.h index af085934c92..7ee1bd066fa 100644 --- a/include/hw/arm/bcm2838_peripherals.h +++ b/include/hw/arm/bcm2838_peripherals.h @@ -71,6 +71,7 @@ struct BCM2838PeripheralState { OrIRQState dma_9_10_irq_orgate; UnimplementedDeviceState asb; + UnimplementedDeviceState clkisp; }; struct BCM2838PeripheralClass { diff --git a/hw/arm/bcm2838_peripherals.c b/hw/arm/bcm2838_peripherals.c index ca2f37b2606..e28bef4a37d 100644 --- a/hw/arm/bcm2838_peripherals.c +++ b/hw/arm/bcm2838_peripherals.c @@ -12,6 +12,9 @@ #include "hw/arm/raspi_platform.h" #include "hw/arm/bcm2838_peripherals.h" +#define CLOCK_ISP_OFFSET 0xc11000 +#define CLOCK_ISP_SIZE 0x100 + /* Lower peripheral base address on the VC (GPU) system bus */ #define BCM2838_VC_PERI_LOW_BASE 0x7c000000 @@ -176,6 +179,9 @@ static void bcm2838_peripherals_realize(DeviceState *dev, Error **errp) memory_region_add_subregion(&s_base->peri_mr, BCM2838_MPHI_OFFSET, &s->mphi_mr_alias); + create_unimp(s_base, &s->clkisp, "bcm2835-clkisp", CLOCK_ISP_OFFSET, + CLOCK_ISP_SIZE); + /* GPIO */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) { return; From patchwork Tue Feb 27 13:33:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776234 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp160887wro; Tue, 27 Feb 2024 05:46:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUIJ09PL+1q2sEzNB1hi85cswLCddPQmbg/B/XT8+1AAoTUoyRVWlpVLz30Y6dfrFPYCLjKcuoxSW8w0xfgoX8b X-Google-Smtp-Source: AGHT+IErXIlNJoIhYK92p6ckm9IhROHk6grg1au1sENYkLPIz5gu+OQgSiMkTBoONeJtObo5la89 X-Received: by 2002:adf:fb0b:0:b0:33d:56a0:88e3 with SMTP id c11-20020adffb0b000000b0033d56a088e3mr7348095wrr.65.1709041577858; Tue, 27 Feb 2024 05:46:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041577; cv=none; d=google.com; s=arc-20160816; b=d5EHWw5Fo3EQYMQJEcQqJzvSJ5uX3CilCDjPkUaLB39jWoEga7wg82viD9ZZmjj6Dz SxUHbQwBfCcCQFkQNMJi259gc5gBTMpzQCh24SSxNA0HOgDrQj/DQPTeQp47HF52Q7wp J1R8BBuLbLN1RtpkAJo6lAaulDMCC/L7ZVzy7Wx8ZJZBWjjhEd4+QG/6r4qSXb7OS/WM mw+2bmgiFx0Vb6/BS3EZJZBMBsD5mTwRDmMb2tgMnvIo8XhRgKC6Y5FmXPIjk97+6NxU y0w0661n0fOCuR0K7WQBwPCGa8+c5GAPjNGEM736Fu9DZcJwefAEF4FMHwWMaJxvCcft ZLAQ== 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=EftjVY6w4DE2ldAEkCyJ7CK71+vFHWwK/iRzj67kYsA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=HPNpwIAn1UAZPuLtRRlKBOqkXhNUzHduSeW0mSW/ksp4B5YSnDBar46DgypyAKHsIz jcXDwdcvrPQahzzBkP/nAWrPizz9OvfGRja9+dQBaeuQqDRoNplXFHMv2wuq/i3baRIQ 2rW33bq71gVqPpE+HaUx2A+lYI43KYQnzY115xRq2YW3pqSc6kyo6oHsHRwtH69vaJ6W Nun2i0B3nkDuer5isvWxe90b4JmcONmF0S85HEw9lpw0+cHo1u8UoFF0u7OND6RlInt/ obzyWdXJJE8hrHSZPOuUFXayKsMbvvuz4D9+y3TvTgelMzD0ALQ1qFc7Yq0qYIjSt4H/ RoEw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cfr27BB0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m12-20020a056000174c00b0033d9c3e7204si3787688wrf.845.2024.02.27.05.46.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:46:17 -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=cfr27BB0; 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 1rexat-00012F-De; Tue, 27 Feb 2024 08:34: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 1rexab-0000pk-FH for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:47 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaT-0002uy-GT for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:43 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-33de64c91abso799195f8f.1 for ; Tue, 27 Feb 2024 05:33:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040813; x=1709645613; 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=EftjVY6w4DE2ldAEkCyJ7CK71+vFHWwK/iRzj67kYsA=; b=cfr27BB01h3QXWD/ltxfDxslW8sl0cRDcapMlmmKYULsBzmHX7U8+G3hsv9nNDzo7v O+1l/jmBypXl7PdBhWPl8Ssd/ATCnSthpMhdjLx44RNtGSspIIrlF5yeyFGqysF9n4tM V2c6tpEXgZfGuqQAI13kCmw8WuDnTVYHsWemByxtvB9BJB/2zqEQg+tmF7OVoWOw97bC +T1aFjKWwEE324bhRppcTjjijDXDfG7h442gkrpUG+LpMsgqUfZgDqr3J0bfDJqj1ocw BkyWtsWVLWHg667RWA9J7WoALdK8mk4Lg8f5MaJJeU87hjtW+SLvOdzosbK8bTUJ7TJO 33Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040813; x=1709645613; 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=EftjVY6w4DE2ldAEkCyJ7CK71+vFHWwK/iRzj67kYsA=; b=bGRcR72UQy7gzGAuo3YOetMRkFmxUE0/3vR8Fy5WbA8PUvEq20FNAvmAc2PtGfoI07 SpzvOz8kHlSKkjWMemLDn6C14Tnd5KloZB07Z2rICrorDjl7AyCv0NPGyiJI15NCXgsR ElVjpnXIaF00FHrL8oMBFaU+83hCW214RE6WZ485cbCLx00wT0RfvtodTqFXgKXGeGXf XJO4WdHTluZIOf9QL14Av9VK3qBTpkx9/KWMkJwZa8Mj6uXrxY6Cf3x9Nw0nDVDgcNcK Coc2MTEtyD19SVtn3fXNPjq5TqvXTdykiPtWNBJpQoqO0ZMFhbY3NwzmPETBUQS24OJK 3UZA== X-Gm-Message-State: AOJu0YwTKhGx8yJq3eEybaYhTOpzxqXMpUMcYxibFWskly7wOVCsSE/H 47IG+KvNVjIeUYERgQ/3RzpJriuFPNneVyBA+2i9zl3ChqgDPljOjvRsd5qj8DnjFgripdAX5zS z X-Received: by 2002:adf:f7cd:0:b0:33d:c29d:2219 with SMTP id a13-20020adff7cd000000b0033dc29d2219mr6825862wrq.8.1709040813046; Tue, 27 Feb 2024 05:33:33 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:32 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 34/45] tests/avocado/boot_linux_console.py: Add Rpi4b boot tests Date: Tue, 27 Feb 2024 13:33:03 +0000 Message-Id: <20240227133314.1721857-35-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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 Signed-off-by: Sergey Kambalin Message-id: 20240226000259.2752893-31-sergey.kambalin@auriga.com Reviewed-by: Peter Maydell [PMM: Comment out use of USB, which depends on PCI] Signed-off-by: Peter Maydell --- tests/avocado/boot_linux_console.py | 97 +++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py index a00202df3cb..989b65111c0 100644 --- a/tests/avocado/boot_linux_console.py +++ b/tests/avocado/boot_linux_console.py @@ -501,6 +501,103 @@ def test_arm_raspi2_initrd(self): # Wait for VM to shut down gracefully self.vm.wait() + def test_arm_raspi4(self): + """ + :avocado: tags=arch:aarch64 + :avocado: tags=machine:raspi4b + :avocado: tags=device:pl011 + :avocado: tags=accel:tcg + :avocado: tags=rpi4b + + The kernel can be rebuilt using the kernel source referenced + and following the instructions on the on: + https://www.raspberrypi.org/documentation/linux/kernel/building.md + """ + + deb_url = ('http://archive.raspberrypi.org/debian/' + 'pool/main/r/raspberrypi-firmware/' + 'raspberrypi-kernel_1.20230106-1_arm64.deb') + deb_hash = '08dc55696535b18a6d4fe6fa10d4c0d905cbb2ed' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, '/boot/kernel8.img') + dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2711-rpi-4-b.dtb') + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'earlycon=pl011,mmio32,0xfe201000 ' + + 'console=ttyAMA0,115200 ' + + 'root=/dev/mmcblk1p2 rootwait ' + + 'dwc_otg.fiq_fsm_enable=0') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-append', kernel_command_line) + # When PCI is supported we can add a USB controller: + # '-device', 'qemu-xhci,bus=pcie.1,id=xhci', + # '-device', 'usb-kbd,bus=xhci.0', + self.vm.launch() + console_pattern = 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) + # When USB is enabled we can look for this + # console_pattern = 'Product: QEMU USB Keyboard' + # self.wait_for_console_pattern(console_pattern) + console_pattern = 'Waiting for root device' + self.wait_for_console_pattern(console_pattern) + + + def test_arm_raspi4_initrd(self): + """ + :avocado: tags=arch:aarch64 + :avocado: tags=machine:raspi4b + :avocado: tags=device:pl011 + :avocado: tags=accel:tcg + :avocado: tags=rpi4b + + The kernel can be rebuilt using the kernel source referenced + and following the instructions on the on: + https://www.raspberrypi.org/documentation/linux/kernel/building.md + """ + deb_url = ('http://archive.raspberrypi.org/debian/' + 'pool/main/r/raspberrypi-firmware/' + 'raspberrypi-kernel_1.20230106-1_arm64.deb') + deb_hash = '08dc55696535b18a6d4fe6fa10d4c0d905cbb2ed' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, '/boot/kernel8.img') + dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2711-rpi-4-b.dtb') + + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '86b2be1384d41c8c388e63078a847f1e1c4cb1de/rootfs/' + 'arm64/rootfs.cpio.gz') + initrd_hash = 'f3d4f9fa92a49aa542f1b44d34be77bbf8ca5b9d' + initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + initrd_path = os.path.join(self.workdir, 'rootfs.cpio') + archive.gzip_uncompress(initrd_path_gz, initrd_path) + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'earlycon=pl011,mmio32,0xfe201000 ' + + 'console=ttyAMA0,115200 ' + + 'panic=-1 noreboot ' + + 'dwc_otg.fiq_fsm_enable=0') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-initrd', initrd_path, + '-append', kernel_command_line, + '-no-reboot') + # When PCI is supported we can add a USB controller: + # '-device', 'qemu-xhci,bus=pcie.1,id=xhci', + # '-device', 'usb-kbd,bus=xhci.0', + self.vm.launch() + self.wait_for_console_pattern('Boot successful.') + + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + 'BCM2835') + exec_command_and_wait_for_pattern(self, 'cat /proc/iomem', + 'cprman@7e101000') + exec_command_and_wait_for_pattern(self, 'halt', 'reboot: System halted') + # TODO: Raspberry Pi4 doesn't shut down properly with recent kernels + # Wait for VM to shut down gracefully + #self.vm.wait() + def test_arm_exynos4210_initrd(self): """ :avocado: tags=arch:arm From patchwork Tue Feb 27 13:33:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776216 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp159719wro; Tue, 27 Feb 2024 05:43:37 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXNarkotl95MaHy6gBtVlGUxB1BZwGZHCXuAiNEIn6NDts9t6DDHsVM+zQLbJHHRXtOU2mUwKc8R35lLFqpHDue X-Google-Smtp-Source: AGHT+IHUxObnzzcCguXsNG6Ad+/YeuFm0bWSzF/OybZteaGIef3DL+RHps/6/PgBMEp4ONE+kApg X-Received: by 2002:a05:6871:b26:b0:21e:9eac:b0a3 with SMTP id fq38-20020a0568710b2600b0021e9eacb0a3mr11058781oab.24.1709041417252; Tue, 27 Feb 2024 05:43:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041417; cv=none; d=google.com; s=arc-20160816; b=wQIqKEWsTbHIvO0p6cjN54tDcnTAen2+9h89527RJ+1jgZ1ABX4gdh5ALTvUgE/Vio d4NYKw51b2EJ8hdUaDkIXWuQKQOVREyW2Xf6Cgzhz0dWaZqP+UYFbKPdrIHGTcsskKxL xdkOiH20rvIu3/Hf0F2AMEIZIDArYAOvsBgG0U8Y2ihBKeM+nyjeZLpzfgHVpkD1WFJl UNK6xJ4ec7wXbrp+O2D82tyX3OsjRoldUu/v7e1AnkppH/g1R9qu0xqXhP4T7skEWfBH BB0z3GapPQQ+nd5ymVxgKcBIu4buQtU+FG2mZ0pcTz67pOoaPc6W4haPxqtqo/9JysJr TXzg== 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=+8/ybQwcfm79xtd0ngd5/n2BlvfQRgOhwhHQ/JtQPWs=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=cyzwb5DRVc9EwtSDc6Vx6gxH1sCohQmoaEN0aw/9B3lSM0T+Yq37ZnIOCQYcL7CNUO 9z7QAwZtpS57qb8J+b4gewdnIYp2/RrZjkbR1qPZEQoWeF6Dj50yaqfSMu7lgozMWfZE 65qm2XqwCLfp88c+5lCPh9RAMpepr5Fboq0TYKR9EPhaKNEam1ohSuVEZ/F6SNL2p5hM S2wMvO2a746zbjGNyXoBuQiD9TsQ53frqE/KyC74SzKB0BVZ/KFWuDKaGOBwMttB8Mpy SaB2GvCsbwbU1orEJGkb4+tDPpq3c0+nqATfZmH1kRG0fILnHTLfOKaZfuyiS6hb0/5f 0eXw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rYo2+mJa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c8-20020a05620a200800b00787b3f280c2si7190904qka.123.2024.02.27.05.43.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:43:37 -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=rYo2+mJa; 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 1rexap-0000uC-7u; Tue, 27 Feb 2024 08:34:00 -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 1rexaX-0000oW-FB for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:41 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaQ-0002v2-Sc for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:41 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-33ddebaf810so959429f8f.2 for ; Tue, 27 Feb 2024 05:33:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040813; x=1709645613; 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=+8/ybQwcfm79xtd0ngd5/n2BlvfQRgOhwhHQ/JtQPWs=; b=rYo2+mJa/Tz1qSKIc/UeXa9FgEQR6BLL7bCdu6WhmdKIcB1VqbbBvDz7qKeRvZ+Ujf sBgybkz9Otm5+JC5oTTOOyosMKxOaM+hCIDPc1KR4EMLvbth4prlz8Z3LYesYEpb7EnD XPWLQD6IG9y3SNbsEBF8K53Ye+ti2bVS1XNG22zJX0DaPcNTbgD8l4dHR8rz/SvNC2aO 6xY8KfdcLOf9yKrhE8411H1gq1KnoTVu0YajXiA2/3xPdB2w0JEW6aOdmWlq0zvk+1Ez NfXJdj7vZGItlk399t1MbuDnimowFh0N93eJIY1s8JWGfdTJzmkPBnfr9mh20YBwGEq4 CVQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040813; x=1709645613; 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=+8/ybQwcfm79xtd0ngd5/n2BlvfQRgOhwhHQ/JtQPWs=; b=RMI6jcTZjhrqKlrM6ygzJFS+JlxlyITj0sJXtbQiASNhw39y3oSlYLKjKAnH2O8R/+ ZA3gJIsvVDI9/tM6JQZu3+S7KDRE+fo7ovZtSBbc6QsA/ckpzUCjcE7WoPP6kooEZJtO FD/geXUpBsL3EjQIauBDhOiAVvEdzW9VzzWZsbOEytA9aSvjrN6gwyy8gu5T5AG2uneV J7n1SJtR7aJT+uHbvxsTg8wdoXum0HTEYxVgapHT5qklUEBQoaJTn+E07zMuCr5Z19Bi m+PKw46MA+XzvcC422BSQlvgmAiOOInmXNXByOLMqSrKeEupzOVzJtVAnDnIEftJBKVV qdEQ== X-Gm-Message-State: AOJu0Yz8GEvH8sYxskxOkS/uonYzblN9bCj7NK2+eIrhCe3wzmWRpNB4 tXk7YV1DvLcGzEaRM1H4ciKPN+Ii6lPiXiEpO3YK7SQwSIhKkk1ebD1tqKinW21B9voL5M8EKpg s X-Received: by 2002:a05:6000:136a:b0:33d:2629:c518 with SMTP id q10-20020a056000136a00b0033d2629c518mr6517686wrz.64.1709040813628; Tue, 27 Feb 2024 05:33:33 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:33 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 35/45] tests/qtest: Add bcm2838 mailbox test stub Date: Tue, 27 Feb 2024 13:33:04 +0000 Message-Id: <20240227133314.1721857-36-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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: Sergey Kambalin Signed-off-by: Sergey Kambalin Message-id: 20240226000259.2752893-32-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- tests/qtest/bcm2838-mailbox.h | 37 +++++++++++++++++++++ tests/qtest/bcm2838-mailbox.c | 60 +++++++++++++++++++++++++++++++++++ tests/qtest/meson.build | 1 + 3 files changed, 98 insertions(+) create mode 100644 tests/qtest/bcm2838-mailbox.h create mode 100644 tests/qtest/bcm2838-mailbox.c diff --git a/tests/qtest/bcm2838-mailbox.h b/tests/qtest/bcm2838-mailbox.h new file mode 100644 index 00000000000..e9e1f53bc98 --- /dev/null +++ b/tests/qtest/bcm2838-mailbox.h @@ -0,0 +1,37 @@ +/* + * Declarations for BCM2838 mailbox test. + * + * Copyright (c) 2023 Auriga LLC + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +typedef struct { + uint32_t size; + uint32_t req_resp_code; +} MboxBufHeader; + +#define DECLARE_TAG_TYPE(TypeName, RequestValueType, ResponseValueType) \ +typedef struct { \ + uint32_t id; \ + uint32_t value_buffer_size; \ + union { \ + struct { \ + uint32_t zero; \ + RequestValueType value; \ + } request; \ + struct { \ + uint32_t size_stat; \ + ResponseValueType value; \ + } response; \ + }; \ +} TypeName + + +int mbox0_has_data(void); +void mbox0_read_message(uint8_t channel, void *msgbuf, size_t msgbuf_size); +void mbox1_write_message(uint8_t channel, uint32_t msg_addr); +int qtest_mbox0_has_data(QTestState *s); +void qtest_mbox0_read_message(QTestState *s, uint8_t channel, void *msgbuf, size_t msgbuf_size); +void qtest_mbox1_write_message(QTestState *s, uint8_t channel, uint32_t msg_addr); diff --git a/tests/qtest/bcm2838-mailbox.c b/tests/qtest/bcm2838-mailbox.c new file mode 100644 index 00000000000..0928a3dff8e --- /dev/null +++ b/tests/qtest/bcm2838-mailbox.c @@ -0,0 +1,60 @@ +/* + * Helper functions to work with BCM2838 mailbox via qtest interface. + * + * Copyright (c) 2023 Auriga LLC + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/registerfields.h" +#include "libqtest-single.h" +#include "bcm2838-mailbox.h" + +REG32(MBOX_EXCHNG_REG, 0) +FIELD(MBOX_EXCHNG_REG, CHANNEL, 0, 4) +FIELD(MBOX_EXCHNG_REG, DATA, 4, 28) + +static uint32_t qtest_mbox0_read_reg32(QTestState *s, uint32_t offset) +{ + return qtest_readl(s, MBOX0_BASE + offset); +} + +static void qtest_mbox1_write_reg32(QTestState *s, uint32_t offset, uint32_t value) +{ + return qtest_writel(s, MBOX1_BASE + offset, value); +} + +static void qtest_mbox1_write(QTestState *s, uint8_t channel, uint32_t data) +{ + uint32_t mbox_reg = 0; + + mbox_reg = FIELD_DP32(mbox_reg, MBOX_EXCHNG_REG, CHANNEL, channel); + mbox_reg = FIELD_DP32(mbox_reg, MBOX_EXCHNG_REG, DATA, data); + qtest_mbox1_write_reg32(s, MBOX_REG_WRITE, mbox_reg); +} + +int qtest_mbox0_has_data(QTestState *s) { + return !(qtest_mbox0_read_reg32(s, MBOX_REG_STATUS) & MBOX_READ_EMPTY); +} + +void qtest_mbox0_read_message(QTestState *s, + uint8_t channel, + void *msgbuf, + size_t msgbuf_size) +{ + uint32_t mbox_reg; + uint32_t msgaddr; + + g_assert(qtest_mbox0_has_data(s)); + mbox_reg = qtest_mbox0_read_reg32(s, MBOX_REG_READ); + g_assert_cmphex(FIELD_EX32(mbox_reg, MBOX_EXCHNG_REG, CHANNEL), ==, channel); + msgaddr = FIELD_EX32(mbox_reg, MBOX_EXCHNG_REG, DATA) << 4; + qtest_memread(s, msgaddr, msgbuf, msgbuf_size); +} + +void qtest_mbox1_write_message(QTestState *s, uint8_t channel, uint32_t msg_addr) +{ + qtest_mbox1_write(s, channel, msg_addr >> 4); +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 6ea77893f50..e49ce4f0929 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -334,6 +334,7 @@ qtests = { 'virtio-net-failover': files('migration-helpers.c'), 'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'), 'netdev-socket': files('netdev-socket.c', '../unit/socket-helpers.c'), + 'bcm2838-mbox-property-test' : files('bcm2838-mailbox.c'), } if vnc.found() From patchwork Tue Feb 27 13:33:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776227 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp160586wro; Tue, 27 Feb 2024 05:45:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVmAgK6kkrsap1bEWVBmTvkmnrY7MdxM5OumXjQ37yWiQ+L3SOv3+qPYwNb6w74pOpA15VcZCwNUHVOEbxwPoxs X-Google-Smtp-Source: AGHT+IEPhc2UTSkl//kyztXG7boTa/19TrFYBTp5t87bunW8Jd0Vc0UhbHWU/cOfbLCwwO+cPZ+u X-Received: by 2002:a05:6102:c03:b0:470:54fa:b366 with SMTP id x3-20020a0561020c0300b0047054fab366mr10430473vss.16.1709041539852; Tue, 27 Feb 2024 05:45:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041539; cv=none; d=google.com; s=arc-20160816; b=0bRxIFK2ggvsve04AdA4D6GQDZAXXR1TnVTh8m+kjyGHhWkhhy3oDMxPHqVeXipI5C 4xOO8hTZDILK15MWSsqFOgQKpcmLPJvaauYC19az3iUzZpa0H9qcv3i6PtwtpuzVce2V zh9VSd4GaSz7Xxu6VW7zL5ro3M62tUwnRFVKVcQ2woRU6lNw2KoUT4rFXBKX1/wnGz1P OWaEoT2UZ8jr2ZOPFRZ/S9E7/GlW6BO7w2LnDGick4TtEXxLo/rT6sDkpdE+g3VjAbpM OTByVo4ZbH5sXnkRXz+W7m8egC7BK16UJgshN1HCEWIX08TcfCTStE25IDcVs+vNHVqo 34LA== 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=/gB32I1sR09/AJAVuS8WOYWpV/CkkUOZlRnkYlseuVI=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=RXIjeGwWS9TE7ev2AIAcnB/lmwx4jdSC8zEzX6Mf9mPMITK2k7466MT4x5fkvYbwaf 42LSW2gE17fgJSpjYAWqrBFZv7Q4bA8eAwR7WpY8/9EJu07Z4mlSvMG+Uk+5tSzj6SN8 j9MGIIs48YWU1/v+vFSxdg9GnJgMjs4xsx/YwH3JezxcemAK7uTl4eqAJ+gCahWCIMt/ HQQ/Y6Al118bAQiP5WHg8yhpek78en1bWKcUb4AEX/aCoVwLLco4eYquWK8XsCaUVbL0 DwZyZX6vXf2KZfua5pCDXM3xzHF6XHIJaA1W1+nHBjJloLOflWO/pz45MD/FNjvBkykg bYaA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ENMl5WDo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fs6-20020a056130198600b007d9014a9b1fsi986753uab.108.2024.02.27.05.45.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:45: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=ENMl5WDo; 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 1rexav-00014j-Oo; Tue, 27 Feb 2024 08:34:05 -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 1rexaY-0000pE-NX for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:47 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaT-0002v6-HN for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:42 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-412a38e2adaso16987615e9.1 for ; Tue, 27 Feb 2024 05:33:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040814; x=1709645614; 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=/gB32I1sR09/AJAVuS8WOYWpV/CkkUOZlRnkYlseuVI=; b=ENMl5WDodGddbLuoHtWzMwLnXO5npR1JCtCocXgxWLEy5qfEasBMvlGKVdJlHvmPUQ veCPZOCgd2wt8c4xKj70heU8lnaMd6tpfOFUL9WK0ZMUzm2OuCPPVOJHmk69xQG8vXXK aBKi7KAxZwNJo9btsA5xKBHseyowvuodIDJ3aWUuZ+c5Q95+s2qGCBzExTJif1pW4k5E CDcirgApa/QtZZiqVGygMT4bM4F5AOdC+0omDn9z2FsQU70W35IIBvXhoQQRs9SxVUho ru7h/GOUKyWO0MziNlTUvrccRGxHLTF7O0TEtTbV0zqFyqI+G6dpdKoTztEepvYNQA7f IhYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040814; x=1709645614; 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=/gB32I1sR09/AJAVuS8WOYWpV/CkkUOZlRnkYlseuVI=; b=uMMNhmYYqLWaPkL7dCeQOjGV/uXkrKm/e5ma61Er7pgFeCg1X/Ld7fzySSJ4LujdD0 jeG3b7L7NCgbyGFdLaDgIBOzwnqQvqxxuhVv+wX0pTb3hw4F8dWdaAX0dzeItZ6jzGUa hYZ58xhK1G/SSyyifku36VuvVzpP9p9/lMPoPFLnNl23KqeJNcz06cHXzN7XuC4BE+Xz vbNmOWv03xM7DIZun1y1exQ2QNjL8TKcDUnDinpDi+29ya5nEqQuaPYpacn/OpUyfBD4 weXK/p2CUNfG+tZk2slgLzilgNviDPs54PFfhPf6VfbNB1t1p04f/uVckAuteqDbDMMS zLig== X-Gm-Message-State: AOJu0Yx2p3y71vgUAgs11b190XDiXfH7BY0FobXp8wgUKtDyGbyKWFHS P5ir9me7sjs/B0n74EePo3FyoC5x7x1HOjIxm7w7mbxI+6qUQ9UR/sDhhWbRkqSqIwELslyjkra 1 X-Received: by 2002:a05:6000:1364:b0:33d:7e99:babc with SMTP id q4-20020a056000136400b0033d7e99babcmr6974817wrz.50.1709040814031; Tue, 27 Feb 2024 05:33:34 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:33 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 36/45] tests/qtest/bcm2828-mailbox: Add mailbox test constants Date: Tue, 27 Feb 2024 13:33:05 +0000 Message-Id: <20240227133314.1721857-37-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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: Sergey Kambalin Signed-off-by: Sergey Kambalin Message-id: 20240226000259.2752893-33-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- tests/qtest/bcm2838-mailbox.h | 88 +++++++++++++++++++++++++++++++++++ tests/qtest/bcm2838-mailbox.c | 1 + 2 files changed, 89 insertions(+) diff --git a/tests/qtest/bcm2838-mailbox.h b/tests/qtest/bcm2838-mailbox.h index e9e1f53bc98..9222b38bad7 100644 --- a/tests/qtest/bcm2838-mailbox.h +++ b/tests/qtest/bcm2838-mailbox.h @@ -7,6 +7,94 @@ * See the COPYING file in the top-level directory. */ +#define MBOX0_BASE 0xFE00B880 +#define MBOX1_BASE 0xFE00B8A0 + +#define MBOX_REG_READ 0x00 +#define MBOX_REG_WRITE 0x00 +#define MBOX_REG_PEEK 0x10 +#define MBOX_REG_SENDER 0x14 +#define MBOX_REG_STATUS 0x18 +#define MBOX_REG_CONFIG 0x1C + +#define MBOX_READ_EMPTY 0x40000000 + +#define MBOX_CHANNEL_ID_PROPERTY 8 + +#define MBOX_PROCESS_REQUEST 0x00000000 +#define MBOX_SUCCESS 0x80000000 +#define MBOX_ERROR_PARSING_BUFFER 0x80000001 + +#define BOARD_REVISION 0xB03115 +#define FIRMWARE_REVISION 0x548E1 +#define FIRMWARE_VARIANT 0x77777777 /* TODO: Find the real value */ + +#define ARM_MEMORY_BASE 0x00000000 +#define ARM_MEMORY_SIZE 0x3c000000 +#define VC_MEMORY_BASE 0x3c000000 +#define VC_MEMORY_SIZE 0x04000000 +#define VC_FB_BASE 0x3c100000 +#define VC_FB_SIZE 0x00096000 + +#define CLOCK_ID_ROOT 0x00000000 +#define CLOCK_ID_EMMC 0x00000001 +#define CLOCK_ID_UART 0x00000002 +#define CLOCK_ID_ARM 0x00000003 +#define CLOCK_ID_CORE 0x00000004 +#define CLOCK_ID_UNDEFINED 0x12345678 + +#define CLOCK_RATE_EMMC 50000000 +#define CLOCK_RATE_UART 3000000 +#define CLOCK_RATE_CORE 350000000 +#define CLOCK_RATE_ANY 700000000 + +#define DEVICE_ID_SD_CARD 0x00000000 +#define DEVICE_ID_UART0 0x00000001 +#define DEVICE_ID_UART1 0x00000002 +#define DEVICE_ID_USB HCD 0x00000003 +#define DEVICE_ID_I2C0 0x00000004 +#define DEVICE_ID_I2C1 0x00000005 +#define DEVICE_ID_I2C2 0x00000006 +#define DEVICE_ID_SPI 0x00000007 +#define DEVICE_ID_CCP2TX 0x00000008 +#define DEVICE_ID_UNKNOWN_0 0x00000009 +#define DEVICE_ID_UNKNOWN_1 0x0000000a + +#define TEMPERATURE_ID_SOC 0x00000000 + +#define TEMPERATURE_SOC 25000 +#define TEMPERATURE_SOC_MAX 99000 + +#define ALIGN_4K 4096 + +#define PIXEL_ORDER_BGR 0 +#define PIXEL_ORDER_RGB 1 + +#define ALPHA_MODE_ENABLED 0 +#define ALPHA_MODE_REVERSED 1 +#define ALPHA_MODE_IGNORED 2 + +#define GPIO_MASK 0x003c + +#define GPIO_0 0x00000080 + +#define GPIO_DIRECTION_IN 0 +#define GPIO_DIRECTION_OUT 1 + +#define GPIO_TERMINATION_DISABLED 0 +#define GPIO_TERMINATION_ENABLED 1 + +#define GPIO_TERMINATION_PULLUP_DISABLED 0 +#define GPIO_TERMINATION_PULLUP_ENABLED 1 + +#define GPIO_POLARITY_LOW 0 +#define GPIO_POLARITY_HIGH 1 + +#define GPIO_STATE_DOWN 0 + +/* Used to test stubs that don't perform actual work */ +#define DUMMY_VALUE 0x12345678 + typedef struct { uint32_t size; uint32_t req_resp_code; diff --git a/tests/qtest/bcm2838-mailbox.c b/tests/qtest/bcm2838-mailbox.c index 0928a3dff8e..1efd3c628a9 100644 --- a/tests/qtest/bcm2838-mailbox.c +++ b/tests/qtest/bcm2838-mailbox.c @@ -11,6 +11,7 @@ #include "hw/registerfields.h" #include "libqtest-single.h" #include "bcm2838-mailbox.h" +#include "hw/arm/raspberrypi-fw-defs.h" REG32(MBOX_EXCHNG_REG, 0) FIELD(MBOX_EXCHNG_REG, CHANNEL, 0, 4) From patchwork Tue Feb 27 13:33:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776205 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp157117wro; Tue, 27 Feb 2024 05:37:17 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXy8k9CJ4AsoIHvPgNCDW/znVvjNxMWJAz3I/9J1eJQ1eKE7y2a+ckoH5gVCLo3F2g56a1Sp2u60cdM7BBd+6GI X-Google-Smtp-Source: AGHT+IF60FLQn0S4yIXXDmmIBYMZX+kQicpJzkaJHlaV94SSc9yg77FA6kaN3YWNxg+/K45YRQwu X-Received: by 2002:a05:622a:50d:b0:42e:8768:355e with SMTP id l13-20020a05622a050d00b0042e8768355emr6025639qtx.9.1709041037454; Tue, 27 Feb 2024 05:37:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041037; cv=none; d=google.com; s=arc-20160816; b=GozLIOXPwbCiIPO513BUtK/8BWAJbpfIWWavNSeVuOdEVZXrrCCXsXAoaMkMcW4Kx6 eXCLjJgatwNgQYggj4M8ZpIwG+OMdrnR5Rg42j0FsDNgb4pDkcHYbChry9lHTL5Rq1B2 SzOxqeQmgjZNc8ctEpSuSWci6uSPb26o4O15ZaSyT0W7x9BgjSDrp4PQJstKjHevi+l/ ikxG6Ix7f6KOP9XBYJlsgND7/jYYS7zJ+ynbmkp/M6znk0sf+1Rcl803aehRnO9+5PD3 bFK5rJ/ramWRMNZuVhuNHaDq17+5rXdDRHkpUg4pLJ3sLkFvtZVg92VSXVLGr+zd0nxS Y1+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=SKp/LXSTlCcUFFla4fnBLkH5V/PUv+zdz1N55mPonwQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=unNNYO/lq6kvCLDiGHSBzh+hz3k+hPXmXJisiy+bnajxbiKs0Z+h14CoP3YmB1/P8u mPvuveHvNhijxhDPTxdCW6axzHmmdP/5nGe2fBME26lH9au4nC/fLDjO1tSp3Gus2ntd /01ihPLirJ3ghrJ8bjXCDTBggZpFNM/IdyrtMT7PVGQZFXxrpk8I5aujsgC95kHObFWk s4IzXbhx/eU6bmxtSd/20gjoIaO8nrofeQdhq8QzMrGXdfxBaSoEfpGbXxWAG5eBKx9V XaUArGPh1/NEaw7hkuNxLvZVQHW62cpNm0qPVbGWEVRqTTSreqciHEqpUp4Ngdb2Yln5 uk4A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wqlLyFiW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f22-20020ac84716000000b0042c4208f213si7263388qtp.44.2024.02.27.05.37.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:37:17 -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=wqlLyFiW; 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 1rexaz-00015y-Nn; Tue, 27 Feb 2024 08:34:09 -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 1rexab-0000pj-F1 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:47 -0500 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaT-0002vE-HV for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:43 -0500 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2d23a22233fso43646371fa.2 for ; Tue, 27 Feb 2024 05:33:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040814; x=1709645614; 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=SKp/LXSTlCcUFFla4fnBLkH5V/PUv+zdz1N55mPonwQ=; b=wqlLyFiW33rsU4Wr+ERhwP67WlCsqMzpIcF3jGYh7uB2MU0OXgXBUwYqMbUUHgdmZi JyebwHcmYYUAMVOFg6W4ubL+GOVQazYuaBXwJ5hPYtOtcvp5E48EKnAnz+NXAeOJFa8y x5uyg4DClgWquHAg4Digpus3XlshEp5OA7s2dYNb0bvfJ+h6hgVRBZAz9u91YBSpkHQk Tgxr5iAMqow4p7IMim4YlYsEqsDfdsl+Y4X1/cJ1B9X77hmrLV1ZZntj2oWY0ZzEQ3mR upJldmuiKV9NLqD2S4KcHGiW4EIW3/UT49xkHTQySLnYkrBQHv1wZUt6uF48jv9HquQS 2X7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040814; x=1709645614; 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=SKp/LXSTlCcUFFla4fnBLkH5V/PUv+zdz1N55mPonwQ=; b=mrqCq+XU6Ph/MctaKubBZJNLATZ+9e4AoLbD94xoy6J/gVoASBz7QfoII3Pyenw8Vd lJjku6ByGJFK6d6fD8Vv/JPCIbalJ3v7tfRCwgnzExMN/uhLvGnTIzt5vXNeBhyKZvrg ErLroOuvya6QA5/4CR68G7H7HOXBIF+49UbZpf9Cf3nUEffYkZs5HsVdbYuWa4rcgxfl K09dam0COSG8BvxReFeiRLWrQevGxnx+X1Ojw0JRyVbJjjx/UGtBv9HhTL/S7hcfg+Mo 8fwyDx6QoEM0Nx9LRolgrRB3ne0IY5XJiUgT5Lagn+xoTxoefiEXx+LMHxyw8emOnUyn 8Hvw== X-Gm-Message-State: AOJu0YyhJci1Ome7LAaPSNw0MMzuOl9DblJbkTzugn1A2uJBNZ/mIOuF Tt9P9sGp4DwCbzMqoTvLlQTRo9J9K/1ezt0p45scgQHY44TzRq4bVS+ce5HiusELJy50tB78nWy 6 X-Received: by 2002:a05:651c:508:b0:2d2:45e0:f154 with SMTP id o8-20020a05651c050800b002d245e0f154mr7130141ljp.26.1709040814450; Tue, 27 Feb 2024 05:33:34 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:34 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 37/45] tests/qtest/bcm2828-mailbox: Add mailbox tests tags. Part 1 Date: Tue, 27 Feb 2024 13:33:06 +0000 Message-Id: <20240227133314.1721857-38-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x22e.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: Sergey Kambalin Signed-off-by: Sergey Kambalin Message-id: 20240226000259.2752893-34-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- tests/qtest/bcm2838-mailbox.h | 177 ++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) diff --git a/tests/qtest/bcm2838-mailbox.h b/tests/qtest/bcm2838-mailbox.h index 9222b38bad7..1360fbb8cf4 100644 --- a/tests/qtest/bcm2838-mailbox.h +++ b/tests/qtest/bcm2838-mailbox.h @@ -116,6 +116,183 @@ typedef struct { \ }; \ } TypeName +DECLARE_TAG_TYPE(TAG_GET_FIRMWARE_REVISION_t, + struct {}, + struct { + uint32_t revision; + }); + +DECLARE_TAG_TYPE(TAG_GET_FIRMWARE_VARIANT_t, + struct {}, + struct { + uint32_t variant; + }); + +DECLARE_TAG_TYPE(TAG_GET_BOARD_REVISION_t, + struct {}, + struct { + uint32_t revision; + }); + +DECLARE_TAG_TYPE(TAG_GET_ARM_MEMORY_t, + struct {}, + struct { + uint32_t base; + uint32_t size; + }); + +DECLARE_TAG_TYPE(TAG_GET_VC_MEMORY_t, + struct {}, + struct { + uint32_t base; + uint32_t size; + }); + +DECLARE_TAG_TYPE(TAG_SET_POWER_STATE_t, + struct { + uint32_t device_id; + uint32_t cmd; + }, + struct { + uint32_t device_id; + uint32_t cmd; + }); + +DECLARE_TAG_TYPE(TAG_GET_CLOCK_STATE_t, + struct { + uint32_t clock_id; + }, + struct { + uint32_t clock_id; + uint32_t cmd; + }); + +DECLARE_TAG_TYPE(TAG_GET_CLOCK_RATE_t, + struct { + uint32_t clock_id; + }, + struct { + uint32_t clock_id; + uint32_t rate; + }); + +DECLARE_TAG_TYPE(TAG_GET_MAX_CLOCK_RATE_t, + struct { + uint32_t clock_id; + }, + struct { + uint32_t clock_id; + uint32_t rate; + }); + +DECLARE_TAG_TYPE(TAG_GET_MIN_CLOCK_RATE_t, + struct { + uint32_t clock_id; + }, + struct { + uint32_t clock_id; + uint32_t rate; + }); + +DECLARE_TAG_TYPE(TAG_GET_CLOCKS_t, + struct {}, + struct { + uint32_t root_clock; + uint32_t arm_clock; + }); + +DECLARE_TAG_TYPE(TAG_GET_TEMPERATURE_t, + struct { + uint32_t temperature_id; + }, + struct { + uint32_t temperature_id; + uint32_t temperature; + }); + +DECLARE_TAG_TYPE(TAG_GET_MAX_TEMPERATURE_t, + struct { + uint32_t temperature_id; + }, + struct { + uint32_t temperature_id; + uint32_t temperature; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_ALLOCATE_t, + struct { + uint32_t alignment; + }, + struct { + uint32_t base; + uint32_t size; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_RELEASE_t, + struct {}, + struct {}); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_BLANK_t, + struct { + uint32_t on; + }, + struct { + uint32_t on; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_GET_PHYSICAL_WIDTH_HEIGHT_t, + struct {}, + struct { + uint32_t width; + uint32_t height; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT_t, + struct { + uint32_t width; + uint32_t height; + }, + struct { + uint32_t width; + uint32_t height; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT_t, + struct { + uint32_t width; + uint32_t height; + }, + struct { + uint32_t width; + uint32_t height; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_GET_VIRTUAL_WIDTH_HEIGHT_t, + struct {}, + struct { + uint32_t width; + uint32_t height; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT_t, + struct { + uint32_t width; + uint32_t height; + }, + struct { + uint32_t width; + uint32_t height; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT_t, + struct { + uint32_t width; + uint32_t height; + }, + struct { + uint32_t width; + uint32_t height; + }); int mbox0_has_data(void); void mbox0_read_message(uint8_t channel, void *msgbuf, size_t msgbuf_size); From patchwork Tue Feb 27 13:33:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776200 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp156808wro; Tue, 27 Feb 2024 05:36:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV5y35Cs3kW+Rky5r0mrtOaXff1tyIpSr9ZWhqxsOzPnmAAPWq8gfNCDLSDxL0vqGvKFKpVUe/wVMaGljDqAEBl X-Google-Smtp-Source: AGHT+IENWoTmQZALwnHmsPoiCk3If5wTih7NOiSnj+8Z4BcpxoqhPfewAX7AV0MFi4HVFxwc+bo9 X-Received: by 2002:a05:620a:462b:b0:785:d82b:784d with SMTP id br43-20020a05620a462b00b00785d82b784dmr2806868qkb.48.1709040996618; Tue, 27 Feb 2024 05:36:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709040996; cv=none; d=google.com; s=arc-20160816; b=TBA5O85foS7ukPDedWMHnhZzeC/kd65O5qUZDGSpgTmx+DPzMUKORqgdyQAeR24xRl J55wZrma3i+TxTySfW5LSMi0wrxeGZSKI+CO6IWw+mhyO+CJ1Mhd1yLyRbr+t+s4Lu8z 3qacQFl3V9Kqm3nL0bbHY241yb2ydGLOjKATFt0TsoKHlAzNTiLqDWvR3y+JvW0ma9W8 C3a1sYdu8L8ajY30jqsCEt2jyWD0cFFqIz50Z3ZlsnYc0yygEupX1Tk3TRJsdcoxS1SW OByCcvwK4UCaE35STv3+C+ZWW3AN1ske8UIfKt/6XJ0LDfZHTzOgEtZWaOUYF/foCGCo KCBA== 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=LAJ/EogWW9dhCM2UgCKzftAD6rpSgQuVvkridR+6mrg=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=wVe5I7zEf9+6GYtOMA6vFjCKdjHGy8zesY+3kxlRsQn2HqETDzMDjx0AB/LydN7tlj n+8ZJ0fgvDXTjO2WwQasYIeUxPlIyyBfUIQmtrlgtTgB1+1/uUoR/XdGvkvNPUCWszhx BWn6cTjTA+/zFra6U9WEfCndxnG31jwj2IaEetzusWoGJTQfxdF0+KC+mvIscc/zN+d7 uAyoucR6mLJTJZYiJs2n3zD+1eriR26C79C5pKVN88RqSHbHTZCEi4frugoYdHXA18de Swpr4/cD/TJa0HCVe7r3ngBDs7ruqXMrLc0rNXewriZnmIrjxGwlO2hMncH3R0V1FmzX W+FA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Bf3iPuIB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id wm8-20020a05620a580800b00787adf4ceccsi7410008qkn.574.2024.02.27.05.36.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:36: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=Bf3iPuIB; 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 1rexb0-000189-K0; Tue, 27 Feb 2024 08:34:10 -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 1rexaZ-0000pQ-PU for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:47 -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 1rexaT-0002vT-HP for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:42 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-412a38e2adaso16988375e9.1 for ; Tue, 27 Feb 2024 05:33:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040815; x=1709645615; 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=LAJ/EogWW9dhCM2UgCKzftAD6rpSgQuVvkridR+6mrg=; b=Bf3iPuIBI9fXEU1eCt8r/ZRczaBsl1Nusmhg500qyPyWZ/Ng354lYhb3ZAW6Tg+an7 Kp+8AeKeD6AFadOoKGA9K9Nl5Qtf3w6AxVpQYktFkDTtf5WlV+C6/bG6jBpA58wHFN4u aDwbOEGvOOAoWJM/LNL04P1hZj3WluYlBH68Ba6DH9FPT+z2QMjmnH74cTg+qg0OeH4P A2LU5HKTMYtJ92A5smDRgyxfa8pkB5xEX2vTUk4ZdHLfwSPXOsIv4v2h1Hd9TSuqrGK6 eFr5G9BkuaElctuGWXw7EuFUFYp/+TjPIe8N4+RmCuq4lQ/+R7BKHVdmGewje/J+N2Pp O5uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040815; x=1709645615; 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=LAJ/EogWW9dhCM2UgCKzftAD6rpSgQuVvkridR+6mrg=; b=BJ7oc/ulayggfTLgCXAU1fGfNM7CehQRNR2/relq5GEgNS6cbHBreX7A4IARKCW9di nAaz8zQ4wswMimVHwoDpazsqrLPRkcFEtUKoQbLOOSJcgB11vYaB/x+XO09HAgC/Me45 B2h2WlbIkjLjy9+dWs2PryOOfTtu754wB3tQIPb7JnssWPTiDGmbHXjSNn2XYmBmrU9y eYoQYiXhVgfMmdjEhJ3QJPjqdYVdp5epc6KFJWVli7Qn00gy9FpSn8ToI4Uh476X8FWo OOSysvIrdzs8xgsK/wiN39YsMA69AmQxgFGWOmodNmMGQHEs+2YSPL6Kx2ZfBUB6EO2t HO1Q== X-Gm-Message-State: AOJu0YzVCQlX4e4SSyDMG/JjGCiF0oTDXkIQGl4QjKkWIhY2jkfx/QTV pF4L407CUv2/mYH213kH7RRbx7lSjzFPnTeD2ufZK98eoDNx7Swm2ltYuX4EmchzPB59LmSlLMD V X-Received: by 2002:a05:600c:3508:b0:412:b0ed:f18f with SMTP id h8-20020a05600c350800b00412b0edf18fmr111726wmq.21.1709040815706; Tue, 27 Feb 2024 05:33:35 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:34 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 38/45] tests/qtest/bcm2828-mailbox: Add mailbox tests tags. Part 2 Date: Tue, 27 Feb 2024 13:33:07 +0000 Message-Id: <20240227133314.1721857-39-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-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: Sergey Kambalin Signed-off-by: Sergey Kambalin Message-id: 20240226000259.2752893-35-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- tests/qtest/bcm2838-mailbox.h | 152 ++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) diff --git a/tests/qtest/bcm2838-mailbox.h b/tests/qtest/bcm2838-mailbox.h index 1360fbb8cf4..b4f7b7b3143 100644 --- a/tests/qtest/bcm2838-mailbox.h +++ b/tests/qtest/bcm2838-mailbox.h @@ -294,6 +294,158 @@ DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT_t, uint32_t height; }); +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_GET_DEPTH_t, + struct {}, + struct { + uint32_t bpp; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_TEST_DEPTH_t, + struct { + uint32_t bpp; + }, + struct { + uint32_t bpp; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_SET_DEPTH_t, + struct { + uint32_t bpp; + }, + struct { + uint32_t bpp; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_GET_PIXEL_ORDER_t, + struct {}, + struct { + uint32_t pixel_order; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_TEST_PIXEL_ORDER_t, + struct { + uint32_t pixel_order; + }, + struct { + uint32_t pixel_order; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_SET_PIXEL_ORDER_t, + struct { + uint32_t pixel_order; + }, + struct { + uint32_t pixel_order; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_GET_ALPHA_MODE_t, + struct {}, + struct { + uint32_t alpha_mode; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_TEST_ALPHA_MODE_t, + struct { + uint32_t alpha_mode; + }, + struct { + uint32_t alpha_mode; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_SET_ALPHA_MODE_t, + struct { + uint32_t alpha_mode; + }, + struct { + uint32_t alpha_mode; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_GET_PITCH_t, + struct {}, + struct { + uint32_t pitch; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_SET_PITCH_t, + struct { + uint32_t pitch; + }, + struct {}); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_GET_VIRTUAL_OFFSET_t, + struct {}, + struct { + uint32_t x; + uint32_t y; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_TEST_VIRTUAL_OFFSET_t, + struct { + uint32_t x; + uint32_t y; + }, + struct { + uint32_t x; + uint32_t y; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_SET_VIRTUAL_OFFSET_t, + struct { + uint32_t x; + uint32_t y; + }, + struct { + uint32_t x; + uint32_t y; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_GET_OVERSCAN_t, + struct {}, + struct { + uint32_t top; + uint32_t bottom; + uint32_t left; + uint32_t right; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_TEST_OVERSCAN_t, + struct { + uint32_t top; + uint32_t bottom; + uint32_t left; + uint32_t right; + }, + struct { + uint32_t top; + uint32_t bottom; + uint32_t left; + uint32_t right; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_SET_OVERSCAN_t, + struct { + uint32_t top; + uint32_t bottom; + uint32_t left; + uint32_t right; + }, + struct { + uint32_t top; + uint32_t bottom; + uint32_t left; + uint32_t right; + }); + +DECLARE_TAG_TYPE(TAG_GET_COMMAND_LINE_t, + struct {}, + struct {}); + +DECLARE_TAG_TYPE(TAG_GET_DMA_CHANNELS_t, + struct {}, + struct { + uint32_t mask; + }); + int mbox0_has_data(void); void mbox0_read_message(uint8_t channel, void *msgbuf, size_t msgbuf_size); void mbox1_write_message(uint8_t channel, uint32_t msg_addr); From patchwork Tue Feb 27 13:33:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776236 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp160946wro; Tue, 27 Feb 2024 05:46:25 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXsZnxs8Eb31/2EWucoeCDFKalNQpwoeBuaOTEZx7PFUP2q3nytpTLvNp01xx2k+UE6RLeFy2cDkITmVin2EIFJ X-Google-Smtp-Source: AGHT+IEyYge4rDpwrSipv2YAZXrY1DvP1X99G5hSv+V6PiJ5I4J+gAYqZI0E09RKIoaqRxP07MgV X-Received: by 2002:ac2:5dcb:0:b0:513:d23:7bf6 with SMTP id x11-20020ac25dcb000000b005130d237bf6mr1017624lfq.21.1709041584853; Tue, 27 Feb 2024 05:46:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041584; cv=none; d=google.com; s=arc-20160816; b=uCtMnaSPDenALXxc8OVtmrHbM5ZGibSazitZHoFUMD6Zby9aU/dYJpUhrzhX1zXhB1 dvDsaByHlL4KrwDVR1f/vapp0pTDFyFaxowahzZ0bW4xgectdE4dDQckdr5sopWvCU3H POT7NuzXmtDD5Y2SwUbcp8cM/JpIBqwFq076AdI2RefBJM7MZeqcE+XRqiI1WcIDoklx rLEFlCoOExefe5LH55o8z4rYNvLWqxDofYQ3jJdGUVjrYi7SsILYt9y/XXDz2oVXovFT r0dxJLX1S3t5HE/SlEi4nB3BBsbw7U2lSdmZpAn8TZFVfNTaerpkheZBIqDhR6iM1MQw i/fA== 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=6xpLdkE9iXtV73i2+Xl5bPxwLohpFKgvSaeqg1dUVtY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=S7leeZINNqN5HOoZ/Wt4xvk7G5NRBR4t7/LHIa4J2AlD952njIRhx7TSq5peIbTKqY L4O7DgCJfCuM5W+rJcE83CQhKYILXMen9U5Qk3Anh4ptF6P7F86z2ldkuLoTiH6xIasT q0kXIrRK9d1XiF+YTKXVvPANm7FCoUh35h9LaUPAR+QREUnduR3yIUW5zM97PZBVA1Sm 7fx6Wu0eeV/ZdErOWHP3r5cJRYnt8D5PyoR70adE1SNZ6axcyDVG5hkGtQihc9SjMYaJ enDi/4tfIrXG9WUB1stU5OOEd4fHIxi2gxCje0h+5HSx1qDgrQdiXKqo3oGSIQEla0Xx poxA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IkEZ53Hn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bd12-20020a05600c1f0c00b00412afe5f412si350425wmb.212.2024.02.27.05.46.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:46: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=IkEZ53Hn; 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 1rexat-00012u-PR; Tue, 27 Feb 2024 08:34: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 1rexab-0000pm-GB for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:47 -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 1rexaT-0002vb-Vd for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:43 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-412a3ebad2aso17393685e9.1 for ; Tue, 27 Feb 2024 05:33:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040816; x=1709645616; 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=6xpLdkE9iXtV73i2+Xl5bPxwLohpFKgvSaeqg1dUVtY=; b=IkEZ53Hn7s5eLL+Nfr3a94zLampuoLXax2F+6be/8rFh0Ttb1Z0JFFPmuhe7nDzhW3 m63TmfZ9lxWUGf6/Gb1s+THkRNaaWIM92en7+etkRHyI6j+k6a7P/AFTLGVHYX62zAMl c+Krp5O7jT5RiVFDG4eWPd2ui/1anwUTPWUYFRu9kaK7lsSY67Z56e6JaK6aWmho84r1 AR2BWrOs9YdbYFbumpLmg7eqGWB6c8UwPlYSlZvoSOxQDU8msluAaR1n5ktDAfcfzQ1Z XhWY1AMAb7xtfqD+HSCtxKFp5x4nuuumI9iFevFbJLJQ0+xf8UkE+/vvaCe4M/d6vQZ1 qe0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040816; x=1709645616; 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=6xpLdkE9iXtV73i2+Xl5bPxwLohpFKgvSaeqg1dUVtY=; b=wIWlQoXVKGNfI5lq+2crOjwt/pzINBONtfnD81Kz+kUNpXc2MutWMgSdlC4xYFOaI7 s+zR5QM/E4AmqcZBf8CDnzZr5foZMP6YvvI898xzcv0RdjBWea6Ual453ya1zl7zgtd0 v9q8cnFe78kvL8t7otPB6ANb3QO9V2cF1Cdct+Pj7IhBZamCne2k9tLEfdTZjZnGiOcm XcGLbCsnTX+cWvVOTNTls99I0ihh8hDIa42uQQew6aEcHmcWmMUJqpH38dhn5OCZs1X/ 8FjbYyB07nOhgN7a/tWZMdvORWqnEwV6ZjyTjeHQhZiw1SIUBPfbic2GJrRjcXgis4ta Zwtg== X-Gm-Message-State: AOJu0Yyup+km7mVJ3Gw5E4OqdVfGZb2Val0IB9wVB9iazkqe1bipw8bC jKmjKAkf10OTiDezGJWJvQ1ggXyXoVVDvGDwtLsG/H0e3GrPLJXOOjoBWqLeUhwzvb6nmwBMt65 f X-Received: by 2002:adf:f50f:0:b0:33d:ca72:7255 with SMTP id q15-20020adff50f000000b0033dca727255mr5044214wro.1.1709040816217; Tue, 27 Feb 2024 05:33:36 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:35 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 39/45] tests/qtest/bcm2828-mailbox: Add mailbox tests tags. Part 3 Date: Tue, 27 Feb 2024 13:33:08 +0000 Message-Id: <20240227133314.1721857-40-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-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: Sergey Kambalin Signed-off-by: Sergey Kambalin Message-id: 20240226000259.2752893-36-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- tests/qtest/bcm2838-mailbox.h | 78 +++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/tests/qtest/bcm2838-mailbox.h b/tests/qtest/bcm2838-mailbox.h index b4f7b7b3143..d753f17fb22 100644 --- a/tests/qtest/bcm2838-mailbox.h +++ b/tests/qtest/bcm2838-mailbox.h @@ -446,6 +446,84 @@ DECLARE_TAG_TYPE(TAG_GET_DMA_CHANNELS_t, uint32_t mask; }); +DECLARE_TAG_TYPE(TAG_GET_THROTTLED_t, + struct {}, + struct { + uint32_t throttled; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_GET_NUM_DISPLAYS_t, + struct {}, + struct { + uint32_t num_displays; + }); + +DECLARE_TAG_TYPE(TAG_FRAMEBUFFER_GET_DISPLAY_SETTINGS_t, + struct {}, + struct { + uint32_t display_num; + uint32_t phys_width; + uint32_t phys_height; + uint32_t bpp; + uint16_t pitch; + uint32_t virt_width; + uint32_t virt_height; + uint16_t virt_width_offset; + uint32_t virt_height_offset; + uint32_t fb_bus_address_lo; + uint32_t fb_bus_address_hi; + }); + +DECLARE_TAG_TYPE(TAG_GET_GPIO_CONFIG_t, + struct { + uint32_t gpio_num; + }, + struct { + uint32_t zero; + uint32_t direction; + uint32_t polarity; + uint32_t term_en; + uint32_t term_pull_up; + }); + + +DECLARE_TAG_TYPE(TAG_SET_GPIO_CONFIG_t, + struct { + uint32_t gpio_num; + uint32_t direction; + uint32_t polarity; + uint32_t term_en; + uint32_t term_pull_up; + uint32_t state; + }, + struct { + uint32_t zero; + }); + +DECLARE_TAG_TYPE(TAG_GET_GPIO_STATE_t, + struct { + uint32_t gpio_num; + }, + struct { + uint32_t zero; + uint32_t state; + }); + +DECLARE_TAG_TYPE(TAG_SET_GPIO_STATE_t, + struct { + uint32_t gpio_num; + uint32_t state; + }, + struct { + uint32_t zero; + }); + +DECLARE_TAG_TYPE(TAG_VCHIQ_INIT_t, + struct {}, + struct { + uint32_t zero; + }); + int mbox0_has_data(void); void mbox0_read_message(uint8_t channel, void *msgbuf, size_t msgbuf_size); void mbox1_write_message(uint8_t channel, uint32_t msg_addr); From patchwork Tue Feb 27 13:33:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776224 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp160183wro; Tue, 27 Feb 2024 05:44:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXyrD4zICnN6vKKlpnJHE3GtX07O0JtQ8OoRj9gHpKk0MLazeWEpuBzcHQxEPyq4Vk+ZIE0zIGJC6/qAjAG+AmK X-Google-Smtp-Source: AGHT+IFcA+//mO4HgluTIZFgU2ug6wmQQSt/opxeA6F2nA4kcjCQpwnXNbZnzPOkgwwbNF0V/ghp X-Received: by 2002:a05:6358:5611:b0:17b:56f5:3 with SMTP id b17-20020a056358561100b0017b56f50003mr13160896rwf.12.1709041488103; Tue, 27 Feb 2024 05:44:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041488; cv=none; d=google.com; s=arc-20160816; b=rR6l0GZT4xq+eP3FatE5JjDkP8DWWSK7xcagAz5nZAw2t7zShgPj8IMnkc8TaK//96 gdVs/jNg4b5ZkDOpu8R0uXJmlR/kdFcnl+0OuoimXCru5YW/JcD4DxHTo1PdFQavTkk4 hnpXZ35KOdoiZwV8y6NonIBbNbK+FpGQemtEulGqLoFm1lFsqsY64+dU8oVdKZZJ20KT z+7OQ+mrNmqfFUPeT6LjlvV+6LAP2rQaxUS9WaFGDAvh1PRLcP0ph7s2WWvDh07mVjyk 5fziyUAxEkTNFP1zV0wyBHEDgk+Efaf/T8QOE0WuUZ2T+t8bcBIcCI0J8sAAfBewdKrZ 30Wg== 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=f4i9R4ec5Zld7AP7PRU5CKoRN1UcjNx31RRTTHyHgW0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=nTYb67lB1BklJjyGf+QFQRr5L0lzKKpfDNISAQFb7Kx9y0FUgu5W/y7CWoRjw5iSg8 GuNAE0hr8UQU2NEJPz3VXIW/wH5/M6Z2+lf22GCQtEM5CAJD2FLpiRuAoqaX1wjCo6JF VkFQSYPJXldwldgjQoMZG3c4LA8NnKN510GdRhUxF63o0gSdQPNlaFiWWqMteEjuv+6b BPRnkaJgDr9gdpEI7yKa1IjoSZn/aEZYQd1/STMeDEZPqJYFfO4QwxWywoLE+ZMG173u pqyGjVmfkgoW0cIOSUY4JoqazzCwZSiRxHzYOBhR08R09RUq3ry1T3YS9RUN0+LgdPIa At5w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IVjhcMxu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r2-20020a056214124200b006903065874csi32283qvv.199.2024.02.27.05.44.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:44: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=IVjhcMxu; 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 1rexb1-00019F-IY; Tue, 27 Feb 2024 08:34:11 -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 1rexad-0000qf-DN for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:49 -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 1rexaU-0002vf-MB for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:47 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-412a9c1921dso9397745e9.0 for ; Tue, 27 Feb 2024 05:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040817; x=1709645617; 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=f4i9R4ec5Zld7AP7PRU5CKoRN1UcjNx31RRTTHyHgW0=; b=IVjhcMxuDd/zUegvnc/pCU8jR/Wr8J1nyntwpwh97+/ydoSWmIKBN2T6YZ3DItC0UE nrdKrSlacZSKjD+2uyFLKV/O7bAzwVyuDZgcQhT/eT5mqj12SaWwV+9i6PeJJCAOrAEX iRtrBb1rvfqV6rl29Rl7CQL/1kf0Gmx/j5fqFY4JMp+iDPQk7G4/OEdJrnvkUP/VHY3t 76MZHDdN7OEJ7UkwnwflSgKCpugfdvTGKBReI1+KUx7gQD8kEauPaymkAscXHY/vXAbw mZBW6VmFgBLvQnpH4VeufT+c8wzWzGvF7jo5+ogWQ360+XKRN5CyKVa8QzKQlJw94HZ0 SxJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040817; x=1709645617; 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=f4i9R4ec5Zld7AP7PRU5CKoRN1UcjNx31RRTTHyHgW0=; b=t74FSMaglyr+eYCwSnGmvWWrDvuGgo7f+tHQRUOSN5DRe7hng+jEa4+e6FkltTaIcS ydcrU2TOXty6ZvSorGPl/uj/NkGjAfqU41PEHQwmP5Ls8dxZe1JX6xZHH2lpRcd3kwzz 8vauzNlw95DkIBx6kMIcvpnxXyp4z3RjU+Ba/2hU/Qf2V41i5gJ7mscPh/Pq2uirhHe9 oCBd2HEjmYs9bvT820fLdwrJ1QjCfbjjXYkytMqqIEPYRAH8qf+ulYhLlBMPX5MbfbxO fH5xh/tdQmMiNHsaU5CduhJW33gJcPSUSa9id4x62tt0vchOcqod3gA3tJzOr5/HgqgG 2H4Q== X-Gm-Message-State: AOJu0YxtW3KrtVSMJQsFxiUB5xK54wJOJBhOheWvoHXchSLSCZ6iAYtY uKz3t6N5W21dKaYKOtyJ5lFtWak1tLZUDFnwPXhbFkR1VHtXZFc5ILXz85TnavQFkXeUphf8m0t h X-Received: by 2002:a05:600c:4e86:b0:412:a21b:5bf8 with SMTP id f6-20020a05600c4e8600b00412a21b5bf8mr4436121wmq.3.1709040816722; Tue, 27 Feb 2024 05:33:36 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:36 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 40/45] tests/qtest/bcm2828-mailbox: Add mailbox property tests. Part 1 Date: Tue, 27 Feb 2024 13:33:09 +0000 Message-Id: <20240227133314.1721857-41-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-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: Sergey Kambalin Signed-off-by: Sergey Kambalin Message-id: 20240226000259.2752893-37-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- tests/qtest/bcm2838-mailbox.c | 1 - tests/qtest/bcm2838-mbox-property-test.c | 207 +++++++++++++++++++++++ tests/qtest/meson.build | 2 +- 3 files changed, 208 insertions(+), 2 deletions(-) create mode 100644 tests/qtest/bcm2838-mbox-property-test.c diff --git a/tests/qtest/bcm2838-mailbox.c b/tests/qtest/bcm2838-mailbox.c index 1efd3c628a9..0928a3dff8e 100644 --- a/tests/qtest/bcm2838-mailbox.c +++ b/tests/qtest/bcm2838-mailbox.c @@ -11,7 +11,6 @@ #include "hw/registerfields.h" #include "libqtest-single.h" #include "bcm2838-mailbox.h" -#include "hw/arm/raspberrypi-fw-defs.h" REG32(MBOX_EXCHNG_REG, 0) FIELD(MBOX_EXCHNG_REG, CHANNEL, 0, 4) diff --git a/tests/qtest/bcm2838-mbox-property-test.c b/tests/qtest/bcm2838-mbox-property-test.c new file mode 100644 index 00000000000..1361e84a988 --- /dev/null +++ b/tests/qtest/bcm2838-mbox-property-test.c @@ -0,0 +1,207 @@ +/* + * Tests set for BCM2838 mailbox property interface. + * + * Copyright (c) 2022 Auriga + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/registerfields.h" +#include "libqtest-single.h" +#include "bcm2838-mailbox.h" +#include "hw/arm/raspberrypi-fw-defs.h" + +REG32(MBOX_SIZE_STAT, 0) +FIELD(MBOX_SIZE_STAT, SIZE, 0, 31) +FIELD(MBOX_SIZE_STAT, SUCCESS, 31, 1) + +REG32(SET_POWER_STATE_CMD, 0) +FIELD(SET_POWER_STATE_CMD, EN, 0, 1) +FIELD(SET_POWER_STATE_CMD, WAIT, 1, 1) + +REG32(GET_CLOCK_STATE_CMD, 0) +FIELD(GET_CLOCK_STATE_CMD, EN, 0, 1) +FIELD(GET_CLOCK_STATE_CMD, NPRES, 1, 1) + +#define MBOX_TEST_MESSAGE_ADDRESS 0x10000000 + +#define TEST_TAG(x) RPI_FWREQ_ ## x +#define TEST_TAG_TYPE(x) TAG_##x##_t + +#define TEST_FN_NAME(test, subtest) \ + test ## _ ## subtest ## _test + +#define SETUP_FN_NAME(test, subtest) \ + test ## _ ## subtest ## _setup + +#define CHECK_FN_NAME(test, subtest) \ + test ## _ ## subtest ## _spec_check + +#define DECLARE_TEST_CASE_SETUP(testname, ...) \ + void SETUP_FN_NAME(testname, __VA_ARGS__) \ + (TEST_TAG_TYPE(testname) * tag) + +/*----------------------------------------------------------------------------*/ +#define DECLARE_TEST_CASE(testname, ...) \ + __attribute__((weak)) \ + void SETUP_FN_NAME(testname, __VA_ARGS__) \ + (TEST_TAG_TYPE(testname) * tag); \ + static void CHECK_FN_NAME(testname, __VA_ARGS__) \ + (TEST_TAG_TYPE(testname) *tag); \ + static void TEST_FN_NAME(testname, __VA_ARGS__)(void) { \ + struct { \ + MboxBufHeader header; \ + TEST_TAG_TYPE(testname) tag; \ + uint32_t end_tag; \ + } mailbox_buffer = { 0 }; \ + \ + QTestState *qts = qtest_init("-machine raspi4b"); \ + \ + mailbox_buffer.header.size = sizeof(mailbox_buffer); \ + mailbox_buffer.header.req_resp_code = MBOX_PROCESS_REQUEST; \ + \ + mailbox_buffer.tag.id = TEST_TAG(testname); \ + mailbox_buffer.tag.value_buffer_size = MAX( \ + sizeof(mailbox_buffer.tag.request.value), \ + sizeof(mailbox_buffer.tag.response.value)); \ + mailbox_buffer.tag.request.zero = 0; \ + \ + mailbox_buffer.end_tag = RPI_FWREQ_PROPERTY_END; \ + \ + if (SETUP_FN_NAME(testname, __VA_ARGS__)) { \ + SETUP_FN_NAME(testname, __VA_ARGS__)(&mailbox_buffer.tag); \ + } \ + \ + qtest_memwrite(qts, MBOX_TEST_MESSAGE_ADDRESS, \ + &mailbox_buffer, sizeof(mailbox_buffer)); \ + qtest_mbox1_write_message(qts, MBOX_CHANNEL_ID_PROPERTY, \ + MBOX_TEST_MESSAGE_ADDRESS); \ + \ + qtest_mbox0_read_message(qts, MBOX_CHANNEL_ID_PROPERTY, \ + &mailbox_buffer, sizeof(mailbox_buffer)); \ + \ + g_assert_cmphex(mailbox_buffer.header.req_resp_code, ==, MBOX_SUCCESS);\ + \ + g_assert_cmphex(mailbox_buffer.tag.id, ==, TEST_TAG(testname)); \ + \ + uint32_t size = FIELD_EX32(mailbox_buffer.tag.response.size_stat, \ + MBOX_SIZE_STAT, SIZE); \ + uint32_t success = FIELD_EX32(mailbox_buffer.tag.response.size_stat, \ + MBOX_SIZE_STAT, SUCCESS); \ + g_assert_cmpint(size, ==, sizeof(mailbox_buffer.tag.response.value)); \ + g_assert_cmpint(success, ==, 1); \ + \ + CHECK_FN_NAME(testname, __VA_ARGS__)(&mailbox_buffer.tag); \ + \ + qtest_quit(qts); \ + } \ + static void CHECK_FN_NAME(testname, __VA_ARGS__) \ + (TEST_TAG_TYPE(testname) * tag) + +/*----------------------------------------------------------------------------*/ + +#define QTEST_ADD_TEST_CASE(testname, ...) \ + qtest_add_func(stringify(/bcm2838/mbox/property/ \ + TEST_FN_NAME(testname, __VA_ARGS__)-test), \ + TEST_FN_NAME(testname, __VA_ARGS__)) + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_FIRMWARE_REVISION) { + g_assert_cmpint(tag->response.value.revision, ==, FIRMWARE_REVISION); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_BOARD_REVISION) { + g_assert_cmpint(tag->response.value.revision, ==, BOARD_REVISION); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_ARM_MEMORY) { + g_assert_cmphex(tag->response.value.base, ==, ARM_MEMORY_BASE); + g_assert_cmphex(tag->response.value.size, ==, ARM_MEMORY_SIZE); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_VC_MEMORY) { + g_assert_cmphex(tag->response.value.base, ==, VC_MEMORY_BASE); + g_assert_cmphex(tag->response.value.size, ==, VC_MEMORY_SIZE); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(SET_POWER_STATE) { + uint32_t enabled = + FIELD_EX32(tag->response.value.cmd, SET_POWER_STATE_CMD, EN); + uint32_t wait = + FIELD_EX32(tag->response.value.cmd, SET_POWER_STATE_CMD, WAIT); + g_assert_cmphex(tag->response.value.device_id, ==, DEVICE_ID_UART0); + g_assert_cmpint(enabled, ==, 1); + g_assert_cmpint(wait, ==, 0); +} +DECLARE_TEST_CASE_SETUP(SET_POWER_STATE) { + tag->request.value.device_id = DEVICE_ID_UART0; + tag->response.value.cmd = + FIELD_DP32(tag->response.value.cmd, SET_POWER_STATE_CMD, EN, 1); + tag->response.value.cmd = + FIELD_DP32(tag->response.value.cmd, SET_POWER_STATE_CMD, WAIT, 1); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_CLOCK_STATE) { + uint32_t enabled = + FIELD_EX32(tag->response.value.cmd, GET_CLOCK_STATE_CMD, EN); + uint32_t not_present = + FIELD_EX32(tag->response.value.cmd, GET_CLOCK_STATE_CMD, NPRES); + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_CORE); + g_assert_cmphex(enabled, ==, 1); + g_assert_cmphex(not_present, ==, 0); +} +DECLARE_TEST_CASE_SETUP(GET_CLOCK_STATE) { + tag->request.value.clock_id = CLOCK_ID_CORE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_CLOCK_RATE, EMMC) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_EMMC); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_EMMC); +} +DECLARE_TEST_CASE_SETUP(GET_CLOCK_RATE, EMMC) { + tag->request.value.clock_id = CLOCK_ID_EMMC; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MAX_CLOCK_RATE, EMMC) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_EMMC); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_EMMC); +} +DECLARE_TEST_CASE_SETUP(GET_MAX_CLOCK_RATE, EMMC) { + tag->request.value.clock_id = CLOCK_ID_EMMC; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MIN_CLOCK_RATE, EMMC) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_EMMC); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_EMMC); +} +DECLARE_TEST_CASE_SETUP(GET_MIN_CLOCK_RATE, EMMC) { + tag->request.value.clock_id = CLOCK_ID_EMMC; +} + +/*----------------------------------------------------------------------------*/ +int main(int argc, char **argv) +{ + g_test_init(&argc, &argv, NULL); + + QTEST_ADD_TEST_CASE(GET_FIRMWARE_REVISION); + QTEST_ADD_TEST_CASE(GET_BOARD_REVISION); + QTEST_ADD_TEST_CASE(GET_ARM_MEMORY); + QTEST_ADD_TEST_CASE(GET_VC_MEMORY); + QTEST_ADD_TEST_CASE(SET_POWER_STATE); + QTEST_ADD_TEST_CASE(GET_CLOCK_STATE); + QTEST_ADD_TEST_CASE(GET_CLOCK_RATE, EMMC); + QTEST_ADD_TEST_CASE(GET_MAX_CLOCK_RATE, EMMC); + QTEST_ADD_TEST_CASE(GET_MIN_CLOCK_RATE, EMMC); + + return g_test_run(); +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index e49ce4f0929..194ddf35103 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -230,7 +230,7 @@ qtests_aarch64 = \ ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \ (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \ (config_all_devices.has_key('CONFIG_XLNX_VERSAL') ? ['xlnx-canfd-test', 'xlnx-versal-trng-test'] : []) + \ - (config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) + \ + (config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test', 'bcm2838-mbox-property-test'] : []) + \ (config_all_accel.has_key('CONFIG_TCG') and \ config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \ ['arm-cpu-features', From patchwork Tue Feb 27 13:33: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: 776207 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp157173wro; Tue, 27 Feb 2024 05:37:25 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVocw6inFP+QYm269+1YNvPWlG7bNIc161WeBtggFvWsQkxgqy2S/WMqr7Q+hDUzMQqEcnsNvxy5Tdfcx+Mw2YP X-Google-Smtp-Source: AGHT+IGJzjH6pN4oTnUxv5jq0G598xBdyF1Yipx6IqRH6CUhDXVYgydNu/vwd1gl/N4DLIuZWZDp X-Received: by 2002:a05:620a:4727:b0:787:ced9:c2cd with SMTP id bs39-20020a05620a472700b00787ced9c2cdmr2533315qkb.14.1709041045577; Tue, 27 Feb 2024 05:37:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041045; cv=none; d=google.com; s=arc-20160816; b=e9KLFEAjTDZRbHyZfY54UBajSTljJP8xXn644BEmfXX84gUC1bHZMlfxyEvXizRFy1 7f43j4uCQR+AcS4X7nU1g15qPOBuI8fE27r/d2Bkfh5BJOSuC64qMRCFFLLs3JM8C5ac L18dRmNUd7d7lqhLpSvUIgvW3a46VzrPKLJ/Pz5IMD/bwG37prsrmjqw/V/HlcbYuUIf Vh6kilyQQyRRxkyasq+sjSl8aLS1eejw8hWRgHoR6jSkS1AMtrj2sbEXTdtlIvj8O9NK /IMyu+Sp+fdE1dQFDpmz8vfTcZP+Iel8l2ojBhnu+U3gH7Ux86ThWuK1h/ed67QzTQyJ /RbQ== 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=SGfW+9SUKwb0elju7hK2I/Wy4ErwX11QN2o0E9hUpIA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=JwJAR5jB+hl39B8Hv8osrOOMliYkFP8SB3OsGPreYONFet15v1JPXhhbhc3IW3rqsn 5Lkth+daHtub5IZnWxLziyuhOd8gKkJgkHpOcbYOBEP+IYrdQ9yM9EZ6UmZj2aZOugg9 G5HwjRZYd43lijqxafCFw/722GkRrsLMMYbbbN0rSkhxE/WnSqUDmirvGWimad1mvUgQ GqIK8HDfrVYe1LTe2kUTQxaFoWJCRokJ/cXOZVOkQgtVPcK2pjXd4Zv6nj+/Zy4SA/SU 16OyrlJX+IoQpZ1wWfkTv8/iGgMO/f/UW6TJc0Z/jKKJgXSL8ke0+fa92ndfX9+9+bs6 CfgQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WQAAwZDL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c17-20020a05620a135100b007871fec8208si6929554qkl.477.2024.02.27.05.37.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:37:25 -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=WQAAwZDL; 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 1rexb6-0001Ca-Br; Tue, 27 Feb 2024 08:34:16 -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 1rexaf-0000rG-9l for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:50 -0500 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaV-0002vy-4L for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:49 -0500 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2d29111272eso20739431fa.0 for ; Tue, 27 Feb 2024 05:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040817; x=1709645617; 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=SGfW+9SUKwb0elju7hK2I/Wy4ErwX11QN2o0E9hUpIA=; b=WQAAwZDLheYUCHzEJCNprP6Y7n/esHCATFKEgIj/afZ12Ec0llju79Shjyb5/as3iN EMf8W8aSAC5ye7Hu4prMErB9EEzUYRfuAFlHict/oCuUPVUrApyrpaCjDa+yNt/Iwk+c jeHEdUacogAnS8GUfbOGk5M/VhXNpyJNz/JU+9WToEkVjh66s744+AYlXHkMBzZ/oO/U YsHbRXcbb9+HrHTKVQutP8LLX8K++qmYx6CgQTvrqv7CcetlWWKSPL2N1LW31GukumEB sJuLmjzIgGWznTIZeOugmqJMx3pzxZztm3x4IGjjmPIJ7LEIbZ/S3xnZTTJemhuZq45f bIbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040817; x=1709645617; 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=SGfW+9SUKwb0elju7hK2I/Wy4ErwX11QN2o0E9hUpIA=; b=M5I8grofDPjasK4tWo0DmjfUwUf6vdQ+RbumE33xs4a4seT7tGVcprALUw9OvJj5OP pXKZeA7TTkGZf+01WnXCbRL5l6Lebm0lIC128oO/usEDOOymAf3uKLJ6Dk9hyjdtmKkv 1EuX8OL+4OeeQTLBDtbLzc/Tegn8HWFM/USyJ2e3HcLx/8mAqyi8RrnGZLx9SJJbv80F ogr9qFV8mwtGE0b/H72c4OBS9tnM3O+rmaiHb/liGD8e0mExzGfD16CrrwDXIlSjfinC NA5aRd6R8quOkZJxoqauL7Z9FIApXtwLVQS09MFRsgM9Wxq0skn17pAtU2EA8oufB0fV BcdQ== X-Gm-Message-State: AOJu0YwUHEp9SwIf5qII9JjMaUgw86sUwEG+t6BjyGL7P6bBH3IBkpou 2Vo2RokYUps1oLguMDlqoaq84+l/643qE0+PWxOcSPmtII/4UIuEkOJa7EIXACiiDDik3x8dZ0g r X-Received: by 2002:a2e:2ac5:0:b0:2d2:a302:c626 with SMTP id q188-20020a2e2ac5000000b002d2a302c626mr1022181ljq.33.1709040817295; Tue, 27 Feb 2024 05:33:37 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:36 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 41/45] tests/qtest/bcm2828-mailbox: Add mailbox property tests. Part 2 Date: Tue, 27 Feb 2024 13:33:10 +0000 Message-Id: <20240227133314.1721857-42-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x22e.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: Sergey Kambalin Signed-off-by: Sergey Kambalin Message-id: 20240226000259.2752893-38-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- tests/qtest/bcm2838-mbox-property-test.c | 196 ++++++++++++++++++++++- 1 file changed, 195 insertions(+), 1 deletion(-) diff --git a/tests/qtest/bcm2838-mbox-property-test.c b/tests/qtest/bcm2838-mbox-property-test.c index 1361e84a988..63f1f577f17 100644 --- a/tests/qtest/bcm2838-mbox-property-test.c +++ b/tests/qtest/bcm2838-mbox-property-test.c @@ -50,7 +50,8 @@ FIELD(GET_CLOCK_STATE_CMD, NPRES, 1, 1) (TEST_TAG_TYPE(testname) * tag); \ static void CHECK_FN_NAME(testname, __VA_ARGS__) \ (TEST_TAG_TYPE(testname) *tag); \ - static void TEST_FN_NAME(testname, __VA_ARGS__)(void) { \ + static void TEST_FN_NAME(testname, __VA_ARGS__)(void) \ + { \ struct { \ MboxBufHeader header; \ TEST_TAG_TYPE(testname) tag; \ @@ -188,6 +189,179 @@ DECLARE_TEST_CASE_SETUP(GET_MIN_CLOCK_RATE, EMMC) { tag->request.value.clock_id = CLOCK_ID_EMMC; } +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_CLOCK_RATE, UART) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_UART); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_UART); +} +DECLARE_TEST_CASE_SETUP(GET_CLOCK_RATE, UART) { + tag->request.value.clock_id = CLOCK_ID_UART; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MAX_CLOCK_RATE, UART) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_UART); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_UART); +} +DECLARE_TEST_CASE_SETUP(GET_MAX_CLOCK_RATE, UART) { + tag->request.value.clock_id = CLOCK_ID_UART; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MIN_CLOCK_RATE, UART) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_UART); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_UART); +} +DECLARE_TEST_CASE_SETUP(GET_MIN_CLOCK_RATE, UART) { + tag->request.value.clock_id = CLOCK_ID_UART; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_CLOCK_RATE, CORE) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_CORE); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_CORE); +} +DECLARE_TEST_CASE_SETUP(GET_CLOCK_RATE, CORE) { + tag->request.value.clock_id = CLOCK_ID_CORE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MAX_CLOCK_RATE, CORE) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_CORE); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_CORE); +} +DECLARE_TEST_CASE_SETUP(GET_MAX_CLOCK_RATE, CORE) { + tag->request.value.clock_id = CLOCK_ID_CORE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MIN_CLOCK_RATE, CORE) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_CORE); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_CORE); +} +DECLARE_TEST_CASE_SETUP(GET_MIN_CLOCK_RATE, CORE) { + tag->request.value.clock_id = CLOCK_ID_CORE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_CLOCK_RATE, ANY) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_UNDEFINED); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_ANY); +} +DECLARE_TEST_CASE_SETUP(GET_CLOCK_RATE, ANY) { + tag->request.value.clock_id = CLOCK_ID_UNDEFINED; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MAX_CLOCK_RATE, ANY) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_UNDEFINED); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_ANY); +} +DECLARE_TEST_CASE_SETUP(GET_MAX_CLOCK_RATE, ANY) { + tag->request.value.clock_id = CLOCK_ID_UNDEFINED; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MIN_CLOCK_RATE, ANY) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_UNDEFINED); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_ANY); +} +DECLARE_TEST_CASE_SETUP(GET_MIN_CLOCK_RATE, ANY) { + tag->request.value.clock_id = CLOCK_ID_UNDEFINED; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_TEMPERATURE) { + g_assert_cmphex(tag->response.value.temperature_id, ==, TEMPERATURE_ID_SOC); + g_assert_cmpint(tag->response.value.temperature, ==, TEMPERATURE_SOC); +} +DECLARE_TEST_CASE_SETUP(GET_TEMPERATURE) { + tag->request.value.temperature_id = TEMPERATURE_ID_SOC; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MAX_TEMPERATURE) { + g_assert_cmphex(tag->response.value.temperature_id, ==, TEMPERATURE_ID_SOC); + g_assert_cmpint(tag->response.value.temperature, ==, TEMPERATURE_SOC_MAX); +} +DECLARE_TEST_CASE_SETUP(GET_MAX_TEMPERATURE) { + tag->request.value.temperature_id = TEMPERATURE_ID_SOC; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_ALLOCATE) { + g_assert_cmphex(tag->response.value.base, ==, VC_FB_BASE); + g_assert_cmphex(tag->response.value.size, ==, VC_FB_SIZE); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_ALLOCATE) { + tag->request.value.alignment = ALIGN_4K; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_RELEASE) { + /* No special checks are needed for this test */ +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_BLANK) { + g_assert_cmphex(tag->response.value.on, ==, 0); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_BLANK) { + tag->request.value.on = 0; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT) { + g_assert_cmpint(tag->response.value.width, ==, DUMMY_VALUE); + g_assert_cmpint(tag->response.value.height, ==, DUMMY_VALUE); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT) { + tag->request.value.width = DUMMY_VALUE; + tag->request.value.height = DUMMY_VALUE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_GET_PHYSICAL_WIDTH_HEIGHT, INITIAL) { + g_assert_cmpint(tag->response.value.width, ==, 640); + g_assert_cmpint(tag->response.value.height, ==, 480); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT) { + g_assert_cmpint(tag->response.value.width, ==, 800); + g_assert_cmpint(tag->response.value.height, ==, 600); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT) { + tag->request.value.width = 800; + tag->request.value.height = 600; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT) { + g_assert_cmpint(tag->response.value.width, ==, DUMMY_VALUE); + g_assert_cmpint(tag->response.value.height, ==, DUMMY_VALUE); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT) { + tag->request.value.width = DUMMY_VALUE; + tag->request.value.height = DUMMY_VALUE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_GET_VIRTUAL_WIDTH_HEIGHT, INITIAL) { + g_assert_cmpint(tag->response.value.width, ==, 640); + g_assert_cmpint(tag->response.value.height, ==, 480); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT) { + g_assert_cmpint(tag->response.value.width, ==, 800); + g_assert_cmpint(tag->response.value.height, ==, 600); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT) { + tag->request.value.width = 800; + tag->request.value.height = 600; +} + /*----------------------------------------------------------------------------*/ int main(int argc, char **argv) { @@ -202,6 +376,26 @@ int main(int argc, char **argv) QTEST_ADD_TEST_CASE(GET_CLOCK_RATE, EMMC); QTEST_ADD_TEST_CASE(GET_MAX_CLOCK_RATE, EMMC); QTEST_ADD_TEST_CASE(GET_MIN_CLOCK_RATE, EMMC); + QTEST_ADD_TEST_CASE(GET_CLOCK_RATE, UART); + QTEST_ADD_TEST_CASE(GET_MAX_CLOCK_RATE, UART); + QTEST_ADD_TEST_CASE(GET_MIN_CLOCK_RATE, UART); + QTEST_ADD_TEST_CASE(GET_CLOCK_RATE, CORE); + QTEST_ADD_TEST_CASE(GET_MAX_CLOCK_RATE, CORE); + QTEST_ADD_TEST_CASE(GET_MIN_CLOCK_RATE, CORE); + QTEST_ADD_TEST_CASE(GET_CLOCK_RATE, ANY); + QTEST_ADD_TEST_CASE(GET_MAX_CLOCK_RATE, ANY); + QTEST_ADD_TEST_CASE(GET_MIN_CLOCK_RATE, ANY); + QTEST_ADD_TEST_CASE(GET_TEMPERATURE); + QTEST_ADD_TEST_CASE(GET_MAX_TEMPERATURE); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_ALLOCATE); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_RELEASE); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_BLANK); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_GET_PHYSICAL_WIDTH_HEIGHT, INITIAL); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_GET_VIRTUAL_WIDTH_HEIGHT, INITIAL); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT); return g_test_run(); } From patchwork Tue Feb 27 13:33: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: 776226 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp160581wro; Tue, 27 Feb 2024 05:45:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWBAsCyqWUWe/WtAgMV2iPEnODmzGPD8v1BlyiPQWt9ndkMiyyY6Z7ZDZorJBRMGeVaGWEX1TZ49JJpMahOzCxL X-Google-Smtp-Source: AGHT+IFHjeEa0zfjTCWB26pv3cuKJTBRRodYZpu1ypcMPxbs+OIaiJ0xCdoSG/evx+sKXftGAnN0 X-Received: by 2002:a05:6102:809:b0:470:432c:282e with SMTP id g9-20020a056102080900b00470432c282emr7106895vsb.18.1709041539092; Tue, 27 Feb 2024 05:45:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041539; cv=none; d=google.com; s=arc-20160816; b=I6cgJ1IHMS55r2qNCQ5Ps7QZw/w1xD1NrDVW7YCBUD3dZGFllGEKK2lsHqPGRKn1Uk j7XF9igXbcmllqUgRzb39TjisMaNM++MiBQHwe+z/1zWbprRHWeRh1tQPF+0fz6Hb/1Q 5Uu0jsrgBS4JbKk1cm3+m0DvI9PzGFFtEkvkYOH1V2ef3sFnBoKgusSatHH2moVWY3p8 ns/UvgOxIvwBbKR3dYTZI48RUysJMqWIoTx5073+j195EDdyz4tYQ8z+h7D2t+2AHfE9 vvrqXVcfkIBRsd1QwUPH9ZrRUUg7PMA5PcrELNq3kKgPZ9jIlla2eADeDy1xrc2Wo+AA u58w== 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=URdpfz0CO1A4wAw58jRhSAJIVlq3ECKNAIVic8uADcU=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=YsYRejC8dUPwnzdP2wmZG4shHZJOSTiZrH676nld2S+sEGPoghriZ3YcKvm/twCuIl xtzvBir4I7VZ/RQ49G2v5Gd5lx2p7/KeyU8i3EcBObywVe+B5HYh2gYhkScHxPRMORQ4 v1XHuX/A7Cs0v8iZC4H0TFxv18klM0jrFRrsaPxP5tKNt5sXAxvoSbhPOJN7tjiO9quE ptJv4U2PVV4dI4WBI1W7oaMu22PnzkwnOWIME/qlegIUjjI/IwAxYIqThQiqdPYNHUch 2/oEibIOMs3MLlZMO4Pfm7xKz7ZpGq20oGjFerGqWsaJzjGK1gV3FhS7D7Z8hLbunfue tFlA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yqGTCIyF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j7-20020a67e3a7000000b0047260d5b996si55758vsm.646.2024.02.27.05.45.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:45: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=yqGTCIyF; 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 1rexb5-0001BF-A5; Tue, 27 Feb 2024 08:34:15 -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 1rexal-0000td-1i for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:56 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaV-0002wp-6a for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:53 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-33dc3fe739aso1659126f8f.0 for ; Tue, 27 Feb 2024 05:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040818; x=1709645618; 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=URdpfz0CO1A4wAw58jRhSAJIVlq3ECKNAIVic8uADcU=; b=yqGTCIyFFruH+iqUDCfbWYcHMORnHYlCEm9M03A3ibRkopKul51bb9wHOOf+WXtUwY Q4fiLcRPw+XJPlHiKhqfqXoAo05D4FeUElMVrMH9ydyiVrxIL9Tw6JZT3UfgNmn2jfgk 5CSuaTcCs8MIEz8Mu7mdYEFp+o0lOs+4jckwEm7HNjsH8ZgpPm6vKrPNaMIIq9ThDUDg 2mKdzP8V6GIOMaWZ8WZwR1kjT5yGu2kJv51K5M4Tmol63XXzS4hl6Gds6dR5S8MLDJwC 9WunZtPpWzstWY8WxZXH6sG5RrarhaJnvJ+ce/8iuz/RwgwnRcSNwtMZuz7wpIH0PViP Ns2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040818; x=1709645618; 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=URdpfz0CO1A4wAw58jRhSAJIVlq3ECKNAIVic8uADcU=; b=QcWJ3y09t+vFnnoWfFVyb+y10FkhAYpsF0X9i7KdfZtSjAm4tlfJ8kXEmqeP3bEgbd JVmyZYb9rOfT3yilbeVS1qLPx7e6twxg5kSxUA3at15mR1AdoAcBaWYerNtB++WtmxC8 c5Y1DS1P3uH6nxDX5A3YCCc0WX4ycg5tqK6oRqvzVujqyB2najnIyBjZW3FXYUbeV+km WyYZY/bVNS/vBHE4xrJcJ0Cjb0Sz0H8zajHMLZvg+C+PevyQqeK5G6HvPdTFyoUDZ/3X EmI57tT2EIn11Atk8s1jL2ejr3grvxawspeXoWklyaiFRL7FBWHG5joQHJP6toUOrLZO M7iQ== X-Gm-Message-State: AOJu0YwlH+ZvoU8r3n2EJh3B0aqwlNJ7TmmLLC7DiqHNTkCDUuUm78yz MabqcGlloUKgQFVFn7Gm+IsJLdnkAtUnAO10WcZu8GAbKkJmfz7XiRmcbkRhjEDBP49CGl9rNf4 c X-Received: by 2002:a5d:4b8f:0:b0:33d:d7be:5852 with SMTP id b15-20020a5d4b8f000000b0033dd7be5852mr5179217wrt.2.1709040817829; Tue, 27 Feb 2024 05:33:37 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:37 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 42/45] tests/qtest/bcm2828-mailbox: Add mailbox property tests. Part 3 Date: Tue, 27 Feb 2024 13:33:11 +0000 Message-Id: <20240227133314.1721857-43-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.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, PDS_OTHER_BAD_TLD=1.999, 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: Sergey Kambalin Signed-off-by: Sergey Kambalin Message-id: 20240226000259.2752893-39-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- tests/qtest/bcm2838-mbox-property-test.c | 211 +++++++++++++++++++++++ 1 file changed, 211 insertions(+) diff --git a/tests/qtest/bcm2838-mbox-property-test.c b/tests/qtest/bcm2838-mbox-property-test.c index 63f1f577f17..0a71b756dcf 100644 --- a/tests/qtest/bcm2838-mbox-property-test.c +++ b/tests/qtest/bcm2838-mbox-property-test.c @@ -362,6 +362,193 @@ DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT) { tag->request.value.height = 600; } +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_TEST_DEPTH) { + g_assert_cmpint(tag->response.value.bpp, ==, DUMMY_VALUE); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_TEST_DEPTH) { + tag->request.value.bpp = DUMMY_VALUE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_GET_DEPTH) { + g_assert_cmpint(tag->response.value.bpp, ==, 16); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_SET_DEPTH) { + g_assert_cmpint(tag->response.value.bpp, ==, 24); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_DEPTH) { + tag->request.value.bpp = 24; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_TEST_PIXEL_ORDER) { + g_assert_cmphex(tag->response.value.pixel_order, ==, DUMMY_VALUE); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_TEST_PIXEL_ORDER) { + tag->request.value.pixel_order = DUMMY_VALUE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_GET_PIXEL_ORDER) { + g_assert_cmphex(tag->response.value.pixel_order, ==, PIXEL_ORDER_RGB); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_SET_PIXEL_ORDER, BGR) { + g_assert_cmphex(tag->response.value.pixel_order, ==, PIXEL_ORDER_BGR); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_PIXEL_ORDER, BGR) { + tag->request.value.pixel_order = PIXEL_ORDER_BGR; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_SET_PIXEL_ORDER, RGB) { + g_assert_cmphex(tag->response.value.pixel_order, ==, PIXEL_ORDER_BGR); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_PIXEL_ORDER, RGB) { + tag->request.value.pixel_order = PIXEL_ORDER_BGR; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_TEST_ALPHA_MODE) { + g_assert_cmphex(tag->response.value.alpha_mode, ==, DUMMY_VALUE); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_TEST_ALPHA_MODE) { + tag->request.value.alpha_mode = DUMMY_VALUE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_GET_ALPHA_MODE) { + g_assert_cmphex(tag->response.value.alpha_mode, ==, ALPHA_MODE_IGNORED); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_SET_ALPHA_MODE, ENABLED) { + g_assert_cmphex(tag->response.value.alpha_mode, ==, ALPHA_MODE_ENABLED); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_ALPHA_MODE, ENABLED) { + tag->request.value.alpha_mode = ALPHA_MODE_ENABLED; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_SET_ALPHA_MODE, REVERSED) { + g_assert_cmphex(tag->response.value.alpha_mode, ==, ALPHA_MODE_REVERSED); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_ALPHA_MODE, REVERSED) { + tag->request.value.alpha_mode = ALPHA_MODE_REVERSED; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_SET_ALPHA_MODE, IGNORED) { + g_assert_cmphex(tag->response.value.alpha_mode, ==, ALPHA_MODE_IGNORED); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_ALPHA_MODE, IGNORED) { + tag->request.value.alpha_mode = ALPHA_MODE_IGNORED; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_GET_PITCH) { + g_assert_cmpint(tag->response.value.pitch, ==, 1280); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_TEST_VIRTUAL_OFFSET) { + g_assert_cmpint(tag->response.value.x, ==, DUMMY_VALUE); + g_assert_cmpint(tag->response.value.y, ==, DUMMY_VALUE); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_TEST_VIRTUAL_OFFSET) { + tag->request.value.x = DUMMY_VALUE; + tag->request.value.y = DUMMY_VALUE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_GET_VIRTUAL_OFFSET) { + g_assert_cmpint(tag->response.value.x, ==, 0); + g_assert_cmpint(tag->response.value.y, ==, 0); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_SET_VIRTUAL_OFFSET, _0_) { + g_assert_cmpint(tag->response.value.x, ==, 0); + g_assert_cmpint(tag->response.value.y, ==, 0); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_VIRTUAL_OFFSET, _0_) { + tag->request.value.x = 0; + tag->request.value.y = 0; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_SET_VIRTUAL_OFFSET, _42_) { + g_assert_cmpint(tag->response.value.x, ==, 42); + g_assert_cmpint(tag->response.value.y, ==, 42); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_VIRTUAL_OFFSET, _42_) { + tag->request.value.x = 42; + tag->request.value.y = 42; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_GET_OVERSCAN) { + g_assert_cmpint(tag->response.value.top, ==, 0); + g_assert_cmpint(tag->response.value.bottom, ==, 0); + g_assert_cmpint(tag->response.value.left, ==, 0); + g_assert_cmpint(tag->response.value.right, ==, 0); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_TEST_OVERSCAN) { + g_assert_cmpint(tag->response.value.top, ==, 0); + g_assert_cmpint(tag->response.value.bottom, ==, 0); + g_assert_cmpint(tag->response.value.left, ==, 0); + g_assert_cmpint(tag->response.value.right, ==, 0); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_TEST_OVERSCAN) { + tag->request.value.top = DUMMY_VALUE; + tag->request.value.bottom = DUMMY_VALUE; + tag->request.value.left = DUMMY_VALUE; + tag->request.value.right = DUMMY_VALUE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_SET_OVERSCAN) { + g_assert_cmpint(tag->response.value.top, ==, 0); + g_assert_cmpint(tag->response.value.bottom, ==, 0); + g_assert_cmpint(tag->response.value.left, ==, 0); + g_assert_cmpint(tag->response.value.right, ==, 0); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_OVERSCAN) { + tag->request.value.top = DUMMY_VALUE; + tag->request.value.bottom = DUMMY_VALUE; + tag->request.value.left = DUMMY_VALUE; + tag->request.value.right = DUMMY_VALUE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_DMA_CHANNELS) { + g_assert_cmphex(tag->response.value.mask, ==, GPIO_MASK); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_COMMAND_LINE) { + /* No special checks are needed for this test case */ +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_GET_NUM_DISPLAYS) { + g_assert_cmpint(tag->response.value.num_displays, ==, 1); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_SET_PITCH) { + /* No special checks are needed for this test case */ +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_PITCH) { + tag->request.value.pitch = DUMMY_VALUE; +} + /*----------------------------------------------------------------------------*/ int main(int argc, char **argv) { @@ -396,6 +583,30 @@ int main(int argc, char **argv) QTEST_ADD_TEST_CASE(FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT); QTEST_ADD_TEST_CASE(FRAMEBUFFER_GET_VIRTUAL_WIDTH_HEIGHT, INITIAL); QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_TEST_DEPTH); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_GET_DEPTH); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_DEPTH); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_TEST_PIXEL_ORDER); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_GET_PIXEL_ORDER); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_PIXEL_ORDER, BGR); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_PIXEL_ORDER, RGB); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_TEST_ALPHA_MODE); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_GET_ALPHA_MODE); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_ALPHA_MODE, ENABLED); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_ALPHA_MODE, REVERSED); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_ALPHA_MODE, IGNORED); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_GET_PITCH); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_TEST_VIRTUAL_OFFSET); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_GET_VIRTUAL_OFFSET); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_VIRTUAL_OFFSET, _0_); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_VIRTUAL_OFFSET, _42_); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_GET_OVERSCAN); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_TEST_OVERSCAN); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_OVERSCAN); + QTEST_ADD_TEST_CASE(GET_DMA_CHANNELS); + QTEST_ADD_TEST_CASE(GET_COMMAND_LINE); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_GET_NUM_DISPLAYS); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_PITCH); return g_test_run(); } From patchwork Tue Feb 27 13:33: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: 776196 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp155924wro; Tue, 27 Feb 2024 05:34:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVB8ApGFEwR924bwWwCo3YFsJ7elKDgg84YEIVwcOwZf9nD3LYQSvZrPxiVnmxcBnodq5GHtKbKca/uRFOlZjji X-Google-Smtp-Source: AGHT+IHNUOw1bze2CaijTW7VDdiMA6US7zz7G87cVSNLu8S7W2uG+3rMWoYXuqSEBaouQP9wn3gg X-Received: by 2002:a05:620a:640e:b0:787:ec3e:d85f with SMTP id pz14-20020a05620a640e00b00787ec3ed85fmr511460qkn.57.1709040886286; Tue, 27 Feb 2024 05:34:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709040886; cv=none; d=google.com; s=arc-20160816; b=LYwXJRqMEQL73loi4WqBhbj/Md0G2g+kZHGmyvYeF+Jzb4ffqX+J6B8lri+nuxoY+g KiEda9MBuHRyn4gdH8iaNbHVe2aeawAUGW7xdAVFXMxjLa3FOodZbDRyNpCB6UloEOyq SEQYjiRejRuwmA19BB6DZmZQSZVoKCg/FIxXBOHNl1Gg6ifqjUtHyKaU1P06uJNrfWKm eHUCj2e8e5BF5/1MnrRnEm4hQWGCMszoio2HUyLbWo+qo/doECYiFtznp+pnwjvxrltR CmcdAkncZvyfDL5F0Oqh3eqh6A+fYibpV0aliRBpH7h5eCN1nbdEQBjKipPV+uoH4IFX oq0Q== 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=BfQK9OJD3aICemNdn3VvNxx2yZ6JTCZD2HCR6qHP728=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=eErWb+hCtDZq/D+JZvwddVwAUifkPIeHMXnSA8+99J1dMSBW6uWeUhVFG2AjKW4ALn gtZKap6MMXzTUyaNydAbdVoaBCL7okjUmKhlD7qY2FNjP4eAYKTH6sU8ZD+4UFCMmOWH 5J5vf2PA4PiH0SfOXnm2/TNUR0ell/0dhgEiGkByQUm5Km2kUcEonvJWS70pUq75OnfZ ZQgo+9NcZnek0k3tp3B/GGo3jN2Ezhy/epVyE80el9cj6+vATDyDup9x9Pyb5v56ycPU ukzzQbcdCnIq2+8oFhmduwQU9N/N8Rk4YGnpDFVq0IQVCuEQgDovmCGsVSgpQgpqHIYX dFww==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MzIEJVcS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id pi22-20020a05620a379600b00787e0e8e0a6si1860931qkn.458.2024.02.27.05.34.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:34: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=MzIEJVcS; 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 1rexb4-0001AY-Nn; Tue, 27 Feb 2024 08:34:14 -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 1rexam-0000tq-9L for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:56 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaV-0002x7-UE for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:55 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-33d0a7f2424so2873527f8f.0 for ; Tue, 27 Feb 2024 05:33:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040818; x=1709645618; 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=BfQK9OJD3aICemNdn3VvNxx2yZ6JTCZD2HCR6qHP728=; b=MzIEJVcS/KGUOjGy4VfxiuJhFjFVWk1fG3DJ0bHoko+8SJqMg58oo/ERAq8CJ06mNC S/n/bdkWHxPD/JebHNqWE21gjH17ZYbWWR+nAQKaXPsE2aeljdTkSZD5Qzxk4PDtFVkW TtGYhB9VAgu5RhA71lFRADWVZHiODCGmgh8MiG8m9GgpMC6V6ZOaQL/hws+T8NSrJoOS v5ckjWD/KXHJ6ZZfWMNIcizXhhVIO/aZVvmeYd7hAv2zZ71ItKtWFg59Ut8qxzKQGQKN 9OSprnBoWG0B3GanP7xAgIjsk2lQoDrnkMG9aW+5FyuI7SyTD0kPHAg3W7rVJ4t6itR9 9Rwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040818; x=1709645618; 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=BfQK9OJD3aICemNdn3VvNxx2yZ6JTCZD2HCR6qHP728=; b=JjR+37FOdJx/9qjjYHXE3gRuu829sFg/Zxsj24bMElwM/vKhmHWMKY8zhDEmtCApvO kpDXY3StPvX33f/AiM+fNTYbZhAwhP3pPB0uXiUokRu3EemH3mzrhkaBUe4DHVLLDC9E CEH86Lgyi98RBaHOppryEKXDWCfQHnMBU8cfurRj0D4v2Lbjk6JiFAY5L9bJyPA2Jfd+ F2yvNq1nfC1n8eLWA2auRQESNE66BAVA/H7Qqj3pxf3tljduuFFSHBgAHg1jZF0iokLi ReMq4SN/H4thKg6HU2f9Xy2qpo8AQOxJPWk/OTbRsPgOPbIEz4DwLFU8zSSnSTR1S7lK JfYw== X-Gm-Message-State: AOJu0YwKSrNuf1eLeZ4URtfKyQX93BLpJX/bOIVR4XhK/qQiJsTKuNbY ZyQwwFg+25vVbxfAbjXAc+WQp793nZ+0eOx5JlhpxWlKAyHO9Tk0PudwIxjlGsoq7NBFgZN+gLt c X-Received: by 2002:adf:e8ce:0:b0:33d:269e:132a with SMTP id k14-20020adfe8ce000000b0033d269e132amr7010166wrn.15.1709040818296; Tue, 27 Feb 2024 05:33:38 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:38 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 43/45] hw/misc/bcm2835_property: Add missed BCM2835 properties Date: Tue, 27 Feb 2024 13:33:12 +0000 Message-Id: <20240227133314.1721857-44-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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: Sergey Kambalin Our model of the bcm2835 mailbox is missing a few properties that we need for the raspi4 kernel: * RPI_FWREQ_GET_CLOCKS * RPI_FWREQ_GET_THROTTLED * RPI_FWREQ_VCHIQ_INIT Add minimal implementations of them. Signed-off-by: Sergey Kambalin Message-id: 20240226000259.2752893-40-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell [PMM: improved commit message] Reviewed-by: Peter Maydell --- include/hw/arm/raspberrypi-fw-defs.h | 11 +++++++++++ hw/misc/bcm2835_property.c | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/include/hw/arm/raspberrypi-fw-defs.h b/include/hw/arm/raspberrypi-fw-defs.h index 579cf0d5546..8b404e05336 100644 --- a/include/hw/arm/raspberrypi-fw-defs.h +++ b/include/hw/arm/raspberrypi-fw-defs.h @@ -159,4 +159,15 @@ enum rpi_firmware_clk_id { RPI_FIRMWARE_NUM_CLK_ID, }; +struct rpi_firmware_property_tag_header { + uint32_t tag; + uint32_t buf_size; + uint32_t req_resp_size; +}; + +typedef struct rpi_firmware_prop_request { + struct rpi_firmware_property_tag_header hdr; + uint8_t payload[0]; +} rpi_firmware_prop_request_t; + #endif /* INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H_ */ diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c index 5c48f8d7438..bdd9a6bbcec 100644 --- a/hw/misc/bcm2835_property.c +++ b/hw/misc/bcm2835_property.c @@ -19,6 +19,8 @@ #include "trace.h" #include "hw/arm/raspi_platform.h" +#define VCHI_BUSADDR_SIZE sizeof(uint32_t) + /* https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface */ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) @@ -138,6 +140,13 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) resplen = 8; break; + case RPI_FWREQ_GET_CLOCKS: + /* TODO: add more clock IDs if needed */ + stl_le_phys(&s->dma_as, value + 12, 0); + stl_le_phys(&s->dma_as, value + 16, RPI_FIRMWARE_ARM_CLK_ID); + resplen = 8; + break; + case RPI_FWREQ_SET_CLOCK_RATE: case RPI_FWREQ_SET_MAX_CLOCK_RATE: case RPI_FWREQ_SET_MIN_CLOCK_RATE: @@ -276,6 +285,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) stl_le_phys(&s->dma_as, value + 12, 0); resplen = 4; break; + case RPI_FWREQ_FRAMEBUFFER_GET_NUM_DISPLAYS: stl_le_phys(&s->dma_as, value + 12, 1); resplen = 4; @@ -301,6 +311,17 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) resplen); break; + case RPI_FWREQ_GET_THROTTLED: + stl_le_phys(&s->dma_as, value + 12, 0); + resplen = 4; + break; + + case RPI_FWREQ_VCHIQ_INIT: + stl_le_phys(&s->dma_as, + value + offsetof(rpi_firmware_prop_request_t, payload), + 0); + resplen = VCHI_BUSADDR_SIZE; + break; default: qemu_log_mask(LOG_UNIMP, "bcm2835_property: unhandled tag 0x%08x\n", tag); From patchwork Tue Feb 27 13:33: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: 776237 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp161180wro; Tue, 27 Feb 2024 05:47:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUJFPJRHh3LB3exAY6WF55wFxqIkNAL0TLsqlARDDHnK6xGlNesc88DzzmWQsCE/VR1ExE0rXkc0U6MPHInHhc2 X-Google-Smtp-Source: AGHT+IGOeEnuyklDyIgl8H4UybVLq4obkqcZs7akSML7Ogjtyln8+qDd5ayLuueyw7BdcBdf+2qs X-Received: by 2002:a2e:8ec5:0:b0:2d2:3820:fb4f with SMTP id e5-20020a2e8ec5000000b002d23820fb4fmr5757921ljl.12.1709041621420; Tue, 27 Feb 2024 05:47:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041621; cv=none; d=google.com; s=arc-20160816; b=s6X43/C+6Q8RuW1qly921v1cgwdIHe2CgbGrarvBpUNFN51qJUEs4GOi4hkHWKaRMb UV7Pi+YwIXt0QQM4TBZJVaUkzIv6uxVinBV0ZgCRWc4yCDKU/sYsidi76JVqbOhUA06m 2NpIpRuK9qRpBFochj7VU1pceMhtUW8S2q79M7Lk77rONPUsn4B+iqUfIUaFXsWYjrhu xnI8BsRIgOBf44bloMa3dMNMYeHQtnxiUnW28t1J7XS3DppApdyafwnSoazf8mWmq5nC qk2D2tvv6ENwfGIpWWTB1v3v2v/+pO5tpy+34bwLw+ow2OvGzkYf5iRPdlCba/2CE0Qd 1Ilw== 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=8Orf4noRBf1WSFwEsX9mdSuLU4p1Ut9DO1XoPiOsZMY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=jRpT3Iv0zs2z3WYc3CN1Sodw8L/+aP1juxD8d5a+BYw3iDgRUp4DriXcCHTkhAN7l/ egq0F+jFA9rGxyJ7mIF2Ufu9+UKUo647Tzv2uB0rFFVdOJOL5p20UmFhUnEqsxHGwXoS 6IEaagROyw1X9OQqhvzf0KVGiFfOqJHWq91QR09EYjegLG3xtNbsChZZXIfBUvyy67KS ye9UZ7yn4tL5KhcGXVtFUEyZ/QkFvWK5DBGbxD73di6ziVQIJzU8hQzk9Mp1JH4jdrW2 hgECXcsnMaqOLboXkXO3nkyO53oioTDGqkGvp1dLut+/qQYsUiKCCTVodrO/dcheYWCT 6fZQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rI92CFmO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z11-20020a05600c0a0b00b0041266fd6b15si5176075wmp.88.2024.02.27.05.47.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:47: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=rI92CFmO; 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 1rexax-00015D-66; Tue, 27 Feb 2024 08:34:07 -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 1rexab-0000pn-Gx for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:47 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaW-0002xU-19 for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:45 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-33de6da5565so805178f8f.2 for ; Tue, 27 Feb 2024 05:33:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040818; x=1709645618; 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=8Orf4noRBf1WSFwEsX9mdSuLU4p1Ut9DO1XoPiOsZMY=; b=rI92CFmO3lBrpU3uaKGE0jOGvQCvYQeoIuqkN3AGvaX7weaUoAiy9BrRoRI4qReFAq 3+SjpySL2cfY3gqG54wenF1CCmXxZ5qwstAtT+bUExBmk7b2tDxPRIA1V4OoP7+Wr/3a NJGx36nBaeM7TU776+M9woSdvdMD9+Ec6HoJ5WdE8AT6DLbnzEo+ZZARsK8CxkiITrtB P/F7hNZzBvZmW0LaVjce3at7WY8c0kKKP3Tr6TrHgREIqRojH6ixAd1+OOrybifjq9mb XfxYDRmk7LGka3QfQT9Ps2d5lmsy5dEY2QV19CSeYsT4ImaqOGru78++WScjVE6h4pt8 /IwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040818; x=1709645618; 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=8Orf4noRBf1WSFwEsX9mdSuLU4p1Ut9DO1XoPiOsZMY=; b=ek1Wa2sK16nfw2AL7Drr5g1Lsa6ELANMYQB66Gc1wGxLC4eOoT6D3xkr+M/map5y/R YxQNUz/YiQQGW1no7Hn1ltHrKrvHhMu9gdqpo86wfdBuKsibPiTZwm5TYf1DqGXZDiHy oErVE+xqvN2cqVjrypVN+R455Tgsz/QwurJDRlpsI3XmsGfHXQUaeM6av4FY+0zDZH/Z 7o2uGGvVIOCdKo9t+1tNnjNhniXuQMbTl846ChW58Ntuv3tScjD83PcSraEsVD8/5eRY gS91OYLeAjVELBeQA5O9zM6Xy3pO3CuvuR8v6ruGyHNLzLldJHe/V1ZcN+Xj6buVzavW KjnQ== X-Gm-Message-State: AOJu0YzS7wICs5BAuHn7VyMMz17803ERB5hEV+BZemBZo6aN+g7IIjfs ltpTYfzvp8607XGgKepFkFH0ES+Poz2hOlUR/ijJPnTWKMnu4zoK63vk9Bzgc+OJATF8ktDPAsb n X-Received: by 2002:adf:fc01:0:b0:33d:a185:17ed with SMTP id i1-20020adffc01000000b0033da18517edmr6166815wrr.56.1709040818730; Tue, 27 Feb 2024 05:33:38 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:38 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 44/45] tests/qtest/bcm2828-mailbox: Append added properties to mailbox test Date: Tue, 27 Feb 2024 13:33:13 +0000 Message-Id: <20240227133314.1721857-45-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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: Sergey Kambalin Signed-off-by: Sergey Kambalin Message-id: 20240226000259.2752893-41-sergey.kambalin@auriga.com Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- tests/qtest/bcm2838-mbox-property-test.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/qtest/bcm2838-mbox-property-test.c b/tests/qtest/bcm2838-mbox-property-test.c index 0a71b756dcf..ca368afed34 100644 --- a/tests/qtest/bcm2838-mbox-property-test.c +++ b/tests/qtest/bcm2838-mbox-property-test.c @@ -270,6 +270,12 @@ DECLARE_TEST_CASE_SETUP(GET_MIN_CLOCK_RATE, ANY) { tag->request.value.clock_id = CLOCK_ID_UNDEFINED; } +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_CLOCKS) { + g_assert_cmphex(tag->response.value.root_clock, ==, CLOCK_ID_ROOT); + g_assert_cmphex(tag->response.value.arm_clock, ==, CLOCK_ID_ARM); +} + /*----------------------------------------------------------------------------*/ DECLARE_TEST_CASE(GET_TEMPERATURE) { g_assert_cmphex(tag->response.value.temperature_id, ==, TEMPERATURE_ID_SOC); @@ -536,6 +542,11 @@ DECLARE_TEST_CASE(GET_COMMAND_LINE) { /* No special checks are needed for this test case */ } +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_THROTTLED) { + g_assert_cmpint(tag->response.value.throttled, ==, 0); +} + /*----------------------------------------------------------------------------*/ DECLARE_TEST_CASE(FRAMEBUFFER_GET_NUM_DISPLAYS) { g_assert_cmpint(tag->response.value.num_displays, ==, 1); @@ -549,6 +560,11 @@ DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_PITCH) { tag->request.value.pitch = DUMMY_VALUE; } +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(VCHIQ_INIT) { + g_assert_cmpint(tag->response.value.zero, ==, 0); +} + /*----------------------------------------------------------------------------*/ int main(int argc, char **argv) { @@ -572,6 +588,7 @@ int main(int argc, char **argv) QTEST_ADD_TEST_CASE(GET_CLOCK_RATE, ANY); QTEST_ADD_TEST_CASE(GET_MAX_CLOCK_RATE, ANY); QTEST_ADD_TEST_CASE(GET_MIN_CLOCK_RATE, ANY); + QTEST_ADD_TEST_CASE(GET_CLOCKS); QTEST_ADD_TEST_CASE(GET_TEMPERATURE); QTEST_ADD_TEST_CASE(GET_MAX_TEMPERATURE); QTEST_ADD_TEST_CASE(FRAMEBUFFER_ALLOCATE); @@ -607,6 +624,8 @@ int main(int argc, char **argv) QTEST_ADD_TEST_CASE(GET_COMMAND_LINE); QTEST_ADD_TEST_CASE(FRAMEBUFFER_GET_NUM_DISPLAYS); QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_PITCH); + QTEST_ADD_TEST_CASE(GET_THROTTLED); + QTEST_ADD_TEST_CASE(VCHIQ_INIT); return g_test_run(); } From patchwork Tue Feb 27 13:33:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776202 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp157038wro; Tue, 27 Feb 2024 05:37:06 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXA4cRZj45P+7RRzSRvAlnP5GC013FdtSb0TkNTBpAa7guJUNncFturt5GL2wXJh4Q98XZWbZkP8dRdI0pj7LHX X-Google-Smtp-Source: AGHT+IHsQWb86h3YVPLg3amWjATrbaszLvInKgJ0laZj5o66UW2TIlA3am+RGz/Mx+kRLY4ImbtP X-Received: by 2002:a05:620a:2626:b0:787:ed4f:a091 with SMTP id z38-20020a05620a262600b00787ed4fa091mr25066qko.72.1709041025846; Tue, 27 Feb 2024 05:37:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041025; cv=none; d=google.com; s=arc-20160816; b=AqGn+dl9VH5vU6r8dMIyqjV80NGQGUzzMoiv3uly0ON1pWzt0cGNeFn/bNbB5Cea4M c/Y4yqqXxfLJWa+U1QZ2BYIDY7RH6j2OWFjtfHMlSkC2XvViRrwqecuv4QLmo+5jAt9J pSCuHbznd9ivz+xgPL8VXrckEjBBw9i6nHewFvwQ7Ddt3r86VVEFvDBPYVhNJSzSs1oX aE+Bnv9qx+cviAnSMgPCFwRBCVu2KqYK9wfP1kovX2ET1IyiWuGL91kuRTAhkmxAMtTx zzeAjzpsAg07nbOz8EtfKKfOGrW9edTA7xfRE6c8kEqGchqRDJHbP8JHaZDw5Cp1om44 2Mng== 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=P4hkNztqDNRnaj+KFHGOI40tyfjypqPbuVEH2aEu/ZE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=I/0l1KzR+VdHPp+ZSnibgKxJX+QzqLXHpZdrHiCFTlHbfs8/U4GH6J5THq4D7h/ejQ y9Snk7HN9NYdMvJf2z7PtI8cQ59gpgOfgS0j6KPLeteBuhRBVrAAMdQAXYYJ8VpqOikr S9IbEjQ5XTsUtNixJa8G4wmFIk4Z22x5DknrBb1AwELMJUUuQw+dbY8w3qBklD1NPCzo 2g5q1sL06n+wZG1QwLLpqx7HBoNIynHt9serTP0+TTF9YEShx2nrB4RRufdo8LkTdWs4 WetYJShZVHl1JdgaBBpIbU+BNjvU2T2QoqaH7csGPq6Zx2XT9UYYYTpS/H9G4WPuF4Kd ztmA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="aDH/Cv7Y"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c16-20020a05620a11b000b007879038b456si7361592qkk.196.2024.02.27.05.37.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:37: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="aDH/Cv7Y"; 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 1rexb4-0001AS-LY; Tue, 27 Feb 2024 08:34:14 -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 1rexae-0000r0-IB for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:49 -0500 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaW-0002xt-Sv for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:48 -0500 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2d288bac3caso27993981fa.2 for ; Tue, 27 Feb 2024 05:33:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040819; x=1709645619; 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=P4hkNztqDNRnaj+KFHGOI40tyfjypqPbuVEH2aEu/ZE=; b=aDH/Cv7YDomn/mjERrsncVZ0o53RbnyAog096DYWI1ROzohllKa9W0sjV65d5YC4rt Tg2I7lReUR9HyVokNemRqYzwunrGkr5ILFvsqmmDhDzCQHtAx5h3NWDVB6NKECZnJvfg ahji41lc6JdlW2nMAyar1cu8wHxQTmJUwG2RobdseVIREd4IvK43CXrx7eKdMsXtt6sa oa1ThrBKy8idr3bhXpK/cVv4NB52MdPtVonaFhXCMrq9ztCq6J6ENEPxcU0mspQXfwQr uerylaHEeO4XxUgEKFi8p9aIN40xB5wEZb/bVF9YGXUozbQ5ALZhqnIF2eSIRl749bAI m4ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040819; x=1709645619; 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=P4hkNztqDNRnaj+KFHGOI40tyfjypqPbuVEH2aEu/ZE=; b=tXv9nV9IVg+3Xb6cwixwR0Qb1JHYDMEjZu2CoikEAO2JLUJyPt8crfnF7BAg3g4uSY GKggRUgibyyY4E5u3o92u2MJwkp+DLvyfV3ni15cwpxJEvQSQf9tE+mIrAZCHHBuJ7jM boI5LLwTFtJyEb97mwfr4hS6eurTekhiFzpeXzUJ8xVsvgQYzEWUmYOHoJKtawtQZO03 us5yDYscHrY9qCvSqU0E8C2EqbhGfOJPhfPVi8wsPHjZ0X5NSTIlv+a54l2dfifuLptt QOH6Ai8cQq/INjMiHI1CbhtuoykXhjeU7+rgDcyX/5O4Zsh3Lwdh6hGyv0njCuhy3Q7O A0PA== X-Gm-Message-State: AOJu0YxWBh9uBYrsA99ZcFe60OCMSD4f1dQ1fgvYJmwNjqfCNAQutK8O t+DytNbNMy1DuJz/Gh8whmcRhCrbAtJXF+K29CGtTjCw5lMIlOIHHNH1rDl8pWslq0hMqt6wB+E W X-Received: by 2002:a2e:be89:0:b0:2d2:5430:605a with SMTP id a9-20020a2ebe89000000b002d25430605amr7860482ljr.7.1709040819205; Tue, 27 Feb 2024 05:33:39 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:38 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 45/45] docs/system/arm: Add RPi4B to raspi.rst Date: Tue, 27 Feb 2024 13:33:14 +0000 Message-Id: <20240227133314.1721857-46-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x233.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: Sergey Kambalin Signed-off-by: Sergey Kambalin Reviewed-by: Peter Maydell Message-id: 20240226000259.2752893-42-sergey.kambalin@auriga.com [PMM: list PCIE and GENET as 'missing' for now, until we land the patches which add those devices] Signed-off-by: Peter Maydell --- docs/system/arm/raspi.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/system/arm/raspi.rst b/docs/system/arm/raspi.rst index d0a6f08b2b9..bb417c34241 100644 --- a/docs/system/arm/raspi.rst +++ b/docs/system/arm/raspi.rst @@ -1,5 +1,5 @@ -Raspberry Pi boards (``raspi0``, ``raspi1ap``, ``raspi2b``, ``raspi3ap``, ``raspi3b``) -====================================================================================== +Raspberry Pi boards (``raspi0``, ``raspi1ap``, ``raspi2b``, ``raspi3ap``, ``raspi3b``, ``raspi4b``) +=================================================================================================== QEMU provides models of the following Raspberry Pi boards: @@ -12,12 +12,13 @@ QEMU provides models of the following Raspberry Pi boards: Cortex-A53 (4 cores), 512 MiB of RAM ``raspi3b`` Cortex-A53 (4 cores), 1 GiB of RAM - +``raspi4b`` + Cortex-A72 (4 cores), 2 GiB of RAM Implemented devices ------------------- - * ARM1176JZF-S, Cortex-A7 or Cortex-A53 CPU + * ARM1176JZF-S, Cortex-A7, Cortex-A53 or Cortex-A72 CPU * Interrupt controller * DMA controller * Clock and reset controller (CPRMAN) @@ -35,9 +36,10 @@ Implemented devices * VideoCore firmware (property) * Peripheral SPI controller (SPI) - Missing devices --------------- * Analog to Digital Converter (ADC) * Pulse Width Modulation (PWM) + * PCIE Root Port (raspi4b) + * GENET Ethernet Controller (raspi4b)