From patchwork Thu Feb 28 14:59:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 10833275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 394A015AC for ; Thu, 28 Feb 2019 15:00:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 275532EDAD for ; Thu, 28 Feb 2019 15:00:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 184A52EE44; Thu, 28 Feb 2019 15:00:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A0A7E2EDAD for ; Thu, 28 Feb 2019 15:00:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ZDa0ZPAbJ+wg4WBxxLjSfPQlpQoOEGem36d0G8jrbrc=; b=PTvu1AI7pGYJ2z h/c5Z9WaYGcO3MVtCMfk9zEt6joFdPE2yGwZzEs4QMbIsCv4JLnO4LvtVBNJ+BQGTmwJzxgwm7Okh 2IPJb4VyZAo9PTn8qrQv1G3SEaEHSbKEcQNV1+Z3S+BOb5O4D92McHkUJAwDg5kKMSffI6FVWWQQT RmLTHazbrZOx/0PzWLvfC33/kfcUUDifEWdInjqlhYLDEFax2cbSg9JMaHEIzPYh6JA8OV/M/+Hmd pIAUqSvzxOBG6piBj90uNeieNic9DqlR4N8azrOaG1edDhQC0h/0koVt5hrQfZ7oDa2VjNf3s22wS C658UKn72W0PTN164HaA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzNAG-0003oQ-1o; Thu, 28 Feb 2019 15:00:00 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzNAB-0003d3-T2 for linux-arm-kernel@lists.infradead.org; Thu, 28 Feb 2019 14:59:58 +0000 Received: by mail-lj1-x242.google.com with SMTP id l5so17429338lje.1 for ; Thu, 28 Feb 2019 06:59:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BldZyq/PlnyG/d2J4f3pJeyBfmYa3p3MVFqeW8B07Qc=; b=MFeXzTR+ujNEnERQuY7TbmdtyfDbVXy8eCHrEDKw3QW/8HfZD3Op/zV1fuFJp54vtj U1R/RA9h5lWksOhuATMswJqAkVMI49SxpzC0kEII/1XOAnDsp0MiC9VToLUTpR0ssr8j o2D3txScVIDS2sNtJCjJ6mFaNVS9NsEo4jmuf5J+Trj1HIRqMcW1NENgUrpTWW5lu+EX 2tAgWLI+gLMg2Bf23rOnfDmix8ZRUZfqDDx1xwFmZnhvyXdtCjHSgNbnLhncKKmERTLf YyjswO7+7GKPyHTmHPPxjNDbZjGGCyCUDppQjVuh00R23h0IebZACwa0CvvkNA0GcuGB as8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BldZyq/PlnyG/d2J4f3pJeyBfmYa3p3MVFqeW8B07Qc=; b=VUTIcsQl4EWPzLTc0iZ8iNs7lSFSQwxTsF3yFHNwv/P4KWkiXjttyPuW1QpbxMgQHg oSujlV6tB/iToUNOBg4f92hAyXgDx6PQWWt1qc9/iv8olrIoFuo2Qkx8H9A+UjoV5GRd PHJjsMQWCMsENWL1EHvj9y7ZBmJzX4nPbSlcAkmQ0r3LtlnXKaiBLxQXRbbjKSVaODps +F/6h4fpeaJ2DMiZGmHVVrwuXM8gpAvWOjbXEDPQlgLW8I6Ie2iEX7iUfX9fUIf/XRT5 syqtMx4TCLI4Hp8KpUNtz1Mjcle+tKQ7U0NatSxsyZED7qvhl5IZPcYMfcSx5Ger5Gt6 +n1Q== X-Gm-Message-State: AHQUAuYI0mhjXrh/mQ0O46cIW6veOdyxrk86tf38dxQDVn4qM693+LB/ 8E9GsiNq5hDrdkyp7+V1CMY= X-Google-Smtp-Source: AHgI3IbJqUcKt94Yq28mpsgwIad6vXg+nMx3kyhMCXxpZ1T49YgeBBDXPZK6voWO9IyEeEn+jFNJmA== X-Received: by 2002:a2e:408:: with SMTP id 8mr5044706lje.15.1551365993678; Thu, 28 Feb 2019 06:59:53 -0800 (PST) Received: from localhost.localdomain (ppp91-79-175-49.pppoe.mtu-net.ru. [91.79.175.49]) by smtp.gmail.com with ESMTPSA id z20sm4728309lff.87.2019.02.28.06.59.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 06:59:52 -0800 (PST) From: Dmitry Osipenko To: Russell King , Thierry Reding , Jonathan Hunter , Robert Yang , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH v8 0/7] Support Trusted Foundations firmware on Tegra30 Date: Thu, 28 Feb 2019 17:59:30 +0300 Message-Id: <20190228145937.27725-1-digetx@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_065956_134007_8C9D4170 X-CRM114-Status: GOOD ( 16.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hello, This patchset adds support for the Trusted Foundations firmware on NVIDIA Tegra30. Pretty much all of Tegra30 consumer devices have that firmware and upstream kernel can't boot on those devices without the firmware support. This series was tested on Nexus 7, TF300T and Ouya Tegra30 devices. Changelog: v8: - Replaced BIT() macro with a definition provided by cache-l2x0.h in the "Support L2 cache maintenance" patch as was suggested by Russell King in the review comment to v7. v7: - Fixed kernel booting with CONFIG_TRUSTED_FOUNDATIONS=n by providing a dummy L2C write_sec implementation in the "Support L2 cache maintenance" patch. - Minor clean up: no static variables anymore, replaced white spaces with a tab in one place, etc. - Added Michał's and Robert's Tested-by/Signed-off-by to the patches. v6: - One patch got messed up accidentally in v5, this is fixed now. - Squashed "Support L2 cache maintenance done via firmware" patch into the "Add firmware calls..." patch. - The l2x0_init() firmware callback is now invoked unconditionally because it is always a NO-OP on T114+ and is a NO-OP on T20/30 if firmware node is missed in device-tree, hence there is no need to check the machine's DT compatible as it was done in the previous versions of the series. v5: - Fixed machine hanging on disabling D-cache during suspend, turned out there are slight variations in behaviour between firmware version in regards to cache-management. Thanks to Robert Yang for reporting the problem and helping with the solution. v4: - Fixed Thumb2-kernel hanging on Tegra20, turned out it was not a good idea to switch CPU into Thumb2 mode right after jumping into the reset handler. - Moved LP2-mode-set firmware call invocation to a later stage to better replicate what downstream kernel does. This change was suggested by Robert Yang and fixes system hang on Ouya game console. - Added references to the original work made by Michał Mirosław into commit messages of the relevant patches. v3: - Implemented suspend-resume support. - Reworked arm/firmware/trusted_foundations.c a tad. Now cache is getting properly initialized, cache enabling / disabling is supported. v2: - The "Don't apply CPU erratas in insecure mode" patch got some cleanup, in particular resolved the messiness in __tegra_cpu_reset_handler_data. - Added a comment to tf_cache_write_sec(), justifying the warning message. Dmitry Osipenko (7): ARM: trusted_foundations: Support L2 cache maintenance ARM: trusted_foundations: Make prepare_idle call to take mode argument ARM: trusted_foundations: Provide information about whether firmware is registered ARM: tegra: Set up L2 cache using Trusted Foundations firmware ARM: tegra: Don't apply CPU erratas in insecure mode ARM: tegra: Always boot CPU in ARM-mode ARM: tegra: Add firmware calls required for suspend-resume on Tegra30 arch/arm/firmware/trusted_foundations.c | 75 +++++++++++++++++++++- arch/arm/include/asm/firmware.h | 2 +- arch/arm/include/asm/trusted_foundations.h | 25 ++++++++ arch/arm/mach-tegra/cpuidle-tegra114.c | 3 +- arch/arm/mach-tegra/pm.c | 49 ++++++++++++++ arch/arm/mach-tegra/reset-handler.S | 50 +++++++++++---- arch/arm/mach-tegra/reset.c | 3 + arch/arm/mach-tegra/reset.h | 9 ++- arch/arm/mach-tegra/sleep-tegra20.S | 4 ++ arch/arm/mach-tegra/sleep.S | 14 ++-- arch/arm/mach-tegra/tegra.c | 2 + 11 files changed, 214 insertions(+), 22 deletions(-)