From: Joerg Roedel <joerg.roedel@amd.com>
To: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Cc: Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 4/7] x86/amd-iommu: Move functions to get rid of forward declarations
Date: Thu, 11 Feb 2010 15:33:14 +0100 [thread overview]
Message-ID: <1265898797-32183-5-git-send-email-joerg.roedel@amd.com> (raw)
In-Reply-To: <1265898797-32183-1-git-send-email-joerg.roedel@amd.com>
This patch moves some functions in amd_iommu.c to get rid of
the iommu_update_domain_dte forward declaration.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/kernel/amd_iommu.c | 90 +++++++++++++++++++++----------------------
1 files changed, 44 insertions(+), 46 deletions(-)
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 02ab775..bda00f0 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -58,7 +58,6 @@ struct iommu_cmd {
};
static void reset_iommu_command_buffer(struct amd_iommu *iommu);
-static void iommu_update_domain_dte(struct protection_domain *domain);
/****************************************************************************
*
@@ -90,6 +89,38 @@ static void update_flush_info_tlb(struct protection_domain *domain,
domain->flush.end = max(end , domain->flush.end);
}
}
+static void set_dte_entry(u16 devid, struct protection_domain *domain)
+{
+ u64 pte_root = virt_to_phys(domain->pt_root);
+
+ pte_root |= (domain->mode & DEV_ENTRY_MODE_MASK)
+ << DEV_ENTRY_MODE_SHIFT;
+ pte_root |= IOMMU_PTE_IR | IOMMU_PTE_IW | IOMMU_PTE_P | IOMMU_PTE_TV;
+
+ amd_iommu_dev_table[devid].data[2] = domain->id;
+ amd_iommu_dev_table[devid].data[1] = upper_32_bits(pte_root);
+ amd_iommu_dev_table[devid].data[0] = lower_32_bits(pte_root);
+}
+
+static void clear_dte_entry(u16 devid)
+{
+ /* remove entry from the device table seen by the hardware */
+ amd_iommu_dev_table[devid].data[0] = IOMMU_PTE_P | IOMMU_PTE_TV;
+ amd_iommu_dev_table[devid].data[1] = 0;
+ amd_iommu_dev_table[devid].data[2] = 0;
+
+ amd_iommu_apply_erratum_63(devid);
+}
+
+static void update_device_table(struct protection_domain *domain)
+{
+ struct iommu_dev_data *dev_data;
+
+ list_for_each_entry(dev_data, &domain->dev_list, list) {
+ u16 devid = get_device_id(dev_data->dev);
+ set_dte_entry(devid, domain);
+ }
+}
/*
* In this function the list of preallocated protection domains is traversed to
@@ -718,6 +749,18 @@ static void reset_iommu_command_buffer(struct amd_iommu *iommu)
iommu->reset_in_progress = false;
}
+static void iommu_update_domain_dte(struct protection_domain *domain)
+{
+ if (!domain->flush.dte)
+ return;
+
+ update_device_table(domain);
+ iommu_flush_domain_devices(domain);
+ iommu_flush_tlb_pde(domain);
+
+ domain->flush.dte = false;
+}
+
/****************************************************************************
*
* The functions below are used the create the page table mappings for
@@ -1366,29 +1409,6 @@ static bool dma_ops_domain(struct protection_domain *domain)
return domain->flags & PD_DMA_OPS_MASK;
}
-static void set_dte_entry(u16 devid, struct protection_domain *domain)
-{
- u64 pte_root = virt_to_phys(domain->pt_root);
-
- pte_root |= (domain->mode & DEV_ENTRY_MODE_MASK)
- << DEV_ENTRY_MODE_SHIFT;
- pte_root |= IOMMU_PTE_IR | IOMMU_PTE_IW | IOMMU_PTE_P | IOMMU_PTE_TV;
-
- amd_iommu_dev_table[devid].data[2] = domain->id;
- amd_iommu_dev_table[devid].data[1] = upper_32_bits(pte_root);
- amd_iommu_dev_table[devid].data[0] = lower_32_bits(pte_root);
-}
-
-static void clear_dte_entry(u16 devid)
-{
- /* remove entry from the device table seen by the hardware */
- amd_iommu_dev_table[devid].data[0] = IOMMU_PTE_P | IOMMU_PTE_TV;
- amd_iommu_dev_table[devid].data[1] = 0;
- amd_iommu_dev_table[devid].data[2] = 0;
-
- amd_iommu_apply_erratum_63(devid);
-}
-
static void do_attach(struct device *dev, struct protection_domain *domain)
{
struct iommu_dev_data *dev_data;
@@ -1698,28 +1718,6 @@ static struct protection_domain *get_domain(struct device *dev)
return &dma_dom->domain;
}
-static void update_device_table(struct protection_domain *domain)
-{
- struct iommu_dev_data *dev_data;
-
- list_for_each_entry(dev_data, &domain->dev_list, list) {
- u16 devid = get_device_id(dev_data->dev);
- set_dte_entry(devid, domain);
- }
-}
-
-static void iommu_update_domain_dte(struct protection_domain *domain)
-{
- if (!domain->flush.dte)
- return;
-
- update_device_table(domain);
- iommu_flush_domain_devices(domain);
- iommu_flush_tlb_pde(domain);
-
- domain->flush.dte = false;
-}
-
/*
* This function fetches the PTE for a given address in the aperture
*/
--
1.6.6
next prev parent reply other threads:[~2010-02-11 14:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-11 14:33 [PATCH 0/7] amd iommu smart tlb flushing Joerg Roedel
2010-02-11 14:33 ` [PATCH 1/7] x86/amd-iommu: Add flush_info to protection domains Joerg Roedel
2010-02-11 16:40 ` Don Dutile
2010-02-11 16:45 ` Joerg Roedel
2010-02-11 14:33 ` [PATCH 2/7] x86/amd-iommu: Introduce iommu_update_domain_tlb function Joerg Roedel
2010-02-11 14:33 ` [PATCH 3/7] x86/amd-iommu: Move dte udpate flag into flush_info structure Joerg Roedel
2010-02-11 14:33 ` Joerg Roedel [this message]
2010-02-11 14:33 ` [PATCH 5/7] x86/amd-iommu: Add function to commit domain changes Joerg Roedel
2010-02-11 14:33 ` [PATCH 6/7] x86/amd-iommu: Introduce iommu_update_dma_ops_domain() Joerg Roedel
2010-02-11 14:33 ` [PATCH 7/7] x86/amd-iommu: Reimplement iommu_flush_tlb_pde using iommu_update_domain_tlb Joerg Roedel
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=1265898797-32183-5-git-send-email-joerg.roedel@amd.com \
--to=joerg.roedel@amd.com \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome