From patchwork Tue Aug 27 11:36:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Kondratiev X-Patchwork-Id: 13779360 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45F36C54735 for ; Tue, 27 Aug 2024 11:37:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB4736B007B; Tue, 27 Aug 2024 07:37:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B646D6B0082; Tue, 27 Aug 2024 07:37:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A53426B0083; Tue, 27 Aug 2024 07:37:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 864766B007B for ; Tue, 27 Aug 2024 07:37:01 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2A8DD14183D for ; Tue, 27 Aug 2024 11:37:01 +0000 (UTC) X-FDA: 82497823842.22.E6E1CE0 Received: from esa3.hc555-34.eu.iphmx.com (esa3.hc555-34.eu.iphmx.com [207.54.77.50]) by imf30.hostedemail.com (Postfix) with ESMTP id 0CF3680007 for ; Tue, 27 Aug 2024 11:36:57 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none ("invalid DKIM record") header.d=mobileye.com header.s=MoEyIP header.b=sVzgFVwm; spf=pass (imf30.hostedemail.com: domain of vladimir.kondratiev@mobileye.com designates 207.54.77.50 as permitted sender) smtp.mailfrom=vladimir.kondratiev@mobileye.com; dmarc=pass (policy=quarantine) header.from=mobileye.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724758575; a=rsa-sha256; cv=none; b=Tbvh7znV0do4AeWNCb2BVD8TxTEs7fQzA3N+IWlaJGQRiCQlN2pACMIJr/jXClR7tuii+7 YRqgKtTnhsIsMP26mQRr803y523G9nbsHZvoc3C+4MijD1XbfowSgO+y5ObCXjIKqpHBn4 xvG/pqSWsKX88EAh+b7SU6l7fby3Xas= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none ("invalid DKIM record") header.d=mobileye.com header.s=MoEyIP header.b=sVzgFVwm; spf=pass (imf30.hostedemail.com: domain of vladimir.kondratiev@mobileye.com designates 207.54.77.50 as permitted sender) smtp.mailfrom=vladimir.kondratiev@mobileye.com; dmarc=pass (policy=quarantine) header.from=mobileye.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724758575; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=M4HHx25KWfUlsyT4kYiB6zbBq2L9bKDtf0NSDZ9OvNU=; b=x1Ux+jN1duMWHLaAMZvVkjMxDtrudw+ErvUqQ5RLTS6OOVQlsTTyrmzH9z0er1n1H6maMv fmTd8XVucQg9pQ5KCscjT+ioIVNaUXIYyJa/R7Me+OoXjxSDc9dCFRjUN1Uq6QqUOabB8W TWqN1Cfd+SOQPDQVJp5kE2Yo9mgTK/0= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mobileye.com; i=@mobileye.com; q=dns/txt; s=MoEyIP; t=1724758618; x=1756294618; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=F50f3qIUpTHn684n3f885wQ8c6LqK97tiJsfNPZU8Ws=; b=sVzgFVwm96gl4COQiGv+rHB15HyTKXeFzOzYeQ7NxP0qbsxcOPZXR5K9 8/nDWZyd/bxSZu/lgZ8rOctXAL20Sv9CjfDWmwvLX6AJnwxhQKeY7mKD9 BcMWOQLa54B8mI4byvmRb6rJzbu0QslQkIeM3W6ktTYRkSHIo9PafM5hu s4UgnKK6TZuusVk8j6cNLMtwLG55XOgKkzBlNm3qUa/lPsbIRhDSvkXTt 0k5w53wyTYiwP83ru9ncQLS9OJblrZyFNG6D2SOvFoOWcg+ZrwIZBg4IC pzZNV/6K2k4AzkmsINUiruWq1USDhrlx3D4wlmqZuycnNkhb+ZkS80Bgt Q==; X-CSE-ConnectionGUID: C3M6NWjaSmyvDbj6S4Aw+Q== X-CSE-MsgGUID: 26XD0NNfQRSH4zIQtxG1iQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from unknown (HELO ces03_data.me-corp.lan) ([146.255.191.134]) by esa3.hc555-34.eu.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Aug 2024 14:36:56 +0300 X-CSE-ConnectionGUID: l89z8843QFKHaLS15hpymQ== X-CSE-MsgGUID: IuEfY1SqQ3WNUTEuklfTEg== Received: from unknown (HELO epgd022.me-corp.lan) ([10.154.54.6]) by ces03_data.me-corp.lan with SMTP; 27 Aug 2024 14:36:54 +0300 Received: by epgd022.me-corp.lan (sSMTP sendmail emulation); Tue, 27 Aug 2024 14:36:54 +0300 From: Vladimir Kondratiev To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Vladimir Kondratiev , Andrew Morton , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH] riscv: make ZONE_DMA32 optional Date: Tue, 27 Aug 2024 14:36:11 +0300 Message-Id: <20240827113611.537302-1-vladimir.kondratiev@mobileye.com> MIME-Version: 1.0 X-Stat-Signature: duwuyifnnww337k9hok5xea1ff6bs8fn X-Rspamd-Queue-Id: 0CF3680007 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724758617-212041 X-HE-Meta: U2FsdGVkX19kMYpTsDQIqJzU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7ayF/mzD/fWBulwgMQkyj91iR4wOrR3qUnlx9xPi0cMDfIaSTDHNpj7TIiLOyKCxsuMxXu3p+Xl00/Q+YXpDarNS1o0h/ApwlxrVaVvuXoFqJG+G5E/CJ/ghe9H3haX80goYDqfvIlNxM1KQt6cK2vCdy0N1dFKJzKQ/RBkS/8ntp4ZBI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: It is not necessary any RISCV platform has ZONE_DMA32. Example - if platform has no DRAM in [0..4G] region, it will report failure like below each boot. [ 0.088709] swapper/0: page allocation failure: order:7, mode:0xcc4(GFP_KERNEL|GFP_DMA32), nodemask=(null),cpuset=/ [ 0.088832] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.11.0-rc5 #30 [ 0.088864] Call Trace: [ 0.088869] [] dump_backtrace+0x1c/0x24 [ 0.088910] [] show_stack+0x2c/0x38 [ 0.088957] [] dump_stack_lvl+0x52/0x74 [ 0.088987] [] dump_stack+0x14/0x1c [ 0.089010] [] warn_alloc+0xf4/0x176 [ 0.089041] [] __alloc_pages_noprof+0xc28/0xcb4 [ 0.089067] [] atomic_pool_expand+0x62/0x1f8 [ 0.089090] [] __dma_atomic_pool_init+0x46/0x9e [ 0.089115] [] dma_atomic_pool_init+0x96/0x11c [ 0.089139] [] do_one_initcall+0x5c/0x1b2 [ 0.089158] [] kernel_init_freeable+0x214/0x274 [ 0.089190] [] kernel_init+0x1e/0x10a [ 0.089209] [] ret_from_fork+0xe/0x1c Signed-off-by: Vladimir Kondratiev Reviewed-by: Drew Fustini Signed-off-by: Vladimir Kondratiev --- arch/riscv/Kconfig | 2 +- mm/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 0f3cd7c3a436..94a573112625 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -50,6 +50,7 @@ config RISCV select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_UBSAN select ARCH_HAS_VDSO_DATA + select ARCH_HAS_ZONE_DMA_SET if 64BIT select ARCH_KEEP_MEMBLOCK if ACPI select ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE if 64BIT && MMU select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX @@ -200,7 +201,6 @@ config RISCV select THREAD_INFO_IN_TASK select TRACE_IRQFLAGS_SUPPORT select UACCESS_MEMCPY if !MMU - select ZONE_DMA32 if 64BIT config CLANG_SUPPORTS_DYNAMIC_FTRACE def_bool CC_IS_CLANG diff --git a/mm/Kconfig b/mm/Kconfig index b72e7d040f78..97c85da98e89 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1032,7 +1032,7 @@ config ZONE_DMA config ZONE_DMA32 bool "Support DMA32 zone" if ARCH_HAS_ZONE_DMA_SET depends on !X86_32 - default y if ARM64 + default y if ARM64 || (RISCV && 64BIT) config ZONE_DEVICE bool "Device memory (pmem, HMM, etc...) hotplug support"