* [PATCH] iommu/arm-smmu: Don't bypass pinned stream mappings
@ 2020-06-09 18:05 Jordan Crouse
2020-06-10 0:25 ` kernel test robot
2020-06-10 0:59 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Jordan Crouse @ 2020-06-09 18:05 UTC (permalink / raw)
To: linux-arm-msm
Cc: Patrick Daly, linux-arm-kernel, Bjorn Andersson,
Sai Prakash Ranjan, Joerg Roedel, Robin Murphy, Will Deacon,
iommu, linux-kernel
Commit 0e764a01015d ("iommu/arm-smmu: Allow client devices to select
direct mapping") sets the initial domain type to SMMU_DOMAIN_IDENTITY
for devices that select direct mapping. This ends up setting the domain
as ARM_SMMU_DOMAIN_BYPASS which causes the stream ID mappings
for the device to be programmed to S2CR_TYPE_BYPASS.
This causes a problem for stream mappings that are inherited from
the bootloader since rewriting the stream to BYPASS will disrupt the
display controller access to DDR.
This is an extension to ("iommu/arm-smmu: Allow inheriting stream mapping
from bootloader") [1] that identifies streams that are already configured
and marked them as pinned. This patch extends that to not re-write pinned
stream mappings for ARM_SMMU_DOMAIN_BYPASS domains.
[1] https://lore.kernel.org/r/20191226221709.3844244-4-bjorn.andersson@linaro.org
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
---
drivers/iommu/arm-smmu.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index c7add09f11c1..9c1e5ba948a7 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1143,6 +1143,10 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
if (type == s2cr[idx].type && cbndx == s2cr[idx].cbndx)
continue;
+ /* Don't bypasss pinned streams; leave them as they are */
+ if (type == S2CR_TYPE_BYPASS && s2cr[idx].pinned)
+ continue;
+
s2cr[idx].type = type;
s2cr[idx].privcfg = S2CR_PRIVCFG_DEFAULT;
s2cr[idx].cbndx = cbndx;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu/arm-smmu: Don't bypass pinned stream mappings
2020-06-09 18:05 [PATCH] iommu/arm-smmu: Don't bypass pinned stream mappings Jordan Crouse
@ 2020-06-10 0:25 ` kernel test robot
2020-06-10 0:59 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-06-10 0:25 UTC (permalink / raw)
To: Jordan Crouse, linux-arm-msm
Cc: kbuild-all, clang-built-linux, Patrick Daly, linux-arm-kernel,
Bjorn Andersson, Sai Prakash Ranjan, Joerg Roedel, Robin Murphy,
Will Deacon, iommu, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2736 bytes --]
Hi Jordan,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on iommu/next]
[also build test ERROR on v5.7 next-20200609]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Jordan-Crouse/iommu-arm-smmu-Don-t-bypass-pinned-stream-mappings/20200610-020733
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project bc2b70982be8f5250cd0082a7190f8b417bd4dfe)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> drivers/iommu/arm-smmu.c:1143:45: error: no member named 'pinned' in 'struct arm_smmu_s2cr'
if (type == S2CR_TYPE_BYPASS && s2cr[idx].pinned)
~~~~~~~~~ ^
1 error generated.
vim +1143 drivers/iommu/arm-smmu.c
1122
1123 static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
1124 struct arm_smmu_master_cfg *cfg,
1125 struct iommu_fwspec *fwspec)
1126 {
1127 struct arm_smmu_device *smmu = smmu_domain->smmu;
1128 struct arm_smmu_s2cr *s2cr = smmu->s2crs;
1129 u8 cbndx = smmu_domain->cfg.cbndx;
1130 enum arm_smmu_s2cr_type type;
1131 int i, idx;
1132
1133 if (smmu_domain->stage == ARM_SMMU_DOMAIN_BYPASS)
1134 type = S2CR_TYPE_BYPASS;
1135 else
1136 type = S2CR_TYPE_TRANS;
1137
1138 for_each_cfg_sme(cfg, fwspec, i, idx) {
1139 if (type == s2cr[idx].type && cbndx == s2cr[idx].cbndx)
1140 continue;
1141
1142 /* Don't bypasss pinned streams; leave them as they are */
> 1143 if (type == S2CR_TYPE_BYPASS && s2cr[idx].pinned)
1144 continue;
1145
1146 s2cr[idx].type = type;
1147 s2cr[idx].privcfg = S2CR_PRIVCFG_DEFAULT;
1148 s2cr[idx].cbndx = cbndx;
1149 arm_smmu_write_s2cr(smmu, idx);
1150 }
1151 return 0;
1152 }
1153
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 73462 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu/arm-smmu: Don't bypass pinned stream mappings
2020-06-09 18:05 [PATCH] iommu/arm-smmu: Don't bypass pinned stream mappings Jordan Crouse
2020-06-10 0:25 ` kernel test robot
@ 2020-06-10 0:59 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-06-10 0:59 UTC (permalink / raw)
To: Jordan Crouse, linux-arm-msm
Cc: kbuild-all, Patrick Daly, linux-arm-kernel, Bjorn Andersson,
Sai Prakash Ranjan, Joerg Roedel, Robin Murphy, Will Deacon,
iommu, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2647 bytes --]
Hi Jordan,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on iommu/next]
[also build test ERROR on v5.7 next-20200609]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Jordan-Crouse/iommu-arm-smmu-Don-t-bypass-pinned-stream-mappings/20200610-020733
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: riscv-allyesconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>, old ones prefixed by <<):
drivers/iommu/arm-smmu.c: In function 'arm_smmu_domain_add_master':
>> drivers/iommu/arm-smmu.c:1143:44: error: 'struct arm_smmu_s2cr' has no member named 'pinned'
1143 | if (type == S2CR_TYPE_BYPASS && s2cr[idx].pinned)
| ^
vim +1143 drivers/iommu/arm-smmu.c
1122
1123 static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
1124 struct arm_smmu_master_cfg *cfg,
1125 struct iommu_fwspec *fwspec)
1126 {
1127 struct arm_smmu_device *smmu = smmu_domain->smmu;
1128 struct arm_smmu_s2cr *s2cr = smmu->s2crs;
1129 u8 cbndx = smmu_domain->cfg.cbndx;
1130 enum arm_smmu_s2cr_type type;
1131 int i, idx;
1132
1133 if (smmu_domain->stage == ARM_SMMU_DOMAIN_BYPASS)
1134 type = S2CR_TYPE_BYPASS;
1135 else
1136 type = S2CR_TYPE_TRANS;
1137
1138 for_each_cfg_sme(cfg, fwspec, i, idx) {
1139 if (type == s2cr[idx].type && cbndx == s2cr[idx].cbndx)
1140 continue;
1141
1142 /* Don't bypasss pinned streams; leave them as they are */
> 1143 if (type == S2CR_TYPE_BYPASS && s2cr[idx].pinned)
1144 continue;
1145
1146 s2cr[idx].type = type;
1147 s2cr[idx].privcfg = S2CR_PRIVCFG_DEFAULT;
1148 s2cr[idx].cbndx = cbndx;
1149 arm_smmu_write_s2cr(smmu, idx);
1150 }
1151 return 0;
1152 }
1153
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 63402 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-10 1:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 18:05 [PATCH] iommu/arm-smmu: Don't bypass pinned stream mappings Jordan Crouse
2020-06-10 0:25 ` kernel test robot
2020-06-10 0:59 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).