From nobody Tue Feb 10 05:45:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1586195780; cv=none; d=zohomail.com; s=zohoarc; b=hy78gVqA02iMyp+W/a4W8waLSombZjHSG43z1/rOYtwwDHKgrhg0ojz98oS5QjKqH4hd3Lu5mgRw/nCBZHyNatBfIZVEd7DT87RE/3r3KpwTYqw/WoOjOcTr4iCm9qoRWwFEoMZ4QIoKF1v2Q7D1T1gR34krzLllD9h4m990ACY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586195780; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6j0bhZZ4DXOIthIvcH8V/7teI/2Tb9x+JKEVdKazvPI=; b=DlSobjhFzBkp8BGL2VN148c1OWS5nRQUlMgUMvA2ZTKBDqroNy5KxtxgcZpywYGKAItWbWnXbu0rqybzGJffrAqZGm5CYzepYfsw/otslZUa3QMlt8N/Yi1cd5Dy0/NyyyU6DvYtJktfaCO2TqX5BfMK2gxnAyS3JnwBZvtw2aw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1586195780243607.1673639595531; Mon, 6 Apr 2020 10:56:20 -0700 (PDT) Received: from localhost ([::1]:36022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLVys-0000EI-Ki for importer@patchew.org; Mon, 06 Apr 2020 13:56:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35905) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLVqs-0001ds-Uz for qemu-devel@nongnu.org; Mon, 06 Apr 2020 13:48:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLVqr-0001rT-QH for qemu-devel@nongnu.org; Mon, 06 Apr 2020 13:48:02 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:42903) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLVqr-0001mQ-KH; Mon, 06 Apr 2020 13:48:01 -0400 Received: by mail-wr1-x443.google.com with SMTP id h15so476352wrx.9; Mon, 06 Apr 2020 10:48:01 -0700 (PDT) Received: from x1w.redhat.com (116.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.116]) by smtp.gmail.com with ESMTPSA id a67sm364880wmc.30.2020.04.06.10.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 10:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6j0bhZZ4DXOIthIvcH8V/7teI/2Tb9x+JKEVdKazvPI=; b=X1KU2tXNDH5oKLXhUCQy2lQVeBbPbs/TJMa7hxWN5ICWvCYNdAPpAd/DFf0xuMWQG6 cwqzS1t6QC0JzX5vZ2/jT0sx3PT0WCZPz7/5FwWIbo46IoHrZlvJjnHOyS0FMMmmirpZ NaiYD78By1i2Dwa7U1ZuiWG5kF5dq19RWVIIvi5DwjGZQi87skGeSzKmAn6FsQXYXqvb Gt0YsY+Ugn+KgpbPqiaQqLrqZo0trPsylmt3W18y6H+Y2UmEZZLResC0IGTxMhw5BS0A IHyTK7PSeYtPRlpZSk4N3q7jqwWeOYYCCGoaRBU0hUuKl52jRK0XBJkB98lUr70kI+cR 69BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=6j0bhZZ4DXOIthIvcH8V/7teI/2Tb9x+JKEVdKazvPI=; b=kTxjAJmuJH9jQJ6Sx19HZu8LjkdwF/g46txSK1ZOvOhXmEj9Fv8WVWn+3wrGcGyX8c GYR3bt0/QRqOR+Xte1sojLQRmNLtAdGX2WK+NynIRSN1XfEqsrIbZajAwideNl17c8E+ oc+1gkGqGdej/0gLGKkVMLl40G+DgOUHqwwE6N+wBzsrBW8zqk1JBYehwa0vqC6CDwYc ZeXHIs25aE+SbAHsH7THA/5NL1R/4AAaowaZd/rc+nhXBJtEzIz17cpIvKj+KbQTScn8 emLgo5k2klMeYEdiKtm/XQRXvTaF+AU8uIjbFaImXTuUde/SFe7+WKGhkJhq3KYTxC6a JNXg== X-Gm-Message-State: AGi0PuYDuBI/LthNS7hTzzxk5ow+322o0TQWI3H97Zhfw/+i+b/OmCU0 MBPoaVmKkjxoGlc/JNzvgh4+mhPOPi8= X-Google-Smtp-Source: APiQypLW/IYxXY+iRtT8LTwmBcdFXl7kw3iK4ji/0rTZf/nuBrGEucZybsqGwrOBwcACWlfU9qHrng== X-Received: by 2002:a5d:6104:: with SMTP id v4mr357482wrt.213.1586195278992; Mon, 06 Apr 2020 10:47:58 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Subject: [PATCH-for-5.1 v2 09/54] hw/arm/fsl-imx6: Move some code from realize() to init() Date: Mon, 6 Apr 2020 19:46:58 +0200 Message-Id: <20200406174743.16956-10-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200406174743.16956-1-f4bug@amsat.org> References: <20200406174743.16956-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 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: , Cc: Peter Maydell , Vladimir Sementsov-Ogievskiy , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "open list:SABRELITE / i.MX6" , Jean-Christophe Dubois Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Coccinelle failed at processing this file: $ spatch ... --timeout 60 --sp-file \ scripts/coccinelle/simplify-init-realize-error_propagate.cocci HANDLING: ./hw/arm/fsl-imx6.c Fatal error: exception Coccinelle_modules.Common.Timeout While reviewing we noticed some functions can be called at init() time, reducing the need to add extra Error checks at realize() time. Move them. The coccinelle script succeeds after this. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/fsl-imx6.c | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index 3d37352b08..6bf8aa0404 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -48,11 +48,30 @@ static void fsl_imx6_init(Object *obj) object_initialize_child(obj, name, &s->cpu[i], sizeof(s->cpu[i]), ARM_CPU_TYPE_NAME("cortex-a9"), &error_abort, NULL); + + /* On uniprocessor, the CBAR is set to 0 */ + if (smp_cpus > 1) { + object_property_set_int(OBJECT(&s->cpu[i]), FSL_IMX6_A9MPCORE_= ADDR, + "reset-cbar", &error_abort); + } + + /* All CPU but CPU 0 start in power off mode */ + if (i) { + object_property_set_bool(OBJECT(&s->cpu[i]), true, + "start-powered-off", &error_abort); + } } =20 sysbus_init_child_obj(obj, "a9mpcore", &s->a9mpcore, sizeof(s->a9mpcor= e), TYPE_A9MPCORE_PRIV); =20 + object_property_set_int(OBJECT(&s->a9mpcore), smp_cpus, "num-cpu", + &error_abort); + + object_property_set_int(OBJECT(&s->a9mpcore), + FSL_IMX6_MAX_IRQ + GIC_INTERNAL, "num-irq", + &error_abort); + sysbus_init_child_obj(obj, "ccm", &s->ccm, sizeof(s->ccm), TYPE_IMX6_C= CM); =20 sysbus_init_child_obj(obj, "src", &s->src, sizeof(s->src), TYPE_IMX6_S= RC); @@ -81,6 +100,10 @@ static void fsl_imx6_init(Object *obj) snprintf(name, NAME_SIZE, "gpio%d", i + 1); sysbus_init_child_obj(obj, name, &s->gpio[i], sizeof(s->gpio[i]), TYPE_IMX_GPIO); + object_property_set_bool(OBJECT(&s->gpio[i]), true, "has-edge-sel", + &error_abort); + object_property_set_bool(OBJECT(&s->gpio[i]), true, "has-upper-pin= -irq", + &error_abort); } =20 for (i =3D 0; i < FSL_IMX6_NUM_ESDHCS; i++) { @@ -124,19 +147,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error *= *errp) unsigned int smp_cpus =3D ms->smp.cpus; =20 for (i =3D 0; i < smp_cpus; i++) { - - /* On uniprocessor, the CBAR is set to 0 */ - if (smp_cpus > 1) { - object_property_set_int(OBJECT(&s->cpu[i]), FSL_IMX6_A9MPCORE_= ADDR, - "reset-cbar", &error_abort); - } - - /* All CPU but CPU 0 start in power off mode */ - if (i) { - object_property_set_bool(OBJECT(&s->cpu[i]), true, - "start-powered-off", &error_abort); - } - object_property_set_bool(OBJECT(&s->cpu[i]), true, "realized", &er= r); if (err) { error_propagate(errp, err); @@ -144,13 +154,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error *= *errp) } } =20 - object_property_set_int(OBJECT(&s->a9mpcore), smp_cpus, "num-cpu", - &error_abort); - - object_property_set_int(OBJECT(&s->a9mpcore), - FSL_IMX6_MAX_IRQ + GIC_INTERNAL, "num-irq", - &error_abort); - object_property_set_bool(OBJECT(&s->a9mpcore), true, "realized", &err); if (err) { error_propagate(errp, err); @@ -310,10 +313,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error *= *errp) }, }; =20 - object_property_set_bool(OBJECT(&s->gpio[i]), true, "has-edge-sel", - &error_abort); - object_property_set_bool(OBJECT(&s->gpio[i]), true, "has-upper-pin= -irq", - &error_abort); object_property_set_bool(OBJECT(&s->gpio[i]), true, "realized", &e= rr); if (err) { error_propagate(errp, err); --=20 2.21.1