All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] intel-iommu: respect iommu=pt
@ 2015-11-24 21:53 Shaohua Li
       [not found] ` <58e2344c50053de58ceed658272ecc0f349c2f2f.1448401068.git.shli-b10kYP2dOMg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Shaohua Li @ 2015-11-24 21:53 UTC (permalink / raw)
  To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
  Cc: Kernel-team-b10kYP2dOMg, Joerg Roedel, David Woodhouse

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 <jroedel-l3A5Bk7waGM@public.gmane.org>
Cc: David Woodhouse <David.Woodhouse-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Shaohua Li <shli-b10kYP2dOMg@public.gmane.org>
---
 drivers/iommu/intel-iommu.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index f1042da..24aa0b3 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -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)
-- 
2.4.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] intel-iommu: respect iommu=pt
       [not found] ` <58e2344c50053de58ceed658272ecc0f349c2f2f.1448401068.git.shli-b10kYP2dOMg@public.gmane.org>
@ 2015-11-24 21:59   ` Woodhouse, David
       [not found]     ` <1448402349.44976.112.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Woodhouse, David @ 2015-11-24 21:59 UTC (permalink / raw)
  To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, shli-b10kYP2dOMg
  Cc: Kernel-team-b10kYP2dOMg, jroedel-l3A5Bk7waGM


[-- Attachment #1.1: Type: text/plain, Size: 1291 bytes --]

On Tue, 2015-11-24 at 13:53 -0800, Shaohua Li wrote:
> 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.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org                              Intel Corporation


[-- Attachment #1.2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3437 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] intel-iommu: respect iommu=pt
       [not found]     ` <1448402349.44976.112.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2015-11-24 22:15       ` Shaohua Li
       [not found]         ` <20151124221515.GB2106568-tb7CFzD8y5b7E6g3fPdp/g2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Shaohua Li @ 2015-11-24 22:15 UTC (permalink / raw)
  To: Woodhouse, David
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	jroedel-l3A5Bk7waGM, Kernel-team-b10kYP2dOMg

On Tue, Nov 24, 2015 at 09:59:09PM +0000, Woodhouse, David wrote:
> On Tue, 2015-11-24 at 13:53 -0800, Shaohua Li wrote:
> > 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.

Hmm, yes, it's a device with RMRR. Don't think we can ask vendor to stop
it though.
> 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
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] intel-iommu: respect iommu=pt
       [not found]         ` <20151124221515.GB2106568-tb7CFzD8y5b7E6g3fPdp/g2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
@ 2015-11-24 22:29           ` David Woodhouse
  0 siblings, 0 replies; 4+ messages in thread
From: David Woodhouse @ 2015-11-24 22:29 UTC (permalink / raw)
  To: Shaohua Li
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	jroedel-l3A5Bk7waGM, Kernel-team-b10kYP2dOMg


[-- Attachment #1.1: Type: text/plain, Size: 690 bytes --]

On Tue, 2015-11-24 at 14:15 -0800, Shaohua Li wrote:

> > 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?

> 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.

> 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.

-- 
dwmw2


[-- Attachment #1.2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5691 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-24 22:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-24 21:53 [PATCH] intel-iommu: respect iommu=pt Shaohua Li
     [not found] ` <58e2344c50053de58ceed658272ecc0f349c2f2f.1448401068.git.shli-b10kYP2dOMg@public.gmane.org>
2015-11-24 21:59   ` Woodhouse, David
     [not found]     ` <1448402349.44976.112.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-11-24 22:15       ` Shaohua Li
     [not found]         ` <20151124221515.GB2106568-tb7CFzD8y5b7E6g3fPdp/g2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2015-11-24 22:29           ` David Woodhouse

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.