2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-27 14:43:58 +08:00

iommu/ipmmu-vmsa: IMUCTRn.TTSEL needs a special usage on R-Car Gen3

The TTSEL bit of IMUCTRn register of R-Car Gen3 needs to be set
unused MMU context number even if uTLBs are disabled
(The MMUEN bit of IMUCTRn register = 0).
Since initial values of IMUCTRn.TTSEL on all IPMMU-domains are 0,
this patch adds a new feature "reserved_context" to reserve IPMMU
context number 0 as the unused MMU context.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
Yoshihiro Shimoda 2018-07-09 11:53:31 +09:00 committed by Joerg Roedel
parent bc24f62bf8
commit 2ae8695570

View File

@ -47,6 +47,7 @@ struct ipmmu_features {
unsigned int number_of_contexts; unsigned int number_of_contexts;
bool setup_imbuscr; bool setup_imbuscr;
bool twobit_imttbcr_sl0; bool twobit_imttbcr_sl0;
bool reserved_context;
}; };
struct ipmmu_vmsa_device { struct ipmmu_vmsa_device {
@ -925,6 +926,7 @@ static const struct ipmmu_features ipmmu_features_default = {
.number_of_contexts = 1, /* software only tested with one context */ .number_of_contexts = 1, /* software only tested with one context */
.setup_imbuscr = true, .setup_imbuscr = true,
.twobit_imttbcr_sl0 = false, .twobit_imttbcr_sl0 = false,
.reserved_context = false,
}; };
static const struct ipmmu_features ipmmu_features_rcar_gen3 = { static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
@ -933,6 +935,7 @@ static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
.number_of_contexts = 8, .number_of_contexts = 8,
.setup_imbuscr = false, .setup_imbuscr = false,
.twobit_imttbcr_sl0 = true, .twobit_imttbcr_sl0 = true,
.reserved_context = true,
}; };
static const struct of_device_id ipmmu_of_ids[] = { static const struct of_device_id ipmmu_of_ids[] = {
@ -1038,6 +1041,11 @@ static int ipmmu_probe(struct platform_device *pdev)
} }
ipmmu_device_reset(mmu); ipmmu_device_reset(mmu);
if (mmu->features->reserved_context) {
dev_info(&pdev->dev, "IPMMU context 0 is reserved\n");
set_bit(0, mmu->ctx);
}
} }
/* /*