MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / create_pptt

Method create_pptt

vmm/src/cpu.rs:1895–1971  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

1893
1894 #[cfg(target_arch = "aarch64")]
1895 pub fn create_pptt(&self) -> Sdt {
1896 let pptt_start = 0;
1897 let mut cpus = 0;
1898 let mut uid = 0;
1899 // If topology is not specified, the default setting is:
1900 // 1 package, multiple cores, 1 thread per core
1901 // This is also the behavior when PPTT is missing.
1902 let (threads_per_core, cores_per_die, dies_per_package, packages) = self
1903 .get_vcpu_topology()
1904 .unwrap_or((1, u16::try_from(self.max_vcpus()).unwrap(), 1, 1));
1905 let cores_per_package = cores_per_die * dies_per_package;
1906
1907 let mut pptt = Sdt::new(*b"PPTT", 36, 2, *b"CLOUDH", *b"CHPPTT ", 1);
1908
1909 for cluster_idx in 0..packages {
1910 if cpus < self.config.boot_vcpus as usize {
1911 let cluster_offset = pptt.len() - pptt_start;
1912 let cluster_hierarchy_node = ProcessorHierarchyNode {
1913 r#type: 0,
1914 length: 20,
1915 reserved: 0,
1916 flags: 0x2,
1917 parent: 0,
1918 acpi_processor_id: cluster_idx as u32,
1919 num_private_resources: 0,
1920 };
1921 pptt.append(cluster_hierarchy_node);
1922
1923 for core_idx in 0..cores_per_package {
1924 let core_offset = pptt.len() - pptt_start;
1925
1926 if threads_per_core > 1 {
1927 let core_hierarchy_node = ProcessorHierarchyNode {
1928 r#type: 0,
1929 length: 20,
1930 reserved: 0,
1931 flags: 0x2,
1932 parent: cluster_offset as u32,
1933 acpi_processor_id: core_idx as u32,
1934 num_private_resources: 0,
1935 };
1936 pptt.append(core_hierarchy_node);
1937
1938 for _thread_idx in 0..threads_per_core {
1939 let thread_hierarchy_node = ProcessorHierarchyNode {
1940 r#type: 0,
1941 length: 20,
1942 reserved: 0,
1943 flags: 0xE,
1944 parent: core_offset as u32,
1945 acpi_processor_id: uid as u32,
1946 num_private_resources: 0,
1947 };
1948 pptt.append(thread_hierarchy_node);
1949 uid += 1;
1950 }
1951 } else {
1952 let thread_hierarchy_node = ProcessorHierarchyNode {

Callers 1

Calls 4

newFunction · 0.85
get_vcpu_topologyMethod · 0.80
max_vcpusMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected