From patchwork Thu Jun 15 08:43:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noam Camus X-Patchwork-Id: 776184 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wpHBq6m2Tz9s71 for ; Thu, 15 Jun 2017 18:45:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Jmy0Gw0m"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=+FB6nRev/Qy/kSBdheTJajhVL5tC8iAIgREfReXQdB0=; b=Jmy0Gw0mMcUACYMF3S8ozw9tP6 ZXIP7/16CjurjxkHDzS5EFWQmWAb5V6wRAky/Af0bod4rVMAEIJAZbt12O3CV0vQZtQ9AWtk/b97M /S4xOoyZGVsl0R7WEY8JFTW8+WLHwdOcWbotJvEtT2IqyaNjGlJz7FswGMyVEKOkYBfQu455smi6S bQZ9FR4v1+Qy6387PAeBxnlEBdKycmUpzWd+P/T4GKN72MJJs6Aushky/OD2y7S7OJokh+MNOS5Dp IIUrGUzMZZNuohwpNFEYVA4P/cS5e7e7qrI9SsUC1ypVuRA25MFyR8zplenrHqDDGKG3mhisErREk tUIdDSPw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dLQP4-0007Yb-DW; Thu, 15 Jun 2017 08:45:22 +0000 Received: from mail-il-dmz.mellanox.com ([193.47.165.129] helo=mellanox.co.il) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dLQP0-0006Gs-Iq for linux-snps-arc@lists.infradead.org; Thu, 15 Jun 2017 08:45:20 +0000 Received: from Internal Mail-Server by MTLPINE1 (envelope-from noamca@mellanox.com) with ESMTPS (AES256-SHA encrypted); 15 Jun 2017 11:44:54 +0300 Received: from nps20.mtl.labs.mlnx. (l-nps20.mtl.labs.mlnx [10.7.191.20]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v5F8iorC007661; Thu, 15 Jun 2017 11:44:54 +0300 From: Noam Camus To: linux-snps-arc@lists.infradead.org Subject: [PATCH v3 06/11] ARC: [NUMA] added CONFIG_NUMA for plat-eznps Date: Thu, 15 Jun 2017 11:43:56 +0300 Message-Id: <1497516241-16446-7-git-send-email-noamca@mellanox.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1497516241-16446-1-git-send-email-noamca@mellanox.com> References: <1497516241-16446-1-git-send-email-noamca@mellanox.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170615_014519_113992_3ACA8846 X-CRM114-Status: UNSURE ( 9.54 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Noam Camus , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Noam Camus This is needed for NPS400 where high memory is assigned to node1 where the associated addresses are lower than node0. This use case is not typical and just using discontigmem is not enough since nodes assumed to have increasing address range. i.e. address range of node0 assumed to be lower than node1. Signed-off-by: Noam Camus --- arch/arc/Kconfig | 9 +++++++++ arch/arc/include/asm/topology.h | 6 ++++++ arch/arc/kernel/setup.c | 3 +++ arch/arc/mm/init.c | 6 ++++++ 4 files changed, 24 insertions(+), 0 deletions(-) diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 982bd18..18c37de 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -378,6 +378,15 @@ config ARC_HUGEPAGE_16M endchoice +config NUMA + bool "NUMA Memory Allocation and Scheduler Support" + depends on SMP && DISCONTIGMEM + default y if ARC_PLAT_EZNPS + ---help--- + NUMA memory allocation is required for NPS400 processors. + The reason is that node1 in NPS400 is assigned to lower + addresses than node0, which is not typical scenario. + config NODES_SHIFT int "Maximum NUMA Nodes (as a power of 2)" default "0" if !DISCONTIGMEM diff --git a/arch/arc/include/asm/topology.h b/arch/arc/include/asm/topology.h index a9be3f8..dfbc2ab 100644 --- a/arch/arc/include/asm/topology.h +++ b/arch/arc/include/asm/topology.h @@ -1,6 +1,12 @@ #ifndef _ASM_ARC_TOPOLOGY_H #define _ASM_ARC_TOPOLOGY_H +#ifdef CONFIG_NUMA +#define cpu_to_node(cpu) ((void)(cpu), 0) +#define parent_node(node) (node) +#define cpumask_of_node(node) ((void)node, cpu_online_mask) +#endif + #ifdef CONFIG_NPS_CPU_TOPOLOGY #include diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c index 379ebda..3d1509b 100644 --- a/arch/arc/kernel/setup.c +++ b/arch/arc/kernel/setup.c @@ -577,6 +577,9 @@ static int __init topology_init(void) { int cpu; + for_each_online_node(cpu) + register_one_node(cpu); + for_each_present_cpu(cpu) register_cpu(&per_cpu(cpu_topo_info, cpu), cpu); diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c index 8c9415e..f9f80d9 100644 --- a/arch/arc/mm/init.c +++ b/arch/arc/mm/init.c @@ -113,6 +113,10 @@ void __init setup_arch_memory(void) init_mm.end_data = (unsigned long)_edata; init_mm.brk = (unsigned long)_end; + node_set_online(0); + node_set_state(0, N_MEMORY); + node_set_state(0, N_NORMAL_MEMORY); + /* first page of system - kernel .vector starts here */ min_low_pfn = ARCH_PFN_OFFSET; @@ -182,6 +186,8 @@ void __init setup_arch_memory(void) * populated with normal memory zone while node 1 only has highmem */ node_set_online(1); + node_set_state(1, N_MEMORY); + node_set_state(1, N_HIGH_MEMORY); min_high_pfn = PFN_DOWN(high_mem_start); max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz);