From patchwork Fri Apr 22 10:03: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: 564772 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp322501map; Fri, 22 Apr 2022 03:06:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzK3VSzz7DqUFlLC/0xPMoQOptK3yKvF4QkaoFxpS+oUO1N+e+pleIBVZh3aRa9bb+6F5X X-Received: by 2002:a05:6214:29e7:b0:446:6d26:2440 with SMTP id jv7-20020a05621429e700b004466d262440mr2600911qvb.118.1650621977840; Fri, 22 Apr 2022 03:06:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650621977; cv=none; d=google.com; s=arc-20160816; b=PDreypz8/epm/22FC+3HVGKx+PRpXK2Qr/2K/5XabKvmwN+Jc/31c7BfBiKwns9DPX jnnpFtwLnL3cd2tah4e95Oe7FgR9rsmdr7+2e6Qrp++LHQXYFUm/3050hVGbd9Q567wV 3KWpYSCzkTwVfp8PYuWvX3n3HCJ3tKBqLIG4CxQX+jzjNNktCnhU/9dFAsZU+1GLkTGs /ukbWoKMUSDS1U92BA1KUTMssJRhp7qPayhbUbHfXJq7pfPq8K4YQHtZEi7UOLXT7gCh 7zgSv7GfsjEIcBfEA5ZSemhKN5Va5MrbDnxxcHc/0kahWdXzTgWr370+aUdOmjnWWTsa NzBg== 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=nusE4iJqKxuXxzxUwLDY6MVU16Qz+ioLkpoA1JeR0xQ=; b=yAceIWPAC8r3Dhs6mVGhU1bKPN0+Q2uC40Z26KOWRwGvUUFQGbRhvJd9RCqgtQma24 iHwZlByr7fpIrPyLn/IGb17sZtFzLu86JEIbqW/suXEOwVqm4HKEzfJUtM1UMHbyfTUz 2gSMVnkvV8YKd2fYC/bSegVv1++JG3C6fW3ELJ2p/dExa74NXwCrKoDjKyUwu9yrmwz1 pCNHV0ALqx5mwYtlZo/LYUChkuBZV/qZnMjKVSrTL1eHIVFmjlfhVDVe22Wq0FW/+C16 B/FXqEna+tYKywrftcsmmiPmvOf5hlnP+haPtuW2fqWOEylXdk1Sxe2dFdpDFdV1rN6U jIpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DVA1dWbT; 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 i5-20020ac85c05000000b002f20456f89bsi76991qti.767.2022.04.22.03.06.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:06:17 -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=DVA1dWbT; 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]:56930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqB7-0004If-7E for patch@linaro.org; Fri, 22 Apr 2022 06:06:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9b-0004E2-5Y for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:47 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:45965) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9Y-0002ZU-9M for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:42 -0400 Received: by mail-wr1-x432.google.com with SMTP id w4so10276646wrg.12 for ; Fri, 22 Apr 2022 03:04:38 -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=nusE4iJqKxuXxzxUwLDY6MVU16Qz+ioLkpoA1JeR0xQ=; b=DVA1dWbTaTzwPJZN/KDd/Dd/1bpsQqjIKd/SdeMpwMb2bKLRkZPK9tVoB9n66h8Aqd /zyUFLbXWzad3idW90bRqJCHPvnqeBgE/YaQfvvR7et/1TGO4ZJrKY09FdDOhhm/vzYQ VOjkJ9+w0r7LnV2EDHJTE67zkkR99bdVE5KEbzx0c89bZ+9xpWzyO1Eif+h96aF1+BK9 /WHAjNvFqggKNWPUBhazv6ugIrfQgyhmgzMjXCIpZlwUu9YVUajXN4B/3ZipqV6iTCFi fyPPkZM5P0eAAqUTTmfKGnE6I3LSImX3OOdN70ARgbAicZa4vmy7C4G9Lc86wxNHm6Si q6vg== 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=nusE4iJqKxuXxzxUwLDY6MVU16Qz+ioLkpoA1JeR0xQ=; b=QiC7EwAWEbC2mr4JWmcSlaSvmGQkhqSE/HdKVZQuxPpSICQ3jKHPRHfaA27dt/a9Aq KkFoXXES92tFJioTSPWzpEUhyA9pG66eK0u9jrxUyjogrxoj2xX9YJH3GOKG+rF3foCj kJCv8Px9UAvwCeg15+DiRAI7p15Go48+FnNDd2GzZ5N2tVNwA62ivktKFiPVtM1zNGM8 UQsnyhqu6LI/Ahf2/q2k7ZP9TGfjX+i60sayWeyKejOvp8Ief2O/UUHGLSHPDyeAXbBe osXl6nCPE8VWH5V96vrckQtn92vHad4x3pt5TeruyBXI8KS2WwBsQJHaudK3AwpbLCnZ NhYg== X-Gm-Message-State: AOAM531mWK8WilTLXF8MmHSh7zrzM4VK/Jh53iJ4jyfVsssp9ybswZPQ AHs3WoCo2Fc9oNWxs+UaNRKj+uezd7kUUw== X-Received: by 2002:adf:ebc7:0:b0:1ee:945a:ffb4 with SMTP id v7-20020adfebc7000000b001ee945affb4mr3050675wrn.641.1650621877103; Fri, 22 Apr 2022 03:04:37 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:36 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/61] hw/intc/arm_gicv3: Sanity-check num-cpu property Date: Fri, 22 Apr 2022 11:03:33 +0100 Message-Id: <20220422100432.2288247-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-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" In the GICv3 code we implicitly rely on there being at least one CPU and thus at least one redistributor and CPU interface. Sanity-check that the property the board code sets is not zero. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-3-peter.maydell@linaro.org --- hw/intc/arm_gicv3_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index 4ca5ae9bc56..90204be25b6 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -328,6 +328,10 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) s->num_irq, GIC_INTERNAL); return; } + if (s->num_cpu == 0) { + error_setg(errp, "num-cpu must be at least 1"); + return; + } /* ITLinesNumber is represented as (N / 32) - 1, so this is an * implementation imposed restriction, not an architectural one,