mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 22:24:11 +08:00
a603002eea
Instead of having a global flag to require restricted memory access for all virtio devices, introduce a callback which can select that requirement on a per-device basis. For convenience add a common function returning always true, which can be used for use cases like SEV. Per default use a callback always returning false. As the callback needs to be set in early init code already, add a virtio anchor which is builtin in case virtio is enabled. Signed-off-by: Juergen Gross <jgross@suse.com> Tested-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> # Arm64 guest using Xen Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Link: https://lore.kernel.org/r/20220622063838.8854-2-jgross@suse.com Signed-off-by: Juergen Gross <jgross@suse.com>
19 lines
464 B
C
19 lines
464 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
#include <linux/virtio.h>
|
|
#include <linux/virtio_anchor.h>
|
|
|
|
bool virtio_require_restricted_mem_acc(struct virtio_device *dev)
|
|
{
|
|
return true;
|
|
}
|
|
EXPORT_SYMBOL_GPL(virtio_require_restricted_mem_acc);
|
|
|
|
static bool virtio_no_restricted_mem_acc(struct virtio_device *dev)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
bool (*virtio_check_mem_acc_cb)(struct virtio_device *dev) =
|
|
virtio_no_restricted_mem_acc;
|
|
EXPORT_SYMBOL_GPL(virtio_check_mem_acc_cb);
|