From patchwork Thu Apr 21 11:18:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564314 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp341601map; Thu, 21 Apr 2022 04:21:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxG5Fi/RI4+08XtHJ3MPmAFbxDNNKXRAbItAqpjGt7LGJ2op/8TcD96q2+BumGE+CeucVRT X-Received: by 2002:a05:6214:29e7:b0:446:6d26:2440 with SMTP id jv7-20020a05621429e700b004466d262440mr10812840qvb.118.1650540105123; Thu, 21 Apr 2022 04:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540105; cv=none; d=google.com; s=arc-20160816; b=gggNqxXcyVl4WVNP7jW45NYvqQ/WXjRl/3py1cwyU5iwSomgjn8Ddzi/V1PwR2ZWXD 1jFU2Jg27EFAuzvbZcx2cI0hpT+fB09VX3A1rfxQPkqpr0lqE5wVapfmr19XIwM67Rti 9zeVBE7d6PxOQg+v7v/lhanbHwARuFVtXDJEwkCNQSpxRcqTTLr1kotRwoUOpg9S3UrL Ptdeit8sXU1pZTTCmK5iAIplUW/zZ9zKSPsGeIt4JyhT3+rKowDnW/NkDfMf1QtljFLA OIiH3sxYbXvHqKyXVwCEpkMDBoxuWzSgCFfX2DTXlGVcGOPlwHFo+8HF/1SCgdsTb79Z X+Aw== 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=MEtor4j+P9zV/cCDr31gN48wrx6xOJygpWmwTKMQDwk=; b=gRpQGSYu7UmelaNSB0BltOH5FaG3C234nrjBC+yt3IHWehZIpJQB485ZzpWqP6Po5X VhGoVmW9EVck0ecteHppLct/Nd7yGhBJrOsoLIrekWlps3X4w0cjqgLOaVmrnPwyv4zk mwPKz6MOo4oeh1ZY50T9JrXDxDGckzF62/O3hrr/g4+2vnQnnZpwjstiP/hRbOs2p8yA JmdcCOEn5SuMoG40HTiygsEFVaggSDpccmjCoIgStJb3rWijgpu5S/1LL5O5H/vvoelE GHP3lWEqmFisv5W5yCGVufiUDTvYrPXwBlrZEGG4nbjkfobfe3jMnEwvfYAsujTX/KFL D3jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V+xylE73; 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 w11-20020ac84d0b000000b002f1e866a306si1180987qtv.559.2022.04.21.04.21.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:21:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V+xylE73; 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]:59416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhUsa-0003ZB-MK for patch@linaro.org; Thu, 21 Apr 2022 07:21:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUpo-0002g2-L1 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:52 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:41510) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpm-0003Q0-LF for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:52 -0400 Received: by mail-wm1-x334.google.com with SMTP id o20-20020a05600c511400b0038ebbbb2ad8so3203081wms.0 for ; Thu, 21 Apr 2022 04:18:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=MEtor4j+P9zV/cCDr31gN48wrx6xOJygpWmwTKMQDwk=; b=V+xylE735e+Mbe6ZBvaUKQJv1i9wA3UBx+FbQfh7PU5RmY0z79rASvlg79cQovQgAM /KiR0QCpaSceW/w/qrNqXVhYJUrqRnvFTV3GLt17wbNNsOIxqTGWW1x7puYFG2ENJyGr QMCOuS1tLkSFlYg0Ify40oIPh50d1rI0pMR0kgMTV4Wn48ihAhj4nuFNd/27mNflAL2w W2yP4CS+XQzO6ZHBnOFRKRZol44q6B4kTrLmuUTAayWflDAepeJMvyROC3QHG+NzF2br +Qdn+hXoNoJhWUQGqMXN78mTa2sN8bmBJAwwfF1lqVYOqdLchX2itLE5wknzvrgx/ndh VHug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MEtor4j+P9zV/cCDr31gN48wrx6xOJygpWmwTKMQDwk=; b=BBW8jkdm40ObAgviGcwxcDH/Hx+eltzCRdVebNGcenhf8gzGt7svQEf7jlqUspegoV OUoirrvWpwTVV1kZtYVC+NyB01x2ZaP2UXU7iC6baan31NfQAY0oV/xeQ1jf6QhVJIKV RLkK9+N6bRNTK8C2iCrkWhiot8Vvin0qkDiHadyuax7aX0BGxnYbs2XKo6L200H4VEbr jkAwP6eAGKrsVLOMZrF+/c9nn7TcVHqd7Rh+a9AWfj8Lbjw/UStrkj79Uls7gTlMv5xE iYlIrhzhcm6wiKg7c1JyPvE0u+RAv1C7Yf6CgHDvKCaV2dHSRvyAmiAbGpWlls2D2do9 odCA== X-Gm-Message-State: AOAM531hp07AajJePupq//D47sjkB9t0UILWg02NmbyqW16+J9VUYNAd x+FVxER+iaQFbrukV4wIQ07KT//m9yWkQQ== X-Received: by 2002:a05:600c:1552:b0:38e:c7a4:f056 with SMTP id f18-20020a05600c155200b0038ec7a4f056mr8169781wmg.183.1650539928956; Thu, 21 Apr 2022 04:18:48 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.18.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:18:48 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/31] hw/arm/virt: Check for attempt to use TrustZone with KVM or HVF Date: Thu, 21 Apr 2022 12:18:16 +0100 Message-Id: <20220421111846.2011565-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" It's not possible to provide the guest with the Security extensions (TrustZone) when using KVM or HVF, because the hardware virtualization extensions don't permit running EL3 guest code. However, we weren't checking for this combination, with the result that QEMU would assert if you tried it: $ qemu-system-aarch64 -enable-kvm -machine virt,secure=on -cpu host -display none Unexpected error in object_property_find_err() at ../../qom/object.c:1304: qemu-system-aarch64: Property 'host-arm-cpu.secure-memory' not found Aborted Check for this combination of options and report an error, in the same way we already do for attempts to give a KVM or HVF guest the Virtualization or MTE extensions. Now we will report: qemu-system-aarch64: mach-virt: KVM does not support providing Security extensions (TrustZone) to the guest CPU Resolves: https://gitlab.com/qemu-project/qemu/-/issues/961 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404155301.566542-1-peter.maydell@linaro.org --- hw/arm/virt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 9284f7d28e6..bb6a2484d81 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2048,6 +2048,13 @@ static void machvirt_init(MachineState *machine) exit(1); } + if (vms->secure && (kvm_enabled() || hvf_enabled())) { + error_report("mach-virt: %s does not support providing " + "Security extensions (TrustZone) to the guest CPU", + kvm_enabled() ? "KVM" : "HVF"); + exit(1); + } + if (vms->virt && (kvm_enabled() || hvf_enabled())) { error_report("mach-virt: %s does not support providing " "Virtualization extensions to the guest CPU", From patchwork Thu Apr 21 11:18:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564313 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp341479map; Thu, 21 Apr 2022 04:21:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0QTbaDZcjupjBWfVrfzFgd3tBFRXN84/i984HVcy62o5aTxIXCkq2RpR1GR+w2noDa4EW X-Received: by 2002:ac8:7f07:0:b0:2f1:f0e0:27b with SMTP id f7-20020ac87f07000000b002f1f0e0027bmr17106314qtk.464.1650540092294; Thu, 21 Apr 2022 04:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540092; cv=none; d=google.com; s=arc-20160816; b=PJU35JAbdz+7nDJlxv+iZbiSvV+Ms1k5PFdbtnj4Omn1UXX6x6Cwrn7m+bduqlXJu5 90uyk8z09JDCtTQu7iM2OhLCSYwLq1yvUG5N1Nj2HmqPojM9Av/h2Uk6XvIK3YPvotqj k7sk8wQ79y3MAFgT9aCa+vLcwtDLN11LZPKKeSLe9+Vv5FWTM/IsPKP1JEofd5eCpXIQ Jckmx96Qvv5sTjiU4d4R+w1b0UT2BdFNZtisCJ63DJdawmXrlKUDMTtC7lrFeN+ur/Gi w54H5HQkuXVw3VI2/niZciMw3Cavej9wmhrvkrT4T8V8DUiUBdGYeZ/kj8HYHXXUcWOm FStA== 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=TwQCGhEvSSQC/Z2/EccxdurzG1YqSvcBdgIIL6E/lik=; b=WiCSaB513Kkn8V+EyfO6mNwER42wB2kJflKvnZ0SBlEcEQgFti7wBwUPYUvnAOkB8F 0wu7bql39v0W5a430YB6He7SYiLTra87GGD7/Rbd77tKnJMEY2LFiUcMUg0XegYj2scF tjp2d+h2WMhq78lkRboAnUVSOWtYr5MqviGR49sFztUhLq5LLFbkhpdAuQO+18zT9U1h 9js7pvWQlOUYeNa9dWAn6FgQHTZNF2cckfRIrsRGCwXAFvby8vP2NTZzJgv0PIk9yjFt WLhfrrT6janf2suyhKxBFImBE/tpOEkAjUVeTOU65DKg1XgfLgoSTqIwBIZf7878pXTn X5fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GSzUzfym; 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 p7-20020a05621421e700b004464f471090si1262783qvj.501.2022.04.21.04.21.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:21:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GSzUzfym; 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]:58372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhUsN-0002mz-OJ for patch@linaro.org; Thu, 21 Apr 2022 07:21:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUpq-0002js-3F for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:54 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:35755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpn-0003Q8-C1 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:53 -0400 Received: by mail-wr1-x436.google.com with SMTP id k22so6227929wrd.2 for ; Thu, 21 Apr 2022 04:18:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=TwQCGhEvSSQC/Z2/EccxdurzG1YqSvcBdgIIL6E/lik=; b=GSzUzfymB4RGM71lbqIspMIWR7nnanN6QGW9GjbJWpE265kzng/iPaZLD7K/laDupw 17zEhQDhlM+DAxsAwmizBpxvyZ+kISH0g3jRLcay0+h61CLuD93wctvj7nhZ9nRQ0mGH 2AiOOOUr2MZ3lO670+ycldbnh9Asc175si3kv3d3Nzc1K2qRhrcMjEENtpJJ8Ji8Nf7f md+YXt6fRq4zKjKJ7Eici53DYBJv8rmiWAY3nUAdzBKduFalFsY6TzGYaQWfeeFJlHlj lWAJ3weEQXWQCWAUXUoOe2pc3tICUBnqbQbP1KYPbKhKMawair5mdaYQzqkx2mZO7Smj pf4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TwQCGhEvSSQC/Z2/EccxdurzG1YqSvcBdgIIL6E/lik=; b=hMLplDQYwoBuL4SEu4dKs07RbFXg3IGsYCo1TQ6hDwWdTeweNyK37Opj/lQfGugbUf QdVErsAOUhp4/q/qX6NnlywkJ3/LqhEG9d+b5/0832IZQr+sIRFrQwlkWqxYTPJa0nNw R3MjseSyeFDs9kfzXBJMrdNVZrByhEARu9BvPMhk9WIdI2p39c+m+fqhHz2dD3VVJpIx M0nU2AgJDGy+YAv8nbqEa+37gBStPcKD+7C18RF18Dhj+Giqw8kD/9E+nigck3+7iaAZ 6EhrXiRfFZpwKF3Ph78iE+03hLLaJ+zekwXjJe8KMEuufyPV6pDDRIzeADxgGgkF82Dh Q5Cg== X-Gm-Message-State: AOAM530ekGfqQYIMRp/QE4oKlVHfc632zCicEF9DrTebiWdMkcm1VFXb frsbDQ0qs/o+85hekTf/aeOerZdn8TFX+g== X-Received: by 2002:adf:ebd2:0:b0:20a:9c10:ab29 with SMTP id v18-20020adfebd2000000b0020a9c10ab29mr13123277wrn.212.1650539929889; Thu, 21 Apr 2022 04:18:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.18.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:18:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/31] timer: cadence_ttc: Break out header file to allow embedding Date: Thu, 21 Apr 2022 12:18:17 +0100 Message-Id: <20220421111846.2011565-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" From: "Edgar E. Iglesias" Break out header file to allow embedding of the the TTC. Signed-off-by: Edgar E. Iglesias Reviewed-by: Alistair Francis Reviewed-by: Luc Michel Reviewed-by: Francisco Iglesias Message-id: 20220331222017.2914409-2-edgar.iglesias@gmail.com Signed-off-by: Peter Maydell --- include/hw/timer/cadence_ttc.h | 54 ++++++++++++++++++++++++++++++++++ hw/timer/cadence_ttc.c | 32 ++------------------ 2 files changed, 56 insertions(+), 30 deletions(-) create mode 100644 include/hw/timer/cadence_ttc.h diff --git a/include/hw/timer/cadence_ttc.h b/include/hw/timer/cadence_ttc.h new file mode 100644 index 00000000000..e1251383f2a --- /dev/null +++ b/include/hw/timer/cadence_ttc.h @@ -0,0 +1,54 @@ +/* + * Xilinx Zynq cadence TTC model + * + * Copyright (c) 2011 Xilinx Inc. + * Copyright (c) 2012 Peter A.G. Crosthwaite (peter.crosthwaite@petalogix.com) + * Copyright (c) 2012 PetaLogix Pty Ltd. + * Written By Haibing Ma + * M. Habib + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ +#ifndef HW_TIMER_CADENCE_TTC_H +#define HW_TIMER_CADENCE_TTC_H + +#include "hw/sysbus.h" +#include "qemu/timer.h" + +typedef struct { + QEMUTimer *timer; + int freq; + + uint32_t reg_clock; + uint32_t reg_count; + uint32_t reg_value; + uint16_t reg_interval; + uint16_t reg_match[3]; + uint32_t reg_intr; + uint32_t reg_intr_en; + uint32_t reg_event_ctrl; + uint32_t reg_event; + + uint64_t cpu_time; + unsigned int cpu_time_valid; + + qemu_irq irq; +} CadenceTimerState; + +#define TYPE_CADENCE_TTC "cadence_ttc" +OBJECT_DECLARE_SIMPLE_TYPE(CadenceTTCState, CADENCE_TTC) + +struct CadenceTTCState { + SysBusDevice parent_obj; + + MemoryRegion iomem; + CadenceTimerState timer[3]; +}; + +#endif diff --git a/hw/timer/cadence_ttc.c b/hw/timer/cadence_ttc.c index 64108241ba9..e57a0f5f09f 100644 --- a/hw/timer/cadence_ttc.c +++ b/hw/timer/cadence_ttc.c @@ -24,6 +24,8 @@ #include "qemu/timer.h" #include "qom/object.h" +#include "hw/timer/cadence_ttc.h" + #ifdef CADENCE_TTC_ERR_DEBUG #define DB_PRINT(...) do { \ fprintf(stderr, ": %s: ", __func__); \ @@ -49,36 +51,6 @@ #define CLOCK_CTRL_PS_EN 0x00000001 #define CLOCK_CTRL_PS_V 0x0000001e -typedef struct { - QEMUTimer *timer; - int freq; - - uint32_t reg_clock; - uint32_t reg_count; - uint32_t reg_value; - uint16_t reg_interval; - uint16_t reg_match[3]; - uint32_t reg_intr; - uint32_t reg_intr_en; - uint32_t reg_event_ctrl; - uint32_t reg_event; - - uint64_t cpu_time; - unsigned int cpu_time_valid; - - qemu_irq irq; -} CadenceTimerState; - -#define TYPE_CADENCE_TTC "cadence_ttc" -OBJECT_DECLARE_SIMPLE_TYPE(CadenceTTCState, CADENCE_TTC) - -struct CadenceTTCState { - SysBusDevice parent_obj; - - MemoryRegion iomem; - CadenceTimerState timer[3]; -}; - static void cadence_timer_update(CadenceTimerState *s) { qemu_set_irq(s->irq, !!(s->reg_intr & s->reg_intr_en)); From patchwork Thu Apr 21 11:18:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564317 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp343098map; Thu, 21 Apr 2022 04:23:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5SbrehqnXfueXkKC7DOr23qOzota1SX4Rr/vLqh8Zis5/Xi/jxBaNmsjca1mh80CRYWC8 X-Received: by 2002:a05:622a:82:b0:2f3:4be3:3a91 with SMTP id o2-20020a05622a008200b002f34be33a91mr1590277qtw.241.1650540239800; Thu, 21 Apr 2022 04:23:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540239; cv=none; d=google.com; s=arc-20160816; b=gLOmSa7yVLSLgI2OIIU4ro82C4c2hMriaW1RnhyEtXlE5xCW4RCKDyk0VYPijQ5h5G oeBFcmkBuXGee4Onh46aYaii+/QqfYnZN06YbyZ/40MGWAzP/C2+WjSVbsg++lJ7a4nS 7NYA0LNHCwzEKYNMdA5FZYQEMbhXLil0GwwScmFAI9y0Bl2BYBDQVTepzNetszkq8dC/ rti2WQ4ffy1SvQqc0Hy4IxMOdn2F9dp+uIxd/LN4d84t3wK8v1YSqjqD0QItxeETbSfS pEL5ZXylDl+uXRKaJk5Mfxu9Sk+llUg4d+IrUD9DdkfYodaMA6vylFWOLONF29oMn67W Cnvw== 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=f47lw1QPcXaJplbJJd1gYAYuTWuO7WWJTSxjhTHJnU4=; b=odyTFk/ipoZ3pLmNbztWbhEGbQluyXu7Xj/EGKW40ro0mPiSVq3aMkFaUBP+RCnP3h VCbTmJAD0RcpjUcgHUZ3pmbCkmLgOKDzdyJw0WX8fcE4CJYUH41WCjQu+tbeIfimEGNp QiYZd9mgpn5ii8SanX2SXTkBiWWCfU6Pq+Pgx6OruC++K6XIIV0hM2nFdAnsAUc19QAQ x+dcJxhZKACucboRNZAzyNWaZQ5Lh459zCIE8gUqxbcouBciISAv7Ujuf26Xc9fa6Ez3 riVeWlZ3YPmECte6ZDEeltPNZReOt9pr1FqZijIQ6RnqXNznKwwxV1TzZDfpnBZgMJpE gBiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ffg3eyFj; 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 l23-20020ae9f017000000b0069c652150e7si1176402qkg.685.2022.04.21.04.23.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:23:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ffg3eyFj; 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]:38820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhUuj-0000LE-Ns for patch@linaro.org; Thu, 21 Apr 2022 07:23:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUpq-0002k5-6I for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:54 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:42864) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpo-0003QB-0Y for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:53 -0400 Received: by mail-wr1-x429.google.com with SMTP id bv16so6181619wrb.9 for ; Thu, 21 Apr 2022 04:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=f47lw1QPcXaJplbJJd1gYAYuTWuO7WWJTSxjhTHJnU4=; b=Ffg3eyFjT+HmD1OynSuN7IaOH5LGe6roPgC/RFrlP5CldS7QsqBrvOh9oV3kI7aOeY TjfhdZZgVRoEPk5vvWYBGvlpglQXnahTTiEmo5UdrNNX+SQM1EHa7ETkklb8eVJgbVzi vTKJ5FdY74l2dLK7Y7L9AKBRQzd5vD/NWkE0OtM5Nnwo4eRIw3bKC3Qp9JJqKPkSmIoY RU63Z22Lr3w1p5YsfoPoEGXS8Ub0uaykfcTp63IE4gxi0i4y8m1syHzzuK3S3dIO4VLj 8iCJkCtO1F2hS5wc9nBZjigomYcnQkbzR1WhHqoeEycJfiUKrV2NIWVp+TwB060+5Fwn 7Gow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f47lw1QPcXaJplbJJd1gYAYuTWuO7WWJTSxjhTHJnU4=; b=rdroUZ+9vCWYvHrtMLEXjSqn13tv/5XVq+86DD24na9p7NxMhP+wwJnL4HaAXgZned OsE786GPhGmqrs0Qp5gUcJBks8xQk/N4jeJ3eRqmUFmJrdWTRHDVHBiUzI9Os0MdhwdY 8WQ4YVleIfYkzwSK8jXqSVip9i8oamA0emG/LrzY7X8+2kevlO0qCKDqL0J9URmIXBlh ocWJ4lNM5n1gIBGAV+klK7kcmF33QIX0NJYDPLPoD62XWq+odbiQiUZn/ukuCLQEpx8t JSjbncds+EhkYUHR1x1qJn1ElMqcLHeVjZ0Pf+TJx9u8tyomrnsrHh3k4cK/l6su7vY5 142Q== X-Gm-Message-State: AOAM5327/mMZyIXU0eiGvnfoipLTC80v0U4NrpZFIuz1giuBD27/N1tQ RHg0bfLbsK7qARW1v3+3LIuLCnf9HYDPIQ== X-Received: by 2002:a5d:4a81:0:b0:207:9abe:2908 with SMTP id o1-20020a5d4a81000000b002079abe2908mr18818289wrq.341.1650539930676; Thu, 21 Apr 2022 04:18:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.18.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:18:50 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/31] hw/arm/xlnx-zynqmp: Connect 4 TTC timers Date: Thu, 21 Apr 2022 12:18:18 +0100 Message-Id: <20220421111846.2011565-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" From: "Edgar E. Iglesias" Connect the 4 TTC timers on the ZynqMP. Signed-off-by: Edgar E. Iglesias Reviewed-by: Alistair Francis Reviewed-by: Luc Michel Reviewed-by: Francisco Iglesias Message-id: 20220331222017.2914409-3-edgar.iglesias@gmail.com Signed-off-by: Peter Maydell --- include/hw/arm/xlnx-zynqmp.h | 4 ++++ hw/arm/xlnx-zynqmp.c | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h index 9d9a9d0bf9d..85fd9f53daa 100644 --- a/include/hw/arm/xlnx-zynqmp.h +++ b/include/hw/arm/xlnx-zynqmp.h @@ -41,6 +41,7 @@ #include "hw/or-irq.h" #include "hw/misc/xlnx-zynqmp-apu-ctrl.h" #include "hw/misc/xlnx-zynqmp-crf.h" +#include "hw/timer/cadence_ttc.h" #define TYPE_XLNX_ZYNQMP "xlnx-zynqmp" OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP) @@ -84,6 +85,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP) #define XLNX_ZYNQMP_MAX_RAM_SIZE (XLNX_ZYNQMP_MAX_LOW_RAM_SIZE + \ XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE) +#define XLNX_ZYNQMP_NUM_TTC 4 + /* * Unimplemented mmio regions needed to boot some images. */ @@ -128,6 +131,7 @@ struct XlnxZynqMPState { qemu_or_irq qspi_irq_orgate; XlnxZynqMPAPUCtrl apu_ctrl; XlnxZynqMPCRF crf; + CadenceTTCState ttc[XLNX_ZYNQMP_NUM_TTC]; char *boot_cpu; ARMCPU *boot_cpu_ptr; diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index 5bfe285a191..375309e68eb 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -68,6 +68,9 @@ #define APU_ADDR 0xfd5c0000 #define APU_IRQ 153 +#define TTC0_ADDR 0xFF110000 +#define TTC0_IRQ 36 + #define IPI_ADDR 0xFF300000 #define IPI_IRQ 64 @@ -316,6 +319,24 @@ static void xlnx_zynqmp_create_crf(XlnxZynqMPState *s, qemu_irq *gic) sysbus_connect_irq(sbd, 0, gic[CRF_IRQ]); } +static void xlnx_zynqmp_create_ttc(XlnxZynqMPState *s, qemu_irq *gic) +{ + SysBusDevice *sbd; + int i, irq; + + for (i = 0; i < XLNX_ZYNQMP_NUM_TTC; i++) { + object_initialize_child(OBJECT(s), "ttc[*]", &s->ttc[i], + TYPE_CADENCE_TTC); + sbd = SYS_BUS_DEVICE(&s->ttc[i]); + + sysbus_realize(sbd, &error_fatal); + sysbus_mmio_map(sbd, 0, TTC0_ADDR + i * 0x10000); + for (irq = 0; irq < 3; irq++) { + sysbus_connect_irq(sbd, irq, gic[TTC0_IRQ + i * 3 + irq]); + } + } +} + static void xlnx_zynqmp_create_unimp_mmio(XlnxZynqMPState *s) { static const struct UnimpInfo { @@ -721,6 +742,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) xlnx_zynqmp_create_efuse(s, gic_spi); xlnx_zynqmp_create_apu_ctrl(s, gic_spi); xlnx_zynqmp_create_crf(s, gic_spi); + xlnx_zynqmp_create_ttc(s, gic_spi); xlnx_zynqmp_create_unimp_mmio(s); for (i = 0; i < XLNX_ZYNQMP_NUM_GDMA_CH; i++) { From patchwork Thu Apr 21 11:18:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564319 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp344193map; Thu, 21 Apr 2022 04:25:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTT7GKZi2w292ehSnzxUzM/Mv4TaKOaMUc/E3v1z6Qp/G0Stx/FcM2uMaKDr6I5GiySRmE X-Received: by 2002:a05:620a:288c:b0:699:bbc6:9e54 with SMTP id j12-20020a05620a288c00b00699bbc69e54mr15693931qkp.226.1650540346156; Thu, 21 Apr 2022 04:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540346; cv=none; d=google.com; s=arc-20160816; b=nW091qDt6C+SDDY3SbH+PWk7QIUfYz9RDuQgDN90Srm5JPJrR7qE5ZC0SqvOSoK2Tg KglU4Fhjk77sbveSWvZhXA/f+5Xl32L1fm5MR1G1+w+/MSLFqJyqnp8CLHPQVZ2837OD PoqsxtAn8i1H1v61oh/GYv3meTFNQMVI51Y4AAMwv1aAR9mRhnHRKjLCP9SWTiDD70fi vvlamhmVfu5dMbUwKswlaB1ghBZKHE7hweXbnWtAnsViPy5/kYQlBbIPlzErS8m05L6n Z1uA6OUujLMKwLZcC9nt2uKMRXOP7poNpUvuQjhVmDHG+NOC5J27WRKq9YVivhLrH45E deBg== 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=wfsVKDSs56nO298B9eGbm6n11u9EwnB13l23WZAxciw=; b=sLViDXIb8jzba8WkMmR3Agu9RcrSuvnCGp94zzMa/K9ChXTN/CQAUiU9v3aQdqhiSm lFY3xu0rLujdJsh7oSZoL+5hdWz2tOufYKKpvvJP/WYgeLK/mJvqJeQ9LbkqoGOmGl/D 1x2E7fsdI8P/a/tGYCMKkJJ3tsM7xNdphFLMpsxFk1FeIxJ96l1N20oT4oJkfIETjckF ZPLdorMc5+k4mr+ZargL7H19G1vxvtdJAGdBkBNWcLB9++SgpaAwDGiYTITLJAl+L8Qp fgRPhYhRSKJfEoODt0CG8fKiPNe9Ft4XWMb3oQ9bLCSV1DKjxE1x1P5a0RPdQ9S19ljO wKpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Tq/20ZDi"; 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 u11-20020a05622a010b00b002ef8bc6a479si1302628qtw.51.2022.04.21.04.25.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:25:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Tq/20ZDi"; 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]:41482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhUwT-00028h-Oa for patch@linaro.org; Thu, 21 Apr 2022 07:25:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUpq-0002ln-TL for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:54 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:33683) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpp-0003QI-48 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:54 -0400 Received: by mail-wr1-x429.google.com with SMTP id x18so6241562wrc.0 for ; Thu, 21 Apr 2022 04:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=wfsVKDSs56nO298B9eGbm6n11u9EwnB13l23WZAxciw=; b=Tq/20ZDirVD5MPM9Tg3S22Mt9CzMpQEFaxl+LQPDNzTThjK5bt8bVB6k1X6hOzT+nd hAM06HKLbt4AT0bcE6xwVgJSaSICS6GbZTllrtIux11/VYZCgTxFkkPt2dVavJ+XU/AR fUd74zWmQZCbhOBy4KjX03qsaE/QxR94cMU6943fBpiWGGmNXyQjPIiu8lo1RH5QEryb HELbiX4G8JNZ5Ga8tRcVx5x80twdkG5iIoM317K1cypomsXEA09b8Te/scvXb0TIBl1F t0VjqKGTH+cygtVu2oTppWYe1vIg4LoN2aZutFC0Ydyo6ox/dagQTICXk1kOZDELphzK YKmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wfsVKDSs56nO298B9eGbm6n11u9EwnB13l23WZAxciw=; b=LvRR27z6oYwN8u/TrX4b5X7j373DRv9/TpiGAvv1o79Y88Vwdw8JcxCRX4r7LYLGLS khOK1EDejy+SamQm3vui84z3fkkh7X6/U4T1feWo2KUm+/spCXeapmN7N/sW3YM3KY5q 9RIXhHjnvT2xgE4wS1q3FLW10SZ/f8YNRllxhL71pSvRtsUkGOUZsXjyI9nGklKtnol2 l/QAdgYVh+F9Dv1YxmNoZGEgwtA1DWu1RYL+mggNmvPi7TmPZiPGWVpARyM6H24eRi6Q 76pO66quF12S8E4hwzOnTs6cHM8wby+xjUEvVZHBMZ44u+dAFWK5bqLF2pbLL0V6iyPn Rfjw== X-Gm-Message-State: AOAM533gaCI2nwkb8ozXA1y50uQ0v9A5xByPjOsGvmSgmjYo3/m8DiNP UDe84CrtLYF1TV1uEBI1zNS9fy7Hbct1jA== X-Received: by 2002:a5d:5604:0:b0:207:a2a3:2f3d with SMTP id l4-20020a5d5604000000b00207a2a32f3dmr18913328wrv.358.1650539931618; Thu, 21 Apr 2022 04:18:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.18.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:18:51 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/31] hw/arm: versal: Create an APU CPU Cluster Date: Thu, 21 Apr 2022 12:18:19 +0100 Message-Id: <20220421111846.2011565-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" From: "Edgar E. Iglesias" Create an APU CPU Cluster. This is in preparation to add the RPU. Signed-off-by: Edgar E. Iglesias Reviewed-by: Francisco Iglesias Message-id: 20220406174303.2022038-2-edgar.iglesias@xilinx.com Signed-off-by: Peter Maydell --- include/hw/arm/xlnx-versal.h | 2 ++ hw/arm/xlnx-versal.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h index 0728316ec77..d2d3028e185 100644 --- a/include/hw/arm/xlnx-versal.h +++ b/include/hw/arm/xlnx-versal.h @@ -14,6 +14,7 @@ #include "hw/sysbus.h" #include "hw/arm/boot.h" +#include "hw/cpu/cluster.h" #include "hw/or-irq.h" #include "hw/sd/sdhci.h" #include "hw/intc/arm_gicv3.h" @@ -49,6 +50,7 @@ struct Versal { struct { struct { MemoryRegion mr; + CPUClusterState cluster; ARMCPU cpu[XLNX_VERSAL_NR_ACPUS]; GICv3State gic; } apu; diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c index 2551dfc22d6..4415ee413fc 100644 --- a/hw/arm/xlnx-versal.c +++ b/hw/arm/xlnx-versal.c @@ -34,10 +34,15 @@ static void versal_create_apu_cpus(Versal *s) { int i; + object_initialize_child(OBJECT(s), "apu-cluster", &s->fpd.apu.cluster, + TYPE_CPU_CLUSTER); + qdev_prop_set_uint32(DEVICE(&s->fpd.apu.cluster), "cluster-id", 0); + for (i = 0; i < ARRAY_SIZE(s->fpd.apu.cpu); i++) { Object *obj; - object_initialize_child(OBJECT(s), "apu-cpu[*]", &s->fpd.apu.cpu[i], + object_initialize_child(OBJECT(&s->fpd.apu.cluster), + "apu-cpu[*]", &s->fpd.apu.cpu[i], XLNX_VERSAL_ACPU_TYPE); obj = OBJECT(&s->fpd.apu.cpu[i]); if (i) { @@ -52,6 +57,8 @@ static void versal_create_apu_cpus(Versal *s) &error_abort); qdev_realize(DEVICE(obj), NULL, &error_fatal); } + + qdev_realize(DEVICE(&s->fpd.apu.cluster), NULL, &error_fatal); } static void versal_create_apu_gic(Versal *s, qemu_irq *pic) From patchwork Thu Apr 21 11:18:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564321 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp346338map; Thu, 21 Apr 2022 04:29:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlEaso/Ymg1tanudtsy6sDJQbrDJlleDCDWps0NbTHbVIYd3F7E2Y/+iRECIlylAW0zhLV X-Received: by 2002:ac8:7d50:0:b0:2f1:f199:3f57 with SMTP id h16-20020ac87d50000000b002f1f1993f57mr16968038qtb.525.1650540545125; Thu, 21 Apr 2022 04:29:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540545; cv=none; d=google.com; s=arc-20160816; b=q66bgxjcD1uYvr6fsCQHTpKPQ3jcpUwHLfmTKLPK7lmjZzUGUMYfbhXUPW56CmWDMg CYVYNUXXSCQiNZk6+l6sNTkS96kjtzPusuFhYkeQIi+49qrynnJyABy711f3LiTDawAW Z2Vf3GAw9bX20WSqzds4aHzcNMECsF1Bmd5o6/3EMHChdEHgiVAAlaT5IN1Rx6GcPfBc GHQVpFW6sHQweP1cA5NO1ZjerI0WkhC5ag1chaGKc4oQz1u6e+LTJS37PKu/FqnZcTPH I0xMrO1nqjVq/EeEr527iIeIri/sQw+sQNviH59lGs17hrpFMP6HITKiu3qnB5RptW0E IxgQ== 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=BePwGfJ5XZrjJA9AlqDcYsFQYq5FiOLMVEDlWQi8GrM=; b=KXbsC4gUEtBMu5u61kIGEN2BI0zkIaw6tJwH2cDydLDbaIwZsoebkQwxP39RyavR+U V2NQtx2WMCH7J6HBEL3ZrVeYbj7B7nRGO02quPep06nK5M/Yd54e6b472uVd2JkmdR+7 GrqsyYFWph11yaakklUqvVWlxMo25jTi4d6toWzBGDpEfmn1A40pmg2kUJTWha1T7ydC yB9sy0sje8gqZK5lcrizgx/ZgBkfZTLYqxy3pGjQPtizn7ahX+qpGz8/+FhwUXOck/OO fA7PbkNaAXnkTPJmBQAxlzRwN5E0jeTHExRo9oLJ6Ve18bH4hdfxCUNuCupDAxLCDcJt 5O2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PMzk4M48; 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 a8-20020a05622a064800b002ebdbc118besi1369087qtb.706.2022.04.21.04.29.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:29:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PMzk4M48; 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]:47520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhUzg-0007Ff-JP for patch@linaro.org; Thu, 21 Apr 2022 07:29:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUpr-0002oV-NW for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:55 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:34759) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpp-0003Qe-R2 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:55 -0400 Received: by mail-wr1-x429.google.com with SMTP id c10so6234376wrb.1 for ; Thu, 21 Apr 2022 04:18:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BePwGfJ5XZrjJA9AlqDcYsFQYq5FiOLMVEDlWQi8GrM=; b=PMzk4M48woAwFUg07t1b4tzLxELfAYuONCe0q9VpXUWt66zuZ2iI/zOjHKGm0MESUd dUHbc4XEw7N4eQGX+osOdE2tWXGlcqxWJRHt57xyeN7+GtxMIOZRnME3NQXJp2mHGg/i hmSmiMyuFSezglBYMQBuJBwZ+m7gmFvZ3Ga7wXzWOimMGjwdPyYbGd3yd7yMFQaDOTvW BVEY2zMb9xKiTX4OF2LtrMLk9+ulqBbMnlDA9HCshtoJNyiF9sCBKCeoPtbxd/YbzFSX qA2g9Q83A4+3vDqVK1/7gjc7bWMS1JnFSoU14foQlXHB11JfwfMs5SroaGOGVsF8dcld Dmxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BePwGfJ5XZrjJA9AlqDcYsFQYq5FiOLMVEDlWQi8GrM=; b=Ki7fer0356JPrPBYPH5fuN87q/Y/y38UW7l/gXjI3vR6DNL0mNKmjMfe+KX6SAd3o6 PxnN+ITkIcMZjpaPb0xQW+OCo8JlRGrPSh/V4smN1dzSZKib2jyQ651WZfznf2U8awZT hIf5oyjtpBVQjfe3hXIBbnIQNyNBspdJjQLw2/6OAcfZy2LhahGDdipiIRNLtpxqentz ZXRnrFqC0ZdSMtaemY9EH34+UBZ13M6bUcsc/fq48qI8NTb+Qd3G+2aWv6Djcv3q1qH/ UMSR3DjOAzV8pKhpnKR+0BLeFzc8gUJ800nv+9btcCn+iUlib7/SXUvCWu2P/tKR0PCm 7ZaQ== X-Gm-Message-State: AOAM530mP6Uo7a5ISgDCVFMKxn9x8dkdJDu17plrml6NAMTuSuGYBGbK TxX078/47Ozu08qebU8JOiINthor5g2wfg== X-Received: by 2002:a5d:48cc:0:b0:206:d17:10aa with SMTP id p12-20020a5d48cc000000b002060d1710aamr19310591wrs.460.1650539932453; Thu, 21 Apr 2022 04:18:52 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.18.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:18:52 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/31] hw/arm: versal: Add the Cortex-R5Fs Date: Thu, 21 Apr 2022 12:18:20 +0100 Message-Id: <20220421111846.2011565-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" From: "Edgar E. Iglesias" Add the Cortex-R5Fs of the Versal RPU (Real-time Processing Unit) subsystem. Signed-off-by: Edgar E. Iglesias Reviewed-by: Francisco Iglesias Message-id: 20220406174303.2022038-3-edgar.iglesias@xilinx.com Signed-off-by: Peter Maydell --- include/hw/arm/xlnx-versal.h | 10 ++++++++++ hw/arm/xlnx-versal-virt.c | 6 +++--- hw/arm/xlnx-versal.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h index d2d3028e185..155e8c4b8cd 100644 --- a/include/hw/arm/xlnx-versal.h +++ b/include/hw/arm/xlnx-versal.h @@ -35,6 +35,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(Versal, XLNX_VERSAL) #define XLNX_VERSAL_NR_ACPUS 2 +#define XLNX_VERSAL_NR_RCPUS 2 #define XLNX_VERSAL_NR_UARTS 2 #define XLNX_VERSAL_NR_GEMS 2 #define XLNX_VERSAL_NR_ADMAS 8 @@ -73,6 +74,15 @@ struct Versal { VersalUsb2 usb; } iou; + /* Real-time Processing Unit. */ + struct { + MemoryRegion mr; + MemoryRegion mr_ps_alias; + + CPUClusterState cluster; + ARMCPU cpu[XLNX_VERSAL_NR_RCPUS]; + } rpu; + struct { qemu_or_irq irq_orgate; XlnxXramCtrl ctrl[XLNX_VERSAL_NR_XRAM]; diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 7c7baff8b7f..66a2de7e133 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -721,9 +721,9 @@ static void versal_virt_machine_class_init(ObjectClass *oc, void *data) mc->desc = "Xilinx Versal Virtual development board"; mc->init = versal_virt_init; - mc->min_cpus = XLNX_VERSAL_NR_ACPUS; - mc->max_cpus = XLNX_VERSAL_NR_ACPUS; - mc->default_cpus = XLNX_VERSAL_NR_ACPUS; + mc->min_cpus = XLNX_VERSAL_NR_ACPUS + XLNX_VERSAL_NR_RCPUS; + mc->max_cpus = XLNX_VERSAL_NR_ACPUS + XLNX_VERSAL_NR_RCPUS; + mc->default_cpus = XLNX_VERSAL_NR_ACPUS + XLNX_VERSAL_NR_RCPUS; mc->no_cdrom = true; mc->default_ram_id = "ddr"; } diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c index 4415ee413fc..ebad8dbb6d8 100644 --- a/hw/arm/xlnx-versal.c +++ b/hw/arm/xlnx-versal.c @@ -25,6 +25,7 @@ #include "hw/sysbus.h" #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72") +#define XLNX_VERSAL_RCPU_TYPE ARM_CPU_TYPE_NAME("cortex-r5f") #define GEM_REVISION 0x40070106 #define VERSAL_NUM_PMC_APB_IRQS 3 @@ -130,6 +131,35 @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic) } } +static void versal_create_rpu_cpus(Versal *s) +{ + int i; + + object_initialize_child(OBJECT(s), "rpu-cluster", &s->lpd.rpu.cluster, + TYPE_CPU_CLUSTER); + qdev_prop_set_uint32(DEVICE(&s->lpd.rpu.cluster), "cluster-id", 1); + + for (i = 0; i < ARRAY_SIZE(s->lpd.rpu.cpu); i++) { + Object *obj; + + object_initialize_child(OBJECT(&s->lpd.rpu.cluster), + "rpu-cpu[*]", &s->lpd.rpu.cpu[i], + XLNX_VERSAL_RCPU_TYPE); + obj = OBJECT(&s->lpd.rpu.cpu[i]); + object_property_set_bool(obj, "start-powered-off", true, + &error_abort); + + object_property_set_int(obj, "mp-affinity", 0x100 | i, &error_abort); + object_property_set_int(obj, "core-count", ARRAY_SIZE(s->lpd.rpu.cpu), + &error_abort); + object_property_set_link(obj, "memory", OBJECT(&s->lpd.rpu.mr), + &error_abort); + qdev_realize(DEVICE(obj), NULL, &error_fatal); + } + + qdev_realize(DEVICE(&s->lpd.rpu.cluster), NULL, &error_fatal); +} + static void versal_create_uarts(Versal *s, qemu_irq *pic) { int i; @@ -638,6 +668,7 @@ static void versal_realize(DeviceState *dev, Error **errp) versal_create_apu_cpus(s); versal_create_apu_gic(s, pic); + versal_create_rpu_cpus(s); versal_create_uarts(s, pic); versal_create_usbs(s, pic); versal_create_gems(s, pic); @@ -659,6 +690,8 @@ static void versal_realize(DeviceState *dev, Error **errp) memory_region_add_subregion_overlap(&s->mr_ps, MM_OCM, &s->lpd.mr_ocm, 0); memory_region_add_subregion_overlap(&s->fpd.apu.mr, 0, &s->mr_ps, 0); + memory_region_add_subregion_overlap(&s->lpd.rpu.mr, 0, + &s->lpd.rpu.mr_ps_alias, 0); } static void versal_init(Object *obj) @@ -666,7 +699,10 @@ static void versal_init(Object *obj) Versal *s = XLNX_VERSAL(obj); memory_region_init(&s->fpd.apu.mr, obj, "mr-apu", UINT64_MAX); + memory_region_init(&s->lpd.rpu.mr, obj, "mr-rpu", UINT64_MAX); memory_region_init(&s->mr_ps, obj, "mr-ps-switch", UINT64_MAX); + memory_region_init_alias(&s->lpd.rpu.mr_ps_alias, OBJECT(s), + "mr-rpu-ps-alias", &s->mr_ps, 0, UINT64_MAX); } static Property versal_properties[] = { From patchwork Thu Apr 21 11:18:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564316 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp341984map; Thu, 21 Apr 2022 04:22:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo5YvjnPqTXWAZ2FwdFEljIQ0uJYrS97PyE09cP/eM27/8KEkuHYrCYorqVtm5tXQW5Vs8 X-Received: by 2002:a05:620a:e8a:b0:69c:1f96:b247 with SMTP id w10-20020a05620a0e8a00b0069c1f96b247mr15242689qkm.234.1650540134445; Thu, 21 Apr 2022 04:22:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540134; cv=none; d=google.com; s=arc-20160816; b=hp6Vs9FtkWSmhwZvC+dTpLskP9rZtHKnmkICqxHTxXf4ozprRYZ8MSlsgim2JNlfGt UXt5eSbepS4hnnU3GpfnOB2LSbJQwVcJm+itpSOJl2BdMSUDpr9a93/JxOdTRRFU+VUP OEzBfWsnpAoJ+qboPX5t/38pB1Waz4G4fbHjrwvhovckLqR//sFPnxeJ/u1fG5eJZDsn 367U0gFMatUEURPCmev2haayrhyL/qlq8UAIe3nhcRA/bWTwWf84kEBso62Xe614ScXz Vk1qbiwlwC3QY3A+d/50kcdq93wqGb+qp7qXtHICF89AR/V9xG1KwxpYY8o09Q0V2+sQ sfnQ== 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=0h0Rvkwm6rsblcwsPxp9qPIXdkCkI7ax30Wxe1BZzVA=; b=ynil/HW796PGZuGWN6KQedJ5z/1StBaukuA5rMrTC0fgCcM9oRn61oWms4jjMLPYET n70gjr3Jh8coksv9fjdCXgAqZTDFLvz6qPzWwWpKoY3FlC2ci5ZR88zloOiPTDRQOg5i SeeiMOsqebW7aG9K2Df4SG+lMa4vtT6zunO69a1WpLMY9bEzQXJXgqCraAJGtLL5mDNs 6PLk0401FOJcJs99A88vRbI6WfuKn9fTS4Tk1apcG03a/XI7m7J288ln434Wk4iJz6ay qStdDVZVy+0DIFHwFLmMRduryCYs7XZSQD5ii2iOMRtkcoMKb+2GlB6hyfuV6un84pOE 6fcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="CD/PiLoA"; 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 m10-20020a0562141bca00b0044623cbecb7si1255794qvc.290.2022.04.21.04.22.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:22:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="CD/PiLoA"; 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]:33334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhUt4-00054c-09 for patch@linaro.org; Thu, 21 Apr 2022 07:22:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUpv-0002wb-Q1 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:59 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:33049) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpr-0003RH-HQ for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:59 -0400 Received: by mail-wm1-x32c.google.com with SMTP id l3-20020a05600c1d0300b0038ff89c938bso3652828wms.0 for ; Thu, 21 Apr 2022 04:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=0h0Rvkwm6rsblcwsPxp9qPIXdkCkI7ax30Wxe1BZzVA=; b=CD/PiLoAr/lGQjPW0dqR/2R2juPclgbDVak4cLQiRUjqQ/5vCVCTvKkmGkeEmvSE29 slbDICrAhwPWWS17KAJ7dowZUgn5WSpHom2bfNXsC3GbRZB4d7P2Hyc5V3S1ur0vlqrx 3wkygZudbmxaYHZMj1s6alU9xZxVaZ5mleFXWAVHYQdKcYXvU5j4GRf70qEwO0wrSV+z ivFnCcZlmgr7ox95yRNOmT1BbHjF32KjRavsEZTKVyWRF67e9fLNbnxpwdqc849ZI6Co H8MlmNoiFLgaTqoC00516t3RMSRbAwj5TbElanon7Ykt+6G+Kx/XHBU979Og/jko5TPZ NfmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0h0Rvkwm6rsblcwsPxp9qPIXdkCkI7ax30Wxe1BZzVA=; b=7VV8vzvW3iJxILKUOvJcOzkSocZV9k0SrCt2DovYQkusf2NsoaKMRpOWRytUPwxKR7 YeUY2j+EoOeOSem1Ybqrjk85CYBQl0bvCDOp9NTO8aIgzBP0id26URxoCd49/4IGEN9B JTGzYoHm3GRD5h4FiNwEFg7hxuj6l1u342rQHBxsY29DJa1OzaKPpAn1JcP929Sg6/fr Okb4KM27NH0jK6svnR6eEv8vfPSwddCpnXfSi01SuL4ubhcNxgD0vPtwZxhyG+JOxUcC GwyXef5jt5x3Cm6jcehoKcDmjyEtKMSp2q65QshVF0zcsQuVHrGxCCmG/7zQ7wI3uOB/ dC0Q== X-Gm-Message-State: AOAM531EzfRrYZD9L3kwHA+P6R0MgxV2cllJDeErZ/+AxMXTxE3bRFWT wKu4l1bF2MnWjqT85sQFwlIYXuUAJv4+2Q== X-Received: by 2002:a05:600c:1456:b0:38e:bd55:700 with SMTP id h22-20020a05600c145600b0038ebd550700mr8006170wmi.204.1650539933965; Thu, 21 Apr 2022 04:18:53 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.18.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:18:53 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/31] hw/misc: Add a model of the Xilinx Versal CRL Date: Thu, 21 Apr 2022 12:18:21 +0100 Message-Id: <20220421111846.2011565-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" From: "Edgar E. Iglesias" Add a model of the Xilinx Versal CRL. Signed-off-by: Edgar E. Iglesias Reviewed-by: Frederic Konrad Reviewed-by: Francisco Iglesias Message-id: 20220406174303.2022038-4-edgar.iglesias@xilinx.com Signed-off-by: Peter Maydell --- include/hw/misc/xlnx-versal-crl.h | 235 +++++++++++++++++ hw/misc/xlnx-versal-crl.c | 421 ++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + 3 files changed, 657 insertions(+) create mode 100644 include/hw/misc/xlnx-versal-crl.h create mode 100644 hw/misc/xlnx-versal-crl.c diff --git a/include/hw/misc/xlnx-versal-crl.h b/include/hw/misc/xlnx-versal-crl.h new file mode 100644 index 00000000000..2857f4169a5 --- /dev/null +++ b/include/hw/misc/xlnx-versal-crl.h @@ -0,0 +1,235 @@ +/* + * QEMU model of the Clock-Reset-LPD (CRL). + * + * Copyright (c) 2022 Xilinx Inc. + * SPDX-License-Identifier: GPL-2.0-or-later + * + * Written by Edgar E. Iglesias + */ +#ifndef HW_MISC_XLNX_VERSAL_CRL_H +#define HW_MISC_XLNX_VERSAL_CRL_H + +#include "hw/sysbus.h" +#include "hw/register.h" +#include "target/arm/cpu.h" + +#define TYPE_XLNX_VERSAL_CRL "xlnx,versal-crl" +OBJECT_DECLARE_SIMPLE_TYPE(XlnxVersalCRL, XLNX_VERSAL_CRL) + +REG32(ERR_CTRL, 0x0) + FIELD(ERR_CTRL, SLVERR_ENABLE, 0, 1) +REG32(IR_STATUS, 0x4) + FIELD(IR_STATUS, ADDR_DECODE_ERR, 0, 1) +REG32(IR_MASK, 0x8) + FIELD(IR_MASK, ADDR_DECODE_ERR, 0, 1) +REG32(IR_ENABLE, 0xc) + FIELD(IR_ENABLE, ADDR_DECODE_ERR, 0, 1) +REG32(IR_DISABLE, 0x10) + FIELD(IR_DISABLE, ADDR_DECODE_ERR, 0, 1) +REG32(WPROT, 0x1c) + FIELD(WPROT, ACTIVE, 0, 1) +REG32(PLL_CLK_OTHER_DMN, 0x20) + FIELD(PLL_CLK_OTHER_DMN, APLL_BYPASS, 0, 1) +REG32(RPLL_CTRL, 0x40) + FIELD(RPLL_CTRL, POST_SRC, 24, 3) + FIELD(RPLL_CTRL, PRE_SRC, 20, 3) + FIELD(RPLL_CTRL, CLKOUTDIV, 16, 2) + FIELD(RPLL_CTRL, FBDIV, 8, 8) + FIELD(RPLL_CTRL, BYPASS, 3, 1) + FIELD(RPLL_CTRL, RESET, 0, 1) +REG32(RPLL_CFG, 0x44) + FIELD(RPLL_CFG, LOCK_DLY, 25, 7) + FIELD(RPLL_CFG, LOCK_CNT, 13, 10) + FIELD(RPLL_CFG, LFHF, 10, 2) + FIELD(RPLL_CFG, CP, 5, 4) + FIELD(RPLL_CFG, RES, 0, 4) +REG32(RPLL_FRAC_CFG, 0x48) + FIELD(RPLL_FRAC_CFG, ENABLED, 31, 1) + FIELD(RPLL_FRAC_CFG, SEED, 22, 3) + FIELD(RPLL_FRAC_CFG, ALGRTHM, 19, 1) + FIELD(RPLL_FRAC_CFG, ORDER, 18, 1) + FIELD(RPLL_FRAC_CFG, DATA, 0, 16) +REG32(PLL_STATUS, 0x50) + FIELD(PLL_STATUS, RPLL_STABLE, 2, 1) + FIELD(PLL_STATUS, RPLL_LOCK, 0, 1) +REG32(RPLL_TO_XPD_CTRL, 0x100) + FIELD(RPLL_TO_XPD_CTRL, CLKACT, 25, 1) + FIELD(RPLL_TO_XPD_CTRL, DIVISOR0, 8, 10) +REG32(LPD_TOP_SWITCH_CTRL, 0x104) + FIELD(LPD_TOP_SWITCH_CTRL, CLKACT_ADMA, 26, 1) + FIELD(LPD_TOP_SWITCH_CTRL, CLKACT, 25, 1) + FIELD(LPD_TOP_SWITCH_CTRL, DIVISOR0, 8, 10) + FIELD(LPD_TOP_SWITCH_CTRL, SRCSEL, 0, 3) +REG32(LPD_LSBUS_CTRL, 0x108) + FIELD(LPD_LSBUS_CTRL, CLKACT, 25, 1) + FIELD(LPD_LSBUS_CTRL, DIVISOR0, 8, 10) + FIELD(LPD_LSBUS_CTRL, SRCSEL, 0, 3) +REG32(CPU_R5_CTRL, 0x10c) + FIELD(CPU_R5_CTRL, CLKACT_OCM2, 28, 1) + FIELD(CPU_R5_CTRL, CLKACT_OCM, 27, 1) + FIELD(CPU_R5_CTRL, CLKACT_CORE, 26, 1) + FIELD(CPU_R5_CTRL, CLKACT, 25, 1) + FIELD(CPU_R5_CTRL, DIVISOR0, 8, 10) + FIELD(CPU_R5_CTRL, SRCSEL, 0, 3) +REG32(IOU_SWITCH_CTRL, 0x114) + FIELD(IOU_SWITCH_CTRL, CLKACT, 25, 1) + FIELD(IOU_SWITCH_CTRL, DIVISOR0, 8, 10) + FIELD(IOU_SWITCH_CTRL, SRCSEL, 0, 3) +REG32(GEM0_REF_CTRL, 0x118) + FIELD(GEM0_REF_CTRL, CLKACT_RX, 27, 1) + FIELD(GEM0_REF_CTRL, CLKACT_TX, 26, 1) + FIELD(GEM0_REF_CTRL, CLKACT, 25, 1) + FIELD(GEM0_REF_CTRL, DIVISOR0, 8, 10) + FIELD(GEM0_REF_CTRL, SRCSEL, 0, 3) +REG32(GEM1_REF_CTRL, 0x11c) + FIELD(GEM1_REF_CTRL, CLKACT_RX, 27, 1) + FIELD(GEM1_REF_CTRL, CLKACT_TX, 26, 1) + FIELD(GEM1_REF_CTRL, CLKACT, 25, 1) + FIELD(GEM1_REF_CTRL, DIVISOR0, 8, 10) + FIELD(GEM1_REF_CTRL, SRCSEL, 0, 3) +REG32(GEM_TSU_REF_CTRL, 0x120) + FIELD(GEM_TSU_REF_CTRL, CLKACT, 25, 1) + FIELD(GEM_TSU_REF_CTRL, DIVISOR0, 8, 10) + FIELD(GEM_TSU_REF_CTRL, SRCSEL, 0, 3) +REG32(USB0_BUS_REF_CTRL, 0x124) + FIELD(USB0_BUS_REF_CTRL, CLKACT, 25, 1) + FIELD(USB0_BUS_REF_CTRL, DIVISOR0, 8, 10) + FIELD(USB0_BUS_REF_CTRL, SRCSEL, 0, 3) +REG32(UART0_REF_CTRL, 0x128) + FIELD(UART0_REF_CTRL, CLKACT, 25, 1) + FIELD(UART0_REF_CTRL, DIVISOR0, 8, 10) + FIELD(UART0_REF_CTRL, SRCSEL, 0, 3) +REG32(UART1_REF_CTRL, 0x12c) + FIELD(UART1_REF_CTRL, CLKACT, 25, 1) + FIELD(UART1_REF_CTRL, DIVISOR0, 8, 10) + FIELD(UART1_REF_CTRL, SRCSEL, 0, 3) +REG32(SPI0_REF_CTRL, 0x130) + FIELD(SPI0_REF_CTRL, CLKACT, 25, 1) + FIELD(SPI0_REF_CTRL, DIVISOR0, 8, 10) + FIELD(SPI0_REF_CTRL, SRCSEL, 0, 3) +REG32(SPI1_REF_CTRL, 0x134) + FIELD(SPI1_REF_CTRL, CLKACT, 25, 1) + FIELD(SPI1_REF_CTRL, DIVISOR0, 8, 10) + FIELD(SPI1_REF_CTRL, SRCSEL, 0, 3) +REG32(CAN0_REF_CTRL, 0x138) + FIELD(CAN0_REF_CTRL, CLKACT, 25, 1) + FIELD(CAN0_REF_CTRL, DIVISOR0, 8, 10) + FIELD(CAN0_REF_CTRL, SRCSEL, 0, 3) +REG32(CAN1_REF_CTRL, 0x13c) + FIELD(CAN1_REF_CTRL, CLKACT, 25, 1) + FIELD(CAN1_REF_CTRL, DIVISOR0, 8, 10) + FIELD(CAN1_REF_CTRL, SRCSEL, 0, 3) +REG32(I2C0_REF_CTRL, 0x140) + FIELD(I2C0_REF_CTRL, CLKACT, 25, 1) + FIELD(I2C0_REF_CTRL, DIVISOR0, 8, 10) + FIELD(I2C0_REF_CTRL, SRCSEL, 0, 3) +REG32(I2C1_REF_CTRL, 0x144) + FIELD(I2C1_REF_CTRL, CLKACT, 25, 1) + FIELD(I2C1_REF_CTRL, DIVISOR0, 8, 10) + FIELD(I2C1_REF_CTRL, SRCSEL, 0, 3) +REG32(DBG_LPD_CTRL, 0x148) + FIELD(DBG_LPD_CTRL, CLKACT, 25, 1) + FIELD(DBG_LPD_CTRL, DIVISOR0, 8, 10) + FIELD(DBG_LPD_CTRL, SRCSEL, 0, 3) +REG32(TIMESTAMP_REF_CTRL, 0x14c) + FIELD(TIMESTAMP_REF_CTRL, CLKACT, 25, 1) + FIELD(TIMESTAMP_REF_CTRL, DIVISOR0, 8, 10) + FIELD(TIMESTAMP_REF_CTRL, SRCSEL, 0, 3) +REG32(CRL_SAFETY_CHK, 0x150) +REG32(PSM_REF_CTRL, 0x154) + FIELD(PSM_REF_CTRL, DIVISOR0, 8, 10) + FIELD(PSM_REF_CTRL, SRCSEL, 0, 3) +REG32(DBG_TSTMP_CTRL, 0x158) + FIELD(DBG_TSTMP_CTRL, CLKACT, 25, 1) + FIELD(DBG_TSTMP_CTRL, DIVISOR0, 8, 10) + FIELD(DBG_TSTMP_CTRL, SRCSEL, 0, 3) +REG32(CPM_TOPSW_REF_CTRL, 0x15c) + FIELD(CPM_TOPSW_REF_CTRL, CLKACT, 25, 1) + FIELD(CPM_TOPSW_REF_CTRL, DIVISOR0, 8, 10) + FIELD(CPM_TOPSW_REF_CTRL, SRCSEL, 0, 3) +REG32(USB3_DUAL_REF_CTRL, 0x160) + FIELD(USB3_DUAL_REF_CTRL, CLKACT, 25, 1) + FIELD(USB3_DUAL_REF_CTRL, DIVISOR0, 8, 10) + FIELD(USB3_DUAL_REF_CTRL, SRCSEL, 0, 3) +REG32(RST_CPU_R5, 0x300) + FIELD(RST_CPU_R5, RESET_PGE, 4, 1) + FIELD(RST_CPU_R5, RESET_AMBA, 2, 1) + FIELD(RST_CPU_R5, RESET_CPU1, 1, 1) + FIELD(RST_CPU_R5, RESET_CPU0, 0, 1) +REG32(RST_ADMA, 0x304) + FIELD(RST_ADMA, RESET, 0, 1) +REG32(RST_GEM0, 0x308) + FIELD(RST_GEM0, RESET, 0, 1) +REG32(RST_GEM1, 0x30c) + FIELD(RST_GEM1, RESET, 0, 1) +REG32(RST_SPARE, 0x310) + FIELD(RST_SPARE, RESET, 0, 1) +REG32(RST_USB0, 0x314) + FIELD(RST_USB0, RESET, 0, 1) +REG32(RST_UART0, 0x318) + FIELD(RST_UART0, RESET, 0, 1) +REG32(RST_UART1, 0x31c) + FIELD(RST_UART1, RESET, 0, 1) +REG32(RST_SPI0, 0x320) + FIELD(RST_SPI0, RESET, 0, 1) +REG32(RST_SPI1, 0x324) + FIELD(RST_SPI1, RESET, 0, 1) +REG32(RST_CAN0, 0x328) + FIELD(RST_CAN0, RESET, 0, 1) +REG32(RST_CAN1, 0x32c) + FIELD(RST_CAN1, RESET, 0, 1) +REG32(RST_I2C0, 0x330) + FIELD(RST_I2C0, RESET, 0, 1) +REG32(RST_I2C1, 0x334) + FIELD(RST_I2C1, RESET, 0, 1) +REG32(RST_DBG_LPD, 0x338) + FIELD(RST_DBG_LPD, RPU_DBG1_RESET, 5, 1) + FIELD(RST_DBG_LPD, RPU_DBG0_RESET, 4, 1) + FIELD(RST_DBG_LPD, RESET_HSDP, 1, 1) + FIELD(RST_DBG_LPD, RESET, 0, 1) +REG32(RST_GPIO, 0x33c) + FIELD(RST_GPIO, RESET, 0, 1) +REG32(RST_TTC, 0x344) + FIELD(RST_TTC, TTC3_RESET, 3, 1) + FIELD(RST_TTC, TTC2_RESET, 2, 1) + FIELD(RST_TTC, TTC1_RESET, 1, 1) + FIELD(RST_TTC, TTC0_RESET, 0, 1) +REG32(RST_TIMESTAMP, 0x348) + FIELD(RST_TIMESTAMP, RESET, 0, 1) +REG32(RST_SWDT, 0x34c) + FIELD(RST_SWDT, RESET, 0, 1) +REG32(RST_OCM, 0x350) + FIELD(RST_OCM, RESET, 0, 1) +REG32(RST_IPI, 0x354) + FIELD(RST_IPI, RESET, 0, 1) +REG32(RST_SYSMON, 0x358) + FIELD(RST_SYSMON, SEQ_RST, 1, 1) + FIELD(RST_SYSMON, CFG_RST, 0, 1) +REG32(RST_FPD, 0x360) + FIELD(RST_FPD, SRST, 1, 1) + FIELD(RST_FPD, POR, 0, 1) +REG32(PSM_RST_MODE, 0x370) + FIELD(PSM_RST_MODE, WAKEUP, 2, 1) + FIELD(PSM_RST_MODE, RST_MODE, 0, 2) + +#define CRL_R_MAX (R_PSM_RST_MODE + 1) + +#define RPU_MAX_CPU 2 + +struct XlnxVersalCRL { + SysBusDevice parent_obj; + qemu_irq irq; + + struct { + ARMCPU *cpu_r5[RPU_MAX_CPU]; + DeviceState *adma[8]; + DeviceState *uart[2]; + DeviceState *gem[2]; + DeviceState *usb; + } cfg; + + RegisterInfoArray *reg_array; + uint32_t regs[CRL_R_MAX]; + RegisterInfo regs_info[CRL_R_MAX]; +}; +#endif diff --git a/hw/misc/xlnx-versal-crl.c b/hw/misc/xlnx-versal-crl.c new file mode 100644 index 00000000000..767106b7a30 --- /dev/null +++ b/hw/misc/xlnx-versal-crl.c @@ -0,0 +1,421 @@ +/* + * QEMU model of the Clock-Reset-LPD (CRL). + * + * Copyright (c) 2022 Advanced Micro Devices, Inc. + * SPDX-License-Identifier: GPL-2.0-or-later + * + * Written by Edgar E. Iglesias + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu/log.h" +#include "qemu/bitops.h" +#include "migration/vmstate.h" +#include "hw/qdev-properties.h" +#include "hw/sysbus.h" +#include "hw/irq.h" +#include "hw/register.h" +#include "hw/resettable.h" + +#include "target/arm/arm-powerctl.h" +#include "hw/misc/xlnx-versal-crl.h" + +#ifndef XLNX_VERSAL_CRL_ERR_DEBUG +#define XLNX_VERSAL_CRL_ERR_DEBUG 0 +#endif + +static void crl_update_irq(XlnxVersalCRL *s) +{ + bool pending = s->regs[R_IR_STATUS] & ~s->regs[R_IR_MASK]; + qemu_set_irq(s->irq, pending); +} + +static void crl_status_postw(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque); + crl_update_irq(s); +} + +static uint64_t crl_enable_prew(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque); + uint32_t val = val64; + + s->regs[R_IR_MASK] &= ~val; + crl_update_irq(s); + return 0; +} + +static uint64_t crl_disable_prew(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque); + uint32_t val = val64; + + s->regs[R_IR_MASK] |= val; + crl_update_irq(s); + return 0; +} + +static void crl_reset_dev(XlnxVersalCRL *s, DeviceState *dev, + bool rst_old, bool rst_new) +{ + device_cold_reset(dev); +} + +static void crl_reset_cpu(XlnxVersalCRL *s, ARMCPU *armcpu, + bool rst_old, bool rst_new) +{ + if (rst_new) { + arm_set_cpu_off(armcpu->mp_affinity); + } else { + arm_set_cpu_on_and_reset(armcpu->mp_affinity); + } +} + +#define REGFIELD_RESET(type, s, reg, f, new_val, dev) { \ + bool old_f = ARRAY_FIELD_EX32((s)->regs, reg, f); \ + bool new_f = FIELD_EX32(new_val, reg, f); \ + \ + /* Detect edges. */ \ + if (dev && old_f != new_f) { \ + crl_reset_ ## type(s, dev, old_f, new_f); \ + } \ +} + +static uint64_t crl_rst_r5_prew(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque); + + REGFIELD_RESET(cpu, s, RST_CPU_R5, RESET_CPU0, val64, s->cfg.cpu_r5[0]); + REGFIELD_RESET(cpu, s, RST_CPU_R5, RESET_CPU1, val64, s->cfg.cpu_r5[1]); + return val64; +} + +static uint64_t crl_rst_adma_prew(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque); + int i; + + /* A single register fans out to all ADMA reset inputs. */ + for (i = 0; i < ARRAY_SIZE(s->cfg.adma); i++) { + REGFIELD_RESET(dev, s, RST_ADMA, RESET, val64, s->cfg.adma[i]); + } + return val64; +} + +static uint64_t crl_rst_uart0_prew(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque); + + REGFIELD_RESET(dev, s, RST_UART0, RESET, val64, s->cfg.uart[0]); + return val64; +} + +static uint64_t crl_rst_uart1_prew(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque); + + REGFIELD_RESET(dev, s, RST_UART1, RESET, val64, s->cfg.uart[1]); + return val64; +} + +static uint64_t crl_rst_gem0_prew(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque); + + REGFIELD_RESET(dev, s, RST_GEM0, RESET, val64, s->cfg.gem[0]); + return val64; +} + +static uint64_t crl_rst_gem1_prew(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque); + + REGFIELD_RESET(dev, s, RST_GEM1, RESET, val64, s->cfg.gem[1]); + return val64; +} + +static uint64_t crl_rst_usb_prew(RegisterInfo *reg, uint64_t val64) +{ + XlnxVersalCRL *s = XLNX_VERSAL_CRL(reg->opaque); + + REGFIELD_RESET(dev, s, RST_USB0, RESET, val64, s->cfg.usb); + return val64; +} + +static const RegisterAccessInfo crl_regs_info[] = { + { .name = "ERR_CTRL", .addr = A_ERR_CTRL, + },{ .name = "IR_STATUS", .addr = A_IR_STATUS, + .w1c = 0x1, + .post_write = crl_status_postw, + },{ .name = "IR_MASK", .addr = A_IR_MASK, + .reset = 0x1, + .ro = 0x1, + },{ .name = "IR_ENABLE", .addr = A_IR_ENABLE, + .pre_write = crl_enable_prew, + },{ .name = "IR_DISABLE", .addr = A_IR_DISABLE, + .pre_write = crl_disable_prew, + },{ .name = "WPROT", .addr = A_WPROT, + },{ .name = "PLL_CLK_OTHER_DMN", .addr = A_PLL_CLK_OTHER_DMN, + .reset = 0x1, + .rsvd = 0xe, + },{ .name = "RPLL_CTRL", .addr = A_RPLL_CTRL, + .reset = 0x24809, + .rsvd = 0xf88c00f6, + },{ .name = "RPLL_CFG", .addr = A_RPLL_CFG, + .reset = 0x2000000, + .rsvd = 0x1801210, + },{ .name = "RPLL_FRAC_CFG", .addr = A_RPLL_FRAC_CFG, + .rsvd = 0x7e330000, + },{ .name = "PLL_STATUS", .addr = A_PLL_STATUS, + .reset = R_PLL_STATUS_RPLL_STABLE_MASK | + R_PLL_STATUS_RPLL_LOCK_MASK, + .rsvd = 0xfa, + .ro = 0x5, + },{ .name = "RPLL_TO_XPD_CTRL", .addr = A_RPLL_TO_XPD_CTRL, + .reset = 0x2000100, + .rsvd = 0xfdfc00ff, + },{ .name = "LPD_TOP_SWITCH_CTRL", .addr = A_LPD_TOP_SWITCH_CTRL, + .reset = 0x6000300, + .rsvd = 0xf9fc00f8, + },{ .name = "LPD_LSBUS_CTRL", .addr = A_LPD_LSBUS_CTRL, + .reset = 0x2000800, + .rsvd = 0xfdfc00f8, + },{ .name = "CPU_R5_CTRL", .addr = A_CPU_R5_CTRL, + .reset = 0xe000300, + .rsvd = 0xe1fc00f8, + },{ .name = "IOU_SWITCH_CTRL", .addr = A_IOU_SWITCH_CTRL, + .reset = 0x2000500, + .rsvd = 0xfdfc00f8, + },{ .name = "GEM0_REF_CTRL", .addr = A_GEM0_REF_CTRL, + .reset = 0xe000a00, + .rsvd = 0xf1fc00f8, + },{ .name = "GEM1_REF_CTRL", .addr = A_GEM1_REF_CTRL, + .reset = 0xe000a00, + .rsvd = 0xf1fc00f8, + },{ .name = "GEM_TSU_REF_CTRL", .addr = A_GEM_TSU_REF_CTRL, + .reset = 0x300, + .rsvd = 0xfdfc00f8, + },{ .name = "USB0_BUS_REF_CTRL", .addr = A_USB0_BUS_REF_CTRL, + .reset = 0x2001900, + .rsvd = 0xfdfc00f8, + },{ .name = "UART0_REF_CTRL", .addr = A_UART0_REF_CTRL, + .reset = 0xc00, + .rsvd = 0xfdfc00f8, + },{ .name = "UART1_REF_CTRL", .addr = A_UART1_REF_CTRL, + .reset = 0xc00, + .rsvd = 0xfdfc00f8, + },{ .name = "SPI0_REF_CTRL", .addr = A_SPI0_REF_CTRL, + .reset = 0x600, + .rsvd = 0xfdfc00f8, + },{ .name = "SPI1_REF_CTRL", .addr = A_SPI1_REF_CTRL, + .reset = 0x600, + .rsvd = 0xfdfc00f8, + },{ .name = "CAN0_REF_CTRL", .addr = A_CAN0_REF_CTRL, + .reset = 0xc00, + .rsvd = 0xfdfc00f8, + },{ .name = "CAN1_REF_CTRL", .addr = A_CAN1_REF_CTRL, + .reset = 0xc00, + .rsvd = 0xfdfc00f8, + },{ .name = "I2C0_REF_CTRL", .addr = A_I2C0_REF_CTRL, + .reset = 0xc00, + .rsvd = 0xfdfc00f8, + },{ .name = "I2C1_REF_CTRL", .addr = A_I2C1_REF_CTRL, + .reset = 0xc00, + .rsvd = 0xfdfc00f8, + },{ .name = "DBG_LPD_CTRL", .addr = A_DBG_LPD_CTRL, + .reset = 0x300, + .rsvd = 0xfdfc00f8, + },{ .name = "TIMESTAMP_REF_CTRL", .addr = A_TIMESTAMP_REF_CTRL, + .reset = 0x2000c00, + .rsvd = 0xfdfc00f8, + },{ .name = "CRL_SAFETY_CHK", .addr = A_CRL_SAFETY_CHK, + },{ .name = "PSM_REF_CTRL", .addr = A_PSM_REF_CTRL, + .reset = 0xf04, + .rsvd = 0xfffc00f8, + },{ .name = "DBG_TSTMP_CTRL", .addr = A_DBG_TSTMP_CTRL, + .reset = 0x300, + .rsvd = 0xfdfc00f8, + },{ .name = "CPM_TOPSW_REF_CTRL", .addr = A_CPM_TOPSW_REF_CTRL, + .reset = 0x300, + .rsvd = 0xfdfc00f8, + },{ .name = "USB3_DUAL_REF_CTRL", .addr = A_USB3_DUAL_REF_CTRL, + .reset = 0x3c00, + .rsvd = 0xfdfc00f8, + },{ .name = "RST_CPU_R5", .addr = A_RST_CPU_R5, + .reset = 0x17, + .rsvd = 0x8, + .pre_write = crl_rst_r5_prew, + },{ .name = "RST_ADMA", .addr = A_RST_ADMA, + .reset = 0x1, + .pre_write = crl_rst_adma_prew, + },{ .name = "RST_GEM0", .addr = A_RST_GEM0, + .reset = 0x1, + .pre_write = crl_rst_gem0_prew, + },{ .name = "RST_GEM1", .addr = A_RST_GEM1, + .reset = 0x1, + .pre_write = crl_rst_gem1_prew, + },{ .name = "RST_SPARE", .addr = A_RST_SPARE, + .reset = 0x1, + },{ .name = "RST_USB0", .addr = A_RST_USB0, + .reset = 0x1, + .pre_write = crl_rst_usb_prew, + },{ .name = "RST_UART0", .addr = A_RST_UART0, + .reset = 0x1, + .pre_write = crl_rst_uart0_prew, + },{ .name = "RST_UART1", .addr = A_RST_UART1, + .reset = 0x1, + .pre_write = crl_rst_uart1_prew, + },{ .name = "RST_SPI0", .addr = A_RST_SPI0, + .reset = 0x1, + },{ .name = "RST_SPI1", .addr = A_RST_SPI1, + .reset = 0x1, + },{ .name = "RST_CAN0", .addr = A_RST_CAN0, + .reset = 0x1, + },{ .name = "RST_CAN1", .addr = A_RST_CAN1, + .reset = 0x1, + },{ .name = "RST_I2C0", .addr = A_RST_I2C0, + .reset = 0x1, + },{ .name = "RST_I2C1", .addr = A_RST_I2C1, + .reset = 0x1, + },{ .name = "RST_DBG_LPD", .addr = A_RST_DBG_LPD, + .reset = 0x33, + .rsvd = 0xcc, + },{ .name = "RST_GPIO", .addr = A_RST_GPIO, + .reset = 0x1, + },{ .name = "RST_TTC", .addr = A_RST_TTC, + .reset = 0xf, + },{ .name = "RST_TIMESTAMP", .addr = A_RST_TIMESTAMP, + .reset = 0x1, + },{ .name = "RST_SWDT", .addr = A_RST_SWDT, + .reset = 0x1, + },{ .name = "RST_OCM", .addr = A_RST_OCM, + },{ .name = "RST_IPI", .addr = A_RST_IPI, + },{ .name = "RST_FPD", .addr = A_RST_FPD, + .reset = 0x3, + },{ .name = "PSM_RST_MODE", .addr = A_PSM_RST_MODE, + .reset = 0x1, + .rsvd = 0xf8, + } +}; + +static void crl_reset_enter(Object *obj, ResetType type) +{ + XlnxVersalCRL *s = XLNX_VERSAL_CRL(obj); + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(s->regs_info); ++i) { + register_reset(&s->regs_info[i]); + } +} + +static void crl_reset_hold(Object *obj) +{ + XlnxVersalCRL *s = XLNX_VERSAL_CRL(obj); + + crl_update_irq(s); +} + +static const MemoryRegionOps crl_ops = { + .read = register_read_memory, + .write = register_write_memory, + .endianness = DEVICE_LITTLE_ENDIAN, + .valid = { + .min_access_size = 4, + .max_access_size = 4, + }, +}; + +static void crl_init(Object *obj) +{ + XlnxVersalCRL *s = XLNX_VERSAL_CRL(obj); + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); + int i; + + s->reg_array = + register_init_block32(DEVICE(obj), crl_regs_info, + ARRAY_SIZE(crl_regs_info), + s->regs_info, s->regs, + &crl_ops, + XLNX_VERSAL_CRL_ERR_DEBUG, + CRL_R_MAX * 4); + sysbus_init_mmio(sbd, &s->reg_array->mem); + sysbus_init_irq(sbd, &s->irq); + + for (i = 0; i < ARRAY_SIZE(s->cfg.cpu_r5); ++i) { + object_property_add_link(obj, "cpu_r5[*]", TYPE_ARM_CPU, + (Object **)&s->cfg.cpu_r5[i], + qdev_prop_allow_set_link_before_realize, + OBJ_PROP_LINK_STRONG); + } + + for (i = 0; i < ARRAY_SIZE(s->cfg.adma); ++i) { + object_property_add_link(obj, "adma[*]", TYPE_DEVICE, + (Object **)&s->cfg.adma[i], + qdev_prop_allow_set_link_before_realize, + OBJ_PROP_LINK_STRONG); + } + + for (i = 0; i < ARRAY_SIZE(s->cfg.uart); ++i) { + object_property_add_link(obj, "uart[*]", TYPE_DEVICE, + (Object **)&s->cfg.uart[i], + qdev_prop_allow_set_link_before_realize, + OBJ_PROP_LINK_STRONG); + } + + for (i = 0; i < ARRAY_SIZE(s->cfg.gem); ++i) { + object_property_add_link(obj, "gem[*]", TYPE_DEVICE, + (Object **)&s->cfg.gem[i], + qdev_prop_allow_set_link_before_realize, + OBJ_PROP_LINK_STRONG); + } + + object_property_add_link(obj, "usb", TYPE_DEVICE, + (Object **)&s->cfg.gem[i], + qdev_prop_allow_set_link_before_realize, + OBJ_PROP_LINK_STRONG); +} + +static void crl_finalize(Object *obj) +{ + XlnxVersalCRL *s = XLNX_VERSAL_CRL(obj); + register_finalize_block(s->reg_array); +} + +static const VMStateDescription vmstate_crl = { + .name = TYPE_XLNX_VERSAL_CRL, + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT32_ARRAY(regs, XlnxVersalCRL, CRL_R_MAX), + VMSTATE_END_OF_LIST(), + } +}; + +static void crl_class_init(ObjectClass *klass, void *data) +{ + ResettableClass *rc = RESETTABLE_CLASS(klass); + DeviceClass *dc = DEVICE_CLASS(klass); + + dc->vmsd = &vmstate_crl; + + rc->phases.enter = crl_reset_enter; + rc->phases.hold = crl_reset_hold; +} + +static const TypeInfo crl_info = { + .name = TYPE_XLNX_VERSAL_CRL, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(XlnxVersalCRL), + .class_init = crl_class_init, + .instance_init = crl_init, + .instance_finalize = crl_finalize, +}; + +static void crl_register_types(void) +{ + type_register_static(&crl_info); +} + +type_init(crl_register_types) diff --git a/hw/misc/meson.build b/hw/misc/meson.build index 6fb69612e06..2ff05c7afa9 100644 --- a/hw/misc/meson.build +++ b/hw/misc/meson.build @@ -86,6 +86,7 @@ softmmu_ss.add(when: 'CONFIG_SLAVIO', if_true: files('slavio_misc.c')) softmmu_ss.add(when: 'CONFIG_ZYNQ', if_true: files('zynq_slcr.c')) specific_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-crf.c')) specific_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-apu-ctrl.c')) +specific_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal-crl.c')) softmmu_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files( 'xlnx-versal-xramc.c', 'xlnx-versal-pmc-iou-slcr.c', From patchwork Thu Apr 21 11:18:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564325 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp349804map; Thu, 21 Apr 2022 04:33:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2d5r1Noz4732SmNk9fYuxSmLSVpm0YPnBbbK1oyNkkzoUDrDerBZGsPjk4vYMdbT+1BLL X-Received: by 2002:ac8:57c7:0:b0:2f1:f7d4:9c1f with SMTP id w7-20020ac857c7000000b002f1f7d49c1fmr15557013qta.81.1650540818594; Thu, 21 Apr 2022 04:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540818; cv=none; d=google.com; s=arc-20160816; b=W6qRbzCpz8aAgy5MN2CSg3HDVfHO8p6D5EiKx06KEo6G5BqrHfrnpAVI7We7RZkMER zuxjmZqjochviJrb8ys2wxUuVTCQs/Rixnjbv4/oY9KUxCPTtScV1fUG5xiDwd4KSN2L wIWFyThpb8GqPfnVRXwZZJc0zSSwwFhnG13ifEOnYLGx8ovSE0Ci5d/Uv9pII/YHk9YC UtytYqF77v6dL+mM/mfJ7SN47g1Ctj5rE+HRcOw6QfFnFloNPAV5WI1TESemKA2aD5xd ztWq1nIdHHQI14P4CnUZMSlhe9m8qo38ktD3gm7FHhUuVKaBkVypCT5MFpA2qS/Fsl0S FWYw== 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=ReWbTkMl4DXESP2NpUgeKJbFF10+7aoUcCCjIOL5Pg0=; b=qRd/9wPpH72orfxEatMYkg6FMKDbDlPy9qltE1zBnuEohKsIk0tFemVEiGyKh4EDak /GWjJ3SOIYHjQc0UL3Uh6u3leuCS6GI/qY0gNnztXfz2L+M92DAEJCPCXad+y/Dq7pVT OXhikmftSY6PYCyuyfe5ayz5sjPdxSRE5vrNmVcstgO15Q0iSO3yTbdTYGm9D7g2xsez VgfIjZlqOtlJtiNUsOtYTTLDmyg/7ea6xv2XzIiYfTFWVxCgwlN9RnOsR0SShlXmHFLp SeotT+q9E83a/DAoM9n/1gu/FQxnw0VYEl9nZcJqMhw40xgwWKf8f47Yg6Oig477KZDD dKGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cnXwucAX; 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 bs7-20020a05620a470700b0069f09b96cbesi101533qkb.740.2022.04.21.04.33.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:33:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cnXwucAX; 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]:56120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhV46-0005er-5f for patch@linaro.org; Thu, 21 Apr 2022 07:33:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUpv-0002vR-2h for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:59 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:39583) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUps-0003Sb-6Y for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:58 -0400 Received: by mail-wr1-x432.google.com with SMTP id m14so6214439wrb.6 for ; Thu, 21 Apr 2022 04:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ReWbTkMl4DXESP2NpUgeKJbFF10+7aoUcCCjIOL5Pg0=; b=cnXwucAX4ita/RXYBwOjjTX1ucS1P+1bWQByMWzDSrnjqWGFPedrryYLAbm985FRjL MQNoahUKBKUKVDIEfobInWrcfVnAf2L5g7Fxs+48/7Ve6mDZvdYaAZmdUkksYjYONxt8 MlHvDEliVM0kqU2P+kEqx0RSmHHcZ1y0wTBlNYRl7T3+CAvVJKJwJtiyweDUJyRbZN8I rVTpaKUTPymYV9m5YFxw30VXciVj4aDbrWeY4x53Joqb7L7MxtNmZHjeAiu/iCPksI4f aXoQ+sflE4f7cS+rN1lFDR3WPq6lztDwGHSFvEFTBX/XgR9LSANj47B305qAefCtJAfx UTYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ReWbTkMl4DXESP2NpUgeKJbFF10+7aoUcCCjIOL5Pg0=; b=lwU71gZmNQhcj9mFDCO6uGIq2Qd/GQ4USxSq0FSo4oyjPJDlueqqZOsJLgBkzBwl8O acsr2hq4s5/nVpRr2aLAMKCcEahscSyCjRfnUso29pRU/Jd62D+fATFs/KTC+rdLLlP8 uUN0paUQ6ZyRU17k29FajELj7MZzSSMLvjRloSYaO3IcxIw+itHkY2z1Z2nDsyenhSvl 8Y159IvFwRNGr/5BiIrHSg3Pqv4SyTORRarXRrflP1WstaJyxro39K45/mG92DZqxrUV NT5cjHeBJCRT+sO8g5yakUTGML9Q2FFcrTAPP/Lhm0ngc5SEMIadRlBu8JcrtDHjn7fz zRHw== X-Gm-Message-State: AOAM533YbCrtWMdHhENwiI/I8+pVRM038cNw4QEpOPH1DsFkqOiwa+RD 6S/dkEorBHudsFcXAqZvdGcGVyngBcYIZg== X-Received: by 2002:a05:6000:18c5:b0:207:ac0d:f32 with SMTP id w5-20020a05600018c500b00207ac0d0f32mr18555079wrq.574.1650539934888; Thu, 21 Apr 2022 04:18:54 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.18.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:18:54 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/31] hw/arm: versal: Connect the CRL Date: Thu, 21 Apr 2022 12:18:22 +0100 Message-Id: <20220421111846.2011565-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" From: "Edgar E. Iglesias" Connect the CRL (Clock Reset LPD) to the Versal SoC. Signed-off-by: Edgar E. Iglesias Reviewed-by: Frederic Konrad Reviewed-by: Francisco Iglesias Message-id: 20220406174303.2022038-5-edgar.iglesias@xilinx.com Signed-off-by: Peter Maydell --- include/hw/arm/xlnx-versal.h | 4 +++ hw/arm/xlnx-versal.c | 54 ++++++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h index 155e8c4b8cd..cbe8a19c10f 100644 --- a/include/hw/arm/xlnx-versal.h +++ b/include/hw/arm/xlnx-versal.h @@ -29,6 +29,7 @@ #include "hw/nvram/xlnx-versal-efuse.h" #include "hw/ssi/xlnx-versal-ospi.h" #include "hw/dma/xlnx_csu_dma.h" +#include "hw/misc/xlnx-versal-crl.h" #include "hw/misc/xlnx-versal-pmc-iou-slcr.h" #define TYPE_XLNX_VERSAL "xlnx-versal" @@ -87,6 +88,8 @@ struct Versal { qemu_or_irq irq_orgate; XlnxXramCtrl ctrl[XLNX_VERSAL_NR_XRAM]; } xram; + + XlnxVersalCRL crl; } lpd; /* The Platform Management Controller subsystem. */ @@ -127,6 +130,7 @@ struct Versal { #define VERSAL_TIMER_NS_EL1_IRQ 14 #define VERSAL_TIMER_NS_EL2_IRQ 10 +#define VERSAL_CRL_IRQ 10 #define VERSAL_UART0_IRQ_0 18 #define VERSAL_UART1_IRQ_0 19 #define VERSAL_USB0_IRQ_0 22 diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c index ebad8dbb6d8..57276e1506f 100644 --- a/hw/arm/xlnx-versal.c +++ b/hw/arm/xlnx-versal.c @@ -539,6 +539,57 @@ static void versal_create_ospi(Versal *s, qemu_irq *pic) qdev_connect_gpio_out(orgate, 0, pic[VERSAL_OSPI_IRQ]); } +static void versal_create_crl(Versal *s, qemu_irq *pic) +{ + SysBusDevice *sbd; + int i; + + object_initialize_child(OBJECT(s), "crl", &s->lpd.crl, + TYPE_XLNX_VERSAL_CRL); + sbd = SYS_BUS_DEVICE(&s->lpd.crl); + + for (i = 0; i < ARRAY_SIZE(s->lpd.rpu.cpu); i++) { + g_autofree gchar *name = g_strdup_printf("cpu_r5[%d]", i); + + object_property_set_link(OBJECT(&s->lpd.crl), + name, OBJECT(&s->lpd.rpu.cpu[i]), + &error_abort); + } + + for (i = 0; i < ARRAY_SIZE(s->lpd.iou.gem); i++) { + g_autofree gchar *name = g_strdup_printf("gem[%d]", i); + + object_property_set_link(OBJECT(&s->lpd.crl), + name, OBJECT(&s->lpd.iou.gem[i]), + &error_abort); + } + + for (i = 0; i < ARRAY_SIZE(s->lpd.iou.adma); i++) { + g_autofree gchar *name = g_strdup_printf("adma[%d]", i); + + object_property_set_link(OBJECT(&s->lpd.crl), + name, OBJECT(&s->lpd.iou.adma[i]), + &error_abort); + } + + for (i = 0; i < ARRAY_SIZE(s->lpd.iou.uart); i++) { + g_autofree gchar *name = g_strdup_printf("uart[%d]", i); + + object_property_set_link(OBJECT(&s->lpd.crl), + name, OBJECT(&s->lpd.iou.uart[i]), + &error_abort); + } + + object_property_set_link(OBJECT(&s->lpd.crl), + "usb", OBJECT(&s->lpd.iou.usb), + &error_abort); + + sysbus_realize(sbd, &error_fatal); + memory_region_add_subregion(&s->mr_ps, MM_CRL, + sysbus_mmio_get_region(sbd, 0)); + sysbus_connect_irq(sbd, 0, pic[VERSAL_CRL_IRQ]); +} + /* This takes the board allocated linear DDR memory and creates aliases * for each split DDR range/aperture on the Versal address map. */ @@ -622,8 +673,6 @@ static void versal_unimp(Versal *s) versal_unimp_area(s, "psm", &s->mr_ps, MM_PSM_START, MM_PSM_END - MM_PSM_START); - versal_unimp_area(s, "crl", &s->mr_ps, - MM_CRL, MM_CRL_SIZE); versal_unimp_area(s, "crf", &s->mr_ps, MM_FPD_CRF, MM_FPD_CRF_SIZE); versal_unimp_area(s, "apu", &s->mr_ps, @@ -681,6 +730,7 @@ static void versal_realize(DeviceState *dev, Error **errp) versal_create_efuse(s, pic); versal_create_pmc_iou_slcr(s, pic); versal_create_ospi(s, pic); + versal_create_crl(s, pic); versal_map_ddr(s); versal_unimp(s); From patchwork Thu Apr 21 11:18:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564318 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp343659map; Thu, 21 Apr 2022 04:24:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6VsTCeGImi9bQkVAz1IJq4a7vSumUPAaJE2xwH/kYzzCXSINi523z2b+Hqpa4Zt1CQkYD X-Received: by 2002:ac8:5ad1:0:b0:2f1:f29b:7371 with SMTP id d17-20020ac85ad1000000b002f1f29b7371mr16920037qtd.330.1650540296754; Thu, 21 Apr 2022 04:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540296; cv=none; d=google.com; s=arc-20160816; b=Wqr46ObiOOY0gwHRYbkXVs8wi03snbYbJuTBwm2h9uFNcWU/x/Wwf34TpGu9Ii2TXi da7KGKbsRB+APsutzFaDzrSMb7yurXOo0tNzuyz8gVsCOguVmITBjyHF1jxGIZVDpSry jR9wXx5cmkJ2h8Ouehusw88CDD5dtQEmpDIsvbtM94qj6MUnEb4ypZYWV6brHIEp7puy hhCc+Scie7TsDLtFYohztjOSzbG89ioJieD2k5pMRDj7ngS/468S1bPHbV6fE9x/1yZp P7Is8iAaUte5TNFTWDVXGVdFzXZQUfEg6907VSgEWazKuBF9ybSPSeIwlN4aJ4rPzi7b vinw== 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=QXsRoPUHqCo0IDRsRtZasRxyubwKd5nnuvujoVU4STM=; b=yB2Sa7qWEt5vDInXl4I+U0BrlKJo+lElbITyPTMwgA1vBKsKNuUvUqE1iRysitKJuY 1DZOD/0bflWVuoOojpsw+soExYwDUKrIJWy7cGjKcet56AmoeF5uWrhXAQ3GNWniXL4e x8C9NUHeRgl2BxNEt5LJwxmnWbdlihC55dFEIOK7E1lnWer0yi6RonVANzXsM6+9WX7I JOJVd1z2Cu3j3wYvHP9m/7X0Ls1exKSk51iJlP5liv23Z5T5tA9csHL8+hax54VkbsaE Xcz4lgpVXKYD/HEsH7NVjmyBOO4XLE+s82oyAid4I26YGITvWZh9y7BxZPCJvYqGqiDL NG2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t1uGfVXb; 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 de20-20020a05620a371400b0067e4be2385dsi1336565qkb.162.2022.04.21.04.24.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:24:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t1uGfVXb; 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]:39822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhUvg-00011N-AS for patch@linaro.org; Thu, 21 Apr 2022 07:24:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUpv-0002vU-3I for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:59 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:34772) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpt-0003Ss-4W for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:18:58 -0400 Received: by mail-wr1-x436.google.com with SMTP id c10so6234566wrb.1 for ; Thu, 21 Apr 2022 04:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=QXsRoPUHqCo0IDRsRtZasRxyubwKd5nnuvujoVU4STM=; b=t1uGfVXbk4R7suZ/3tVt3awik1AUZu3LlHN4XGUyFmWcNQU6Vkvro3ZJ+PQ15h0Ilx NcCyN2ET3I/7UzweVHFxRSAQbE9X9LBqmCU4nbCsjMW7igWsNK4ssmIVkH3MnMKUlMay YcBf1Bzq8OUyNjN6ei1744WxAygVHhVwQKeJ9aGcygUinjBhrrTgXZWNtwW4qHijuDky ZWx65f0lIDogvjhS2s3EE2XHdzt4G/G/DMYZxQayMjBrXALvBkdhLxZk/CV+EUG6ijsJ aaw25+v4ZBavga8VRSSKGJAeovrd5ezDWl7XiJmu5Hc2Ize9EF5+ibPt4B8A6GFLjx5Z 6eBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QXsRoPUHqCo0IDRsRtZasRxyubwKd5nnuvujoVU4STM=; b=ud4+buKoyG8rag1goBLiVVPAKAh/zRH7RKA7cilN8IPXzg1OYfQZBGqzGCeOCQpuGH 3D+PVUasJBD7g712u9lSDFclyora1FqMrjL/ePe1IElPXiKe1T7m3FP4EsBKEgXfXFM4 3zm4a6MOMJN9U30aT2QOK7Ycv5EKUj3Dg5Q0xVWQiVBDEB6I0mhyXHAFh+eaMGVPmgi/ 2CCetcT2Xz4V7gcVgqBJ5gv1O8a+cMTKI0ACDz3wInNDuTdo/ZQ0DfRi/9LtxDmtBCNv zkybQ6t9Qe0WO59gciWg3W0Ubhuoi28HDhGYc3/srh0vQLe3aULmH+zzHaz4xfTzncoG PUhA== X-Gm-Message-State: AOAM533ov0Egmz9dh69/2cvsUMpxuW9oyO1NWtA9AcRR8Faf+jfiZWmY cgRCxHEgd4pug2FGPTnw1KKWqZ3ELbjE8A== X-Received: by 2002:a5d:5005:0:b0:207:a7d7:ba4f with SMTP id e5-20020a5d5005000000b00207a7d7ba4fmr19148208wrt.163.1650539935722; Thu, 21 Apr 2022 04:18:55 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.18.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:18:55 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/31] hw/arm/exynos4210: Use TYPE_OR_IRQ instead of custom OR-gate device Date: Thu, 21 Apr 2022 12:18:23 +0100 Message-Id: <20220421111846.2011565-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" The Exynos4210 SoC device currently uses a custom device "exynos4210.irq_gate" to model the OR gate that feeds each CPU's IRQ line. We have a standard TYPE_OR_IRQ device for this now, so use that instead. (This is a migration compatibility break, but that is OK for this machine type.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-2-peter.maydell@linaro.org --- include/hw/arm/exynos4210.h | 1 + hw/arm/exynos4210.c | 31 ++++++++++++++++--------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index 60b9e126f55..3999034053e 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -102,6 +102,7 @@ struct Exynos4210State { MemoryRegion bootreg_mem; I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER]; qemu_or_irq pl330_irq_orgate[EXYNOS4210_NUM_DMA]; + qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS]; }; #define TYPE_EXYNOS4210_SOC "exynos4210" diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 0299e81f853..dfc0a4eec25 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -205,7 +205,6 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) { Exynos4210State *s = EXYNOS4210_SOC(socdev); MemoryRegion *system_mem = get_system_memory(); - qemu_irq gate_irq[EXYNOS4210_NCPUS][EXYNOS4210_IRQ_GATE_NINPUTS]; SysBusDevice *busdev; DeviceState *dev, *uart[4], *pl330[3]; int i, n; @@ -235,18 +234,13 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) /* IRQ Gate */ for (i = 0; i < EXYNOS4210_NCPUS; i++) { - dev = qdev_new("exynos4210.irq_gate"); - qdev_prop_set_uint32(dev, "n_in", EXYNOS4210_IRQ_GATE_NINPUTS); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - /* Get IRQ Gate input in gate_irq */ - for (n = 0; n < EXYNOS4210_IRQ_GATE_NINPUTS; n++) { - gate_irq[i][n] = qdev_get_gpio_in(dev, n); - } - busdev = SYS_BUS_DEVICE(dev); - - /* Connect IRQ Gate output to CPU's IRQ line */ - sysbus_connect_irq(busdev, 0, - qdev_get_gpio_in(DEVICE(s->cpu[i]), ARM_CPU_IRQ)); + DeviceState *orgate = DEVICE(&s->cpu_irq_orgate[i]); + object_property_set_int(OBJECT(orgate), "num-lines", + EXYNOS4210_IRQ_GATE_NINPUTS, + &error_abort); + qdev_realize(orgate, NULL, &error_abort); + qdev_connect_gpio_out(orgate, 0, + qdev_get_gpio_in(DEVICE(s->cpu[i]), ARM_CPU_IRQ)); } /* Private memory region and Internal GIC */ @@ -256,7 +250,8 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) sysbus_realize_and_unref(busdev, &error_fatal); sysbus_mmio_map(busdev, 0, EXYNOS4210_SMP_PRIVATE_BASE_ADDR); for (n = 0; n < EXYNOS4210_NCPUS; n++) { - sysbus_connect_irq(busdev, n, gate_irq[n][0]); + sysbus_connect_irq(busdev, n, + qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 0)); } for (n = 0; n < EXYNOS4210_INT_GIC_NIRQ; n++) { s->irqs.int_gic_irq[n] = qdev_get_gpio_in(dev, n); @@ -275,7 +270,8 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) /* Map Distributer interface */ sysbus_mmio_map(busdev, 1, EXYNOS4210_EXT_GIC_DIST_BASE_ADDR); for (n = 0; n < EXYNOS4210_NCPUS; n++) { - sysbus_connect_irq(busdev, n, gate_irq[n][1]); + sysbus_connect_irq(busdev, n, + qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 1)); } for (n = 0; n < EXYNOS4210_EXT_GIC_NIRQ; n++) { s->irqs.ext_gic_irq[n] = qdev_get_gpio_in(dev, n); @@ -488,6 +484,11 @@ static void exynos4210_init(Object *obj) object_initialize_child(obj, name, orgate, TYPE_OR_IRQ); g_free(name); } + + for (i = 0; i < ARRAY_SIZE(s->cpu_irq_orgate); i++) { + g_autofree char *name = g_strdup_printf("cpu-irq-orgate%d", i); + object_initialize_child(obj, name, &s->cpu_irq_orgate[i], TYPE_OR_IRQ); + } } static void exynos4210_class_init(ObjectClass *klass, void *data) From patchwork Thu Apr 21 11:18:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564324 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp346971map; Thu, 21 Apr 2022 04:30:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzngf8BudAuOEM6NrDwG733cOEFFSbBfYECU4o45D+18yG0tgWPURt98CT3qKtzFD7F6GYM X-Received: by 2002:a37:de0c:0:b0:69e:cd37:7646 with SMTP id h12-20020a37de0c000000b0069ecd377646mr6805424qkj.449.1650540610401; Thu, 21 Apr 2022 04:30:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540610; cv=none; d=google.com; s=arc-20160816; b=T4gy7NL6zv4vOHC2bQMs9GzP9Hg2ZKWiNn2W1BExrP8rpVuZGnt1n46iczxkEX56+4 gXz8L3bztWKG42FfE8/31nZ15PsaBpi73kVeZ86AFIjmUCsrr0vLp39CByjLhJ/mxmg8 mak4Evl9Jfhq/nVCUwzuk8FPnGS9aCqrTavuYkfU/uhHvgGAqnZHzzAL9L2FyQ5m0iwI KMwzxhyqhXh+dgXYinF9Zb3QjpTelfSo+s2I+NLx+pd7tME7KXVKf+BKyrvTztMFF5hi XaQn4D3LSj9BWXN15RSDeVLdNDz1g8t8/kYzDp/L30tTNUCiUK35Dr88JL1YPSJhiotj MaCg== 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=sDjN+WySih18ryXF6R3n9stfRQojyj640nNIa0UOxtI=; b=ZCniHkKV0wM/Gbs13RS5sKcE1XgaKdm7gs5Gi88uXCVGDvmDw0LyokG4g44oY6ZOrk jMSDiibKk0fL/DTDHov4CqVsNdoM9EFBWpcw3tu6Ax+liYxRbeX9eosd38Jy2C8EKgAC 7cVCCPssIxBK5v3UVPbGErTUMRvb84YDvW4kNQW95QQsx9eALFMJjuddqaB+j42yHKoD +vBhOs/VnsBcVMVdDzLiQVb8Xero7nUgqOLVvTvyhBj6ivrDqXriPmytM0IoRR2pOj2d Op038MQADEdyTObOoGR8+p9vkQJ5zUwy+v7OJ/cgQvtpv+C4oXZgSZgFgxeSDo+FHhKz F7oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B97bjf+P; 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 h13-20020ac87d4d000000b002e2161f2446si1409474qtb.172.2022.04.21.04.30.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:30:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B97bjf+P; 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]:50676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhV0j-0001HO-Uz for patch@linaro.org; Thu, 21 Apr 2022 07:30:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUpx-00030X-F9 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:01 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:43848) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpv-0003TJ-96 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:01 -0400 Received: by mail-wr1-x435.google.com with SMTP id g18so6190407wrb.10 for ; Thu, 21 Apr 2022 04:18:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=sDjN+WySih18ryXF6R3n9stfRQojyj640nNIa0UOxtI=; b=B97bjf+PebiFn+tJj+ywXJSHjx3y+nZBRVnRO8FJcyyp8PdLWH7EhiN/i+7F1ayvMY +rQBrSLnbzT1fJd6cAYSnQMqL6xqcTAHFW6+WacbPkIT5s91Pw/iHWy1hiZM8S3H5ErP YUgD1/Ldt9B2Y+gPkmDZS++vVODiFdyopD3VTQnLrJafF4yBRHxGbRf+2VCaMrN1NKT0 sPbVtJXCuEQbGWB5uif1IT3yGoYXY57PEo6RkSTTvvKnwRRBngI+Zcf1q8kin0HLlX7t oELm1ggZY1WmMfcl8zXWmtHVlnPbB7y4Zjmdx71RDkFjIIIPB9nWwemlfz7Am6FLCIfi 3qvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sDjN+WySih18ryXF6R3n9stfRQojyj640nNIa0UOxtI=; b=1ufueq6uYvvwWYRYwoLAEk9n7I1j8+aJQQ4fWcyfzE5fOmHJGMzGk1JEa4dLUSVuYT lyGhCm9ErfvqRcqVhZB6BEFHjxqSqNSHpCRopE0SYtJCzDyLdlmxSPQKNHjMhDOBP2B/ i2dRsAsX09YK+cswGwEbZN9JIz7ulzYnmS8gTAFh33dUljH5+Fp1m72CsFA1xwWDmPF+ AUktNJqA/RksE83HlYJOgEFM1StzYWky0/syM2MjY4j/clj3rVbdJAzv1zT4+zQN7d7w 2LixUrPDGKaMLsR6kqvmS9BEdqQ3MZX7D1i+WZy4HGotLRNBVZlrJMcAqqM5682/1mGq EoUw== X-Gm-Message-State: AOAM531QlQ2/5/DWiFVyncSNPcBiT91b18OPZ4e/mymycmpPbWW5uXLO 61ntyLY3TaXOtnNiK4+isk/leHeWwAJffg== X-Received: by 2002:a05:6000:16ce:b0:20a:88cf:c026 with SMTP id h14-20020a05600016ce00b0020a88cfc026mr18637549wrf.496.1650539936644; Thu, 21 Apr 2022 04:18:56 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.18.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:18:56 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/31] hw/intc/exynos4210_gic: Remove unused TYPE_EXYNOS4210_IRQ_GATE Date: Thu, 21 Apr 2022 12:18:24 +0100 Message-Id: <20220421111846.2011565-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" Now we have removed the only use of TYPE_EXYNOS4210_IRQ_GATE we can delete the device entirely. Signed-off-by: Peter Maydell Reviewed-by: Francisco Iglesias Message-id: 20220404154658.565020-3-peter.maydell@linaro.org --- hw/intc/exynos4210_gic.c | 107 --------------------------------------- 1 file changed, 107 deletions(-) diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c index bc73d1f1152..794f6b5ac72 100644 --- a/hw/intc/exynos4210_gic.c +++ b/hw/intc/exynos4210_gic.c @@ -373,110 +373,3 @@ static void exynos4210_gic_register_types(void) } type_init(exynos4210_gic_register_types) - -/* IRQ OR Gate struct. - * - * This device models an OR gate. There are n_in input qdev gpio lines and one - * output sysbus IRQ line. The output IRQ level is formed as OR between all - * gpio inputs. - */ - -#define TYPE_EXYNOS4210_IRQ_GATE "exynos4210.irq_gate" -OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210IRQGateState, EXYNOS4210_IRQ_GATE) - -struct Exynos4210IRQGateState { - SysBusDevice parent_obj; - - uint32_t n_in; /* inputs amount */ - uint32_t *level; /* input levels */ - qemu_irq out; /* output IRQ */ -}; - -static Property exynos4210_irq_gate_properties[] = { - DEFINE_PROP_UINT32("n_in", Exynos4210IRQGateState, n_in, 1), - DEFINE_PROP_END_OF_LIST(), -}; - -static const VMStateDescription vmstate_exynos4210_irq_gate = { - .name = "exynos4210.irq_gate", - .version_id = 2, - .minimum_version_id = 2, - .fields = (VMStateField[]) { - VMSTATE_VBUFFER_UINT32(level, Exynos4210IRQGateState, 1, NULL, n_in), - VMSTATE_END_OF_LIST() - } -}; - -/* Process a change in IRQ input. */ -static void exynos4210_irq_gate_handler(void *opaque, int irq, int level) -{ - Exynos4210IRQGateState *s = (Exynos4210IRQGateState *)opaque; - uint32_t i; - - assert(irq < s->n_in); - - s->level[irq] = level; - - for (i = 0; i < s->n_in; i++) { - if (s->level[i] >= 1) { - qemu_irq_raise(s->out); - return; - } - } - - qemu_irq_lower(s->out); -} - -static void exynos4210_irq_gate_reset(DeviceState *d) -{ - Exynos4210IRQGateState *s = EXYNOS4210_IRQ_GATE(d); - - memset(s->level, 0, s->n_in * sizeof(*s->level)); -} - -/* - * IRQ Gate initialization. - */ -static void exynos4210_irq_gate_init(Object *obj) -{ - Exynos4210IRQGateState *s = EXYNOS4210_IRQ_GATE(obj); - SysBusDevice *sbd = SYS_BUS_DEVICE(obj); - - sysbus_init_irq(sbd, &s->out); -} - -static void exynos4210_irq_gate_realize(DeviceState *dev, Error **errp) -{ - Exynos4210IRQGateState *s = EXYNOS4210_IRQ_GATE(dev); - - /* Allocate general purpose input signals and connect a handler to each of - * them */ - qdev_init_gpio_in(dev, exynos4210_irq_gate_handler, s->n_in); - - s->level = g_malloc0(s->n_in * sizeof(*s->level)); -} - -static void exynos4210_irq_gate_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc = DEVICE_CLASS(klass); - - dc->reset = exynos4210_irq_gate_reset; - dc->vmsd = &vmstate_exynos4210_irq_gate; - device_class_set_props(dc, exynos4210_irq_gate_properties); - dc->realize = exynos4210_irq_gate_realize; -} - -static const TypeInfo exynos4210_irq_gate_info = { - .name = TYPE_EXYNOS4210_IRQ_GATE, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(Exynos4210IRQGateState), - .instance_init = exynos4210_irq_gate_init, - .class_init = exynos4210_irq_gate_class_init, -}; - -static void exynos4210_irq_gate_register_types(void) -{ - type_register_static(&exynos4210_irq_gate_info); -} - -type_init(exynos4210_irq_gate_register_types) From patchwork Thu Apr 21 11:18:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564320 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp344361map; Thu, 21 Apr 2022 04:26:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxx91IByUVqHLd979syjyN69ImCFGvWeTv7WB4wSAjTm2obxk7QtlYJmo3qCQCp+X1FIhuk X-Received: by 2002:a05:6214:1cc4:b0:435:b8a0:1fe9 with SMTP id g4-20020a0562141cc400b00435b8a01fe9mr18836920qvd.54.1650540360902; Thu, 21 Apr 2022 04:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540360; cv=none; d=google.com; s=arc-20160816; b=LGxhRa0hcHDPGf7EbMR2rHo0uKlIuLQn0P/Ul6lKxg9Wc8uAvOFuyH38x8G/Or7gyt A2bYMD5EyxjPyJsya3MIo83Eiwe2ZDMD4TwOzIopZVe3bFQJb0COYwaFz7D9lfCixzuP yHr65cThyXSiMPWgDFVC3yRQxZyZSgkNf62/xBsFZlu23z4cZCFMbrGzlaY6HyU2h2vw 5hB5Mz0eyeFuVzWUEDhugiJ5GvCDzmqzypxhDfiG2cQ4UfVBM5YgkBEOwwjUkgpu5iF6 oIli7W/mvYnQdzbOKZ1CkHVc6jl4WCoyzzNjLbmUtXZONk4jpT/IWQRrxHvCGssUUsW7 Pm0A== 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=HtN0kqqvwwTdtiQPjMVdnwH1taYT1AjPI2wX6s5u1Aw=; b=b+J/wL3L0bfcLp/pg2PZwACAua/M7TONwzy3DtsrgQPQ1IjS4PZkGTk9T3zvFJgG5n exVhpN+9i+OVzKI2BK42wDrBh9DpYp4Kr7x7M5aMOzctoWTM3CPO230HYpYoF7of/VuZ N94mtaBcF/AE7XLfCH9BlZkuObf7le7gO9+o8sTp5FPfjmsPhetmVfE75QTWsOX37wRF SBH04VI8+CTjPtZKIT0VtdXfZ3h3plI/ZkwFedn/xHuGEtrsUzz0fkbxkIykTMDLWE/4 9+8c4VaIqOqAmVFvaT+2R3wUaa7b55gTbj2lMffAb3bWcsKuPS0k/jNRDsRy+VHT6o/f CMtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y1iQmWtM; 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-20020a37a30c000000b0067e4be23a2bsi1235390qke.624.2022.04.21.04.26.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:26:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y1iQmWtM; 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]:42048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhUwd-0002X3-W3 for patch@linaro.org; Thu, 21 Apr 2022 07:25:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUpw-0002yw-Oj for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:00 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:34766) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpu-0003TW-Pn for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:00 -0400 Received: by mail-wr1-x42f.google.com with SMTP id c10so6234667wrb.1 for ; Thu, 21 Apr 2022 04:18:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=HtN0kqqvwwTdtiQPjMVdnwH1taYT1AjPI2wX6s5u1Aw=; b=Y1iQmWtM7G8bJJgbrlt0ara2NGUC3+0X2km8FlPbtXYGEI1mwHVM/4Rdhi5MZyC2aX 9y/P2gFNxyi165kQ1wLEXJvbVvIll3yOoiOyMuOTWceZj1IkDYsc8FRVuNKUDh1ddmTu ZEZGPv+EyUFFZNYxyqdanmo0FEVfqvq/dv5yI8XkPZ+HnNAxLyi9Vpf/eK9b/E98D3qv N5Z0ib1TZ+be91ypB2JmZ+rslI5UTRyN11OXsTWoRUhZMS2E7+J/U0xk7bfBxe2mKx6Z WqYlT1VLCoy7mPvKydfGxKfLx5iTjcMCyouJodbZE1/KDn8eMNqv5AF4r7HbjupR9mCt Oz9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HtN0kqqvwwTdtiQPjMVdnwH1taYT1AjPI2wX6s5u1Aw=; b=pY+T235nK+yMhoXwNfas4k303ebaerh5UaBpZTiD+nYMr+0lcZcCDy/hAktmPoULmA ykyBuiwgo4rR0zfyMPuFxKpSzoFX7yFw3dPVHpjclOANHrbCKdS4SqZF8KJeog97OGpE 9zDF0P2AVXflFNR/wyl/YkFqUTjQ3S0Ij/ABMEoTy6na5hqtW181P5MwPCrm6gxT8vxY t4/v7hTWMUsWiu+7R2wbOMn3OAjhYyw82y3k9eBbqoTybkxCXy3dQ0uxkj0pTDaqhIlv iTYAYipVqDeUv9Nlbut3WWnuloirWWIlPUOvggC/8GbyEdEnk6IbNRdC7C0y7eNnngXj 1A2g== X-Gm-Message-State: AOAM531uQ+yqPq5WOQA9bKu3BuyBjUWepZ0OA8rQeogUFyC6HO/UGrDo df3Hdrh9D2c1YaRvxmNR5unlon3iDFiAzQ== X-Received: by 2002:a05:6000:71c:b0:207:a807:e297 with SMTP id bs28-20020a056000071c00b00207a807e297mr18676051wrb.596.1650539937459; Thu, 21 Apr 2022 04:18:57 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.18.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:18:57 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/31] hw/arm/exynos4210: Put a9mpcore device into state struct Date: Thu, 21 Apr 2022 12:18:25 +0100 Message-Id: <20220421111846.2011565-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" The exynos4210 SoC mostly creates its child devices as if it were board code. This includes the a9mpcore object. Switch that to a new-style "embedded in the state struct" creation, because in the next commit we're going to want to refer to the object again further down in the exynos4210_realize() function. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-4-peter.maydell@linaro.org --- include/hw/arm/exynos4210.h | 2 ++ hw/arm/exynos4210.c | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index 3999034053e..215c039b414 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -26,6 +26,7 @@ #include "hw/or-irq.h" #include "hw/sysbus.h" +#include "hw/cpu/a9mpcore.h" #include "target/arm/cpu-qom.h" #include "qom/object.h" @@ -103,6 +104,7 @@ struct Exynos4210State { I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER]; qemu_or_irq pl330_irq_orgate[EXYNOS4210_NUM_DMA]; qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS]; + A9MPPrivState a9mpcore; }; #define TYPE_EXYNOS4210_SOC "exynos4210" diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index dfc0a4eec25..ef4d646eb91 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -244,17 +244,16 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) } /* Private memory region and Internal GIC */ - dev = qdev_new(TYPE_A9MPCORE_PRIV); - qdev_prop_set_uint32(dev, "num-cpu", EXYNOS4210_NCPUS); - busdev = SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(busdev, &error_fatal); + qdev_prop_set_uint32(DEVICE(&s->a9mpcore), "num-cpu", EXYNOS4210_NCPUS); + busdev = SYS_BUS_DEVICE(&s->a9mpcore); + sysbus_realize(busdev, &error_fatal); sysbus_mmio_map(busdev, 0, EXYNOS4210_SMP_PRIVATE_BASE_ADDR); for (n = 0; n < EXYNOS4210_NCPUS; n++) { sysbus_connect_irq(busdev, n, qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 0)); } for (n = 0; n < EXYNOS4210_INT_GIC_NIRQ; n++) { - s->irqs.int_gic_irq[n] = qdev_get_gpio_in(dev, n); + s->irqs.int_gic_irq[n] = qdev_get_gpio_in(DEVICE(&s->a9mpcore), n); } /* Cache controller */ @@ -489,6 +488,8 @@ static void exynos4210_init(Object *obj) g_autofree char *name = g_strdup_printf("cpu-irq-orgate%d", i); object_initialize_child(obj, name, &s->cpu_irq_orgate[i], TYPE_OR_IRQ); } + + object_initialize_child(obj, "a9mpcore", &s->a9mpcore, TYPE_A9MPCORE_PRIV); } static void exynos4210_class_init(ObjectClass *klass, void *data) From patchwork Thu Apr 21 11:18:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564328 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp350538map; Thu, 21 Apr 2022 04:34:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzy7Vd4o8Y5Y8bWBlxI9plbDF28fjWCSlAujqSiBn/AObnoiu3ZqD1YO+c/H9Yo2bDDdRbj X-Received: by 2002:a37:9203:0:b0:69b:f993:dbe8 with SMTP id u3-20020a379203000000b0069bf993dbe8mr15358639qkd.94.1650540872004; Thu, 21 Apr 2022 04:34:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540872; cv=none; d=google.com; s=arc-20160816; b=AhLIzbiCJfLb7ndCwDYGdFrZ6OOip2zPdD1y+e7YwJKbUjxF/z9m6zUK1ELGq5zO05 obvMUeqFJ4Dmaqv4bifUQ7bBIFSfoIHBO/rji2WumIQU7U+1KgK5/Rn587oWrpfnl3dl uXB0NXDLE80Ydj6VDckYQ1pmYCPyUUMRbvrb7dkshRapMR6HmNL0EdLQyR+VOCzTJ9RR QKXsoVA5LzW6hgDXK5I2uAi3Irrxn/cbh6VL7v7GTvs79Ff0Gc4Ueoewg5/6TPKMeHPC be81hKFFetoRqC1R1Eas9BAzgvsAHt+WGQkYExA/VuQnLHi4JZq1Y6c/2XV2ZzqXtBYY n7HQ== 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=f6gs5lG3WvFi/GkMdFvvztB0m3oPJAErdAfbpm6CH1E=; b=D5huuIwtwYB8gz4LZA9MSV1wWPeHELXWStGK9QoS/TQKpdz2HQHcXVhnClv4KWQSl1 7s/OoORTpAHLJmXmoAtRiB/77skWthIQWfwdy7t66IGmXI6R6h6NPs0KwRjU0qEVs9L2 TfBvQp1V9erE/tOuhDOvkbnjTA/Wgc4RATj4qZMjRfXlC4sL16C9SWy5fVIu7EQWTp2+ VseZ7dAaqjURB938DXF7wToC0RcW0vq5UNbZRZ0c8JYeTedvY9VT0hFcINm5vE2nnB/l JsfUeUV3Diu85DCY5BPYoA3ktIum09Xx+LRSKmEhNOImTVQ1VyPrBPpbmoK7FZkGe/Fa Itiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A1oBjf+N; 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 ey5-20020a0562140b6500b004444e3b0d82si1429050qvb.40.2022.04.21.04.34.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:34:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A1oBjf+N; 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]:58984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhV4x-0007dy-EA for patch@linaro.org; Thu, 21 Apr 2022 07:34:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUpx-000314-Jc for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:01 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:38789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpv-0003Tf-Kj for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:01 -0400 Received: by mail-wr1-x42a.google.com with SMTP id p18so6213873wru.5 for ; Thu, 21 Apr 2022 04:18:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=f6gs5lG3WvFi/GkMdFvvztB0m3oPJAErdAfbpm6CH1E=; b=A1oBjf+NwbvPyCzVI+knnD1KV5tPL1S0fAOZzBtYJRbVPwUtOZ6ZqSnSWS6SXWvs6f w1u5X1ypjyQwfVkvIM5iCof95Q5TzqeqaYSnRTtuwLqJQ3QswtPNGiTHfQU2ciuVh2fV q/a8Hanodlu5hAIiX8N+RN/RK07OkMk0C+ttDyihSd6YInHnoptaJrfs20E2EBsMxdIK 6xwmVl97rP+Q3PX2q4ACS8Tzr5IxNGo5LfcfkIrf6Rui/xgTWm6QyVkxzcDA3ma7PLWE ttn4Wb9nxkwZeoyOVhcLimxZtqO/56HS9HBV/aukOFqZyM1/m3sSpQBRkf6Yi0rHI0Td OR5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f6gs5lG3WvFi/GkMdFvvztB0m3oPJAErdAfbpm6CH1E=; b=uJZazpUE/tOX5HRmT7v3838cjO+NBvO0+48l0j/kXEc7+iEP396kelOSLX4/tvpVVB ZZOw6Ac59PWLm/a+9ZYOJNFjSNee1p6fxqn3knNo0C07YY3COVAze0gFgheJaEYwmGuU 0YhgpXjIJkdLNXLmNmfCdKTvyVxLW1VRFcYffuCcaE+xUa16jFv2WlDBj9iVJd2ILSAP 25AX6JGKx5r9nHA3dukoMnl3WDrrkMbj8acWMNCdjgmuVQ8lwGhsWGFDQyIw0wKCWUNb AKmcWF8cAx2kvWdRSvJGT2JhHRsyoMDT9HC9PsUSZToUqjmtYjuBRbT5bcw4gNHL3wfd jVoQ== X-Gm-Message-State: AOAM531MUewyuI+1YCmMdvRuy0iZu/tLOtOqztSLn63fZuQoFga76ULC R6HizXfTOzOiG/BgFgct9cUxA2BMxvxFmA== X-Received: by 2002:a5d:64a3:0:b0:20a:7931:5b84 with SMTP id m3-20020a5d64a3000000b0020a79315b84mr19822561wrp.407.1650539938191; Thu, 21 Apr 2022 04:18:58 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.18.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:18:57 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/31] hw/arm/exynos4210: Drop int_gic_irq[] from Exynos4210Irq struct Date: Thu, 21 Apr 2022 12:18:26 +0100 Message-Id: <20220421111846.2011565-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" The only time we use the int_gic_irq[] array in the Exynos4210Irq struct is in the exynos4210_realize() function: we initialize it with the GPIO inputs of the a9mpcore device, and then a bit later on we connect those to the outputs of the internal combiner. Now that the a9mpcore object is easily accessible as s->a9mpcore we can make the connection directly from one device to the other without going via this array. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-5-peter.maydell@linaro.org --- include/hw/arm/exynos4210.h | 1 - hw/arm/exynos4210.c | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index 215c039b414..923ce987627 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -82,7 +82,6 @@ typedef struct Exynos4210Irq { qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ]; - qemu_irq int_gic_irq[EXYNOS4210_INT_GIC_NIRQ]; qemu_irq ext_gic_irq[EXYNOS4210_EXT_GIC_NIRQ]; qemu_irq board_irqs[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; } Exynos4210Irq; diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index ef4d646eb91..60fc5a2ffe7 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -252,9 +252,6 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) sysbus_connect_irq(busdev, n, qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 0)); } - for (n = 0; n < EXYNOS4210_INT_GIC_NIRQ; n++) { - s->irqs.int_gic_irq[n] = qdev_get_gpio_in(DEVICE(&s->a9mpcore), n); - } /* Cache controller */ sysbus_create_simple("l2x0", EXYNOS4210_L2X0_BASE_ADDR, NULL); @@ -281,7 +278,8 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) busdev = SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(busdev, &error_fatal); for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) { - sysbus_connect_irq(busdev, n, s->irqs.int_gic_irq[n]); + sysbus_connect_irq(busdev, n, + qdev_get_gpio_in(DEVICE(&s->a9mpcore), n)); } exynos4210_combiner_get_gpioin(&s->irqs, dev, 0); sysbus_mmio_map(busdev, 0, EXYNOS4210_INT_COMBINER_BASE_ADDR); From patchwork Thu Apr 21 11:18:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564322 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp346555map; Thu, 21 Apr 2022 04:29:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv8V0TuY50DGV+A46+kE91UE5CyLI3GVgLwtx5ipmwJMgHocoV8+rEDAaVvU6zsFSPe57u X-Received: by 2002:ac8:5509:0:b0:2f1:ea6f:55b8 with SMTP id j9-20020ac85509000000b002f1ea6f55b8mr16997204qtq.379.1650540570592; Thu, 21 Apr 2022 04:29:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540570; cv=none; d=google.com; s=arc-20160816; b=F4MlyKFNORYRGX5Yucp6Y5e7/ZpsYSWfVvvSwIrt7Uy0QtN5/NYnTW20Bu2u4+ytlI cOrF8KUaDR9R+duF7PENWsTJQWHBIlkFbZv8H+vJili1SH6SHIiW9/J5lAXIVns52olp 6dWDGK9GrfuHxdNABI7sccoFZ2IH+XFhF2mXBRrCoiaaxx2livivOytGBdt39wQ8SgsQ h0066Jbfo4X+N2FMHToOXD5oB1490RfMzLAQzAlxj9k2CKnA4VIrUxNLPHsDEp6GJRuX Kadaikh9NFOjpZ6qN6w8eKI6/1ijsw90tA61lYcg9PaiIgtjyKZHhOGbJtcLNgF1HSbz xQ5g== 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=NxyRKNFl2O6E7I/QAVOYo1T3g62wFJsWVPRRmD11FmI=; b=F7ivERlJrI+UyM6fgtuuJEPn9EcjD59dRPCq87JnC+phXqyaDpOrqYXhviz7GoF/Ll sb1+f8Y30XfP87EbAs+ljBlp9rj1MQa2EcRw/bPfm8bdZl5+3iuQj2ReKSx6OpeI4B1O eE1ncXb6is0DXgDVZtDiRlqzT2XxsNbpkHQS0S45kU5zFNbR+bLVZSgApimF7j1e8b44 lO0muqouAhAmhBrqXfAJXdZD5OY3wN1eyyBFokpf9wSq01s4FqHseDIBwTdxA47QJ/1z OYhIgsAH5lcJPu85PZE/ESiQmxygXaqSHq5W/1/aOlUCMi3jdD/ZcE2H1+6UickKKV+J ucRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=llpp7lcb; 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 k8-20020a05620a0b8800b0069ea736d82dsi1240864qkh.289.2022.04.21.04.29.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:29:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=llpp7lcb; 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]:48572 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhV05-00089G-42 for patch@linaro.org; Thu, 21 Apr 2022 07:29:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59312) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUpy-00033v-IO for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:02 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:43839) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpw-0003Tz-JK for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:02 -0400 Received: by mail-wr1-x42b.google.com with SMTP id g18so6190568wrb.10 for ; Thu, 21 Apr 2022 04:19:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=NxyRKNFl2O6E7I/QAVOYo1T3g62wFJsWVPRRmD11FmI=; b=llpp7lcbkUKy06ghh/lmPABu+jgefJcWc0HyuyXLGQ/TcwdezGUyp/79knaqmN2BMD WuK9qon6sPkfV7BiRO7BXVX5Q6wVG1t2ug5Miv8m3zVSrdC9ij/05LOussydzwkE29S9 wLGXoutBIhv1dGIVdNTydIYRGTYWJE9ZxlbjiIluv4UfSkkx4MtCPPiYW3ftHtBuhwqG Hgbg8T8/5Iu31ZBiOo7mj4L2eBSNwvTfI+uM6nosIOnymiCGASv9Y2w1Cg5yrLC0QRtm 3toqqi7V95Qkbqk/CXxas+05mI+M+wrdcSVCIX/P6vo2pqDle/AkjxQ64llbDlByxB1D kxdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NxyRKNFl2O6E7I/QAVOYo1T3g62wFJsWVPRRmD11FmI=; b=hwq8bkB8AYsHZ/K3oNdYmlLOst4zFkmX4CShUUQrK4kLR0E4HIavNXxgrvNH9PSEvg QyIUs0BObShD7dV41rDHARekedDE6Gw/L/Urmq8qHkCNAC7CdzgxpZVEh4zevngjAMzF z7zZrixegib5ix7y5W9ypiRB9SnYr667HxYAlGaUb5xnwLm+brv19TkyoPX0NP8eU1nU s7DRne7nCF0oVqXopZRuPbEZQCa9pji5nc09m0cbOMdDd48S2LVdp5yh8NYkySBRQ0YU ojPebdoK1P5amASHiGKoPj4acqDbygn2lXPkWyY+o4TzSGJxT3HvY8HJCEal9wKKrLmc XI1A== X-Gm-Message-State: AOAM532r8ZglzScmbZk4Kw89XCDUtKL8hQIbgw6sPCEoL7RLYrAveUId aANsqoXIQlsAD2MGTLEv8SN8x3/ub+solA== X-Received: by 2002:a5d:4a81:0:b0:207:9abe:2908 with SMTP id o1-20020a5d4a81000000b002079abe2908mr18818764wrq.341.1650539939070; Thu, 21 Apr 2022 04:18:59 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.18.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:18:58 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/31] hw/arm/exynos4210: Coalesce board_irqs and irq_table Date: Thu, 21 Apr 2022 12:18:27 +0100 Message-Id: <20220421111846.2011565-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" The exynos4210 code currently has two very similar arrays of IRQs: * board_irqs is a field of the Exynos4210Irq struct which is filled in by exynos4210_init_board_irqs() with the appropriate qemu_irqs for each IRQ the board/SoC can assert * irq_table is a set of qemu_irqs pointed to from the Exynos4210State struct. It's allocated in exynos4210_init_irq, and the only behaviour these irqs have is that they pass on the level to the equivalent board_irqs[] irq The extra indirection through irq_table is unnecessary, so coalesce these into a single irq_table[] array as a direct field in Exynos4210State which exynos4210_init_board_irqs() fills in. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-6-peter.maydell@linaro.org --- include/hw/arm/exynos4210.h | 8 ++------ hw/arm/exynos4210.c | 6 +----- hw/intc/exynos4210_gic.c | 32 ++++++++------------------------ 3 files changed, 11 insertions(+), 35 deletions(-) diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index 923ce987627..a9f186370ee 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -83,7 +83,6 @@ typedef struct Exynos4210Irq { qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ]; qemu_irq ext_gic_irq[EXYNOS4210_EXT_GIC_NIRQ]; - qemu_irq board_irqs[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; } Exynos4210Irq; struct Exynos4210State { @@ -92,7 +91,7 @@ struct Exynos4210State { /*< public >*/ ARMCPU *cpu[EXYNOS4210_NCPUS]; Exynos4210Irq irqs; - qemu_irq *irq_table; + qemu_irq irq_table[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; MemoryRegion chipid_mem; MemoryRegion iram_mem; @@ -112,12 +111,9 @@ OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210State, EXYNOS4210_SOC) void exynos4210_write_secondary(ARMCPU *cpu, const struct arm_boot_info *info); -/* Initialize exynos4210 IRQ subsystem stub */ -qemu_irq *exynos4210_init_irq(Exynos4210Irq *env); - /* Initialize board IRQs. * These IRQs contain splitted Int/External Combiner and External Gic IRQs */ -void exynos4210_init_board_irqs(Exynos4210Irq *s); +void exynos4210_init_board_irqs(Exynos4210State *s); /* Get IRQ number from exynos4210 IRQ subsystem stub. * To identify IRQ source use internal combiner group and bit number diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 60fc5a2ffe7..11e321d7830 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -228,10 +228,6 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) qdev_realize(DEVICE(cpuobj), NULL, &error_fatal); } - /*** IRQs ***/ - - s->irq_table = exynos4210_init_irq(&s->irqs); - /* IRQ Gate */ for (i = 0; i < EXYNOS4210_NCPUS; i++) { DeviceState *orgate = DEVICE(&s->cpu_irq_orgate[i]); @@ -296,7 +292,7 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_COMBINER_BASE_ADDR); /* Initialize board IRQs. */ - exynos4210_init_board_irqs(&s->irqs); + exynos4210_init_board_irqs(s); /*** Memory ***/ diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c index 794f6b5ac72..ec79b96f6d1 100644 --- a/hw/intc/exynos4210_gic.c +++ b/hw/intc/exynos4210_gic.c @@ -192,30 +192,14 @@ combiner_grp_to_gic_id[64-EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { #define EXYNOS4210_GIC_CPU_REGION_SIZE 0x100 #define EXYNOS4210_GIC_DIST_REGION_SIZE 0x1000 -static void exynos4210_irq_handler(void *opaque, int irq, int level) -{ - Exynos4210Irq *s = (Exynos4210Irq *)opaque; - - /* Bypass */ - qemu_set_irq(s->board_irqs[irq], level); -} - -/* - * Initialize exynos4210 IRQ subsystem stub. - */ -qemu_irq *exynos4210_init_irq(Exynos4210Irq *s) -{ - return qemu_allocate_irqs(exynos4210_irq_handler, s, - EXYNOS4210_MAX_INT_COMBINER_IN_IRQ); -} - /* * Initialize board IRQs. * These IRQs contain splitted Int/External Combiner and External Gic IRQs. */ -void exynos4210_init_board_irqs(Exynos4210Irq *s) +void exynos4210_init_board_irqs(Exynos4210State *s) { uint32_t grp, bit, irq_id, n; + Exynos4210Irq *is = &s->irqs; for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) { irq_id = 0; @@ -230,11 +214,11 @@ void exynos4210_init_board_irqs(Exynos4210Irq *s) irq_id = EXT_GIC_ID_MCT_G1; } if (irq_id) { - s->board_irqs[n] = qemu_irq_split(s->int_combiner_irq[n], - s->ext_gic_irq[irq_id-32]); + s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], + is->ext_gic_irq[irq_id - 32]); } else { - s->board_irqs[n] = qemu_irq_split(s->int_combiner_irq[n], - s->ext_combiner_irq[n]); + s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], + is->ext_combiner_irq[n]); } } for (; n < EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; n++) { @@ -245,8 +229,8 @@ void exynos4210_init_board_irqs(Exynos4210Irq *s) EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][bit]; if (irq_id) { - s->board_irqs[n] = qemu_irq_split(s->int_combiner_irq[n], - s->ext_gic_irq[irq_id-32]); + s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], + is->ext_gic_irq[irq_id - 32]); } } } From patchwork Thu Apr 21 11:18:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564332 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp352598map; Thu, 21 Apr 2022 04:37:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmxKehRu2KHKo2RB1O3zHAkVRZq/UxqDxHpIWEO1vZUjdhKejIN9myZjDA/Um1SSudiv3m X-Received: by 2002:a05:6214:21a9:b0:446:3c84:a188 with SMTP id t9-20020a05621421a900b004463c84a188mr19160778qvc.55.1650541052208; Thu, 21 Apr 2022 04:37:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650541052; cv=none; d=google.com; s=arc-20160816; b=yLZNoIy/F3LK2kPwUKCFFa+iIDEHdvqI53c78a/V5btPYmTL5C9IJTJR1Cc8Ihnup3 AXVH+0oaKrZTykxFX/zmqeGCFEIbw+bEUGbUTGV6/LhIlCoxymu+O8jFPKS9gdCW26St 7M5MAv49Rh0GPaZ8fQu0HjzZNwZ2p0kc44yaSfxxb5rm1tEfKN3yWZutjvklUL9prZgI c+GasCSDrgy9AOsC+ezrFQJZeRi9FJgx/K3TskxUI+PC/0W0rRadZKdyuJfnu5sVy3WD i1WJcYCJ+6M3UrtHSGloPeDbwfNck36JD1FlBddXectaH2wTuWfVxJDxw0aeot9jfmi1 X5Uw== 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=bxmVBnLL0UuF4+CoaLzsddoXXo7cHYtUouPIfgvtaUY=; b=K3Cnk9590yPBlzQcWVFuU2Gze2+H0yfEaZwwfQbhMQQ1YtzH6w8pNivQQJFFPkWBaY hd68ZpBoum/ytfPYKkt4fVFWKe0KAAQIrN2R+Ecp9l6qrArBynjFz1uqj0AjN5J0x/6T KCg7bJmRCE3GXCBVi1+i3Dq+FGJ0lVZLHP2JuBK00PihsGzNswEJnyODJqvFPhIunAS5 lFQD1lx14QTKjBkpnUXTekWcHd5xySU3rat1BlDxO2NqQGSinF0E8Y8Cv4k3aPdvJpOr KHW3ap2pOshC5FpBxUJ+ydh6ldUsh7XJukfY8SdZk3+J78LJmRrB6m+jRbmHDdr+l34r +4fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p6NDZ1Ew; 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 h2-20020ac85842000000b002e1fbf3bf64si1264046qth.341.2022.04.21.04.37.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:37:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p6NDZ1Ew; 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]:39202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhV7r-0005V8-ON for patch@linaro.org; Thu, 21 Apr 2022 07:37:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUpz-00036b-Qw for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:06 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:38791) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpy-0003UZ-5c for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:03 -0400 Received: by mail-wr1-x42c.google.com with SMTP id p18so6213967wru.5 for ; Thu, 21 Apr 2022 04:19:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=bxmVBnLL0UuF4+CoaLzsddoXXo7cHYtUouPIfgvtaUY=; b=p6NDZ1Ew73HpfEgMv2z6nHwUjJv8hThRBvuFlxwSK3ByuJ31BKV1u7iWkgV+msmU/p 7YdA4trxkmibIJ2JukjDTvX/LlyHD6pPtOsYCSWSN76OynV2NwPEVn5jUhXF3dlnM6G8 O+DOIpg1PZy/q90wvjT5/ZiKY+Qf1mjCKXrOLb7F20RrVS7a09ODPR6h07e4PC+KSJ0H IEKj2JOdfTqgObf0h3s2ymdmwpff5l5CfVe/H7zAOWZuvzIQvyOmlP62pCZjm1G2TPIy 8jyp2XnJkNxcCI3cUd7J3Sts3z6RHuK0div1xx04Y5L4tRU0gicF9FQUJ3r4cmmbgJwF AuQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bxmVBnLL0UuF4+CoaLzsddoXXo7cHYtUouPIfgvtaUY=; b=OWDWsFPjb050vfwb73sj/ZFEDFQljizHEXFbMmNzVeAGYtHp+LJkJVh7o2s1UJ7iHJ BA4n/zW+OLdmbH11oH3CLPXknWNClI/Pjvi3WdssxVGLmWFufko38+Im7d6vcrrqIQZd B4MZOiZKvqTNgF6p8sVC+OkqyJl6Q+d7cWnWvZtdTcPc+ApZVyoljnO0JbkNfZxKzdvS D63N6R0MD26XIpKKg7QTOx9xzC9QbqSQL4Vh+f1PaS43E6Z9306r/LqgBvfofvxOnmpH ZWiLI7OW/oAnduYYCCUDY6iTetkku2zPM7Eb5o6wKZm2pRKeYsJwYYhfrQwX5RENw/z/ oTBw== X-Gm-Message-State: AOAM532LjrkwNgUrQCk00mhtb+DqtYhwQQlUVPxwbOYPU45mS+Mmzh0T Nlnn0Ubvx39UKZakiaA5Zfjdsj6SDmgLFw== X-Received: by 2002:a5d:424f:0:b0:20a:c08b:551a with SMTP id s15-20020a5d424f000000b0020ac08b551amr1580529wrr.521.1650539939827; Thu, 21 Apr 2022 04:18:59 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.18.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:18:59 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/31] hw/arm/exynos4210: Fix code style nit in combiner_grp_to_gic_id[] Date: Thu, 21 Apr 2022 12:18:28 +0100 Message-Id: <20220421111846.2011565-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" Fix a missing set of spaces around '-' in the definition of combiner_grp_to_gic_id[]. We're about to move this code, so fix the style issue first to keep checkpatch happy with the code-motion patch. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-7-peter.maydell@linaro.org --- hw/intc/exynos4210_gic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c index ec79b96f6d1..3b77a485780 100644 --- a/hw/intc/exynos4210_gic.c +++ b/hw/intc/exynos4210_gic.c @@ -121,7 +121,7 @@ enum ExtInt { */ static const uint32_t -combiner_grp_to_gic_id[64-EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { +combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { /* int combiner groups 16-19 */ { }, { }, { }, { }, /* int combiner group 20 */ From patchwork Thu Apr 21 11:18:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564327 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp350498map; Thu, 21 Apr 2022 04:34:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlsbMomKZ2dzSyDSs9C3u7yQnIdoSnBEMhuXRsOlY5b3yN1S9+i+JRa8HkZYKSiPcI6+03 X-Received: by 2002:ad4:5cc2:0:b0:448:c1f8:58f6 with SMTP id iu2-20020ad45cc2000000b00448c1f858f6mr7474682qvb.91.1650540868549; Thu, 21 Apr 2022 04:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540868; cv=none; d=google.com; s=arc-20160816; b=jeDyJpRk6bedYfcBkRWqjLpTE2HBRCgMMd5k/MIlnW6fkzw79SbIIczCcx6KQZ+Sgf rtVUxCYP+csq/IG0qP0V4KorfRLcGtj9+Yhzo/Z/vPaOLgpOGtuMojPWZ52AEJn5ggUs r9Q4XgtKRuoJi9WMIK1WNFt3q2gvRj99wB0dOCdd+NE8TUmN/4nu2qsmmfzE/xMWAQ3m pApsZZwEghplPXVkMRTfuauIUvK/eZi4cH84cYvlK0RDqmOHe0ETNwFQt4msUTE+JVHP Kl5MA6sktDs4haEqeJK4NkrDpFGBHEZUntC/iuSgBu2CGVNS0xwuDepB8vZ+IBXAZuD1 FVnQ== 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=2NDP/T7Fv9/K0sGy4dyMoIgx7aLG/7J2aqJYascVVTc=; b=S2L1lDzm5Di0kNbcpeEwuQhXPJXnxIeiz/tZj71AJJAzEXp7ezwIkSa4rnxB+43LkS GNF0kWylr2jvOkRONqN1LN+DVaXr8Z4lbvz/nXXq1hMglFv67PPILbMTuaxll7CRJVkg PU+49RIVqiA5rppxDhmVmxaGA1FwXAhNeJ3SjHGQlrqyjnN8/5d5XdZXJpcIKEZjtN/7 LACGvCDoZZP3tamfmnd9NYDfaUKZfQOza5WThC5j+D5pA30qycC2HTdnHXa1yHJsPthi 4kjQsaXT/qUTV6FG/YhE1CCyt72HzD5/EM/3LNG0sxOhlxARI4TNQzQ3j5DYdardSLS/ KrYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bRLRnyp1; 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 10-20020ac84e8a000000b002f2035b28b0si1475540qtp.145.2022.04.21.04.34.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:34:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bRLRnyp1; 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]:58664 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhV4t-0007QG-WC for patch@linaro.org; Thu, 21 Apr 2022 07:34:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUq0-00036i-P0 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:06 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:33047) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpy-0003Uf-Bi for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:04 -0400 Received: by mail-wm1-x329.google.com with SMTP id l3-20020a05600c1d0300b0038ff89c938bso3652998wms.0 for ; Thu, 21 Apr 2022 04:19:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=2NDP/T7Fv9/K0sGy4dyMoIgx7aLG/7J2aqJYascVVTc=; b=bRLRnyp1S/zFTJP49eyClVBIPBujuMQv8TZ90eAGqTr57ZGL6Bp3EcVB0VvIaoi/wo 9cc/fC3lQJSvDtEVPHf10PiI0+EQn5OQbwzEuMa5+4fzmZIHrv6huwi0oAoDRKpQYeoY jMwzKXxdLYi+zLBF2AkVE/D2KReLVAqzM24/dG/e9S4JGq1+AQ1/d+2cOYYuK18Hz0dT 4oyvRJquqfrtJPtbZkD87cKTz2ts625pGvAsICsdeeouusZwOSRa8rm3jeS0Gpq+YNve 8ZPqSWbDc8eUXurvZhaSiJi49meH3nWxSvdZdiM4+1Bk4BrIvqIOVQUNFc+vy3DvmhxU 6BcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2NDP/T7Fv9/K0sGy4dyMoIgx7aLG/7J2aqJYascVVTc=; b=3RZ50xTAexmdbnddTD5pwvJrL8ZYVPDDyJWg12WLOTrpteumjIYhb7yT+nWW+pJfcL kcFZnJGd5aTGF9tQC1diM0pBLsLkLYK4TWbvzrJ1bea7tZYC2honLIoC/QjQtRjEG1+j ysimWk5OJanNCS7dgJTy2mODG8wie6ajGgklPGNvcm5Jt6v5ZrSa3e3uUa0OT6LcQPA2 co2EbC0Oe3+zcFIkUcOOJ/PBhXIwIrDcvUr5v19xmgcJ7FZZtf9FbMWk9T3WLAqsXAEI OgqagWcUNkRPo9PMJGKokkCz6fwLcrwz5Z3waRt8M7EPZO8jgKPDBifcjD96EECzgLfG KWDQ== X-Gm-Message-State: AOAM530Rk1dhV/CDI+5H1mZBnLHtpNH34G3rAJ4LkZuNjDta6vnWsH62 xOEhecwIAeAoBCLwWfBRdV7e1Lt1zim5uQ== X-Received: by 2002:a1c:7415:0:b0:38e:bbbf:52d9 with SMTP id p21-20020a1c7415000000b0038ebbbf52d9mr8095277wmc.104.1650539940787; Thu, 21 Apr 2022 04:19:00 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.18.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:00 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/31] hw/arm/exynos4210: Move exynos4210_init_board_irqs() into exynos4210.c Date: Thu, 21 Apr 2022 12:18:29 +0100 Message-Id: <20220421111846.2011565-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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, 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" The function exynos4210_init_board_irqs() currently lives in exynos4210_gic.c, but it isn't really part of the exynos4210.gic device -- it is a function that implements (some of) the wiring up of interrupts between the SoC's GIC and combiner components. This means it fits better in exynos4210.c, which is the SoC-level code. Move it there. Similarly, exynos4210_git_irq() is used almost only in the SoC-level code, so move it too. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-8-peter.maydell@linaro.org --- include/hw/arm/exynos4210.h | 4 - hw/arm/exynos4210.c | 202 +++++++++++++++++++++++++++++++++++ hw/intc/exynos4210_gic.c | 204 ------------------------------------ 3 files changed, 202 insertions(+), 208 deletions(-) diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index a9f186370ee..d83e96a091e 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -111,10 +111,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210State, EXYNOS4210_SOC) void exynos4210_write_secondary(ARMCPU *cpu, const struct arm_boot_info *info); -/* Initialize board IRQs. - * These IRQs contain splitted Int/External Combiner and External Gic IRQs */ -void exynos4210_init_board_irqs(Exynos4210State *s); - /* Get IRQ number from exynos4210 IRQ subsystem stub. * To identify IRQ source use internal combiner group and bit number * grp - group number diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 11e321d7830..742666ba779 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -101,6 +101,208 @@ #define EXYNOS4210_PL330_BASE1_ADDR 0x12690000 #define EXYNOS4210_PL330_BASE2_ADDR 0x12850000 +enum ExtGicId { + EXT_GIC_ID_MDMA_LCD0 = 66, + EXT_GIC_ID_PDMA0, + EXT_GIC_ID_PDMA1, + EXT_GIC_ID_TIMER0, + EXT_GIC_ID_TIMER1, + EXT_GIC_ID_TIMER2, + EXT_GIC_ID_TIMER3, + EXT_GIC_ID_TIMER4, + EXT_GIC_ID_MCT_L0, + EXT_GIC_ID_WDT, + EXT_GIC_ID_RTC_ALARM, + EXT_GIC_ID_RTC_TIC, + EXT_GIC_ID_GPIO_XB, + EXT_GIC_ID_GPIO_XA, + EXT_GIC_ID_MCT_L1, + EXT_GIC_ID_IEM_APC, + EXT_GIC_ID_IEM_IEC, + EXT_GIC_ID_NFC, + EXT_GIC_ID_UART0, + EXT_GIC_ID_UART1, + EXT_GIC_ID_UART2, + EXT_GIC_ID_UART3, + EXT_GIC_ID_UART4, + EXT_GIC_ID_MCT_G0, + EXT_GIC_ID_I2C0, + EXT_GIC_ID_I2C1, + EXT_GIC_ID_I2C2, + EXT_GIC_ID_I2C3, + EXT_GIC_ID_I2C4, + EXT_GIC_ID_I2C5, + EXT_GIC_ID_I2C6, + EXT_GIC_ID_I2C7, + EXT_GIC_ID_SPI0, + EXT_GIC_ID_SPI1, + EXT_GIC_ID_SPI2, + EXT_GIC_ID_MCT_G1, + EXT_GIC_ID_USB_HOST, + EXT_GIC_ID_USB_DEVICE, + EXT_GIC_ID_MODEMIF, + EXT_GIC_ID_HSMMC0, + EXT_GIC_ID_HSMMC1, + EXT_GIC_ID_HSMMC2, + EXT_GIC_ID_HSMMC3, + EXT_GIC_ID_SDMMC, + EXT_GIC_ID_MIPI_CSI_4LANE, + EXT_GIC_ID_MIPI_DSI_4LANE, + EXT_GIC_ID_MIPI_CSI_2LANE, + EXT_GIC_ID_MIPI_DSI_2LANE, + EXT_GIC_ID_ONENAND_AUDI, + EXT_GIC_ID_ROTATOR, + EXT_GIC_ID_FIMC0, + EXT_GIC_ID_FIMC1, + EXT_GIC_ID_FIMC2, + EXT_GIC_ID_FIMC3, + EXT_GIC_ID_JPEG, + EXT_GIC_ID_2D, + EXT_GIC_ID_PCIe, + EXT_GIC_ID_MIXER, + EXT_GIC_ID_HDMI, + EXT_GIC_ID_HDMI_I2C, + EXT_GIC_ID_MFC, + EXT_GIC_ID_TVENC, +}; + +enum ExtInt { + EXT_GIC_ID_EXTINT0 = 48, + EXT_GIC_ID_EXTINT1, + EXT_GIC_ID_EXTINT2, + EXT_GIC_ID_EXTINT3, + EXT_GIC_ID_EXTINT4, + EXT_GIC_ID_EXTINT5, + EXT_GIC_ID_EXTINT6, + EXT_GIC_ID_EXTINT7, + EXT_GIC_ID_EXTINT8, + EXT_GIC_ID_EXTINT9, + EXT_GIC_ID_EXTINT10, + EXT_GIC_ID_EXTINT11, + EXT_GIC_ID_EXTINT12, + EXT_GIC_ID_EXTINT13, + EXT_GIC_ID_EXTINT14, + EXT_GIC_ID_EXTINT15 +}; + +/* + * External GIC sources which are not from External Interrupt Combiner or + * External Interrupts are starting from EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ, + * which is INTG16 in Internal Interrupt Combiner. + */ + +static const uint32_t +combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { + /* int combiner groups 16-19 */ + { }, { }, { }, { }, + /* int combiner group 20 */ + { 0, EXT_GIC_ID_MDMA_LCD0 }, + /* int combiner group 21 */ + { EXT_GIC_ID_PDMA0, EXT_GIC_ID_PDMA1 }, + /* int combiner group 22 */ + { EXT_GIC_ID_TIMER0, EXT_GIC_ID_TIMER1, EXT_GIC_ID_TIMER2, + EXT_GIC_ID_TIMER3, EXT_GIC_ID_TIMER4 }, + /* int combiner group 23 */ + { EXT_GIC_ID_RTC_ALARM, EXT_GIC_ID_RTC_TIC }, + /* int combiner group 24 */ + { EXT_GIC_ID_GPIO_XB, EXT_GIC_ID_GPIO_XA }, + /* int combiner group 25 */ + { EXT_GIC_ID_IEM_APC, EXT_GIC_ID_IEM_IEC }, + /* int combiner group 26 */ + { EXT_GIC_ID_UART0, EXT_GIC_ID_UART1, EXT_GIC_ID_UART2, EXT_GIC_ID_UART3, + EXT_GIC_ID_UART4 }, + /* int combiner group 27 */ + { EXT_GIC_ID_I2C0, EXT_GIC_ID_I2C1, EXT_GIC_ID_I2C2, EXT_GIC_ID_I2C3, + EXT_GIC_ID_I2C4, EXT_GIC_ID_I2C5, EXT_GIC_ID_I2C6, + EXT_GIC_ID_I2C7 }, + /* int combiner group 28 */ + { EXT_GIC_ID_SPI0, EXT_GIC_ID_SPI1, EXT_GIC_ID_SPI2 , EXT_GIC_ID_USB_HOST}, + /* int combiner group 29 */ + { EXT_GIC_ID_HSMMC0, EXT_GIC_ID_HSMMC1, EXT_GIC_ID_HSMMC2, + EXT_GIC_ID_HSMMC3, EXT_GIC_ID_SDMMC }, + /* int combiner group 30 */ + { EXT_GIC_ID_MIPI_CSI_4LANE, EXT_GIC_ID_MIPI_CSI_2LANE }, + /* int combiner group 31 */ + { EXT_GIC_ID_MIPI_DSI_4LANE, EXT_GIC_ID_MIPI_DSI_2LANE }, + /* int combiner group 32 */ + { EXT_GIC_ID_FIMC0, EXT_GIC_ID_FIMC1 }, + /* int combiner group 33 */ + { EXT_GIC_ID_FIMC2, EXT_GIC_ID_FIMC3 }, + /* int combiner group 34 */ + { EXT_GIC_ID_ONENAND_AUDI, EXT_GIC_ID_NFC }, + /* int combiner group 35 */ + { 0, 0, 0, EXT_GIC_ID_MCT_L1, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 }, + /* int combiner group 36 */ + { EXT_GIC_ID_MIXER }, + /* int combiner group 37 */ + { EXT_GIC_ID_EXTINT4, EXT_GIC_ID_EXTINT5, EXT_GIC_ID_EXTINT6, + EXT_GIC_ID_EXTINT7 }, + /* groups 38-50 */ + { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, + /* int combiner group 51 */ + { EXT_GIC_ID_MCT_L0, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 }, + /* group 52 */ + { }, + /* int combiner group 53 */ + { EXT_GIC_ID_WDT, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 }, + /* groups 54-63 */ + { }, { }, { }, { }, { }, { }, { }, { }, { }, { } +}; + +/* + * Initialize board IRQs. + * These IRQs contain splitted Int/External Combiner and External Gic IRQs. + */ +static void exynos4210_init_board_irqs(Exynos4210State *s) +{ + uint32_t grp, bit, irq_id, n; + Exynos4210Irq *is = &s->irqs; + + for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) { + irq_id = 0; + if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 4) || + n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4)) { + /* MCT_G0 is passed to External GIC */ + irq_id = EXT_GIC_ID_MCT_G0; + } + if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 5) || + n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 5)) { + /* MCT_G1 is passed to External and GIC */ + irq_id = EXT_GIC_ID_MCT_G1; + } + if (irq_id) { + s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], + is->ext_gic_irq[irq_id - 32]); + } else { + s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], + is->ext_combiner_irq[n]); + } + } + for (; n < EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; n++) { + /* these IDs are passed to Internal Combiner and External GIC */ + grp = EXYNOS4210_COMBINER_GET_GRP_NUM(n); + bit = EXYNOS4210_COMBINER_GET_BIT_NUM(n); + irq_id = combiner_grp_to_gic_id[grp - + EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][bit]; + + if (irq_id) { + s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], + is->ext_gic_irq[irq_id - 32]); + } + } +} + +/* + * Get IRQ number from exynos4210 IRQ subsystem stub. + * To identify IRQ source use internal combiner group and bit number + * grp - group number + * bit - bit number inside group + */ +uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit) +{ + return EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit); +} + static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43, 0x09, 0x00, 0x00, 0x00 }; diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c index 3b77a485780..d8cad537fbf 100644 --- a/hw/intc/exynos4210_gic.c +++ b/hw/intc/exynos4210_gic.c @@ -30,154 +30,6 @@ #include "hw/arm/exynos4210.h" #include "qom/object.h" -enum ExtGicId { - EXT_GIC_ID_MDMA_LCD0 = 66, - EXT_GIC_ID_PDMA0, - EXT_GIC_ID_PDMA1, - EXT_GIC_ID_TIMER0, - EXT_GIC_ID_TIMER1, - EXT_GIC_ID_TIMER2, - EXT_GIC_ID_TIMER3, - EXT_GIC_ID_TIMER4, - EXT_GIC_ID_MCT_L0, - EXT_GIC_ID_WDT, - EXT_GIC_ID_RTC_ALARM, - EXT_GIC_ID_RTC_TIC, - EXT_GIC_ID_GPIO_XB, - EXT_GIC_ID_GPIO_XA, - EXT_GIC_ID_MCT_L1, - EXT_GIC_ID_IEM_APC, - EXT_GIC_ID_IEM_IEC, - EXT_GIC_ID_NFC, - EXT_GIC_ID_UART0, - EXT_GIC_ID_UART1, - EXT_GIC_ID_UART2, - EXT_GIC_ID_UART3, - EXT_GIC_ID_UART4, - EXT_GIC_ID_MCT_G0, - EXT_GIC_ID_I2C0, - EXT_GIC_ID_I2C1, - EXT_GIC_ID_I2C2, - EXT_GIC_ID_I2C3, - EXT_GIC_ID_I2C4, - EXT_GIC_ID_I2C5, - EXT_GIC_ID_I2C6, - EXT_GIC_ID_I2C7, - EXT_GIC_ID_SPI0, - EXT_GIC_ID_SPI1, - EXT_GIC_ID_SPI2, - EXT_GIC_ID_MCT_G1, - EXT_GIC_ID_USB_HOST, - EXT_GIC_ID_USB_DEVICE, - EXT_GIC_ID_MODEMIF, - EXT_GIC_ID_HSMMC0, - EXT_GIC_ID_HSMMC1, - EXT_GIC_ID_HSMMC2, - EXT_GIC_ID_HSMMC3, - EXT_GIC_ID_SDMMC, - EXT_GIC_ID_MIPI_CSI_4LANE, - EXT_GIC_ID_MIPI_DSI_4LANE, - EXT_GIC_ID_MIPI_CSI_2LANE, - EXT_GIC_ID_MIPI_DSI_2LANE, - EXT_GIC_ID_ONENAND_AUDI, - EXT_GIC_ID_ROTATOR, - EXT_GIC_ID_FIMC0, - EXT_GIC_ID_FIMC1, - EXT_GIC_ID_FIMC2, - EXT_GIC_ID_FIMC3, - EXT_GIC_ID_JPEG, - EXT_GIC_ID_2D, - EXT_GIC_ID_PCIe, - EXT_GIC_ID_MIXER, - EXT_GIC_ID_HDMI, - EXT_GIC_ID_HDMI_I2C, - EXT_GIC_ID_MFC, - EXT_GIC_ID_TVENC, -}; - -enum ExtInt { - EXT_GIC_ID_EXTINT0 = 48, - EXT_GIC_ID_EXTINT1, - EXT_GIC_ID_EXTINT2, - EXT_GIC_ID_EXTINT3, - EXT_GIC_ID_EXTINT4, - EXT_GIC_ID_EXTINT5, - EXT_GIC_ID_EXTINT6, - EXT_GIC_ID_EXTINT7, - EXT_GIC_ID_EXTINT8, - EXT_GIC_ID_EXTINT9, - EXT_GIC_ID_EXTINT10, - EXT_GIC_ID_EXTINT11, - EXT_GIC_ID_EXTINT12, - EXT_GIC_ID_EXTINT13, - EXT_GIC_ID_EXTINT14, - EXT_GIC_ID_EXTINT15 -}; - -/* - * External GIC sources which are not from External Interrupt Combiner or - * External Interrupts are starting from EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ, - * which is INTG16 in Internal Interrupt Combiner. - */ - -static const uint32_t -combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { - /* int combiner groups 16-19 */ - { }, { }, { }, { }, - /* int combiner group 20 */ - { 0, EXT_GIC_ID_MDMA_LCD0 }, - /* int combiner group 21 */ - { EXT_GIC_ID_PDMA0, EXT_GIC_ID_PDMA1 }, - /* int combiner group 22 */ - { EXT_GIC_ID_TIMER0, EXT_GIC_ID_TIMER1, EXT_GIC_ID_TIMER2, - EXT_GIC_ID_TIMER3, EXT_GIC_ID_TIMER4 }, - /* int combiner group 23 */ - { EXT_GIC_ID_RTC_ALARM, EXT_GIC_ID_RTC_TIC }, - /* int combiner group 24 */ - { EXT_GIC_ID_GPIO_XB, EXT_GIC_ID_GPIO_XA }, - /* int combiner group 25 */ - { EXT_GIC_ID_IEM_APC, EXT_GIC_ID_IEM_IEC }, - /* int combiner group 26 */ - { EXT_GIC_ID_UART0, EXT_GIC_ID_UART1, EXT_GIC_ID_UART2, EXT_GIC_ID_UART3, - EXT_GIC_ID_UART4 }, - /* int combiner group 27 */ - { EXT_GIC_ID_I2C0, EXT_GIC_ID_I2C1, EXT_GIC_ID_I2C2, EXT_GIC_ID_I2C3, - EXT_GIC_ID_I2C4, EXT_GIC_ID_I2C5, EXT_GIC_ID_I2C6, - EXT_GIC_ID_I2C7 }, - /* int combiner group 28 */ - { EXT_GIC_ID_SPI0, EXT_GIC_ID_SPI1, EXT_GIC_ID_SPI2 , EXT_GIC_ID_USB_HOST}, - /* int combiner group 29 */ - { EXT_GIC_ID_HSMMC0, EXT_GIC_ID_HSMMC1, EXT_GIC_ID_HSMMC2, - EXT_GIC_ID_HSMMC3, EXT_GIC_ID_SDMMC }, - /* int combiner group 30 */ - { EXT_GIC_ID_MIPI_CSI_4LANE, EXT_GIC_ID_MIPI_CSI_2LANE }, - /* int combiner group 31 */ - { EXT_GIC_ID_MIPI_DSI_4LANE, EXT_GIC_ID_MIPI_DSI_2LANE }, - /* int combiner group 32 */ - { EXT_GIC_ID_FIMC0, EXT_GIC_ID_FIMC1 }, - /* int combiner group 33 */ - { EXT_GIC_ID_FIMC2, EXT_GIC_ID_FIMC3 }, - /* int combiner group 34 */ - { EXT_GIC_ID_ONENAND_AUDI, EXT_GIC_ID_NFC }, - /* int combiner group 35 */ - { 0, 0, 0, EXT_GIC_ID_MCT_L1, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 }, - /* int combiner group 36 */ - { EXT_GIC_ID_MIXER }, - /* int combiner group 37 */ - { EXT_GIC_ID_EXTINT4, EXT_GIC_ID_EXTINT5, EXT_GIC_ID_EXTINT6, - EXT_GIC_ID_EXTINT7 }, - /* groups 38-50 */ - { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, - /* int combiner group 51 */ - { EXT_GIC_ID_MCT_L0, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 }, - /* group 52 */ - { }, - /* int combiner group 53 */ - { EXT_GIC_ID_WDT, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 }, - /* groups 54-63 */ - { }, { }, { }, { }, { }, { }, { }, { }, { }, { } -}; - #define EXYNOS4210_GIC_NIRQ 160 #define EXYNOS4210_EXT_GIC_CPU_REGION_SIZE 0x10000 @@ -192,62 +44,6 @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { #define EXYNOS4210_GIC_CPU_REGION_SIZE 0x100 #define EXYNOS4210_GIC_DIST_REGION_SIZE 0x1000 -/* - * Initialize board IRQs. - * These IRQs contain splitted Int/External Combiner and External Gic IRQs. - */ -void exynos4210_init_board_irqs(Exynos4210State *s) -{ - uint32_t grp, bit, irq_id, n; - Exynos4210Irq *is = &s->irqs; - - for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) { - irq_id = 0; - if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 4) || - n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4)) { - /* MCT_G0 is passed to External GIC */ - irq_id = EXT_GIC_ID_MCT_G0; - } - if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 5) || - n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 5)) { - /* MCT_G1 is passed to External and GIC */ - irq_id = EXT_GIC_ID_MCT_G1; - } - if (irq_id) { - s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], - is->ext_gic_irq[irq_id - 32]); - } else { - s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], - is->ext_combiner_irq[n]); - } - } - for (; n < EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; n++) { - /* these IDs are passed to Internal Combiner and External GIC */ - grp = EXYNOS4210_COMBINER_GET_GRP_NUM(n); - bit = EXYNOS4210_COMBINER_GET_BIT_NUM(n); - irq_id = combiner_grp_to_gic_id[grp - - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][bit]; - - if (irq_id) { - s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], - is->ext_gic_irq[irq_id - 32]); - } - } -} - -/* - * Get IRQ number from exynos4210 IRQ subsystem stub. - * To identify IRQ source use internal combiner group and bit number - * grp - group number - * bit - bit number inside group - */ -uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit) -{ - return EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit); -} - -/********* GIC part *********/ - #define TYPE_EXYNOS4210_GIC "exynos4210.gic" OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210GicState, EXYNOS4210_GIC) From patchwork Thu Apr 21 11:18:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564335 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp356576map; Thu, 21 Apr 2022 04:43:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWRiMuVrtC3K4MOY9uhGs1EVQbytwJ/Esz+QWWDPzFknZ9OkITjy3DSiV6fYr2T0qJpQKE X-Received: by 2002:ad4:5ba6:0:b0:446:3044:268a with SMTP id 6-20020ad45ba6000000b004463044268amr18863570qvq.119.1650541409326; Thu, 21 Apr 2022 04:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650541409; cv=none; d=google.com; s=arc-20160816; b=aU8SU0yKkYwSL3VCbHF0LzUHQqZpGlvXFIYdOlcjL0McwMeRmPKgXZ+LwoFPvVMHgY 9/Q9BBjcf6O49RIlF29+TFIlZgHmr2xjwUgBe2FpZceJFYuh2A6tdMUVE9900K8Wfm0W S7VPAR8D8dcBHoZvLTcWDbFDs84t4Btqfo4YkL/0FQ8E7vZRjaIxRmhRymIuCEjg/NLo bB0Qllbzkkj64N22k0Gd1GhQSCxarBoEwZn/IPWwahb/S+gpy+6WFUq8jSrPh1xgpsz6 tXtYO1O4TXIOX43FKalbsHKDsYTSyof7nqcb1afLThv5Z/DCzr0/tFfBJO6IVKVmM3Wj wNrw== 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=JyLLiVr6CM6ojc6EwZhzCmQ6kWAPOLYrRnM+QBWq57Q=; b=mEXckBhVcJuslUgrHxQHf65uwO9EGtGgDFrwCVdph4oW9A+BZUky5O4/Z4SdHX1D7o K1TSeVIm9OzbQH6tsvuaCl3jxQM+omyg22R860SPCC3LjVFmH8Fksf3JERXC+lh7dS5t bkHujSdERSgXo5dLbmbgiNHlMJor3JJynV7B4ZxOawkkYBBa5Z2YR9mPEg6ur27oKVFt 5vh+o/vmkT14oRCleoCsdnUDeba4Ftx7rIvA9grey9yDfvJwE+i33VAEoDjk/LYdSvhF ucpiRMjTGKlk/ZfxRqtCZ9vZocJsj8WdUJqD5/UHwq0mhWFpjmnDk7cPwxfBdemrr8wb zoIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FhG83E+j; 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 z26-20020ac8101a000000b002f1e448499esi1176755qti.586.2022.04.21.04.43.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:43:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FhG83E+j; 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]:47720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhVDc-00036f-Sz for patch@linaro.org; Thu, 21 Apr 2022 07:43:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUq1-00036r-NA for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:06 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:38479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpz-0003V2-7Z for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:05 -0400 Received: by mail-wm1-x329.google.com with SMTP id r187-20020a1c44c4000000b0038ccb70e239so5638810wma.3 for ; Thu, 21 Apr 2022 04:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=JyLLiVr6CM6ojc6EwZhzCmQ6kWAPOLYrRnM+QBWq57Q=; b=FhG83E+jrBBv6HzscjGozhqg8zyI6d/k2vicx5AaQgM+1ezyukHjwX/nLbCPV4zQDn zoRwTFS3Dyb7gyiesEIcPdOaAMkpPzqzyHcW72Gso120lny5ZGf2QxIFSW5G2vOVaw/K 3su2+8oD79Al5F36osqsYYXlial1tFs4a6bwqjuaYC/X+fGYk4KaE/+X9GPOD/tE+NpU EMs7bSgs6zgdoX1jOx+3VtuHqDJvE76Qzh52Fk4lrBJs+2XCxlWWUPY2xbJFF8vxKT9v R+EAoe0dKNEWxW17mLi+yuLh6x7RnHmejCTMDVf2skUcWcUZBhUeLHL6waxPgZFh1XCM SRvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JyLLiVr6CM6ojc6EwZhzCmQ6kWAPOLYrRnM+QBWq57Q=; b=R/dR1anNX1sWrsV4MQtY1sI0LrazckLGizMkjFkMDSreen9YpPip21HifQQsPQ4Dtt k347R6YIkSdSmkjyO2Wr5tf8MAzx+Ed/gFYAkvheSCDR4AgMsUm6SXSx/cKwssoj1TjZ +MyIlf6RmUjWEuGaxU78v5K8l2wS5YtR7orboesCVnax1M6T7MUimxIWV9eV5bKT2It3 Vqy3pVQpu864VqiK4cyr7wk9HmA0MgOHuNVSx9DWEJx4WvXud7LKDWOpcXOm1PdTBqQZ kGa+KNNpLXyefA1MqBTJtCm5eVQ/ai0TJYSHO3z7XoA7ENUvX+FsQ7sBQE4PY38/AjUG vXJA== X-Gm-Message-State: AOAM530Hyw/jW9oWgYvO1VyrJqW9kDOf8fuT8Ml954J+1xwaZfSPNhMD paGVRNMEXs9MW0E5isQvWQNmFj7ugRy5EA== X-Received: by 2002:a05:600c:1e1e:b0:38e:baaa:aae0 with SMTP id ay30-20020a05600c1e1e00b0038ebaaaaae0mr7852688wmb.157.1650539941786; Thu, 21 Apr 2022 04:19:01 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:01 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/31] hw/arm/exynos4210: Put external GIC into state struct Date: Thu, 21 Apr 2022 12:18:30 +0100 Message-Id: <20220421111846.2011565-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" Switch the creation of the external GIC to the new-style "embedded in state struct" approach, so we can easily refer to the object elsewhere during realize. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-9-peter.maydell@linaro.org --- include/hw/arm/exynos4210.h | 2 ++ include/hw/intc/exynos4210_gic.h | 43 ++++++++++++++++++++++++++++++++ hw/arm/exynos4210.c | 10 ++++---- hw/intc/exynos4210_gic.c | 17 ++----------- MAINTAINERS | 2 +- 5 files changed, 53 insertions(+), 21 deletions(-) create mode 100644 include/hw/intc/exynos4210_gic.h diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index d83e96a091e..f35ae90000f 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -27,6 +27,7 @@ #include "hw/or-irq.h" #include "hw/sysbus.h" #include "hw/cpu/a9mpcore.h" +#include "hw/intc/exynos4210_gic.h" #include "target/arm/cpu-qom.h" #include "qom/object.h" @@ -103,6 +104,7 @@ struct Exynos4210State { qemu_or_irq pl330_irq_orgate[EXYNOS4210_NUM_DMA]; qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS]; A9MPPrivState a9mpcore; + Exynos4210GicState ext_gic; }; #define TYPE_EXYNOS4210_SOC "exynos4210" diff --git a/include/hw/intc/exynos4210_gic.h b/include/hw/intc/exynos4210_gic.h new file mode 100644 index 00000000000..f64c4069c6d --- /dev/null +++ b/include/hw/intc/exynos4210_gic.h @@ -0,0 +1,43 @@ +/* + * Samsung exynos4210 GIC implementation. Based on hw/arm_gic.c + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. + * All rights reserved. + * + * Evgeny Voevodin + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ +#ifndef HW_INTC_EXYNOS4210_GIC_H +#define HW_INTC_EXYNOS4210_GIC_H + +#include "hw/sysbus.h" + +#define TYPE_EXYNOS4210_GIC "exynos4210.gic" +OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210GicState, EXYNOS4210_GIC) + +#define EXYNOS4210_GIC_NCPUS 2 + +struct Exynos4210GicState { + SysBusDevice parent_obj; + + MemoryRegion cpu_container; + MemoryRegion dist_container; + MemoryRegion cpu_alias[EXYNOS4210_GIC_NCPUS]; + MemoryRegion dist_alias[EXYNOS4210_GIC_NCPUS]; + uint32_t num_cpu; + DeviceState *gic; +}; + +#endif diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 742666ba779..2058df9aecf 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -455,10 +455,9 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) sysbus_create_simple("l2x0", EXYNOS4210_L2X0_BASE_ADDR, NULL); /* External GIC */ - dev = qdev_new("exynos4210.gic"); - qdev_prop_set_uint32(dev, "num-cpu", EXYNOS4210_NCPUS); - busdev = SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(busdev, &error_fatal); + qdev_prop_set_uint32(DEVICE(&s->ext_gic), "num-cpu", EXYNOS4210_NCPUS); + busdev = SYS_BUS_DEVICE(&s->ext_gic); + sysbus_realize(busdev, &error_fatal); /* Map CPU interface */ sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_GIC_CPU_BASE_ADDR); /* Map Distributer interface */ @@ -468,7 +467,7 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 1)); } for (n = 0; n < EXYNOS4210_EXT_GIC_NIRQ; n++) { - s->irqs.ext_gic_irq[n] = qdev_get_gpio_in(dev, n); + s->irqs.ext_gic_irq[n] = qdev_get_gpio_in(DEVICE(&s->ext_gic), n); } /* Internal Interrupt Combiner */ @@ -686,6 +685,7 @@ static void exynos4210_init(Object *obj) } object_initialize_child(obj, "a9mpcore", &s->a9mpcore, TYPE_A9MPCORE_PRIV); + object_initialize_child(obj, "ext-gic", &s->ext_gic, TYPE_EXYNOS4210_GIC); } static void exynos4210_class_init(ObjectClass *klass, void *data) diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c index d8cad537fbf..71a88c86bc1 100644 --- a/hw/intc/exynos4210_gic.c +++ b/hw/intc/exynos4210_gic.c @@ -27,6 +27,7 @@ #include "qemu/module.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/intc/exynos4210_gic.h" #include "hw/arm/exynos4210.h" #include "qom/object.h" @@ -44,20 +45,6 @@ #define EXYNOS4210_GIC_CPU_REGION_SIZE 0x100 #define EXYNOS4210_GIC_DIST_REGION_SIZE 0x1000 -#define TYPE_EXYNOS4210_GIC "exynos4210.gic" -OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210GicState, EXYNOS4210_GIC) - -struct Exynos4210GicState { - SysBusDevice parent_obj; - - MemoryRegion cpu_container; - MemoryRegion dist_container; - MemoryRegion cpu_alias[EXYNOS4210_NCPUS]; - MemoryRegion dist_alias[EXYNOS4210_NCPUS]; - uint32_t num_cpu; - DeviceState *gic; -}; - static void exynos4210_gic_set_irq(void *opaque, int irq, int level) { Exynos4210GicState *s = (Exynos4210GicState *)opaque; @@ -100,7 +87,7 @@ static void exynos4210_gic_realize(DeviceState *dev, Error **errp) * enough room for the cpu numbers. gcc 9.2.1 on 32-bit x86 * doesn't figure this out, otherwise and gives spurious warnings. */ - assert(n <= EXYNOS4210_NCPUS); + assert(n <= EXYNOS4210_GIC_NCPUS); for (i = 0; i < n; i++) { /* Map CPU interface per SMP Core */ sprintf(cpu_alias_name, "%s%x", cpu_prefix, i); diff --git a/MAINTAINERS b/MAINTAINERS index dcedfaed1f1..294c88ace9b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -648,7 +648,7 @@ M: Peter Maydell L: qemu-arm@nongnu.org S: Odd Fixes F: hw/*/exynos* -F: include/hw/arm/exynos4210.h +F: include/hw/*/exynos* Calxeda Highbank M: Rob Herring From patchwork Thu Apr 21 11:18:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564323 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp346900map; Thu, 21 Apr 2022 04:30:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBUkdSvVwYhsBuVLMGPr31EJ9aN1cSzRjjnYN5LTfCB1RVihFzeIt9+rjY4SkQhC0QcoN0 X-Received: by 2002:a05:622a:1905:b0:2f3:5337:2edf with SMTP id w5-20020a05622a190500b002f353372edfmr415991qtc.630.1650540604512; Thu, 21 Apr 2022 04:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540604; cv=none; d=google.com; s=arc-20160816; b=LmOEI5M8VhrMDLnZBN4IV4+Bnlx+gGZdpzGPAltsuosHc7RmgrkKpRzGanO4YNXMnF KPAmW29FUIY0LDsXk66bBnLs7Sw3pv1gQF5HceFtJaNj6aaEp5A7kk4Jg5664rCmI8ik v+dk6m9L7V/JAm5xbmfn/xpF5sXJwlpG4iJ6ChxtjOd0QvaWvevpvfSYTIkF+IhvdBx5 7AcPkZrvxOT7XcJodILa4Y7MBN1QJZe35UNefXNEIFjiCtRxWxWLe20WGYCb5mFwHAE6 9Er62A2detmDbDCtA1HoLBQc5n/uuhSZOIJ+kv92WnGLuXGZb79Okng7Ut3m2ZMA2xuz 1z0Q== 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=/ffir/t2Hx0u1CtjBTRNm3H/5/bT+TQ8gxlGGj0T27Q=; b=ST2YS1+dXgkezb0shvs5i+x7da0ckRM7cByKdnwvdwvQjI/1MppR5xbsy69oN+yQxi uiXVF8kdve2MuNADRE7mTZW9vAP0X+xxAEVbb3AuYxnjv+ttv+N96HL8VnMDp8TPrtWx pt7/3Ncf4PTr8ahTkvTfEvGTOL+MyJsKBlVcSfx4PhUjzDfAnxZw844ulenporzIUXM1 +8YK1TKcxYqEXC5TWArSmsYl5VAa1K1ApKu5ycTO1jBKcG0h4rQ+Sk5mb5y2x2JZNzXr fSoY/zXC5Pl/ulhjAcxQiK4yrt3Mz6U8cCO88//reWH9uOcB9q0f1r5jxMKwIYyekECi mDDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=br+s5mkL; 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 o85-20020a37a558000000b0069ec230b0d4si1239733qke.338.2022.04.21.04.30.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:30:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=br+s5mkL; 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]:50166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhV0d-0000rz-0t for patch@linaro.org; Thu, 21 Apr 2022 07:30:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUq1-00036s-Nc for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:06 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:35748) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUpz-0003VB-TB for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:05 -0400 Received: by mail-wr1-x42c.google.com with SMTP id k22so6228648wrd.2 for ; Thu, 21 Apr 2022 04:19:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=/ffir/t2Hx0u1CtjBTRNm3H/5/bT+TQ8gxlGGj0T27Q=; b=br+s5mkL5fknQLnUEEjkazjt+BUZLYKwxAwJg22m7cPqwhiUsTYtNuTSw0GzCAS4ZB o+qosPgMSYfVlgXw+hDkwRbHnP+QY5TODlreOZ1ry2XJDkHLaI5VZWyaWu9R4s1Ha06e wgvJlgbPq4O/0OkwaSs/PNUzBSWEs8+/YqojC4iJVcudbnh6R7mPEOTkdQ+VWaG1QHeU uaPVMEv+XpPNj3+xKGXaolgLKzKa1ssbU7x3g/ID5GUO1raIWzyK1GuzqnheKYYoGJp9 XpZXBJwkpsreajfZoT4g8uNhk7HugBinsz3VPtnbUu4EDulTtK0+kSj8bwS2NSCBWYgD kVAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/ffir/t2Hx0u1CtjBTRNm3H/5/bT+TQ8gxlGGj0T27Q=; b=cG79vDgURjaJBY9eqmMDykrSp9EIHOPtDVde9abFlWPcnfgP1c2XVdPAmudMS/lbTJ VOLQlu/fNUcF5EQ1H98NOnepVpZXB/AIbDiKWXNIZ9am1SzYHAqyGFactApz2NgHrnn9 y/GFrRIMZ2lDS8zWymsudc66Pyh/9KZhq1p/2c8zD/u3mrkatz8ZyTAGxmZnSdLizuDo zKwrZrhbJ0YtqFkKHgvugy4jLzbq8o4iqpkdhFfm67wb3ZDFct2Tkb6pyu12Hqyzc1Ve c4+Ch/Sxe7zk4OINxnkthC+p32Xe/syKAk+YUVA/UGX+DwPdke6Wf3ABu0LTWJ0baNSm xRBQ== X-Gm-Message-State: AOAM531XuxsNKfguJZ0kqtqTNK0BeJPxCUBP6cXTiAvqnuFduMEicX+6 Odg8rW/s8DBLWL8zhW8DJr6EpbjAapMqdg== X-Received: by 2002:adf:e687:0:b0:207:a4c4:b928 with SMTP id r7-20020adfe687000000b00207a4c4b928mr18988594wrm.629.1650539942598; Thu, 21 Apr 2022 04:19:02 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:02 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/31] hw/arm/exynos4210: Drop ext_gic_irq[] from Exynos4210Irq struct Date: Thu, 21 Apr 2022 12:18:31 +0100 Message-Id: <20220421111846.2011565-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" The only time we use the ext_gic_irq[] array in the Exynos4210Irq struct is during realize of the SoC -- we initialize it with the input IRQs of the external GIC device, and then connect those to outputs of other devices further on in realize (including in the exynos4210_init_board_irqs() function). Now that the ext_gic object is easily accessible as s->ext_gic we can make the connections directly from one device to the other without going via this array. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-10-peter.maydell@linaro.org --- include/hw/arm/exynos4210.h | 1 - hw/arm/exynos4210.c | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index f35ae90000f..08f52c511ff 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -83,7 +83,6 @@ typedef struct Exynos4210Irq { qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ]; - qemu_irq ext_gic_irq[EXYNOS4210_EXT_GIC_NIRQ]; } Exynos4210Irq; struct Exynos4210State { diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 2058df9aecf..5a41af089f9 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -257,6 +257,7 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) { uint32_t grp, bit, irq_id, n; Exynos4210Irq *is = &s->irqs; + DeviceState *extgicdev = DEVICE(&s->ext_gic); for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) { irq_id = 0; @@ -272,7 +273,8 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) } if (irq_id) { s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], - is->ext_gic_irq[irq_id - 32]); + qdev_get_gpio_in(extgicdev, + irq_id - 32)); } else { s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], is->ext_combiner_irq[n]); @@ -287,7 +289,8 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) if (irq_id) { s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], - is->ext_gic_irq[irq_id - 32]); + qdev_get_gpio_in(extgicdev, + irq_id - 32)); } } } @@ -466,9 +469,6 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) sysbus_connect_irq(busdev, n, qdev_get_gpio_in(DEVICE(&s->cpu_irq_orgate[n]), 1)); } - for (n = 0; n < EXYNOS4210_EXT_GIC_NIRQ; n++) { - s->irqs.ext_gic_irq[n] = qdev_get_gpio_in(DEVICE(&s->ext_gic), n); - } /* Internal Interrupt Combiner */ dev = qdev_new("exynos4210.combiner"); @@ -487,7 +487,7 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) busdev = SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(busdev, &error_fatal); for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) { - sysbus_connect_irq(busdev, n, s->irqs.ext_gic_irq[n]); + sysbus_connect_irq(busdev, n, qdev_get_gpio_in(DEVICE(&s->ext_gic), n)); } exynos4210_combiner_get_gpioin(&s->irqs, dev, 1); sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_COMBINER_BASE_ADDR); From patchwork Thu Apr 21 11:18:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564331 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp352590map; Thu, 21 Apr 2022 04:37:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3zE1CpJUr1G/LsyrvYXeauylJ6zbJr6Xm393HOPP8q6olrgCvH46NstK5/xCCGAdNmIjX X-Received: by 2002:a05:620a:c55:b0:67e:125b:38ea with SMTP id u21-20020a05620a0c5500b0067e125b38eamr14945755qki.396.1650541051120; Thu, 21 Apr 2022 04:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650541051; cv=none; d=google.com; s=arc-20160816; b=nouORoOYlKlyS5cQPlZuQ7ji2QSdJTuZOwyCOObc9y0mfrWcCqmJzQWp8XrZTdYqth tYNGoM6uyDBAkzClKGeompIWXm8i9Bl02xmpoQqoOwNH442J58Amh54ncsM3w7WXahlW R8CgzOhquX2Vub3mDJR9qMvH+37AnHSL6MEIijWyaHwLzWhHzkynPH1m7Set72uRf4Hc awgPK33lRLKVts5e1w2Z7a5cBasQmRFZ990C0yU6qS+i5ylx3/oyLZneac12aW2eSe8p PbuKDeR+NV5sNhOa8ADbU+KiRTL/DKcHqC0GXbrH2Y4SO4VWigI04LxRp8AOHV9tXux1 1TDg== 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=+j9q4V2tfWLss3L7M8noxjW9hKFspam5EgiESVzgKr8=; b=FMMa1QoVlNGVsWSnIMZk1jXwWJL81IOiYGoh6qIEzFd1cuOPQj7Es9nT/a8+JbEV2L LYancLDTnWJyO64SmDrGl0vjpl+1m01Wm+eitwjbkKdyEHHlg1IEWwzj8ZWNqzzjVHn9 5Oyy0Wkr6jyRLwFCs6amgdmYeS3PX0oeQcbNPE891x59VWBZnyQPRiFjbL7ivNKJr3Rk V7ZSMjUbhTX+qrUHz/VwZMBbqLSiaD8CHbBmp/ydK8A9hrv5HyImNJ9d2/fjMzJ8g8hw jj0rpGQsnu8HVF/Egy5zUqPvRlZriloFWLe2Ey/SG/dcJhivZEDsGZLxaFGDxwSsAiag 2veA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qqHja5fh; 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 f10-20020ac87f0a000000b002f1fa4af7c8si1359091qtk.668.2022.04.21.04.37.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:37:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qqHja5fh; 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]:39006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhV7q-0005NH-L7 for patch@linaro.org; Thu, 21 Apr 2022 07:37:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUq3-00038H-1g for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:07 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:40521) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUq0-0003VP-Ti for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:06 -0400 Received: by mail-wm1-x32e.google.com with SMTP id v64-20020a1cac43000000b0038cfd1b3a6dso5635129wme.5 for ; Thu, 21 Apr 2022 04:19:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+j9q4V2tfWLss3L7M8noxjW9hKFspam5EgiESVzgKr8=; b=qqHja5fhYrGXsGbPswB0HsAJx6HaUk3AKol4573I3LjVDja13GBsheEg0vvUdXTbIo gbTOojWYja759m0mkfWuE5RPBjuZdvXo0BqxMP9U/NnTr9ZLCsYqXe2AKJnLghppOBmn dmWEjCM9ab0LGWcHcE4prZ9XTVN7+UUtfBeJGIATW/+kFgdGx5DJHA91rjkx6Qd4zIeh jOgNpyJbi1u+VUkGF+cVKxacMTNT8vm5A6jSRCWHo9fvaFTfS2BtEbpDdO5a0lrAhl4A GeUljrjMcv9i4SdGkD/CE/lWU1WA0aY3H2dWFW8OZRFRj/OE+wN9iV2zBkf8Qk9LpjrW mWPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+j9q4V2tfWLss3L7M8noxjW9hKFspam5EgiESVzgKr8=; b=UXZhDLaI1CES78gIc1riZMxA+ieDGHfdxVMhfTvdobrxBVTiGbrnTvfjnpPi8qHDG8 Y3x+GhhDMBZKJStidjr8cnQ/eGaSxEtBhZINeo5L9C6oWLZagoE6eDi0B/1Aaa02yXYF CqtxJsMVU43ORnnN8+G2+BaxcCk4PmbOhN1GzCLk+H4l9Bu134eDPnQ+RW6f0aLpDcWG XUDfBTLluBgMwF8zfnU5BR/9PgTPf1h2AajC1LkMmodOl+YnwbwZ+21BIAOxjhoNbeUG yYAdptGunT3fphjNCz+kW5dzxA0Am625kB3UcFS4dBm3BYnEttage9aBdPXOGTTZoWZ2 +8vQ== X-Gm-Message-State: AOAM533B0v1Qxt8JLKeAsJPQ6sKDrx11DVRI+iFDPLfXL9MMpY/fe8AH 3eRjMA5K6pVDV+A9vZlMAi/M1KihjJadPQ== X-Received: by 2002:a05:600c:4f56:b0:392:4cd4:b161 with SMTP id m22-20020a05600c4f5600b003924cd4b161mr8238111wmq.178.1650539943498; Thu, 21 Apr 2022 04:19:03 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:03 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/31] hw/arm/exynos4210: Move exynos4210_combiner_get_gpioin() into exynos4210.c Date: Thu, 21 Apr 2022 12:18:32 +0100 Message-Id: <20220421111846.2011565-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The function exynos4210_combiner_get_gpioin() currently lives in exynos4210_combiner.c, but it isn't really part of the combiner device itself -- it is a function that implements the wiring up of some interrupt sources to multiple combiner inputs. Move it to live with the other SoC-level code in exynos4210.c, along with a few macros previously defined in exynos4210.h which are now used only in exynos4210.c. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-11-peter.maydell@linaro.org --- include/hw/arm/exynos4210.h | 11 ----- hw/arm/exynos4210.c | 82 +++++++++++++++++++++++++++++++++++ hw/intc/exynos4210_combiner.c | 77 -------------------------------- 3 files changed, 82 insertions(+), 88 deletions(-) diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index 08f52c511ff..b564e3582bb 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -67,11 +67,6 @@ #define EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ \ (EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ * 8) -#define EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit) ((grp)*8 + (bit)) -#define EXYNOS4210_COMBINER_GET_GRP_NUM(irq) ((irq) / 8) -#define EXYNOS4210_COMBINER_GET_BIT_NUM(irq) \ - ((irq) - 8 * EXYNOS4210_COMBINER_GET_GRP_NUM(irq)) - /* IRQs number for external and internal GIC */ #define EXYNOS4210_EXT_GIC_NIRQ (160-32) #define EXYNOS4210_INT_GIC_NIRQ 64 @@ -118,12 +113,6 @@ void exynos4210_write_secondary(ARMCPU *cpu, * bit - bit number inside group */ uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit); -/* - * Get Combiner input GPIO into irqs structure - */ -void exynos4210_combiner_get_gpioin(Exynos4210Irq *irqs, DeviceState *dev, - int ext); - /* * exynos4210 UART */ diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 5a41af089f9..86a9a0dae12 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -249,6 +249,11 @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { { }, { }, { }, { }, { }, { }, { }, { }, { }, { } }; +#define EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit) ((grp) * 8 + (bit)) +#define EXYNOS4210_COMBINER_GET_GRP_NUM(irq) ((irq) / 8) +#define EXYNOS4210_COMBINER_GET_BIT_NUM(irq) \ + ((irq) - 8 * EXYNOS4210_COMBINER_GET_GRP_NUM(irq)) + /* * Initialize board IRQs. * These IRQs contain splitted Int/External Combiner and External Gic IRQs. @@ -306,6 +311,83 @@ uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit) return EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit); } +/* + * Get Combiner input GPIO into irqs structure + */ +static void exynos4210_combiner_get_gpioin(Exynos4210Irq *irqs, + DeviceState *dev, int ext) +{ + int n; + int bit; + int max; + qemu_irq *irq; + + max = ext ? EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ : + EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; + irq = ext ? irqs->ext_combiner_irq : irqs->int_combiner_irq; + + /* + * Some IRQs of Int/External Combiner are going to two Combiners groups, + * so let split them. + */ + for (n = 0; n < max; n++) { + + bit = EXYNOS4210_COMBINER_GET_BIT_NUM(n); + + switch (n) { + /* MDNIE_LCD1 INTG1 */ + case EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 0) ... + EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 3): + irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), + irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(0, bit + 4)]); + continue; + + /* TMU INTG3 */ + case EXYNOS4210_COMBINER_GET_IRQ_NUM(3, 4): + irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), + irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(2, bit)]); + continue; + + /* LCD1 INTG12 */ + case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 0) ... + EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 3): + irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), + irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(11, bit + 4)]); + continue; + + /* Multi-Core Timer INTG12 */ + case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4) ... + EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 8): + irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), + irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); + continue; + + /* Multi-Core Timer INTG35 */ + case EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 4) ... + EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 8): + irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), + irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); + continue; + + /* Multi-Core Timer INTG51 */ + case EXYNOS4210_COMBINER_GET_IRQ_NUM(51, 4) ... + EXYNOS4210_COMBINER_GET_IRQ_NUM(51, 8): + irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), + irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); + continue; + + /* Multi-Core Timer INTG53 */ + case EXYNOS4210_COMBINER_GET_IRQ_NUM(53, 4) ... + EXYNOS4210_COMBINER_GET_IRQ_NUM(53, 8): + irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), + irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); + continue; + } + + irq[n] = qdev_get_gpio_in(dev, n); + } +} + static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43, 0x09, 0x00, 0x00, 0x00 }; diff --git a/hw/intc/exynos4210_combiner.c b/hw/intc/exynos4210_combiner.c index 4534ee248db..83b42b9bce1 100644 --- a/hw/intc/exynos4210_combiner.c +++ b/hw/intc/exynos4210_combiner.c @@ -105,83 +105,6 @@ static const VMStateDescription vmstate_exynos4210_combiner = { } }; -/* - * Get Combiner input GPIO into irqs structure - */ -void exynos4210_combiner_get_gpioin(Exynos4210Irq *irqs, DeviceState *dev, - int ext) -{ - int n; - int bit; - int max; - qemu_irq *irq; - - max = ext ? EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ : - EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; - irq = ext ? irqs->ext_combiner_irq : irqs->int_combiner_irq; - - /* - * Some IRQs of Int/External Combiner are going to two Combiners groups, - * so let split them. - */ - for (n = 0; n < max; n++) { - - bit = EXYNOS4210_COMBINER_GET_BIT_NUM(n); - - switch (n) { - /* MDNIE_LCD1 INTG1 */ - case EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 0) ... - EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 3): - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(0, bit + 4)]); - continue; - - /* TMU INTG3 */ - case EXYNOS4210_COMBINER_GET_IRQ_NUM(3, 4): - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(2, bit)]); - continue; - - /* LCD1 INTG12 */ - case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 0) ... - EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 3): - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(11, bit + 4)]); - continue; - - /* Multi-Core Timer INTG12 */ - case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4) ... - EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 8): - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); - continue; - - /* Multi-Core Timer INTG35 */ - case EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 4) ... - EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 8): - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); - continue; - - /* Multi-Core Timer INTG51 */ - case EXYNOS4210_COMBINER_GET_IRQ_NUM(51, 4) ... - EXYNOS4210_COMBINER_GET_IRQ_NUM(51, 8): - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); - continue; - - /* Multi-Core Timer INTG53 */ - case EXYNOS4210_COMBINER_GET_IRQ_NUM(53, 4) ... - EXYNOS4210_COMBINER_GET_IRQ_NUM(53, 8): - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); - continue; - } - - irq[n] = qdev_get_gpio_in(dev, n); - } -} - static uint64_t exynos4210_combiner_read(void *opaque, hwaddr offset, unsigned size) { From patchwork Thu Apr 21 11:18:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564337 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp359232map; Thu, 21 Apr 2022 04:47:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNiroA+YLWRQrcyYqUp5mV3Iw2B0xgZLA6c4HIFDk6MnXA9KhgqHR1hAmAHHmbNLCg/thZ X-Received: by 2002:a05:622a:1715:b0:2f1:fa51:d766 with SMTP id h21-20020a05622a171500b002f1fa51d766mr14407125qtk.430.1650541672344; Thu, 21 Apr 2022 04:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650541672; cv=none; d=google.com; s=arc-20160816; b=CjPc15UeSbdQKlpDEmQSuLOOP+nbLUvp/funu3a1DeGuRCzvoenB6Ii/b8pO/OUXkq gREPn0Gndk72O+EyP8/eKJy+DLvuWj5xxKupYb9Eqlomd/CiYQM8UipFjieWsvlOrdwR ydZ9RsaXlqNUz5c8DL64IWkteJE1abD++N5yZSKxxV9trlavHrG58wGtXA2ZaH8j6MUE x2LwCIIdzRgPPqj/3BBlqQuzaAKdziAy6Ipgi1IUSw0O97siXEbyrGKQzDp2ZhvcDvKt jnwutdUGcZARDeQTB0gx7KGfO0KyOa7ig5s7t/9s2GMa9sd8+Es2QIO3JGL7+LMJF9/r hLqw== 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=Iwx4JxobNFjb6CXW4X/ZTu+ghI+lexKYib3ejhFEP0M=; b=M8vejmqBELujtyfcb/fXbw9QJfirDKqiypWXyZjiruocAo/0QXHjCJDQTdsNEkuMJO HzY2LFpoCI7CC6fQlWiuyUkTVYIou7pVy0YoX0pRLBKJdjJF++vngjH7zYKzVogtQDI7 ppSUAPccA5ErZ4CcHbtPIPYuPsFlqceromSra5VzvoDGBDa4SbQmC3u/S9+9JUQ5miTN NHl63cWL5YlDCXu8ZuFBZF1Ab7f5q50InpLDC7lbQ6DYx3kJGrnXo3TVfVWJ5E5/GNEW MGJBb8PaG17CcbpvEYp9nWZ5V7aQRboCxlRLcJF8QH/qt/yMy2eJaU0lAszfcwkBov8F mLEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kdgkb46s; 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 e8-20020ac84e48000000b002f3545c4348si3897qtw.7.2022.04.21.04.47.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:47:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kdgkb46s; 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]:56294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhVHr-0000v4-W3 for patch@linaro.org; Thu, 21 Apr 2022 07:47:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUq3-00038e-3N for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:07 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:35753) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUq1-0003VX-IG for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:06 -0400 Received: by mail-wr1-x431.google.com with SMTP id k22so6228755wrd.2 for ; Thu, 21 Apr 2022 04:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Iwx4JxobNFjb6CXW4X/ZTu+ghI+lexKYib3ejhFEP0M=; b=Kdgkb46swUg7oAnpP59auRbM8I2cxAKaoMOng966/zqzj+G7BIJglFKB99pn7U6zo7 yZrDCCcIO5KGWGN6T7pAgzPAMHbsr8j6/CbWUqE9wGPnFh/uGBFhafqZ9NokoL+nQyZ7 f7V6T67mjTMr6UJ+YNj01K1ZgeKjvUGUWHpZ7ewhVKCN5Als+zh63/uZnF8srqV3bgWu OLf0CBxYX2D8Jo6tn1O67oDtTTkY+j6GlSEVn5gC57BegI5eG8+2joBS7SE2yDxJwTVC ncTjWKAWT0oR/uyZb0RLNXdL9S3S+pQi9Ed7seCTobHhdenZGrKmzLMZzXCv16UvEIRn AZcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Iwx4JxobNFjb6CXW4X/ZTu+ghI+lexKYib3ejhFEP0M=; b=gQhKRp1vkCZEBL6EgojzsMYomEmAWakzLSyzTP/wAgxrKHea4ZzzgiE9AxjJOdaQhW dDu/62EsnmZi+4p6BcctZ5WBtnI6MS8HOGvBxk/B7dmdSQXZ5AZ74EL3mXwbtXbSv6Vr GLjHlHwmuiV6aVT7X26GOUvJUYU2WZgT2nKzrHu/A6BJ7gKWXeBnDL4ngHnTiCFIxl9B wTn2ZT8qMp8Ff4xopXbZK/HlyVI0Onjxja2UN2O+Lx6SFen3Z2lxkq9VMIzQ4wAYs6Xm C2RJIF9whq68Z/YwFPOrrU229sBRzxML5mx+psBXU6CutA1sFL/346d+hGHMcJ8D1h/+ 4Bfg== X-Gm-Message-State: AOAM532bU9mFIC8cqS+rzaf874Uu/AIICGc+hE3eKkGzGMgmqMCujV/Q d2W/oSm5MtClASFmcyGMKPEBaptvvajuaQ== X-Received: by 2002:a05:6000:156a:b0:20a:9c1b:6b1b with SMTP id 10-20020a056000156a00b0020a9c1b6b1bmr13221774wrz.683.1650539944279; Thu, 21 Apr 2022 04:19:04 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:03 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/31] hw/arm/exynos4210: Delete unused macro definitions Date: Thu, 21 Apr 2022 12:18:33 +0100 Message-Id: <20220421111846.2011565-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" Delete a couple of #defines which are never used. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-12-peter.maydell@linaro.org --- include/hw/arm/exynos4210.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index b564e3582bb..f0769a4045b 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -67,10 +67,6 @@ #define EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ \ (EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ * 8) -/* IRQs number for external and internal GIC */ -#define EXYNOS4210_EXT_GIC_NIRQ (160-32) -#define EXYNOS4210_INT_GIC_NIRQ 64 - #define EXYNOS4210_I2C_NUMBER 9 #define EXYNOS4210_NUM_DMA 3 From patchwork Thu Apr 21 11:18:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564326 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp349945map; Thu, 21 Apr 2022 04:33:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4T2T3NXie8a0RehwIMYZJaqbzDHg0sk33uvsXEVlZuGkddOEmKgij7fCpVirEcfBe5aqi X-Received: by 2002:a05:622a:14:b0:2f2:4f0:a6d4 with SMTP id x20-20020a05622a001400b002f204f0a6d4mr11226570qtw.373.1650540827805; Thu, 21 Apr 2022 04:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650540827; cv=none; d=google.com; s=arc-20160816; b=t+wRRHquvQKjiEFulKGMT8eSdaKnoFFw8OspW6JjEzXOYz369OzdVMyuGmU5aTjPiT Ut00CQIORL+pF2YgydKJj+z/14Qy5Cf6jhCAaCLYmumps6JIoDSnmwMrsBXOFzs909xJ gFAfi3FbuWHlXKjh9j2DrRN/LP9I0X5oKrNmvIPgd4ADtLt5lKZFueXF/SrdHy5Hy9+L BIzOXjb9wjkdCO0KmTVX4yI/6JcMuaKH77PjdCEbIMeo6+tDAnub/iyguPYqVPwzxTDu JJEi+l64/IYw7TaWpjWOq94G4X8SrR15aiyQmUMIEYuhddLCJfr2S7382gRSzYoFPMqZ atng== 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=6iEh6vhBWVu8vdp664MaCGIOBRqTLHZP+x0CHEhw0js=; b=CH6XE8cEBFX30bLV0hJKFqu+ZYWXpaskOfaulM6DTKl5tHUpVJ2hsnUqeXEn6pkdii rKMFrAJCt9ZyjwXtq7onJQ2CT3lKASnvmilWbpRGxq/+EBYZ9eU3FxgOvpa02P2Zf5+z GmnT3BEizz8c7+tF4i9nScLZ6vSE86wUZacgWX6bk0i5rNR7jlk3SUO9aP/YpMnZUtQU MniAbb7qCiVc1+SWFWeij92J++qZ/+bJZSM51hCo3lDOpit0MW51BkL80mx0rf1v/1In gWshZqHeY6Qpcu+j+cV15EuvLMmb+NSFuTj9mroordlrE6N7J8CRsA07qJUv+6BSmj9b WcbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fm30hB+y; 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 j14-20020a05621419ce00b0044652f9c825si1392037qvc.393.2022.04.21.04.33.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:33:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fm30hB+y; 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]:57008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhV4F-0006FV-CU for patch@linaro.org; Thu, 21 Apr 2022 07:33:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUq5-0003AC-3F for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:10 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:41812) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUq2-0003Vn-EF for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:08 -0400 Received: by mail-wr1-x42c.google.com with SMTP id s25so1326008wrb.8 for ; Thu, 21 Apr 2022 04:19:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=6iEh6vhBWVu8vdp664MaCGIOBRqTLHZP+x0CHEhw0js=; b=Fm30hB+yVssk93ZtLO9H3OCgJ/vc2BiWLPA7lgfLDj/QcTjk3HDqW9hdzflhnzzTza sml/i3TJ2Q5w53rmmhx3kPVjOvJTWoN3ZA6eIushhhLOPKNWfVH129QFKN6/6PPD3dgP dXleNo6/nQfvgo+UhWTcx2ZLRTZ8C/j4vU+0hm05DmGT3DWTTcxJxINm5e7QnepCPP7h /R6USRYGkvxlq340C8dUUoWmam38nex5ro0b9TyIqZFYErCxfmJRGH5NTjhx/dtSUT7E /7lAReiPYVt4UPRQk1+49fDo7WtFd1sjDum1jbcJMI/S3mzwdCqqMSlWqiuDNTJQzWWX wRPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6iEh6vhBWVu8vdp664MaCGIOBRqTLHZP+x0CHEhw0js=; b=y1sf7AW3dLX9PTXIio4YRtrmOL2wL5HFYwDaGQMXiwPBWa2ZC01q8MojvG2AIKkBnu vId5kgk9x8LQZ6Pg3PKXCwnUqwfGoLx9f88PvpQYbVQbz8bu9xgkV0zebDABe5Wn8By3 E4CG9D6e1nNi9Qj3ElmiJLcJZT1FkQX57cvwa1raD6QJ4qUAXMF8AoND/PW6ybhA3BDO iwRzSv7M/KyeF50/0cnoyEoAkrQ8mKoc01Gtrxt3xE+weXHk5UmrQROELBz3MPiu65Fr FARVCzBDLAgnTuW/IPP943j/QkC+4V9X5jyzARQAMA3KsaBypRpPi5ySCYZQ8eW9WTnw Eefg== X-Gm-Message-State: AOAM531X4Rne7JF7RZjUEUBytBv0NKqhUMEnbFeMY07NLAaKIyPdgek5 EJafr11Z0kIF6a1KbaxTZBDFPFqZMPMCRA== X-Received: by 2002:adf:f2cb:0:b0:20a:77c2:3958 with SMTP id d11-20020adff2cb000000b0020a77c23958mr18539139wrp.589.1650539945226; Thu, 21 Apr 2022 04:19:05 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:04 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/31] hw/arm/exynos4210: Use TYPE_SPLIT_IRQ in exynos4210_init_board_irqs() Date: Thu, 21 Apr 2022 12:18:34 +0100 Message-Id: <20220421111846.2011565-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" In exynos4210_init_board_irqs(), use the TYPE_SPLIT_IRQ device instead of qemu_irq_split(). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-13-peter.maydell@linaro.org --- include/hw/arm/exynos4210.h | 9 ++++++++ hw/arm/exynos4210.c | 41 +++++++++++++++++++++++++++++-------- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index f0769a4045b..f58ee0f2686 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -28,6 +28,7 @@ #include "hw/sysbus.h" #include "hw/cpu/a9mpcore.h" #include "hw/intc/exynos4210_gic.h" +#include "hw/core/split-irq.h" #include "target/arm/cpu-qom.h" #include "qom/object.h" @@ -71,6 +72,13 @@ #define EXYNOS4210_NUM_DMA 3 +/* + * We need one splitter for every external combiner input, plus + * one for every non-zero entry in combiner_grp_to_gic_id[]. + * We'll assert in exynos4210_init_board_irqs() if this is wrong. + */ +#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 60) + typedef struct Exynos4210Irq { qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ]; @@ -95,6 +103,7 @@ struct Exynos4210State { qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS]; A9MPPrivState a9mpcore; Exynos4210GicState ext_gic; + SplitIRQ splitter[EXYNOS4210_NUM_SPLITTERS]; }; #define TYPE_EXYNOS4210_SOC "exynos4210" diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 86a9a0dae12..919821833b5 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -263,6 +263,8 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) uint32_t grp, bit, irq_id, n; Exynos4210Irq *is = &s->irqs; DeviceState *extgicdev = DEVICE(&s->ext_gic); + int splitcount = 0; + DeviceState *splitter; for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) { irq_id = 0; @@ -276,13 +278,19 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) /* MCT_G1 is passed to External and GIC */ irq_id = EXT_GIC_ID_MCT_G1; } + + assert(splitcount < EXYNOS4210_NUM_SPLITTERS); + splitter = DEVICE(&s->splitter[splitcount]); + qdev_prop_set_uint16(splitter, "num-lines", 2); + qdev_realize(splitter, NULL, &error_abort); + splitcount++; + s->irq_table[n] = qdev_get_gpio_in(splitter, 0); + qdev_connect_gpio_out(splitter, 0, is->int_combiner_irq[n]); if (irq_id) { - s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], - qdev_get_gpio_in(extgicdev, - irq_id - 32)); + qdev_connect_gpio_out(splitter, 1, + qdev_get_gpio_in(extgicdev, irq_id - 32)); } else { - s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], - is->ext_combiner_irq[n]); + qdev_connect_gpio_out(splitter, 1, is->ext_combiner_irq[n]); } } for (; n < EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; n++) { @@ -293,11 +301,23 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][bit]; if (irq_id) { - s->irq_table[n] = qemu_irq_split(is->int_combiner_irq[n], - qdev_get_gpio_in(extgicdev, - irq_id - 32)); + assert(splitcount < EXYNOS4210_NUM_SPLITTERS); + splitter = DEVICE(&s->splitter[splitcount]); + qdev_prop_set_uint16(splitter, "num-lines", 2); + qdev_realize(splitter, NULL, &error_abort); + splitcount++; + s->irq_table[n] = qdev_get_gpio_in(splitter, 0); + qdev_connect_gpio_out(splitter, 0, is->int_combiner_irq[n]); + qdev_connect_gpio_out(splitter, 1, + qdev_get_gpio_in(extgicdev, irq_id - 32)); } } + /* + * We check this here to avoid a more obscure assert later when + * qdev_assert_realized_properly() checks that we realized every + * child object we initialized. + */ + assert(splitcount == EXYNOS4210_NUM_SPLITTERS); } /* @@ -766,6 +786,11 @@ static void exynos4210_init(Object *obj) object_initialize_child(obj, name, &s->cpu_irq_orgate[i], TYPE_OR_IRQ); } + for (i = 0; i < ARRAY_SIZE(s->splitter); i++) { + g_autofree char *name = g_strdup_printf("irq-splitter%d", i); + object_initialize_child(obj, name, &s->splitter[i], TYPE_SPLIT_IRQ); + } + object_initialize_child(obj, "a9mpcore", &s->a9mpcore, TYPE_A9MPCORE_PRIV); object_initialize_child(obj, "ext-gic", &s->ext_gic, TYPE_EXYNOS4210_GIC); } From patchwork Thu Apr 21 11:18:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564330 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp352177map; Thu, 21 Apr 2022 04:36:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylD7BhnI5aRv5ks8p9kdYMDgouRkNb1o3eogZApvt2NCB85GECaAakjhF12p6Yf0QKT6Jr X-Received: by 2002:a05:620a:143:b0:69d:2187:b07a with SMTP id e3-20020a05620a014300b0069d2187b07amr15421442qkn.470.1650541016540; Thu, 21 Apr 2022 04:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650541016; cv=none; d=google.com; s=arc-20160816; b=kTkav8CyfwzNzgKUEjRt+7xXIjfBucroiVIitMPpNr7sTXffoI0GVAEkopJI9XEGxp UnKqxeWNB6VT/8QHjGRNCzz9+8hCOymh41v1ghdIcczGN6ojoNMXbPnnrTuWJ3RqN7Y/ YcRnn3H2bgOwreA1uqR+aHx9BPXE5EwoV6D0zwlyFeNtZyRZ4YA7pvDY9JVa6vz3R/aN 8G3G5eOvcNFXFwCWrTIKaOOWPkqywREFF5oK2TLBITBSqh7wbpekZdkZu82rXiJ92J3r j7jz7EwsskzzdwvKvVm+itHXAszjJ+U1i1vHKjvTHbLycQffcLqPb3tj4y1t++ZTrEo7 PtUQ== 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=1PyZdnk6RoN3xmhb1oq389S8umKBSyZVP3ZN0NOpuv4=; b=OeC8SM6IWS+wmQw4bU4OVHLVcOsOktoj6L2pH1KKRiZQLGX9oWZLUh/jA+L5F6vcV4 2QKCnJNexlvgnGlXDNsVzvQPEVYsed07X5xBh/IcXXw6Ee+RBUt2rczkMfp3UtyiHyBm SnYOXguuxwtwRUlzdOk2DRBXkdR2pqLz6T7DEq/G9xw5RgG/BUGoKnI+qrnCE/NQ847r AQjKyXicrC0KM4/tGN6Eln0hQAR06Kk/cx0OPXIRe1fJiZeScZS7VXC2l6dkNxprl2cv Ng7i2qVaI7nXkqT8R/8ga+NCrO8MSwvu0JPquBaRbGI8dO/g1YFx4/C4ANFMrT7erKaT 5eog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ezgU+k2K; 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 t1-20020a05622a180100b002f35421d672si18722qtc.317.2022.04.21.04.36.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:36:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ezgU+k2K; 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]:37144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhV7I-00047z-52 for patch@linaro.org; Thu, 21 Apr 2022 07:36:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUq5-0003AG-36 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:10 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:38792) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUq3-0003Vx-Bv for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:08 -0400 Received: by mail-wr1-x42c.google.com with SMTP id p18so6214367wru.5 for ; Thu, 21 Apr 2022 04:19:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=1PyZdnk6RoN3xmhb1oq389S8umKBSyZVP3ZN0NOpuv4=; b=ezgU+k2K7uylQi+TnfdXloAlNPAhxPyPYVOnPWz1r98/ZviPpKcyyN1Smw2ArwhNzs dfg8mAphw5kwrUhN7YCKVDwC0cMaNM6SpoP0+YNmcEIhhuK8UarLQCzbTDmop5iq2qX5 4nmXnuE4smBtCUmkxljADcB2Eseyahuaq9ZxUxCpZWEjTfATGfuD5t/vY5pWUQ7hvgz7 GCAo/V0fYJafvDU8n1qvaunaOqgc35C41EXhCVhve4EZxUTXNvpc6tR3v3tFI2aY/ZNr 8PjkHlhpks/e+E2ZgMRHofdNMUTJ0+9ZfOb+8GVkJdhIBqo6E4L2msMz+T3IM5ZRC1vJ uZZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1PyZdnk6RoN3xmhb1oq389S8umKBSyZVP3ZN0NOpuv4=; b=hxR5gqksoaZrsY8Rshzz1wFftY864Ao04a7Clv8VgzwhwR/BTZT/RbMIjiTbRcj44V 9F7pJuFlDKw0CiU3wOUX+EfTWnJYof2zEbkaIY/SV9PIECg8tqwevOefavftmGp7jJvh vdlLGONNU7Eh4p2KGEeA8xOS3wNFjT9oazF2J1X2/9faAYGv0aQu3p/T9StSyM9Zh5PL vNXhCbNHOWOMlJgizIaycM4fvFC4JUfr+wc5piKQxvVicSTYWPg6rU3RLQDGFRvVSinO zmBB0WV0tWMW6b67X3AnwbX2oL+GKQo0JEIMzX1tEP3eARcOGkcMyVQ/23DjTh/67aRk nK/Q== X-Gm-Message-State: AOAM530JTrnLi3drLodmS3aLq7+j0UxVEt3wSDL/BuYQWKU+XkXeLUoz C5LvVqRRzrAjgHao+vjVx7fyr2+3wlwYoA== X-Received: by 2002:adf:ebd2:0:b0:20a:9c10:ab29 with SMTP id v18-20020adfebd2000000b0020a9c10ab29mr13124200wrn.212.1650539946108; Thu, 21 Apr 2022 04:19:06 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:05 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/31] hw/arm/exynos4210: Fill in irq_table[] for internal-combiner-only IRQ lines Date: Thu, 21 Apr 2022 12:18:35 +0100 Message-Id: <20220421111846.2011565-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" In exynos4210_init_board_irqs(), the loop that handles IRQ lines that are in a range that applies to the internal combiner only creates a splitter for those interrupts which go to both the internal combiner and to the external GIC, but it does nothing at all for the interrupts which don't go to the external GIC, leaving the irq_table[] array element empty for those. (This will result in those interrupts simply being lost, not in a QEMU crash.) I don't have a reliable datasheet for this SoC, but since we do wire up one interrupt line in this category (the HDMI I2C device on interrupt 16,1), this seems like it must be a bug in the existing QEMU code. Fill in the irq_table[] entries where we're not splitting the IRQ to both the internal combiner and the external GIC with the IRQ line of the internal combiner. (That is, these IRQ lines go to just one device, not multiple.) This bug didn't have any visible guest effects because the only implemented device that was affected was the HDMI I2C controller, and we never connect any I2C devices to that bus. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-14-peter.maydell@linaro.org --- hw/arm/exynos4210.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 919821833b5..a4527f819ef 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -310,6 +310,8 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) qdev_connect_gpio_out(splitter, 0, is->int_combiner_irq[n]); qdev_connect_gpio_out(splitter, 1, qdev_get_gpio_in(extgicdev, irq_id - 32)); + } else { + s->irq_table[n] = is->int_combiner_irq[n]; } } /* From patchwork Thu Apr 21 11:18:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564334 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp355315map; Thu, 21 Apr 2022 04:41:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtcUoSaGX+OgAscYnULqYyyRy1AOA4Adjxu+2mDZYnI20UdyWw1AxmXWas9ewEAd32tADV X-Received: by 2002:ac8:5795:0:b0:2f1:f9cd:4076 with SMTP id v21-20020ac85795000000b002f1f9cd4076mr14410639qta.549.1650541286836; Thu, 21 Apr 2022 04:41:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650541286; cv=none; d=google.com; s=arc-20160816; b=Bd3JokOgaJJX0vS4rzaRKT7KkPsNsXMmpneuVWfNEAfyodm6eA6w5tT65gaglW7zEe cLZqxeXj2I+NDKl3N3LmtlSUYK9mUWRi/upDT/h4F6tLEfh8f1DZCd37YbYEIkKX2cYF qJwiqpyXpQhSuLMbPxVcmXV84sCPzp7/ezx3vzsWuYMIBfeRIQ3O5+Wj06MRGwH/Oh4P 4Fh3+wLG4fpcrVuiVNXt/OvpDtUUGkAqbufWFwJM81Z2QxzxQy7v/8aVS2bALb59i/D/ 2uA+YXf/IOAv2pABvVIczFbAQgc148G1FcMUg7D4gkCygrKdbQNpFRzWvObKmXO4HSk+ TQIA== 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=eg02MfewzqD34GfCv6gUqyp7N32TaZTJUBAY/UnbV7k=; b=Np4Iq8oJSsAussxoC2qPKR1+ga2Z68BfXFIPM533/PCL73kpBbEEe96YjqrMSbKmcE gD5HoaXq9eIm5DWG0Z5HnI7QAqbwP8TmIuCdmMOEexMh4ulJR+Fk3yHii2nOWWg7XUUt KDGmwBzhT0ecv+/+hZMNaSE7K1y4Cv7jbbJWuaoTnXX5HfBfRaDA77fJHcTkTupZpCSu FkB6aKLpeqOy02eGp4EG2oQpQRpOXDaoeQW3IetGXWOaTM4DP9GVFaFUHTZWYXZ49ask uz7ZfvTAgpBKf27WVAqyGNLx2vVRQnLpFJNTPQ05wUUFcAoweag7Pg/v4Xdy9cpq1jE9 QY1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tUtl+e+D; 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-20020a05620a268800b0069e6f343d66si1408152qkp.268.2022.04.21.04.41.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:41:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tUtl+e+D; 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]:45572 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhVBe-0001T9-EA for patch@linaro.org; Thu, 21 Apr 2022 07:41:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUq6-0003BT-SN for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:10 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:45931) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUq4-0003WH-N1 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:10 -0400 Received: by mail-wr1-x429.google.com with SMTP id w4so6175904wrg.12 for ; Thu, 21 Apr 2022 04:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=eg02MfewzqD34GfCv6gUqyp7N32TaZTJUBAY/UnbV7k=; b=tUtl+e+DxAOnuKU7tEpwTfSmYg3VZ+4yL4j9a6aSeve94IyBU1LaDvbE6HlfMSA9iI 1PyNctNWyj0b6dXeWrM+A5fJbjb22l4MO1W8mXZSyhl0gsAh3pM0gzRSnHs5qJ1WIaxj SKzDzV18Ip2ngRmi5ySJX4rnqZvue8oQeDbnWflGPosNImG3Kq8j6DmNgHmDDyixQtjs Wz10f/R8GxMIBtq5GGKEVohbF+2LhUVz6aeeCzYtlGNJR8pYQKAPNmfd5qd9HktIwYet y3dD3NaPt8vgL06PJpEsmEdA8hip7y2XqWGeYB9o5TS2r2SU3ZcYYz+sl16z/ftBmCNr 4PNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eg02MfewzqD34GfCv6gUqyp7N32TaZTJUBAY/UnbV7k=; b=e3n9bEjFdL45kBxO3Io3aM07ZDO/qvuvx97+An5X2i6G3MynD7qckJ07TNG6ZLyVLI udiOZkgy2k0YIfPS6swTMFTDiRf+nLs+vAX74eyUKJvWjv7hwOwtWmFcFCZ6EQ96JzF6 FhdNIH0S1nSfcvR88wj8pdill5io4nL3/9ENswGugvaBo+onH/zMEwwR2ZVcxLtC4JhA nxc0rtQvGgIDMliHVjfIjh8nmELoRurDt9NWqTDEa6vzkGXc22ijQjk1nkjeqcNjrLwQ sFdEqtm/Bjw08lya+xe7i+kAasiYBFCKyV5by9V4hxTdA7CVzL/rFr0rqafeTOsGnhNP dgnA== X-Gm-Message-State: AOAM533tfqXcDZutJZdvsHGC+Rxj2L2dg4RO3NEghrtafOAe2iHs8fdc HKZg6BvISdtab2lwpn7e1Q/ygZd/SZVbbQ== X-Received: by 2002:a5d:4a81:0:b0:207:9abe:2908 with SMTP id o1-20020a5d4a81000000b002079abe2908mr18819233wrq.341.1650539946907; Thu, 21 Apr 2022 04:19:06 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:06 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/31] hw/arm/exynos4210: Connect MCT_G0 and MCT_G1 to both combiners Date: Thu, 21 Apr 2022 12:18:36 +0100 Message-Id: <20220421111846.2011565-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" Currently for the interrupts MCT_G0 and MCT_G1 which are the only ones in the input range of the external combiner and which are also wired to the external GIC, we connect them only to the internal combiner and the external GIC. This seems likely to be a bug, as all other interrupts which are in the input range of both combiners are connected to both combiners. (The fact that the code in exynos4210_combiner_get_gpioin() is also trying to wire up these inputs on both combiners also suggests this.) Wire these interrupts up to both combiners, like the rest. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-15-peter.maydell@linaro.org --- hw/arm/exynos4210.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index a4527f819ef..962d6d0ac2a 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -281,16 +281,15 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) assert(splitcount < EXYNOS4210_NUM_SPLITTERS); splitter = DEVICE(&s->splitter[splitcount]); - qdev_prop_set_uint16(splitter, "num-lines", 2); + qdev_prop_set_uint16(splitter, "num-lines", irq_id ? 3 : 2); qdev_realize(splitter, NULL, &error_abort); splitcount++; s->irq_table[n] = qdev_get_gpio_in(splitter, 0); qdev_connect_gpio_out(splitter, 0, is->int_combiner_irq[n]); + qdev_connect_gpio_out(splitter, 1, is->ext_combiner_irq[n]); if (irq_id) { - qdev_connect_gpio_out(splitter, 1, + qdev_connect_gpio_out(splitter, 2, qdev_get_gpio_in(extgicdev, irq_id - 32)); - } else { - qdev_connect_gpio_out(splitter, 1, is->ext_combiner_irq[n]); } } for (; n < EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; n++) { From patchwork Thu Apr 21 11:18:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564336 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp356588map; Thu, 21 Apr 2022 04:43:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE8QajylfAA7eW4MqaBjs6wtz4hpbAT4uR0BBTOjCcC7r5FEMmoZh0Om4P0dR3MTjsvPUD X-Received: by 2002:a05:622a:148f:b0:2f3:386b:cda6 with SMTP id t15-20020a05622a148f00b002f3386bcda6mr8255709qtx.660.1650541410210; Thu, 21 Apr 2022 04:43:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650541410; cv=none; d=google.com; s=arc-20160816; b=uRypVWL7LthZBAVN8oGFZAAjr2RfFdSIDNVdahrsgS9p6nVtLJh8bn7DSN8SPRqldp WaJN5J7s3B2plTp3T68ZIidKmMVFTgW4LT4bcpXdEc6duPZJud2ncClv2tuhVuAD5GDV MMf0KMDgJ5ZFzfOwwIPgZm8MlfMg44dopqSkwMd5IzXk0DsE568ZttGk9ggJqkMrf4oW Xl7GEA0F5XkMt8+0ejw9/Uvx/AtaizKlWstbvkQp5w5JS7JtIjCjIq2q4sFlYBM4/nKc lSzknaECWDm9kndD6DCvQqNjWsl8T4vaDV8jPL5Z/DtFy9LohFF2+uHyRYgrenNKP9RC Bh+Q== 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=d+s9Ayr2MToy3NwUrcI6rbLNGvw59lNw6jFaFEZj0pg=; b=oyQn/m4Myi7vU0kNoC+ep8ctV3qaP9Ejk4I6kS0AkjvLh98ZXGpQz3EYcfheIK4mT3 nGeR2cy0mlC4pYvPqIoJonCfJFFfhbJyqdDZiIh0WYzjZW6RTtBaXmjssk3r0d4jRhhY RcCDo4GRpijlCLr1mNe42vfpqMakevO8jcHyXxLVuwdOmqk6GsxmE2rw3E/t/um6ca4G 2DLx6zryQz887koGEMIYwsuhstagOBxJjOsEm6x9Iuiq3dKD5y/SX6sWc2Y5pgmCXjwT NlbhcUttwUWc3+UQHdygwIx1a/qNfgEXR6UY5wJAln9val1Fq/acYqSQ1jVs4Z30NKel 6xPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=trl0v42o; 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 kk26-20020a056214509a00b0044662cd3cc5si1219663qvb.507.2022.04.21.04.43.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:43:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=trl0v42o; 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]:47736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhVDd-000371-PO for patch@linaro.org; Thu, 21 Apr 2022 07:43:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUq6-0003Ba-VG for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:10 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:45935) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUq5-0003WQ-5E for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:10 -0400 Received: by mail-wr1-x42d.google.com with SMTP id w4so6175948wrg.12 for ; Thu, 21 Apr 2022 04:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=d+s9Ayr2MToy3NwUrcI6rbLNGvw59lNw6jFaFEZj0pg=; b=trl0v42oRATPMLSLwQnyQsz1N3yV0jiv33fUxMzqUe0cApeqCAkDL/2nV64QYsMapZ nvl4ifx70k/aUeGDr/BmLqlUvn3qJj+eDz+rSwSaLG3oOyw+wmJaJhwTOMDA4uL+vtyY a3aCNl+iMZnYoZ4N4rUAsfom8SpG3CANlbW+zia1I7RYjVzotWkBZn3uWnPqe8iA4X1Z ahhmoGJu8Bd76EB80UmkEDzdD3LbRQp+Vga/yv6XkzqpGpy7E9Aid7s3Pp+JA4gGjOlN Lk7cH89wqWxi+a5ehDhUrj7gdpJbRso9VIQDpT9vJVGHgRymH5O2FpwoKtDFdbOMD9MO ewwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d+s9Ayr2MToy3NwUrcI6rbLNGvw59lNw6jFaFEZj0pg=; b=4oSpbQBLah1NeM/HNNHl0ikff+LZyou8b/drI6iTWfxChWEOPqwZrsVgH1b3Ct3q1O iKuAho5160kJRJZ9hLlZOdTe1k9ERHsaaue1oEbADUFYW4xS+5l2HCT6u+t0KWBh/MYT MAWwskE6l4GQGyvdkF8zb/tN2fosvb1kKq7zX36MqAybL34juvCyaLgR7ZNaW0bTmsqu 1y/c5AabKCYtpg4gbSHBc5BKu8un2ZdDe2kbfYMTg78PgLzjlRxfXDqXUqM59/dljWX5 aGrf7lHpcLoRvNEhm8n1xNlCoRMbkKe41RyiKsb6odzcs3mwxvFBtMizmjWR4t0twtt4 8Lhg== X-Gm-Message-State: AOAM5322/jNupzocea3rHSMN9waj9v+sdTWOOn7NfkTXO7TbU/PcE+WK YT4WSHMd3t9p04lPDx4MCi5fd9Haq+UA9Q== X-Received: by 2002:a5d:4348:0:b0:206:1c79:fd57 with SMTP id u8-20020a5d4348000000b002061c79fd57mr19555430wrr.344.1650539947766; Thu, 21 Apr 2022 04:19:07 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:07 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/31] hw/arm/exynos4210: Don't connect multiple lines to external GIC inputs Date: Thu, 21 Apr 2022 12:18:37 +0100 Message-Id: <20220421111846.2011565-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" The combiner_grp_to_gic_id[] array includes the EXT_GIC_ID_MCT_G0 and EXT_GIC_ID_MCT_G1 multiple times. This means that we will connect multiple IRQs up to the same external GIC input, which is not permitted. We do the same thing in the code in exynos4210_init_board_irqs() because the conditionals selecting an irq_id in the first loop match multiple interrupt IDs. Overall we do this for interrupt IDs (1, 4), (12, 4), (35, 4), (51, 4), (53, 4) for EXT_GIC_ID_MCT_G0 and (1, 5), (12, 5), (35, 5), (51, 5), (53, 5) for EXT_GIC_ID_MCT_G1 These correspond to the cases for the multi-core timer that we are wiring up to multiple inputs on the combiner in exynos4210_combiner_get_gpioin(). That code already deals with all these interrupt IDs being the same input source, so we don't need to connect the external GIC interrupt for any of them except the first (1, 4) and (1, 5). Remove the array entries and conditionals which were incorrectly causing us to wire up extra lines. This bug didn't cause any visible effects, because we only connect up a device to the "primary" ID values (1, 4) and (1, 5), so the extra lines would never be set to a level. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-16-peter.maydell@linaro.org --- include/hw/arm/exynos4210.h | 2 +- hw/arm/exynos4210.c | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index f58ee0f2686..7da3eddea5f 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -77,7 +77,7 @@ * one for every non-zero entry in combiner_grp_to_gic_id[]. * We'll assert in exynos4210_init_board_irqs() if this is wrong. */ -#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 60) +#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 54) typedef struct Exynos4210Irq { qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 962d6d0ac2a..39e334e0773 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -231,7 +231,7 @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { /* int combiner group 34 */ { EXT_GIC_ID_ONENAND_AUDI, EXT_GIC_ID_NFC }, /* int combiner group 35 */ - { 0, 0, 0, EXT_GIC_ID_MCT_L1, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 }, + { 0, 0, 0, EXT_GIC_ID_MCT_L1 }, /* int combiner group 36 */ { EXT_GIC_ID_MIXER }, /* int combiner group 37 */ @@ -240,11 +240,11 @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { /* groups 38-50 */ { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, /* int combiner group 51 */ - { EXT_GIC_ID_MCT_L0, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 }, + { EXT_GIC_ID_MCT_L0 }, /* group 52 */ { }, /* int combiner group 53 */ - { EXT_GIC_ID_WDT, 0, 0, 0, EXT_GIC_ID_MCT_G0, EXT_GIC_ID_MCT_G1 }, + { EXT_GIC_ID_WDT }, /* groups 54-63 */ { }, { }, { }, { }, { }, { }, { }, { }, { }, { } }; @@ -268,13 +268,11 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) { irq_id = 0; - if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 4) || - n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4)) { + if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 4)) { /* MCT_G0 is passed to External GIC */ irq_id = EXT_GIC_ID_MCT_G0; } - if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 5) || - n == EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 5)) { + if (n == EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 5)) { /* MCT_G1 is passed to External and GIC */ irq_id = EXT_GIC_ID_MCT_G1; } From patchwork Thu Apr 21 11:18:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564329 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp352050map; Thu, 21 Apr 2022 04:36:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycUMI66bH5H4alNHv9aGmuOhS73U3j3xs/UIWDniO4W+OQUTiioCVZQkgtNrERKpJ4WUPb X-Received: by 2002:ac8:5716:0:b0:2f3:3f2e:535c with SMTP id 22-20020ac85716000000b002f33f2e535cmr5976701qtw.544.1650541005921; Thu, 21 Apr 2022 04:36:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650541005; cv=none; d=google.com; s=arc-20160816; b=j7TQ2M/EPiO63hYbp1ngUVn4ap319kH3M8FBZxakcsqLoI+RucQKXnbD7qLb5OLIxK MgPnXU/XPR8z9uKayL02mFTGhs2dCp+kUYFnWOm+Nwg/pBGiNe7+STqZT/xuyR+16vsM Q34ZawsSmlKEMp+ZSQr242wdiL8EsbrYz7+0ivtRdWrXoNVghcw9mfy/s4ydqKs+oMAe PSo7bdWZ3T5xwLIXu29QIHWVMC4e054KtKC2N81bLNwInDpUVoLgdrMiX3HPFgdX2900 /aAq9vnolCfzUUaVP4FlfPONjB1ck4MnlK8sGAzF58xmaqk5283dirw5JqMlWL6Amm3v zMfg== 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=oHJIYCR/bV2ZQNmrQ3vUauIwQavU4nVbs97MW/KeCJM=; b=VA8qXtNgXAcFj0F/EnzSpfGTzThTuKLyD27nA0usgiM/dNRTX4UtZSAWKDZyUxh8A4 le4T/8J5Snv1zNkKk1pL9r7/uU81oL+XP0U0m2J7P9I+nLHiE/8dvdbqsN2EX6Y1C2Zj gBTKT3zBrvHPk6+bdvTz1148Vo2jPfmitbc+LcQCLWg332Db+ZX5MgPYtwEklTm4OvTx buRQuNeQTnTEdQWXk9Qu7EkWu98V0yiidALAx8NuLvWTVvyzUnXnqU+Wi1IDyEAlhU9Y 0EdLidnuOjqsDWBswv7sqZafvFu66j+aQXb3y1nIShlFPfvqziLJD0eV8n3JqOkgYuPp mh1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KtviYcsr; 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 ke27-20020a056214301b00b004465db6fc22si1212334qvb.401.2022.04.21.04.36.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:36:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KtviYcsr; 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]:36386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhV77-0003XI-DK for patch@linaro.org; Thu, 21 Apr 2022 07:36:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUq8-0003DG-S9 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:14 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:42877) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUq6-0003Wy-OX for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:12 -0400 Received: by mail-wr1-x433.google.com with SMTP id bv16so6182742wrb.9 for ; Thu, 21 Apr 2022 04:19:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=oHJIYCR/bV2ZQNmrQ3vUauIwQavU4nVbs97MW/KeCJM=; b=KtviYcsrJcSxVXC4hx/ThCiSV3Z/p015qnCJENSUK7dFp9KYYpcn3T2x6bXdrRwayL 5zPVlBKTjPGyxXEeB2fZq7jU5wNrMWgTC7TmgcPolcFZpV3sWxL9hNuuWZIouycYXkpL X7GAzEGPimWpyBUa8XriQZ21OhdCCPAn+46eUsQF/+J2V9DGn6dk/wJJnKrqcJ7SvfXA NtjtheLyShPa4goUcWBWvw+iMe0plYTAMtGzR8okcv5cqtH+bcmMIffdYIgr/HC6dmG1 fEvn/LwbEEek6YG/V115fDWdiNKr81tfCWAIuckPOzewFPYzvin+6CfVl3m0NTKv/cWx dCmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oHJIYCR/bV2ZQNmrQ3vUauIwQavU4nVbs97MW/KeCJM=; b=rztZoF4LEkeJ8RxGLsSHfuTKh7Vj5EyBU4sriktuZ5CWXKN1icc2ZiBFPJt+OVFAdc uKdmCfbe7I3Im9QWMWFl4QXEKkdynpeS1E0JF7plq7iF9f8eycjDTGmSzSkQmTPePTi+ 93cJQXDdcvyJMaoqQsbh/nVejr4WafNiLZjlU+zc9jCNd6XDQPPxuuzBI7k9bVv0ielY 4QBgn0rDvwaFbpP408/DS8bMdfsxVY7ssNtfeeJLeZ4gMDKTjlKavD3lf6duA6qOS2Y9 wOD+ptPicaqCsZpdMU7P8F9lYePI0UuubNZMcBj9x1hSLAYuf6AS1qSA2NnzXJzou7Zc B8pw== X-Gm-Message-State: AOAM533QyKgWpskyNPcnmgfFtZyKAG5Ewl17prEcDr9nBk9X29LoD0Pa I2Oc5vzzKiPyISeTd/AV1FFvvChoclHqSw== X-Received: by 2002:adf:f20d:0:b0:207:9a8f:ef9e with SMTP id p13-20020adff20d000000b002079a8fef9emr19543157wro.618.1650539949289; Thu, 21 Apr 2022 04:19:09 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:08 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/31] hw/arm/exynos4210: Fold combiner splits into exynos4210_init_board_irqs() Date: Thu, 21 Apr 2022 12:18:38 +0100 Message-Id: <20220421111846.2011565-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" At this point, the function exynos4210_init_board_irqs() splits input IRQ lines to connect them to the input combiner, output combiner and external GIC. The function exynos4210_combiner_get_gpioin() splits some of the combiner input lines further to connect them to multiple different inputs on the combiner. Because (unlike qemu_irq_split()) the TYPE_SPLIT_IRQ device has a configurable number of outputs, we can do all this in one place, by making exynos4210_init_board_irqs() add extra outputs to the splitter device when it must be connected to more than one input on each combiner. We do this with a new data structure, the combinermap, which is an array each of whose elements is a list of the interrupt IDs on the combiner which must be tied together. As we loop through each interrupt ID, if we find that it is the first one in one of these lists, we configure the splitter device with eonugh extra outputs and wire them up to the other interrupt IDs in the list. Conveniently, for all the cases where this is necessary, the lowest-numbered interrupt ID in each group is in the range of the external combiner, so we only need to code for this in the first of the two loops in exynos4210_init_board_irqs(). The old code in exynos4210_combiner_get_gpioin() which is being deleted here had several problems which don't exist in the new code in its handling of the multi-core timer interrupts: (1) the case labels specified bits 4 ... 8, but bit '8' doesn't exist; these should have been 4 ... 7 (2) it used the input irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)] multiple times as the input of several different splitters, which isn't allowed (3) in an apparent cut-and-paste error, the cases for all the multi-core timer inputs used "bit + 4" even though the bit range for the case was (intended to be) 4 ... 7, which meant it was looking at non-existent bits 8 ... 11. None of these exist in the new code. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-17-peter.maydell@linaro.org --- include/hw/arm/exynos4210.h | 6 +- hw/arm/exynos4210.c | 178 +++++++++++++++++++++++------------- 2 files changed, 119 insertions(+), 65 deletions(-) diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index 7da3eddea5f..f24617f681d 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -74,10 +74,12 @@ /* * We need one splitter for every external combiner input, plus - * one for every non-zero entry in combiner_grp_to_gic_id[]. + * one for every non-zero entry in combiner_grp_to_gic_id[], + * minus one for every external combiner ID in second or later + * places in a combinermap[] line. * We'll assert in exynos4210_init_board_irqs() if this is wrong. */ -#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 54) +#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 38) typedef struct Exynos4210Irq { qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 39e334e0773..05b28cf5905 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -254,6 +254,76 @@ combiner_grp_to_gic_id[64 - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = { #define EXYNOS4210_COMBINER_GET_BIT_NUM(irq) \ ((irq) - 8 * EXYNOS4210_COMBINER_GET_GRP_NUM(irq)) +/* + * Some interrupt lines go to multiple combiner inputs. + * This data structure defines those: each array element is + * a list of combiner inputs which are connected together; + * the one with the smallest interrupt ID value must be first. + * As with combiner_grp_to_gic_id[], we rely on (0, 0) not being + * wired to anything so we can use 0 as a terminator. + */ +#define IRQNO(G, B) EXYNOS4210_COMBINER_GET_IRQ_NUM(G, B) +#define IRQNONE 0 + +#define COMBINERMAP_SIZE 16 + +static const int combinermap[COMBINERMAP_SIZE][6] = { + /* MDNIE_LCD1 */ + { IRQNO(0, 4), IRQNO(1, 0), IRQNONE }, + { IRQNO(0, 5), IRQNO(1, 1), IRQNONE }, + { IRQNO(0, 6), IRQNO(1, 2), IRQNONE }, + { IRQNO(0, 7), IRQNO(1, 3), IRQNONE }, + /* TMU */ + { IRQNO(2, 4), IRQNO(3, 4), IRQNONE }, + { IRQNO(2, 5), IRQNO(3, 5), IRQNONE }, + { IRQNO(2, 6), IRQNO(3, 6), IRQNONE }, + { IRQNO(2, 7), IRQNO(3, 7), IRQNONE }, + /* LCD1 */ + { IRQNO(11, 4), IRQNO(12, 0), IRQNONE }, + { IRQNO(11, 5), IRQNO(12, 1), IRQNONE }, + { IRQNO(11, 6), IRQNO(12, 2), IRQNONE }, + { IRQNO(11, 7), IRQNO(12, 3), IRQNONE }, + /* Multi-core timer */ + { IRQNO(1, 4), IRQNO(12, 4), IRQNO(35, 4), IRQNO(51, 4), IRQNO(53, 4), IRQNONE }, + { IRQNO(1, 5), IRQNO(12, 5), IRQNO(35, 5), IRQNO(51, 5), IRQNO(53, 5), IRQNONE }, + { IRQNO(1, 6), IRQNO(12, 6), IRQNO(35, 6), IRQNO(51, 6), IRQNO(53, 6), IRQNONE }, + { IRQNO(1, 7), IRQNO(12, 7), IRQNO(35, 7), IRQNO(51, 7), IRQNO(53, 7), IRQNONE }, +}; + +#undef IRQNO + +static const int *combinermap_entry(int irq) +{ + /* + * If the interrupt number passed in is the first entry in some + * line of the combinermap, return a pointer to that line; + * otherwise return NULL. + */ + int i; + for (i = 0; i < COMBINERMAP_SIZE; i++) { + if (combinermap[i][0] == irq) { + return combinermap[i]; + } + } + return NULL; +} + +static int mapline_size(const int *mapline) +{ + /* Return number of entries in this mapline in total */ + int i = 0; + + if (!mapline) { + /* Not in the map? IRQ goes to exactly one combiner input */ + return 1; + } + while (*mapline != IRQNONE) { + mapline++; + i++; + } + return i; +} + /* * Initialize board IRQs. * These IRQs contain splitted Int/External Combiner and External Gic IRQs. @@ -265,6 +335,8 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) DeviceState *extgicdev = DEVICE(&s->ext_gic); int splitcount = 0; DeviceState *splitter; + const int *mapline; + int numlines, splitin, in; for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) { irq_id = 0; @@ -277,16 +349,46 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) irq_id = EXT_GIC_ID_MCT_G1; } + if (s->irq_table[n]) { + /* + * This must be some non-first entry in a combinermap line, + * and we've already filled it in. + */ + continue; + } + mapline = combinermap_entry(n); + /* + * We need to connect the IRQ to multiple inputs on both combiners + * and possibly also to the external GIC. + */ + numlines = 2 * mapline_size(mapline); + if (irq_id) { + numlines++; + } assert(splitcount < EXYNOS4210_NUM_SPLITTERS); splitter = DEVICE(&s->splitter[splitcount]); - qdev_prop_set_uint16(splitter, "num-lines", irq_id ? 3 : 2); + qdev_prop_set_uint16(splitter, "num-lines", numlines); qdev_realize(splitter, NULL, &error_abort); splitcount++; - s->irq_table[n] = qdev_get_gpio_in(splitter, 0); - qdev_connect_gpio_out(splitter, 0, is->int_combiner_irq[n]); - qdev_connect_gpio_out(splitter, 1, is->ext_combiner_irq[n]); + + in = n; + splitin = 0; + for (;;) { + s->irq_table[in] = qdev_get_gpio_in(splitter, 0); + qdev_connect_gpio_out(splitter, splitin, is->int_combiner_irq[in]); + qdev_connect_gpio_out(splitter, splitin + 1, is->ext_combiner_irq[in]); + splitin += 2; + if (!mapline) { + break; + } + mapline++; + in = *mapline; + if (in == IRQNONE) { + break; + } + } if (irq_id) { - qdev_connect_gpio_out(splitter, 2, + qdev_connect_gpio_out(splitter, splitin, qdev_get_gpio_in(extgicdev, irq_id - 32)); } } @@ -297,6 +399,14 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) irq_id = combiner_grp_to_gic_id[grp - EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][bit]; + if (s->irq_table[n]) { + /* + * This must be some non-first entry in a combinermap line, + * and we've already filled it in. + */ + continue; + } + if (irq_id) { assert(splitcount < EXYNOS4210_NUM_SPLITTERS); splitter = DEVICE(&s->splitter[splitcount]); @@ -337,7 +447,6 @@ static void exynos4210_combiner_get_gpioin(Exynos4210Irq *irqs, DeviceState *dev, int ext) { int n; - int bit; int max; qemu_irq *irq; @@ -345,64 +454,7 @@ static void exynos4210_combiner_get_gpioin(Exynos4210Irq *irqs, EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; irq = ext ? irqs->ext_combiner_irq : irqs->int_combiner_irq; - /* - * Some IRQs of Int/External Combiner are going to two Combiners groups, - * so let split them. - */ for (n = 0; n < max; n++) { - - bit = EXYNOS4210_COMBINER_GET_BIT_NUM(n); - - switch (n) { - /* MDNIE_LCD1 INTG1 */ - case EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 0) ... - EXYNOS4210_COMBINER_GET_IRQ_NUM(1, 3): - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(0, bit + 4)]); - continue; - - /* TMU INTG3 */ - case EXYNOS4210_COMBINER_GET_IRQ_NUM(3, 4): - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(2, bit)]); - continue; - - /* LCD1 INTG12 */ - case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 0) ... - EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 3): - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(11, bit + 4)]); - continue; - - /* Multi-Core Timer INTG12 */ - case EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 4) ... - EXYNOS4210_COMBINER_GET_IRQ_NUM(12, 8): - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); - continue; - - /* Multi-Core Timer INTG35 */ - case EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 4) ... - EXYNOS4210_COMBINER_GET_IRQ_NUM(35, 8): - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); - continue; - - /* Multi-Core Timer INTG51 */ - case EXYNOS4210_COMBINER_GET_IRQ_NUM(51, 4) ... - EXYNOS4210_COMBINER_GET_IRQ_NUM(51, 8): - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); - continue; - - /* Multi-Core Timer INTG53 */ - case EXYNOS4210_COMBINER_GET_IRQ_NUM(53, 4) ... - EXYNOS4210_COMBINER_GET_IRQ_NUM(53, 8): - irq[n] = qemu_irq_split(qdev_get_gpio_in(dev, n), - irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]); - continue; - } - irq[n] = qdev_get_gpio_in(dev, n); } } From patchwork Thu Apr 21 11:18:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564340 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp361531map; Thu, 21 Apr 2022 04:51:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFl3kgg3V0d7/1ysrhWhlZWDuOj8W88do5e/JWbPy8Rs5qICoV/Ve7alB7dH3uZz9qO4jB X-Received: by 2002:a37:b6c5:0:b0:69b:d92c:7de9 with SMTP id g188-20020a37b6c5000000b0069bd92c7de9mr15693128qkf.541.1650541893021; Thu, 21 Apr 2022 04:51:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650541893; cv=none; d=google.com; s=arc-20160816; b=FBFgFMyx+QTvxV3DHzOD9Qfv7IP310MsBVax+iqrnikQexNDHG5ce56iUjBclmqg4b dZZp3M0CFb1a+l4hhkomdf+mvljJRbZAQXt5YjCgJ4kCjTxum4Lz+FUlftQzcfpKfQL7 bIuyHrYW1UKLQyiUDKCGiIoEyAJn6G12JUjFA21YqiPtixxkCuLfQKtHzxdDw2OW6m1g g53apyLFEDEr4L8IApLPjhYE/pTiBE76YPrOnU9gYHguxxgMYOS45jTQshFz+IgXU/pX dHOjeeKvig2OYehXhhogYPJsiMtEtm2KgJHRQrV3MQUwCYtTMuquOiJG5V5A8Cj04j9O laiQ== 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=g+Co51E/+7lmbmTDyWaG5WQzn5vB4kGUC/Z7E1cxKEA=; b=AAs0gbkhSYf/V93ffitfp+anmPCShqmN0TUL548q0eFRyzbSkbeOxzG9Blw8dmK2UM lUwK6eHq7M//SuuGcnGAVmjdiNbHPYHIWd02oGX88KXn5Qbz5YYnZ2wYRqlBmBDGmeiA N6LC2aS2vb+LI7n/d4PFobBlssdpbCNAfsYRt8/xmPBINVwT+a5ToWvb/v+fGVPfEtL9 ATcpwB+rJldUNtU5QNN139Qe9K8LN/xK3HOQriEERrbF6h8OrzMDUFuIJOtW65mF2PKe PXEXNWOBGXEN0iUNmhNfSOQaaEnZ/M6pairxzQOB1kKjcND1rFZBjvTBqEbQxtnk1003 /Xvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CEIxTB0R; 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 gf12-20020a056214250c00b00440e46a7c3bsi1328615qvb.217.2022.04.21.04.51.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:51:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CEIxTB0R; 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]:36620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhVLQ-0006tj-IT for patch@linaro.org; Thu, 21 Apr 2022 07:51:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUqM-0003Fz-Pl for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:28 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:42868) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUq8-0003XN-RR for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:14 -0400 Received: by mail-wr1-x429.google.com with SMTP id bv16so6182866wrb.9 for ; Thu, 21 Apr 2022 04:19:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=g+Co51E/+7lmbmTDyWaG5WQzn5vB4kGUC/Z7E1cxKEA=; b=CEIxTB0REDzYgul9ceihtBhXVeRfPk37c/BBdLplsKSp14Edx5ilPcLUzLC8w+O8Ru IE8EdaPwhc6Jk3neEXZCnv1bKrfWkJd0NWjE+5301JiUgrsfJWafyGFNA/UaJhgQqk+Z WAHVeggQCk/QvTQt6Gu9oBnpI0cQZDCViiXHO7Oiymta7IZWcfI5JvBTf3NNSFXmsMFN Xyka+RcPz1b9/KJcAYn4rBG+bxzgG0K+Jvfra0FfpvUipp5bQkeeYVUk9LHN6rhq5aOG 917xYn8lUuBASC1XmFABGouRDuloJ3AOq1oPMTlBaiBOJVskP+rM2l1i1dEBwklauQE8 c7Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g+Co51E/+7lmbmTDyWaG5WQzn5vB4kGUC/Z7E1cxKEA=; b=iP6mClSR/D+lKt+9Ld6Uvt8OUBkLoXOpfslwMpJNa4BFk5lclrBsxO63pv7sLBcICH yfw0BE+3xvBvZaHIiZ26Dv1a5jinaBZjDZ0sELE+oUXF4q4hc5jh4j1qL92v3sVyqKzZ zG+OXcqp/N2TYnoG/TYYYnI7qJCpBLutogzDyMJx0GRopC7t2aavmwZBN4YuWFDIct4K +wfE7LaM52evFPcCLcUJWHu0cbva3BJIDhm+RbEBRtMHZa7vLoUBZRocbnW/UaNg8bHk q0UVeJVRWY4cC6hFrc/G4W2OQL3+U0VDaj95SOVOIySqudbr7hUolp6G0gE7naRSnWON 3gBg== X-Gm-Message-State: AOAM531YsQe7n9K+2hsr9OoG//6+LJ4OkAiIvUw2cLAxl3cPEREdbI8/ Aqkl4wADgOLlF+BUhzWamUieuAXWzgRdBA== X-Received: by 2002:a05:6000:2cb:b0:20a:88c4:ec9f with SMTP id o11-20020a05600002cb00b0020a88c4ec9fmr18060482wry.43.1650539951597; Thu, 21 Apr 2022 04:19:11 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:11 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/31] hw/arm/exynos4210: Put combiners into state struct Date: Thu, 21 Apr 2022 12:18:39 +0100 Message-Id: <20220421111846.2011565-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" Switch the creation of the combiner devices to the new-style "embedded in state struct" approach, so we can easily refer to the object elsewhere during realize. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-18-peter.maydell@linaro.org --- include/hw/arm/exynos4210.h | 3 ++ include/hw/intc/exynos4210_combiner.h | 57 +++++++++++++++++++++++++++ hw/arm/exynos4210.c | 20 +++++----- hw/intc/exynos4210_combiner.c | 31 +-------------- 4 files changed, 72 insertions(+), 39 deletions(-) create mode 100644 include/hw/intc/exynos4210_combiner.h diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index f24617f681d..d38be8767b3 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -28,6 +28,7 @@ #include "hw/sysbus.h" #include "hw/cpu/a9mpcore.h" #include "hw/intc/exynos4210_gic.h" +#include "hw/intc/exynos4210_combiner.h" #include "hw/core/split-irq.h" #include "target/arm/cpu-qom.h" #include "qom/object.h" @@ -105,6 +106,8 @@ struct Exynos4210State { qemu_or_irq cpu_irq_orgate[EXYNOS4210_NCPUS]; A9MPPrivState a9mpcore; Exynos4210GicState ext_gic; + Exynos4210CombinerState int_combiner; + Exynos4210CombinerState ext_combiner; SplitIRQ splitter[EXYNOS4210_NUM_SPLITTERS]; }; diff --git a/include/hw/intc/exynos4210_combiner.h b/include/hw/intc/exynos4210_combiner.h new file mode 100644 index 00000000000..429844fed41 --- /dev/null +++ b/include/hw/intc/exynos4210_combiner.h @@ -0,0 +1,57 @@ +/* + * Samsung exynos4210 Interrupt Combiner + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. + * All rights reserved. + * + * Evgeny Voevodin + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#ifndef HW_INTC_EXYNOS4210_COMBINER +#define HW_INTC_EXYNOS4210_COMBINER + +#include "hw/sysbus.h" + +/* + * State for each output signal of internal combiner + */ +typedef struct CombinerGroupState { + uint8_t src_mask; /* 1 - source enabled, 0 - disabled */ + uint8_t src_pending; /* Pending source interrupts before masking */ +} CombinerGroupState; + +#define TYPE_EXYNOS4210_COMBINER "exynos4210.combiner" +OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210CombinerState, EXYNOS4210_COMBINER) + +/* Number of groups and total number of interrupts for the internal combiner */ +#define IIC_NGRP 64 +#define IIC_NIRQ (IIC_NGRP * 8) +#define IIC_REGSET_SIZE 0x41 + +struct Exynos4210CombinerState { + SysBusDevice parent_obj; + + MemoryRegion iomem; + + struct CombinerGroupState group[IIC_NGRP]; + uint32_t reg_set[IIC_REGSET_SIZE]; + uint32_t icipsr[2]; + uint32_t external; /* 1 means that this combiner is external */ + + qemu_irq output_irq[IIC_NGRP]; +}; + +#endif diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 05b28cf5905..27c6ab27123 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -624,25 +624,23 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) } /* Internal Interrupt Combiner */ - dev = qdev_new("exynos4210.combiner"); - busdev = SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(busdev, &error_fatal); + busdev = SYS_BUS_DEVICE(&s->int_combiner); + sysbus_realize(busdev, &error_fatal); for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) { sysbus_connect_irq(busdev, n, qdev_get_gpio_in(DEVICE(&s->a9mpcore), n)); } - exynos4210_combiner_get_gpioin(&s->irqs, dev, 0); + exynos4210_combiner_get_gpioin(&s->irqs, DEVICE(&s->int_combiner), 0); sysbus_mmio_map(busdev, 0, EXYNOS4210_INT_COMBINER_BASE_ADDR); /* External Interrupt Combiner */ - dev = qdev_new("exynos4210.combiner"); - qdev_prop_set_uint32(dev, "external", 1); - busdev = SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(busdev, &error_fatal); + qdev_prop_set_uint32(DEVICE(&s->ext_combiner), "external", 1); + busdev = SYS_BUS_DEVICE(&s->ext_combiner); + sysbus_realize(busdev, &error_fatal); for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) { sysbus_connect_irq(busdev, n, qdev_get_gpio_in(DEVICE(&s->ext_gic), n)); } - exynos4210_combiner_get_gpioin(&s->irqs, dev, 1); + exynos4210_combiner_get_gpioin(&s->irqs, DEVICE(&s->ext_combiner), 1); sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_COMBINER_BASE_ADDR); /* Initialize board IRQs. */ @@ -844,6 +842,10 @@ static void exynos4210_init(Object *obj) object_initialize_child(obj, "a9mpcore", &s->a9mpcore, TYPE_A9MPCORE_PRIV); object_initialize_child(obj, "ext-gic", &s->ext_gic, TYPE_EXYNOS4210_GIC); + object_initialize_child(obj, "int-combiner", &s->int_combiner, + TYPE_EXYNOS4210_COMBINER); + object_initialize_child(obj, "ext-combiner", &s->ext_combiner, + TYPE_EXYNOS4210_COMBINER); } static void exynos4210_class_init(ObjectClass *klass, void *data) diff --git a/hw/intc/exynos4210_combiner.c b/hw/intc/exynos4210_combiner.c index 83b42b9bce1..a289510bdb8 100644 --- a/hw/intc/exynos4210_combiner.c +++ b/hw/intc/exynos4210_combiner.c @@ -31,7 +31,7 @@ #include "hw/sysbus.h" #include "migration/vmstate.h" #include "qemu/module.h" - +#include "hw/intc/exynos4210_combiner.h" #include "hw/arm/exynos4210.h" #include "hw/hw.h" #include "hw/irq.h" @@ -48,36 +48,7 @@ #define DPRINTF(fmt, ...) do {} while (0) #endif -#define IIC_NGRP 64 /* Internal Interrupt Combiner - Groups number */ -#define IIC_NIRQ (IIC_NGRP * 8)/* Internal Interrupt Combiner - Interrupts number */ #define IIC_REGION_SIZE 0x108 /* Size of memory mapped region */ -#define IIC_REGSET_SIZE 0x41 - -/* - * State for each output signal of internal combiner - */ -typedef struct CombinerGroupState { - uint8_t src_mask; /* 1 - source enabled, 0 - disabled */ - uint8_t src_pending; /* Pending source interrupts before masking */ -} CombinerGroupState; - -#define TYPE_EXYNOS4210_COMBINER "exynos4210.combiner" -OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210CombinerState, EXYNOS4210_COMBINER) - -struct Exynos4210CombinerState { - SysBusDevice parent_obj; - - MemoryRegion iomem; - - struct CombinerGroupState group[IIC_NGRP]; - uint32_t reg_set[IIC_REGSET_SIZE]; - uint32_t icipsr[2]; - uint32_t external; /* 1 means that this combiner is external */ - - qemu_irq output_irq[IIC_NGRP]; -}; static const VMStateDescription vmstate_exynos4210_combiner_group_state = { .name = "exynos4210.combiner.groupstate", From patchwork Thu Apr 21 11:18:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564339 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp359348map; Thu, 21 Apr 2022 04:48:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9pl9AFh1Lv6CrQlJgVlf0nSXTAU3NkMDKpJZIiZwCUL/vi40MaQjCDc5NTc7XLl7JS1vp X-Received: by 2002:a37:aa97:0:b0:69e:5c01:86f4 with SMTP id t145-20020a37aa97000000b0069e5c0186f4mr15763538qke.366.1650541681517; Thu, 21 Apr 2022 04:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650541681; cv=none; d=google.com; s=arc-20160816; b=zOJC/gj/4k8fxT0gETFjEqXkh5RaJ+kMMdjzq6qtuA2IMCvUPU1M+zemhg1fyAtur1 va5/pLhSL1HySakkrTY2HSTR2gMSZcbpwckn1I3Jq34yeL6IWNJsZvlS86QOrEgIQP5k q9f/XYWV+7FdcQVVJ0oBRl4wW+UGnC1XEmSjkEn98yWtSiNamoO3sa1M2hCwWpdeLPj+ iHqJsSa1+c0AhCPKnFa2vSOU8S4bxqL2CnMB2DMJBhcO3tb5i0106HoOYjxHeQKGUr1e iKI74ReOk/AoyPLHgZJra3MrvaPQW8vLxJQUrSmcRfNQ6pFqp6sAgIkBo+wI/71wQBcr k4ww== 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=yNOaXUrJUAeJ+AixS5fcfCSvW1JdJPD9+7LfvbRwH6I=; b=SirOWMc1xm1m3j86yUHOFNr2eMqAoLmp/nY2i4ZW/7wVABOYZYsWhrwbtpsFdWQ3h0 onVOxT47ukHLbd7iLsJrexqXkfK/mA5u4BQ5jMHOdBgqvXlayhcIOZXq/fc2WXySrSdY 0owVKnkZurAybJNDycBRbvtkP5mZlhCEzTkYvEPL1RPTZCd/0GWn//VgKWBxaOxw/iIx +bjZZ7tcpYSY94KjugEUZeVMquEeBF52AIf4y420tkfnz+WCa9/mAil51QqU+DN8QqET eaqT/vZA33f1iJq23bwUOvVFGeac0wsQ1laW2XjiCDyktuLULJdtoHUMb5u8EDUioaxA aEPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="aA/uLGOQ"; 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 f19-20020a05620a409300b0069c6169256esi1404644qko.4.2022.04.21.04.48.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:48:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="aA/uLGOQ"; 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]:57068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhVI0-0001dL-Tz for patch@linaro.org; Thu, 21 Apr 2022 07:48:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUqS-0003Hn-Rj for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:32 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:37807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUqG-0003Xb-DV for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:27 -0400 Received: by mail-wr1-x42b.google.com with SMTP id t6so2774198wra.4 for ; Thu, 21 Apr 2022 04:19:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=yNOaXUrJUAeJ+AixS5fcfCSvW1JdJPD9+7LfvbRwH6I=; b=aA/uLGOQsns/PX4347e8rd7Y08PUpzNqA8Pi3t/J/s4riXwYLlqIOfjzXRvlY6+35u TyuIwZiAliJ9Yd0gD53ytcH/BV9jyLnOkduKIZDxk9mdCPtIHkldXOtw/ppoI0ScpgnA yubLZf2oOlZqXVaiQ1b7VCt1uMGXUuoNK+36oD/sTgktbl3edCCqJ8Qj8V5/rPkKVAgc j7jRRsZXEZZ64mXRtJ8kGubKALqOhj8dL8vqoTavfbLCFgixRn7nONXMXoQD0BYbp0Ix tWSON7WbvSluiARaih7Ugy8DEwb6K2wcf+baz/vNO2JQLeNs0J0rGDb8HEZQMYf8pI2u aAIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yNOaXUrJUAeJ+AixS5fcfCSvW1JdJPD9+7LfvbRwH6I=; b=4GozdLVR3xqNzfl3yiLAtKUeKKfOai9n526I2PDSjm6jVpQUD8oq8gTbdk89yj28gj tacXDzBWQSXiHPVuZI8Z0YXmmLOIwC9Xt4l43oblS45wwVlXUotxyxK/WKEKuEl6B87L 3E+Q1APV6SrF57pdNBLtEoAJj5+PU0++2rJUXjuZJg3ma0SVavuCnOLMM2EsC3v3p+WK OddKPICplMb+lqU7n9R/e52asXYsJIBOrVYF6D9mrxvETrX6L8W3VS/7e0Dm1ja7h/XS oAV8EG0vTPSY/sB4espYJ4oDqRm7TpSyp3iOqHLxnkzE26iXnbzfRAIER6nlbOzbQ9Bv d7yw== X-Gm-Message-State: AOAM530NKWuG7eyULG2z6+CbYSPApjHFZ3DqAorvi+CIhoXZ15oIZVxl dQ76mvaQ+SE5KJ8qbM9w6WQR+zdcgOPh1g== X-Received: by 2002:a05:6000:156a:b0:20a:9c1b:6b1b with SMTP id 10-20020a056000156a00b0020a9c1b6b1bmr13222289wrz.683.1650539952579; Thu, 21 Apr 2022 04:19:12 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:12 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/31] hw/arm/exynos4210: Drop Exynos4210Irq struct Date: Thu, 21 Apr 2022 12:18:40 +0100 Message-Id: <20220421111846.2011565-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" The only time we use the int_combiner_irq[] and ext_combiner_irq[] arrays in the Exynos4210Irq struct is during realize of the SoC -- we initialize them with the input IRQs of the combiner devices, and then connect those to outputs of other devices in exynos4210_init_board_irqs(). Now that the combiner objects are easily accessible as s->int_combiner and s->ext_combiner we can make the connections directly from one device to the other without going via these arrays. Since these are the only two remaining elements of Exynos4210Irq, we can remove that struct entirely. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220404154658.565020-19-peter.maydell@linaro.org --- include/hw/arm/exynos4210.h | 6 ------ hw/arm/exynos4210.c | 34 ++++++++-------------------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index d38be8767b3..97353f1c02f 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -82,17 +82,11 @@ */ #define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 38) -typedef struct Exynos4210Irq { - qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; - qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ]; -} Exynos4210Irq; - struct Exynos4210State { /*< private >*/ SysBusDevice parent_obj; /*< public >*/ ARMCPU *cpu[EXYNOS4210_NCPUS]; - Exynos4210Irq irqs; qemu_irq irq_table[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; MemoryRegion chipid_mem; diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 27c6ab27123..8dafa2215b6 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -331,8 +331,9 @@ static int mapline_size(const int *mapline) static void exynos4210_init_board_irqs(Exynos4210State *s) { uint32_t grp, bit, irq_id, n; - Exynos4210Irq *is = &s->irqs; DeviceState *extgicdev = DEVICE(&s->ext_gic); + DeviceState *intcdev = DEVICE(&s->int_combiner); + DeviceState *extcdev = DEVICE(&s->ext_combiner); int splitcount = 0; DeviceState *splitter; const int *mapline; @@ -375,8 +376,10 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) splitin = 0; for (;;) { s->irq_table[in] = qdev_get_gpio_in(splitter, 0); - qdev_connect_gpio_out(splitter, splitin, is->int_combiner_irq[in]); - qdev_connect_gpio_out(splitter, splitin + 1, is->ext_combiner_irq[in]); + qdev_connect_gpio_out(splitter, splitin, + qdev_get_gpio_in(intcdev, in)); + qdev_connect_gpio_out(splitter, splitin + 1, + qdev_get_gpio_in(extcdev, in)); splitin += 2; if (!mapline) { break; @@ -414,11 +417,11 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) qdev_realize(splitter, NULL, &error_abort); splitcount++; s->irq_table[n] = qdev_get_gpio_in(splitter, 0); - qdev_connect_gpio_out(splitter, 0, is->int_combiner_irq[n]); + qdev_connect_gpio_out(splitter, 0, qdev_get_gpio_in(intcdev, n)); qdev_connect_gpio_out(splitter, 1, qdev_get_gpio_in(extgicdev, irq_id - 32)); } else { - s->irq_table[n] = is->int_combiner_irq[n]; + s->irq_table[n] = qdev_get_gpio_in(intcdev, n); } } /* @@ -440,25 +443,6 @@ uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit) return EXYNOS4210_COMBINER_GET_IRQ_NUM(grp, bit); } -/* - * Get Combiner input GPIO into irqs structure - */ -static void exynos4210_combiner_get_gpioin(Exynos4210Irq *irqs, - DeviceState *dev, int ext) -{ - int n; - int max; - qemu_irq *irq; - - max = ext ? EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ : - EXYNOS4210_MAX_INT_COMBINER_IN_IRQ; - irq = ext ? irqs->ext_combiner_irq : irqs->int_combiner_irq; - - for (n = 0; n < max; n++) { - irq[n] = qdev_get_gpio_in(dev, n); - } -} - static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43, 0x09, 0x00, 0x00, 0x00 }; @@ -630,7 +614,6 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) sysbus_connect_irq(busdev, n, qdev_get_gpio_in(DEVICE(&s->a9mpcore), n)); } - exynos4210_combiner_get_gpioin(&s->irqs, DEVICE(&s->int_combiner), 0); sysbus_mmio_map(busdev, 0, EXYNOS4210_INT_COMBINER_BASE_ADDR); /* External Interrupt Combiner */ @@ -640,7 +623,6 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) { sysbus_connect_irq(busdev, n, qdev_get_gpio_in(DEVICE(&s->ext_gic), n)); } - exynos4210_combiner_get_gpioin(&s->irqs, DEVICE(&s->ext_combiner), 1); sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_COMBINER_BASE_ADDR); /* Initialize board IRQs. */ From patchwork Thu Apr 21 11:18:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564343 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp364873map; Thu, 21 Apr 2022 04:56:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTzTTdPcJzOhbI0fU2YSq2jECfwxW/xYvOg+bkPZhkIe38QjZCrYbgpYmdxw5PN+9+jaGJ X-Received: by 2002:ac8:5f4f:0:b0:2f3:52eb:681 with SMTP id y15-20020ac85f4f000000b002f352eb0681mr607752qta.267.1650542200700; Thu, 21 Apr 2022 04:56:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650542200; cv=none; d=google.com; s=arc-20160816; b=eBbb7F7Igrui+4GXEzD6G3BWZK5mVa+XIxiDGWjBOjKge7iNQ6UyL7fOW5LC5D+UWS +dnPNB4jjGaI1W1QNy7VGKsMWy3XlmFOIvGVnOokiYh0VZZJvpKoQpUDkL0SLeFBY0ig qDPeVfzv6IS6+T94sP1/J3L7kb1pecF8efgRmxuWzmTxcGNzvCwVlyDK0YpduUrqT1+T eSVESwig8jFVl94XkMTItm31EfSj/6JB/vINCpA3NnI/kZGfxdCQe5ciu0OFHBHEq7Ug t0xWeZCvCr2ggNmYNXC46Keib9NncFcsO4w1rKS8SH95o6U59tjxyXvjJfHv1BNTlQpJ 2KzA== 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=c+3p6Fbz730AqqAeRKPa+9fqaNknD7WBGqtKg8sQzjk=; b=1AvbGIygZ/J8ELYE6RnksTNb3aaT6mNAtC8jyVxvsgcGch8vJi5C1QArhmMK1+sF1a YAMUNrFu/pY1rxyLS4JGqj0NgCLmfU+8r7uTkyG3OMYlvtSszsWY+FSbp/TMOor4C5ih fRQTWNVm0HCKO5vsvv38tbWXUhIhhB58qgmbBkedKjceC88jgRdWOeVJdmqLtzO5UXMh DqsuqFfRc53mt8SS7LlLdJTtf/i7UAtaKNaaZ+TcDFIzlDTJdMdh86kH6CmK+KkNPiyv CqigFsH7z3xFQ2ds9LNtacgp9j6VBDDimIrSVIMbv3zzWLrbCj3HYwqt8kt4aHTDJO1s GMSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dAll3k0Y; 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 o11-20020a0562140e4b00b004466c300c0fsi1316831qvc.396.2022.04.21.04.56.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:56:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dAll3k0Y; 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]:45956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhVQO-0005SQ-6k for patch@linaro.org; Thu, 21 Apr 2022 07:56:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUqX-0003Nc-AO for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:37 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:36824) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUqS-0003Xm-US for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:35 -0400 Received: by mail-wm1-x32c.google.com with SMTP id u17-20020a05600c211100b0038eaf4cdaaeso5654523wml.1 for ; Thu, 21 Apr 2022 04:19:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=c+3p6Fbz730AqqAeRKPa+9fqaNknD7WBGqtKg8sQzjk=; b=dAll3k0YjZvgD8NsoQayAtE85398/oh29v8IvYyQzzlNSjJdFkP0mhcWD35FAHnUpN Oko1uVeU6Ug8Xf76FqYaIqrVHbF5ACH6kY2VRcGk5Ha/BeCE33xN/nVygL6L5SQdkc0o tNdCAeeGua3R6JUn5KqLDhcEb1FIpFsXLvE/DCw6/GKpb3NqPCGhEtAHl69XFHzPYUHG 5cVXVBsR+NFxJkjUF5x0GWLj4G5otN1AnYxv6UJN/ytlCQYZcE5HY+XTkSJq3bM6jcsH c1mf4OSCFVMGcySBREJuCOx3PR6J7tD1z64Hq8pgszQuHR/p1JtuZvZJ1oVCyFWtEuHB E5gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c+3p6Fbz730AqqAeRKPa+9fqaNknD7WBGqtKg8sQzjk=; b=vGaIG1TXwRqrFeDojoDUTF/91/lbQO4QXut0FJK4totP7mBXtgcgdCeB0JHh5d+ux5 HoFYwqLYGpX9QE78BBeQG0UBmwTi+SLhiAhjNWbbGjx8hp7ht5BivlzcEx/IioQ1KT1Y /gi+k2tJCyRpO9cUUNAwIyID2iM6e6Tt9el73qKHuRxLBqIqh0axFOzAYfLMkKLJfGpr 214sDGvJ7fIrEbmDkIUbkqlkAZkMcvo24b9vWEpQpUeinmcR+6xN1i1zKGSk2Bk/1F57 HHSqkLG6kcJcVaxST20xRaKMquqW94kVnu16aLnF4016GH71FQUn/N0UTEW8U6S6u4/O Nqxg== X-Gm-Message-State: AOAM532yxzRhSXwl5iSKchBkWBuFKfDa4KG2V6rbDtG5klUhbzkQPoUD NnOl8HDQwo6R8DzF5zDgvldoik3peQXE6g== X-Received: by 2002:a7b:cb0d:0:b0:38e:aaf3:b08f with SMTP id u13-20020a7bcb0d000000b0038eaaf3b08fmr8135396wmj.12.1650539953371; Thu, 21 Apr 2022 04:19:13 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:12 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 26/31] hw/arm/realview: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ' Date: Thu, 21 Apr 2022 12:18:41 +0100 Message-Id: <20220421111846.2011565-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" From: Zongyuan Li Signed-off-by: Zongyuan Li Reviewed-by: Peter Maydell Message-id: 20220324181557.203805-2-zongyuan.li@smartx.com Signed-off-by: Peter Maydell --- hw/arm/realview.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 7b424e94a5f..d2dc8a89525 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -13,9 +13,11 @@ #include "hw/sysbus.h" #include "hw/arm/boot.h" #include "hw/arm/primecell.h" +#include "hw/core/split-irq.h" #include "hw/net/lan9118.h" #include "hw/net/smc91c111.h" #include "hw/pci/pci.h" +#include "hw/qdev-core.h" #include "net/net.h" #include "sysemu/sysemu.h" #include "hw/boards.h" @@ -53,6 +55,20 @@ static const int realview_board_id[] = { 0x76d }; +static void split_irq_from_named(DeviceState *src, const char* outname, + qemu_irq out1, qemu_irq out2) { + DeviceState *splitter = qdev_new(TYPE_SPLIT_IRQ); + + qdev_prop_set_uint32(splitter, "num-lines", 2); + + qdev_realize_and_unref(splitter, NULL, &error_fatal); + + qdev_connect_gpio_out(splitter, 0, out1); + qdev_connect_gpio_out(splitter, 1, out2); + qdev_connect_gpio_out_named(src, outname, 0, + qdev_get_gpio_in(splitter, 0)); +} + static void realview_init(MachineState *machine, enum realview_board_type board_type) { @@ -66,7 +82,6 @@ static void realview_init(MachineState *machine, DeviceState *dev, *sysctl, *gpio2, *pl041; SysBusDevice *busdev; qemu_irq pic[64]; - qemu_irq mmc_irq[2]; PCIBus *pci_bus = NULL; NICInfo *nd; DriveInfo *dinfo; @@ -229,14 +244,14 @@ static void realview_init(MachineState *machine, * and the PL061 has them the other way about. Also the card * detect line is inverted. */ - mmc_irq[0] = qemu_irq_split( - qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT), - qdev_get_gpio_in(gpio2, 1)); - mmc_irq[1] = qemu_irq_split( - qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN), - qemu_irq_invert(qdev_get_gpio_in(gpio2, 0))); - qdev_connect_gpio_out_named(dev, "card-read-only", 0, mmc_irq[0]); - qdev_connect_gpio_out_named(dev, "card-inserted", 0, mmc_irq[1]); + split_irq_from_named(dev, "card-read-only", + qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT), + qdev_get_gpio_in(gpio2, 1)); + + split_irq_from_named(dev, "card-inserted", + qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN), + qemu_irq_invert(qdev_get_gpio_in(gpio2, 0))); + dinfo = drive_get(IF_SD, 0, 0); if (dinfo) { DeviceState *card; From patchwork Thu Apr 21 11:18:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564333 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp355224map; Thu, 21 Apr 2022 04:41:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUAJ6oRB12WJR2EZkDK1CETLcDymG5+QGV4/3jf8urSYgzZxX5yThgsNDz+XuwtLi45UkQ X-Received: by 2002:a05:6214:5016:b0:446:33d5:c935 with SMTP id jo22-20020a056214501600b0044633d5c935mr18926129qvb.18.1650541279919; Thu, 21 Apr 2022 04:41:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650541279; cv=none; d=google.com; s=arc-20160816; b=jE+uINb8hCwSp6OC/5JPkpf9JOooc8mrZ45bn9YxYSD82339PQKlI4GsK6SC9baQvn YQYzili1q8Pl5T1oUCRllWMLzjp1dihrGV2Ahl5r2Ze3XF86U7gPbCOcBK8iHmkseRLI Surlq+64pht9Y//Ms1oSITfK1e+yiD5njkRocUP8TlduwZSfZu61a1jhkhDSljGOrIaS E4OmQR2Kys+2GTUVYsA4YYd7R9vd9s0OuSdLZLMaCYTr2cHZxYEcH+qlvanjWsZJMAQ+ vRSgf0TFhjDDVayNLt2uWFhpTKCF7in1l1da6/b1R/O6AnL63tqlgnVgdGv9lIWbNd6E Ez4w== 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=uM2Z8pOmM345Tmz6p1sACjfjRoZTp+FYU6GMrrVCQUQ=; b=NJ1w5kEcMJ5EnJ/41/djkOmBKJEjKA3zt1vzWcVN0mW8iGThjz9MimEsvzyVHCFceK kDXoh3w40vJHKGtZayXMFDR2jomBjnSuZ5LcL9VdheilzkYKTv7FFndCpwZ/FnSGT1VJ zWul6nx2vLsGE0eDZ7Nds1eDH9XQZYMMyK9YzuPUmEhAvH6VnYe+GbNY0MnFvGHKutUs ynbNsORAUO4bExYhf1h19vzIrmXhLfXuW72I+Z4bShgpg2eVcnOd1NuMUHFKQgsqmlN/ VWf9jilV8tO5cR1rOmmRTnimDl/CnQaOfoMTpY22KiX2Jsckk8WNi4IfIFrnT4ScXH7I BQbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HHP4jVN5; 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 z17-20020a376511000000b0069c5a280b7bsi1234968qkb.405.2022.04.21.04.41.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:41:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HHP4jVN5; 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]:45170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhVBX-00018F-Hd for patch@linaro.org; Thu, 21 Apr 2022 07:41:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUqU-0003MM-Ik for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:35 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:46608) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUqR-0003Xx-Ps for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:34 -0400 Received: by mail-wr1-x42a.google.com with SMTP id h25so177568wrc.13 for ; Thu, 21 Apr 2022 04:19:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=uM2Z8pOmM345Tmz6p1sACjfjRoZTp+FYU6GMrrVCQUQ=; b=HHP4jVN51SEgdlWe4LzqFH5voCB/4YczYRRrdxwYWYgCT6M5jvbyi9c/KfFDNOUnnT vzkVdOX65/0Jyv3u2D2uEujgNdJGqgQIWG2YsHc6G6vCiWhk1BbMLKkD6e43Gd7pqAyH JKPZKFRFRE6SWP6uqm2vyQm4MJqZpe0toM3B/SnCVutKcbmif3LTooz8TYYyZyL2n9Fn 0MxAJxUwarv8Q6PJptvD1VNxiiyBozdsNS8RVKbaNVQSM+eVM5MJJVmmPUqlceBppmOa Q5XrV9pAAVdu9+sas4aDVhCu5p569eXoTdfByLh9r17RtqgSb1k1sVY6nStzS2Eq0ty9 bFnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uM2Z8pOmM345Tmz6p1sACjfjRoZTp+FYU6GMrrVCQUQ=; b=h73WlVWiO7RxXRV92qtZpyJOIvacA91uCTCawCZRiGDDSvyLZX94MSFBVuCsAZYlG3 EKAvPx94YdIr34im87a51pHGI0x0OAXJ6kZkFkEHapDL6zdoIoA1MGDpJj6x+7UFl33d uMC9JVj2gIBqu6e5RuMqWOJANOlHja/kUkZlWUBmDEhgaR+2R2PRw9CVCvTN5nDfRj1V urVQe9zE+YgCAVreOlJ1DHx1jahZ6JI2fwh8qtv8Si8jq/UO2L5K+0Uc4EnkIm4O+/Me 12D6aAtuKCCPxLAoIKfSy6W8/JvbEiCeKmKVRmBCP8VM6zpfMY+Vns+p8hUmrbK/TzZH +L9A== X-Gm-Message-State: AOAM530jgbVYcW0FUzsA96tXs3UpLgJN7/j0pOUFwqCxU47/JxPy6rzL Dg9Nk/Brq+/merQaWCZraqoj3lpE7Pu/zQ== X-Received: by 2002:a5d:64a3:0:b0:20a:7931:5b84 with SMTP id m3-20020a5d64a3000000b0020a79315b84mr19823553wrp.407.1650539954144; Thu, 21 Apr 2022 04:19:14 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:13 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 27/31] hw/arm/stellaris: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ' Date: Thu, 21 Apr 2022 12:18:42 +0100 Message-Id: <20220421111846.2011565-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" From: Zongyuan Li Signed-off-by: Zongyuan Li Reviewed-by: Peter Maydell Message-id: 20220324181557.203805-3-zongyuan.li@smartx.com Signed-off-by: Peter Maydell --- hw/arm/stellaris.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index b6c8a5d6098..12c673c9172 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -9,6 +9,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "hw/core/split-irq.h" #include "hw/sysbus.h" #include "hw/sd/sd.h" #include "hw/ssi/ssi.h" @@ -1160,6 +1161,7 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) DeviceState *ssddev; DriveInfo *dinfo; DeviceState *carddev; + DeviceState *gpio_d_splitter; BlockBackend *blk; /* @@ -1237,9 +1239,18 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) &error_fatal); ssddev = ssi_create_peripheral(bus, "ssd0323"); - gpio_out[GPIO_D][0] = qemu_irq_split( - qdev_get_gpio_in_named(sddev, SSI_GPIO_CS, 0), + + gpio_d_splitter = qdev_new(TYPE_SPLIT_IRQ); + qdev_prop_set_uint32(gpio_d_splitter, "num-lines", 2); + qdev_realize_and_unref(gpio_d_splitter, NULL, &error_fatal); + qdev_connect_gpio_out( + gpio_d_splitter, 0, + qdev_get_gpio_in_named(sddev, SSI_GPIO_CS, 0)); + qdev_connect_gpio_out( + gpio_d_splitter, 1, qdev_get_gpio_in_named(ssddev, SSI_GPIO_CS, 0)); + gpio_out[GPIO_D][0] = qdev_get_gpio_in(gpio_d_splitter, 0); + gpio_out[GPIO_C][7] = qdev_get_gpio_in(ssddev, 0); /* Make sure the select pin is high. */ From patchwork Thu Apr 21 11:18:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564341 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp361660map; Thu, 21 Apr 2022 04:51:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzS8ycbAf3ENTfilxjYOAMZb04BK9ZRSndpvbGlyiEkDJvQI8roMz0zq71YdXOEGE1iVOFb X-Received: by 2002:a05:622a:507:b0:2e2:3401:49e3 with SMTP id l7-20020a05622a050700b002e2340149e3mr16622111qtx.560.1650541903537; Thu, 21 Apr 2022 04:51:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650541903; cv=none; d=google.com; s=arc-20160816; b=03r6/DyYvanimqzfTbPIPQsoHuG+pFv+BXhYDVHxtdP2R3kUrCXj9R09dc77ivvWGR 5xy0P+qfraCe6E9UnpbDMIBuFjRrJKQvWasM97grufz8j/fDKi/yc0Ffl1iqW01jTyuM WnIubn9KTfkV63vPXWm/pxwPObWJlIDC7W87MWKqWGK0dx5Z1L6XsXzpaKvIRNB8hFmk hAeS5V2YitydcvFXmA08nzGsI7pawopMA7znKTzGPYFNf+qdBrQUJqd05fJv6hk2GA3/ eKi9eaxzvcAhEzz8wtYHfCnM5eFhCxoqjZ2IxDgTxJAfmWozh/DqxiQtDnO42+jKQGvB 6j4Q== 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=dDB/DivYt5DY6348otTzGl2ix/NfxmzFGVdHPWkVBdI=; b=ao9R2jZXv/5wwuroaqWvwFuDBjlFwV76/+XjqdufV1ysexFm6JzjLF2Z152l7DPSCf 5g+WiB2FY+LcpIpAp6rXmIt0Vlf3+nGPrtBtNcNLGjQsV7ApNcU8Ao121eSIdnYWkL40 ZCX10WVp2JJLTVFgsw4NepxTbgSQsQd2zCS4sW+O2SFuCz4w4V4kDMRM+JtFl51hEkFL 3wobi/EIyT/O5wNwy1icoYAmr41M7dcXusMvEJIqKPqUoDrzBkXgPGW9wcsWu7ZpSleR ln2E/V2TF/uY2RobY7vjZWhgOPz0B+o0WmjpOETGedGru0w/NyaKK0HtvmuqmxLD9wbV 3HcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WBgqe8q/"; 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 c25-20020a05620a269900b0067e4be237d1si1480741qkp.22.2022.04.21.04.51.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:51:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WBgqe8q/"; 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]:37420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhVLb-0007UB-5S for patch@linaro.org; Thu, 21 Apr 2022 07:51:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUqW-0003NC-4L for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:37 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:45942) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUqR-0003Y6-QB for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:35 -0400 Received: by mail-wr1-x433.google.com with SMTP id w4so6176410wrg.12 for ; Thu, 21 Apr 2022 04:19:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=dDB/DivYt5DY6348otTzGl2ix/NfxmzFGVdHPWkVBdI=; b=WBgqe8q/1zdY+mVF4a7rEp1dSPgWyTIWKfJ94Ma58bP95zIvbGxEHclaPsq5S+5ru+ zvnrIbANRoWWYTo2YNq/Px4KX04dRU63qs/v64nC2+rP51HNLfmugyDZg+voTkI4/7Mg nhexUze/u6aJr2A38yld+qYoIi3OQ3XuWjBUOLOnoC3BrHobsn9Mofm8yH06A8Q6V3Nl 4EIu6aVK/ixlDrgTDID2ozy3Ed+G3we1YC5Gp9B3Kywd9J+IWM9t3ZypuwsKT7Rc7F6u R83uCfjScjPkmqI8cL7/stkg95ztCAef84spGW19nP9tIVPi0s3SYBSAmU8efnxpQNhl DXtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dDB/DivYt5DY6348otTzGl2ix/NfxmzFGVdHPWkVBdI=; b=nEMPNqGFcRSZ4z1UNzFYlLBNnEHAHqBRInPKmq2p9q3PKRD6HELl68NdGiNRW1+Ghw WpFWWYYqvPB+Lj8Lw/2ihs92U710mL1SbZTYrXco+6+1lIwbhzgwrsEDRWAi6TAvZI22 3ykml7B6ntLHKqSva5JYP3b0JxfzEW0Yyx8B/cXTdGB6rRX2rbpW4e4TQsQ9jAjKk1LM IkL2jwGJnhvYj/XZUWIaPydQwxuu5ExGFuzt12M9/Rz2YYbrK2+8LUVGd/z0Gb2tg6sZ eP7xz+d3GFXSXSn+zA4Mxo6kqDZdTZSWpisqSnT+YOi5qdIwel19TQ09ekDUA81ZAAHf M8wA== X-Gm-Message-State: AOAM530XPyUcvV8Ke/GgIVSwADO9G36tqrcTn45vyfMzlEhhchtraTT4 cTD5SFkz6onVfZJOgB5s805d7L0Pc8M+ZA== X-Received: by 2002:a05:6000:2ac:b0:20a:77c1:c64f with SMTP id l12-20020a05600002ac00b0020a77c1c64fmr18914416wry.588.1650539955088; Thu, 21 Apr 2022 04:19:15 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:14 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/31] hw/core/irq: remove unused 'qemu_irq_split' function Date: Thu, 21 Apr 2022 12:18:43 +0100 Message-Id: <20220421111846.2011565-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" From: Zongyuan Li Signed-off-by: Zongyuan Li Reviewed-by: Peter Maydell Message-id: 20220324181557.203805-5-zongyuan.li@smartx.com Resolves: https://gitlab.com/qemu-project/qemu/-/issues/811 Signed-off-by: Peter Maydell --- include/hw/irq.h | 5 ----- hw/core/irq.c | 15 --------------- 2 files changed, 20 deletions(-) diff --git a/include/hw/irq.h b/include/hw/irq.h index dc7abf199e3..645b73d2512 100644 --- a/include/hw/irq.h +++ b/include/hw/irq.h @@ -46,11 +46,6 @@ void qemu_free_irq(qemu_irq irq); /* Returns a new IRQ with opposite polarity. */ qemu_irq qemu_irq_invert(qemu_irq irq); -/* Returns a new IRQ which feeds into both the passed IRQs. - * It's probably better to use the TYPE_SPLIT_IRQ device instead. - */ -qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2); - /* For internal use in qtest. Similar to qemu_irq_split, but operating on an existing vector of qemu_irq. */ void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n); diff --git a/hw/core/irq.c b/hw/core/irq.c index 741219277b1..3623f711fe6 100644 --- a/hw/core/irq.c +++ b/hw/core/irq.c @@ -106,21 +106,6 @@ qemu_irq qemu_irq_invert(qemu_irq irq) return qemu_allocate_irq(qemu_notirq, irq, 0); } -static void qemu_splitirq(void *opaque, int line, int level) -{ - struct IRQState **irq = opaque; - irq[0]->handler(irq[0]->opaque, irq[0]->n, level); - irq[1]->handler(irq[1]->opaque, irq[1]->n, level); -} - -qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2) -{ - qemu_irq *s = g_new0(qemu_irq, 2); - s[0] = irq1; - s[1] = irq2; - return qemu_allocate_irq(qemu_splitirq, s, 0); -} - void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n) { int i; From patchwork Thu Apr 21 11:18:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564338 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp359248map; Thu, 21 Apr 2022 04:47:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXGuB3S+g5JFTRZ6gVkdpxXowIvP9taWl5Q1dwjXRu2VERaTkB5QUkMxK1H6ZkC1MeMinf X-Received: by 2002:ac8:5dca:0:b0:2f1:fcc6:d85a with SMTP id e10-20020ac85dca000000b002f1fcc6d85amr13602905qtx.72.1650541674225; Thu, 21 Apr 2022 04:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650541674; cv=none; d=google.com; s=arc-20160816; b=RZg8E5e2VNm2hyPoerkGM6ztrCTn5qZCMiH/kNoInTRz8LOJ6bm4SZsj6HyAt5yMxk D3vF0ulMhRwdOOlArCUHFBOK0tlevATQCFS/e4gc4Bdjurfk7KaYyTsFn8v5TGu57MTo ubqcvSwS4CK1iGDtmmLYmFvmBthNEKbLXjkgKFmEKHQ9fj6oxmEOmzU+CHrHZ43XtsGP 6njmtLJQnj3Y+3hBzh1RGiI/m2PGw8L4+2+jWl/qXCn3Kjne5eO8gBpDFGauDRoFhKiA Jg8WPNPsWFGBBlVGr2uDWsfsCxdjFeVeBe0H9EZVlctEJ92pL3p8ouOnL7QW6y3A0q95 64vA== 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=iC1dx7osygPCKxzESmzHpFu3XuxeglPRcqZ1T2HastM=; b=FIHUz3UIBXLxRkumbEve5C/b2tLnMDm9Rns+K3zbJ+0ZcpVOsEXScl9IgMH+dLKfNu /Xod6FySt2Bw0Lk3dUqCgmGSkPQlm5pD74wUARBq0bAKjs2RavOnhflrKy5+jT8rMdxY ThPhirMRv+q5tZfUIFjVkPfnr99VDChJ/MgeAK4oOfzgX1JSx2jBeJHaHuq3zTKxOzB7 kM0bHxFB8PEWrIioM25iUVUTnrKuzUo3k9gmM8Cx3GkkEFepHxZX9ROAjiplBOUClfGB aQs2YZc/mbv4Zo+cYDpwTH58UHm91uXKpgr+lltYbaJBkVjujCuCpmtIXWlsxRZ5fI5x +ZsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KO5f4YOl; 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 i9-20020ad45c69000000b00443d0548d13si1273711qvh.324.2022.04.21.04.47.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:47:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KO5f4YOl; 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]:56408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhVHt-0000zc-PA for patch@linaro.org; Thu, 21 Apr 2022 07:47:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUqR-0003Gm-QY for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:31 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:43848) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUqM-0003YY-9z for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:27 -0400 Received: by mail-wr1-x431.google.com with SMTP id g18so6191583wrb.10 for ; Thu, 21 Apr 2022 04:19:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=iC1dx7osygPCKxzESmzHpFu3XuxeglPRcqZ1T2HastM=; b=KO5f4YOle1iTvySe8e1oM8XoLsD3opyfMk7EHr9qLoXEljVzTy9UCGkrsm67mujFSE yFV3ubjfceRnCsm2Xh9B8zymzZHonJcizS144dnoSMjI1gp/sQC3IsKo83zzWHRm8K6i MueX/HLArfBIX3LRREDodrqrEyKRYtYn7tsGfGv1GTkPf32zo4xVR6Lwk0+Dm043FOW6 DJW3jP1qUCSmJtvo2W3c1X1AQVkih8yAUiksLEiUYKnc+7cTgujnqFpSqa08O2pn5JXC DxxXymm/QBJd0V9lTHepTyTrLPWCzqmjKAH4C7uB71Eu7Sb/NSsthHLAIzgfJ8R9yDXH KhQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iC1dx7osygPCKxzESmzHpFu3XuxeglPRcqZ1T2HastM=; b=cOCXQFyT06BSpmls5obUacojczcIyHw8W3Oi6uuEuKeBncKg7y4GJFShcgkXtHP+o3 yTUt45v3kJt1y5vgmrI+N7/Vo6jS1gw3jqXPAs91RzliloqOwMrkaxVVKXdPKpSWEKqd iYk4gBayl1DpBYjHc5PfERcvJvg3xve4+ITIfKXwZy3T474B0C9z4qpQQQHqBdVAffkq 39VTib0KaFJ1XYxt/mVvaAXh/u8TOdQYHNh9xERb7Gk0MgS5I5k5C5G8E+6V8TuimJ6h lhlREBWT9XTZcNOOY+j7YCVmqvAeFD2FEUSjmIQodAY1jqqfGOuA1zOGtGJTv4sylEdh mIFQ== X-Gm-Message-State: AOAM532h31477bL3MO3+61lX5xToiAr819RsWIlytyJEEoERYXFRrGt1 if65QoxxjW/yQ49Q+a3K1vcV4vZ94GKF3w== X-Received: by 2002:a05:6000:2cb:b0:20a:88c4:ec9f with SMTP id o11-20020a05600002cb00b0020a88c4ec9fmr18060790wry.43.1650539956750; Thu, 21 Apr 2022 04:19:16 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:16 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/31] hw/arm/virt: impact of gic-version on max CPUs Date: Thu, 21 Apr 2022 12:18:44 +0100 Message-Id: <20220421111846.2011565-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" From: Heinrich Schuchardt Describe that the gic-version influences the maximum number of CPUs. Signed-off-by: Heinrich Schuchardt Message-id: 20220413231456.35811-1-heinrich.schuchardt@canonical.com [PMM: minor punctuation tweaks] Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- docs/system/arm/virt.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst index 1544632b674..1297dff5228 100644 --- a/docs/system/arm/virt.rst +++ b/docs/system/arm/virt.rst @@ -96,9 +96,9 @@ gic-version Valid values are: ``2`` - GICv2 + GICv2. Note that this limits the number of CPUs to 8. ``3`` - GICv3 + GICv3. This allows up to 512 CPUs. ``host`` Use the same GIC version the host provides, when using KVM ``max`` From patchwork Thu Apr 21 11:18:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564342 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp364545map; Thu, 21 Apr 2022 04:56:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8CONI9QANBJo5IUf2SHk4IUeSjZ6qXQxG6CHNatR/BhEzy7yFvNmfFDfpi1ed3U56PlQk X-Received: by 2002:a05:620a:408e:b0:69e:d439:c7a0 with SMTP id f14-20020a05620a408e00b0069ed439c7a0mr4603674qko.641.1650542170547; Thu, 21 Apr 2022 04:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650542170; cv=none; d=google.com; s=arc-20160816; b=sAQjrJEJjqt9maNCUh87gCVz5Oj/u6pE5pOH+15i3z3YXBSagT/HHg5tlnTGLaDpz2 IZ9mQWoeaDZJmrxucD/tsNxlHoqLMV+0M9tTo5tgqa2YO66RIa1IA9zIlqFqcd4WYaHU vVeo9DHQ9goUKrYckflk738en2yrVSE/caXiMgEkAfPaht9DcskA3gHiUdWf21Q9TCxx Giu4A9B3CaO/R4EV0IritYZqkyGyw1j+thKvRXl9XfRV2KOrp+70j186V4Vwv6NZjzuW In7i7G1wmEdUXE3/+4rKl6Ud4v1idsOI9aG0Mp/DvnY+9zmUrXgj0dkdg5gHLbTlkcio A7Mw== 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=1vQQmnvrDnu1486ihClizISxJdbac6HgCRxcsBLC0jQ=; b=MHwAoiUC8qkeIf1Yojg1o4gr7QW7j2bQDQJq8PoK6WjDql3A4dv3iiExQKFATse2Nl ZiWTxbKsSnsDzBtADBADyrDXEL3XZGpnrp3slr4NQTOnGJvvPiPUEazAQzq29nX4vlV8 Fv3A5m+qS6oM1tqmumWzbH4RLeIYR3swiLXuiFepnQfsM6/q2nW7moVQSnNTto91Yl/G CZK0XsJgF7frItfFLwJaoYdpVRnc+Nba7oOynVo5KtMDnp6F0OXiFeXpHu2YXqXjZTlT 6ufD/7N9TaZX1OffhHuDOoNgIS2td+zO75qg4Dn5keN8ECiB/qQaSU9wd1RzLUgfUssP XIaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ses9ETiU; 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 y14-20020ac85f4e000000b002e1fbf3be71si1353790qta.98.2022.04.21.04.56.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:56:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ses9ETiU; 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]:45288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhVPu-0004pn-3x for patch@linaro.org; Thu, 21 Apr 2022 07:56:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59714) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUqW-0003NF-4a for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:36 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:45940) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUqR-0003Yf-QD for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:35 -0400 Received: by mail-wr1-x430.google.com with SMTP id w4so6176572wrg.12 for ; Thu, 21 Apr 2022 04:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=1vQQmnvrDnu1486ihClizISxJdbac6HgCRxcsBLC0jQ=; b=ses9ETiUbAm0kzmUJWLRZdA9dCCpjd848fLEzR6NyJ6Z0dJFazIaAr3VggB+0JUzC8 cawe4ULRfCuzZ2pk1Wm/L7sbKJaaUCDJ/SqtgbcI6B6t3bqfcgIeLogWUdYCqZSzLEsh Wmln/ckjtbQB7W72EDHipCY4ew/RxcLKtz2BPHfRTHgGAf8LuEFRSKI+dmsp09tKD/vP 9x8t/0DB16I/8+vKdJLx6NuvgxZvCynrjxRO8zJpiOiTdHp8IMMbypQeozQ7W7PzXVF1 s/F+YM0BcnJSCq66DD4YUJ7K2kDyMhLSVBCRBhJDosBop/PlWrI/Qn6QArLj9UuuxLS9 fvuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1vQQmnvrDnu1486ihClizISxJdbac6HgCRxcsBLC0jQ=; b=KFLL4+2rIj5wCGNlhIXyryj4giH/tzd4L4ndq1k36RN/BbM4ll037figDyLnn6uUw4 /xwsRVQ07gZxRp9AcfYY2wkdsJ9/UjQ62leILjFM6LUN1F98Uan6fTI5bLDsAhLOMd4y AdELdHnjeN2Ix0xTr5BS2ja25TitwqqGU41EcjMgR+z5SQ2b67vbpDZ18h0z8VgsFX33 fyCSJVQyI6rboeESj7jYrmB1wdPE8zPj7HBSwXiZxO5A4B8Dnz1srUEP3mGIF7OC4pyt K0bwKKqU44m0fJ8lTOqPeM+RLIEOlkc5/btpJKaAKDd1lG7W2Ow0rpHKA+mdjldLymUP H49g== X-Gm-Message-State: AOAM533/aHKBvYA/Jd6qM2uM+zMZaRmEIhabsQ7WN6DMGcldEUCYza3q 1Mom9ERsMyjI7/jRdoKNefZenwZONomFtw== X-Received: by 2002:a5d:64c7:0:b0:20a:8785:eb43 with SMTP id f7-20020a5d64c7000000b0020a8785eb43mr18353638wri.210.1650539957539; Thu, 21 Apr 2022 04:19:17 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:17 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/31] hw/misc: Add PWRON STRAP bit fields in GCR module Date: Thu, 21 Apr 2022 12:18:45 +0100 Message-Id: <20220421111846.2011565-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" From: Hao Wu Similar to the Aspeed code in include/misc/aspeed_scu.h, we define the PWRON STRAP fields in their corresponding module for NPCM7XX. Signed-off-by: Hao Wu Reviewed-by: Patrick Venture Message-id: 20220411165842.3912945-2-wuhaotsh@google.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/misc/npcm7xx_gcr.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/hw/misc/npcm7xx_gcr.h b/include/hw/misc/npcm7xx_gcr.h index 13109d9d324..9419e0a7d2a 100644 --- a/include/hw/misc/npcm7xx_gcr.h +++ b/include/hw/misc/npcm7xx_gcr.h @@ -19,6 +19,36 @@ #include "exec/memory.h" #include "hw/sysbus.h" +/* + * NPCM7XX PWRON STRAP bit fields + * 12: SPI0 powered by VSBV3 at 1.8V + * 11: System flash attached to BMC + * 10: BSP alternative pins. + * 9:8: Flash UART command route enabled. + * 7: Security enabled. + * 6: HI-Z state control. + * 5: ECC disabled. + * 4: Reserved + * 3: JTAG2 enabled. + * 2:0: CPU and DRAM clock frequency. + */ +#define NPCM7XX_PWRON_STRAP_SPI0F18 BIT(12) +#define NPCM7XX_PWRON_STRAP_SFAB BIT(11) +#define NPCM7XX_PWRON_STRAP_BSPA BIT(10) +#define NPCM7XX_PWRON_STRAP_FUP(x) ((x) << 8) +#define FUP_NORM_UART2 3 +#define FUP_PROG_UART3 2 +#define FUP_PROG_UART2 1 +#define FUP_NORM_UART3 0 +#define NPCM7XX_PWRON_STRAP_SECEN BIT(7) +#define NPCM7XX_PWRON_STRAP_HIZ BIT(6) +#define NPCM7XX_PWRON_STRAP_ECC BIT(5) +#define NPCM7XX_PWRON_STRAP_RESERVE1 BIT(4) +#define NPCM7XX_PWRON_STRAP_J2EN BIT(3) +#define NPCM7XX_PWRON_STRAP_CKFRQ(x) (x) +#define CKFRQ_SKIPINIT 0x000 +#define CKFRQ_DEFAULT 0x111 + /* * Number of registers in our device state structure. Don't change this without * incrementing the version_id in the vmstate. From patchwork Thu Apr 21 11:18:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564344 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp366471map; Thu, 21 Apr 2022 04:59:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3VHgfbZOKevThK602yXqZchBw16np233tzYiyYD67BYM6xVbIRL2/7H/WapCa2hjGMCbe X-Received: by 2002:a05:622a:15d0:b0:2f1:f883:f697 with SMTP id d16-20020a05622a15d000b002f1f883f697mr15445396qty.106.1650542366554; Thu, 21 Apr 2022 04:59:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650542366; cv=none; d=google.com; s=arc-20160816; b=ydzpZEZX5llVwUAPNX8C+HB9K80g5sYYR1YxQ9/8v8I1+x3RO142kExS9P4O6uMA9E SoohFzuxJvSIM9CM+iwzjOS39xrVhhAODYLMjj8My0Bn3e9rbYHmd8YTvkPWJy5AlBVI NAMI5EDBOv1QZlF/J49RTdrWxqCB/1gsNvi7g8HRV10jH7a1i8t2u5b0hhnhrDr2e5jT WcxYyiIIqqx29H7oDT54UzQpyQdArrJ5ZUtCP2psFioJ86FZr6rLl9jddT6Brybur1Jh xQN12pctusQPtaHVl2zY+SbpYSHVOdC9ymNMTURJSF7DjQqtUaJ+qgTKMPLaNOmzvb6q xQrg== 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=VUeeNu4fbGv2sc/gKkaaAIAzl6d3eREzjCssGM3/Sx0=; b=Sw+XgquoAOEEO+vCBoXccxKec5HisJeG3IRyETef752OsIzRhYjXr1v5Ks3oxdmyJ8 CFWarGcKDOIwmY5rd9aBzSuXQ6Mqd2o++7M4lvMGHhgU/B5eciScVV/CO/m9MOtqwxHc g8ehLgkcKQzc5y3kMaS+wKQsQG/pHeD9KwR1McWwaWeiYnqU6VbGLa8omSzgUkfQaDAK /YLG8Ce2kmKHc7Pk5HD+j5/KJ6Nyalwewynr52nUWV0emaJAv8XcpILaP8TRCiTdjFRg K/xlq3Iy7A1+XPLHhvI6ZrdAhp9Zs4Pc7oVctAVBT5ZTBOCJFQPPY+vHUBAfe8eyeyV3 9b8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LLRSaHt2; 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 c11-20020ac85a8b000000b002ebccf4adabsi1311061qtc.481.2022.04.21.04.59.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 04:59:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LLRSaHt2; 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]:53796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhVT3-0005NE-6U for patch@linaro.org; Thu, 21 Apr 2022 07:59:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhUqX-0003NT-7S for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:37 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:44913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhUqR-0003ZF-QB for qemu-devel@nongnu.org; Thu, 21 Apr 2022 07:19:35 -0400 Received: by mail-wr1-x436.google.com with SMTP id b19so6177557wrh.11 for ; Thu, 21 Apr 2022 04:19:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=VUeeNu4fbGv2sc/gKkaaAIAzl6d3eREzjCssGM3/Sx0=; b=LLRSaHt2MTUvjCW0k5r/i0vM56a2nM8UmXvsN1nlemxtwLbmsTt5LiiiNpsTJSmMGB g7rhw9goVmWM9PtBHaZY9fpExD0I6SSsybl+RaPpT/DkO8NmU0b9PslPqIzjeORtTCsW qKOWac3VpdhgSeqtcR2FpVsEtY8akNihOl0INLSEOnbPgPCByCuu+YJUuktOXRwb5YpP +2pnj3+yfU5X8RgpB3VPEf6gJaHbiCCiaJ4BE0sPWy3ipVRzP90kvcIEtZKYhtDh4z+b ycrZXgQRyN7EzPhHn76wFa1Y3ATVkIYD1Ds4/M0gTgWQdufGnbTI5tZsv9PB8Td6fKqg HYvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VUeeNu4fbGv2sc/gKkaaAIAzl6d3eREzjCssGM3/Sx0=; b=beNwGHQwUrWVzlZtnJhL0y6vJUlz5+eVA93t1xN084lQ6DHZXO+N2LfIl+kiZQ2KBG Gzc5n5ktxhHBvG98TWW0ibSFQOf/X8V8jMWYeXtTowkhAAh02WxwbAmBf5RSc2NF0tI0 M3uYqd+gv89FNvwCg1hOZas27j6KvqwM2DjRvX9WOiIEJ746ab/Qmx4Ayb7pdvOuLryl Zg6Y7SMggdD7Kcy3M+NO21WfGEIZ9wClDICAeHPwtAs1XUm7Ejihkx81EZuGp9VcZtKl Hk1WnXvsvExXQH1ou8NdRhy96Dm/LwoLqQJNE1pQo7xZqYUYFKjwo0cEapAcbBDHOwGw sB7g== X-Gm-Message-State: AOAM531RGeUkQjJGHG/+V92gj1dPWq5g5CMgWy1mekB7lXUYogYpb1SA Av/3OGaW7sSwtxUQkF47RAEtOJ4q6ODx2w== X-Received: by 2002:a5d:4a81:0:b0:207:9abe:2908 with SMTP id o1-20020a5d4a81000000b002079abe2908mr18820062wrq.341.1650539959284; Thu, 21 Apr 2022 04:19:19 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e4-20020a5d6d04000000b0020a8bbbb72bsm2597694wrq.97.2022.04.21.04.19.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 04:19:18 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 31/31] hw/arm: Use bit fields for NPCM7XX PWRON STRAPs Date: Thu, 21 Apr 2022 12:18:46 +0100 Message-Id: <20220421111846.2011565-32-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421111846.2011565-1-peter.maydell@linaro.org> References: <20220421111846.2011565-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" From: Hao Wu This patch uses the defined fields to describe PWRON STRAPs for better readability. Signed-off-by: Hao Wu Reviewed-by: Patrick Venture Message-id: 20220411165842.3912945-3-wuhaotsh@google.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/npcm7xx_boards.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index 0678a56156f..6bc6f5d2fe2 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -30,11 +30,25 @@ #include "sysemu/sysemu.h" #include "sysemu/block-backend.h" -#define NPCM750_EVB_POWER_ON_STRAPS 0x00001ff7 -#define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff -#define QUANTA_GBS_POWER_ON_STRAPS 0x000017ff -#define KUDO_BMC_POWER_ON_STRAPS 0x00001fff -#define MORI_BMC_POWER_ON_STRAPS 0x00001fff +#define NPCM7XX_POWER_ON_STRAPS_DEFAULT ( \ + NPCM7XX_PWRON_STRAP_SPI0F18 | \ + NPCM7XX_PWRON_STRAP_SFAB | \ + NPCM7XX_PWRON_STRAP_BSPA | \ + NPCM7XX_PWRON_STRAP_FUP(FUP_NORM_UART2) | \ + NPCM7XX_PWRON_STRAP_SECEN | \ + NPCM7XX_PWRON_STRAP_HIZ | \ + NPCM7XX_PWRON_STRAP_ECC | \ + NPCM7XX_PWRON_STRAP_RESERVE1 | \ + NPCM7XX_PWRON_STRAP_J2EN | \ + NPCM7XX_PWRON_STRAP_CKFRQ(CKFRQ_DEFAULT)) + +#define NPCM750_EVB_POWER_ON_STRAPS ( \ + NPCM7XX_POWER_ON_STRAPS_DEFAULT & ~NPCM7XX_PWRON_STRAP_J2EN) +#define QUANTA_GSJ_POWER_ON_STRAPS NPCM7XX_POWER_ON_STRAPS_DEFAULT +#define QUANTA_GBS_POWER_ON_STRAPS ( \ + NPCM7XX_POWER_ON_STRAPS_DEFAULT & ~NPCM7XX_PWRON_STRAP_SFAB) +#define KUDO_BMC_POWER_ON_STRAPS NPCM7XX_POWER_ON_STRAPS_DEFAULT +#define MORI_BMC_POWER_ON_STRAPS NPCM7XX_POWER_ON_STRAPS_DEFAULT static const char npcm7xx_default_bootrom[] = "npcm7xx_bootrom.bin";