From patchwork Wed Feb 12 12:49:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13971469 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3ED2209696; Wed, 12 Feb 2025 12:49:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739364561; cv=none; b=j1m+K5vV+Ch+HZaMiHNLDse+3UMEOmHN9cXNh7+ZSlxwhZsQfT/ihTO5ugyLUAo0VGLNrA9brtOFCZHDTHTKCFNSB747I7UzbSo+RSR+i+kVy57MfsHnpP9l4D7BqtvVZIc/H4TAnV7UCza2FoZ8tXZOo7VtX/QUVAywyXBr0PQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739364561; c=relaxed/simple; bh=Z3DuBWiolyR+/hYM6KNiu+IxGCZbOsuSr/Aoh4+JX5A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=O/EFh0jS45EEs86ZX5x1P7s4qoZLy53Vs8ODSsDWYctuWb5Otww1gpjD8GE3PmLE4eVDKICrRGrySco1LIB2oOlsmxkNWlyMVnBfzEz5Z2UChGuq1hhXbKdN88IRq88rRy0O/wFYDBbO6/DjXnhgaOktQE4jbw3p2JrEpfnz3NY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=a9gReCmn; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=KzVnUi34; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="a9gReCmn"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="KzVnUi34" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1739364558; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rRO/aCcLz5c3u/REzsM4oOV5h4ZskKLpS8CU6v4XYto=; b=a9gReCmnC7XI7cxq9UB1Fw/AGRgKOd1XXL0iAYc+qorhU5jzfBJSSUjYAarb1x9RCOWz8x HGzrzeePWrOm8T/cxTfgtORX4YJdsF9/Ps1ryhXL8RCVCq0h6+hS2GTyekgdRuNdu1q5nS DKBiwoAACo6WV2Mmr/hNV9xk1/s6LZ1VkIFdcZadFZm6MnUTc6oi73qhPSwKRlfr2/cc6N Wi9QPEv6IYv6B52E3nPZkeOfUlgSzJgbTHs70i0F7Zo9GF14mfLwxGQSVIkpuiUBtUfISf Ki3/RD1+v3YvJrnK4iV6VUmpoJyWTwcKvW8dFlczZD1HsP5MRPlIo+G80AGQFA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1739364558; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rRO/aCcLz5c3u/REzsM4oOV5h4ZskKLpS8CU6v4XYto=; b=KzVnUi34OjDF9ollf//8mUXu1v9G83HTe0nbKZ4dXQTuxcC9M+JLjkbl9EA+1r+hOiuI6O +6ui9WzPSsR3gjCg== Date: Wed, 12 Feb 2025 13:49:12 +0100 Subject: [PATCH 1/2] MIPS: mm: Avoid blocking DMA zone with memory map memblock allocation Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250212-kunit-mips-v1-1-eb49c9d76615@linutronix.de> References: <20250212-kunit-mips-v1-0-eb49c9d76615@linutronix.de> In-Reply-To: <20250212-kunit-mips-v1-0-eb49c9d76615@linutronix.de> To: Thomas Bogendoerfer , Paul Burton , Brendan Higgins , David Gow , Rae Moar Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?q?Tho?= =?utf-8?q?mas_Wei=C3=9Fschuh?= , Mike Rapoport , Andrew Morton , linux-mm@kvack.org X-Developer-Signature: v=1; a=ed25519-sha256; t=1739364553; l=1909; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=Z3DuBWiolyR+/hYM6KNiu+IxGCZbOsuSr/Aoh4+JX5A=; b=OXcSbIpxkSAcwRHlbs6HEkqNZAr1X0CIlnfLaAoT1SSEcEMDWPzWfdYZd9W5RQPoUd7KDBMI5 FrUSOFE+ZgQDd8N90ifgnRot3jhDXJfoQTpI9U4z66GBsSI9+Wtcn33 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= On MIPS the memblock allocator is configured to allocate bottom-up. The memory map is allocated by the mm core through memblock and uses MEMBLOCK_LOW_LIMIT as minimal address. This constant is defined as zero because it assumes that "we are using top down, so it is safe to use 0 here". So the memory map is allocated as close to 0 as possible, right where the DMA zone will end up. As the memory map is allocated permanently and also larger than the DMA zone, it makes the DMA zone unusable. Temporarily switch to top-down allocation for the call to free_area_init() so the memory map allocation does not fall into the DMA zone. Signed-off-by: Thomas Weißschuh --- Another solution would be to change alloc_node_mem_map() in the mm core to use __pa(MAX_DMA_ADDRESS) for the min_addr when calling memmap_alloc(), as is done by the other callers of memmap_alloc(). Looping in the memblock maintainers for discussion. This is reliably reproducible in QEMU. To reproduce, use the kunit configuration from patch 2 of this series and run it like so: ./tools/testing/kunit/kunit.py run --arch mips64el --cross_compile $CROSS_COMPILE cs_dsp_wmfwV3_err_halo.wmfw_v2_coeff_description_exceeds_block To: Mike Rapoport To: Andrew Morton Cc: linux-mm@kvack.org --- arch/mips/mm/init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 4583d1a2a73e7ff36a42f6017d9aef008e45df6e..712eb4762917261416f1fca2d9925a42107ef6c1 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c @@ -435,7 +435,9 @@ void __init paging_init(void) #endif high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); + memblock_set_bottom_up(false); free_area_init(max_zone_pfns); + memblock_set_bottom_up(true); } #ifdef CONFIG_64BIT From patchwork Wed Feb 12 12:49:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13971470 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7E7A20A5CB; Wed, 12 Feb 2025 12:49:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739364562; cv=none; b=dffI+l33cqBWErXT/05uLKGWxom+RKRPGohCNziweTz1Lgd9gO0erYBZ/uwDyOPeOFjo4ld3fli/VzpemIsy+cBopEVzN1qbHyW0MsNXuppKRLj+y7QV4PFjBjZS0FjSTDuB5UBud6zSe8IsVaUrqODxZKOg7bgItu6JlT48ufc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739364562; c=relaxed/simple; bh=Ki0geKqiotb7MNz6x+v8X77O0WmfIbS8RbGuA4eQZjo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dns9b55exvIgBnedUvcXPt3enMiY2GHN8wh/NUSnRqS8tA544FuHuROZWpmIXFrzsy7hWVxyVQ20grx9tyeyCJz2fxVeJp2RPHAh3drnEJ3g+3TYD4qKBQYvFwtpjaon/BLZkr4AFbWxw38t5Wv4gB9sOX3Otwfv3dHflKNWd/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=cl+rNPKR; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=PTK+ISsi; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="cl+rNPKR"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="PTK+ISsi" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1739364558; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VfBrN75f8h+uEuGhED42HwCyXiiO8jFgRTxqPcj2O+Q=; b=cl+rNPKRaaTBh62w7oiiSM1M3DNpYR0LUo4dwEVn+QhuzRBGhiGg9wC4Mycqs+s6zUDrW6 sh4hxBqjKg4Jtnf3azYthU4vWgbLFsQHQ0Ku0ZlXx3coGXNTnJ2EUCAs/0rY2G1MHDkxi9 pMtGS5wXIl+NNGeHH0BFnyA+zFCKqLtg8TcbavQPabXU1MhMARD1JiibqgUZ1FnowN/RsN HW6oCsA8k96p0alan3oTXMZ5xXR9crGpCCc8tepfl0IIc4Jir8iERcSElJ7h5RyItdJ4Kj 7dKfpGMVp/Ss/f6UlwhvhhgpwFqygi3i8ZiJnU2tZvmqamFshdlwBwGtF4syXw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1739364558; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VfBrN75f8h+uEuGhED42HwCyXiiO8jFgRTxqPcj2O+Q=; b=PTK+ISsi6zORO6UZMD23AevzyGYLcw2wB0UCxsEGFJ7csQJhsAPbhQbjCjbYpnjgxMU++Z O5Yk3xUuL8pg1WCQ== Date: Wed, 12 Feb 2025 13:49:13 +0100 Subject: [PATCH 2/2] kunit: qemu_configs: Add MIPS configurations Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250212-kunit-mips-v1-2-eb49c9d76615@linutronix.de> References: <20250212-kunit-mips-v1-0-eb49c9d76615@linutronix.de> In-Reply-To: <20250212-kunit-mips-v1-0-eb49c9d76615@linutronix.de> To: Thomas Bogendoerfer , Paul Burton , Brendan Higgins , David Gow , Rae Moar Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?q?Tho?= =?utf-8?q?mas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1739364553; l=4132; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=Ki0geKqiotb7MNz6x+v8X77O0WmfIbS8RbGuA4eQZjo=; b=Ar6njH5ZwFpZSFlfL1oDpY8zPN35HzEyLXIMywlPj1uWAZiUPpdn6ZZLsvvohpPE78uwrRv5R Fno8E8H5e5uAAlSMTnyfTO/B4NXkcQ+rnzg8iezaz7YPkfn1SMMgjaL X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Add basic support to run various MIPS variants via kunit_tool using the virtualized malta platform. Signed-off-by: Thomas Weißschuh --- tools/testing/kunit/qemu_configs/mips.py | 18 ++++++++++++++++++ tools/testing/kunit/qemu_configs/mips64.py | 19 +++++++++++++++++++ tools/testing/kunit/qemu_configs/mips64el.py | 19 +++++++++++++++++++ tools/testing/kunit/qemu_configs/mipsel.py | 18 ++++++++++++++++++ 4 files changed, 74 insertions(+) diff --git a/tools/testing/kunit/qemu_configs/mips.py b/tools/testing/kunit/qemu_configs/mips.py new file mode 100644 index 0000000000000000000000000000000000000000..8899ac157b30bd2ee847eacd5b90fe6ad4e5fb04 --- /dev/null +++ b/tools/testing/kunit/qemu_configs/mips.py @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0 + +from ..qemu_config import QemuArchParams + +QEMU_ARCH = QemuArchParams(linux_arch='mips', + kconfig=''' +CONFIG_32BIT=y +CONFIG_CPU_BIG_ENDIAN=y +CONFIG_MIPS_MALTA=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_SYSCON=y +''', + qemu_arch='mips', + kernel_path='vmlinuz', + kernel_command_line='console=ttyS0', + extra_qemu_params=['-M', 'malta']) diff --git a/tools/testing/kunit/qemu_configs/mips64.py b/tools/testing/kunit/qemu_configs/mips64.py new file mode 100644 index 0000000000000000000000000000000000000000..1478aed05b94da4914f34c6a8affdcfe34eb88ea --- /dev/null +++ b/tools/testing/kunit/qemu_configs/mips64.py @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0 + +from ..qemu_config import QemuArchParams + +QEMU_ARCH = QemuArchParams(linux_arch='mips', + kconfig=''' +CONFIG_CPU_MIPS64_R2=y +CONFIG_64BIT=y +CONFIG_CPU_BIG_ENDIAN=y +CONFIG_MIPS_MALTA=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_SYSCON=y +''', + qemu_arch='mips64', + kernel_path='vmlinuz', + kernel_command_line='console=ttyS0', + extra_qemu_params=['-M', 'malta', '-cpu', '5KEc']) diff --git a/tools/testing/kunit/qemu_configs/mips64el.py b/tools/testing/kunit/qemu_configs/mips64el.py new file mode 100644 index 0000000000000000000000000000000000000000..300c711d7a82500b2ebcb4cf1467b6f72b5c17aa --- /dev/null +++ b/tools/testing/kunit/qemu_configs/mips64el.py @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0 + +from ..qemu_config import QemuArchParams + +QEMU_ARCH = QemuArchParams(linux_arch='mips', + kconfig=''' +CONFIG_CPU_MIPS64_R2=y +CONFIG_64BIT=y +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_MIPS_MALTA=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_SYSCON=y +''', + qemu_arch='mips64el', + kernel_path='vmlinuz', + kernel_command_line='console=ttyS0', + extra_qemu_params=['-M', 'malta', '-cpu', '5KEc']) diff --git a/tools/testing/kunit/qemu_configs/mipsel.py b/tools/testing/kunit/qemu_configs/mipsel.py new file mode 100644 index 0000000000000000000000000000000000000000..3d3543315b45776d0e77fb5c00c8c0a89eafdffd --- /dev/null +++ b/tools/testing/kunit/qemu_configs/mipsel.py @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0 + +from ..qemu_config import QemuArchParams + +QEMU_ARCH = QemuArchParams(linux_arch='mips', + kconfig=''' +CONFIG_32BIT=y +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_MIPS_MALTA=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_SYSCON=y +''', + qemu_arch='mipsel', + kernel_path='vmlinuz', + kernel_command_line='console=ttyS0', + extra_qemu_params=['-M', 'malta'])