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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 66B02C433F5 for ; Tue, 31 May 2022 18:16:58 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CC99384284; Tue, 31 May 2022 20:15:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="foRct3LE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A39BF84293; Tue, 31 May 2022 20:15:26 +0200 (CEST) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DBB048426E for ; Tue, 31 May 2022 20:14:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ovpanait@gmail.com Received: by mail-wr1-x436.google.com with SMTP id p10so19748373wrg.12 for ; Tue, 31 May 2022 11:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D39dZNdJRsDaeyIeepMKjq7dxb1TOcirC2anI+zisL4=; b=foRct3LEj7iTMHJ2HRbnGQKqj6PeWWkGPQexel1dEFlWN2LoWDoqW2sifMNNeeksjf Yg49uWPYyotqcReb/MVBhh5nOCEbFy31PE/ERdbEVtzjkSovJdhILjRFei7U1Npr85bm Rs/N2tqN37XlQfB0R+WteRIkCNaTdmX6c/PKs9Xn4nzOi6cEMGHwsROnYHLungZyyvVq /9oVhjPpacJEya3viZyQibQDKzu3jhV7tLT4gV0xE93/LpI3A5YZCyzUheqMDk+XzFY1 htAKjWV6JUh97MGSmsX1YQkaua+o7IRO2LDt1N051rlTgO0L7ngBz0fLllqOMBdKyTz+ cEDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D39dZNdJRsDaeyIeepMKjq7dxb1TOcirC2anI+zisL4=; b=sOy7GzkDy+mDHativS4gl+ojqDooeeMBMGpAAIgI15kUh0tg16HBL+oTQU8WwDfy9M xu6mg9zldAgSu8xbyzGf+S56ZYp6nlvunwvOCusB/HEZr5YFIWE+smyJxuJu6zBzUGbJ Rm9nl8Qrk0HPhjyiAfOLMRAf2/e/mMNnFjmN7+m3fm6u+lwqfyTXhgTCbxMB5vyhEJxj jFC1/FcF7hChLyyctcYNSeGsL75Jj0vPwF2MbVzl03WV55So6V44LV+hNK48/i5qchWg ZaFKaZluUKb5MTMY3MDjhI2qP1ymQktLjAdiPS6YVH75ZuFaDZla3UQ14FepDU4eUc+E MSZQ== X-Gm-Message-State: AOAM531XyTxSIzYVWVTJrJ3TBwXY5i27gNw4CDLng1ispgIo2pXmIXCY jHC7esLayJ6a2gjcwDhgXafHtALYIBA= X-Google-Smtp-Source: ABdhPJwhNATgUnilmf0PwcZxuoRY4CLCC1/wCfCGqfIjf4QkQMW40RezK7nNK6XxsNXRnqv2aAMdfw== X-Received: by 2002:a5d:6dc3:0:b0:210:89d:30bc with SMTP id d3-20020a5d6dc3000000b00210089d30bcmr23266314wrz.272.1654020897456; Tue, 31 May 2022 11:14:57 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f0e:c003:7c00:45d1:29c0:7802:f752]) by smtp.gmail.com with ESMTPSA id l3-20020a1c7903000000b003974027722csm2682980wme.47.2022.05.31.11.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 11:14:57 -0700 (PDT) From: Ovidiu Panait To: u-boot@lists.denx.de Cc: monstr@monstr.eu, Ovidiu Panait , Alexandru Gagniuc , Marek Vasut , Michal Simek , Simon Glass Subject: [PATCH v2 08/14] microblaze: cache: introduce Kconfig options for icache/dcache sizes Date: Tue, 31 May 2022 21:14:29 +0300 Message-Id: <20220531181435.3473549-8-ovpanait@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531181435.3473549-1-ovpanait@gmail.com> References: <20220531181435.3473549-1-ovpanait@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Replace XILINX_DCACHE_BYTE_SIZE macro with two Kconfig symbols for instruction and data caches sizes, respectively: CONFIG_XILINX_MICROBLAZE0_ICACHE_SIZE CONFIG_XILINX_MICROBLAZE0_DCACHE_SIZE Also, get rid of the hardcoded value in icache_disable(). Signed-off-by: Ovidiu Panait --- Changes in v2: - added separate Kconfig symbols for icache/dcache arch/microblaze/cpu/cache.c | 5 ++--- arch/microblaze/cpu/start.S | 4 ++-- arch/microblaze/lib/bootm.c | 2 +- board/xilinx/microblaze-generic/Kconfig | 16 ++++++++++++++++ include/configs/microblaze-generic.h | 4 ---- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/arch/microblaze/cpu/cache.c b/arch/microblaze/cpu/cache.c index e362a34a79..d5c0afd935 100644 --- a/arch/microblaze/cpu/cache.c +++ b/arch/microblaze/cpu/cache.c @@ -65,8 +65,7 @@ void icache_enable(void) void icache_disable(void) { - /* we are not generate ICACHE size -> flush whole cache */ - __invalidate_icache(0, 32768); + __invalidate_icache(0, CONFIG_XILINX_MICROBLAZE0_ICACHE_SIZE); MSRCLR(0x20); } @@ -78,7 +77,7 @@ void dcache_enable(void) void dcache_disable(void) { - __flush_dcache(0, XILINX_DCACHE_BYTE_SIZE); + __flush_dcache(0, CONFIG_XILINX_MICROBLAZE0_DCACHE_SIZE); MSRCLR(0x80); } diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S index d1b0453caf..356ca05392 100644 --- a/arch/microblaze/cpu/start.S +++ b/arch/microblaze/cpu/start.S @@ -53,7 +53,7 @@ _start: /* Flush cache before enable cache */ addik r5, r0, 0 - addik r6, r0, XILINX_DCACHE_BYTE_SIZE + addik r6, r0, CONFIG_XILINX_MICROBLAZE0_DCACHE_SIZE bralid r15, flush_cache nop @@ -284,7 +284,7 @@ relocate_code: /* Flush caches to ensure consistency */ addik r5, r0, 0 - addik r6, r0, XILINX_DCACHE_BYTE_SIZE + addik r6, r0, CONFIG_XILINX_MICROBLAZE0_DCACHE_SIZE bralid r15, flush_cache nop diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c index dba6226ce5..48e05333a6 100644 --- a/arch/microblaze/lib/bootm.c +++ b/arch/microblaze/lib/bootm.c @@ -57,7 +57,7 @@ static void boot_jump_linux(bootm_headers_t *images, int flag) "(fake run for tracing)" : ""); bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel"); - flush_cache(0, XILINX_DCACHE_BYTE_SIZE); + flush_cache(0, CONFIG_XILINX_MICROBLAZE0_DCACHE_SIZE); if (!fake) { /* diff --git a/board/xilinx/microblaze-generic/Kconfig b/board/xilinx/microblaze-generic/Kconfig index 98b4814b95..a6743cadf4 100644 --- a/board/xilinx/microblaze-generic/Kconfig +++ b/board/xilinx/microblaze-generic/Kconfig @@ -85,4 +85,20 @@ config SPL_XILINX_MICROBLAZE0_USE_WIC bool default XILINX_MICROBLAZE0_USE_WIC +config XILINX_MICROBLAZE0_DCACHE_SIZE + int "Default data cache size" + default 32768 + help + This fallback size will be used when no dcache info can be found in + the device tree, or when the data cache is flushed very early in the + boot process, before device tree is available. + +config XILINX_MICROBLAZE0_ICACHE_SIZE + int "Default instruction cache size" + default 32768 + help + This fallback size will be used when no icache info can be found in + the device tree, or when the instruction cache is flushed very early + in the boot process, before device tree is available. + endif diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h index 663837f33d..7b064eacb2 100644 --- a/include/configs/microblaze-generic.h +++ b/include/configs/microblaze-generic.h @@ -30,10 +30,6 @@ # define CONFIG_SYS_MAX_FLASH_SECT 2048 #endif -#ifndef XILINX_DCACHE_BYTE_SIZE -#define XILINX_DCACHE_BYTE_SIZE 32768 -#endif - /* size of console buffer */ #define CONFIG_SYS_CBSIZE 512 /* max number of command args */ -- 2.25.1