Skip to contentSkip to conversation

intel-iommu: respect iommu=pt

PATCH In review Shaohua Li 3 participants 4 messages Nov 24, 2015 3 messages not in the archive IOMMU

lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

PATCH 1/1 intel-iommu: respect iommu=pt

Currently if a device has rmrr or the device is a pci device, passthrough is disabled even with iommu=pt. The worry is moving such devices between domains don't work. But some users don't do the domain reassignment at all, disabling passthough punish everybody. And iommu=pt is a boot option, user knows the risk. So intead of failing the passthough, just print a warning and continue the passthough.

Cc Joerg Roedel <[email protected]>
Cc David Woodhouse <[email protected]>
---
 drivers/iommu/intel-iommu.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/iommu/intel-iommu.c +6 -2
index f1042da..24aa0b3 100644
@@ -2798,8 +2798,12 @@ static int __init dev_prepare_static_identity_mapping(struct device *dev, int hw
 {
 	int ret;
 
-	if (!iommu_should_identity_map(dev, 1))
-		return 0;
+	if (!iommu_should_identity_map(dev, 1)) {
+		if (!(iommu_identity_mapping & IDENTMAP_ALL))
+			return 0;
+		WARN_ONCE(true, "IOMMU passthough is forced on, some devices "
+			"might not work because of device/platform limitations\n");
+	}
 
 	ret = domain_add_dev_info(si_domain, dev);
 	if (!ret)
Signature · 1 line
2.4.6

A message that is not in the archive (sent off-list or not yet received): 58e2344c50053de58ceed658272ecc0f349c2f2f.1448401068.git.shli-b10kYP2dOMg@public.gmane.org

#2 lore raw
Quoted 6 lines · Shaohua Li

Currently if a device has rmrr or the device is a pci device, passthrough is disabled even with iommu=pt. The worry is moving such devices between domains don't work. But some users don't do the domain reassignment at all, disabling passthough punish everybody. And iommu=pt is a boot option, user knows the risk. So intead of failing the passthough, just print a warning and continue the passthough.

We tend to suggest that iommu=pt gives you performance for the *decent* devices, while dubious devices still get translated. So your crappy 32- bit devices still get translated. And anything unfortunate enough to have an RMRR can *still* get translated.

I'm reluctant to change that. If it hurts you, kick your system vendor until they stop doing stupid things with RMRRs.

I think we also need to revisit the whole 'iommu=pt' thing anyway and define the semantics we expect across archiectures — given that SPARC and POWER are doing passthrough for 'decent' devices by *default*. So let's not tweak it right now.

Signature · 2 lines
David Woodhouse                            Open Source Technology Centre
[email protected]                              Intel Corporation

A message that is not in the archive (sent off-list or not yet received): 1448402349.44976.112.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

author
#4 lore raw
Quoted 8 lines · David
Quoted 6 lines · Shaohua Li

Currently if a device has rmrr or the device is a pci device, passthrough is disabled even with iommu=pt. The worry is moving such devices between domains don't work. But some users don't do the domain reassignment at all, disabling passthough punish everybody. And iommu=pt is a boot option, user knows the risk. So intead of failing the passthough, just print a warning and continue the passthough.

Quoted 7 lines

We tend to suggest that iommu=pt gives you performance for the *decent* devices, while dubious devices still get translated. So your crappy 32- bit devices still get translated. And anything unfortunate enough to have an RMRR can *still* get translated.

I'm reluctant to change that. If it hurts you, kick your system vendor until they stop doing stupid things with RMRRs.

Hmm, yes, it's a device with RMRR. Don't think we can ask vendor to stop it though.

Quoted 4 lines

I think we also need to revisit the whole 'iommu=pt' thing anyway and define the semantics we expect across archiectures — given that SPARC and POWER are doing passthrough for 'decent' devices by *default*. So let's not tweak it right now.

I'd really like an option to avoid the penality for RMRR devices. Would a new option like 'iommu=strictpt' work?
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

A message that is not in the archive (sent off-list or not yet received): 20151124221515.GB2106568-tb7CFzD8y5b7E6g3fPdp/[email protected]

#6 lore raw
Quoted 5 lines · Shaohua Li
Quoted 2 lines

I'm reluctant to change that. If it hurts you, kick your system vendor until they stop doing stupid things with RMRRs.

Hmm, yes, it's a device with RMRR. Don't think we can ask vendor to stop it though.

Get a new vendor?

Quoted 1 line

I'd really like an option to avoid the penality for RMRR devices.

RMRR devices should just die. It's insanely stupid in almost all cases.

Quoted 1 line

Would a new option like 'iommu=strictpt' work?

Which does what? Forces passthrough in *all* cases, even when it then has to use SWIOTLB?

I would much prefer to just accept that RMRR-afflicted devices are crippled.

Signature · 1 line
dwmw2