iommu/amd: Reduce delay waiting for command buffer space
authorTom Lendacky <thomas.lendacky@amd.com>
Mon, 5 Jun 2017 19:52:26 +0000 (14:52 -0500)
committerJoerg Roedel <jroedel@suse.de>
Thu, 8 Jun 2017 12:31:03 +0000 (14:31 +0200)
commit23e967e17c58779b38f69f8d41d727f59440d36a
tree32d99307e8bef0fcf0d7230382637303bd28cc40
parentd334a5637dfb53f7d07017afc1e491903b482ef8
iommu/amd: Reduce delay waiting for command buffer space

Currently if there is no room to add a command to the command buffer, the
driver performs a "completion wait" which only returns when all commands
on the queue have been processed. There is no need to wait for the entire
command queue to be executed before adding the next command.

Update the driver to perform the same udelay() loop that the "completion
wait" performs, but instead re-read the head pointer to determine if
sufficient space is available.  The very first time it is found that there
is no space available, the udelay() will be skipped to immediately perform
the opportunistic read of the head pointer. If it is still found that
there is not sufficient space, then the udelay() will be performed.

Signed-off-by: Leo Duran <leo.duran@amd.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd_iommu.c