From patchwork Mon Feb 13 14:28:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 93891 Delivered-To: patches@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1121385qgi; Mon, 13 Feb 2017 06:28:27 -0800 (PST) X-Received: by 10.84.133.69 with SMTP id 63mr29945961plf.97.1486996107144; Mon, 13 Feb 2017 06:28:27 -0800 (PST) Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id t25si10159115pgo.353.2017.02.13.06.28.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Feb 2017 06:28:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1cdHc5-00014o-HG; Mon, 13 Feb 2017 14:28:21 +0000 From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: patches@linaro.org, Eduardo Habkost Subject: [PATCH 2/4] cpu: Clarify TODO comment in cpu_generic_new() Date: Mon, 13 Feb 2017 14:28:17 +0000 Message-Id: <1486996099-15820-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486996099-15820-1-git-send-email-peter.maydell@linaro.org> References: <1486996099-15820-1-git-send-email-peter.maydell@linaro.org> The TODO comment in cpu_generic_new() suggests that we want to move to having all callers do the parse_features work by hand. In fact the intention is that we would prefer to have this happen automatically via machine core work or similar common code changes. In the meantime boards should use the cpu_generic_new() wrapper rather than calling parse_features themselves, because this means we only need to change one place in future if we change how parse_features gets called. Signed-off-by: Peter Maydell --- Change based on email conversation with Eduardo...hopefully I have understood the intention here correctly. --- qom/cpu.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/qom/cpu.c b/qom/cpu.c index a783aec..eacce5e 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -80,8 +80,14 @@ CPUState *cpu_generic_new(const char *typename, const char *cpu_model) cc = CPU_CLASS(oc); featurestr = strtok(NULL, ","); - /* TODO: all callers of cpu_generic_init() need to be converted to - * call parse_features() only once, before calling cpu_generic_init(). + /* TODO: we should really arrange to have parse_features() called + * only once, since it needs only to be called once per CPU class + * rather than once per instance of that class. Perhaps this would + * be done by changes to how machine core code works or by doing + * something in main(). In the meantime, board code should prefer + * to use this function rather than calling parse_features() + * manually, so that refactoring how we handle this is easier in + * future. */ cc->parse_features(object_class_get_name(oc), featurestr, &err); g_free(str);