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, 232e87309eSAlyssa Rosenzweig HW_FEATURE_IDVS_GROUP_SIZE, 24*5b9afc16SAlyssa Rosenzweig HW_FEATURE_CLEAN_ONLY_SAFE, 25f3ba9122SRob Herring HW_FEATURE_3BIT_EXT_RW_L2_MMU_CONFIG, 26f3ba9122SRob Herring }; 27f3ba9122SRob Herring 28f3ba9122SRob Herring #define hw_features_t600 (\ 29f3ba9122SRob Herring BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \ 30f3ba9122SRob Herring BIT_ULL(HW_FEATURE_V4)) 31f3ba9122SRob Herring 328f54eab0SAlyssa Rosenzweig #define hw_features_t620 hw_features_t600 33f3ba9122SRob Herring 348f54eab0SAlyssa Rosenzweig #define hw_features_t720 hw_features_t600 35f3ba9122SRob Herring 36f3ba9122SRob Herring #define hw_features_t760 (\ 37f3ba9122SRob Herring BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \ 38f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \ 39f3ba9122SRob Herring BIT_ULL(HW_FEATURE_XAFFINITY) | \ 40f3ba9122SRob Herring BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT)) 41f3ba9122SRob Herring 428f54eab0SAlyssa Rosenzweig #define hw_features_t860 hw_features_t760 43f3ba9122SRob Herring 448f54eab0SAlyssa Rosenzweig #define hw_features_t880 hw_features_t760 45f3ba9122SRob Herring 468f54eab0SAlyssa Rosenzweig #define hw_features_t830 hw_features_t760 47f3ba9122SRob Herring 488f54eab0SAlyssa Rosenzweig #define hw_features_t820 hw_features_t760 49f3ba9122SRob Herring 50f3ba9122SRob Herring #define hw_features_g71 (\ 51f3ba9122SRob Herring BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \ 52f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \ 53f3ba9122SRob Herring BIT_ULL(HW_FEATURE_XAFFINITY) | \ 54f3ba9122SRob Herring BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \ 55f3ba9122SRob Herring BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \ 56f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \ 57f3ba9122SRob Herring BIT_ULL(HW_FEATURE_COHERENCY_REG)) 58f3ba9122SRob Herring 59f3ba9122SRob Herring #define hw_features_g72 (\ 60f3ba9122SRob Herring BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \ 61f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \ 62f3ba9122SRob Herring BIT_ULL(HW_FEATURE_XAFFINITY) | \ 63f3ba9122SRob Herring BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \ 64f3ba9122SRob Herring BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \ 65f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \ 66f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_DEBUG_MODE) | \ 67f3ba9122SRob Herring BIT_ULL(HW_FEATURE_COHERENCY_REG)) 68f3ba9122SRob Herring 698f54eab0SAlyssa Rosenzweig #define hw_features_g51 hw_features_g72 70f3ba9122SRob Herring 71f3ba9122SRob Herring #define hw_features_g52 (\ 72f3ba9122SRob Herring BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \ 73f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \ 74f3ba9122SRob Herring BIT_ULL(HW_FEATURE_XAFFINITY) | \ 75f3ba9122SRob Herring BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \ 76f3ba9122SRob Herring BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \ 77f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \ 78f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_DEBUG_MODE) | \ 792e87309eSAlyssa Rosenzweig BIT_ULL(HW_FEATURE_IDVS_GROUP_SIZE) | \ 80f3ba9122SRob Herring BIT_ULL(HW_FEATURE_COHERENCY_REG)) 81f3ba9122SRob Herring 82f3ba9122SRob Herring #define hw_features_g76 (\ 83f3ba9122SRob Herring BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \ 84f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \ 85f3ba9122SRob Herring BIT_ULL(HW_FEATURE_XAFFINITY) | \ 86f3ba9122SRob Herring BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \ 87f3ba9122SRob Herring BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \ 88f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \ 89f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_DEBUG_MODE) | \ 90f3ba9122SRob Herring BIT_ULL(HW_FEATURE_COHERENCY_REG) | \ 91f3ba9122SRob Herring BIT_ULL(HW_FEATURE_AARCH64_MMU) | \ 92f3ba9122SRob Herring BIT_ULL(HW_FEATURE_TLS_HASHING) | \ 932e87309eSAlyssa Rosenzweig BIT_ULL(HW_FEATURE_IDVS_GROUP_SIZE) | \ 94f3ba9122SRob Herring BIT_ULL(HW_FEATURE_3BIT_EXT_RW_L2_MMU_CONFIG)) 95f3ba9122SRob Herring 96f3ba9122SRob Herring #define hw_features_g31 (\ 97f3ba9122SRob Herring BIT_ULL(HW_FEATURE_JOBCHAIN_DISAMBIGUATION) | \ 98f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PWRON_DURING_PWROFF_TRANS) | \ 99f3ba9122SRob Herring BIT_ULL(HW_FEATURE_XAFFINITY) | \ 100f3ba9122SRob Herring BIT_ULL(HW_FEATURE_THREAD_GROUP_SPLIT) | \ 101f3ba9122SRob Herring BIT_ULL(HW_FEATURE_FLUSH_REDUCTION) | \ 102f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_MODE) | \ 103f3ba9122SRob Herring BIT_ULL(HW_FEATURE_PROTECTED_DEBUG_MODE) | \ 104f3ba9122SRob Herring BIT_ULL(HW_FEATURE_COHERENCY_REG) | \ 105f3ba9122SRob Herring BIT_ULL(HW_FEATURE_AARCH64_MMU) | \ 106f3ba9122SRob Herring BIT_ULL(HW_FEATURE_TLS_HASHING) | \ 107f3ba9122SRob Herring BIT_ULL(HW_FEATURE_3BIT_EXT_RW_L2_MMU_CONFIG)) 108f3ba9122SRob Herring 109f3ba9122SRob Herring static inline bool panfrost_has_hw_feature(struct panfrost_device *pfdev, 110f3ba9122SRob Herring enum panfrost_hw_feature feat) 111f3ba9122SRob Herring { 112f3ba9122SRob Herring return test_bit(feat, pfdev->features.hw_features); 113f3ba9122SRob Herring } 114f3ba9122SRob Herring 115f3ba9122SRob Herring #endif 116