All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xen.org>
Cc: Jacob Shin <jacob.shin@amd.com>,
	xiantao.zhang@intel.com, suravee.suthikulpanit@amd.com
Subject: [PATCH 1/2] VT-d: use ioremap()
Date: Wed, 10 Jul 2013 11:48:57 +0100	[thread overview]
Message-ID: <51DD583902000078000E3D3C@nat28.tlf.novell.com> (raw)
In-Reply-To: <51DD555102000078000E3D11@nat28.tlf.novell.com>

[-- Attachment #1: Type: text/plain, Size: 1999 bytes --]

There's no point in using the fixmap here, and it gets iommu_alloc()
in line with iommu_free(), which was already using iounmap() (thus
crashing if actually used).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/drivers/passthrough/vtd/dmar.h
+++ b/xen/drivers/passthrough/vtd/dmar.h
@@ -127,8 +127,6 @@ do {                                    
     }                                                           \
 } while (0)
 
-void *map_to_nocache_virt(int nr_iommus, u64 maddr);
-
 int vtd_hw_check(void);
 void disable_pmr(struct iommu *iommu);
 int is_usb_device(u16 seg, u8 bus, u8 devfn);
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1143,7 +1143,7 @@ int __init iommu_alloc(struct acpi_drhd_
     }
     iommu->intel->drhd = drhd;
 
-    iommu->reg = map_to_nocache_virt(nr_iommus, drhd->address);
+    iommu->reg = ioremap(drhd->address, PAGE_SIZE);
     iommu->index = nr_iommus++;
 
     iommu->cap = dmar_readq(iommu->reg, DMAR_CAP_REG);
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -64,12 +64,6 @@ void flush_all_cache()
     wbinvd();
 }
 
-void *__init map_to_nocache_virt(int nr_iommus, u64 maddr)
-{
-    set_fixmap_nocache(FIX_IOMMU_REGS_BASE_0 + nr_iommus, maddr);
-    return (void *)fix_to_virt(FIX_IOMMU_REGS_BASE_0 + nr_iommus);
-}
-
 static int _hvm_dpci_isairq_eoi(struct domain *d,
                                 struct hvm_pirq_dpci *pirq_dpci, void *arg)
 {
--- a/xen/include/asm-x86/fixmap.h
+++ b/xen/include/asm-x86/fixmap.h
@@ -60,8 +60,6 @@ enum fixed_addresses {
     FIX_KEXEC_BASE_0,
     FIX_KEXEC_BASE_END = FIX_KEXEC_BASE_0 \
       + ((KEXEC_XEN_NO_PAGES >> 1) * KEXEC_IMAGE_NR) - 1,
-    FIX_IOMMU_REGS_BASE_0,
-    FIX_IOMMU_REGS_END = FIX_IOMMU_REGS_BASE_0 + MAX_IOMMUS-1,
     FIX_IOMMU_MMIO_BASE_0,
     FIX_IOMMU_MMIO_END = FIX_IOMMU_MMIO_BASE_0 + IOMMU_PAGES -1,
     FIX_TBOOT_SHARED_BASE,




[-- Attachment #2: VT-d-use-ioremap.patch --]
[-- Type: text/plain, Size: 2016 bytes --]

VT-d: use ioremap()

There's no point in using the fixmap here, and it gets iommu_alloc()
in line with iommu_free(), which was already using iounmap() (thus
crashing if actually used).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/drivers/passthrough/vtd/dmar.h
+++ b/xen/drivers/passthrough/vtd/dmar.h
@@ -127,8 +127,6 @@ do {                                    
     }                                                           \
 } while (0)
 
-void *map_to_nocache_virt(int nr_iommus, u64 maddr);
-
 int vtd_hw_check(void);
 void disable_pmr(struct iommu *iommu);
 int is_usb_device(u16 seg, u8 bus, u8 devfn);
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1143,7 +1143,7 @@ int __init iommu_alloc(struct acpi_drhd_
     }
     iommu->intel->drhd = drhd;
 
-    iommu->reg = map_to_nocache_virt(nr_iommus, drhd->address);
+    iommu->reg = ioremap(drhd->address, PAGE_SIZE);
     iommu->index = nr_iommus++;
 
     iommu->cap = dmar_readq(iommu->reg, DMAR_CAP_REG);
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -64,12 +64,6 @@ void flush_all_cache()
     wbinvd();
 }
 
-void *__init map_to_nocache_virt(int nr_iommus, u64 maddr)
-{
-    set_fixmap_nocache(FIX_IOMMU_REGS_BASE_0 + nr_iommus, maddr);
-    return (void *)fix_to_virt(FIX_IOMMU_REGS_BASE_0 + nr_iommus);
-}
-
 static int _hvm_dpci_isairq_eoi(struct domain *d,
                                 struct hvm_pirq_dpci *pirq_dpci, void *arg)
 {
--- a/xen/include/asm-x86/fixmap.h
+++ b/xen/include/asm-x86/fixmap.h
@@ -60,8 +60,6 @@ enum fixed_addresses {
     FIX_KEXEC_BASE_0,
     FIX_KEXEC_BASE_END = FIX_KEXEC_BASE_0 \
       + ((KEXEC_XEN_NO_PAGES >> 1) * KEXEC_IMAGE_NR) - 1,
-    FIX_IOMMU_REGS_BASE_0,
-    FIX_IOMMU_REGS_END = FIX_IOMMU_REGS_BASE_0 + MAX_IOMMUS-1,
     FIX_IOMMU_MMIO_BASE_0,
     FIX_IOMMU_MMIO_END = FIX_IOMMU_MMIO_BASE_0 + IOMMU_PAGES -1,
     FIX_TBOOT_SHARED_BASE,

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2013-07-10 10:48 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 ` Jan Beulich [this message]
2013-07-10 11:37   ` [PATCH 1/2] VT-d: " 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
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=51DD583902000078000E3D3C@nat28.tlf.novell.com \
    --to=jbeulich@suse.com \
    --cc=jacob.shin@amd.com \
    --cc=suravee.suthikulpanit@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 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.