From patchwork Mon Jan 21 18:43:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 1028870 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="kBeVTm0f"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43k14g1nbdz9s55 for ; Tue, 22 Jan 2019 05:57:07 +1100 (AEDT) Received: from localhost ([127.0.0.1]:58160 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1glekr-00059f-7u for incoming@patchwork.ozlabs.org; Mon, 21 Jan 2019 13:57:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gleXZ-0002Rh-Ke for qemu-devel@nongnu.org; Mon, 21 Jan 2019 13:43:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gleXX-0006dL-A7 for qemu-devel@nongnu.org; Mon, 21 Jan 2019 13:43:21 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:45993) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gleXX-0006ca-3R for qemu-devel@nongnu.org; Mon, 21 Jan 2019 13:43:19 -0500 Received: by mail-wr1-x443.google.com with SMTP id t6so24531371wrr.12 for ; Mon, 21 Jan 2019 10:43:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WiI/ai6LBZIUIZQd++BmhxhHpLIGKWoxtvMp7jrWOAw=; b=kBeVTm0flg/zNKFVys1m3Gk5FbfoKckXCdrOOP/NP+9reDUXyUdOwQeKO3XCaQzxxd zfZ06TM0XDXYXw8FYRAIphZS96T44gIncgHpX2qE3kzEpZKfunmbgDDdSqo01oxv76c7 B1v7bpfVrMwPuyp7EVleQUtJZGnSfMNfZRKW8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WiI/ai6LBZIUIZQd++BmhxhHpLIGKWoxtvMp7jrWOAw=; b=o/QVF1JUKweYufPMu71seS24uAV6UbDEkyVcQw+hKLwkFHQeo5Nx8f1sazedIK7eII mn2qEPn215z7PbZWRZNixY5zo2BQubNS8LrFDfEXSddRLRHeetviqlNjqU3Ac1qxvZ92 vfzD/ZWJFiPWx6eaKIInUPtHj+9ymgFmz/4qop9ND9kO+ly6NYndU+/68W1+e+sLCf1O Tn72WmIVEPg42e9WiHh9q81XHH174xbEjQe6Pq1BrKCV25g2L1/xQA9ga5yVoADcIpOM 3mUbVuo90+KGZ7wTfsbdHZa+f8XuLlZ9jTOpDP55XDNF7UWvLrBPHYEHsjua5xq/a218 qtag== X-Gm-Message-State: AJcUukdpf0jL6S4x7Ra2pZkVssSlB/goY0vPDFxADIBUGwrGARIGJBOv tFml2jwUwe3bvehWqFtNVMnihQ== X-Google-Smtp-Source: ALg8bN6q8wgTYrapiNS9y5viDMslxbV4oqzum085QGZ681dmrsZoHlpOcQ46PZdahdOdrbtDIz9ShQ== X-Received: by 2002:adf:eb45:: with SMTP id u5mr28174324wrn.102.1548096197585; Mon, 21 Jan 2019 10:43:17 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id 200sm52038603wmw.31.2019.01.21.10.43.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Jan 2019 10:43:16 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Mon, 21 Jan 2019 18:43:14 +0000 Message-Id: <20190121184314.14311-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PATCH] xlnx-zynqmp: Don't create rpu-cluster if there are no RPUs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E. Iglesias" , Alistair Francis , Luc Michel , patches@linaro.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" If we aren't going to create any RPUs, then don't create the rpu-cluster unit. This allows us to add an assertion to the cluster object that it contains at least one CPU, which helps to avoid bugs in creating clusters and putting CPUs in them. Signed-off-by: Peter Maydell Reviewed-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé --- This is a preparatory patch that is necessary for the series "[PATCH v3 0/4] tcg: support heterogenous CPU clusters" (20190121152218.9592-1-peter.maydell@linaro.org) in order to avoid the xlnx-zcu102 board asserting if started with fewer than 5 CPUs. hw/arm/xlnx-zynqmp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index 370b0e44a38..16cba433cb7 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -178,6 +178,11 @@ static void xlnx_zynqmp_create_rpu(XlnxZynqMPState *s, const char *boot_cpu, int i; int num_rpus = MIN(smp_cpus - XLNX_ZYNQMP_NUM_APU_CPUS, XLNX_ZYNQMP_NUM_RPU_CPUS); + if (num_rpus == 0) { + /* Don't create rpu-cluster object if there's nothing to put in it */ + return; + } + object_initialize_child(OBJECT(s), "rpu-cluster", &s->rpu_cluster, sizeof(s->rpu_cluster), TYPE_CPU_CLUSTER, &error_abort, NULL);