blob: 8d692ec32445cf892d271058a111ea4af6408a98 [file] [log] [blame]
// 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: [
"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",
],
},
{
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",
},
{
config: "fuchsia.sysmem.FixedContiguousMemorySize",
key: "contiguous_memory_size",
type: "int64",
availability: "optional",
},
{
config: "fuchsia.sysmem.PercentContiguousMemorySize",
key: "contiguous_memory_size_percent",
type: "int32",
availability: "optional",
},
{
config: "fuchsia.sysmem.FixedProtectedMemorySize",
key: "protected_memory_size",
type: "int64",
availability: "optional",
},
{
config: "fuchsia.sysmem.PercentProtectedMemorySize",
key: "protected_memory_size_percent",
type: "int32",
availability: "optional",
},
{
config: "fuchsia.sysmem.ContiguousGuardPagesUnused",
key: "contiguous_guard_pages_unused",
type: "bool",
availability: "optional",
},
{
// 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",
},
],
config: {
// 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.
contiguous_memory_size: { type: "int64" },
// 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.
contiguous_memory_size_percent: { type: "int32" },
// If value is less than 0 then it is ignored. The value is in bytes, and will be rounded up
// to page size alignment.
protected_memory_size: { type: "int64" },
// 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.
protected_memory_size_percent: { type: "int32" },
// If true, sysmem crashes on a guard page violation. The default is false.
contiguous_guard_pages_fatal: { type: "bool" },
// If true, sysmem will create guard regions around every allocation.
contiguous_guard_pages_internal: { type: "bool" },
// 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.
contiguous_guard_pages_unused: { type: "bool" },
// 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.
contiguous_guard_pages_unused_fraction_denominator: { type: "int32" },
// If value is less than or equal to 0 then it is ignored. The default is one page.
contiguous_guard_page_count: { type: "int32" },
// If value is less or equal to 0 then it is ignored. The default is 600 seconds.
contiguous_guard_pages_unused_cycle_seconds: { type: "int32" },
// 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.
protected_ranges_disable_dynamic: { type: "bool" },
},
}