All of lore.kernel.org
 help / color / mirror / Atom feed
From: Weidong Han <weidong.han@intel.com>
To: Jan Beulich <JBeulich@novell.com>
Cc: "Jiang, Yunhong" <yunhong.jiang@intel.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: VT-d device assignment may fail (regression from Xen c/s		 19805:2f1fa2215e60)
Date: Thu, 28 Oct 2010 08:31:29 +0800	[thread overview]
Message-ID: <4CC8C461.9000303@intel.com> (raw)
In-Reply-To: <4CC82A74020000780001F6FC@vpn.id2.novell.com>

Jan Beulich wrote:
>>>> On 27.10.10 at 07:43, Weidong Han <weidong.han@intel.com> wrote:
>>>>         
>> Jan Beulich wrote:
>>     
>>> The question now is whether some similar check should be restored,
>>> or whether pdev->domain should get updated earlier. This may
>>>   
>>>       
>> I prefer to add the check.
>>     
>
> Like this (not tested yet, simplifying the code a little at once):
>
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -1371,23 +1371,16 @@ static int domain_context_mapping(struct
>          if ( find_upstream_bridge(&bus, &devfn, &secbus) < 1 )
>              break;
>  
> -        /* PCIe to PCI/PCIx bridge */
> -        if ( pdev_type(bus, devfn) == DEV_TYPE_PCIe2PCI_BRIDGE )
> -        {
> -            ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn);
> -            if ( ret )
> -                return ret;
> +        ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn);
>  
> -            /*
> -             * Devices behind PCIe-to-PCI/PCIx bridge may generate
> -             * different requester-id. It may originate from devfn=0
> -             * on the secondary bus behind the bridge. Map that id
> -             * as well.
> -             */
> +        /*
> +         * Devices behind PCIe-to-PCI/PCIx bridge may generate different
> +         * requester-id. It may originate from devfn=0 on the secondary bus
> +         * behind the bridge. Map that id as well if we didn't already.
> +         */
> +        if ( !ret && pdev_type(bus, devfn) == DEV_TYPE_PCIe2PCI_BRIDGE &&
> +             (secbus != pdev->bus || pdev->devfn != 0) )
>              ret = domain_context_mapping_one(domain, drhd->iommu, secbus, 0);
> -        }
> -        else /* Legacy PCI bridge */
> -            ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn);
>  
>          break;
>  
>
>
>   
Looks good.

Regards,
Weidong

      reply	other threads:[~2010-10-28  0:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-22 10:13 VT-d device assignment may fail (regression from Xen c/s 19805:2f1fa2215e60) Jan Beulich
2010-10-25  7:05 ` Jiang, Yunhong
2010-10-25  8:58   ` Jan Beulich
2010-10-25 15:31     ` Jiang, Yunhong
2010-10-25 15:52     ` Jiang, Yunhong
2010-10-25 16:07       ` Jan Beulich
2010-10-26  3:48         ` Alfred Song
2010-10-27  5:43 ` Weidong Han
2010-10-27  9:55   ` Jan Beulich
2010-10-28  0:26     ` Weidong Han
2010-10-27 11:34   ` Jan Beulich
2010-10-28  0:31     ` Weidong Han [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CC8C461.9000303@intel.com \
    --to=weidong.han@intel.com \
    --cc=JBeulich@novell.com \
    --cc=xen-devel@lists.xensource.com \
    --cc=yunhong.jiang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.