Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1729878pxb; Mon, 12 Apr 2021 05:30:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCP31ZQyAYwBCB206tf5TBFBANCwdPr7muciRY6cDOg3hL1j8m/v6h9HFKnH4lWXIP+tNg X-Received: by 2002:a17:906:944c:: with SMTP id z12mr11497391ejx.398.1618230654910; Mon, 12 Apr 2021 05:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618230654; cv=none; d=google.com; s=arc-20160816; b=kTSO2f+7xFQIBjIPlsm353Ro7kO/I/hO2H7aayodbLTytl8pqV69zYEQVR1Jxq/Fur QSk4PHc5KHXtcXgOefpjitPRXqt9hfSK4h+HTpXGvECjYMzjSJ1hUgAkGVac758drbOY fIYLQys3Lg2fD8GivU3dV/LiP8t8N4bsVAwJKqdDM2A8odiczpxMGzmTp4NlzM7MhrJG mK18GzaYRguopFDx9CMR6VcdVy4b1rxKlXf2tl/bDvG6jur/6ZSjp96e/IWUNrGNAN7Z EWA5aHgBZho3jwnmqlnjGVsvmNi3pBh4ohxNWkfPZ9NnfVWO5Gjf/N7dSFPLEsVZO7xW 3zlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=lbsiJfaNFK5ndsvAFok89bkgzI35J1ejsbhohfzoOu8=; b=Oo7NQWenqkeyA4nlmdVbb8iR8NYXXFWW21wXfUG7DG5xDluDSFh4lN0/LyGVNuXWTr zMbKxQxU9MSwRLwS9ih+7VxBLBOzbOhH3Th8sMzBZ1QcLkYR94EqwoDWxDTdyuPu7hK3 YUTAN18NYSHgZ5wJ9d1zivld111iQFTAkMJ8nztW5N+SN7huQSk9gH+ie9U47zNOGHOh NZMBekln38SeVo6hk7G7x+0jBV+59je8QC3QPvWkm8gMUSjyJ3wqSlbl9ZqmGbz42jRI nASr57rQ6fUFP4RXmDw/zvAsT6RHwEJclfbzecsmR3EEoIL1AqwJLIoq/qALEBu6SWqL pdoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb26si1712262ejc.125.2021.04.12.05.30.31; Mon, 12 Apr 2021 05:30:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240931AbhDLM27 (ORCPT + 99 others); Mon, 12 Apr 2021 08:28:59 -0400 Received: from mail.loongson.cn ([114.242.206.163]:59222 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240167AbhDLM2w (ORCPT ); Mon, 12 Apr 2021 08:28:52 -0400 Received: from loongson.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxzcjsPHRgCyoHAA--.9793S6; Mon, 12 Apr 2021 20:28:30 +0800 (CST) From: Jinyang He To: Thomas Bogendoerfer , Paul Burton Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/5] MIPS: cavium-octeon: Execute the smp handle after jumping to kernel linked address Date: Mon, 12 Apr 2021 20:28:13 +0800 Message-Id: <1618230494-6207-5-git-send-email-hejinyang@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1618230494-6207-1-git-send-email-hejinyang@loongson.cn> References: <1618230494-6207-1-git-send-email-hejinyang@loongson.cn> X-CM-TRANSID: AQAAf9AxzcjsPHRgCyoHAA--.9793S6 X-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SsGvfC2KfnxnUUI43ZEXa7IUYwa93UUUUU== X-CM-SenderInfo: pkhmx0p1dqwqxorr0wxvrqhubq/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Once relocation is required, some fixed addresses in `smp handle` will be affected. For example, octeon_processor_relocated_kernel_entry may cause the problem of loading wrong memory at old address. This patch makes smp cpu do two more things, one is to set ST0_KX, another is to jump to the kernel linked address. They will not destroy the cavium-octeon platform. This patch adds two platform-related macros, SMP_IN_KERNEL_ENTRY and smp_in_kernel_handle, which can be used on other platforms to deal with the SMP CPU in the kernel_entry, if the smp CPU entered the kernel entry. Signed-off-by: Jinyang He --- arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h | 7 +++++++ arch/mips/kernel/head.S | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h b/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h index e66767d..21b9854 100644 --- a/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h +++ b/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h @@ -86,6 +86,13 @@ dli v0, 0x27 dmtc0 v0, CP0_DCACHE_ERR_REG 1: + .set pop +.endm + +#define SMP_IN_KERNEL_ENTRY +.macro smp_in_kernel_entry_handle + .set push + .set arch=octeon # Get my core id rdhwr v0, $0 # Jump the master to kernel_entry diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S index 0186285..6cfe23e 100644 --- a/arch/mips/kernel/head.S +++ b/arch/mips/kernel/head.S @@ -104,6 +104,10 @@ NESTED(kernel_entry, 16, sp) # kernel entry point jr t0 2: +#ifdef SMP_IN_KERNEL_ENTRY + smp_in_kernel_entry_handle +#endif + PTR_LA t0, __bss_start # clear .bss LONG_S zero, (t0) PTR_LA t1, __bss_stop - LONGSIZE -- 2.1.0