-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates #11436 PiperOrigin-RevId: 723723715
- Loading branch information
1 parent
6194338
commit 578733b
Showing
25 changed files
with
327 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright 2025 The gVisor Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package hostarch | ||
|
||
// MemoryType specifies CPU memory access behavior with respect to a given | ||
// virtual memory mapping. | ||
type MemoryType uint8 | ||
|
||
const ( | ||
// MemoryTypeInvalid ensures that the zero value of MemoryType is invalid. | ||
MemoryTypeInvalid MemoryType = iota | ||
|
||
// MemoryTypeUncacheable is equivalent to the following architectural | ||
// memory types: | ||
// | ||
// x86: Uncacheable (UC) | ||
// ARM64: Device-nGnRnE | ||
// | ||
// TODO(gvisor.dev/issue/11436): nv-mmap.c:nv_encode_caching() | ||
// distinguishes between NV_PGPROT_UNCACHED => Normal-NC and | ||
// NV_PGPROT_UNCACHED_DEVICE => Device-nGnRnE; is this just for | ||
// performance, or required for correctness? cf. Armv8-M Architecture | ||
// Reference Manual B7.16 "Mismatched memory attributes" R_GBKH | ||
MemoryTypeUncacheable | ||
|
||
// MemoryTypeWriteCombine is equivalent to the following architectural | ||
// memory types: | ||
// | ||
// x86: Write-combining (WC) | ||
// ARM64: Normal non-cacheable | ||
// | ||
// TODO(gvisor.dev/issue/11436): This is consistent with Linux's | ||
// arch/arm64/include/asm/pgtable.h:pgprot_writecombine(). However, it also | ||
// corresponds to NV_PGPROT_WRITE_COMBINED in the Nvidia driver (rather | ||
// than NV_PGPROT_WRITE_COMBINED_DEVICE => Device-nGnRE), which on ARM64 | ||
// uses normal cacheable rather than non-cacheable on chipsets for which | ||
// PDB_PROP_CL_IS_CHIPSET_IO_COHERENT is true, which seems to be the case | ||
// on most systems. | ||
MemoryTypeWriteCombine | ||
|
||
// MemoryTypeWriteBack is equivalent to the following architectural memory | ||
// types: | ||
// | ||
// x86: Write-back (WB) | ||
// ARM64: Normal write-back cacheable | ||
MemoryTypeWriteBack | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.