aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/amd_iommu.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2011-04-06 05:07:21 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2011-04-06 05:44:15 -0400
commit94fe79e2f100bfcd8e7689cbf8838634779b80a2 (patch)
tree227a4502ab6f0dac202f5d584ac9814ab2b4f7c5 /arch/x86/kernel/amd_iommu.c
parentded467374a34eb80020c2213456b1d9ca946b88c (diff)
x86/amd-iommu: Move inv-dte command building to own function
This patch moves command building for the invalidate-dte command into its own function. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch/x86/kernel/amd_iommu.c')
-rw-r--r--arch/x86/kernel/amd_iommu.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index eebd504519c6..4e5631a433aa 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -390,6 +390,13 @@ static void build_completion_wait(struct iommu_cmd *cmd)
390 CMD_SET_TYPE(cmd, CMD_COMPL_WAIT); 390 CMD_SET_TYPE(cmd, CMD_COMPL_WAIT);
391} 391}
392 392
393static void build_inv_dte(struct iommu_cmd *cmd, u16 devid)
394{
395 memset(cmd, 0, sizeof(*cmd));
396 cmd->data[0] = devid;
397 CMD_SET_TYPE(cmd, CMD_INV_DEV_ENTRY);
398}
399
393/* 400/*
394 * Writes the command to the IOMMUs command buffer and informs the 401 * Writes the command to the IOMMUs command buffer and informs the
395 * hardware about the new command. Must be called with iommu->lock held. 402 * hardware about the new command. Must be called with iommu->lock held.
@@ -533,10 +540,7 @@ static int iommu_flush_device(struct device *dev)
533 devid = get_device_id(dev); 540 devid = get_device_id(dev);
534 iommu = amd_iommu_rlookup_table[devid]; 541 iommu = amd_iommu_rlookup_table[devid];
535 542
536 /* Build command */ 543 build_inv_dte(&cmd, devid);
537 memset(&cmd, 0, sizeof(cmd));
538 CMD_SET_TYPE(&cmd, CMD_INV_DEV_ENTRY);
539 cmd.data[0] = devid;
540 544
541 return iommu_queue_command(iommu, &cmd); 545 return iommu_queue_command(iommu, &cmd);
542} 546}