AMD/IOMMU: size command buffer dynamically
authorJan Beulich <JBeulich@suse.com>
Tue, 8 Jun 2021 16:38:55 +0000 (17:38 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 8 Jun 2021 16:43:06 +0000 (17:43 +0100)
commitdf242851ddc93ac0b0a3a20ecab34acc29e3b36b
treebcb45202074f2ef8c117412eae5416353c5d86ae
parentcbfa62bb140c8f10a0ae96db3ce06e22b3b9d302
AMD/IOMMU: size command buffer dynamically

With the present synchronous model, we need two slots for every
operation (the operation itself and a wait command).  There can be one
such pair of commands pending per CPU. To ensure that under all normal
circumstances a slot is always available when one is requested, size the
command ring according to the number of present CPUs.

This is part of XSA-373 / CVE-2021-28692.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
xen/drivers/passthrough/amd/iommu-defs.h
xen/drivers/passthrough/amd/iommu_cmd.c
xen/drivers/passthrough/amd/iommu_init.c