1f3ba9122SRob Herring /* SPDX-License-Identifier: GPL-2.0 */ 2f3ba9122SRob Herring /* (C) COPYRIGHT 2014-2018 ARM Limited. All rights reserved. */ 3f3ba9122SRob Herring /* Copyright 2019 Linaro, Ltd., Rob Herring <robh@kernel.org> */ 4f3ba9122SRob Herring #ifndef __PANFROST_FEATURES_H__ 5f3ba9122SRob Herring #define __PANFROST_FEATURES_H__ 6f3ba9122SRob Herring 7f3ba9122SRob Herring #include <linux/bitops.h> 8f3ba9122SRob Herring 9f3ba9122SRob Herring #include "panfrost_device.h" 10f3ba9122SRob Herring 11f3ba9122SRob Herring enum panfrost_hw_feature { 12f3ba9122SRob Herring HW_FEATURE_JOBCHAIN_DISAMBIGUATION, 13f3ba9122SRob Herring HW_FEATURE_PWRON_DURING_PWROFF_TRANS, 14f3ba9122SRob Herring HW_FEATURE_XAFFINITY, 15f3ba9122SRob Herring HW_FEATURE_V4, 16f3ba9122SRob Herring HW_FEATURE_FLUSH_REDUCTION, 17f3ba9122SRob Herring HW_FEATURE_PROTECTED_MODE, 18f3ba9122SRob Herring HW_FEATURE_COHERENCY_REG, 19f3ba9122SRob Herring HW_FEATURE_PROTECTED_DEBUG_MODE, 20f3ba9122SRob Herring HW_FEATURE_AARCH64_MMU, 21f3ba9122SRob Herring HW_FEATURE_TLS_HASHING, 22f3ba9122SRob Herring HW_FEATURE_THREAD_GROUP_SPLIT, 23*2e87309eSAlyssa Rosenzweig HW_FEATURE_IDVS_GROUP_SIZE, 24f3ba9122SRob Herring HW_FEATURE_3BIT_EXT_RW_L2_MMU_CONFIG, 25f3ba9122SRob Herring }; 26f3ba9122SRob Herring 27f3ba9122SRob Herring #define hw_features_t600 (\ 28f3ba9122SRob Herring BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \ 29f3ba9122SRob Herring BIT_ULL(HW_FEATURE_V4)) 30f3ba9122SRob Herring 318f54eab0SAlyssa Rosenzweig #define hw_features_t620 hw_features_t600 32f3ba9122SRob Herring 338f54eab0SAlyssa Rosenzweig #define hw_features_t720 hw_features_t600 34f3ba9122SRob Herring 35f3ba9122SRob Herring #define hw_features_t760 (\ 36f3ba9122SRob Herring BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \ 37f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \ 38f3ba9122SRob Herring BIT_ULL(HW_FEATURE_XAFFINITY) | \ 39f3ba9122SRob Herring BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT)) 40f3ba9122SRob Herring 418f54eab0SAlyssa Rosenzweig #define hw_features_t860 hw_features_t760 42f3ba9122SRob Herring 438f54eab0SAlyssa Rosenzweig #define hw_features_t880 hw_features_t760 44f3ba9122SRob Herring 458f54eab0SAlyssa Rosenzweig #define hw_features_t830 hw_features_t760 46f3ba9122SRob Herring 478f54eab0SAlyssa Rosenzweig #define hw_features_t820 hw_features_t760 48f3ba9122SRob Herring 49f3ba9122SRob Herring #define hw_features_g71 (\ 50f3ba9122SRob Herring BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \ 51f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \ 52f3ba9122SRob Herring BIT_ULL(HW_FEATURE_XAFFINITY) | \ 53f3ba9122SRob Herring BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \ 54f3ba9122SRob Herring BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \ 55f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \ 56f3ba9122SRob Herring BIT_ULL(HW_FEATURE_COHERENCY_REG)) 57f3ba9122SRob Herring 58f3ba9122SRob Herring #define hw_features_g72 (\ 59f3ba9122SRob Herring BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \ 60f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \ 61f3ba9122SRob Herring BIT_ULL(HW_FEATURE_XAFFINITY) | \ 62f3ba9122SRob Herring BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \ 63f3ba9122SRob Herring BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \ 64f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \ 65f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_DEBUG_MODE) | \ 66f3ba9122SRob Herring BIT_ULL(HW_FEATURE_COHERENCY_REG)) 67f3ba9122SRob Herring 688f54eab0SAlyssa Rosenzweig #define hw_features_g51 hw_features_g72 69f3ba9122SRob Herring 70f3ba9122SRob Herring #define hw_features_g52 (\ 71f3ba9122SRob Herring BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \ 72f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \ 73f3ba9122SRob Herring BIT_ULL(HW_FEATURE_XAFFINITY) | \ 74f3ba9122SRob Herring BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \ 75f3ba9122SRob Herring BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \ 76f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \ 77f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_DEBUG_MODE) | \ 78*2e87309eSAlyssa Rosenzweig BIT_ULL(HW_FEATURE_IDVS_GROUP_SIZE) | \ 79f3ba9122SRob Herring BIT_ULL(HW_FEATURE_COHERENCY_REG)) 80f3ba9122SRob Herring 81f3ba9122SRob Herring #define hw_features_g76 (\ 82f3ba9122SRob Herring BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \ 83f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \ 84f3ba9122SRob Herring BIT_ULL(HW_FEATURE_XAFFINITY) | \ 85f3ba9122SRob Herring BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \ 86f3ba9122SRob Herring BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \ 87f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \ 88f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_DEBUG_MODE) | \ 89f3ba9122SRob Herring BIT_ULL(HW_FEATURE_COHERENCY_REG) | \ 90f3ba9122SRob Herring BIT_ULL(HW_FEATURE_AARCH64_MMU) | \ 91f3ba9122SRob Herring BIT_ULL(HW_FEATURE_TLS_HASHING) | \ 92*2e87309eSAlyssa Rosenzweig BIT_ULL(HW_FEATURE_IDVS_GROUP_SIZE) | \ 93f3ba9122SRob Herring BIT_ULL(HW_FEATURE_3BIT_EXT_RW_L2_MMU_CONFIG)) 94f3ba9122SRob Herring 95f3ba9122SRob Herring #define hw_features_g31 (\ 96f3ba9122SRob Herring BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \ 97f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \ 98f3ba9122SRob Herring BIT_ULL(HW_FEATURE_XAFFINITY) | \ 99f3ba9122SRob Herring BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \ 100f3ba9122SRob Herring BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \ 101f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \ 102f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_DEBUG_MODE) | \ 103f3ba9122SRob Herring BIT_ULL(HW_FEATURE_COHERENCY_REG) | \ 104f3ba9122SRob Herring BIT_ULL(HW_FEATURE_AARCH64_MMU) | \ 105f3ba9122SRob Herring BIT_ULL(HW_FEATURE_TLS_HASHING) | \ 106f3ba9122SRob Herring BIT_ULL(HW_FEATURE_3BIT_EXT_RW_L2_MMU_CONFIG)) 107f3ba9122SRob Herring 108f3ba9122SRob Herring static inline bool panfrost_has_hw_feature(struct panfrost_device *pfdev, 109f3ba9122SRob Herring enum panfrost_hw_feature feat) 110f3ba9122SRob Herring { 111f3ba9122SRob Herring return test_bit(feat, pfdev->features.hw_features); 112f3ba9122SRob Herring } 113f3ba9122SRob Herring 114f3ba9122SRob Herring #endif 115