AMD/IOMMU: size command buffer dynamically
authorJan Beulich <jbeulich@suse.com>
Tue, 8 Jun 2021 17:15:45 +0000 (18:15 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 8 Jun 2021 17:36:03 +0000 (18:36 +0100)
commit46ff2453de9e58ad49d79eda1be6ff21c22b3144
treedd31bc21c95a57f65ce50adfec7a2739ab03324c
parent2665d9785e748bf9cd87ec5783099e644ce2bac2
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>
(cherry picked from commit df242851ddc93ac0b0a3a20ecab34acc29e3b36b)
xen/drivers/passthrough/amd/iommu-defs.h
xen/drivers/passthrough/amd/iommu_cmd.c
xen/drivers/passthrough/amd/iommu_init.c