| .. | .. |
|---|
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note |
|---|
| 2 | 2 | /* |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * (C) COPYRIGHT 2011-2021 ARM Limited. All rights reserved. |
|---|
| 4 | + * (C) COPYRIGHT 2011-2022 ARM Limited. All rights reserved. |
|---|
| 5 | 5 | * |
|---|
| 6 | 6 | * This program is free software and is provided to you under the terms of the |
|---|
| 7 | 7 | * GNU General Public License version 2 as published by the Free Software |
|---|
| .. | .. |
|---|
| 198 | 198 | gpu_props->raw_props.mem_features = regdump.mem_features; |
|---|
| 199 | 199 | gpu_props->raw_props.mmu_features = regdump.mmu_features; |
|---|
| 200 | 200 | gpu_props->raw_props.l2_features = regdump.l2_features; |
|---|
| 201 | | - gpu_props->raw_props.core_features = regdump.core_features; |
|---|
| 202 | 201 | |
|---|
| 203 | 202 | gpu_props->raw_props.as_present = regdump.as_present; |
|---|
| 204 | 203 | gpu_props->raw_props.js_present = regdump.js_present; |
|---|
| .. | .. |
|---|
| 312 | 311 | struct base_gpu_props * const gpu_props, struct kbase_device *kbdev) |
|---|
| 313 | 312 | { |
|---|
| 314 | 313 | int i; |
|---|
| 315 | | - u32 gpu_id; |
|---|
| 316 | 314 | |
|---|
| 317 | 315 | /* Populate the base_gpu_props structure */ |
|---|
| 318 | 316 | kbase_gpuprops_update_core_props_gpu_id(gpu_props); |
|---|
| .. | .. |
|---|
| 323 | 321 | gpu_props->core_props.gpu_available_memory_size = |
|---|
| 324 | 322 | totalram_pages() << PAGE_SHIFT; |
|---|
| 325 | 323 | #endif |
|---|
| 326 | | - |
|---|
| 327 | | - gpu_props->core_props.num_exec_engines = |
|---|
| 328 | | - KBASE_UBFX32(gpu_props->raw_props.core_features, 0, 4); |
|---|
| 329 | 324 | |
|---|
| 330 | 325 | for (i = 0; i < BASE_GPU_NUM_TEXTURE_FEATURES_REGISTERS; i++) |
|---|
| 331 | 326 | gpu_props->core_props.texture_features[i] = gpu_props->raw_props.texture_features[i]; |
|---|
| .. | .. |
|---|
| 365 | 360 | gpu_props->thread_props.tls_alloc = |
|---|
| 366 | 361 | gpu_props->raw_props.thread_tls_alloc; |
|---|
| 367 | 362 | |
|---|
| 368 | | - /* MIDHARC-2364 was intended for tULx. |
|---|
| 369 | | - * Workaround for the incorrectly applied THREAD_FEATURES to tDUx. |
|---|
| 370 | | - */ |
|---|
| 371 | | - gpu_id = kbdev->gpu_props.props.raw_props.gpu_id; |
|---|
| 372 | | - |
|---|
| 373 | 363 | #if MALI_USE_CSF |
|---|
| 374 | 364 | gpu_props->thread_props.max_registers = |
|---|
| 375 | | - KBASE_UBFX32(gpu_props->raw_props.thread_features, |
|---|
| 376 | | - 0U, 22); |
|---|
| 365 | + KBASE_UBFX32(gpu_props->raw_props.thread_features, 0U, 22); |
|---|
| 377 | 366 | gpu_props->thread_props.impl_tech = |
|---|
| 378 | | - KBASE_UBFX32(gpu_props->raw_props.thread_features, |
|---|
| 379 | | - 22U, 2); |
|---|
| 367 | + KBASE_UBFX32(gpu_props->raw_props.thread_features, 22U, 2); |
|---|
| 380 | 368 | gpu_props->thread_props.max_task_queue = |
|---|
| 381 | | - KBASE_UBFX32(gpu_props->raw_props.thread_features, |
|---|
| 382 | | - 24U, 8); |
|---|
| 369 | + KBASE_UBFX32(gpu_props->raw_props.thread_features, 24U, 8); |
|---|
| 383 | 370 | gpu_props->thread_props.max_thread_group_split = 0; |
|---|
| 384 | 371 | #else |
|---|
| 385 | | - if ((gpu_id & GPU_ID2_PRODUCT_MODEL) == GPU_ID2_PRODUCT_TDUX) { |
|---|
| 386 | | - gpu_props->thread_props.max_registers = |
|---|
| 387 | | - KBASE_UBFX32(gpu_props->raw_props.thread_features, |
|---|
| 388 | | - 0U, 22); |
|---|
| 389 | | - gpu_props->thread_props.impl_tech = |
|---|
| 390 | | - KBASE_UBFX32(gpu_props->raw_props.thread_features, |
|---|
| 391 | | - 22U, 2); |
|---|
| 392 | | - gpu_props->thread_props.max_task_queue = |
|---|
| 393 | | - KBASE_UBFX32(gpu_props->raw_props.thread_features, |
|---|
| 394 | | - 24U, 8); |
|---|
| 395 | | - gpu_props->thread_props.max_thread_group_split = 0; |
|---|
| 396 | | - } else { |
|---|
| 397 | | - gpu_props->thread_props.max_registers = |
|---|
| 398 | | - KBASE_UBFX32(gpu_props->raw_props.thread_features, |
|---|
| 399 | | - 0U, 16); |
|---|
| 400 | | - gpu_props->thread_props.max_task_queue = |
|---|
| 401 | | - KBASE_UBFX32(gpu_props->raw_props.thread_features, |
|---|
| 402 | | - 16U, 8); |
|---|
| 403 | | - gpu_props->thread_props.max_thread_group_split = |
|---|
| 404 | | - KBASE_UBFX32(gpu_props->raw_props.thread_features, |
|---|
| 405 | | - 24U, 6); |
|---|
| 406 | | - gpu_props->thread_props.impl_tech = |
|---|
| 407 | | - KBASE_UBFX32(gpu_props->raw_props.thread_features, |
|---|
| 408 | | - 30U, 2); |
|---|
| 409 | | - } |
|---|
| 372 | + gpu_props->thread_props.max_registers = |
|---|
| 373 | + KBASE_UBFX32(gpu_props->raw_props.thread_features, 0U, 16); |
|---|
| 374 | + gpu_props->thread_props.max_task_queue = |
|---|
| 375 | + KBASE_UBFX32(gpu_props->raw_props.thread_features, 16U, 8); |
|---|
| 376 | + gpu_props->thread_props.max_thread_group_split = |
|---|
| 377 | + KBASE_UBFX32(gpu_props->raw_props.thread_features, 24U, 6); |
|---|
| 378 | + gpu_props->thread_props.impl_tech = |
|---|
| 379 | + KBASE_UBFX32(gpu_props->raw_props.thread_features, 30U, 2); |
|---|
| 410 | 380 | #endif |
|---|
| 411 | 381 | |
|---|
| 412 | 382 | /* If values are not specified, then use defaults */ |
|---|
| .. | .. |
|---|
| 506 | 476 | if (!kbase_hw_has_feature(kbdev, BASE_HW_FEATURE_THREAD_GROUP_SPLIT)) |
|---|
| 507 | 477 | gpu_props->thread_props.max_thread_group_split = 0; |
|---|
| 508 | 478 | |
|---|
| 479 | + /* |
|---|
| 480 | + * The CORE_FEATURES register has different meanings depending on GPU. |
|---|
| 481 | + * On tGOx, bits[3:0] encode num_exec_engines. |
|---|
| 482 | + * On CSF GPUs, bits[7:0] is an enumeration that needs to be parsed, |
|---|
| 483 | + * instead. |
|---|
| 484 | + * GPUs like tTIx have additional fields like LSC_SIZE that are |
|---|
| 485 | + * otherwise reserved/RAZ on older GPUs. |
|---|
| 486 | + */ |
|---|
| 487 | + gpu_props->raw_props.core_features = regdump.core_features; |
|---|
| 488 | + |
|---|
| 489 | +#if !MALI_USE_CSF |
|---|
| 490 | + gpu_props->core_props.num_exec_engines = |
|---|
| 491 | + KBASE_UBFX32(gpu_props->raw_props.core_features, 0, 4); |
|---|
| 492 | +#endif |
|---|
| 493 | + |
|---|
| 509 | 494 | return err; |
|---|
| 510 | 495 | } |
|---|
| 511 | 496 | |
|---|
| .. | .. |
|---|
| 527 | 512 | static u32 l2_hash_values[ASN_HASH_COUNT] = { |
|---|
| 528 | 513 | 0, |
|---|
| 529 | 514 | }; |
|---|
| 530 | | -static int num_override_l2_hash_values; |
|---|
| 515 | +static unsigned int num_override_l2_hash_values; |
|---|
| 531 | 516 | module_param_array(l2_hash_values, uint, &num_override_l2_hash_values, 0000); |
|---|
| 532 | 517 | MODULE_PARM_DESC(l2_hash_values, "Override L2 hash values config for testing"); |
|---|
| 533 | 518 | |
|---|
| .. | .. |
|---|
| 581 | 566 | |
|---|
| 582 | 567 | kbdev->l2_hash_values_override = false; |
|---|
| 583 | 568 | if (num_override_l2_hash_values) { |
|---|
| 584 | | - int i; |
|---|
| 569 | + unsigned int i; |
|---|
| 585 | 570 | |
|---|
| 586 | 571 | kbdev->l2_hash_values_override = true; |
|---|
| 587 | 572 | for (i = 0; i < num_override_l2_hash_values; i++) |
|---|
| .. | .. |
|---|
| 661 | 646 | dev_info(kbdev->dev, "Reflected L2_CONFIG is 0x%08x\n", |
|---|
| 662 | 647 | regdump.l2_config); |
|---|
| 663 | 648 | |
|---|
| 649 | + if (kbase_hw_has_feature(kbdev, BASE_HW_FEATURE_ASN_HASH)) { |
|---|
| 650 | + int idx; |
|---|
| 651 | + const bool asn_he = regdump.l2_config & |
|---|
| 652 | + L2_CONFIG_ASN_HASH_ENABLE_MASK; |
|---|
| 653 | +#if !IS_ENABLED(CONFIG_MALI_BIFROST_NO_MALI) |
|---|
| 654 | + if (!asn_he && kbdev->l2_hash_values_override) |
|---|
| 655 | + dev_err(kbdev->dev, |
|---|
| 656 | + "Failed to use requested ASN_HASH, fallback to default"); |
|---|
| 657 | +#endif |
|---|
| 658 | + for (idx = 0; idx < ASN_HASH_COUNT; idx++) |
|---|
| 659 | + dev_info(kbdev->dev, |
|---|
| 660 | + "%s ASN_HASH[%d] is [0x%08x]\n", |
|---|
| 661 | + asn_he ? "Overridden" : "Default", idx, |
|---|
| 662 | + regdump.l2_asn_hash[idx]); |
|---|
| 663 | + } |
|---|
| 664 | 664 | |
|---|
| 665 | 665 | /* Update gpuprops with reflected L2_FEATURES */ |
|---|
| 666 | 666 | gpu_props->raw_props.l2_features = regdump.l2_features; |
|---|
| .. | .. |
|---|
| 680 | 680 | #define PROP(name, member) \ |
|---|
| 681 | 681 | {KBASE_GPUPROP_ ## name, offsetof(struct base_gpu_props, member), \ |
|---|
| 682 | 682 | sizeof(((struct base_gpu_props *)0)->member)} |
|---|
| 683 | | - PROP(PRODUCT_ID, core_props.product_id), |
|---|
| 684 | | - PROP(VERSION_STATUS, core_props.version_status), |
|---|
| 685 | | - PROP(MINOR_REVISION, core_props.minor_revision), |
|---|
| 686 | | - PROP(MAJOR_REVISION, core_props.major_revision), |
|---|
| 687 | | - PROP(GPU_FREQ_KHZ_MAX, core_props.gpu_freq_khz_max), |
|---|
| 688 | | - PROP(LOG2_PROGRAM_COUNTER_SIZE, core_props.log2_program_counter_size), |
|---|
| 689 | | - PROP(TEXTURE_FEATURES_0, core_props.texture_features[0]), |
|---|
| 690 | | - PROP(TEXTURE_FEATURES_1, core_props.texture_features[1]), |
|---|
| 691 | | - PROP(TEXTURE_FEATURES_2, core_props.texture_features[2]), |
|---|
| 692 | | - PROP(TEXTURE_FEATURES_3, core_props.texture_features[3]), |
|---|
| 693 | | - PROP(GPU_AVAILABLE_MEMORY_SIZE, core_props.gpu_available_memory_size), |
|---|
| 694 | | - PROP(NUM_EXEC_ENGINES, core_props.num_exec_engines), |
|---|
| 683 | + PROP(PRODUCT_ID, core_props.product_id), |
|---|
| 684 | + PROP(VERSION_STATUS, core_props.version_status), |
|---|
| 685 | + PROP(MINOR_REVISION, core_props.minor_revision), |
|---|
| 686 | + PROP(MAJOR_REVISION, core_props.major_revision), |
|---|
| 687 | + PROP(GPU_FREQ_KHZ_MAX, core_props.gpu_freq_khz_max), |
|---|
| 688 | + PROP(LOG2_PROGRAM_COUNTER_SIZE, core_props.log2_program_counter_size), |
|---|
| 689 | + PROP(TEXTURE_FEATURES_0, core_props.texture_features[0]), |
|---|
| 690 | + PROP(TEXTURE_FEATURES_1, core_props.texture_features[1]), |
|---|
| 691 | + PROP(TEXTURE_FEATURES_2, core_props.texture_features[2]), |
|---|
| 692 | + PROP(TEXTURE_FEATURES_3, core_props.texture_features[3]), |
|---|
| 693 | + PROP(GPU_AVAILABLE_MEMORY_SIZE, core_props.gpu_available_memory_size), |
|---|
| 695 | 694 | |
|---|
| 696 | | - PROP(L2_LOG2_LINE_SIZE, l2_props.log2_line_size), |
|---|
| 697 | | - PROP(L2_LOG2_CACHE_SIZE, l2_props.log2_cache_size), |
|---|
| 698 | | - PROP(L2_NUM_L2_SLICES, l2_props.num_l2_slices), |
|---|
| 695 | +#if MALI_USE_CSF |
|---|
| 696 | +#define BACKWARDS_COMPAT_PROP(name, type) \ |
|---|
| 697 | + { \ |
|---|
| 698 | + KBASE_GPUPROP_##name, SIZE_MAX, sizeof(type) \ |
|---|
| 699 | + } |
|---|
| 700 | + BACKWARDS_COMPAT_PROP(NUM_EXEC_ENGINES, u8), |
|---|
| 701 | +#else |
|---|
| 702 | + PROP(NUM_EXEC_ENGINES, core_props.num_exec_engines), |
|---|
| 703 | +#endif |
|---|
| 699 | 704 | |
|---|
| 700 | | - PROP(TILER_BIN_SIZE_BYTES, tiler_props.bin_size_bytes), |
|---|
| 701 | | - PROP(TILER_MAX_ACTIVE_LEVELS, tiler_props.max_active_levels), |
|---|
| 705 | + PROP(L2_LOG2_LINE_SIZE, l2_props.log2_line_size), |
|---|
| 706 | + PROP(L2_LOG2_CACHE_SIZE, l2_props.log2_cache_size), |
|---|
| 707 | + PROP(L2_NUM_L2_SLICES, l2_props.num_l2_slices), |
|---|
| 702 | 708 | |
|---|
| 703 | | - PROP(MAX_THREADS, thread_props.max_threads), |
|---|
| 704 | | - PROP(MAX_WORKGROUP_SIZE, thread_props.max_workgroup_size), |
|---|
| 705 | | - PROP(MAX_BARRIER_SIZE, thread_props.max_barrier_size), |
|---|
| 706 | | - PROP(MAX_REGISTERS, thread_props.max_registers), |
|---|
| 707 | | - PROP(MAX_TASK_QUEUE, thread_props.max_task_queue), |
|---|
| 708 | | - PROP(MAX_THREAD_GROUP_SPLIT, thread_props.max_thread_group_split), |
|---|
| 709 | | - PROP(IMPL_TECH, thread_props.impl_tech), |
|---|
| 710 | | - PROP(TLS_ALLOC, thread_props.tls_alloc), |
|---|
| 709 | + PROP(TILER_BIN_SIZE_BYTES, tiler_props.bin_size_bytes), |
|---|
| 710 | + PROP(TILER_MAX_ACTIVE_LEVELS, tiler_props.max_active_levels), |
|---|
| 711 | 711 | |
|---|
| 712 | | - PROP(RAW_SHADER_PRESENT, raw_props.shader_present), |
|---|
| 713 | | - PROP(RAW_TILER_PRESENT, raw_props.tiler_present), |
|---|
| 714 | | - PROP(RAW_L2_PRESENT, raw_props.l2_present), |
|---|
| 715 | | - PROP(RAW_STACK_PRESENT, raw_props.stack_present), |
|---|
| 716 | | - PROP(RAW_L2_FEATURES, raw_props.l2_features), |
|---|
| 717 | | - PROP(RAW_CORE_FEATURES, raw_props.core_features), |
|---|
| 718 | | - PROP(RAW_MEM_FEATURES, raw_props.mem_features), |
|---|
| 719 | | - PROP(RAW_MMU_FEATURES, raw_props.mmu_features), |
|---|
| 720 | | - PROP(RAW_AS_PRESENT, raw_props.as_present), |
|---|
| 721 | | - PROP(RAW_JS_PRESENT, raw_props.js_present), |
|---|
| 722 | | - PROP(RAW_JS_FEATURES_0, raw_props.js_features[0]), |
|---|
| 723 | | - PROP(RAW_JS_FEATURES_1, raw_props.js_features[1]), |
|---|
| 724 | | - PROP(RAW_JS_FEATURES_2, raw_props.js_features[2]), |
|---|
| 725 | | - PROP(RAW_JS_FEATURES_3, raw_props.js_features[3]), |
|---|
| 726 | | - PROP(RAW_JS_FEATURES_4, raw_props.js_features[4]), |
|---|
| 727 | | - PROP(RAW_JS_FEATURES_5, raw_props.js_features[5]), |
|---|
| 728 | | - PROP(RAW_JS_FEATURES_6, raw_props.js_features[6]), |
|---|
| 729 | | - PROP(RAW_JS_FEATURES_7, raw_props.js_features[7]), |
|---|
| 730 | | - PROP(RAW_JS_FEATURES_8, raw_props.js_features[8]), |
|---|
| 731 | | - PROP(RAW_JS_FEATURES_9, raw_props.js_features[9]), |
|---|
| 732 | | - PROP(RAW_JS_FEATURES_10, raw_props.js_features[10]), |
|---|
| 733 | | - PROP(RAW_JS_FEATURES_11, raw_props.js_features[11]), |
|---|
| 734 | | - PROP(RAW_JS_FEATURES_12, raw_props.js_features[12]), |
|---|
| 735 | | - PROP(RAW_JS_FEATURES_13, raw_props.js_features[13]), |
|---|
| 736 | | - PROP(RAW_JS_FEATURES_14, raw_props.js_features[14]), |
|---|
| 737 | | - PROP(RAW_JS_FEATURES_15, raw_props.js_features[15]), |
|---|
| 738 | | - PROP(RAW_TILER_FEATURES, raw_props.tiler_features), |
|---|
| 739 | | - PROP(RAW_TEXTURE_FEATURES_0, raw_props.texture_features[0]), |
|---|
| 740 | | - PROP(RAW_TEXTURE_FEATURES_1, raw_props.texture_features[1]), |
|---|
| 741 | | - PROP(RAW_TEXTURE_FEATURES_2, raw_props.texture_features[2]), |
|---|
| 742 | | - PROP(RAW_TEXTURE_FEATURES_3, raw_props.texture_features[3]), |
|---|
| 743 | | - PROP(RAW_GPU_ID, raw_props.gpu_id), |
|---|
| 744 | | - PROP(RAW_THREAD_MAX_THREADS, raw_props.thread_max_threads), |
|---|
| 745 | | - PROP(RAW_THREAD_MAX_WORKGROUP_SIZE, |
|---|
| 746 | | - raw_props.thread_max_workgroup_size), |
|---|
| 712 | + PROP(MAX_THREADS, thread_props.max_threads), |
|---|
| 713 | + PROP(MAX_WORKGROUP_SIZE, thread_props.max_workgroup_size), |
|---|
| 714 | + PROP(MAX_BARRIER_SIZE, thread_props.max_barrier_size), |
|---|
| 715 | + PROP(MAX_REGISTERS, thread_props.max_registers), |
|---|
| 716 | + PROP(MAX_TASK_QUEUE, thread_props.max_task_queue), |
|---|
| 717 | + PROP(MAX_THREAD_GROUP_SPLIT, thread_props.max_thread_group_split), |
|---|
| 718 | + PROP(IMPL_TECH, thread_props.impl_tech), |
|---|
| 719 | + PROP(TLS_ALLOC, thread_props.tls_alloc), |
|---|
| 720 | + |
|---|
| 721 | + PROP(RAW_SHADER_PRESENT, raw_props.shader_present), |
|---|
| 722 | + PROP(RAW_TILER_PRESENT, raw_props.tiler_present), |
|---|
| 723 | + PROP(RAW_L2_PRESENT, raw_props.l2_present), |
|---|
| 724 | + PROP(RAW_STACK_PRESENT, raw_props.stack_present), |
|---|
| 725 | + PROP(RAW_L2_FEATURES, raw_props.l2_features), |
|---|
| 726 | + PROP(RAW_CORE_FEATURES, raw_props.core_features), |
|---|
| 727 | + PROP(RAW_MEM_FEATURES, raw_props.mem_features), |
|---|
| 728 | + PROP(RAW_MMU_FEATURES, raw_props.mmu_features), |
|---|
| 729 | + PROP(RAW_AS_PRESENT, raw_props.as_present), |
|---|
| 730 | + PROP(RAW_JS_PRESENT, raw_props.js_present), |
|---|
| 731 | + PROP(RAW_JS_FEATURES_0, raw_props.js_features[0]), |
|---|
| 732 | + PROP(RAW_JS_FEATURES_1, raw_props.js_features[1]), |
|---|
| 733 | + PROP(RAW_JS_FEATURES_2, raw_props.js_features[2]), |
|---|
| 734 | + PROP(RAW_JS_FEATURES_3, raw_props.js_features[3]), |
|---|
| 735 | + PROP(RAW_JS_FEATURES_4, raw_props.js_features[4]), |
|---|
| 736 | + PROP(RAW_JS_FEATURES_5, raw_props.js_features[5]), |
|---|
| 737 | + PROP(RAW_JS_FEATURES_6, raw_props.js_features[6]), |
|---|
| 738 | + PROP(RAW_JS_FEATURES_7, raw_props.js_features[7]), |
|---|
| 739 | + PROP(RAW_JS_FEATURES_8, raw_props.js_features[8]), |
|---|
| 740 | + PROP(RAW_JS_FEATURES_9, raw_props.js_features[9]), |
|---|
| 741 | + PROP(RAW_JS_FEATURES_10, raw_props.js_features[10]), |
|---|
| 742 | + PROP(RAW_JS_FEATURES_11, raw_props.js_features[11]), |
|---|
| 743 | + PROP(RAW_JS_FEATURES_12, raw_props.js_features[12]), |
|---|
| 744 | + PROP(RAW_JS_FEATURES_13, raw_props.js_features[13]), |
|---|
| 745 | + PROP(RAW_JS_FEATURES_14, raw_props.js_features[14]), |
|---|
| 746 | + PROP(RAW_JS_FEATURES_15, raw_props.js_features[15]), |
|---|
| 747 | + PROP(RAW_TILER_FEATURES, raw_props.tiler_features), |
|---|
| 748 | + PROP(RAW_TEXTURE_FEATURES_0, raw_props.texture_features[0]), |
|---|
| 749 | + PROP(RAW_TEXTURE_FEATURES_1, raw_props.texture_features[1]), |
|---|
| 750 | + PROP(RAW_TEXTURE_FEATURES_2, raw_props.texture_features[2]), |
|---|
| 751 | + PROP(RAW_TEXTURE_FEATURES_3, raw_props.texture_features[3]), |
|---|
| 752 | + PROP(RAW_GPU_ID, raw_props.gpu_id), |
|---|
| 753 | + PROP(RAW_THREAD_MAX_THREADS, raw_props.thread_max_threads), |
|---|
| 754 | + PROP(RAW_THREAD_MAX_WORKGROUP_SIZE, raw_props.thread_max_workgroup_size), |
|---|
| 747 | 755 | PROP(RAW_THREAD_MAX_BARRIER_SIZE, raw_props.thread_max_barrier_size), |
|---|
| 748 | | - PROP(RAW_THREAD_FEATURES, raw_props.thread_features), |
|---|
| 749 | | - PROP(RAW_THREAD_TLS_ALLOC, raw_props.thread_tls_alloc), |
|---|
| 750 | | - PROP(RAW_COHERENCY_MODE, raw_props.coherency_mode), |
|---|
| 751 | | - PROP(RAW_GPU_FEATURES, raw_props.gpu_features), |
|---|
| 752 | | - PROP(COHERENCY_NUM_GROUPS, coherency_info.num_groups), |
|---|
| 753 | | - PROP(COHERENCY_NUM_CORE_GROUPS, coherency_info.num_core_groups), |
|---|
| 754 | | - PROP(COHERENCY_COHERENCY, coherency_info.coherency), |
|---|
| 755 | | - PROP(COHERENCY_GROUP_0, coherency_info.group[0].core_mask), |
|---|
| 756 | | - PROP(COHERENCY_GROUP_1, coherency_info.group[1].core_mask), |
|---|
| 757 | | - PROP(COHERENCY_GROUP_2, coherency_info.group[2].core_mask), |
|---|
| 758 | | - PROP(COHERENCY_GROUP_3, coherency_info.group[3].core_mask), |
|---|
| 759 | | - PROP(COHERENCY_GROUP_4, coherency_info.group[4].core_mask), |
|---|
| 760 | | - PROP(COHERENCY_GROUP_5, coherency_info.group[5].core_mask), |
|---|
| 761 | | - PROP(COHERENCY_GROUP_6, coherency_info.group[6].core_mask), |
|---|
| 762 | | - PROP(COHERENCY_GROUP_7, coherency_info.group[7].core_mask), |
|---|
| 763 | | - PROP(COHERENCY_GROUP_8, coherency_info.group[8].core_mask), |
|---|
| 764 | | - PROP(COHERENCY_GROUP_9, coherency_info.group[9].core_mask), |
|---|
| 765 | | - PROP(COHERENCY_GROUP_10, coherency_info.group[10].core_mask), |
|---|
| 766 | | - PROP(COHERENCY_GROUP_11, coherency_info.group[11].core_mask), |
|---|
| 767 | | - PROP(COHERENCY_GROUP_12, coherency_info.group[12].core_mask), |
|---|
| 768 | | - PROP(COHERENCY_GROUP_13, coherency_info.group[13].core_mask), |
|---|
| 769 | | - PROP(COHERENCY_GROUP_14, coherency_info.group[14].core_mask), |
|---|
| 770 | | - PROP(COHERENCY_GROUP_15, coherency_info.group[15].core_mask), |
|---|
| 756 | + PROP(RAW_THREAD_FEATURES, raw_props.thread_features), |
|---|
| 757 | + PROP(RAW_COHERENCY_MODE, raw_props.coherency_mode), |
|---|
| 758 | + PROP(RAW_THREAD_TLS_ALLOC, raw_props.thread_tls_alloc), |
|---|
| 759 | + PROP(RAW_GPU_FEATURES, raw_props.gpu_features), |
|---|
| 760 | + PROP(COHERENCY_NUM_GROUPS, coherency_info.num_groups), |
|---|
| 761 | + PROP(COHERENCY_NUM_CORE_GROUPS, coherency_info.num_core_groups), |
|---|
| 762 | + PROP(COHERENCY_COHERENCY, coherency_info.coherency), |
|---|
| 763 | + PROP(COHERENCY_GROUP_0, coherency_info.group[0].core_mask), |
|---|
| 764 | + PROP(COHERENCY_GROUP_1, coherency_info.group[1].core_mask), |
|---|
| 765 | + PROP(COHERENCY_GROUP_2, coherency_info.group[2].core_mask), |
|---|
| 766 | + PROP(COHERENCY_GROUP_3, coherency_info.group[3].core_mask), |
|---|
| 767 | + PROP(COHERENCY_GROUP_4, coherency_info.group[4].core_mask), |
|---|
| 768 | + PROP(COHERENCY_GROUP_5, coherency_info.group[5].core_mask), |
|---|
| 769 | + PROP(COHERENCY_GROUP_6, coherency_info.group[6].core_mask), |
|---|
| 770 | + PROP(COHERENCY_GROUP_7, coherency_info.group[7].core_mask), |
|---|
| 771 | + PROP(COHERENCY_GROUP_8, coherency_info.group[8].core_mask), |
|---|
| 772 | + PROP(COHERENCY_GROUP_9, coherency_info.group[9].core_mask), |
|---|
| 773 | + PROP(COHERENCY_GROUP_10, coherency_info.group[10].core_mask), |
|---|
| 774 | + PROP(COHERENCY_GROUP_11, coherency_info.group[11].core_mask), |
|---|
| 775 | + PROP(COHERENCY_GROUP_12, coherency_info.group[12].core_mask), |
|---|
| 776 | + PROP(COHERENCY_GROUP_13, coherency_info.group[13].core_mask), |
|---|
| 777 | + PROP(COHERENCY_GROUP_14, coherency_info.group[14].core_mask), |
|---|
| 778 | + PROP(COHERENCY_GROUP_15, coherency_info.group[15].core_mask), |
|---|
| 771 | 779 | |
|---|
| 772 | 780 | #undef PROP |
|---|
| 773 | 781 | }; |
|---|
| .. | .. |
|---|
| 787 | 795 | } |
|---|
| 788 | 796 | |
|---|
| 789 | 797 | kprops->prop_buffer_size = size; |
|---|
| 790 | | - kprops->prop_buffer = kmalloc(size, GFP_KERNEL); |
|---|
| 798 | + kprops->prop_buffer = kzalloc(size, GFP_KERNEL); |
|---|
| 791 | 799 | |
|---|
| 792 | 800 | if (!kprops->prop_buffer) { |
|---|
| 793 | 801 | kprops->prop_buffer_size = 0; |
|---|
| .. | .. |
|---|
| 804 | 812 | for (i = 0; i < count; i++) { |
|---|
| 805 | 813 | u32 type = gpu_property_mapping[i].type; |
|---|
| 806 | 814 | u8 type_size; |
|---|
| 807 | | - void *field = ((u8 *)props) + gpu_property_mapping[i].offset; |
|---|
| 815 | + const size_t offset = gpu_property_mapping[i].offset; |
|---|
| 816 | + const u64 dummy_backwards_compat_value = (u64)0; |
|---|
| 817 | + const void *field; |
|---|
| 818 | + |
|---|
| 819 | + if (likely(offset < sizeof(struct base_gpu_props))) |
|---|
| 820 | + field = ((const u8 *)props) + offset; |
|---|
| 821 | + else |
|---|
| 822 | + field = &dummy_backwards_compat_value; |
|---|
| 808 | 823 | |
|---|
| 809 | 824 | switch (gpu_property_mapping[i].size) { |
|---|
| 810 | 825 | case 1: |
|---|
| .. | .. |
|---|
| 830 | 845 | |
|---|
| 831 | 846 | switch (type_size) { |
|---|
| 832 | 847 | case KBASE_GPUPROP_VALUE_SIZE_U8: |
|---|
| 833 | | - WRITE_U8(*((u8 *)field)); |
|---|
| 848 | + WRITE_U8(*((const u8 *)field)); |
|---|
| 834 | 849 | break; |
|---|
| 835 | 850 | case KBASE_GPUPROP_VALUE_SIZE_U16: |
|---|
| 836 | | - WRITE_U16(*((u16 *)field)); |
|---|
| 851 | + WRITE_U16(*((const u16 *)field)); |
|---|
| 837 | 852 | break; |
|---|
| 838 | 853 | case KBASE_GPUPROP_VALUE_SIZE_U32: |
|---|
| 839 | | - WRITE_U32(*((u32 *)field)); |
|---|
| 854 | + WRITE_U32(*((const u32 *)field)); |
|---|
| 840 | 855 | break; |
|---|
| 841 | 856 | case KBASE_GPUPROP_VALUE_SIZE_U64: |
|---|
| 842 | | - WRITE_U64(*((u64 *)field)); |
|---|
| 857 | + WRITE_U64(*((const u64 *)field)); |
|---|
| 843 | 858 | break; |
|---|
| 844 | 859 | default: /* Cannot be reached */ |
|---|
| 845 | 860 | WARN_ON(1); |
|---|