Linux IOMMU Development
 help / color / mirror / Atom feed
From: Yijing Wang <wangyijing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: "Bharat.Bhushan-KZfg59tc24xl57MIdRCFDg@public.gmane.org"
	<Bharat.Bhushan-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
	Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
Cc: "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Jiang Liu <jiang.liu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Subject: Re: [PATCH v2] iommu/vt-d: Fix broken device issue when using iommu=pt
Date: Mon, 25 Aug 2014 15:13:32 +0800	[thread overview]
Message-ID: <53FAE21C.3000603@huawei.com> (raw)
In-Reply-To: <8121916dfcae4c4a9d71377081c082fc-GeMU99Gfrru4FpqPz9FowuO6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>

>> +	/* We found some strange devices in HP c7000 and other platforms, they
>> +	 * can not be enumerated by OS, and they did DMA read/write without
>> +	 * driver management. if we open iommu in these platforms, the DMA
>> read/write
>> +	 * will be blocked by IOMMU hardware. Currently, we only create identity
>> mapping
>> +	 * for the devices in OS. To fix this, add iommu=pt_force=segment:busnum
>> to
>> +	 * force to do identity mapping for the specific bus.
>> +	 */
>> +	if (iommu_pt_force_bus >= 0 && iommu_pt_force_bus >= 0) {
> 
> iommu_pt_force_bus twice?

Sharp eyes! Sorry, it should be if (iommu_pt_force_domain >= 0 && iommu_pt_force_bus >= 0).

Thanks for your good catch!

Thanks!
Yijing.

> 
> Thanks
> -Bharat
> 
>> +		int found = 0;
>> +
>> +		iommu = NULL;
>> +		for_each_active_iommu(iommu, drhd) {
>> +			if (iommu_pt_force_domain != drhd->segment)
>> +				continue;
>> +
>> +			for_each_active_dev_scope(drhd->devices, drhd->devices_cnt,
>> i, dev) {
>> +				if (!dev_is_pci(dev))
>> +					continue;
>> +
>> +				pdev = to_pci_dev(dev);
>> +				if (pdev->bus->number == iommu_pt_force_bus ||
>> +						(pdev->subordinate
>> +						 && pdev->subordinate->number <=
>> iommu_pt_force_bus
>> +						 && pdev->subordinate->busn_res.end >=
>> iommu_pt_force_bus)) {
>> +					found = 1;
>> +					break;
>> +				}
>> +			}
>> +
>> +			if (drhd->include_all) {
>> +				found = 1;
>> +				break;
>> +			}
>> +		}
>> +
>> +		if (found && iommu)
>> +			for (i = 0; i < 256; i++)
>> +				domain_context_mapping_one(si_domain, iommu,
>> iommu_pt_force_bus,
>> +						i,  hw ? CONTEXT_TT_PASS_THROUGH :
>> +						CONTEXT_TT_MULTI_LEVEL);
>> +	}
>> +
>>  	return 0;
>>  }
>>
>> --
>> 1.7.1
>>
>> _______________________________________________
>> iommu mailing list
>> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
>> https://lists.linuxfoundation.org/mailman/listinfo/iommu
> 
> .
> 


-- 
Thanks!
Yijing

  parent reply	other threads:[~2014-08-25  7:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25  6:44 [PATCH v2] iommu/vt-d: Fix broken device issue when using iommu=pt Yijing Wang
     [not found] ` <1408949099-18677-1-git-send-email-wangyijing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-08-25  6:58   ` Bharat.Bhushan-KZfg59tc24xl57MIdRCFDg
     [not found]     ` <8121916dfcae4c4a9d71377081c082fc-GeMU99Gfrru4FpqPz9FowuO6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2014-08-25  7:13       ` Yijing Wang [this message]
2014-08-25  9:15   ` Joerg Roedel
     [not found]     ` <20140825091531.GG16329-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-08-25  9:32       ` Sathya Perla
     [not found]         ` <8dada92a-19af-4b77-b917-f2d97291abbe-3RiH6ntJJkOPfaB/Gd0HpljyZtpTMMwT@public.gmane.org>
2014-08-25 11:16           ` Yijing Wang
     [not found]             ` <53FB1B09.5070209-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-08-25 12:11               ` Sathya Perla
     [not found]                 ` <8b3c2f14-d454-45f5-87ab-69e1b87f27c9-3RiH6ntJJkP8BX6JNMqfyFjyZtpTMMwT@public.gmane.org>
2014-08-25 12:47                   ` Yijing Wang
     [not found]                     ` <ff926f1d-b899-4245-93bf-3aa1b593ad7e@CMEXHTCAS1.ad.emulex.com>
     [not found]                       ` <ff926f1d-b899-4245-93bf-3aa1b593ad7e-3RiH6ntJJkP8BX6JNMqfyFjyZtpTMMwT@public.gmane.org>
2014-09-05  1:11                         ` Yijing Wang
2014-08-25 15:04                   ` David Woodhouse
     [not found]                     ` <1408979059.29915.0.camel-W2I5cNIroUsVm/YvaOjsyQ@public.gmane.org>
2014-08-26  1:51                       ` Yijing Wang
     [not found]                         ` <53FBE82B.2080105-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-08-28 16:42                           ` Linda Knippers
2014-08-26  2:03       ` Yijing Wang

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=53FAE21C.3000603@huawei.com \
    --to=wangyijing-hv44wf8li93qt0dzr+alfa@public.gmane.org \
    --cc=Bharat.Bhushan-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=jiang.liu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox