From patchwork Fri May 22 02:23:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1295827 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=duuliWX1; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Sr1g1wq5z9sSw for ; Fri, 22 May 2020 12:25:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 45C3781E77; Fri, 22 May 2020 04:24:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="duuliWX1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7251481E2C; Fri, 22 May 2020 04:24:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4ADFF81E3A for ; Fri, 22 May 2020 04:24:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x144.google.com with SMTP id n11so9311752ilj.4 for ; Thu, 21 May 2020 19:24:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dbYZ3nXsxXsfBPNjU8XeEkVOcKnwwndP0tW4tQEqmvw=; b=duuliWX1ef8ppnd/KD9ain2C6g3bNzm2q5iqi1o0g5c2fEziMjweAhLrurKOCIVCsi 5EGUfgTPPA4/macR9ZUq/gI3lKRDR8eBkp+PCW1DNhMaW0JWOLE+NXv/Sb/3hWZjxxED K2Abm3yDuHvdhda7AXopX+SBNmUBvU41Wzjwk= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=dbYZ3nXsxXsfBPNjU8XeEkVOcKnwwndP0tW4tQEqmvw=; b=q0HV88hV4U0/bAjYsnF7kX7z/lz+GsV1UCIOtPbmqQx2LP0qASlOqyE6giz4KIEnwm sLWfwFxec7Jq+p7pXuQoQQO3zbIeaUHZPYjKD0zG0eRS+rGOfgraR2SDnqCSilVegxAA dD79SGLrWk606wdQdKQlDbAv/GWEv3O/WAet6h/lglmm0dJpZSoS5r2Tm6Vl2biV6E6F msMpRUPaCUn8NpSFm2HBKaLpmnURu2hpzFZP4BodTt25NbTBKpUwE33r8pT/rUP2t9YL 8GrwAptpGiJSFoAxcI7hF9ayab2McJGukcuUh82mmM3dBx6qxcotzWxRpGLL7ID0DQ1M 54MQ== X-Gm-Message-State: AOAM532KmkN97DWOXDN/AXEhVQGrLdZl7S3b/XWXQAfHUO8lGLLluc3x yjszJv1/twVDMA1cZEzG5479AoSwn70mOw== X-Google-Smtp-Source: ABdhPJzGi3ANVPx6NgwCitLFehX4ZlNfceZBJKIDJEPEjnryk6W5/oJtMnXeS+9/AxqI+EXWdSHc3Q== X-Received: by 2002:a05:6e02:68d:: with SMTP id o13mr11717228ils.230.1590114247060; Thu, 21 May 2020 19:24:07 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id t10sm3757098ilq.62.2020.05.21.19.24.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 19:24:06 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Andy Shevchenko , Wolfgang Wallner , Simon Glass Subject: [PATCH 07/22] x86: mp_init: Set up the CPU numbers at the start Date: Thu, 21 May 2020 20:23:11 -0600 Message-Id: <20200522022326.238388-7-sjg@chromium.org> X-Mailer: git-send-email 2.27.0.rc0.183.gde8f92d652-goog In-Reply-To: <20200522022326.238388-1-sjg@chromium.org> References: <20200522022326.238388-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean At present each CPU is given a number when it starts itself up. While this saves a tiny amount of time by doing the device-tree read in parallel, it is confusing that the numbering happens on the fly. Move this code into mp_init() and do it at the start. Signed-off-by: Simon Glass Reviewed-by: Wolfgang Wallner --- arch/x86/cpu/mp_init.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/arch/x86/cpu/mp_init.c b/arch/x86/cpu/mp_init.c index bb39fd30d18..8b4c72bbcf2 100644 --- a/arch/x86/cpu/mp_init.c +++ b/arch/x86/cpu/mp_init.c @@ -431,12 +431,6 @@ static int mp_init_cpu(struct udevice *cpu, void *unused) { struct cpu_platdata *plat = dev_get_parent_platdata(cpu); - /* - * Multiple APs are brought up simultaneously and they may get the same - * seq num in the uclass_resolve_seq() during device_probe(). To avoid - * this, set req_seq to the reg number in the device tree in advance. - */ - cpu->req_seq = dev_read_u32_default(cpu, "reg", -1); plat->ucode_version = microcode_read_rev(); plat->device_id = gd->arch.x86_device; @@ -452,13 +446,8 @@ int mp_init(void) int num_aps, num_cpus; atomic_t *ap_count; struct udevice *cpu; - int ret; - - /* This will cause the CPUs devices to be bound */ struct uclass *uc; - ret = uclass_get(UCLASS_CPU, &uc); - if (ret) - return ret; + int ret; if (IS_ENABLED(CONFIG_QFW)) { ret = qemu_cpu_fixup(); @@ -466,6 +455,14 @@ int mp_init(void) return ret; } + /* + * Multiple APs are brought up simultaneously and they may get the same + * seq num in the uclass_resolve_seq() during device_probe(). To avoid + * this, set req_seq to the reg number in the device tree in advance. + */ + uclass_id_foreach_dev(UCLASS_CPU, cpu, uc) + cpu->req_seq = dev_read_u32_default(cpu, "reg", -1); + ret = init_bsp(&cpu); if (ret) { debug("Cannot init boot CPU: err=%d\n", ret);