* [PATCH] VT-d: constrain IGD check
@ 2023-02-28 9:51 Jan Beulich
2023-03-13 14:23 ` Ping: " Jan Beulich
2023-03-14 1:47 ` Tian, Kevin
0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2023-02-28 9:51 UTC (permalink / raw
To: xen-devel@lists.xenproject.org; +Cc: Kevin Tian, Marek Marczykowski
Marking a DRHD as controlling an IGD isn't very sensible without
checking that at the very least it's a graphics device that lives at
0000:00:02.0. Re-use the reading of the class-code to control both the
clearing of "gfx_only" and the setting of "igd_drhd_address".
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
This way we also read the class code when we don't really need it, but
I think that's tolerable, and the simpler logic is preferable. The more
that with Marek's proposed patch, adjusted as suggested, we'd read
vendor and device IDs unconditionally for all devices (enumerated for a
DRHD) anyway.
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -391,15 +391,12 @@ static int __init acpi_parse_dev_scope(
if ( drhd )
{
- if ( (seg == 0) && (bus == 0) && (path->dev == 2) &&
- (path->fn == 0) )
- igd_drhd_address = drhd->address;
-
- if ( gfx_only &&
- pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
+ if ( pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
PCI_CLASS_DEVICE + 1) != 0x03
/* PCI_BASE_CLASS_DISPLAY */ )
gfx_only = false;
+ else if ( !seg && !bus && path->dev == 2 && !path->fn )
+ igd_drhd_address = drhd->address;
}
break;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Ping: [PATCH] VT-d: constrain IGD check
2023-02-28 9:51 [PATCH] VT-d: constrain IGD check Jan Beulich
@ 2023-03-13 14:23 ` Jan Beulich
2023-03-14 1:47 ` Tian, Kevin
1 sibling, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2023-03-13 14:23 UTC (permalink / raw
To: Kevin Tian; +Cc: Marek Marczykowski, xen-devel@lists.xenproject.org
On 28.02.2023 10:51, Jan Beulich wrote:
> Marking a DRHD as controlling an IGD isn't very sensible without
> checking that at the very least it's a graphics device that lives at
> 0000:00:02.0. Re-use the reading of the class-code to control both the
> clearing of "gfx_only" and the setting of "igd_drhd_address".
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Kevin?
Thanks, Jan
> ---
> This way we also read the class code when we don't really need it, but
> I think that's tolerable, and the simpler logic is preferable. The more
> that with Marek's proposed patch, adjusted as suggested, we'd read
> vendor and device IDs unconditionally for all devices (enumerated for a
> DRHD) anyway.
>
> --- a/xen/drivers/passthrough/vtd/dmar.c
> +++ b/xen/drivers/passthrough/vtd/dmar.c
> @@ -391,15 +391,12 @@ static int __init acpi_parse_dev_scope(
>
> if ( drhd )
> {
> - if ( (seg == 0) && (bus == 0) && (path->dev == 2) &&
> - (path->fn == 0) )
> - igd_drhd_address = drhd->address;
> -
> - if ( gfx_only &&
> - pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
> + if ( pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
> PCI_CLASS_DEVICE + 1) != 0x03
> /* PCI_BASE_CLASS_DISPLAY */ )
> gfx_only = false;
> + else if ( !seg && !bus && path->dev == 2 && !path->fn )
> + igd_drhd_address = drhd->address;
> }
>
> break;
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] VT-d: constrain IGD check
2023-02-28 9:51 [PATCH] VT-d: constrain IGD check Jan Beulich
2023-03-13 14:23 ` Ping: " Jan Beulich
@ 2023-03-14 1:47 ` Tian, Kevin
1 sibling, 0 replies; 3+ messages in thread
From: Tian, Kevin @ 2023-03-14 1:47 UTC (permalink / raw
To: Beulich, Jan, xen-devel@lists.xenproject.org; +Cc: Marczykowski, Marek
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Tuesday, February 28, 2023 5:52 PM
>
> Marking a DRHD as controlling an IGD isn't very sensible without
> checking that at the very least it's a graphics device that lives at
> 0000:00:02.0. Re-use the reading of the class-code to control both the
> clearing of "gfx_only" and the setting of "igd_drhd_address".
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-14 1:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-28 9:51 [PATCH] VT-d: constrain IGD check Jan Beulich
2023-03-13 14:23 ` Ping: " Jan Beulich
2023-03-14 1:47 ` Tian, Kevin
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 read-only IMAP folder(s) and NNTP newsgroup(s).