passthrough/vtd: Don't DMA to the stack in queue_invalidate_wait()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 29 Oct 2019 13:36:13 +0000 (14:36 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 29 Oct 2019 13:36:13 +0000 (14:36 +0100)
commite2e653f69281e2050acbff3a57cc06cebb7b1078
treee1f4c6f36a0f9d25d2e9c9f7f92d92e73e874f2b
parent9eac9324c7f19d8fd0824a1ba25fd1ba7d60bab8
passthrough/vtd: Don't DMA to the stack in queue_invalidate_wait()

DMA-ing to the stack is considered bad practice.  In this case, if a
timeout occurs because of a sluggish device which is processing the
request, the completion notification will corrupt the stack of a
subsequent deeper call tree.

Place the poll_slot in a percpu area and DMA to that instead.

Fix the declaration of saddr in struct qinval_entry, to avoid a shift by
two.  The requirement here is that the DMA address is dword aligned,
which is covered by poll_slot's type.

This change does not address other issues.  Correlating completions
after a timeout with their request is a more complicated change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <JBeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
master commit: 8970834eb95586d87b064e8c7fc49ee8d2875db4
master date: 2019-07-24 14:40:10 +0100
xen/drivers/passthrough/vtd/iommu.h
xen/drivers/passthrough/vtd/qinval.c