video: tegra: nvmap: Add new heap for VI mempool

- The VI is allowed to access the whole of the Guest VM currently as it
is a stage-2 SMMU device. Hence it can read and write to any memory.
This may lead to breach of confidentiality and integrity. In order to
restrict the VI from accessing the whole VM, a mempool is being created
by HV that would restrict access to VI to just the mempool memory.
- In nvmap, we have some special rules for IVM carveout like if user
specify IVM carveout to allocate from, then if first IVM carveout does
not have sufficient memory then nvmap tries to allocate from next IVM
carveout. We don't want these rules applicable for VI mempool heap,
hence only carveout initialization part would remain similar to IVM
carveouts but rest of the operations would be performed normally like
any other carveout.
- Add DT binding doc for VI-carveout.

Bug 4648721

Change-Id: Ib40415a4c80da908654c86162c1cd4b50b33ef31
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3196238
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
This commit is contained in:
Ketan Patil
2024-08-19 09:16:56 +00:00
committed by Jon Hunter
parent a59a10dfeb
commit 6e5aec9ce4
3 changed files with 123 additions and 34 deletions

View File

@@ -0,0 +1,67 @@
# Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
%YAML 1.2
---
$id: http://devicetree.org/schemas/vi-carveout/nvidia,vi-carveout.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Nvidia VI Carveout
maintainers:
- Ketan Patil
description: |
This schema defines the properties for the NVIDIA VI carveout (mempool) memory
node. The reference to this DT node should be added memory-region in tegra carveout
to create the VI carveout.
select:
properties:
compatible:
minItems: 1
maxItems: 1
items:
enum:
- nvidia,vi_carveout
required:
- compatible
properties:
ivm:
description: |
A phandle to the tegra-hv node followed by the mempool id.
items:
minItems: 2
maxItems: 2
items:
- $ref: "/schemas/types.yaml#/definitions/phandle"
- $ref: "/schemas/types.yaml#/definitions/uint32"
status:
description: |
The status of the carveouts node.
enum:
- okay
- disabled
required:
- compatible
- ivm
examples:
- |
vi-carveout {
compatible = "nvidia,vi_carveout";
ivm = <&tegra_hv 3>;
status = "okay";
};