From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB9E9C433EF for ; Mon, 4 Oct 2021 10:13:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 892136128A for ; Mon, 4 Oct 2021 10:13:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232377AbhJDKPJ (ORCPT ); Mon, 4 Oct 2021 06:15:09 -0400 Received: from esa.microchip.iphmx.com ([68.232.153.233]:37092 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231575AbhJDKPD (ORCPT ); Mon, 4 Oct 2021 06:15:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1633342395; x=1664878395; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=ZRiPgFOwdB5HQVEmuLOGDb/uc8iQaPWmGWovZpGxIpw=; b=NyyJH8tB3hnFpCVa11fnWchfaFrJmnieiIrEyRdOfIqK7CrZ5ElGBrG9 umylK/nsulPTA+b39/fuAlnheX7uygzDS0J5As1B4jGBm3EdxnxLJqDNu R/L9jHBojqwgcyF/6dWuxpbB4/DMwVdcBoej8GVcWJuryKZ4BPAcUfGsG yDLhIiNfyAFVabe202/n3SHJNJj8cI0A17ll8oyv5rc9tbpKxNcdDTH/p 0uQv+UWPP5W7NkoDd+CtQ88v89hff2XGaL6jzA/IRGnAM6N5UdBjrgmUI +qZDFsOryzXOoE5634MCITrrHVNEVJ7gKb0pUaSWphSc6vbwl/hiayJFW A==; IronPort-SDR: nWwVL5THIJKc1iCif3n1JInows5yrOx6wTAf/MURZXDOAnfjm5B/27ywqnscJV4999OXbUJbBq +QexuKMty7YcFi02ZL/pHd0VVwB4fdaMj7BZxf+DyVaE4tfmsNPISR6Z/ypOdLhSNa0bMQ+2Ld wsTcsMUdiaFo9L1wZ7wwDbtGkYt+3aMUvrgElmJjIBOZ/ZFmiGPltyXTk/JKXdD+lGtnzARDeS B6X+D3B97VPxoNw2EK6tIUL2+4MtDZtoDjtLCW6kxcZBPBkPUKGJHUU+kgET8pFhMLa73HV/lN 8kbOvaoHdIg0kgRsqbsYRe/s X-IronPort-AV: E=Sophos;i="5.85,345,1624345200"; d="scan'208";a="146651402" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Oct 2021 03:13:13 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 4 Oct 2021 03:13:13 -0700 Received: from [10.12.73.58] (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 4 Oct 2021 03:13:11 -0700 Subject: Re: [PATCH v2 3/3] ARM: at91: pm: preload base address of controllers in tlb To: Claudiu Beznea , , , , CC: , , References: <20210930154219.2214051-1-claudiu.beznea@microchip.com> <20210930154219.2214051-4-claudiu.beznea@microchip.com> From: Nicolas Ferre Organization: microchip Message-ID: Date: Mon, 4 Oct 2021 12:13:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210930154219.2214051-4-claudiu.beznea@microchip.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/09/2021 at 17:42, Claudiu Beznea wrote: > In suspend/resume procedure for AT91 architecture different controllers > (PMC, SHDWC, RAM, RAM PHY, SFRBU) are accessed to do the proper settings > for power saving. Commit f0bbf17958e8 ("ARM: at91: pm: add self-refresh > support for sama7g5") introduced the access to RAMC PHY controller for > SAMA7G5. The access to this controller is done after RAMC ports are > closed, thus any TLB walk necessary for RAMC PHY virtual address will > fail. In the development branch this was not encountered. However, on > current kernel the issue is reproducible. > > To solve the issue the previous mechanism of pre-loading the TLB with > the RAMC PHY virtual address has been used. However, only the addition > of this new pre-load breaks the functionality for ARMv5 based > devices (SAM9X60). This behavior has been encountered previously > while debugging this code and using the same mechanism for pre-loading > address for different controllers (e.g. pin controller, the assumption > being that other requested translations are replaced from TLB). > > To solve this new issue the TLB flush + the extension of pre-loading > the rest of controllers to TLB (e.g. PMC, RAMC) has been added. The > rest of the controllers should have been pre-loaded previously, anyway. > > Fixes: f0bbf17958e8 ("ARM: at91: pm: add self-refresh support for sama7g5") > Signed-off-by: Claudiu Beznea > --- > > Hi Nicolas, > > Please link this patch with the previous one in this series ("ARM: at91: > pm: group constants and addresses loading") with a Depends-on tag as this > will fail to apply if backported to older kernel versions. Done. For whole series: Acked-by: Nicolas Ferre Whole series added to at91-fixes. To be sent as a second fixes tag to arm-soc. Best regards, Nicolas > arch/arm/mach-at91/pm_suspend.S | 25 ++++++++++++++++++++++++- > 1 file changed, 24 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S > index 34f251fdb743..fdb4f63ecde4 100644 > --- a/arch/arm/mach-at91/pm_suspend.S > +++ b/arch/arm/mach-at91/pm_suspend.S > @@ -1014,6 +1014,10 @@ ENTRY(at91_pm_suspend_in_sram) > mov tmp1, #0 > mcr p15, 0, tmp1, c7, c10, 4 > > + /* Flush tlb. */ > + mov r4, #0 > + mcr p15, 0, r4, c8, c7, 0 > + > ldr tmp1, [r0, #PM_DATA_PMC_MCKR_OFFSET] > str tmp1, .mckr_offset > ldr tmp1, [r0, #PM_DATA_PMC_VERSION] > @@ -1023,23 +1027,42 @@ ENTRY(at91_pm_suspend_in_sram) > ldr tmp1, [r0, #PM_DATA_MODE] > str tmp1, .pm_mode > > + /* > + * ldrne below are here to preload their address in the TLB as access > + * to RAM may be limited while in self-refresh. > + */ > ldr tmp1, [r0, #PM_DATA_PMC] > str tmp1, .pmc_base > + cmp tmp1, #0 > + ldrne tmp2, [tmp1, #0] > + > ldr tmp1, [r0, #PM_DATA_RAMC0] > str tmp1, .sramc_base > + cmp tmp1, #0 > + ldrne tmp2, [tmp1, #0] > + > ldr tmp1, [r0, #PM_DATA_RAMC1] > str tmp1, .sramc1_base > + cmp tmp1, #0 > + ldrne tmp2, [tmp1, #0] > + > +#ifndef CONFIG_SOC_SAM_V4_V5 > + /* ldrne below are here to preload their address in the TLB */ > ldr tmp1, [r0, #PM_DATA_RAMC_PHY] > str tmp1, .sramc_phy_base > - /* Both ldrne below are here to preload their address in the TLB */ > + cmp tmp1, #0 > + ldrne tmp2, [tmp1, #0] > + > ldr tmp1, [r0, #PM_DATA_SHDWC] > str tmp1, .shdwc > cmp tmp1, #0 > ldrne tmp2, [tmp1, #0] > + > ldr tmp1, [r0, #PM_DATA_SFRBU] > str tmp1, .sfrbu > cmp tmp1, #0 > ldrne tmp2, [tmp1, #0x10] > +#endif > > /* Active the self-refresh mode */ > at91_sramc_self_refresh_ena > -- Nicolas Ferre From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFB97C433EF for ; Mon, 4 Oct 2021 10:15:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 92EBB613AC for ; Mon, 4 Oct 2021 10:15:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 92EBB613AC Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:CC:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WFv7cEq3/JISaZxenswLYoti9ah6nmaYtx4LXUdQy1g=; b=Gh94UinhwHcfBRFI1bII3mECeJ 5OaPZbuc1UgQSJYdGeV2U/R5o+pqs1zzkDAZtnSNsBV//4eDQKy+JjPGoA32K3VmZSm2/nFjSgApc 4zw+a9Fhw8n7NR9T2rmYexHtRMM2YPii8ZWMsCtGzyrlTIdtugFeYLUBnwexvzCub8m3ZwVxwPYy3 pzqHVFTWYuqE9IAJ36NtEqo7AXfDPUuciySXQZgtwatR+z1l47YeZtFyMCK64VxTgJVtSU7i594wm Y57NCu79fyzJRpe8wlKP77NZuSq36I+yikjBdFXFnYEUfWVOK0zj8Y+KsajnelcAck/ipT4CrOMuO +UdbarnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXKyc-005xWv-DM; Mon, 04 Oct 2021 10:13:42 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXKyB-005xLx-Bb for linux-arm-kernel@lists.infradead.org; Mon, 04 Oct 2021 10:13:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1633342395; x=1664878395; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=ZRiPgFOwdB5HQVEmuLOGDb/uc8iQaPWmGWovZpGxIpw=; b=NyyJH8tB3hnFpCVa11fnWchfaFrJmnieiIrEyRdOfIqK7CrZ5ElGBrG9 umylK/nsulPTA+b39/fuAlnheX7uygzDS0J5As1B4jGBm3EdxnxLJqDNu R/L9jHBojqwgcyF/6dWuxpbB4/DMwVdcBoej8GVcWJuryKZ4BPAcUfGsG yDLhIiNfyAFVabe202/n3SHJNJj8cI0A17ll8oyv5rc9tbpKxNcdDTH/p 0uQv+UWPP5W7NkoDd+CtQ88v89hff2XGaL6jzA/IRGnAM6N5UdBjrgmUI +qZDFsOryzXOoE5634MCITrrHVNEVJ7gKb0pUaSWphSc6vbwl/hiayJFW A==; IronPort-SDR: nWwVL5THIJKc1iCif3n1JInows5yrOx6wTAf/MURZXDOAnfjm5B/27ywqnscJV4999OXbUJbBq +QexuKMty7YcFi02ZL/pHd0VVwB4fdaMj7BZxf+DyVaE4tfmsNPISR6Z/ypOdLhSNa0bMQ+2Ld wsTcsMUdiaFo9L1wZ7wwDbtGkYt+3aMUvrgElmJjIBOZ/ZFmiGPltyXTk/JKXdD+lGtnzARDeS B6X+D3B97VPxoNw2EK6tIUL2+4MtDZtoDjtLCW6kxcZBPBkPUKGJHUU+kgET8pFhMLa73HV/lN 8kbOvaoHdIg0kgRsqbsYRe/s X-IronPort-AV: E=Sophos;i="5.85,345,1624345200"; d="scan'208";a="146651402" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Oct 2021 03:13:13 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 4 Oct 2021 03:13:13 -0700 Received: from [10.12.73.58] (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 4 Oct 2021 03:13:11 -0700 Subject: Re: [PATCH v2 3/3] ARM: at91: pm: preload base address of controllers in tlb To: Claudiu Beznea , , , , CC: , , References: <20210930154219.2214051-1-claudiu.beznea@microchip.com> <20210930154219.2214051-4-claudiu.beznea@microchip.com> From: Nicolas Ferre Organization: microchip Message-ID: Date: Mon, 4 Oct 2021 12:13:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210930154219.2214051-4-claudiu.beznea@microchip.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211004_031315_462591_62B2F8A2 X-CRM114-Status: GOOD ( 27.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 30/09/2021 at 17:42, Claudiu Beznea wrote: > In suspend/resume procedure for AT91 architecture different controllers > (PMC, SHDWC, RAM, RAM PHY, SFRBU) are accessed to do the proper settings > for power saving. Commit f0bbf17958e8 ("ARM: at91: pm: add self-refresh > support for sama7g5") introduced the access to RAMC PHY controller for > SAMA7G5. The access to this controller is done after RAMC ports are > closed, thus any TLB walk necessary for RAMC PHY virtual address will > fail. In the development branch this was not encountered. However, on > current kernel the issue is reproducible. > > To solve the issue the previous mechanism of pre-loading the TLB with > the RAMC PHY virtual address has been used. However, only the addition > of this new pre-load breaks the functionality for ARMv5 based > devices (SAM9X60). This behavior has been encountered previously > while debugging this code and using the same mechanism for pre-loading > address for different controllers (e.g. pin controller, the assumption > being that other requested translations are replaced from TLB). > > To solve this new issue the TLB flush + the extension of pre-loading > the rest of controllers to TLB (e.g. PMC, RAMC) has been added. The > rest of the controllers should have been pre-loaded previously, anyway. > > Fixes: f0bbf17958e8 ("ARM: at91: pm: add self-refresh support for sama7g5") > Signed-off-by: Claudiu Beznea > --- > > Hi Nicolas, > > Please link this patch with the previous one in this series ("ARM: at91: > pm: group constants and addresses loading") with a Depends-on tag as this > will fail to apply if backported to older kernel versions. Done. For whole series: Acked-by: Nicolas Ferre Whole series added to at91-fixes. To be sent as a second fixes tag to arm-soc. Best regards, Nicolas > arch/arm/mach-at91/pm_suspend.S | 25 ++++++++++++++++++++++++- > 1 file changed, 24 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S > index 34f251fdb743..fdb4f63ecde4 100644 > --- a/arch/arm/mach-at91/pm_suspend.S > +++ b/arch/arm/mach-at91/pm_suspend.S > @@ -1014,6 +1014,10 @@ ENTRY(at91_pm_suspend_in_sram) > mov tmp1, #0 > mcr p15, 0, tmp1, c7, c10, 4 > > + /* Flush tlb. */ > + mov r4, #0 > + mcr p15, 0, r4, c8, c7, 0 > + > ldr tmp1, [r0, #PM_DATA_PMC_MCKR_OFFSET] > str tmp1, .mckr_offset > ldr tmp1, [r0, #PM_DATA_PMC_VERSION] > @@ -1023,23 +1027,42 @@ ENTRY(at91_pm_suspend_in_sram) > ldr tmp1, [r0, #PM_DATA_MODE] > str tmp1, .pm_mode > > + /* > + * ldrne below are here to preload their address in the TLB as access > + * to RAM may be limited while in self-refresh. > + */ > ldr tmp1, [r0, #PM_DATA_PMC] > str tmp1, .pmc_base > + cmp tmp1, #0 > + ldrne tmp2, [tmp1, #0] > + > ldr tmp1, [r0, #PM_DATA_RAMC0] > str tmp1, .sramc_base > + cmp tmp1, #0 > + ldrne tmp2, [tmp1, #0] > + > ldr tmp1, [r0, #PM_DATA_RAMC1] > str tmp1, .sramc1_base > + cmp tmp1, #0 > + ldrne tmp2, [tmp1, #0] > + > +#ifndef CONFIG_SOC_SAM_V4_V5 > + /* ldrne below are here to preload their address in the TLB */ > ldr tmp1, [r0, #PM_DATA_RAMC_PHY] > str tmp1, .sramc_phy_base > - /* Both ldrne below are here to preload their address in the TLB */ > + cmp tmp1, #0 > + ldrne tmp2, [tmp1, #0] > + > ldr tmp1, [r0, #PM_DATA_SHDWC] > str tmp1, .shdwc > cmp tmp1, #0 > ldrne tmp2, [tmp1, #0] > + > ldr tmp1, [r0, #PM_DATA_SFRBU] > str tmp1, .sfrbu > cmp tmp1, #0 > ldrne tmp2, [tmp1, #0x10] > +#endif > > /* Active the self-refresh mode */ > at91_sramc_self_refresh_ena > -- Nicolas Ferre _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel