mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-12 12:25:18 +02:00
ANDROID: iommu/arm-smmu-v3-kvm: Implement reserved regions callback
Implement get_resv_regions of pKVM SMMUv3 callback. Since this does not need to go into EL2, we can use the same function as non-pKVM. So Move arm_smmu_get_resv_regions to common file shared with KVM. Bug: 277989609 Bug: 339336590 Change-Id: I3456c13d4f009f83dd6c06ccf1cf47880b7027d3 Signed-off-by: Ryan Huang <tzukui@google.com>
This commit is contained in:
parent
23b6831c7b
commit
fe188b34f7
|
@ -9,6 +9,7 @@
|
|||
#include <linux/pci.h>
|
||||
|
||||
#include "arm-smmu-v3.h"
|
||||
#include "../../dma-iommu.h"
|
||||
|
||||
struct arm_smmu_option_prop {
|
||||
u32 opt;
|
||||
|
@ -477,6 +478,21 @@ int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args)
|
|||
return iommu_fwspec_add_ids(dev, args->args, 1);
|
||||
}
|
||||
|
||||
void arm_smmu_get_resv_regions(struct device *dev, struct list_head *head)
|
||||
{
|
||||
struct iommu_resv_region *region;
|
||||
int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO;
|
||||
|
||||
region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH,
|
||||
prot, IOMMU_RESV_SW_MSI, GFP_KERNEL);
|
||||
if (!region)
|
||||
return;
|
||||
|
||||
list_add_tail(®ion->list, head);
|
||||
|
||||
iommu_dma_get_resv_regions(dev, head);
|
||||
}
|
||||
|
||||
int arm_smmu_init_one_queue(struct arm_smmu_device *smmu,
|
||||
struct arm_smmu_queue *q,
|
||||
void __iomem *page,
|
||||
|
|
|
@ -449,6 +449,7 @@ static struct iommu_ops kvm_arm_smmu_ops = {
|
|||
.capable = arm_smmu_capable,
|
||||
.device_group = arm_smmu_device_group,
|
||||
.of_xlate = arm_smmu_of_xlate,
|
||||
.get_resv_regions = arm_smmu_get_resv_regions,
|
||||
.probe_device = kvm_arm_smmu_probe_device,
|
||||
.release_device = kvm_arm_smmu_release_device,
|
||||
.domain_alloc = kvm_arm_smmu_domain_alloc,
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <linux/platform_device.h>
|
||||
|
||||
#include "arm-smmu-v3.h"
|
||||
#include "../../dma-iommu.h"
|
||||
#include "../../iommu-sva.h"
|
||||
|
||||
static bool disable_bypass = true;
|
||||
|
@ -2509,22 +2508,6 @@ static int arm_smmu_enable_nesting(struct iommu_domain *domain)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void arm_smmu_get_resv_regions(struct device *dev,
|
||||
struct list_head *head)
|
||||
{
|
||||
struct iommu_resv_region *region;
|
||||
int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO;
|
||||
|
||||
region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH,
|
||||
prot, IOMMU_RESV_SW_MSI, GFP_KERNEL);
|
||||
if (!region)
|
||||
return;
|
||||
|
||||
list_add_tail(®ion->list, head);
|
||||
|
||||
iommu_dma_get_resv_regions(dev, head);
|
||||
}
|
||||
|
||||
static int arm_smmu_dev_enable_feature(struct device *dev,
|
||||
enum iommu_dev_features feat)
|
||||
{
|
||||
|
|
|
@ -278,6 +278,7 @@ int arm_smmu_device_disable(struct arm_smmu_device *smmu);
|
|||
bool arm_smmu_capable(struct device *dev, enum iommu_cap cap);
|
||||
struct iommu_group *arm_smmu_device_group(struct device *dev);
|
||||
int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args);
|
||||
void arm_smmu_get_resv_regions(struct device *dev, struct list_head *head);
|
||||
|
||||
struct platform_device;
|
||||
int arm_smmu_fw_probe(struct platform_device *pdev,
|
||||
|
|
Loading…
Reference in New Issue
Block a user