From patchwork Thu Jan 18 12:39:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Pei X-Patchwork-Id: 13522802 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 464D5241E2 for ; Thu, 18 Jan 2024 12:40:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705581636; cv=none; b=Amk25vl6PMtyJ/j3HKdlkEuUc2OvIF6tx3ebpMklZidyS6EwiC5xK7E7R56F+tn+/Rbgw6hLe1WemotT+mpZVGmUjrF2VFqOaz9TWLKPyRQ95vkoILSkn/YUzLPP46IVtEhNGjcytnVEKre/c/9NCXKyQx+8wHS4c8W91/wE5FE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705581636; c=relaxed/simple; bh=fG2nbvaDO2iaCDKu18t4CYIxFFkuV1hjAHkOmEL+RhQ=; h=Received:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding: X-CM-TRANSID:X-CM-SenderInfo:X-Coremail-Antispam; b=WQSRiF4TDQ6gpv9F1rlc26FKMV8IvMW9PvBVZtDmACLhyPCBUxSL61dv6DAMWa+T6MH/8t8+mU7VoIydXjofQneNRcE0fnX1BAPIgrtxUrcXmm/DGKdo9D+52+CWT6vf4hLKNfAY339IXirTYeV+3Op+Ee2j4izC5D5bj3ib8zk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [111.9.175.10]) by gateway (Coremail) with SMTP id _____8CxrutAHKlla6QBAA--.7621S3; Thu, 18 Jan 2024 20:40:32 +0800 (CST) Received: from localhost.localdomain (unknown [111.9.175.10]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxF80nHKll3YgIAA--.1524S3; Thu, 18 Jan 2024 20:40:31 +0800 (CST) From: Huang Pei To: Thomas Bogendoerfer Cc: Bibo Mao , linux-mips@vger.kernel.org, Jiaxun Yang , Paul Burton , Li Xuefeng , Yang Tiezhu , Gao Juxin , Huacai Chen Subject: [PATCH 1/2] MIPS: reserve exception vector space ONLY ONCE Date: Thu, 18 Jan 2024 20:39:28 +0800 Message-Id: <20240118123929.369939-2-huangpei@loongson.cn> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240118123929.369939-1-huangpei@loongson.cn> References: <20240118123929.369939-1-huangpei@loongson.cn> Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: AQAAf8BxF80nHKll3YgIAA--.1524S3 X-CM-SenderInfo: xkxd0whshlqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoW7KFy8ZrW3GF43uFW7Jw1DurX_yoW8WF17p3 WjkasxKr40kr90qay3Jw1DAr4rXF4kWw48K347Ar4Sv3W5Xr13Xwn2qFy3Xr9I9rWxCa4r uF95Z3WayanrZwbCm3ZEXasCq-sJn29KB7ZKAUJUUUUr529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUU9Yb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVWxJr0_GcWln4kS14v26r1Y6r17M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12 xvs2x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r12 6r1DMcIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64 vIr41l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxYO2xFxVAFwI0_ Jrv_JF1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1V AY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_JFI_Gr1lIxAI cVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42 IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIev Ja73UjIFyTuYvjxU466zUUUUU cpu_probe is called by BP an APs, but reserving exception vector 0x0-0x1000 need once. Call it on cpu 0. Signed-off-by: Huang Pei --- arch/mips/kernel/cpu-probe.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index b406d8bfb15a..6939d0de2a03 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -1581,7 +1581,9 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) __cpu_name[cpu] = "Broadcom BMIPS4380"; set_elf_platform(cpu, "bmips4380"); c->options |= MIPS_CPU_RIXI; - reserve_exception_space(0x400, VECTORSPACING * 64); + if (cpu == 0) { + reserve_exception_space(0x400, VECTORSPACING * 64); + } } else { c->cputype = CPU_BMIPS4350; __cpu_name[cpu] = "Broadcom BMIPS4350"; @@ -1598,7 +1600,9 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) __cpu_name[cpu] = "Broadcom BMIPS5000"; set_elf_platform(cpu, "bmips5000"); c->options |= MIPS_CPU_ULRI | MIPS_CPU_RIXI; - reserve_exception_space(0x1000, VECTORSPACING * 64); + if (cpu == 0) { + reserve_exception_space(0x1000, VECTORSPACING * 64); + } break; } } @@ -1992,12 +1996,13 @@ void cpu_probe(void) */ loongson3_cpucfg_synthesize_data(c); + if (cpu == 0) { #ifdef CONFIG_64BIT - if (cpu == 0) __ua_limit = ~((1ull << cpu_vmbits) - 1); #endif + reserve_exception_space(0, 0x1000); + } - reserve_exception_space(0, 0x1000); } void cpu_report(void) From patchwork Thu Jan 18 12:39:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Pei X-Patchwork-Id: 13522803 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 96B992421D for ; Thu, 18 Jan 2024 12:40:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705581637; cv=none; b=qtt2ikGbWAeHNKPLwTWaPiQpEMuzzORu62PFJJmDNnarZ2ZFlpqRiRQMpdOpQdWRr2v3mWP8gX95l3pHch+Bnr/OTcI3i5A9rNNL+laFPjRGZvM7pJ7rRYFGQtWG+HmUSAWNjFM8EWjVLWCBepmURXCHK6GkXYa8JvXju6DRf04= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705581637; c=relaxed/simple; bh=jQF1Ww9mDtm30PAS7TcOstj+f26QIIg3zHzDxQVsPaE=; h=Received:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding: X-CM-TRANSID:X-CM-SenderInfo:X-Coremail-Antispam; b=iCdcUDeLZhTCnRSmCeXVVTEuY/QXaI8RAE/Ltk45rzGqADXhEhbDrkpkqw0gZV2AxBoEbKSc/+0DhtzOC/KF2GGmQ3XV3FJPmlB8PpZvNtSNatkqF2w70/uAtcqs5YCcF6qX3d/Mf0wel71Rcb/Ao1FWSLqgVBlGRkjcnGNy5pE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [111.9.175.10]) by gateway (Coremail) with SMTP id _____8DxdfFBHKllb6QBAA--.8210S3; Thu, 18 Jan 2024 20:40:33 +0800 (CST) Received: from localhost.localdomain (unknown [111.9.175.10]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxF80nHKll3YgIAA--.1524S4; Thu, 18 Jan 2024 20:40:32 +0800 (CST) From: Huang Pei To: Thomas Bogendoerfer Cc: Bibo Mao , linux-mips@vger.kernel.org, Jiaxun Yang , Paul Burton , Li Xuefeng , Yang Tiezhu , Gao Juxin , Huacai Chen Subject: [PATCH 2/2] MIPS: loongson64: set nid for reserved memblock region Date: Thu, 18 Jan 2024 20:39:29 +0800 Message-Id: <20240118123929.369939-3-huangpei@loongson.cn> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240118123929.369939-1-huangpei@loongson.cn> References: <20240118123929.369939-1-huangpei@loongson.cn> Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: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0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0x vEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVj vjDU0xZFpf9x07jz2NtUUUUU= Commit 61167ad5fecd("mm: pass nid to reserve_bootmem_region()) reveals that reserved memblock regions have no valid node id set, just set it right since loongson64 firmware makes it clear in memory layout info. This work around booting failure on 3A1000+ since commit 61167ad5fecd ("mm: pass nid to reserve_bootmem_region()) under CONFIG_DEFERRED_STRUCT_PAGE_INIT Signed-off-by: Huang Pei --- arch/mips/loongson64/init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/loongson64/init.c b/arch/mips/loongson64/init.c index f25caa6aa9d3..5bfabc67136a 100644 --- a/arch/mips/loongson64/init.c +++ b/arch/mips/loongson64/init.c @@ -97,6 +97,8 @@ void __init szmem(unsigned int node) (u32)node_id, mem_type, &mem_start, &mem_size); break; } + /* set nid for reserved memory */ + memblock_set_node(0, node_id << 44, &memblock.reserved, node_id); } /* Reserve vgabios if it comes from firmware */