From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-eopbgr710095.outbound.protection.outlook.com ([40.107.71.95]:48060 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729527AbeIGFPu (ORCPT ); Fri, 7 Sep 2018 01:15:50 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Yoshihiro Shimoda , Joerg Roedel , Sasha Levin Subject: [PATCH AUTOSEL 4.18 82/88] iommu/ipmmu-vmsa: IMUCTRn.TTSEL needs a special usage on R-Car Gen3 Date: Fri, 7 Sep 2018 00:36:49 +0000 Message-ID: <20180907003547.57567-82-alexander.levin@microsoft.com> References: <20180907003547.57567-1-alexander.levin@microsoft.com> In-Reply-To: <20180907003547.57567-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Yoshihiro Shimoda [ Upstream commit 2ae86955703e9e6a119af4bbe27f6b6dd7a43131 ] 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 =3D 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 Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- drivers/iommu/ipmmu-vmsa.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index 40ae6e87cb88..559ecdf84729 100644 --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ipmmu-vmsa.c @@ -47,6 +47,7 @@ struct ipmmu_features { unsigned int number_of_contexts; bool setup_imbuscr; bool twobit_imttbcr_sl0; + bool reserved_context; }; =20 struct ipmmu_vmsa_device { @@ -917,6 +918,7 @@ static const struct ipmmu_features ipmmu_features_defau= lt =3D { .number_of_contexts =3D 1, /* software only tested with one context */ .setup_imbuscr =3D true, .twobit_imttbcr_sl0 =3D false, + .reserved_context =3D false, }; =20 static const struct ipmmu_features ipmmu_features_r8a7795 =3D { @@ -925,6 +927,7 @@ static const struct ipmmu_features ipmmu_features_r8a77= 95 =3D { .number_of_contexts =3D 8, .setup_imbuscr =3D false, .twobit_imttbcr_sl0 =3D true, + .reserved_context =3D true, }; =20 static const struct of_device_id ipmmu_of_ids[] =3D { @@ -1018,6 +1021,11 @@ static int ipmmu_probe(struct platform_device *pdev) } =20 ipmmu_device_reset(mmu); + + if (mmu->features->reserved_context) { + dev_info(&pdev->dev, "IPMMU context 0 is reserved\n"); + set_bit(0, mmu->ctx); + } } =20 /* --=20 2.17.1