@@ -1512,28 +1512,25 @@ static void __init setup_elf_hwcaps(const struct arm64_cpu_capabilities *hwcaps)
1512
1512
cap_set_elf_hwcap (hwcaps );
1513
1513
}
1514
1514
1515
- static void __update_cpu_capabilities (const struct arm64_cpu_capabilities * caps ,
1516
- u16 scope_mask , const char * info )
1515
+ static void update_cpu_capabilities (u16 scope_mask )
1517
1516
{
1517
+ int i ;
1518
+ const struct arm64_cpu_capabilities * caps ;
1519
+
1518
1520
scope_mask &= ARM64_CPUCAP_SCOPE_MASK ;
1519
- for (; caps -> matches ; caps ++ ) {
1520
- if (!(caps -> type & scope_mask ) ||
1521
+ for (i = 0 ; i < ARM64_NCAPS ; i ++ ) {
1522
+ caps = cpu_hwcaps_ptrs [i ];
1523
+ if (!caps || !(caps -> type & scope_mask ) ||
1524
+ cpus_have_cap (caps -> capability ) ||
1521
1525
!caps -> matches (caps , cpucap_default_scope (caps )))
1522
1526
continue ;
1523
1527
1524
- if (! cpus_have_cap ( caps -> capability ) && caps -> desc )
1525
- pr_info ("%s %s\n" , info , caps -> desc );
1528
+ if (caps -> desc )
1529
+ pr_info ("detected: %s\n" , caps -> desc );
1526
1530
cpus_set_cap (caps -> capability );
1527
1531
}
1528
1532
}
1529
1533
1530
- static void update_cpu_capabilities (u16 scope_mask )
1531
- {
1532
- __update_cpu_capabilities (arm64_errata , scope_mask ,
1533
- "enabling workaround for" );
1534
- __update_cpu_capabilities (arm64_features , scope_mask , "detected:" );
1535
- }
1536
-
1537
1534
static int __enable_cpu_capability (void * arg )
1538
1535
{
1539
1536
const struct arm64_cpu_capabilities * cap = arg ;
@@ -1597,16 +1594,17 @@ static void __init enable_cpu_capabilities(u16 scope_mask)
1597
1594
*
1598
1595
* Returns "false" on conflicts.
1599
1596
*/
1600
- static bool
1601
- __verify_local_cpu_caps (const struct arm64_cpu_capabilities * caps ,
1602
- u16 scope_mask )
1597
+ static bool verify_local_cpu_caps (u16 scope_mask )
1603
1598
{
1599
+ int i ;
1604
1600
bool cpu_has_cap , system_has_cap ;
1601
+ const struct arm64_cpu_capabilities * caps ;
1605
1602
1606
1603
scope_mask &= ARM64_CPUCAP_SCOPE_MASK ;
1607
1604
1608
- for (; caps -> matches ; caps ++ ) {
1609
- if (!(caps -> type & scope_mask ))
1605
+ for (i = 0 ; i < ARM64_NCAPS ; i ++ ) {
1606
+ caps = cpu_hwcaps_ptrs [i ];
1607
+ if (!caps || !(caps -> type & scope_mask ))
1610
1608
continue ;
1611
1609
1612
1610
cpu_has_cap = caps -> matches (caps , SCOPE_LOCAL_CPU );
@@ -1637,7 +1635,7 @@ __verify_local_cpu_caps(const struct arm64_cpu_capabilities *caps,
1637
1635
}
1638
1636
}
1639
1637
1640
- if (caps -> matches ) {
1638
+ if (i < ARM64_NCAPS ) {
1641
1639
pr_crit ("CPU%d: Detected conflict for capability %d (%s), System: %d, CPU: %d\n" ,
1642
1640
smp_processor_id (), caps -> capability ,
1643
1641
caps -> desc , system_has_cap , cpu_has_cap );
@@ -1647,12 +1645,6 @@ __verify_local_cpu_caps(const struct arm64_cpu_capabilities *caps,
1647
1645
return true;
1648
1646
}
1649
1647
1650
- static bool verify_local_cpu_caps (u16 scope_mask )
1651
- {
1652
- return __verify_local_cpu_caps (arm64_errata , scope_mask ) &&
1653
- __verify_local_cpu_caps (arm64_features , scope_mask );
1654
- }
1655
-
1656
1648
/*
1657
1649
* Check for CPU features that are used in early boot
1658
1650
* based on the Boot CPU value.
0 commit comments