From patchwork Thu Feb 28 13:17:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 10833023 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 C93FC17E9 for ; Thu, 28 Feb 2019 13:19:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9201285B7 for ; Thu, 28 Feb 2019 13:19:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC75D289DA; Thu, 28 Feb 2019 13:19:29 +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 4BBBE297AD for ; Thu, 28 Feb 2019 13:19:29 +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:References:In-Reply-To: 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: List-Owner; bh=/V9WNRstVYF0ELkGxWvidJ8I6n+EgIkqe5lIHbSyQF4=; b=cPZ5p3CwOhDf+x y6a6tHQs4DAVFVh9TAtMvlevgKool8wLbTWMAoM9pcZwYhKGRa25pzyxj2/xiQQtSA3VEsADrGN1i sWsTTi8TOdcT2LkJqvjDDJnlIw4VsU1jjBzf/psvn9NcTxOzTcnlTL2iam51K/yGDIJjgLY5o2oZg kHg5wJ4n9xcLWe6+qsNnNFAjBSoVmx9pwhe57SrYZYPLh2YciR2gcuMioSP69BskNlkWeh/vPwycC P8ki9AATiBSr6PWJUoYr3nC3D7Z6vKbPqtRkrOBAk4L00GyQGqLvrqqgkSNYNyH9jN7Fi7kAFQe1I dfyWYBH6epnYS25FJHAw==; 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 1gzLat-0004u7-GR; Thu, 28 Feb 2019 13:19:23 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzLaK-0004Cn-7D for linux-arm-kernel@lists.infradead.org; Thu, 28 Feb 2019 13:18:49 +0000 Received: by mail-lj1-x241.google.com with SMTP id v16so17061961ljg.13 for ; Thu, 28 Feb 2019 05:18:47 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=yzyGiH2ChxicEKeWJXu+4hX+Dt5ldMGxbVc+PSHIupg=; b=sUacrCWmjU36pzRjjOS+WdWQ/SMvUZicfXQYfM/jFcOyzfgkBPZEj73RFRJmkPo1s/ OCfBAjmqDfy5PNnp4Z25p3WxJ9G7wKo7LIo48cqtDJH/AXwrQKqV9X2ChlO84dBG0K3n IwWt4b/FQhjyj8VSeCQ9pOg1ebOkRzm1Cl4aOWC7j/FKU6MHBtLhWs71QrwEZ9cxORAL BgD1mUOtFxaOkwF/3AkP+CYQzrr4hnq5LDhTqEhdTgesDqgwZar/WBev3CT/7BFvFXs9 ZR2vmoyM3EAZJ+9Nx1W8QrzY/7ZXWaLvZoXJHxYvk9YUfwegf5EnHGfl8KWgmePFJILz tB2g== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=yzyGiH2ChxicEKeWJXu+4hX+Dt5ldMGxbVc+PSHIupg=; b=ihgwTHQQy/uv0xfDOAMlI+xSoKoAfZaB9yjI0NWpiu5kkft+JjK7f6o8E8ZWWNtEgN RZUGjMOGRoVAYvpD7VYtJjbwDvHuHVNW5znvOoac6Cd7tj9xscDSiDH5oyTmfJYo1HCz anHYBw1K4V4MsY6AZVjhffo2G9FfG0OFiCVPyJYJiHq2fRPYv6J1IsJ029dXvtyylBZq 48Bz2x8TTGqNAVilsu9lok2FG+xQwWzeAHxHemRelbQK0guHx8dtPKhoDaW8aloN5sy1 jUy5/+OEWXSff0+Er3Bwwhy+5fajmhRNdfCV+g9Hz04PUI9E12usVDAz79iuA4ZY48xJ 4AMA== X-Gm-Message-State: APjAAAU8d8PAVTknMhqM3DHrH1LJQvGylxaQT76qyD8gwhTm7hVfiQ5B 2LibhN4lFubeScgOhOuhjbU= X-Google-Smtp-Source: APXvYqwrTxg3+L7S9QiiZbXHVlSkQQXj43Tt3vbHcR2Sq1AU3S3efmdNsEy8sF6xOnF20wLI+60klA== X-Received: by 2002:a2e:709:: with SMTP id 9mr4738701ljh.4.1551359926226; Thu, 28 Feb 2019 05:18:46 -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 l26sm4600069lfc.37.2019.02.28.05.18.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 05:18:45 -0800 (PST) From: Dmitry Osipenko To: Russell King , Thierry Reding , Jonathan Hunter , Robert Yang , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH v7 3/7] ARM: trusted_foundations: Provide information about whether firmware is registered Date: Thu, 28 Feb 2019 16:17:03 +0300 Message-Id: <20190228131707.2592-4-digetx@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228131707.2592-1-digetx@gmail.com> References: <20190228131707.2592-1-digetx@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_051848_256754_2BFFC06B X-CRM114-Status: GOOD ( 12.71 ) 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 Add a helper that provides information about whether Trusted Foundations firmware operations have been registered. Tested-by: Robert Yang Tested-by: Michał Mirosław Signed-off-by: Dmitry Osipenko --- arch/arm/firmware/trusted_foundations.c | 5 +++++ arch/arm/include/asm/trusted_foundations.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/arch/arm/firmware/trusted_foundations.c b/arch/arm/firmware/trusted_foundations.c index 188b9a33f72b..ca2e31aa1a17 100644 --- a/arch/arm/firmware/trusted_foundations.c +++ b/arch/arm/firmware/trusted_foundations.c @@ -167,3 +167,8 @@ void of_register_trusted_foundations(void) panic("Trusted Foundation: missing version-minor property\n"); register_trusted_foundations(&pdata); } + +bool trusted_foundations_registered(void) +{ + return firmware_ops == &trusted_foundations_ops; +} diff --git a/arch/arm/include/asm/trusted_foundations.h b/arch/arm/include/asm/trusted_foundations.h index 650cca7435f4..ff6e4cb4ca9d 100644 --- a/arch/arm/include/asm/trusted_foundations.h +++ b/arch/arm/include/asm/trusted_foundations.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -50,6 +51,7 @@ struct trusted_foundations_platform_data { void register_trusted_foundations(struct trusted_foundations_platform_data *pd); void of_register_trusted_foundations(void); +bool trusted_foundations_registered(void); #else /* CONFIG_TRUSTED_FOUNDATIONS */ static inline void tf_dummy_write_sec(unsigned long val, unsigned int reg) @@ -86,6 +88,11 @@ static inline void of_register_trusted_foundations(void) if (of_find_compatible_node(NULL, NULL, "tlm,trusted-foundations")) register_trusted_foundations(NULL); } + +static inline bool trusted_foundations_registered(void) +{ + return false; +} #endif /* CONFIG_TRUSTED_FOUNDATIONS */ #endif