Commit b616eebc authored by Ankit Agrawal's avatar Ankit Agrawal Committed by Tomasz Nowicki
Browse files

BACKPORT: KVM: arm64: Set io memory s2 pte as normalnc for vfio pci device



To provide VM with the ability to get device IO memory with NormalNC
property, map device MMIO in KVM for ARM64 at stage2 as NormalNC.
Having NormalNC S2 default puts guests in control (based on [1],
"Combining stage 1 and stage 2 memory type attributes") of device
MMIO regions memory mappings. The rules are summarized below:
([(S1) - stage1], [(S2) - stage 2])

S1           |  S2           | Result
NORMAL-WB    |  NORMAL-NC    | NORMAL-NC
NORMAL-WT    |  NORMAL-NC    | NORMAL-NC
NORMAL-NC    |  NORMAL-NC    | NORMAL-NC
DEVICE<attr> |  NORMAL-NC    | DEVICE<attr>

Still this cannot be generalized to non PCI devices such as GICv2.
There is insufficient information and uncertainity in the behavior
of non PCI driver. A driver must indicate support using the
new flag VM_ALLOW_ANY_UNCACHED.

Adapt KVM to make use of the flag VM_ALLOW_ANY_UNCACHED as indicator to
activate the S2 setting to NormalNc.

[1] section D8.5.5 of DDI0487J_a_a-profile_architecture_reference_manual.pdf

Suggested-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Acked-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Reviewed-by: default avatarMarc Zyngier <maz@kernel.org>
Signed-off-by: default avatarAnkit Agrawal <ankita@nvidia.com>
Link: https://lore.kernel.org/r/20240224150546.368-4-ankita@nvidia.com


Signed-off-by: default avatarOliver Upton <oliver.upton@linux.dev>

(cherry picked from commit 8c47ce3e)
[fix conflict with
 d8569fba("arm64: kvm: Use cpus_have_final_cap() explicitly")]

BUG=b:360295883
TEST=open play store

Change-Id: I890c89eed8819cfbf826b4c0b04f038020887567
Signed-off-by: default avatarHsin-Yi Wang <hsinyi@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/5898308


Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
Signed-off-by: default avatarMateusz Urbańczyk <urbanczyk@google.com>
parent 708d599b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment