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 1F71EC433F5 for ; Fri, 22 Apr 2022 12:47:23 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1E8A983C24; Fri, 22 Apr 2022 14:47:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="gTg41Xtv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2B50583D39; Fri, 22 Apr 2022 14:47:19 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on20608.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe59::608]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5430B839DF for ; Fri, 22 Apr 2022 14:47:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michals@xilinx.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FsrW6tWymd3o0sxUB5lbm/l+libGL0PBnQ5sf2574cPTdBlGW67nhWn2k3TkWLITZsbfdIzsH24F+LF4jqJ2tH6BZA7VbFOPqGV7N8CepM3I5pT2vn5iZvycIJ/4ttCFjHzfwBlMuHNkXQpvIG9siBgC4QdaF0MVkCOfeFDKzrVqF3xOqoGJS0aHkFPD36yHW8PoJsPsyKZKanFj7uh2AD0n1k8a1YaO+CczoLEC1TKxRLvwSsNMUv5ASEUDnsD4swwKB+RHE+sIWZ/gLgW8Sc8dxLe4ILJNqzJUfY6k/HfwgcBz7TBdB90b9bI9FHBUULNl9PKqHHnq6AEovj8u0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=K73t9P3awpuvvAMRLzKym2/iewQMK69Nv4r7QqESomw=; b=DzZknFEBLu48hux6jIUUtM/dCZemWP0uNpyUGUKl0EW/Vls9rDHbOiEwY5//BbfcHyMuOdpdn8oOGYwrwvV6IG96Fx6y7AfSx8WQu6nSL1TtP5AmifTMP+BY0kSNjdYrJdLD13sK+8s7VHK+JgdQoUrBUT7vQ/Giiy3yqaylQp7Ry1xFBEuHIvdQ9umSwZxfagCn5WVz1/m43oYi9YXWB1hp1I06PXSdv9N59/+fxBujK/quIPJ+V5npQHGYfvRPg4Mtu0TfSKbhupPK9G0J2E73T5UtNJ6dVSlKmpzhtTEK6Y3YaYoIYy847hvKAObSM2ucTFZpCWGDtsfT8y8emQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=gmail.com smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K73t9P3awpuvvAMRLzKym2/iewQMK69Nv4r7QqESomw=; b=gTg41Xtvq+8Mdkgia2vRmUPHenLGbcvFeTzKW/hPHDZ8qKBdbdnr9gmGbV5U6To5ZgUOfrgJ0rHd1QIz2xh+x4Qw/N1wP+TdqBG2f+aFN97HcC9P1+BDeXqplMiNXS7f4nTJMvL/maIF5PV9aVbPfwbfNR164TsBVRIc29fDtmU= Received: from DS7P222CA0027.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::35) by PH0PR02MB7397.namprd02.prod.outlook.com (2603:10b6:510:1d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.15; Fri, 22 Apr 2022 12:47:08 +0000 Received: from DM3NAM02FT034.eop-nam02.prod.protection.outlook.com (2603:10b6:8:2e:cafe::44) by DS7P222CA0027.outlook.office365.com (2603:10b6:8:2e::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14 via Frontend Transport; Fri, 22 Apr 2022 12:47:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT034.mail.protection.outlook.com (10.13.4.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5186.14 via Frontend Transport; Fri, 22 Apr 2022 12:47:08 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Fri, 22 Apr 2022 05:47:07 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 22 Apr 2022 05:47:07 -0700 Envelope-to: ovpanait@gmail.com, u-boot@lists.denx.de, mr.nuke.me@gmail.com, marex@denx.de, monstr@monstr.eu, sjg@chromium.org Received: from [10.254.241.50] (port=37130) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nhsgl-000FSL-2l; Fri, 22 Apr 2022 05:47:07 -0700 Message-ID: Date: Fri, 22 Apr 2022 14:47:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH 03/10] microblaze: cache: improve dcache Kconfig options Content-Language: en-US To: Ovidiu Panait , CC: Alexandru Gagniuc , Marek Vasut , Michal Simek , Michal Simek , Simon Glass References: <20220411162634.69647-1-ovpanait@gmail.com> <20220411162634.69647-3-ovpanait@gmail.com> From: Michal Simek In-Reply-To: <20220411162634.69647-3-ovpanait@gmail.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3e49f5ab-7913-44c0-976b-08da245e364b X-MS-TrafficTypeDiagnostic: PH0PR02MB7397:EE_ X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HYDlvAPGLvY9TNsNqNiOS6G7xtBs9gjr3aDg/7lcgRNODXaQ1z4cvNtYbTuN53W6yo3EA0wZsbivyyV0zM8EyPA+LkZAfxc/l7KUYBEOjOe2wk8WwGUU2CdDgl/bYlT6L49R7ATCTyvxNBBqjYuortxLJW+hZv32XyZUQXPkfUyc4T9MD4bcISR2ShoxMFF3LeocBC/PkyucJRTZVY69jSMBY3RzH3ew86BHibi8qURFxzaxFbp2INyQuTQkAgukp+TL7hwyZT7+IXmgAMgZgnJZxMSWNKPP1O960yRIht1yWoWAD/Hu8CDSbJT7BHTWSoiMvx0XQw/sjTNBRE0XWliW0tqrwGa5oi23xP7SVFkaSGxsRUbDRsjoYdYbjJAUgnRPSwmiz3UGqk5DzIWdz3lm0xtCvFcTU7skhcyVL/lOdtmyrooc9Urw8omVQgnCaPofSwnYG8FncZBH/8oB61vlcEnLE9EAFSOmVarrKBXbTVA5HZeTSQNLnwJyCcDG3LMcggcjVXGG3ZLGXVo8ImxXNjD9PwHuJACOVqF+0nWoUrk0DH6jalAru/D7Az1LJIFASVubU41wVpbLmwHoaJPTius9ChgP8/McXEaDeGN43cYzNHpu9zaWNysrGMW5LrkbYA6EhzLdUTokht+OIr0cGO75c+n+CV40jueCkCWh81mycY3OFA0YprY/Ix0856TNz3Fm+DjmIT+Ne10ZSKSb1duLgm5apsDhTwTOeY8= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(53546011)(40460700003)(4326008)(31686004)(47076005)(5660300002)(82310400005)(8676002)(36860700001)(508600001)(70206006)(70586007)(36756003)(9786002)(186003)(336012)(6666004)(26005)(31696002)(426003)(2906002)(8936002)(44832011)(356005)(110136005)(316002)(83380400001)(2616005)(7636003)(54906003)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2022 12:47:08.1858 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e49f5ab-7913-44c0-976b-08da245e364b X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT034.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7397 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 On 4/11/22 18:26, Ovidiu Panait wrote: > 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)) { Based on buildman your patch is removing cache handling from SPL. Here is what I see that there are missing 2 instructions. And 4/10 you see that 8 instructions are missing. 06: microblaze: cache: improve dcache Kconfig options microblaze: (for 1/1 boards) spl/u-boot-spl:all -8.0 spl/u-boot-spl:text -8.0 microblaze-generic: spl/u-boot-spl:all -8 spl/u-boot-spl:text -8 spl-u-boot-spl: add: 0/0, grow: 0/-1 bytes: 0/-8 (-8) function old new delta flush_cache 48 40 -8 07: microblaze: cache: improve icache Kconfig options microblaze: (for 1/1 boards) spl/u-boot-spl:all -32.0 spl/u-boot-spl:text -32.0 microblaze-generic: spl/u-boot-spl:all -32 spl/u-boot-spl:text -32 spl-u-boot-spl: add: 0/0, grow: 0/-1 bytes: 0/-32 (-32) function This is going to macro explanation where it is clear that you don't define CONFIG_SPL_FOO you only define CONFIG_FOO. 104 * CONFIG_IS_ENABLED(FOO) expands to 105 * 1 if USE_HOSTCC is defined and CONFIG_TOOLS_FOO is set to 'y', 106 * 1 if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'y', 107 * 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y', 108 * 1 if CONFIG_TPL_BUILD is defined and CONFIG_TPL_FOO is set to 'y', 109 * 0 otherwise. It means you should use different macro or create one more with SPL. Thanks, Michal