Commit 8eed9833 authored by Joerg Roedel's avatar Joerg Roedel
Browse files

x86/amd-iommu: Move reset_iommu_command_buffer out of locked code



This patch removes the ugly contruct where the
iommu->lock must be released while before calling the
reset_iommu_command_buffer function.

Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
parent b00d3bcf
Loading
Loading
Loading
Loading
+6 −7
Original line number Original line Diff line number Diff line
@@ -285,6 +285,7 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt)
		break;
		break;
	case EVENT_TYPE_ILL_CMD:
	case EVENT_TYPE_ILL_CMD:
		printk("ILLEGAL_COMMAND_ERROR address=0x%016llx]\n", address);
		printk("ILLEGAL_COMMAND_ERROR address=0x%016llx]\n", address);
		iommu->reset_in_progress = true;
		reset_iommu_command_buffer(iommu);
		reset_iommu_command_buffer(iommu);
		dump_command(address);
		dump_command(address);
		break;
		break;
@@ -407,11 +408,8 @@ static void __iommu_wait_for_completion(struct amd_iommu *iommu)
	status &= ~MMIO_STATUS_COM_WAIT_INT_MASK;
	status &= ~MMIO_STATUS_COM_WAIT_INT_MASK;
	writel(status, iommu->mmio_base + MMIO_STATUS_OFFSET);
	writel(status, iommu->mmio_base + MMIO_STATUS_OFFSET);


	if (unlikely(i == EXIT_LOOP_COUNT)) {
	if (unlikely(i == EXIT_LOOP_COUNT))
		spin_unlock(&iommu->lock);
		iommu->reset_in_progress = true;
		reset_iommu_command_buffer(iommu);
		spin_lock(&iommu->lock);
	}
}
}


/*
/*
@@ -458,6 +456,9 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
out:
out:
	spin_unlock_irqrestore(&iommu->lock, flags);
	spin_unlock_irqrestore(&iommu->lock, flags);


	if (iommu->reset_in_progress)
		reset_iommu_command_buffer(iommu);

	return 0;
	return 0;
}
}


@@ -649,8 +650,6 @@ static void reset_iommu_command_buffer(struct amd_iommu *iommu)
	if (iommu->reset_in_progress)
	if (iommu->reset_in_progress)
		panic("AMD-Vi: ILLEGAL_COMMAND_ERROR while resetting command buffer\n");
		panic("AMD-Vi: ILLEGAL_COMMAND_ERROR while resetting command buffer\n");


	iommu->reset_in_progress = true;

	amd_iommu_reset_cmd_buffer(iommu);
	amd_iommu_reset_cmd_buffer(iommu);
	amd_iommu_flush_all_devices();
	amd_iommu_flush_all_devices();
	amd_iommu_flush_all_domains();
	amd_iommu_flush_all_domains();