From patchwork Tue Feb 27 14:09:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 878558 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="S3HSwc98"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zrLDV6MZkz9s2S for ; Wed, 28 Feb 2018 01:09:46 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753791AbeB0OJn (ORCPT ); Tue, 27 Feb 2018 09:09:43 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:53433 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753785AbeB0OJm (ORCPT ); Tue, 27 Feb 2018 09:09:42 -0500 Received: by mail-wm0-f68.google.com with SMTP id t74so24473724wme.3 for ; Tue, 27 Feb 2018 06:09:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=5P6rQr4UYrqvIjgnlkXSFF1Pc7pk/CuSRZQV+Xv0Mes=; b=S3HSwc981JyIevZgFhVg/8bIAPSVzAeCSo6eFkgEw7BMdGogKoyZXJO3wRc2lyCKpW jbT0OabqQlr2OyvEAhRWHPkhLHTGsedYLlPEHJRArjXJjr6+SwsM/xhjRO28ga+/tAHC Yy+n4T0b7IYqBYe1zQF8EHQ50SYjq6k41SB/E= 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; bh=5P6rQr4UYrqvIjgnlkXSFF1Pc7pk/CuSRZQV+Xv0Mes=; b=qTKRnRMLYWRc19TAGLALxPOcqtHkGPfmJhG5FHKsTKTwXfc+T7SnzVskbvr8RwMpvE +vDtI4j7BerFkeI1xhZsEkLE6rThuLAOnzSVMaVfghTIakEpNjHZkxZU7znqQafQwy1I KE0CPBvTAQWibJfgIHCjL8IcDt38TTsRf2wDBnAxIvHgrIjp0CPjSbJj++FWS0jwArO7 kDNJwBEN1ZRji8cP+iAvmLGl+DSBSZsx/wGZImbni/pwzvEz/YM0kdCIOrIsw2T2afT3 XY5uY6D4Dl95m3EtVDUbTdUI9ISU/4nJT3ZfpxvIiqw3Cvp56BOw8UOGgzvjez/M51zL 4Jmw== X-Gm-Message-State: APf1xPAsjx3Hg/NI4LW0pM1DDuD1KlzmOjRkUkHalrBGl7h1d31EGUwJ 8Bjyl4NAYwbqyf/hzqfzkuccBA== X-Google-Smtp-Source: AG47ELsRDAHAJPUhPvrsSK64fgnS3N3YorblmM9amqYD/UVpUfVHorsiS6j7k9vuxE/64lwdvmJ/fw== X-Received: by 10.28.11.70 with SMTP id 67mr10419636wml.158.1519740580787; Tue, 27 Feb 2018 06:09:40 -0800 (PST) Received: from lmecxl0911.lme.st.com ([80.214.71.157]) by smtp.gmail.com with ESMTPSA id 59sm6514496wro.57.2018.02.27.06.09.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Feb 2018 06:09:40 -0800 (PST) From: Benjamin Gaignard X-Google-Original-From: Benjamin Gaignard To: gregkh@linuxfoundation.org, robh+dt@kernel.org, mark.rutland@arm.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Benjamin Gaignard Subject: [PATCH 0/3] STM32 Extended TrustZone Protection driver Date: Tue, 27 Feb 2018 15:09:23 +0100 Message-Id: <20180227140926.22996-1-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On early boot stages STM32MP1 platform is able to dedicate some hardware blocks to a secure OS running in TrustZone. We need to avoid using those hardware blocks on non-secure context (i.e. kernel) because read/write access will all be discarded. Extended TrustZone Protection driver register itself as listener of BUS_NOTIFY_BIND_DRIVER and check, given the device address, if the hardware block could be used in a Linux context. If not it returns NOTIFY_BAD to driver core to stop driver probing. NOTE: patches 2 and 3 should be applied only on git://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git stm32-next but until this patch: https://lkml.org/lkml/2018/2/26/386 find it way to mailine KBuild will complain about them. Benjamin Gaignard (3): driver core: check notifier_call_chain return value dt-bindings: stm32: Add bindings for Extended TrustZone Protection ARM: mach-stm32: Add Extended TrustZone Protection driver .../bindings/arm/stm32/st,stm32mp1-etzpc.txt | 13 ++ arch/arm/mach-stm32/Kconfig | 7 + arch/arm/mach-stm32/Makefile | 1 + arch/arm/mach-stm32/stm32-etzpc.c | 252 +++++++++++++++++++++ drivers/base/dd.c | 9 +- 5 files changed, 279 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/stm32/st,stm32mp1-etzpc.txt create mode 100644 arch/arm/mach-stm32/stm32-etzpc.c