From patchwork Fri Feb 5 17:00:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 12070645 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF82EC4332B for ; Fri, 5 Feb 2021 17:59:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4BF2564E7B for ; Fri, 5 Feb 2021 17:59:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4BF2564E7B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l85Ns-00067G-3F for qemu-devel@archiver.kernel.org; Fri, 05 Feb 2021 12:59:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l84U2-0007GE-PJ for qemu-devel@nongnu.org; Fri, 05 Feb 2021 12:01:26 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:42811) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l84TZ-00044S-M6 for qemu-devel@nongnu.org; Fri, 05 Feb 2021 12:01:26 -0500 Received: by mail-wr1-x435.google.com with SMTP id c4so8409761wru.9 for ; Fri, 05 Feb 2021 09:00:33 -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=Pkc1ViGT7MqLH1WJfEkEx25IDm75/A8GGd4uuqI01Qc=; b=o7QQMVG1wzL8HDe6bM09YFdykZH+bsdJmIUbou0erH8kkvtY4khkPS/+LvmAr0H1/7 GdmBK5IK54Ay7swHinKNAaJK39bCL2ohY9bwbca3vBHKJ255sjZJSDx3/tR07/ONacyl e2yIai33vxDMXJ6h6lfM9+/z09ys0pFJRHQxcluSFo8PzeZuShj8+FFhxj8MpKi8XTmw RBB3VdJ2uIM7eMF/2aDDdm5KbCyWrOAB2jRVfDB7a8BLxPeJhVSh2VNozL7Th8L3hEyL cP+t1QmFMZ933Ip8vrqnW9Fpv3lYpV8B0ZaIUTNc09hiTj4UTP24Fw7CsfbvIzBcgoQH WjAQ== 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=Pkc1ViGT7MqLH1WJfEkEx25IDm75/A8GGd4uuqI01Qc=; b=QX7GgFnf+XIdpxz2x/OgsFk2XNhDeE7afotZkVKc8cTg5MI1plqvR/cHD6ntubN7jT SmfZryPCbN0xRpN9QGU795S9cy2gqifkRo87ODlToPWTY+GT4pVFTAW+ogk6+jwk3fAv LMyP3zfci5dT7dQELnfwR0l2dvIM9hePQ3K+iGmN18ICO7YfYnRtAfBtQUe6g7/qDvyr cIGye67AOvlwQH891+nKxuKm3zJg+Xd+AwLItaATfwRNGwIc1Re7IQJdrSWFmHtZw77m u2Od2YktC//UpkT5RYjFuvdRzPLWGqeEvFNsPgyFYwIdAwxIhn8PLIpw5T5jZjiHiEaB PsZg== X-Gm-Message-State: AOAM531H62fdFGeSh0pEaOH401QD9Igg3VACLQ4+tJYTt9U5JV08C+xN 4eox05Yo9eKBrO0+ryhBM2Dsyg== X-Google-Smtp-Source: ABdhPJxGACVZ+rk54LEjmLHN42RIa+ExSZ3Jw3pj/oy9NPJyimmdHmLrTEHve1ASyooH/uEHpY9OjQ== X-Received: by 2002:adf:e411:: with SMTP id g17mr6177695wrm.296.1612544433205; Fri, 05 Feb 2021 09:00:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 09:00:32 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 14/24] hw/arm/mps2-tz: Size the uart-irq-orgate based on the number of UARTs Date: Fri, 5 Feb 2021 17:00:09 +0000 Message-Id: <20210205170019.25319-15-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::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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We create an OR gate to wire together the overflow IRQs for all the UARTs on the board; this has to have twice the number of inputs as there are UARTs, since each UART feeds it a TX overflow and an RX overflow interrupt line. Replace the hardcoded '10' with a calculation based on the size of the uart[] array in the MPS2TZMachineState. (We rely on OR gate inputs that are never wired up or asserted being treated as always-zero.) Signed-off-by: Peter Maydell --- hw/arm/mps2-tz.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c index 07694413005..87993516816 100644 --- a/hw/arm/mps2-tz.c +++ b/hw/arm/mps2-tz.c @@ -516,13 +516,18 @@ static void mps2tz_common_init(MachineState *machine) */ memory_region_add_subregion(system_memory, 0x80000000, machine->ram); - /* The overflow IRQs for all UARTs are ORed together. + /* + * The overflow IRQs for all UARTs are ORed together. * Tx, Rx and "combined" IRQs are sent to the NVIC separately. - * Create the OR gate for this. + * Create the OR gate for this: it has one input for the TX overflow + * and one for the RX overflow for each UART we might have. + * (If the board has fewer than the maximum possible number of UARTs + * those inputs are never wired up and are treated as always-zero.) */ object_initialize_child(OBJECT(mms), "uart-irq-orgate", &mms->uart_irq_orgate, TYPE_OR_IRQ); - object_property_set_int(OBJECT(&mms->uart_irq_orgate), "num-lines", 10, + object_property_set_int(OBJECT(&mms->uart_irq_orgate), "num-lines", + 2 * ARRAY_SIZE(mms->uart), &error_fatal); qdev_realize(DEVICE(&mms->uart_irq_orgate), NULL, &error_fatal); qdev_connect_gpio_out(DEVICE(&mms->uart_irq_orgate), 0,