From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 2002:ac2:5042:0:0:0:0:0 with SMTP id a2csp298586lfm; Tue, 14 Jul 2020 09:05:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJww9ZtqT8GiOh8tFTZQcXL7aI0OfCbAKqLzoPLm/+FlfEpF8TYTBHiFhdxMUlPRZE41zq4s X-Received: by 2002:ab0:5ea5:: with SMTP id y37mr3843728uag.71.1594742735441; Tue, 14 Jul 2020 09:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594742735; cv=none; d=google.com; s=arc-20160816; b=n9mzDLidSyltjSwB5ILe+Uvyd4qfVEfp8MnCDgL4j2LPBumQ9zRX5nJTjdqNz6KXKv DxdW6+J6ssm+M2GSwlToSGwP0lr8nt/Pr+IumAAOR/LEkgdTgbao5kQ/XFZsqmjj7Ho5 QPi0jQbOmExx4MpPnCPEPu5LZkxsMJeXUsPE38a+oinq0QWMZp4+9MgwHVSgvSuz+Wyw Ot4HW6OtxCfXs+Uv35bg4Xo4DgznhjmwkEHFWNxteGaRzWvC5hz0uz4tC3hLBbvPEDu2 enfv23f6TOsSkkKve5kY5zaW1V1QMYdtgIOjBL2asTcj1le9KfSslAJaAhLSNkKyJhcR +91g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:user-agent:message-id:in-reply-to:date:references :subject:to:from:dkim-signature; bh=dHmDT7E65idIBHLwDNNFjWnd9xmHGR5VIecK7Ss0mic=; b=dFSRMtHeLNDFUOHP2jmUYAXj5hgvOg0nWKX5OdxOP+LmJrUvf2teF8CF6Ngb35TW4q myFGqxOd8QVMTS6Vh35Kaigryhh+Oa9XD3+3BvdSWn55PFgePjvJcjTKpWFpghYnZii4 YtWMK+K2n2oayNHRLry3aInnwCgyNi3uKjVtOfe5+kTeMfi5VS3l0CXn0qSr7h2uFAEY MJgh1Ol7YQ30oG2pwH9rxYY9qDStUraGbdMIvB7U2eG59l4LsXyaXZU/MMK4zpE0I2Ph Wr0B0ea22n92RE0VWSu5MjB7HRh3CjDmB8u2ResOWuLXvVpw5SUKJ8GtdN98p2Q9ex0s Qxog== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=dP6qnSdT; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q13si1081829uap.128.2020.07.14.09.05.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Jul 2020 09:05:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=dP6qnSdT; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:39062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jvNR0-0004Sb-IU for alex.bennee@linaro.org; Tue, 14 Jul 2020 12:05:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jvNNk-0000KB-1P for qemu-devel@nongnu.org; Tue, 14 Jul 2020 12:02:12 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:59648 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jvNNh-00080p-07 for qemu-devel@nongnu.org; Tue, 14 Jul 2020 12:02:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594742527; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dHmDT7E65idIBHLwDNNFjWnd9xmHGR5VIecK7Ss0mic=; b=dP6qnSdT0dabL/oMyfX7kKGH2BCU7QJ0tF8o8OIfLZ4FhdMjSIBmCBJUVHVSXYQiXfqoM2 DXEYGhdOeHiVMKA9CIX8ZpL856w/FkXjBVr9uM4qUms1DVmSMsmjN2MQm0XACtIkBXHfhh A56poPR/1amNDKQzkuMNh4Umi4LmnSY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-317-yFusaVE6Pu6n4RVxFnIn3Q-1; Tue, 14 Jul 2020 12:01:34 -0400 X-MC-Unique: yFusaVE6Pu6n4RVxFnIn3Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D3878015CB; Tue, 14 Jul 2020 16:01:32 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-143.ams2.redhat.com [10.36.112.143]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D43D96FDD1; Tue, 14 Jul 2020 16:01:30 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5130B1267F16; Tue, 14 Jul 2020 18:01:29 +0200 (CEST) From: Markus Armbruster To: Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Subject: Re: [PATCH v5 04/11] hw/arm: Add NPCM730 and NPCM750 SoC models References: <20200709003608.3834629-1-hskinnemoen@google.com> <20200709003608.3834629-5-hskinnemoen@google.com> <3ec30463-03f8-98e9-9a14-01b0bb698c9b@kaod.org> <7c978e82-8890-9ba4-096a-92d7cff60b0a@amsat.org> Date: Tue, 14 Jul 2020 18:01:29 +0200 In-Reply-To: <7c978e82-8890-9ba4-096a-92d7cff60b0a@amsat.org> ("Philippe =?utf-8?Q?Mathieu-Daud=C3=A9=22's?= message of "Tue, 14 Jul 2020 13:37:48 +0200") Message-ID: <877dv63x2e.fsf@dusky.pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=205.139.110.61; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/14 03:57:32 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: , Cc: Peter Maydell , IS20 Avi Fishman , QEMU Developers , Havard Skinnemoen , CS20 KFTing , qemu-arm , =?utf-8?Q?C=C3=A9dric?= Le Goater , Joel Stanley Errors-To: qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-devel" X-TUID: CY40tMlUKuw5 Philippe Mathieu-Daud=C3=A9 writes: > +Markus > > On 7/14/20 2:44 AM, Havard Skinnemoen wrote: >> On Mon, Jul 13, 2020 at 8:02 AM C=C3=A9dric Le Goater wro= te: >>> >>> On 7/9/20 2:36 AM, Havard Skinnemoen wrote: >>>> The Nuvoton NPCM7xx SoC family are used to implement Baseboard >>>> Management Controllers in servers. While the family includes four SoCs= , >>>> this patch implements limited support for two of them: NPCM730 (target= ed >>>> for Data Center applications) and NPCM750 (targeted for Enterprise >>>> applications). >>>> >>>> This patch includes little more than the bare minimum needed to boot a >>>> Linux kernel built with NPCM7xx support in direct-kernel mode: >>>> >>>> - Two Cortex-A9 CPU cores with built-in periperhals. >>>> - Global Configuration Registers. >>>> - Clock Management. >>>> - 3 Timer Modules with 5 timers each. >>>> - 4 serial ports. >>>> >>>> The chips themselves have a lot more features, some of which will be >>>> added to the model at a later stage. >>>> >>>> Reviewed-by: Tyrone Ting >>>> Reviewed-by: Joel Stanley >>>> Signed-off-by: Havard Skinnemoen >>>> --- > ... > >>>> +static void npcm7xx_realize(DeviceState *dev, Error **errp) >>>> +{ >>>> + NPCM7xxState *s =3D NPCM7XX(dev); >>>> + NPCM7xxClass *nc =3D NPCM7XX_GET_CLASS(s); >>>> + int i; >>>> + >>>> + /* CPUs */ >>>> + for (i =3D 0; i < nc->num_cpus; i++) { >>>> + object_property_set_int(OBJECT(&s->cpu[i]), >>>> + arm_cpu_mp_affinity(i, NPCM7XX_MAX_NU= M_CPUS), >>>> + "mp-affinity", &error_abort); >>>> + object_property_set_int(OBJECT(&s->cpu[i]), NPCM7XX_GIC_CPU_I= F_ADDR, >>>> + "reset-cbar", &error_abort); >>>> + object_property_set_bool(OBJECT(&s->cpu[i]), true, >>>> + "reset-hivecs", &error_abort); >>>> + >>>> + /* Disable security extensions. */ >>>> + object_property_set_bool(OBJECT(&s->cpu[i]), false, "has_el3"= , >>>> + &error_abort); >>>> + >>>> + qdev_realize(DEVICE(&s->cpu[i]), NULL, &error_abort); >>> >>> I would check the error: >>> >>> if (!qdev_realize(DEVICE(&s->cpu[i]), NULL, errp)) { >>> return; >>> } >>> >>> same for the sysbus_realize() below. >>=20 >> Hmm, I used to propagate these errors until Philippe told me not to >> (or at least that's how I understood it). > > It was before Markus simplification API were merged, you had to > propagate after each call, since this is a non hot-pluggable SoC > I suggested to use &error_abort to simplify. > >> I'll be happy to do it >> either way (and the new API makes it really easy to propagate errors), >> but I worry that I don't fully understand when to propagate errors and >> when not to. > > Markus explained it on the mailing list recently (as I found the doc > not obvious). I can't find the thread. I suppose once the work result > after the "Questionable aspects of QEMU Error's design" discussion is > merged, the documentation will be clarified. The Error API evolved recently. Please peruse the big comment in include/qapi/error.h. If still unsure, don't hesitate to ask here. > My rule of thumb so far is: > - programming error (can't happen) -> &error_abort Correct. Quote the big comment: * Call a function aborting on errors: * foo(arg, &error_abort); * This is more concise and fails more nicely than * Error *err =3D NULL; * foo(arg, &err); * assert(!err); // don't do this > - everything triggerable by user or management layer (via QMP command) > -> &error_fatal, as we can't risk loose the user data, we need to > shutdown gracefully. Quote the big comment: * Call a function treating errors as fatal: * foo(arg, &error_fatal); * This is more concise than * Error *err =3D NULL; * foo(arg, &err); * if (err) { // don't do this * error_report_err(err); * exit(1); * } Terminating the process is generally fine during initial startup, i.e. before the guest runs. It's generally not fine once the guest runs. Errors need to be handled more gracefully then. A QMP command, for instance, should fail cleanly, propagating the error to the monitor core, which then sends it to the QMP client, and loops to process the next command. >> It makes sense to me to propagate errors from *_realize() and >> error_abort on failure to set simple properties, but I'd like to know >> if Philippe is on board with that. Realize methods must not use &error_fatal. Instead, they should clean up and fail. "Clean up" is the part we often neglect. The big advantage of &error_fatal is that you don't have to bother :) Questions? [...]