]> git.baikalelectronics.ru Git - kernel.git/commit
iommu/amd: Fix the left value check of cmd buffer
authorHuang Rui <ray.huang@amd.com>
Mon, 12 Dec 2016 12:28:26 +0000 (07:28 -0500)
committerJoerg Roedel <jroedel@suse.de>
Wed, 4 Jan 2017 14:22:22 +0000 (15:22 +0100)
commit7935abc24f8fc746567285b89419a75228825d57
tree2acb338f4341a7deae4fdf99579f4b7528cf55cc
parentfc6a3c00b5d1f7c7768ebbdbd7d29a6d224b9030
iommu/amd: Fix the left value check of cmd buffer

The generic command buffer entry is 128 bits (16 bytes), so the offset
of tail and head pointer should be 16 bytes aligned and increased with
0x10 per command.

When cmd buf is full, head = (tail + 0x10) % CMD_BUFFER_SIZE.

So when left space of cmd buf should be able to store only two
command, we should be issued one COMPLETE_WAIT additionally to wait
all older commands completed. Then the left space should be increased
after IOMMU fetching from cmd buf.

So left check value should be left <= 0x20 (two commands).

Signed-off-by: Huang Rui <ray.huang@amd.com>
Fixes: 1d425363b0e75 ('x86/amd-iommu: Improve handling of full command buffer')
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd_iommu.c