[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] IOMMU/VT-d: Fix iommu=no-igfx if the IOMMU scope contains phantom device


  • To: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 27 Feb 2023 17:55:32 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0J3ewT9MFOG2BqMeY/Msa0rH9hQug4Apo/qJD+XOAF8=; b=B3MjriUBWvm3En64ggj1lH0BLwkc+avphNkhpkqIDSb+gE8x9GhR9UK92AQZSXZ2OLDUrXPyDnRcaArmjxXZZAr8oKhVIIKoHThz6GcnMvHwQNCWzP6Mqu9K2CvaZiMzT/+3PQXN9fiVHifLb6bbolE1orLOKNsGsVjFSTCsdmuukZdChI/GRYTrKtPn4aOyTy6yALidg+Tu5MezIhaaAPR5qKX733ZkI4gD2SikRKEe5jg7vqyB6iuZdg7HK8j0Edw1YvS+UKpo4cDltFxnV9ODu888aJBDi//NFV2q017MoyUbcn3y/qgccBg5Ol/2UnNlIK6AalBdgSuZthFLVw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cA8WQKWUgoLB54fKstOXVAzWhEb+2Z5KgBcBMMuSIGu7+xsiDHRSAM99PiJZi781Ul9g02ahtst4xA4ZlPu6MgL3d7Fzsd9qGQZAgNSYZhC4uKUJL+23EIixidIR8r9pQlHYDUN/gaYRB5t6lIie77fT9Nati/JFqnFRQO9Qk73UGQ7Z7J5OCQ2mX2V3TnjWpGOl0iAFu39ey/42ctj6k05ZiZY2f9vlkXSE59vFOH9DNED8FXTDtXVR9CGU2Reox+xUKoLdsQl27ouiSgnpQO3fs1nkPTpbxJfrT5q2sVKImOSuttC2EJioZKW5s6kQCdqGwRgcPoFAGCsCPE7otg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Kevin Tian <kevin.tian@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 27 Feb 2023 16:56:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.02.2023 01:08, Marek Marczykowski-Górecki wrote:
> If the scope for IGD's IOMMU contains additional device that doesn't
> actually exist, iommu=no-igfx would not disable that IOMMU. In this
> particular case (Thinkpad x230) it included
> 00:02.1, but there is no such device on this platform.
> Consider only existing devices for "gfx only" check.
> 

Hmm, perhaps

Fixes: 2d7f191b392e ('VT-d: generalize and correct "iommu=no-igfx" handling')

?

> Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
> ---
> I have looked at existence check acpi_parse_one_drhd(), but re-using
> that one wouldn't work for two reasons:
>  - gfx_only logic is very much tied to acpi_parse_dev_scope()

I think this one could be dealt with, but ...

>  - pci_device_detect() in acpi_parse_one_drhd() is skipped in case of
>    (implicit or explicit) iommu=force

... I agree this is a good reason to put the check in acpi_parse_dev_scope().

> --- a/xen/drivers/passthrough/vtd/dmar.c
> +++ b/xen/drivers/passthrough/vtd/dmar.c
> @@ -396,6 +396,7 @@ static int __init acpi_parse_dev_scope(
>                      igd_drhd_address = drhd->address;
>  
>                  if ( gfx_only &&
> +                     pci_device_detect(seg, bus, path->dev, path->fn) &&
>                       pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
>                                      PCI_CLASS_DEVICE + 1) != 0x03
>                                      /* PCI_BASE_CLASS_DISPLAY */ )

If we're adding an existence check, then maybe better in the surrounding
if(): Setting igd_drhd_address when there's not really a device at the
designated address isn't very sensible either. (In fact I think I'm going
to alter the inner part of that if() again as well.)

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.