[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20081123014037A.fujita.tomonori@lab.ntt.co.jp>
Date: Sun, 23 Nov 2008 01:40:39 +0900
From: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
To: fenghua.yu@...el.com
Cc: fujita.tomonori@....ntt.co.jp, tony.luck@...el.com,
dwmw2@...radead.org, linux-ia64@...r.kernel.org,
linux-kernel@...r.kernel.org, mingo@...e.hu
Subject: RE: [PATCH] IA64: fix VT-d dma_mapping_error
On Sat, 22 Nov 2008 08:18:02 -0800
"Yu, Fenghua" <fenghua.yu@...el.com> wrote:
>
> >+int intel_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr)
> >+{
> >+ return !dma_addr;
> >+}
>
> The implementation of inte_dma_mapping_error is incomplete.
>
> Dma_addr is valid only when it belongs to hwdev's domain. This is all about VT-d isolation fundamental.
>
> +int intel_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr)
> +{
> + struct pci_dev *pdev = to_pci_dev(hwdev);
> + struct dmar_domain *domain;
> + struct iova *iova;
> +
> + domain = find_domain(pdev);
> +
> + iova = find_iova(&domain->iovad, IOVA_PFN(dma_addr));
> + if (!iova)
> + return -EINVAL;
> + return 0;
> +}
Hmm, intel_dma_mapping_error is used to test only the value that
intel_map_single() returns. If intel_map_single() returns a non-zero
dma address, it belongs to hwdev's domain. So intel_dma_mapping_error
can simply return 1 (failure) if the dma_addr is zero.
Do I misunderstand something?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists