From: ZhenHua <zhen-hual@hp.com>
To: "Li, Zhen-Hua" <zhen-hual@hp.com>,
David Woodhouse <dwmw2@infradead.org>,
Vinod Koul <vinod.koul@intel.com>, Dan Williams <djbw@fb.com>,
David Woodhouse <dwmw2@infradead.org>
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] x86/iommu: fix dma pte address size error
Date: Thu, 13 Jun 2013 08:43:05 +0800 [thread overview]
Message-ID: <51B91599.5070006@hp.com> (raw)
In-Reply-To: <1369355756-1030-1-git-send-email-zhen-hual@hp.com>
Hi guys,
I think this patch is necessary. Please take a look at it.
Thanks
Zhen-Hua
On 05/24/2013 08:35 AM, Li, Zhen-Hua wrote:
> In Intel Vt-D specs, Chapter 9.3 Page-Table Entry,
> The size of ADDR(address) field is 12:51, but the function dma_pte_addr
> treats it as 12:63.
>
> Signed-off-by: Li, Zhen-Hua <zhen-hual@hp.com>
> ---
> drivers/iommu/intel-iommu.c | 4 ++--
> include/linux/dma_remapping.h | 2 ++
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index b4f0e28..c6d2847 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -311,10 +311,10 @@ static inline void dma_set_pte_prot(struct dma_pte *pte, unsigned long prot)
> static inline u64 dma_pte_addr(struct dma_pte *pte)
> {
> #ifdef CONFIG_64BIT
> - return pte->val & VTD_PAGE_MASK;
> + return pte->val & DMA_PTE_MASK;
> #else
> /* Must have a full atomic 64-bit read */
> - return __cmpxchg64(&pte->val, 0ULL, 0ULL) & VTD_PAGE_MASK;
> + return __cmpxchg64(&pte->val, 0ULL, 0ULL) & DMA_PTE_MASK;
> #endif
> }
>
> diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
> index 57c9a8a..7a1e212 100644
> --- a/include/linux/dma_remapping.h
> +++ b/include/linux/dma_remapping.h
> @@ -16,6 +16,8 @@
> #define DMA_PTE_WRITE (2)
> #define DMA_PTE_LARGE_PAGE (1 << 7)
> #define DMA_PTE_SNP (1 << 11)
> +#define DMA_PTE_ADD_LENGTH (40)
> +#define DMA_PTE_MASK ((((u64)1 << DMA_PTE_ADD_LENGTH) - 1) << VTD_PAGE_SHIFT)
>
> #define CONTEXT_TT_MULTI_LEVEL 0
> #define CONTEXT_TT_DEV_IOTLB 1
next prev parent reply other threads:[~2013-06-13 0:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-24 0:35 [PATCH 1/1] x86/iommu: fix dma pte address size error Li, Zhen-Hua
2013-06-13 0:43 ` ZhenHua [this message]
2013-06-14 20:16 ` Don Dutile
2013-06-17 3:38 ` Li, Zhen-Hua (USL-China)
-- strict thread matches above, loose matches on Subject: below --
2013-05-23 7:52 Li, Zhen-Hua
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=51B91599.5070006@hp.com \
--to=zhen-hual@hp.com \
--cc=djbw@fb.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vinod.koul@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox