| // Copyright 2021 The Fuchsia Authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style license that can be | |
| // found in the LICENSE file. | |
| { | |
| include: [ | |
| "inspect/client.shard.cml", | |
| "syslog/client.shard.cml", | |
| ], | |
| program: { | |
| runner: "elf", | |
| binary: "bin/sysmem", | |
| }, | |
| children: [ | |
| { | |
| name: "sysmem-config", | |
| url: "fuchsia-boot:///sysmem-config#meta/sysmem-config.cm", | |
| startup: "eager", | |
| }, | |
| ], | |
| capabilities: [ | |
| { | |
| protocol: [ | |
| // Privileged backend registration protocol (for RegisterHeap / RegisterSecureMem | |
| // ONLY). Normal clients (including drivers) should use fuchsia.sysmem2.Allocator. | |
| // Only components that legitimately register a heap or securemem may `use` this. | |
| "fuchsia.hardware.sysmem.Sysmem", | |
| "fuchsia.sysmem.Allocator", | |
| "fuchsia.sysmem2.Allocator", | |
| ], | |
| }, | |
| ], | |
| use: [ | |
| { | |
| protocol: [ | |
| "fuchsia.feedback.ComponentDataRegister", | |
| "fuchsia.kernel.InfoResource", | |
| "fuchsia.kernel.IommuResource", | |
| "fuchsia.kernel.MmioResource", | |
| "fuchsia.metrics.MetricEventLoggerFactory", | |
| "fuchsia.scheduler.RoleManager", | |
| ], | |
| }, | |
| { | |
| protocol: [ "fuchsia.tracing.provider.Registry" ], | |
| // Trace manager may be excluded from builds where tracing is not | |
| // expected to be used for observability, such as in the bringup | |
| // product and non-eng builds of any product. | |
| availability: "optional", | |
| }, | |
| { | |
| // If value is less than 0 then it is ignored. The value is in | |
| // bytes, and will be rounded up to page size alignment. See | |
| // contiguous_memory_size_percent for the default. | |
| config: "fuchsia.sysmem.FixedContiguousMemorySize", | |
| key: "contiguous_memory_size", | |
| type: "int64", | |
| availability: "optional", | |
| default: -1, | |
| }, | |
| { | |
| // If value is less than 0 then it is ignored. The value is a | |
| // percent of physical RAM, and must be less than 100. If both this | |
| // value and contiguous_memory_size are greater than or equal to 0, | |
| // contiguous_memory_size wins. | |
| config: "fuchsia.sysmem.PercentContiguousMemorySize", | |
| key: "contiguous_memory_size_percent", | |
| type: "int32", | |
| availability: "optional", | |
| default: 5, | |
| }, | |
| { | |
| // If value is less than 0 then it is ignored. The value is in | |
| // bytes, and will be rounded up to page size alignment. | |
| config: "fuchsia.sysmem.FixedProtectedMemorySize", | |
| key: "protected_memory_size", | |
| type: "int64", | |
| availability: "optional", | |
| default: 0, | |
| }, | |
| { | |
| // If value is less than 0 then it is ignored. The value is a | |
| // percent of physical RAM, and must be less than 100. If both this | |
| // value and protected_memory_size are greater than or equal to 0, | |
| // protected_memory_size wins. | |
| config: "fuchsia.sysmem.PercentProtectedMemorySize", | |
| key: "protected_memory_size_percent", | |
| type: "int32", | |
| availability: "optional", | |
| default: -1, | |
| }, | |
| { | |
| // If true, sysmem crashes on a guard page violation. The default is | |
| // false. | |
| config: "fuchsia.sysmem.ContiguousGuardPagesFatal", | |
| key: "contiguous_guard_pages_fatal", | |
| type: "bool", | |
| availability: "optional", | |
| default: false, | |
| }, | |
| { | |
| // If true, sysmem will create guard regions around every | |
| // allocation. | |
| config: "fuchsia.sysmem.ContiguousGuardPagesInternal", | |
| key: "contiguous_guard_pages_internal", | |
| type: "bool", | |
| availability: "optional", | |
| default: false, | |
| }, | |
| { | |
| // If true, sysmem will treat a fraction of currently-unused pages | |
| // as guard pages and attempt to loan the rest back to zircon. If | |
| // false, sysmem will attempt to loan all currently-unused pages | |
| // back to zircon. | |
| // | |
| // Enabling this will enable periodic timers in sysmem which check | |
| // unused pages for stray DMA writes. The default is false to avoid | |
| // the periodic timers by default. When true, on detection of an | |
| // improperly written page, sysmem will attempt to log debug info | |
| // re. allocations that previously used the page. | |
| config: "fuchsia.sysmem.ContiguousGuardPagesUnused", | |
| key: "contiguous_guard_pages_unused", | |
| type: "bool", | |
| availability: "optional", | |
| default: false, | |
| }, | |
| { | |
| // When contiguous_guard_pages_unused is true and this value is > 0, | |
| // 1/contiguous_guard_pages_unused_fraction_denominator | |
| // currently-unused pages are not loaned back to zircon, and instead | |
| // become guard pages. | |
| // | |
| // Else if contiguous_guard_pages_unused is true but this value is | |
| // <= 0, the fraction kept as guard pages is 1/128. In other words | |
| // the default is 128. | |
| // | |
| // Else if contiguous_guard_pages_unused is false, this value is | |
| // ignored and all currently-unused pages are loaned back to zircon. | |
| config: "fuchsia.sysmem.ContiguousGuardPagesUnusedFractionDenominator", | |
| key: "contiguous_guard_pages_unused_fraction_denominator", | |
| type: "int32", | |
| availability: "optional", | |
| default: 128, | |
| }, | |
| { | |
| // If value is less than or equal to 0 then it is ignored. The | |
| // default is one page. | |
| config: "fuchsia.sysmem.ContiguousGuardPageCount", | |
| key: "contiguous_guard_page_count", | |
| type: "int32", | |
| availability: "optional", | |
| default: -1, | |
| }, | |
| { | |
| // If value is less or equal to 0 then it is ignored. The default is | |
| // 600 seconds. | |
| config: "fuchsia.sysmem.ContiguousGuardPagesUnusedCycleSeconds", | |
| key: "contiguous_guard_pages_unused_cycle_seconds", | |
| type: "int32", | |
| availability: "optional", | |
| default: 600, | |
| }, | |
| { | |
| // If set to true, dynamic protection / de-protection of pages of | |
| // protected_memory_size is disabled (for debugging purposes). The | |
| // default is false. Disabling this will also prevent any protected | |
| // pages from being decommitted (aka loaned) back to zircon. | |
| config: "fuchsia.sysmem.ProtectedRangesDisableDynamic", | |
| key: "protected_ranges_disable_dynamic", | |
| type: "bool", | |
| availability: "optional", | |
| default: false, | |
| }, | |
| { | |
| // This dir has a config.sysmem_config_persistent_fidl file with | |
| // de-duped format cost entries (and potentially other things that | |
| // make sense to plumb this way). | |
| directory: "sysmem-config", | |
| from: "#sysmem-config", | |
| rights: [ "r*" ], | |
| path: "/sysmem-config", | |
| }, | |
| ], | |
| expose: [ | |
| { | |
| protocol: [ | |
| "fuchsia.hardware.sysmem.Sysmem", | |
| "fuchsia.sysmem.Allocator", | |
| "fuchsia.sysmem2.Allocator", | |
| ], | |
| from: "self", | |
| }, | |
| ], | |
| } |