ANDROID: Revert "ANDROID: iommu/arm-smmu: Allow inherting stream mapping from bootloader"
It breaks the build with the 5.7-rc1 merge and needs to be fixed up as it did not go upstream. Bug: 146449535 Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Id2421f26e0947b486bb4e954928d907c499defa6
This commit is contained in:
parent
2724136fc5
commit
2aba289218
@ -3,7 +3,6 @@
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
|
||||
#include "arm-smmu.h"
|
||||
@ -12,39 +11,6 @@ struct qcom_smmu {
|
||||
struct arm_smmu_device smmu;
|
||||
};
|
||||
|
||||
static int qcom_sdm845_smmu500_cfg_probe(struct arm_smmu_device *smmu)
|
||||
{
|
||||
u32 s2cr;
|
||||
u32 smr;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < smmu->num_mapping_groups; i++) {
|
||||
smr = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_SMR(i));
|
||||
s2cr = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_S2CR(i));
|
||||
|
||||
smmu->smrs[i].mask = FIELD_GET(ARM_SMMU_SMR_MASK, smr);
|
||||
smmu->smrs[i].id = FIELD_GET(ARM_SMMU_SMR_ID, smr);
|
||||
if (smmu->features & ARM_SMMU_FEAT_EXIDS)
|
||||
smmu->smrs[i].valid = FIELD_GET(ARM_SMMU_S2CR_EXIDVALID, s2cr);
|
||||
else
|
||||
smmu->smrs[i].valid = FIELD_GET(ARM_SMMU_SMR_VALID, smr);
|
||||
|
||||
smmu->s2crs[i].group = NULL;
|
||||
smmu->s2crs[i].count = 0;
|
||||
smmu->s2crs[i].type = FIELD_GET(ARM_SMMU_S2CR_TYPE, s2cr);
|
||||
smmu->s2crs[i].privcfg = FIELD_GET(ARM_SMMU_S2CR_PRIVCFG, s2cr);
|
||||
smmu->s2crs[i].cbndx = FIELD_GET(ARM_SMMU_S2CR_CBNDX, s2cr);
|
||||
|
||||
if (!smmu->smrs[i].valid)
|
||||
continue;
|
||||
|
||||
smmu->s2crs[i].pinned = true;
|
||||
bitmap_set(smmu->context_map, smmu->s2crs[i].cbndx, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qcom_sdm845_smmu500_reset(struct arm_smmu_device *smmu)
|
||||
{
|
||||
int ret;
|
||||
@ -65,7 +31,6 @@ static int qcom_sdm845_smmu500_reset(struct arm_smmu_device *smmu)
|
||||
}
|
||||
|
||||
static const struct arm_smmu_impl qcom_smmu_impl = {
|
||||
.cfg_probe = qcom_sdm845_smmu500_cfg_probe,
|
||||
.reset = qcom_sdm845_smmu500_reset,
|
||||
};
|
||||
|
||||
|
@ -223,19 +223,9 @@ static int arm_smmu_register_legacy_master(struct device *dev,
|
||||
}
|
||||
#endif /* CONFIG_ARM_SMMU_LEGACY_DT_BINDINGS */
|
||||
|
||||
static int __arm_smmu_alloc_cb(struct arm_smmu_device *smmu, int start,
|
||||
struct device *dev)
|
||||
static int __arm_smmu_alloc_bitmap(unsigned long *map, int start, int end)
|
||||
{
|
||||
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
|
||||
unsigned long *map = smmu->context_map;
|
||||
int end = smmu->num_context_banks;
|
||||
int idx;
|
||||
int i;
|
||||
|
||||
for_each_cfg_sme(fwspec, i, idx) {
|
||||
if (smmu->s2crs[idx].pinned)
|
||||
return smmu->s2crs[idx].cbndx;
|
||||
}
|
||||
|
||||
do {
|
||||
idx = find_next_zero_bit(map, end, start);
|
||||
@ -660,8 +650,7 @@ static void arm_smmu_write_context_bank(struct arm_smmu_device *smmu, int idx)
|
||||
}
|
||||
|
||||
static int arm_smmu_init_domain_context(struct iommu_domain *domain,
|
||||
struct arm_smmu_device *smmu,
|
||||
struct device *dev)
|
||||
struct arm_smmu_device *smmu)
|
||||
{
|
||||
int irq, start, ret = 0;
|
||||
unsigned long ias, oas;
|
||||
@ -775,7 +764,8 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
|
||||
ret = -EINVAL;
|
||||
goto out_unlock;
|
||||
}
|
||||
ret = __arm_smmu_alloc_cb(smmu, start, dev);
|
||||
ret = __arm_smmu_alloc_bitmap(smmu->context_map, start,
|
||||
smmu->num_context_banks);
|
||||
if (ret < 0)
|
||||
goto out_unlock;
|
||||
|
||||
@ -1042,19 +1032,12 @@ static int arm_smmu_find_sme(struct arm_smmu_device *smmu, u16 id, u16 mask)
|
||||
|
||||
static bool arm_smmu_free_sme(struct arm_smmu_device *smmu, int idx)
|
||||
{
|
||||
bool pinned = smmu->s2crs[idx].pinned;
|
||||
u8 cbndx = smmu->s2crs[idx].cbndx;;
|
||||
|
||||
if (--smmu->s2crs[idx].count)
|
||||
return false;
|
||||
|
||||
smmu->s2crs[idx] = s2cr_init_val;
|
||||
if (pinned) {
|
||||
smmu->s2crs[idx].pinned = true;
|
||||
smmu->s2crs[idx].cbndx = cbndx;
|
||||
} else if (smmu->smrs) {
|
||||
if (smmu->smrs)
|
||||
smmu->smrs[idx].valid = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1191,7 +1174,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
|
||||
return ret;
|
||||
|
||||
/* Ensure that the domain is finalised */
|
||||
ret = arm_smmu_init_domain_context(domain, smmu, dev);
|
||||
ret = arm_smmu_init_domain_context(domain, smmu);
|
||||
if (ret < 0)
|
||||
goto rpm_put;
|
||||
|
||||
|
@ -257,7 +257,6 @@ struct arm_smmu_s2cr {
|
||||
enum arm_smmu_s2cr_type type;
|
||||
enum arm_smmu_s2cr_privcfg privcfg;
|
||||
u8 cbndx;
|
||||
bool pinned;
|
||||
};
|
||||
|
||||
struct arm_smmu_smr {
|
||||
|
Loading…
Reference in New Issue
Block a user