From: Suravee Suthikulanit <suravee.suthikulpanit@amd.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Jacob Shin <jacob.shin@amd.com>,
xiantao.zhang@intel.com, xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 2/2] AMD IOMMU: use ioremap()
Date: Wed, 10 Jul 2013 12:12:26 -0500 [thread overview]
Message-ID: <51DD95FA.9060106@amd.com> (raw)
In-Reply-To: <51DD585702000078000E3D40@nat28.tlf.novell.com>
On 7/10/2013 5:49 AM, Jan Beulich wrote:
> There's no point in using the fixmap here, and it gets
> map_iommu_mmio_region() in line with unmap_iommu_mmio_region(), which
> was already using iounmap() (thus crashing if actually used).
>
> Signed-off-by: Jan Beulich<jbeulich@suse.com>
>
> --- a/xen/drivers/passthrough/amd/iommu_init.c
> +++ b/xen/drivers/passthrough/amd/iommu_init.c
> @@ -48,19 +48,10 @@ static int iommu_has_ht_flag(struct amd_
>
> static int __init map_iommu_mmio_region(struct amd_iommu *iommu)
> {
> - unsigned long mfn;
> -
> - if ( nr_amd_iommus > MAX_AMD_IOMMUS )
> - {
> - AMD_IOMMU_DEBUG("nr_amd_iommus %d > MAX_IOMMUS\n", nr_amd_iommus);
> + iommu->mmio_base = ioremap(iommu->mmio_base_phys,
> + IOMMU_MMIO_REGION_LENGTH);
> + if ( iommu->mmio_base )
This should have been "if ( !iommu->mmio_base )".
> return -ENOMEM;
> - }
> -
> - iommu->mmio_base = (void *)fix_to_virt(
> - FIX_IOMMU_MMIO_BASE_0 + nr_amd_iommus * MMIO_PAGES_PER_IOMMU);
> - mfn = (unsigned long)(iommu->mmio_base_phys >> PAGE_SHIFT);
> - map_pages_to_xen((unsigned long)iommu->mmio_base, mfn,
> - MMIO_PAGES_PER_IOMMU, PAGE_HYPERVISOR_NOCACHE);
>
> memset(iommu->mmio_base, 0, IOMMU_MMIO_REGION_LENGTH);
Once I changed the above logic, IOMMU is initialized correctly. I have
tested pass-though a NIC and thing looks fine.
Suravee
next prev parent reply other threads:[~2013-07-10 17:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-10 10:36 [PATCH 0/2] IOMMU: use ioremap() Jan Beulich
2013-07-10 10:48 ` [PATCH 1/2] VT-d: " Jan Beulich
2013-07-10 11:37 ` Keir Fraser
2013-07-11 8:19 ` [PATCH v2 " Jan Beulich
2013-07-10 10:49 ` [PATCH 2/2] AMD IOMMU: " Jan Beulich
2013-07-10 11:37 ` Keir Fraser
2013-07-10 17:12 ` Suravee Suthikulanit [this message]
2013-07-11 8:14 ` Jan Beulich
2013-07-11 8:22 ` [PATCH v2 " Jan Beulich
2013-07-11 14:05 ` Suravee Suthikulanit
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=51DD95FA.9060106@amd.com \
--to=suravee.suthikulpanit@amd.com \
--cc=JBeulich@suse.com \
--cc=jacob.shin@amd.com \
--cc=xen-devel@lists.xen.org \
--cc=xiantao.zhang@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;
as well as URLs for NNTP newsgroup(s).