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 1A8CEC433EF for ; Mon, 11 Apr 2022 16:27:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6F88F83E55; Mon, 11 Apr 2022 18:27:07 +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="Zix/LQKp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C75EE83E45; Mon, 11 Apr 2022 18:26:54 +0200 (CEST) Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) (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 9011280508 for ; Mon, 11 Apr 2022 18:26:51 +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-x535.google.com with SMTP id d10so19194249edj.0 for ; Mon, 11 Apr 2022 09:26:51 -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=zQKWK82G/nzM29ZFnMet4VsZlSYVnCgluUS9Wd1W0RY=; b=Zix/LQKpPp4elJI8dZL44bIoiFZJmd+rvws3aRw8JhdqC6I4ZlltG1dGsviKDxRAS7 f4+25pjoRn3YPPnYnp3jkTn1TaD1EuY+hWp2iWZIfptihMswS11pUM9QDIg7mfC8yM/c ZFGqnxWTH7eqRsrqXyBsubP2Bof2G25U2cDU0pLGYvwF+emcbCV/SidhR9yM9ojgMnQS hMiLr/ECJsgdlQa2ApvCca1ucXv7hutG5FbieoBzUAL4hS40spsUbJJX19sL/5coyDfs pUAxQedB7ckx4G8YLf7HHoxMbSRBhEihElCNBLYdrSfs6OlZ9/Unnz2h7IP5uxiDKPcA zNIA== 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=zQKWK82G/nzM29ZFnMet4VsZlSYVnCgluUS9Wd1W0RY=; b=qgxVba9GEYUYc9Nk8SLvuNRB+940YuqmYQrxrwqWRIIORfnHcFABC6zDMznmHOvtWA b8aI9yQ/vcRAwJmZ5MoQDEyXs+cgY3tOwVFfNS0YEAHghJ5O334jnOMdqqTqdXgRbDGX 3CNUeBqGO4V+qjb1US9weSJwZoEh/d3zYq3NIWYhHuVHky0n0awmvHLgBa9HAsoXSSJv MXaO3OW961osueNgLPu6fGZbvikGUSw+SElDt/5PEX55il/LS+ATMIez4O6s7pqxAMwR Z9JGeTVAoQDDyb41US9kmM13qfXiAEkmgAq1yZcCHvn/JgXCXC0mRk+eSdepFQ4bcrBS j5aA== X-Gm-Message-State: AOAM531QC1WfUyDjzno2i9k4Y8efoscdQ/0pZz1zGt5tBhjQ9Pd75VkI aAWusuO00RVlsVx8qSE1n+T9fskwtvtyWQ== X-Google-Smtp-Source: ABdhPJxSVDTaa8Wvxu7ogV9XCFBTxPx/lYCzE7iE9RE+2/D2/PwHmTniCfAjfQhD0cX6lXW3kiPjLQ== X-Received: by 2002:a05:6402:3496:b0:419:82d5:f1d9 with SMTP id v22-20020a056402349600b0041982d5f1d9mr34096492edc.36.1649694411276; Mon, 11 Apr 2022 09:26:51 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Apr 2022 09:26:50 -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 03/10] microblaze: cache: improve dcache Kconfig options Date: Mon, 11 Apr 2022 19:26:27 +0300 Message-Id: <20220411162634.69647-3-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 Replace CONFIG_DCACHE with a Kconfig option more limited in scope - XILINX_MICROBLAZE0_USE_WDC. It should be enabled if the processor supports the "wdc" (Write to Data Cache) instruction. It will be used to guard "wdc" invocations in microblaze cache code. Also, drop all ifdefs around flush_cache() calls and only keep one CONFIG_IS_ENABLED() guard within flush_cache() itself. Signed-off-by: Ovidiu Panait --- arch/microblaze/Kconfig | 4 ---- arch/microblaze/cpu/cache.c | 15 ++++++++++----- arch/microblaze/lib/bootm.c | 2 -- board/xilinx/microblaze-generic/Kconfig | 7 +++++++ 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index d7d1b21970..5a2e91104f 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig @@ -25,10 +25,6 @@ config TARGET_MICROBLAZE_GENERIC endchoice -config DCACHE - bool "Enable dcache support" - default y - config ICACHE bool "Enable icache support" default y diff --git a/arch/microblaze/cpu/cache.c b/arch/microblaze/cpu/cache.c index b6126de194..4e8e228a22 100644 --- a/arch/microblaze/cpu/cache.c +++ b/arch/microblaze/cpu/cache.c @@ -49,26 +49,31 @@ void dcache_enable(void) void dcache_disable(void) { -#ifdef CONFIG_DCACHE flush_cache(0, XILINX_DCACHE_BYTE_SIZE); -#endif + MSRCLR(0x80); } void flush_cache(ulong addr, ulong size) { int i; - for (i = 0; i < size; i += 4) + for (i = 0; i < size; i += 4) { asm volatile ( #ifdef CONFIG_ICACHE "wic %0, r0;" #endif "nop;" -#ifdef CONFIG_DCACHE + : + : "r" (addr + i) + : "memory"); + + if (CONFIG_IS_ENABLED(XILINX_MICROBLAZE0_USE_WDC)) { + asm volatile ( "wdc.flush %0, r0;" -#endif "nop;" : : "r" (addr + i) : "memory"); + } + } } diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c index b652d2767a..dba6226ce5 100644 --- a/arch/microblaze/lib/bootm.c +++ b/arch/microblaze/lib/bootm.c @@ -57,9 +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"); -#ifdef CONFIG_DCACHE flush_cache(0, XILINX_DCACHE_BYTE_SIZE); -#endif if (!fake) { /* diff --git a/board/xilinx/microblaze-generic/Kconfig b/board/xilinx/microblaze-generic/Kconfig index 117b476f3f..0d756ac7ba 100644 --- a/board/xilinx/microblaze-generic/Kconfig +++ b/board/xilinx/microblaze-generic/Kconfig @@ -63,4 +63,11 @@ config XILINX_MICROBLAZE0_VECTOR_BASE_ADDR Memory address location of the exception vector table. It is configurable via the C_BASE_VECTORS hdl parameter. +config XILINX_MICROBLAZE0_USE_WDC + bool "MicroBlaze wdc instruction support" + default y + help + Enable this option if the MicroBlaze processor is configured with + support for the "wdc" (Write to Data Cache) instruction. + endif -- 2.25.1