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 76CE1C433F5 for ; Mon, 11 Apr 2022 16:28:01 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D61E183E59; Mon, 11 Apr 2022 18:27:25 +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="AMwBIs8y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8B12883E4D; Mon, 11 Apr 2022 18:26:59 +0200 (CEST) Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) (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 245A683B1B for ; Mon, 11 Apr 2022 18:26:55 +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-ed1-x529.google.com with SMTP id b24so19101081edu.10 for ; Mon, 11 Apr 2022 09:26:55 -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=GoPwxvl0x0d19H3FvnDQt8WpTLHpHBHXBSdzmNd1mjM=; b=AMwBIs8yIbu1/LKCMt5ugCWArST95di5xpkIcC/pV/KVnZTBTFaAGfY0jmLygfY/IL riHK6jhDgbfT++K4nptSbqTqTAuK9NT6XLCCmNBSoDaF7PoCP3AuN74h6eGYiEaBaMF+ VApk4pT7eV7m7lmBlLDJU7SyH3peDLDqYbYjt+bFQqh/OwN6uADb6IHTEa+ONzHW5dhf v2cA7t2pIjUOI7IjpgI9JQPwfT1UfVOK/IgEedhDm8Jhghe+uZWh0Ptpzxal9rRLuJVv sARVuwtvmnJLqFSRfSPbIZ9aPit9CMZL+47HghBe6m6AuC5egKOvSNWdP9FKtjbY7P3O yfLQ== 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=GoPwxvl0x0d19H3FvnDQt8WpTLHpHBHXBSdzmNd1mjM=; b=J8qYaIUuGor8M/KvyAxnZDUYknhroxv/24o0t8N2rLidCddwigpIXMVil/DGDP1hkt +df9Zk/QnNmKtZxt3d/ZFxDApzM4NL2zasJTNCwP41bMi1amKqzKMyzjaL5GTiyjeQY6 8A/jiwFkaYnHqDr0YLGiyLqLzOLgLlaD5/c2JlnHanGzjk7VpLfV+d262mACoPgs6vIk /yOd0ChFXkG9MSb1WXSnd0DcoDw/x9ZrY2Dm0L8saZb1bvb6dF1PpWjVaLOph0Y+6/vn y4CiZ7I6ZUAFASaKawGHwBLHwnDOyMHqvlSuRHjsk2JVW5WzLlC2wLVbtzz1am3cfXLK 9naw== X-Gm-Message-State: AOAM532JL6G5YyJ9myvJi7TaApSVqHTwYsZ9T2uc1Yn94NLjfSZt0mRv NH5jjTTf9uMwNaPCq4TClzYPsY32JI2nFA== X-Google-Smtp-Source: ABdhPJybaJbfzHVNz7g1q7hR4PGGj59hDBHDKsktneM1vDA+r/22FFTgT3Ezwtv5huPi9MOULGdQ8g== X-Received: by 2002:aa7:c789:0:b0:413:605d:8d17 with SMTP id n9-20020aa7c789000000b00413605d8d17mr33894061eds.100.1649694414790; Mon, 11 Apr 2022 09:26:54 -0700 (PDT) Received: from wsdell.corp.ad.wrs.com ([2a02:2f0e:c41b:f600:4ab1:7aea:1e9:311a]) by smtp.gmail.com with ESMTPSA id y26-20020a1709063a9a00b006e0c272e263sm12111417ejd.71.2022.04.11.09.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Apr 2022 09:26:54 -0700 (PDT) From: Ovidiu Panait To: u-boot@lists.denx.de Cc: Ovidiu Panait , Alexandru Gagniuc , Marek Vasut , Michal Simek , Michal Simek , Simon Glass Subject: [PATCH 06/10] microblaze: cache: migrate XILINX_DCACHE_BYTE_SIZE to Kconfig Date: Mon, 11 Apr 2022 19:26:30 +0300 Message-Id: <20220411162634.69647-6-ovpanait@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220411162634.69647-1-ovpanait@gmail.com> References: <20220411162634.69647-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 Migrate XILINX_DCACHE_BYTE_SIZE to Kconfig and rename it to XILINX_MICROBLAZE0_DEFAULT_CACHE_SIZE. Use it as the default size for both instruction/data caches and get rid of the hardcoded value in icache_disable(). Signed-off-by: Ovidiu Panait --- arch/microblaze/cpu/cache.c | 5 ++--- arch/microblaze/cpu/start.S | 4 ++-- arch/microblaze/lib/bootm.c | 2 +- board/xilinx/microblaze-generic/Kconfig | 8 ++++++++ include/configs/microblaze-generic.h | 4 ---- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/arch/microblaze/cpu/cache.c b/arch/microblaze/cpu/cache.c index e362a34a79..2814c1dc07 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_DEFAULT_CACHE_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_DEFAULT_CACHE_SIZE); MSRCLR(0x80); } diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S index d1b0453caf..94984148de 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_DEFAULT_CACHE_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_DEFAULT_CACHE_SIZE bralid r15, flush_cache nop diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c index dba6226ce5..59b757c857 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_DEFAULT_CACHE_SIZE); if (!fake) { /* diff --git a/board/xilinx/microblaze-generic/Kconfig b/board/xilinx/microblaze-generic/Kconfig index 89af8d714f..505a3d59cf 100644 --- a/board/xilinx/microblaze-generic/Kconfig +++ b/board/xilinx/microblaze-generic/Kconfig @@ -77,4 +77,12 @@ config XILINX_MICROBLAZE0_USE_WIC Enable this option if the MicroBlaze processor is configured with support for the "wic" (Write to Instruction Cache) instruction. +config XILINX_MICROBLAZE0_DEFAULT_CACHE_SIZE + int "Default instruction/data cache size" + default 32768 + help + This fallback size will be used when no cache info can be found in + the device tree, or when the caches are 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