From patchwork Fri Feb 5 17:00:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 376962 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp2489885jah; Fri, 5 Feb 2021 10:08:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRXep2IbjG0VYMVcuzdp8+NL7OWRAbXD2ChV7L4C8CFGcEwtY2rjSyg6EFvv2hS1Yt6FEN X-Received: by 2002:a25:5f49:: with SMTP id h9mr8108307ybm.213.1612548483861; Fri, 05 Feb 2021 10:08:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612548483; cv=none; d=google.com; s=arc-20160816; b=B0NzU0pna5T6kmTZxWihUnDa7Pp1xxvfIRNjOfTqBzMYDZaLYj4dkOBdZTIk5c+5UY I4y38dP/IFuBloVCixyxROo8a/OikItrl+jDa+PqV0QQibioiXUV3htNW5AG1o5egeAR thC761ktYx/ZQWSI4BhFPQekSkTIAJ7C5KH5axphpuAgoh6HIwDvUKD1+HgL9c4MRShp ewBJtApfHx6sw76j7GJLyu69rwnc00rBflHJI+/xjjqIB+077g/C0xpMeDGHd9+44NHP vyE0IgJ6sgU9MuSxhVsVerg1NMTO9D7HHNWTuOCu17+tp5HjKHF+9/kZDqSbU0OCy91J GOUA== 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=WtrfuXabVXGeTIyTEVS5d0lsWCXmLnI61ZuEmNjOGlM=; b=pDkBQTvmChfz4Vc6H/mNjwp33E5a+8cVtOAI2URjXwazLgpzDLZQdqLA44Hb8e3SNA UEmLvKoafXgUCtIDwtRCp9oPWyV2JJzW0qertvLIfYV2n8Jh0MrTxWeXdr4Mi3lKxeuJ 7KnTQhJ32NzfeBcLbLQm3ZFOcsNTZAFBgnZKHoQIIEbK4WW6MzEbLlBJIzEroyTtFa3x ZP2drISxU6ArkCcsYrb7AdsEKK5Zq8xHrvhWVCtE4lRejIBXN8VYPoKWfVLuDj4wqs9L v3rOvVNRrpw+4vEcKMV1mYX0UBJPq7S9hySX68qm2PwyNVJlucNmIpUuErHfmBZfomBH +zfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DDtqw24M; 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 o18si8716899ybk.270.2021.02.05.10.08.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Feb 2021 10:08:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DDtqw24M; 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]:40846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l85WV-00072t-C1 for patch@linaro.org; Fri, 05 Feb 2021 13:08:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l84Ta-0006kL-Uz for qemu-devel@nongnu.org; Fri, 05 Feb 2021 12:00:59 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:35371) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l84T8-00043W-N7 for qemu-devel@nongnu.org; Fri, 05 Feb 2021 12:00:56 -0500 Received: by mail-wr1-x42a.google.com with SMTP id l12so8485702wry.2 for ; Fri, 05 Feb 2021 09:00:29 -0800 (PST) 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=WtrfuXabVXGeTIyTEVS5d0lsWCXmLnI61ZuEmNjOGlM=; b=DDtqw24MGTthrvTCDmCVUhvyNywQQ3ySB1PCZmmdqA69MvBPLN8u+GuH550lICpKTM /2Ur1N+ajMBksskb/5L85bcM0JId2ij6HExRnzFXFAyyQI2m4hCMGJRJYVuHNmeGNN3F zsX+EspckPaQQftqV2kqKbLrT2u4/JSCWPyWOCG2JpOAeev7VVgyIhQijjSeZ8LSEiGc kxeOdU7UilnarRePQ0M2zVlXuT94V52X55+xXMh/LN8HIy3xIt3qZQOKZt0hmJSY+B+O /xkdf0icRQFKPVF/Tcg1aOOP2u49grsQlKA5VCDHhwYy2NB+eIvTXmtc/urONqgoq7fR ZUvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WtrfuXabVXGeTIyTEVS5d0lsWCXmLnI61ZuEmNjOGlM=; b=dRJ+l6XpRgVZ4SGm3xqscbkeyawISNoJSWJ3FxgknsAFO/xjg5Ff6wufSXhHrrrcMS v3LIa7arEbiXbP7hcEPl02/UDS/fnvMd0V1C609WcTQtmVEWzE+Ruw2+3EdOQsrnNENF AVALFX74p6jdtytOa9FAdI5AZBMQ6T0I5bx2UKjFvqJT+4FEirmiFyEBMWdpyZp9yAFG dI+8spb2Zz583vd+qCOdyx7eqdrS7R2N0EoDhtjjBTcbmEZgq0vK3Kh/3j15LqjHPcmX KeICJHFC0kRcZCbb1dSHHEIj8cN0YDtwkz/oD+Lu3gJjFrCZbMm+56TQQXVMaecSzCGc Ekeg== X-Gm-Message-State: AOAM533KGPl1sg8eDBpx25G28gkyFmsIFPEGZFr9ilEk9E8NzR9ee5tC Zopxw+5Ta3kF12hqbpiBh4aUanivt2Dbkg== X-Received: by 2002:adf:f182:: with SMTP id h2mr5997610wro.355.1612544429075; Fri, 05 Feb 2021 09:00:29 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id l11sm12200010wrt.23.2021.02.05.09.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 09:00:28 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 09/24] hw/arm/mps2-tz: Make number of IRQs board-specific Date: Fri, 5 Feb 2021 17:00:04 +0000 Message-Id: <20210205170019.25319-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210205170019.25319-1-peter.maydell@linaro.org> References: <20210205170019.25319-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 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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 AN524 has more interrupt lines than the AN505 and AN521; make numirq board-specific rather than a compile-time constant. Since the difference is small (92 on the current boards and 95 on the new one) we don't dynamically allocate the cpu_irq_splitter[] array but leave it as a fixed length array whose size is the maximum needed for any of the boards. Signed-off-by: Peter Maydell --- hw/arm/mps2-tz.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c index 4d8e42fa6b6..0f021676854 100644 --- a/hw/arm/mps2-tz.c +++ b/hw/arm/mps2-tz.c @@ -65,7 +65,7 @@ #include "hw/qdev-clock.h" #include "qom/object.h" -#define MPS2TZ_NUMIRQ 92 +#define MPS2TZ_NUMIRQ_MAX 92 typedef enum MPS2TZFPGAType { FPGA_AN505, @@ -81,6 +81,7 @@ struct MPS2TZMachineClass { const uint32_t *oscclk; uint32_t fpgaio_num_leds; /* Number of LEDs in FPGAIO LED0 register */ bool fpgaio_switches; /* Does FPGAIO have SWITCH register? */ + int numirq; /* Number of external interrupts */ const char *armsse_type; }; @@ -105,7 +106,7 @@ struct MPS2TZMachineState { SplitIRQ sec_resp_splitter; qemu_or_irq uart_irq_orgate; DeviceState *lan9118; - SplitIRQ cpu_irq_splitter[MPS2TZ_NUMIRQ]; + SplitIRQ cpu_irq_splitter[MPS2TZ_NUMIRQ_MAX]; Clock *sysclk; Clock *s32kclk; }; @@ -140,8 +141,9 @@ static qemu_irq get_sse_irq_in(MPS2TZMachineState *mms, int irqno) { /* Return a qemu_irq which will signal IRQ n to all CPUs in the SSE. */ MachineClass *mc = MACHINE_GET_CLASS(mms); + MPS2TZMachineClass *mmc = MPS2TZ_MACHINE_GET_CLASS(mms); - assert(irqno < MPS2TZ_NUMIRQ); + assert(irqno < mmc->numirq); if (mc->max_cpus > 1) { return qdev_get_gpio_in(DEVICE(&mms->cpu_irq_splitter[irqno]), 0); @@ -428,7 +430,7 @@ static void mps2tz_common_init(MachineState *machine) iotkitdev = DEVICE(&mms->iotkit); object_property_set_link(OBJECT(&mms->iotkit), "memory", OBJECT(system_memory), &error_abort); - qdev_prop_set_uint32(iotkitdev, "EXP_NUMIRQ", MPS2TZ_NUMIRQ); + qdev_prop_set_uint32(iotkitdev, "EXP_NUMIRQ", mmc->numirq); qdev_connect_clock_in(iotkitdev, "MAINCLK", mms->sysclk); qdev_connect_clock_in(iotkitdev, "S32KCLK", mms->s32kclk); sysbus_realize(SYS_BUS_DEVICE(&mms->iotkit), &error_fatal); @@ -439,8 +441,9 @@ static void mps2tz_common_init(MachineState *machine) * board. If there is only one CPU, we can just wire the device IRQ * directly to the SSE's IRQ input. */ + assert(mmc->numirq <= MPS2TZ_NUMIRQ_MAX); if (mc->max_cpus > 1) { - for (i = 0; i < MPS2TZ_NUMIRQ; i++) { + for (i = 0; i < mmc->numirq; i++) { char *name = g_strdup_printf("mps2-irq-splitter%d", i); SplitIRQ *splitter = &mms->cpu_irq_splitter[i]; @@ -693,6 +696,7 @@ static void mps2tz_an505_class_init(ObjectClass *oc, void *data) mmc->len_oscclk = ARRAY_SIZE(an505_oscclk); mmc->fpgaio_num_leds = 2; mmc->fpgaio_switches = false; + mmc->numirq = 92; mmc->armsse_type = TYPE_IOTKIT; } @@ -713,6 +717,7 @@ static void mps2tz_an521_class_init(ObjectClass *oc, void *data) mmc->len_oscclk = ARRAY_SIZE(an505_oscclk); mmc->fpgaio_num_leds = 2; mmc->fpgaio_switches = false; + mmc->numirq = 92; mmc->armsse_type = TYPE_SSE200; }