diff options
author | Chris Wright <chrisw@sous-sol.org> | 2010-04-02 21:27:53 -0400 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2010-04-07 05:51:15 -0400 |
commit | 549c90dc9a6d659e792b2a42a0930c7da015ea4a (patch) | |
tree | e0d0115631aa40eb45b58fb24bdcd399d2e17e47 /arch/x86/kernel/amd_iommu_init.c | |
parent | 75f66533bc883f761a7adcab3281fe3323efbc90 (diff) |
x86/amd-iommu: warn when issuing command to uninitialized cmd buffer
To catch future potential issues we can add a warning whenever we issue
a command before the command buffer is fully initialized.
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch/x86/kernel/amd_iommu_init.c')
-rw-r--r-- | arch/x86/kernel/amd_iommu_init.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c index 8975965f3e6..5edf41c7127 100644 --- a/arch/x86/kernel/amd_iommu_init.c +++ b/arch/x86/kernel/amd_iommu_init.c | |||
@@ -438,7 +438,7 @@ static u8 * __init alloc_command_buffer(struct amd_iommu *iommu) | |||
438 | if (cmd_buf == NULL) | 438 | if (cmd_buf == NULL) |
439 | return NULL; | 439 | return NULL; |
440 | 440 | ||
441 | iommu->cmd_buf_size = CMD_BUFFER_SIZE; | 441 | iommu->cmd_buf_size = CMD_BUFFER_SIZE | CMD_BUFFER_UNINITIALIZED; |
442 | 442 | ||
443 | return cmd_buf; | 443 | return cmd_buf; |
444 | } | 444 | } |
@@ -474,12 +474,13 @@ static void iommu_enable_command_buffer(struct amd_iommu *iommu) | |||
474 | &entry, sizeof(entry)); | 474 | &entry, sizeof(entry)); |
475 | 475 | ||
476 | amd_iommu_reset_cmd_buffer(iommu); | 476 | amd_iommu_reset_cmd_buffer(iommu); |
477 | iommu->cmd_buf_size &= ~(CMD_BUFFER_UNINITIALIZED); | ||
477 | } | 478 | } |
478 | 479 | ||
479 | static void __init free_command_buffer(struct amd_iommu *iommu) | 480 | static void __init free_command_buffer(struct amd_iommu *iommu) |
480 | { | 481 | { |
481 | free_pages((unsigned long)iommu->cmd_buf, | 482 | free_pages((unsigned long)iommu->cmd_buf, |
482 | get_order(iommu->cmd_buf_size)); | 483 | get_order(iommu->cmd_buf_size & ~(CMD_BUFFER_UNINITIALIZED))); |
483 | } | 484 | } |
484 | 485 | ||
485 | /* allocates the memory where the IOMMU will log its events to */ | 486 | /* allocates the memory where the IOMMU will log its events to */ |