cpufeature.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Contains CPU feature definitions
  3. *
  4. * Copyright (C) 2015 ARM Ltd.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #define pr_fmt(fmt) "alternatives: " fmt
  19. #include <linux/types.h>
  20. #include <asm/cpu.h>
  21. #include <asm/cpufeature.h>
  22. static const struct arm64_cpu_capabilities arm64_features[] = {
  23. {},
  24. };
  25. void check_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
  26. const char *info)
  27. {
  28. int i;
  29. for (i = 0; caps[i].desc; i++) {
  30. if (!caps[i].matches(&caps[i]))
  31. continue;
  32. if (!cpus_have_cap(caps[i].capability))
  33. pr_info("%s %s\n", info, caps[i].desc);
  34. cpus_set_cap(caps[i].capability);
  35. }
  36. }
  37. void check_local_cpu_features(void)
  38. {
  39. check_cpu_capabilities(arm64_features, "detected feature");
  40. }