BACKPORT: FROMLIST: KVM: arm64: iommu: Add SMMUv3 driver
Add the skeleton for an Arm SMMUv3 driver at EL2. Link: https://lore.kernel.org/all/20241212180423.1578358-26-smostafa@google.com/ Bug: 357781595 Bug: 384432312 Change-Id: I605da2ed3075054b142eac6f6a7922f140244ca8 Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Signed-off-by: Mostafa Saleh <smostafa@google.com>
This commit is contained in:
committed by
Mostafa Saleh
parent
90565c9e2c
commit
c16a84d8e6
@@ -16,6 +16,8 @@ hyp-obj-$(CONFIG_TRACING) += clock.o events.o trace.o
|
||||
hyp-obj-$(CONFIG_MODULES) += modules.o
|
||||
hyp-obj-y += $(lib-objs)
|
||||
|
||||
hyp-obj-$(CONFIG_ARM_SMMU_V3_PKVM) += iommu/arm-smmu-v3.o
|
||||
|
||||
$(obj)/hyp.lds: $(src)/hyp.lds.S FORCE
|
||||
$(call if_changed_dep,cpp_lds_S)
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* pKVM hyp driver for the Arm SMMUv3
|
||||
*
|
||||
* Copyright (C) 2022 Linaro Ltd.
|
||||
*/
|
||||
#include <asm/kvm_hyp.h>
|
||||
#include <kvm/arm_smmu_v3.h>
|
||||
#include <nvhe/iommu.h>
|
||||
|
||||
size_t __ro_after_init kvm_hyp_arm_smmu_v3_count;
|
||||
struct hyp_arm_smmu_v3_device *kvm_hyp_arm_smmu_v3_smmus;
|
||||
|
||||
static int smmu_init(void)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
/* Shared with the kernel driver in EL1 */
|
||||
struct kvm_iommu_ops smmu_ops = {
|
||||
.init = smmu_init,
|
||||
};
|
||||
@@ -437,6 +437,15 @@ config TEGRA241_CMDQV
|
||||
CMDQ-V extension.
|
||||
endif
|
||||
|
||||
config ARM_SMMU_V3_PKVM
|
||||
bool "ARM SMMUv3 support for protected Virtual Machines"
|
||||
depends on KVM && ARM64
|
||||
help
|
||||
Enable a SMMUv3 driver in the KVM hypervisor, to protect VMs against
|
||||
memory accesses from devices owned by the host.
|
||||
|
||||
Say Y here if you intend to enable KVM in protected mode.
|
||||
|
||||
config S390_IOMMU
|
||||
def_bool y if S390 && PCI
|
||||
depends on S390 && PCI
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __KVM_ARM_SMMU_V3_H
|
||||
#define __KVM_ARM_SMMU_V3_H
|
||||
|
||||
#include <asm/kvm_asm.h>
|
||||
#include <kvm/iommu.h>
|
||||
|
||||
struct hyp_arm_smmu_v3_device {
|
||||
struct kvm_hyp_iommu iommu;
|
||||
};
|
||||
|
||||
extern size_t kvm_nvhe_sym(kvm_hyp_arm_smmu_v3_count);
|
||||
#define kvm_hyp_arm_smmu_v3_count kvm_nvhe_sym(kvm_hyp_arm_smmu_v3_count)
|
||||
|
||||
extern struct hyp_arm_smmu_v3_device *kvm_nvhe_sym(kvm_hyp_arm_smmu_v3_smmus);
|
||||
#define kvm_hyp_arm_smmu_v3_smmus kvm_nvhe_sym(kvm_hyp_arm_smmu_v3_smmus)
|
||||
|
||||
#endif /* __KVM_ARM_SMMU_V3_H */
|
||||
Reference in New Issue
Block a user