topology.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_TOPOLOGY_H
  3. #define __ASM_TOPOLOGY_H
  4. #include <linux/cpumask.h>
  5. struct cpu_topology {
  6. int thread_id;
  7. int core_id;
  8. int package_id;
  9. int llc_id;
  10. cpumask_t thread_sibling;
  11. cpumask_t core_sibling;
  12. cpumask_t llc_sibling;
  13. };
  14. extern struct cpu_topology cpu_topology[NR_CPUS];
  15. #define topology_physical_package_id(cpu) (cpu_topology[cpu].package_id)
  16. #define topology_core_id(cpu) (cpu_topology[cpu].core_id)
  17. #define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_sibling)
  18. #define topology_sibling_cpumask(cpu) (&cpu_topology[cpu].thread_sibling)
  19. #define topology_llc_cpumask(cpu) (&cpu_topology[cpu].llc_sibling)
  20. void init_cpu_topology(void);
  21. void store_cpu_topology(unsigned int cpuid);
  22. void remove_cpu_topology(unsigned int cpuid);
  23. const struct cpumask *cpu_coregroup_mask(int cpu);
  24. #ifdef CONFIG_NUMA
  25. struct pci_bus;
  26. int pcibus_to_node(struct pci_bus *bus);
  27. #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
  28. cpu_all_mask : \
  29. cpumask_of_node(pcibus_to_node(bus)))
  30. #endif /* CONFIG_NUMA */
  31. #include <linux/arch_topology.h>
  32. /* Replace task scheduler's default frequency-invariant accounting */
  33. #define arch_scale_freq_capacity topology_get_freq_scale
  34. /* Replace task scheduler's default cpu-invariant accounting */
  35. #define arch_scale_cpu_capacity topology_get_cpu_scale
  36. /* Enable topology flag updates */
  37. #define arch_update_cpu_topology topology_update_cpu_topology
  38. #include <asm-generic/topology.h>
  39. #endif /* _ASM_ARM_TOPOLOGY_H */