Skip to content

Commit

Permalink
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/kernel/git/tip/linux-2.6-tip

* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: fix 27-rc crash on vsmp due to paravirt during module load
  x86, oprofile: BUG scheduling while atomic
  AMD IOMMU: protect completion wait loop with iommu lock
  AMD IOMMU: set iommu sunc flag after command queuing
  • Loading branch information
Linus Torvalds committed Sep 23, 2008
2 parents e002bcc + 05e12e1 commit 9c38c7e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
22 changes: 16 additions & 6 deletions arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,23 @@ static int iommu_queue_command(struct amd_iommu *iommu, struct iommu_cmd *cmd)
*/
static int iommu_completion_wait(struct amd_iommu *iommu)
{
int ret, ready = 0;
int ret = 0, ready = 0;
unsigned status = 0;
struct iommu_cmd cmd;
unsigned long i = 0;
unsigned long flags, i = 0;

memset(&cmd, 0, sizeof(cmd));
cmd.data[0] = CMD_COMPL_WAIT_INT_MASK;
CMD_SET_TYPE(&cmd, CMD_COMPL_WAIT);

iommu->need_sync = 0;

ret = iommu_queue_command(iommu, &cmd);
spin_lock_irqsave(&iommu->lock, flags);

ret = __iommu_queue_command(iommu, &cmd);

if (ret)
return ret;
goto out;

while (!ready && (i < EXIT_LOOP_COUNT)) {
++i;
Expand All @@ -130,6 +132,8 @@ static int iommu_completion_wait(struct amd_iommu *iommu)

if (unlikely((i == EXIT_LOOP_COUNT) && printk_ratelimit()))
printk(KERN_WARNING "AMD IOMMU: Completion wait loop failed\n");
out:
spin_unlock_irqrestore(&iommu->lock, flags);

return 0;
}
Expand All @@ -140,16 +144,19 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid)
{
struct iommu_cmd cmd;
int ret;

BUG_ON(iommu == NULL);

memset(&cmd, 0, sizeof(cmd));
CMD_SET_TYPE(&cmd, CMD_INV_DEV_ENTRY);
cmd.data[0] = devid;

ret = iommu_queue_command(iommu, &cmd);

iommu->need_sync = 1;

return iommu_queue_command(iommu, &cmd);
return ret;
}

/*
Expand All @@ -159,6 +166,7 @@ static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu,
u64 address, u16 domid, int pde, int s)
{
struct iommu_cmd cmd;
int ret;

memset(&cmd, 0, sizeof(cmd));
address &= PAGE_MASK;
Expand All @@ -171,9 +179,11 @@ static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu,
if (pde) /* PDE bit - we wan't flush everything not only the PTEs */
cmd.data[2] |= CMD_INV_IOMMU_PAGES_PDE_MASK;

ret = iommu_queue_command(iommu, &cmd);

iommu->need_sync = 1;

return iommu_queue_command(iommu, &cmd);
return ret;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/vsmp_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static void vsmp_irq_enable(void)
native_restore_fl((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC));
}

static unsigned __init vsmp_patch(u8 type, u16 clobbers, void *ibuf,
static unsigned __init_or_module vsmp_patch(u8 type, u16 clobbers, void *ibuf,
unsigned long addr, unsigned len)
{
switch (type) {
Expand Down
4 changes: 3 additions & 1 deletion arch/x86/oprofile/nmi_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,12 @@ static void nmi_cpu_shutdown(void *dummy)

static void nmi_shutdown(void)
{
struct op_msrs *msrs = &get_cpu_var(cpu_msrs);
struct op_msrs *msrs;

nmi_enabled = 0;
on_each_cpu(nmi_cpu_shutdown, NULL, 1);
unregister_die_notifier(&profile_exceptions_nb);
msrs = &get_cpu_var(cpu_msrs);
model->shutdown(msrs);
free_msrs();
put_cpu_var(cpu_msrs);
Expand Down

0 comments on commit 9c38c7e

Please sign in to comment.