From patchwork Mon Feb 18 14:34:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 158616 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2563481jaa; Mon, 18 Feb 2019 06:34:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ6lnw0hqczII32K8rrXWpueVVfdqT1tMt6SF0Er5StOWWzsk581TNT5/j8xg4sMkoZZMNS X-Received: by 2002:a62:1382:: with SMTP id 2mr20533053pft.157.1550500465888; Mon, 18 Feb 2019 06:34:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550500465; cv=none; d=google.com; s=arc-20160816; b=JBpOFzJtZTmTLIMA6alPMtQqsPIN99jJl0A6sE0xSQV1c3P7gdGDPpFNnDTlUwiWS6 cVdX4RhJ2cwN5SP0d4QcmU6qib8ZZeUmlsncb2kRhxjWPRWhoeKo/jozkmFkRk3VFOXs nCFDfL1kE13iVDx9MURa/5sgVi2/Aw/Lj73klM0lWoEqKFDZR8EY5mUapIDql2hsNcxi Axr0V7cJ/oH2KoTsoIMMxTu0Y30mxzC1qd8+TtwQxEDABVq1bFN7feCR0llqoejq4kZa VHeKRgyX+40D/QPsoCBrEMruV+/vixEVJMLIsw1QlSl+65q6Wnm2TRUvnw/LlXW8sgPJ Rt5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=FJMgoWFRQbTdTclL4lnyqV3sb9oHnrp3+xGX6HY55ww=; b=QZ1F0ARND3B19kgT2DFZejOhTZWH3Ob/F1sm+r+OgUO8mXYaUbEE4pJKkV+ltBLS95 KZ5+vzgat7W4mR1OmuTezAx8GDQxy9ktKOog2oZF6WO3JGgS9YuXLoasWTF/0a4+BhNP Vfnyjl2ppU8pjUT+gQ9fWuYPXuEtmyDorBlwg7Dzucwq0YOYAm726MzVfaTnNNuDhCh1 W0LBz9QiueePLnmGrwDK2A7hCPejw0xTuxozfmXMzC5/6OSWfixUdw8HT7117eqv//tm QVDFjp99r5gs3t8gGssScGSDZBCSrQF3pXaXb/MXvT5+zJpNxKsEpV9IwTpY8ZJcbF8M 8SRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=VZgdnklj; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si12953854pgk.56.2019.02.18.06.34.25; Mon, 18 Feb 2019 06:34:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=VZgdnklj; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388339AbfBROeZ (ORCPT + 3 others); Mon, 18 Feb 2019 09:34:25 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:55922 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732776AbfBROeY (ORCPT ); Mon, 18 Feb 2019 09:34:24 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190218143422euoutp01d5768460badb8b16159d34b2aea166d7~Ee-S3iko91432914329euoutp01I; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190218143422euoutp01d5768460badb8b16159d34b2aea166d7~Ee-S3iko91432914329euoutp01I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1550500462; bh=FJMgoWFRQbTdTclL4lnyqV3sb9oHnrp3+xGX6HY55ww=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=VZgdnkljwnDodkc4NsIG4stxMJNuT+kz5vYuYffxa3KtEcVxhFOIX0YUX6TlYw5yt 4C6k7A8lyF/BDaN0VX2HoiNPD1XKtaWqinqAB4fknm4LUBDMwCvfK4odKPSxaG7ZE7 P+NVda5gOoWaA78LPj3MumyHZRZO9ir7zc0qfh+Q= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190218143422eucas1p12400f5e119ed6eb15547323721e806cc~Ee-Sc1_Xs2004220042eucas1p1M; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 8D.66.04806.D62CA6C5; Mon, 18 Feb 2019 14:34:21 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190218143421eucas1p2c2b7c9417006d71e20af936715eb0caa~Ee-RzzwOc3177231772eucas1p2X; Mon, 18 Feb 2019 14:34:21 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-22-5c6ac26d7d9b Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id A1.8B.04284.D62CA6C5; Mon, 18 Feb 2019 14:34:21 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PN400ECCLT2NV10@eusync1.samsung.com>; Mon, 18 Feb 2019 14:34:21 +0000 (GMT) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Joonyoung Shim , Krzysztof Kozlowski , Chanwoo Choi , Bartlomiej Zolnierkiewicz , Seung-Woo Kim Subject: [PATCH 1/4] ARM: exynos: Move Exynos542x CPU state reset to pm_prepare() Date: Mon, 18 Feb 2019 15:34:09 +0100 Message-id: <20190218143412.6865-2-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190218143412.6865-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprCIsWRmVeSWpSXmKPExsWy7djPc7q5h7JiDLa22FpsnLGe1eL6l+es Fi/uXWSxOH9+A7vFjPP7mCzWHrkLZE1+yebA7rFpVSebR9+WVYwenzfJBTBHcdmkpOZklqUW 6dslcGV8avvCVLCAq2LW2m7mBsarHF2MnBwSAiYSk6+9Yepi5OIQEljBKLG85z4bhPOZUeLQ +l5mmKquF/OYIRLLGCXONE+Eqmpgkjh9dS0TSBWbgKFE19suNhBbREBV4nPbAnaQImaBLiaJ tp3TWUESwgLBEr03vgEVcXCwABUt+1cOEuYVsJG4uqKJEWKbvMTqDQfANnMK2Eps793EAjJH QuAjq8Spx89YIIpcJDqbv0CdJyPR2XGQCaKomVGifcYsdginh1Fi65wdbBBV1hKHj18Eu4JZ gE9i0rbpzCBXSAjwSnS0CUGUeEjMaNgINlRIYAKjxIRfSkByASPDKkbx1NLi3PTUYuO81HK9 4sTc4tK8dL3k/NxNjMC4Ov3v+NcdjPv+JB1iFOBgVOLhXbA8K0aINbGsuDL3EKMEB7OSCO+p A0Ah3pTEyqrUovz4otKc1OJDjNIcLErivNUMD6KFBNITS1KzU1MLUotgskwcnFINjCmRDJKr xVSkwm6nHuzgn2y0osTEib3nv8f6mtcORzfvtl/GnvnkesEz96PTk/JVeQvv6V25cZQj+edG bxfDI9N+Bnxu46gX/VPl5vI4eX607bOod15P2N5k6gcvvH+l7PRR6c0lwS/li5QuL/Fc0JWU eY6Fab/+rPltCyJVt7HevNNT+GbbVSWW4oxEQy3mouJEAOA59yWnAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDJMWRmVeSWpSXmKPExsVy+t/xy7q5h7JiDFZfV7TYOGM9q8X1L89Z LV7cu8hicf78BnaLGef3MVmsPXIXyJr8ks2B3WPTqk42j74tqxg9Pm+SC2CO4rJJSc3JLEst 0rdL4Mr41PaFqWABV8Wstd3MDYxXOboYOTkkBEwkul7MY+5i5OIQEljCKPFo3jtGCKeJSeLB pFNsIFVsAoYSXW+7wGwRAVWJz20L2EGKmAV6mCTuf3rEApIQFgiW6L3xDaiIg4MFqGjZv3KQ MK+AjcTVFU2MENvkJVZvOMAMYnMK2Eps793EAlIuBFSzeln1BEaeBYwMqxhFUkuLc9Nziw31 ihNzi0vz0vWS83M3MQLDZNuxn5t3MF7aGHyIUYCDUYmHd8HyrBgh1sSy4srcQ4wSHMxKIryn DgCFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8543qIwSEkhPLEnNTk0tSC2CyTJxcEo1MHbOWZOy /8L3m0ZFTJmrzFcItD8R+BZp6S7DtfSOxWyjexsKGh1ePTee5Mefpngz/CB7vXAhW2Ghc3Nq jQ7vx916i+tk/jbuWVd1ea2MW/PRmzFVypuS32VNzVntW/TpxY3KJIGP76OYVTza5H6v/+Ka WbFh7ToHLVmfE69srZ8ESu3OvT0jTomlOCPRUIu5qDgRAOcu52kPAgAA X-CMS-MailID: 20190218143421eucas1p2c2b7c9417006d71e20af936715eb0caa CMS-TYPE: 201P X-CMS-RootMailID: 20190218143421eucas1p2c2b7c9417006d71e20af936715eb0caa References: <20190218143412.6865-1-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Reset the CPU state entry in sysram in pm_prepare() callback. That entry doesn't need to be reset for every suspended CPU, so make it symmetic with the code, which restores it in pm_resume() callback. Tested on Samsung Chromebook2 Pit (Exynos5420) and Pi (Exynos5800) boards. Signed-off-by: Marek Szyprowski --- arch/arm/mach-exynos/suspend.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.17.1 diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c index 0850505ac78b..c1e082ab2a1e 100644 --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c @@ -265,8 +265,6 @@ static int exynos5420_cpu_suspend(unsigned long arg) unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); - writel_relaxed(0x0, pm_state.sysram_base + EXYNOS5420_CPU_STATE); - if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM)) { mcpm_set_entry_vector(cpu, cluster, exynos_cpu_resume); mcpm_cpu_suspend(); @@ -341,6 +339,7 @@ static void exynos5420_pm_prepare(void) */ pm_state.cpu_state = readl_relaxed(pm_state.sysram_base + EXYNOS5420_CPU_STATE); + writel_relaxed(0x0, pm_state.sysram_base + EXYNOS5420_CPU_STATE); exynos_pm_enter_sleep_mode(); From patchwork Mon Feb 18 14:34:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 158617 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2563489jaa; Mon, 18 Feb 2019 06:34:26 -0800 (PST) X-Google-Smtp-Source: AHgI3IYHYjS+9BuS4n5jdEkVGzBiK26WOS0KbJ7qci/qYVDEKg4OlypI/gzp/EXIZZbXkHv7tU2z X-Received: by 2002:a17:902:7b85:: with SMTP id w5mr21084828pll.288.1550500466180; Mon, 18 Feb 2019 06:34:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550500466; cv=none; d=google.com; s=arc-20160816; b=CZm8EdbdSBkUTjqcAfR0mTlDIcikRQHCyN1TSGS1/h69pNWxK+K/lVWAiBqc79W2fY ywa1VgpDgfIhHgQfoGGOh6pC9/Khzea14qJmLVIhoZN0sgyHT+tXID9Pxjxg/47A7muy OLx8NVdrI2k9SDz8VoFHl+zpjQ9swX66AuP7gHU1Ls7ODEOY+b6HGSwGh+fVQ+M+JiQf +Ks7LJ6wBY9WhLO/Bex4ca2uEaFWWHrhf6zD5rXV3T3vqwvqWLmG7lJn+18K8g229Mns YLy7jDNiwyH2t7ZGqhaFhBls6APZW3EasQyUXWZQDcuCdriTZh48WAgam4FcnZK+70nD PEPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=16nUhBdGl6srAaOMhAlikxcXfndOVWu7JwCu15HxeQE=; b=krM9s/zQ64jfpYLM7LWAuUhGN2ZhaJ7uZP7wiVlyZeVPfQmI/RWzHBOENW+ihKnXDS 53R6iOcCa7J/Wk4cyEvPk3ltEkqLo2a+dzpW++/nlOcu9FTxG0M71sdctVSeXWD9SLwr GSAcKbL4JlnWp2Er7Ahs4S/1DlpigCbDPMUsh8lpl5/2jT20dgera4NZD4T3N7bxH/Ae 98xu8aEjSkIWLN/3jJAyH6ESXHXTLYnmBkwwNovDGCzmROxaXFgAAfQg+fjf/6Y15Brt ioxQErPFnrKEDLe9d+eavKTqxLwuaDHzzDgJx4F0IMha76xuzcGWSsS7/qwBYrPnX21s l4uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=a0MRjGIn; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si12953854pgk.56.2019.02.18.06.34.25; Mon, 18 Feb 2019 06:34:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=a0MRjGIn; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732776AbfBROeZ (ORCPT + 3 others); Mon, 18 Feb 2019 09:34:25 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:59692 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387866AbfBROeY (ORCPT ); Mon, 18 Feb 2019 09:34:24 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190218143423euoutp024b02ed6f7a041d3526cd4c3d124285a1~Ee-TbQOf91529115291euoutp02L; Mon, 18 Feb 2019 14:34:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190218143423euoutp024b02ed6f7a041d3526cd4c3d124285a1~Ee-TbQOf91529115291euoutp02L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1550500463; bh=16nUhBdGl6srAaOMhAlikxcXfndOVWu7JwCu15HxeQE=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=a0MRjGInCh6xMOpSoXy00dHlRwej3zRhOcocRCtcp0JSpeJNcdgiYaovgomX0Mc1+ NnrVIEZ9VVIXxUojxRUXx66izliKd8Fa7jiMgHA6T6UNDleRgWH5WdfgLJAqKJi4bS yfPy43QwJbdQ2ZYjWPxXr1eax8NfYLIowEgNNWYo= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190218143422eucas1p16ab9dd40ca9b491f8d4f35feca7480b9~Ee-TCelel2004220042eucas1p1O; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 81.A0.04294.E62CA6C5; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190218143422eucas1p1d1bb8b41255990eba819b60cb1b668f4~Ee-SaANVI2685426854eucas1p1n; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) X-AuditID: cbfec7f4-84fff700000010c6-ff-5c6ac26e37cf Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 81.13.04128.D62CA6C5; Mon, 18 Feb 2019 14:34:21 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PN400ECCLT2NV10@eusync1.samsung.com>; Mon, 18 Feb 2019 14:34:21 +0000 (GMT) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Joonyoung Shim , Krzysztof Kozlowski , Chanwoo Choi , Bartlomiej Zolnierkiewicz , Seung-Woo Kim Subject: [PATCH 2/4] ARM: exynos: Add Exynos SMC values for secure memory write Date: Mon, 18 Feb 2019 15:34:10 +0100 Message-id: <20190218143412.6865-3-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190218143412.6865-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKIsWRmVeSWpSXmKPExsWy7djP87p5h7JiDM68ULHYOGM9q8X1L89Z LV7cu8hicf78BnaLGef3MVmsPXIXyJr8ks2B3WPTqk42j74tqxg9Pm+SC2CO4rJJSc3JLEst 0rdL4MrYfWs6c8EdtoobP14wNjBeZO1i5OSQEDCR2HW0k6mLkYtDSGAFo8Sti82sEM5nRokp C16ywVRN63gKVbWMUWLlhWMsEE4Dk8Tpq2uZQKrYBAwlut52gXWICKhKfG5bwA5SxCzQxSTR tnM62EJhgUCJTds62UFsFqCiw5daGbsYOTh4BWwkvp/nhNgmL7F6wwFmEJtTwFZie+8msGUS Ah9ZJaY1gGwGKXKR+P/mBROELSNxeXI3VFEzo0T7jFnsEE4Po8TWOTugnrCWOHwc4m1mAT6J SdumM4NslhDglehoE4Io8ZD4uvYf1GsTGCXeNhxhBlILGBlWMYqnlhbnpqcWG+WllusVJ+YW l+al6yXn525iBEbW6X/Hv+xg3PUn6RCjAAejEg/vguVZMUKsiWXFlbmHGCU4mJVEeE8dAArx piRWVqUW5ccXleakFh9ilOZgURLnrWZ4EC0kkJ5YkpqdmlqQWgSTZeLglGpg7IiUcHheUyM9 5eps2a+Fkn+13vKKnFpq87wq/XfQUbn0A2Iv1V9Num13saL0Y6hWWMLCpjOap3x69ggd9zPl b7+yPid869K2Hdk3HwVLyujXqvU7nZLd7r+03tymWFwv/0C12Jvr5su69oiYfxTv9k2TSdrN dERFMrXFpzqKr2d+r+iRbdpKLMUZiYZazEXFiQBw/Sp5qAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNJMWRmVeSWpSXmKPExsVy+t/xy7q5h7JiDFZPtLLYOGM9q8X1L89Z LV7cu8hicf78BnaLGef3MVmsPXIXyJr8ks2B3WPTqk42j74tqxg9Pm+SC2CO4rJJSc3JLEst 0rdL4MrYfWs6c8EdtoobP14wNjBeZO1i5OSQEDCRmNbxlKmLkYtDSGAJo8TuC93sEE4Tk8SD SafYQKrYBAwlut52gdkiAqoSn9sWgBUxC/QwSdz/9Iili5GDQ1jAX+LU6SKQGhagmsOXWhlB wrwCNhLfz3NCLJOXWL3hADOIzSlgK7G9dxNYpxBQyepl1RMYeRYwMqxiFEktLc5Nzy020itO zC0uzUvXS87P3cQIDJJtx35u2cHY9S74EKMAB6MSD++C5VkxQqyJZcWVuYcYJTiYlUR4Tx0A CvGmJFZWpRblxxeV5qQWH2KU5mBREuc9b1AZJSSQnliSmp2aWpBaBJNl4uCUamDklU2Osrif E6C8PGBJ8JaunfeU482YvFTVtigvOp7cuV1HumKhn6ksw6Tv+pq8Ela72te5/OFufK6rtje+ ZnZ+3xwDq+MhKdeX8UZdmfNxb/NiVoX3Qd+PL76x7se34raZ8Uk/r53yvzajpLCj+vs1rqW/ xCcr1/ecco+bsN68le3+3Mknr89QYinOSDTUYi4qTgQAoQ1NBQ4CAAA= X-CMS-MailID: 20190218143422eucas1p1d1bb8b41255990eba819b60cb1b668f4 CMS-TYPE: 201P X-CMS-RootMailID: 20190218143422eucas1p1d1bb8b41255990eba819b60cb1b668f4 References: <20190218143412.6865-1-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Add defines for the (secure)-memory write for Exynos Secure Monitor Call. The values comes from the vendor kernel. Signed-off-by: Marek Szyprowski --- arch/arm/mach-exynos/smc.h | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.17.1 diff --git a/arch/arm/mach-exynos/smc.h b/arch/arm/mach-exynos/smc.h index f355185d4239..e523e9604ffc 100644 --- a/arch/arm/mach-exynos/smc.h +++ b/arch/arm/mach-exynos/smc.h @@ -25,6 +25,13 @@ #define SMC_CMD_L2X0INVALL (-24) #define SMC_CMD_L2X0DEBUG (-25) +/* For Accessing CP15/SFR (General) */ +#define SMC_CMD_REG (-101) + +/* defines for SMC_CMD_REG */ +#define SMC_REG_CLASS_SFR_W (0x1 << 30) +#define SMC_REG_ID_SFR_W(ADDR) (SMC_REG_CLASS_SFR_W | ((ADDR) >> 2)) + #ifndef __ASSEMBLY__ extern void exynos_smc(u32 cmd, u32 arg1, u32 arg2, u32 arg3); From patchwork Mon Feb 18 14:34:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 158619 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2563507jaa; Mon, 18 Feb 2019 06:34:26 -0800 (PST) X-Google-Smtp-Source: AHgI3IaUIMMG3+JaIuakzbeXV5XA1a94txrZvvSahq/dg2Z7Ef8BgDP79oLcoSrKC8uao3OV9o13 X-Received: by 2002:a17:902:1aa:: with SMTP id b39mr25961640plb.244.1550500466727; Mon, 18 Feb 2019 06:34:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550500466; cv=none; d=google.com; s=arc-20160816; b=hZJHeqCdHG30inwAmVD6eydrTQFZz7ZL7igcHDlmGtMxeh2YmbDPxJZlVMdH/4v80G MMPydbfwkAAGpnjo22ZCMA79yCbKd9ckul6LRGG/sARK9QrBtaoRzmcMRwXDw8OmuP2j fcYoMIezzSUpc0jCeu6PpfPOyp8AtPQtOs8J2z1P649ITcjE+fXplaeYvYJ6aCgweF6V fDewvDriWMjNgCCNvI0NvbdkG9stFgycQHQXnot3KUMgyHlwG1pl7n2WBA7U74I2TBbS TOpW8U3+tSZ4ek+KiAz/xciluse9ywMxX2uOCwbf9KWUKw79AB8OCIJqnbnzHbcCD9Zc +X5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=wkhhyryILl33+9zXODohNWvjDnEysktzCu1IqYw3Glg=; b=Fyb+OTm7BDMTHan98bGdGo6LzEBRpak9TzKAYa6pokxHpZGmW1c7TMuwkLY5EDRfKk 0mYMoCCGFZjmQp9NeEfwuLzy0PD9QVjzDCts49mmwAAvmiXudEQFg3IMGhfSocQH6glP 6TAVfLccGSiNfBWSCGnYZR6QlOn/bM520KLnNBPNToM/hTIpXQtcS5U9+CiJ4eqgY+cl HD5yHgQc98J8+cvi8O15s4tPfkZhMFKv1xYlLtQ9Osf3uc0ijNpMQZHD+WNy89y998wp M+pLwGvOpRlTu0YnUZUPB3sR9qzmVqsPiTCCxT3X1ezqDVvDU5Ydg1UF1OGN/ndpPpJK sqpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lZYA1iMU; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si12953854pgk.56.2019.02.18.06.34.26; Mon, 18 Feb 2019 06:34:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lZYA1iMU; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387403AbfBROeZ (ORCPT + 3 others); Mon, 18 Feb 2019 09:34:25 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:59697 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387891AbfBROeY (ORCPT ); Mon, 18 Feb 2019 09:34:24 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190218143423euoutp02d13cfd89758b25e7c9ba9b565af816f3~Ee-T0m6zF1529115291euoutp02M; Mon, 18 Feb 2019 14:34:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190218143423euoutp02d13cfd89758b25e7c9ba9b565af816f3~Ee-T0m6zF1529115291euoutp02M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1550500463; bh=wkhhyryILl33+9zXODohNWvjDnEysktzCu1IqYw3Glg=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=lZYA1iMU6uLn9u+vnSR1PatMNZnoRDsrMyjHaI2uFt/XdJwZi2F6NMwcAG1OJKwU6 DBy2aREMwafyKDy6Q99sgf4sJV7QHXN0SVULL5kFX4CB9VEnrHf7dz37HHPm328css 8e6Xviu2XrbCbta8wwqYaHSg5VCMrZkfWQeFJg8U= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190218143423eucas1p256c76cf2a547396bf0383d66f81cd91e~Ee-TOWMAy0529205292eucas1p23; Mon, 18 Feb 2019 14:34:23 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 02.A0.04294.E62CA6C5; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190218143422eucas1p124376d6ed4751c715e5f1fb207ca8bfd~Ee-SjScgf2899428994eucas1p1a; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) X-AuditID: cbfec7f4-84fff700000010c6-01-5c6ac26e9878 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 32.13.04128.E62CA6C5; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PN400ECCLT2NV10@eusync1.samsung.com>; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Joonyoung Shim , Krzysztof Kozlowski , Chanwoo Choi , Bartlomiej Zolnierkiewicz , Seung-Woo Kim Subject: [PATCH 3/4] ARM: exynos: Add CPU state management for Exynos542x under secure firmware Date: Mon, 18 Feb 2019 15:34:11 +0100 Message-id: <20190218143412.6865-4-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190218143412.6865-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprMIsWRmVeSWpSXmKPExsWy7djP87p5h7JiDH4tMbbYOGM9q8X1L89Z LV7cu8hicf78BnaLGef3MVmsPXIXyJr8ks2B3WPTqk42j74tqxg9Pm+SC2CO4rJJSc3JLEst 0rdL4Mr4PJG7YL5sxYb+dYwNjHskuhg5OSQETCTuzvjL3sXIxSEksIJRYu+PLmYI5zOjRP/T 98wwVRsOTWMHsYUEljFKHLqsBFHUwCTR1fGVDSTBJmAo0fW2C8wWEVCV+Ny2AGwss0AXk0Tb zumsIAlhgUSJb0fPgE1lASp6fr8DqIiDg1fARuL5/zSIZfISqzccACvhFLCV2N67iQVkjoTA R1aJ81+XMUIUuUj0T9oNZctIXJ7cDVXUzCjRPmMWO4TTwyixdc4ONogqa4nDxy+CXcEswCcx adt0ZpDNEgK8Eh1tQhAlHhKrj05jhXhtAqPEv01L2YHUAkaGVYziqaXFuempxUZ5qeV6xYm5 xaV56XrJ+bmbGIFRdfrf8S87GHf9STrEKMDBqMTDu2B5VowQa2JZcWXuIUYJDmYlEd5TB4BC vCmJlVWpRfnxRaU5qcWHGKU5WJTEeasZHkQLCaQnlqRmp6YWpBbBZJk4OKUaGIXPfbj286L7 ZCnxHyuv7RAsvM+gXj5hTh/Lh+jHHx+FTPi+cmZDWc/Zo6c3S3fxuzxhmmTPxvohq95w7eJv PtUP+IXs9hwL/G+7IiIi527r9od28wQr7ulK2j38KlfpuPWQ5Sv5rZZ8RfeNy125m9Rzjzyb 9SarYpnBvBnTruyNENv98rxRoLMSS3FGoqEWc1FxIgAWvvgKpgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNJMWRmVeSWpSXmKPExsVy+t/xy7p5h7JiDM68F7HYOGM9q8X1L89Z LV7cu8hicf78BnaLGef3MVmsPXIXyJr8ks2B3WPTqk42j74tqxg9Pm+SC2CO4rJJSc3JLEst 0rdL4Mr4PJG7YL5sxYb+dYwNjHskuhg5OSQETCQ2HJrG3sXIxSEksIRRomVWB5TTxCTx/vNr dpAqNgFDia63XWwgtoiAqsTntgVgRcwCPUwS9z89YgFJCAskShx98osVxGYBKnp+H2QSBwev gI3E8/9pENvkJVZvOMAMYnMK2Eps793EAlIiBFSyeln1BEaeBYwMqxhFUkuLc9Nzi430ihNz i0vz0vWS83M3MQKDZNuxn1t2MHa9Cz7EKMDBqMTDu2B5VowQa2JZcWXuIUYJDmYlEd5TB4BC vCmJlVWpRfnxRaU5qcWHGKU5WJTEec8bVEYJCaQnlqRmp6YWpBbBZJk4OKUaGKOWVpzY9pAz xjR085og2Vrec45Xf6ov37eyabXXli3tp4slJlbyq9w4VGzy5nXyOhahX0LHeBUO7Yw4+OXF W6c9t8TlYoLEjFlmyd235H2fXBvwt1GmtVgkVHZuh8faQgH/Up3pc/J2Joka3ng2W+mm+BGn 3bscFtxRurRpnWb78+vr1u3YdE6JpTgj0VCLuag4EQDD0nRkDgIAAA== X-CMS-MailID: 20190218143422eucas1p124376d6ed4751c715e5f1fb207ca8bfd CMS-TYPE: 201P X-CMS-RootMailID: 20190218143422eucas1p124376d6ed4751c715e5f1fb207ca8bfd References: <20190218143412.6865-1-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org From: Joonyoung Shim Add required CPU state management done via secure monitor call for Exynos542x running unsed Secure Firmware. Signed-off-by: Joonyoung Shim [mszyprow: rewrote code to use defines and sysram base address instead of the magic numbers, added second smc call in pm_resume, rephrased subject and commit message] Signed-off-by: Marek Szyprowski --- arch/arm/mach-exynos/common.h | 1 + arch/arm/mach-exynos/exynos.c | 3 +++ arch/arm/mach-exynos/suspend.c | 17 +++++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 1b8699e94098..c93356a8d662 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -91,6 +91,7 @@ extern u32 cp15_save_power; extern void __iomem *sysram_ns_base_addr; extern void __iomem *sysram_base_addr; +extern phys_addr_t sysram_base_phys; extern void __iomem *pmu_base_addr; void exynos_sysram_init(void); diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 865dcc4c3181..9aa483366ebc 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -33,6 +33,7 @@ static struct platform_device exynos_cpuidle = { }; void __iomem *sysram_base_addr __ro_after_init; +phys_addr_t sysram_base_phys __ro_after_init; void __iomem *sysram_ns_base_addr __ro_after_init; void __init exynos_sysram_init(void) @@ -43,6 +44,8 @@ void __init exynos_sysram_init(void) if (!of_device_is_available(node)) continue; sysram_base_addr = of_iomap(node, 0); + sysram_base_phys = of_translate_address(node, + of_get_address(node, 0, NULL, NULL)); break; } diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c index c1e082ab2a1e..3ac84f621d99 100644 --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c @@ -31,6 +31,7 @@ #include #include "common.h" +#include "smc.h" #define REG_TABLE_END (-1U) @@ -62,6 +63,8 @@ struct exynos_pm_state { int cpu_state; unsigned int pmu_spare3; void __iomem *sysram_base; + phys_addr_t sysram_phys; + bool secure_firmware; }; static const struct exynos_pm_data *pm_data __ro_after_init; @@ -340,6 +343,9 @@ static void exynos5420_pm_prepare(void) pm_state.cpu_state = readl_relaxed(pm_state.sysram_base + EXYNOS5420_CPU_STATE); writel_relaxed(0x0, pm_state.sysram_base + EXYNOS5420_CPU_STATE); + if (pm_state.secure_firmware) + exynos_smc(SMC_CMD_REG, SMC_REG_ID_SFR_W(pm_state.sysram_phys + + EXYNOS5420_CPU_STATE), 0, 0); exynos_pm_enter_sleep_mode(); @@ -459,6 +465,10 @@ static void exynos5420_pm_resume(void) /* Restore the sysram cpu state register */ writel_relaxed(pm_state.cpu_state, pm_state.sysram_base + EXYNOS5420_CPU_STATE); + if (pm_state.secure_firmware) + exynos_smc(SMC_CMD_REG, SMC_REG_ID_SFR_W(pm_state.sysram_phys + + EXYNOS5420_CPU_STATE), + EXYNOS_AFTR_MAGIC, 0); pmu_raw_writel(EXYNOS5420_USE_STANDBY_WFI_ALL, S5P_CENTRAL_SEQ_OPTION); @@ -658,8 +668,11 @@ void __init exynos_pm_init(void) * Applicable as of now only to Exynos542x. If booted under secure * firmware, the non-secure region of sysram should be used. */ - if (exynos_secure_firmware_available()) + if (exynos_secure_firmware_available()) { + pm_state.sysram_phys = sysram_base_phys; pm_state.sysram_base = sysram_ns_base_addr; - else + pm_state.secure_firmware = true; + } else { pm_state.sysram_base = sysram_base_addr; + } } From patchwork Mon Feb 18 14:34:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 158620 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2563513jaa; Mon, 18 Feb 2019 06:34:27 -0800 (PST) X-Google-Smtp-Source: AHgI3IbGG/rnrWZjTGcsjfz4g+YCoybNxYZ27ZSBjLT3E3RvIpveyoylsCj+OO2lVP2zpifpupOO X-Received: by 2002:a17:902:b904:: with SMTP id bf4mr11325237plb.273.1550500467029; Mon, 18 Feb 2019 06:34:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550500467; cv=none; d=google.com; s=arc-20160816; b=u43U0fIX+Jmd9EXrh00xN9PajrheEFBv7mUptyfYChtY7+8f6JKsyOGrecgkR7gEm/ BM9qsYwWqFxSe3gzzxAolqe3kQPe12i5/0WykIweNOuBnvxO9bC6wDwZMTK9TD73MzX0 K5pPHfM62E/qY7938Trbk7TTXnjtx6HLpPPvTmMmOP/SCXIlTs1s5KiCiV0CD+j0/aBy sL0vBNPB736VgSSq34UyRNfPn+hGjbavTXQ/MrOxDw39O3IrIe+X0Iy8uk3puF3RYe1m H1/ZfM4yjpwWUtB/OG2UW8XmnOjjp5tpswql7w25bsVG7YGK+ZmxJBFo7uYDF82RXO/9 V2yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=CtZaeO6HKavnUMNvWElW4sGJfjbpT1+04kXGfhTWtvQ=; b=vCKhI7wkWHsx17jdsT7/aau9WNj2AN5CUYRod4FyK7QZN/K4H+mpPvJhpjaVH/6jTZ 17GzTnrSx83Gp0O5O9IJH0cGnu+rmLGH9rb22RnexsTT8fRfT1FmqMYA/5pgTRhT+4Wc VeC0BskRVJ+UvijBmgfiytQJf56muoz2WlG+4V2LsjYIOC32oh8PkxJGkjYhmese8bzH lKNpnzdxd3jo4ntrbbH8omVCvpCy82jp5lFStm0u8wPFWXJ/QEpT4JVCs6J/dqeCU4+r AdgAutJ29I4211O9piULq6zeZU/Vg8is1yFhaZkfPcSzBz6jtDLlXHZ7t+uQn29WucGJ VBDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=VDhlyIOb; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si12953854pgk.56.2019.02.18.06.34.26; Mon, 18 Feb 2019 06:34:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=VDhlyIOb; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387891AbfBROeZ (ORCPT + 3 others); Mon, 18 Feb 2019 09:34:25 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:59701 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388197AbfBROeZ (ORCPT ); Mon, 18 Feb 2019 09:34:25 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190218143424euoutp021963fe83856fd9c25f3be71be7e84bff~Ee-UKA3CJ1530015300euoutp02M; Mon, 18 Feb 2019 14:34:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190218143424euoutp021963fe83856fd9c25f3be71be7e84bff~Ee-UKA3CJ1530015300euoutp02M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1550500464; bh=CtZaeO6HKavnUMNvWElW4sGJfjbpT1+04kXGfhTWtvQ=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=VDhlyIObbDpGIKlQYcsROIFdX5vlCrTCP+YZyZjwCCAG9wsmiuuF3J1DR3vHyiaeV eBbvz9ItnVO3ILcaToffx2fnhdJlaMLntdEI5in3SBbKIjm/8YXRs9nl433kHK8CZO /2zpLmun3BKum6+5k1UWgcgToC73FxCZIHC2AzHA= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190218143423eucas1p2cd3969c27f6244cd2612ec7493c2ef0d~Ee-Tkh3-z2788227882eucas1p2s; Mon, 18 Feb 2019 14:34:23 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id AE.66.04806.F62CA6C5; Mon, 18 Feb 2019 14:34:23 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190218143422eucas1p2992ce94ddab3db3de9534719e7e3d986~Ee-S7ENu83177231772eucas1p2a; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-28-5c6ac26fe55d Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 33.8B.04284.E62CA6C5; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PN400ECCLT2NV10@eusync1.samsung.com>; Mon, 18 Feb 2019 14:34:22 +0000 (GMT) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Joonyoung Shim , Krzysztof Kozlowski , Chanwoo Choi , Bartlomiej Zolnierkiewicz , Seung-Woo Kim Subject: [PATCH 4/4] ARM: exynos: Fix undefined instruction during Exynos5422 resume Date: Mon, 18 Feb 2019 15:34:12 +0100 Message-id: <20190218143412.6865-5-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190218143412.6865-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprCIsWRmVeSWpSXmKPExsWy7djPc7r5h7JiDM585rbYOGM9q8X1L89Z LV7cu8hicf78BnaLGef3MVmsPXIXyJr8ks2B3WPTqk42j74tqxg9Pm+SC2CO4rJJSc3JLEst 0rdL4MqYOO0nW8Ep2YpTp8QaGCdKdjFyckgImEisXv2NtYuRi0NIYAWjROOWZ4wQzmdGib+r rzPDVN0/MA2qahmjxJY3M6CqGpgkujq+soFUsQkYSnS97QKzRQRUJT63LWAHKWIW6GKSaNs5 nRUkISwQJnHl2zKwsSxARSt2vGABsXkFbCTWf77IBLFOXmL1hgNgNZwCthLbezexgAySEPjI KvF720VWiCIXiUnbFrFA2DISnR0HmSCKmhkl2mfMYodwehglts7ZwQZRZS1x+DhEN7MAH1D3 dKAVHEBxXomONiGIEg+JT2cfM4LYQgITGCUmHTMBkgsYGVYxiqeWFuempxYb56WW6xUn5haX 5qXrJefnbmIExtXpf8e/7mDc9yfpEKMAB6MSD++C5VkxQqyJZcWVuYcYJTiYlUR4Tx0ACvGm JFZWpRblxxeV5qQWH2KU5mBREuetZngQLSSQnliSmp2aWpBaBJNl4uCUamAMv9jI/lo+eI7c OyedqyKPVrxQnfZr9yHn/FM6cnJcHTzuR5ST3s3s7VTnPfuw91N915sXa/o0H/NNPJ8TM6/8 otPBY0+VJBl+X963qT3csUuYVU/rlvpzcz/N41kuz42XPWO4u59NsJZR+9/FeQuMHMQ2in3q mVZ3lWXTA3fz+/u8BFl9z+orsRRnJBpqMRcVJwIAZInF0acCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDJMWRmVeSWpSXmKPExsVy+t/xy7p5h7JiDOas1LXYOGM9q8X1L89Z LV7cu8hicf78BnaLGef3MVmsPXIXyJr8ks2B3WPTqk42j74tqxg9Pm+SC2CO4rJJSc3JLEst 0rdL4MqYOO0nW8Ep2YpTp8QaGCdKdjFyckgImEjcPzCNtYuRi0NIYAmjxPb7+6GcJiaJ959f s4NUsQkYSnS97WIDsUUEVCU+ty1gByliFuhhkrj/6RELSEJYIEyi9cIMZhCbBahoxY4XYHFe ARuJ9Z8vMkGsk5dYveEAWA2ngK3E9t5NQDUcQNtsJFYvq57AyLOAkWEVo0hqaXFuem6xoV5x Ym5xaV66XnJ+7iZGYJhsO/Zz8w7GSxuDDzEKcDAq8fAuWJ4VI8SaWFZcmXuIUYKDWUmE99QB oBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHe8waVUUIC6YklqdmpqQWpRTBZJg5OqQZGLn+XPl1T GZMrSidZjwi3F0ZMyb4hrfHwwq24xYyFq288tXT6KB8p2lxh8m7NZoXY/bOmZSz/c17nk0Ic g/X29ufqLL9Kp+3x+OtREmQZtqVQ+L/Cpp+78z7wJi4/W+WeMHHChJ/lkuu++Bx4z+lZ9q/m 2ooj3o8j7jXHMUVwX9pWOlXfYYuhEktxRqKhFnNRcSIAZ1ftvw8CAAA= X-CMS-MailID: 20190218143422eucas1p2992ce94ddab3db3de9534719e7e3d986 CMS-TYPE: 201P X-CMS-RootMailID: 20190218143422eucas1p2992ce94ddab3db3de9534719e7e3d986 References: <20190218143412.6865-1-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org During early system resume on Exynos5422 with performance counters enabled the following kernel oops happens: Internal error: Oops - undefined instruction: 0 [#1] PREEMPT SMP ARM Modules linked in: CPU: 0 PID: 1433 Comm: bash Tainted: G W 5.0.0-rc5-next-20190208-00023-gd5fb5a8a13e6-dirty #5480 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) PC is at reset_ctrl_regs+0x128/0x354 LR is at reset_ctrl_regs+0x124/0x354 pc : [] lr : [] psr: 600001d3 ... Flags: nZCv IRQs off FIQs off Mode SVC_32 ISA ARM Segment none Control: 10c5387d Table: 4451006a DAC: 00000051 Process bash (pid: 1433, stack limit = 0xb7e0e22f) ... [] (reset_ctrl_regs) from [] (dbg_cpu_pm_notify+0x1c/0x24) [] (dbg_cpu_pm_notify) from [] (notifier_call_chain+0x44/0x84) [] (notifier_call_chain) from [] (__atomic_notifier_call_chain+0x7c/0x128) [] (__atomic_notifier_call_chain) from [] (cpu_pm_notify+0x30/0x54) [] (cpu_pm_notify) from [] (syscore_resume+0x98/0x3f4) [] (syscore_resume) from [] (suspend_devices_and_enter+0x97c/0xe74) [] (suspend_devices_and_enter) from [] (pm_suspend+0x770/0xc04) [] (pm_suspend) from [] (state_store+0x6c/0xcc) [] (state_store) from [] (kobj_attr_store+0x14/0x20) [] (kobj_attr_store) from [] (sysfs_kf_write+0x4c/0x50) [] (sysfs_kf_write) from [] (kernfs_fop_write+0xfc/0x1e0) [] (kernfs_fop_write) from [] (__vfs_write+0x2c/0x160) [] (__vfs_write) from [] (vfs_write+0xa4/0x16c) [] (vfs_write) from [] (ksys_write+0x40/0x8c) [] (ksys_write) from [] (ret_fast_syscall+0x0/0x28) ... ---[ end trace 03fc9866185939bf ]--- Undefined instruction is triggered during CP14 reset, because bits: #16 (Secure privileged invasive debug disabled) and #17 (Secure privileged noninvasive debug disable) are set in DSCR. Those bits depend on SPNIDEN and SPIDEN lines, which are provided by Secure JTAG hardware block. That block in turn is powered from cluster 0 (big/Eagle), but the Exynos5422 boots on cluster 1 (LITTLE/KFC). To fix this issue it is enough to turn on the power on the cluster 0 for a while. This lets the Secure JTAG block to propagate the needed signals to LITTLE/KFC cores and change their DSCR. Signed-off-by: Marek Szyprowski --- arch/arm/mach-exynos/suspend.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.17.1 diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c index 3ac84f621d99..ef0c750f746c 100644 --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c @@ -449,8 +449,27 @@ static void exynos3250_pm_resume(void) static void exynos5420_prepare_pm_resume(void) { + unsigned int mpidr, cluster; + + mpidr = read_cpuid_mpidr(); + cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); + if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM)) WARN_ON(mcpm_cpu_powered_up()); + + if (IS_ENABLED(CONFIG_HW_PERF_EVENTS) && cluster != 0) { + /* + * When system is resumed on the LITTLE/KFC core (cluster 1), + * the DSCR is not properly updated until the power is turned + * on also for the cluster 0. Enable it for a while to + * propagate the SPNIDEN and SPIDEN signals from Secure JTAG + * block and avoid undefined instruction issue on CP14 reset. + */ + pmu_raw_writel(S5P_CORE_LOCAL_PWR_EN, + EXYNOS_COMMON_CONFIGURATION(0)); + pmu_raw_writel(0, + EXYNOS_COMMON_CONFIGURATION(0)); + } } static void exynos5420_pm_resume(void)