From patchwork Wed Jun 21 03:16:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jit Loon Lim X-Patchwork-Id: 1797631 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=VZOn6WJ3; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qm7wm4fRqz20XS for ; Wed, 21 Jun 2023 13:17:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 403168637B; Wed, 21 Jun 2023 05:17:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="VZOn6WJ3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C3A40863DB; Wed, 21 Jun 2023 05:16:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 37B7A86288 for ; Wed, 21 Jun 2023 05:16:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=jitloonl@ecsmtp.png.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687317386; x=1718853386; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0oRlpYnvzdH1KkY+sSLGJquXVl3Ic8Wa/sF+Cy1UdWQ=; b=VZOn6WJ3hxlOCxtWp16f/gAu1jc/jfB6qSw6ObgKuMtlEyA/e4M3jSEK aH+5p13HvjDeJ9ItiKwJfIS1xCDGEXEX8QHxQy7VWiFgb23b6yoGK3DFw cIC3xf6nQ3qMhcvSDQ/0rSROGUP2ygCBQi0wW6BwRfxK3BzdMfmfUsNxx jYzo80HrwsSyOLqcEDmZaXOqEA6BSg959ItwvA00bm1NnKQy+VhMtP6yV 63/oFwUF5AuzL1rQKn3QwqwMGFwH1Rg26s6puLDuyO/1oxZ8z7RYcqKG3 reuHER/UbdM9j1JtG9eZ/VMUF3caAN3ki0vuJn4/SYF7+WzwEoJ/AIFna w==; X-IronPort-AV: E=McAfee;i="6600,9927,10747"; a="360059746" X-IronPort-AV: E=Sophos;i="6.00,259,1681196400"; d="scan'208";a="360059746" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2023 20:16:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10747"; a="664479884" X-IronPort-AV: E=Sophos;i="6.00,259,1681196400"; d="scan'208";a="664479884" Received: from pglmail07.png.intel.com ([10.221.193.207]) by orsmga003.jf.intel.com with ESMTP; 20 Jun 2023 20:16:19 -0700 Received: from localhost (pgli0121.png.intel.com [10.221.240.84]) by pglmail07.png.intel.com (Postfix) with ESMTP id 313E52B92; Wed, 21 Jun 2023 11:16:19 +0800 (+08) Received: by localhost (Postfix, from userid 12048045) id 2F8AB2950; Wed, 21 Jun 2023 11:16:19 +0800 (+08) From: Jit Loon Lim To: u-boot@lists.denx.de Cc: Jagan Teki , Vignesh R , Marek , Simon , Tien Fong , Kok Kiang , Raaj , Dinesh , Boon Khai , Alif , Teik Heng , Hazim , Jit Loon Lim , Sieu Mun Tang Subject: [PATCH v1 07/17] doc: device-tree-bindings: misc: add secreg text file for agilex5 Date: Wed, 21 Jun 2023 11:16:00 +0800 Message-Id: <20230621031610.28401-8-jit.loon.lim@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20230621031610.28401-1-jit.loon.lim@intel.com> References: <20230621031610.28401-1-jit.loon.lim@intel.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This is for new platform enablement for agilex5. Add new secure register text file for new platform. Signed-off-by: Jit Loon Lim --- .../misc/socfpga_secreg.txt | 397 ++++++++++++++++++ 1 file changed, 397 insertions(+) create mode 100644 doc/device-tree-bindings/misc/socfpga_secreg.txt diff --git a/doc/device-tree-bindings/misc/socfpga_secreg.txt b/doc/device-tree-bindings/misc/socfpga_secreg.txt new file mode 100644 index 0000000000..97640b74d9 --- /dev/null +++ b/doc/device-tree-bindings/misc/socfpga_secreg.txt @@ -0,0 +1,397 @@ +* Firewall and privilege register settings in device tree + +Required properties: +-------------------- + +- compatible: should contain "intel,socfpga-secreg" +- reg: Physical base address and size of block register. +- intel,offset-settings: 32-bit offset address of block register, + followed by 32-bit value settings and + the masking bits, only masking bit + set to 1 allows modification. + +The device tree node which describes secure and privilege register access +configuration in compile time. + +Most of these registers are expected to work except for the case which some +registers configuration are required for granting access to some other +registers, for example CCU registers have to be properly configured before +allowing register configuration access to fpga2sdram firewall as shown in +below example. + +Some registers depend on runtime data for proper configuration are expected +to be part of driver that generating these data for example configuration for +soc_noc_fw_ddr_mpu_inst_0_ddr_scr block register depend on DDR size parsed from +memory device tree node. + +Please refer details of tested examples below for both fpga2sdram and QoS +configuration with default reset value and the comments. + +Example: +-------- + +Common configuration for all SoC64 devices: +Path: arch/arm/dts/socfpga_soc64_u-boot.dtsi + + socfpga_secreg: socfpga-secreg { + compatible = "intel,socfpga-secreg"; + #address-cells = <1>; + #size-cells = <1>; + u-boot,dm-pre-reloc; + + i_sys_mgr_core@ffd12000 { + reg = <0xffd12000 0x00000230>; + intel,offset-settings = + /* Enable non-secure interface to DMA */ + <0x00000020 0xff010000 0xff010011>, + /* Enable non-secure interface to DMA periph */ + <0x00000024 0xffffffff 0xffffffff>; + u-boot,dm-pre-reloc; + }; + + noc_fw_l4_per_l4_per_scr@ffd21000 { + reg = <0xffd21000 0x00000074>; + intel,offset-settings = + /* Disable L4 periphs firewall */ + <0x00000000 0x01010001 0x01010001>, + <0x00000004 0x01010001 0x01010001>, + <0x0000000c 0x01010001 0x01010001>, + <0x00000010 0x01010001 0x01010001>, + <0x0000001c 0x01010001 0x01010101>, + <0x00000020 0x01010001 0x01010101>, + <0x00000024 0x01010001 0x01010101>, + <0x00000028 0x01010001 0x01010101>, + <0x0000002c 0x01010001 0x01010001>, + <0x00000030 0x01010001 0x01010001>, + <0x00000034 0x01010001 0x01010001>, + <0x00000040 0x01010001 0x01010001>, + <0x00000044 0x01010001 0x01010101>, + <0x00000048 0x01010001 0x01010101>, + <0x00000050 0x01010001 0x01010101>, + <0x00000054 0x01010001 0x01010101>, + <0x00000058 0x01010001 0x01010101>, + <0x0000005c 0x01010001 0x01010101>, + <0x00000060 0x01010001 0x01010101>, + <0x00000064 0x01010001 0x01010101>, + <0x00000068 0x01010001 0x01010101>, + <0x0000006c 0x01010001 0x01010101>, + <0x00000070 0x01010001 0x01010101>; + u-boot,dm-pre-reloc; + }; + + noc_fw_l4_sys_l4_sys_scr@ffd21100 { + reg = <0xffd21100 0x00000098>; + intel,offset-settings = + /* Disable L4 system firewall */ + <0x00000008 0x01010001 0x01010001>, + <0x0000000c 0x01010001 0x01010001>, + <0x00000010 0x01010001 0x01010001>, + <0x00000014 0x01010001 0x01010001>, + <0x00000018 0x01010001 0x01010001>, + <0x0000001c 0x01010001 0x01010001>, + <0x00000020 0x01010001 0x01010001>, + <0x0000002c 0x01010001 0x01010001>, + <0x00000030 0x01010001 0x01010001>, + <0x00000034 0x01010001 0x01010001>, + <0x00000038 0x01010001 0x01010001>, + <0x00000040 0x01010001 0x01010001>, + <0x00000044 0x01010001 0x01010001>, + <0x00000048 0x01010001 0x01010001>, + <0x0000004c 0x01010001 0x01010001>, + <0x00000054 0x01010001 0x01010001>, + <0x00000058 0x01010001 0x01010001>, + <0x0000005c 0x01010001 0x01010001>, + <0x00000060 0x01010001 0x01010101>, + <0x00000064 0x01010001 0x01010101>, + <0x00000068 0x01010001 0x01010101>, + <0x0000006c 0x01010001 0x01010101>, + <0x00000070 0x01010001 0x01010101>, + <0x00000074 0x01010001 0x01010101>, + <0x00000078 0x01010001 0x03010001>, + <0x00000090 0x01010001 0x01010001>, + <0x00000094 0x01010001 0x01010001>; + u-boot,dm-pre-reloc; + }; + + noc_fw_soc2fpga_soc2fpga_scr@ffd21200 { + reg = <0xffd21200 0x00000004>; + /* Disable soc2fpga security access */ + intel,offset-settings = <0x00000000 0x0ffe0101 0x0ffe0101>; + u-boot,dm-pre-reloc; + }; + + noc_fw_lwsoc2fpga_lwsoc2fpga_scr@ffd21300 { + reg = <0xffd21300 0x00000004>; + /* Disable lightweight soc2fpga security access */ + intel,offset-settings = <0x00000000 0x0ffe0101 0x0ffe0101>; + u-boot,dm-pre-reloc; + }; + + noc_fw_tcu_tcu_scr@ffd21400 { + reg = <0xffd21400 0x00000004>; + /* Disable DMA ECC security access, for SMMU use */ + intel,offset-settings = <0x00000000 0x01010001 0x01010001>; + u-boot,dm-pre-reloc; + }; + + noc_fw_priv_MemoryMap_priv@ffd24800 { + reg = <0xffd24800 0x0000000c>; + intel,offset-settings = + /* Enable non-prviledged access to various periphs */ + <0x00000000 0xfff73ffb 0xfff73ffb>; + u-boot,dm-pre-reloc; + }; + }; + +configuration for N5X device: +Path: arch/arm/dts/socfpga_n5x-u-boot.dtsi + + &socfpga_secreg { + coh_cpu0_bypass_OC_Firewall_main_Firewall@f7100200 { + reg = <0xf7100200 0x00000014>; + intel,offset-settings = + /* Disable ocram security at CCU for non secure access */ + <0x0000004 0x8000ffff 0xe007ffff>, + <0x0000008 0x8000ffff 0xe007ffff>, + <0x000000c 0x8000ffff 0xe007ffff>, + <0x0000010 0x8000ffff 0xe007ffff>; + u-boot,dm-pre-reloc; + }; + + soc_noc_fw_mpfe_csr_inst_0_mpfe_scr@f8020000 { + reg = <0xf8020000 0x0000001c>; + intel,offset-settings = + /* Disable MPFE firewall for SMMU */ + <0x00000000 0x00010101 0x00010101>, + /* Disable MPFE firewall for HMC adapter */ + <0x00000004 0x00000001 0x00010101>; + u-boot,dm-pre-reloc; + }; + }; + +configuration for Agilex device: +Path: arch/arm/dts/socfpga_agilex-u-boot.dtsi + + &socfpga_secreg { + CCU_coh_cpu0_bypass_OC_Firewall_main_Firewall@f7100200 { + reg = <0xf7100200 0x00000014>; + intel,offset-settings = + /* Disable ocram security at CCU for non secure access */ + <0x0000004 0x8000ffff 0xe003ffff>, + <0x0000008 0x8000ffff 0xe003ffff>, + <0x000000c 0x8000ffff 0xe003ffff>, + <0x0000010 0x8000ffff 0xe003ffff>; + u-boot,dm-pre-reloc; + }; + + soc_noc_fw_mpfe_csr_inst_0_mpfe_scr@f8020000 { + reg = <0xf8020000 0x0000001c>; + intel,offset-settings = + /* Disable MPFE firewall for SMMU */ + <0x00000000 0x00010101 0x00010101>, + /* Disable MPFE firewall for HMC adapter */ + <0x00000004 0x00000001 0x00010101>; + u-boot,dm-pre-reloc; + }; + + /* + * Below are all fpga2sdram firewall settings with default + * reset value for the sake of easy reference by users. + * Users may choose to remove any of these register + * configurations that they do not require in their specific + * implementation. + */ + soc_noc_fw_ddr_fpga2sdram_inst_0_ddr_scr@f8020100 { + reg = <0xf8020100 0x00000050>; + intel,offset-settings = + <0x0000000 0x00000000 0x0000000f>, + <0x0000004 0x00000000 0x0000000f>, + <0x0000008 0x00000000 0x0000000f>, + <0x0000010 0x00000000 0xffff0000>, + <0x0000014 0x00000000 0x000000ff>, + <0x0000018 0x00000000 0xffff0000>, + <0x000001c 0x00000000 0x000000ff>, + <0x0000020 0x00000000 0xffff0000>, + <0x0000024 0x00000000 0x000000ff>, + <0x0000028 0x00000000 0xffff0000>, + <0x000002c 0x00000000 0x000000ff>, + <0x0000030 0x00000000 0xffff0000>, + <0x0000034 0x00000000 0x000000ff>, + <0x0000038 0x00000000 0xffff0000>, + <0x000003c 0x00000000 0x000000ff>, + <0x0000040 0x00000000 0xffff0000>, + <0x0000044 0x00000000 0x000000ff>, + <0x0000048 0x00000000 0xffff0000>, + <0x000004c 0x00000000 0x000000ff>; + u-boot,dm-pre-reloc; + }; + + /* + * Example of ccu_mem0_I_main QOS settings with + * default reset value for the sake of easy reference + * by users. Users may choose to remove any of these register + * configurations that they do not require in their specific + * implementation. + */ + soc_mpfe_noc_inst_0_ccu_mem0_I_main_QosGenerator@f8022080 { + reg = <0xf8022080 0x0000001c>; + intel,offset-settings = + <0x0000008 0x00000200 0x00000303>, + <0x000000c 0x00000003 0x00000003>, + <0x0000010 0x00000BFE 0x00007fff>, + <0x0000014 0x00000008 0x000003ff>, + <0x0000018 0x00000000 0x0000000f>; + u-boot,dm-pre-reloc; + }; + }; + +configuration for Stratix 10 device: +Path: arch/arm/dts/socfpga_stratix10-u-boot.dtsi + + &socfpga_secreg { + i_ccu_noc_registers@f7000000 { + reg = <0xf7000000 0x00049e60>; + intel,offset-settings = + /* Enable access to DDR reg from CPU */ + <0x0004400 0xF8000000 0xffffffff>, + + /* Enable access to DDR region from CPU */ + <0x00045c0 0x00000000 0xffffffdf>, + <0x00045e0 0x00000000 0xffffffdf>, + <0x0004600 0x00000000 0xffffffdf>, + <0x0004620 0x00000000 0xffffffdf>, + <0x0004640 0x00000000 0xffffffdf>, + <0x0004660 0x00000000 0xffffffdf>, + + /* Disable ocram security at CCU for non secure access */ + <0x0004688 0xfffc0000 0xffffffcf>, + <0x0018628 0xfffc0000 0xffffffcf>, + + /* Enable access to DDR region from IO master */ + <0x00018560 0x00000000 0xffffffdf>, + <0x00018580 0x00000000 0xffffffdf>, + <0x000185a0 0x00000000 0xffffffdf>, + <0x000185c0 0x00000000 0xffffffdf>, + <0x000185e0 0x00000000 0xffffffdf>, + <0x00018600 0x00000000 0xffffffdf>, + + /* Enable access to DDR region from TCU */ + <0x0002c520 0x00000000 0xffffffdf>, + <0x0002c540 0x00000000 0xffffffdf>, + <0x0002c560 0x00000000 0xffffffdf>, + <0x0002c580 0x00000000 0xffffffdf>, + <0x0002c5a0 0x00000000 0xffffffdf>, + <0x0002c5c0 0x00000000 0xffffffdf>, + + /* Enable access to DDR region from FPGA */ + <0x000105a0 0x00000000 0xffffffdf>, + <0x000105c0 0x00000000 0xffffffdf>, + <0x000105e0 0x00000000 0xffffffdf>, + <0x00010600 0x00000000 0xffffffdf>, + <0x00010620 0x00000000 0xffffffdf>, + <0x00010640 0x00000000 0xffffffdf>; + u-boot,dm-pre-reloc; + }; + + /* + * Both firewall and QOS regs accessed by CPU in MPFE has + * dependency on CCU configuration above. + * + * Below are all fpga2sdram firewall settings with default + * reset value for the sake of easy reference by users. + * Users may choose to remove any of these register configurations + * that they do not require in their specific implementation. + */ + soc_noc_fw_ddr_fpga2sdram_inst_0_ddr_scr@f8020200 { + reg = <0xf8020200 0x00000050>; + intel,offset-settings = + <0x0000000 0x00000000 0x0000000f>, + <0x0000004 0x00000000 0x0000000f>, + <0x0000008 0x00000000 0x0000000f>, + <0x0000010 0x00000000 0xffff0000>, + <0x0000014 0x00000000 0x0000001f>, + <0x0000018 0x00000000 0xffff0000>, + <0x000001c 0x00000000 0x0000001f>, + <0x0000020 0x00000000 0xffff0000>, + <0x0000024 0x00000000 0x0000001f>, + <0x0000028 0x00000000 0xffff0000>, + <0x000002c 0x00000000 0x0000001f>, + <0x0000030 0x00000000 0xffff0000>, + <0x0000034 0x00000000 0x0000001f>, + <0x0000038 0x00000000 0xffff0000>, + <0x000003c 0x00000000 0x0000001f>, + <0x0000040 0x00000000 0xffff0000>, + <0x0000044 0x00000000 0x0000001f>, + <0x0000048 0x00000000 0xffff0000>, + <0x000004c 0x00000000 0x0000001f>; + u-boot,dm-pre-reloc; + }; + + soc_noc_fw_ddr_fpga2sdram_inst_1_ddr_scr@f8020300 { + reg = <0xf8020300 0x00000050>; + intel,offset-settings = + <0x0000000 0x00000000 0x0000000f>, + <0x0000004 0x00000000 0x0000000f>, + <0x0000008 0x00000000 0x0000000f>, + <0x0000010 0x00000000 0xffff0000>, + <0x0000014 0x00000000 0x0000001f>, + <0x0000018 0x00000000 0xffff0000>, + <0x000001c 0x00000000 0x0000001f>, + <0x0000020 0x00000000 0xffff0000>, + <0x0000024 0x00000000 0x0000001f>, + <0x0000028 0x00000000 0xffff0000>, + <0x000002c 0x00000000 0x0000001f>, + <0x0000030 0x00000000 0xffff0000>, + <0x0000034 0x00000000 0x0000001f>, + <0x0000038 0x00000000 0xffff0000>, + <0x000003c 0x00000000 0x0000001f>, + <0x0000040 0x00000000 0xffff0000>, + <0x0000044 0x00000000 0x0000001f>, + <0x0000048 0x00000000 0xffff0000>, + <0x000004c 0x00000000 0x0000001f>; + u-boot,dm-pre-reloc; + }; + + soc_noc_fw_ddr_fpga2sdram_inst_2_ddr_scr@f8020400 { + reg = <0xf8020400 0x00000050>; + intel,offset-settings = + <0x0000000 0x00000000 0x0000000f>, + <0x0000004 0x00000000 0x0000000f>, + <0x0000008 0x00000000 0x0000000f>, + <0x0000010 0x00000000 0xffff0000>, + <0x0000014 0x00000000 0x0000001f>, + <0x0000018 0x00000000 0xffff0000>, + <0x000001c 0x00000000 0x0000001f>, + <0x0000020 0x00000000 0xffff0000>, + <0x0000024 0x00000000 0x0000001f>, + <0x0000028 0x00000000 0xffff0000>, + <0x000002c 0x00000000 0x0000001f>, + <0x0000030 0x00000000 0xffff0000>, + <0x0000034 0x00000000 0x0000001f>, + <0x0000038 0x00000000 0xffff0000>, + <0x000003c 0x00000000 0x0000001f>, + <0x0000040 0x00000000 0xffff0000>, + <0x0000044 0x00000000 0x0000001f>, + <0x0000048 0x00000000 0xffff0000>, + <0x000004c 0x00000000 0x0000001f>; + u-boot,dm-pre-reloc; + }; + + /* + * Example of ccu_mem0_I_main QOS settings with + * default reset value for the sake of easy reference + * by users. Users may choose to remove any of these register + * configurations that they do not require in their specific + * implementation. + */ + soc_ddr_scheduler_inst_0_ccu_mem0_I_main_QosGenerator@f8022080 { + reg = <0xf8022080 0x0000001c>; + intel,offset-settings = + <0x0000008 0x00000000 0x00000303>, + <0x000000c 0x00000001 0x00000003>, + <0x0000010 0x00000BFE 0x00001fff>, + <0x0000014 0x00000008 0x000003ff>, + <0x0000018 0x00000000 0x00000007>; + u-boot,dm-pre-reloc; + }; + };