From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0EE5C48BC2 for ; Sun, 27 Jun 2021 23:52:57 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 455DB61C31 for ; Sun, 27 Jun 2021 23:52:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 455DB61C31 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9180D82DA1; Mon, 28 Jun 2021 01:51:59 +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="jqH7/p49"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6181882D7D; Mon, 28 Jun 2021 01:51:32 +0200 (CEST) Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) (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 B732E82D50 for ; Mon, 28 Jun 2021 01:51:27 +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-oi1-x230.google.com with SMTP id s17so19873886oij.0 for ; Sun, 27 Jun 2021 16:51:27 -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=jehOev6efwPLdDK0/bTk25qIMkAMZe+hWvZ4ggzDeI8=; b=jqH7/p49Lnt9xGY4zUKtu71ORhVUbF0P2STuoOi7GeJSIYzmkXpCpmt9u0uEW05gBw PD9QYFiwk0aRE8sfLA7jGjIY/oLf+O/1UvcMUagEsGHZaix6MIyjrzIM1rOLxqxxtjqp SUrNbQKg7DG5N95HCnCQfEiaUyu6g5lHD0n3k= 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=jehOev6efwPLdDK0/bTk25qIMkAMZe+hWvZ4ggzDeI8=; b=nKbrktICU8OCW3YgWjH4iW20xjxz9IP0sru5pPJ1whZxm9uIw7jo2Vsm9N20b8WJ2W Nbqnfo+9i4STI6f6NBalaZXF8OlzKVouZJo0wHJTafKXqJ0XS/H03NQJ9r7nys33ztGt yI3pvtolXetmEJ59OscCBNULedpaI/JuyzHNNhxoMRyqqi0R3VmQoEqsCAs2nnfrV5yx ky2sEqcF2dAVT54XsXlooUhLb3PHhwlpN1W+tdz3+SQRU5cU1v0wvv/fYH3cpA1xhcPA MKgC02b9chZvZydwnQRxVpkWrhMPZ8Vzt/pS4DzP6eLWXzMjs/55Yw1aeQKO1CC00ZDR 9hyQ== X-Gm-Message-State: AOAM531ES2TerI4EZppmXtDubvFv+Sz9kBHqYTGVYJJYuxP+1pklRFwi Bz51ZOCh9Ye3TaLuCBNljJLkdByGmVxiu3li X-Google-Smtp-Source: ABdhPJwK7EbCWYZWrlcnoU47r9lUP9X+GxFmBik9Ocb7HFOUNgiSEz8A8ssDb2mLvUBE0IuKszM8jg== X-Received: by 2002:aca:afd2:: with SMTP id y201mr1398935oie.54.1624837886063; Sun, 27 Jun 2021 16:51:26 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id bb34sm1297928oob.39.2021.06.27.16.51.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Jun 2021 16:51:25 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng Subject: [PATCH v3 07/16] x86: Update the MP constants to avoid conflicts Date: Sun, 27 Jun 2021 17:51:02 -0600 Message-Id: <20210627235111.485507-7-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210627235111.485507-1-sjg@chromium.org> References: <20210627235111.485507-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.103.2 at phobos.denx.de X-Virus-Status: Clean These constants conflict with error codes returned by the MP implementation when something is wrong. In particular, mp_first_cpu() returns MP_SELECT_BSP when running without multiprocessing enabled. Since this is -2, it is interpreted as an error by callers, which expect a positive CPU number for the first CPU. Correct this by using a different range for the pre-defined CPU numbers, above zero and out of the range of possible CPU values. For now it is safe to assume there are no more than 64K CPUs. This fixes the 'mtrr' command when CONFIG_SMP is not enabled. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- (no changes since v1) arch/x86/include/asm/mp.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/mp.h b/arch/x86/include/asm/mp.h index 1a3ae8e3950..e48ba051d92 100644 --- a/arch/x86/include/asm/mp.h +++ b/arch/x86/include/asm/mp.h @@ -10,18 +10,22 @@ #include #include +#include struct udevice; enum { - /* Indicates that the function should run on all CPUs */ - MP_SELECT_ALL = -1, + /* + * Indicates that the function should run on all CPUs. We use a large + * number, above the number of real CPUs we expect to find. + */ + MP_SELECT_ALL = BIT(16), /* Run on boot CPUs */ - MP_SELECT_BSP = -2, + MP_SELECT_BSP, /* Run on non-boot CPUs */ - MP_SELECT_APS = -3, + MP_SELECT_APS, }; typedef int (*mp_callback_t)(struct udevice *cpu, void *arg); -- 2.32.0.93.g670b81a890-goog