forked from Minki/linux
xen: branch for v6.0-rc1
-----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRTLbB6QfY48x44uB6AXGG7T9hjvgUCYuooOQAKCRCAXGG7T9hj vmmlAPoCfYBh4jKwRnvGvyn+sPQed/r0TH0wnsGK1ccONhyIvAD+IZcSTPsnp4Cj m1URGGff2PvAyjOIAzQZbKZomtfICwM= =z2e5 -----END PGP SIGNATURE----- Merge tag 'for-linus-6.0-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip Pull xen updates from Juergen Gross: - a series fine tuning virtio support for Xen guests, including removal the now again unused "platform_has()" feature. - a fix for host admin triggered reboot of Xen guests - a simple spelling fix * tag 'for-linus-6.0-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen: don't require virtio with grants for non-PV guests kernel: remove platform_has() infrastructure virtio: replace restricted mem access flag with callback xen: Fix spelling mistake xen/manage: Use orderly_reboot() to reboot
This commit is contained in:
commit
7447691ef9
@ -16121,14 +16121,6 @@ S: Maintained
|
||||
F: Documentation/devicetree/bindings/iio/chemical/plantower,pms7003.yaml
|
||||
F: drivers/iio/chemical/pms7003.c
|
||||
|
||||
PLATFORM FEATURE INFRASTRUCTURE
|
||||
M: Juergen Gross <jgross@suse.com>
|
||||
S: Maintained
|
||||
F: arch/*/include/asm/platform-feature.h
|
||||
F: include/asm-generic/platform-feature.h
|
||||
F: include/linux/platform-feature.h
|
||||
F: kernel/platform-feature.c
|
||||
|
||||
PLDMFW LIBRARY
|
||||
M: Jacob Keller <jacob.e.keller@intel.com>
|
||||
S: Maintained
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <linux/timekeeping.h>
|
||||
#include <linux/timekeeper_internal.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/virtio_anchor.h>
|
||||
|
||||
#include <linux/mm.h>
|
||||
|
||||
@ -443,7 +444,8 @@ static int __init xen_guest_init(void)
|
||||
if (!xen_domain())
|
||||
return 0;
|
||||
|
||||
xen_set_restricted_virtio_memory_access();
|
||||
if (IS_ENABLED(CONFIG_XEN_VIRTIO))
|
||||
virtio_set_mem_acc_cb(xen_virtio_mem_acc);
|
||||
|
||||
if (!acpi_disabled)
|
||||
xen_acpi_guest_init();
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <linux/cma.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/dma-direct.h>
|
||||
#include <linux/platform-feature.h>
|
||||
#include <asm/processor.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <asm/pgalloc.h>
|
||||
@ -48,6 +47,7 @@
|
||||
#include <asm/kasan.h>
|
||||
#include <asm/dma-mapping.h>
|
||||
#include <asm/uv.h>
|
||||
#include <linux/virtio_anchor.h>
|
||||
#include <linux/virtio_config.h>
|
||||
|
||||
pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(".bss..swapper_pg_dir");
|
||||
@ -175,7 +175,7 @@ static void pv_init(void)
|
||||
if (!is_prot_virt_guest())
|
||||
return;
|
||||
|
||||
platform_set(PLATFORM_VIRTIO_RESTRICTED_MEM_ACCESS);
|
||||
virtio_set_mem_acc_cb(virtio_require_restricted_mem_acc);
|
||||
|
||||
/* make sure bounce buffers are shared */
|
||||
swiotlb_init(true, SWIOTLB_FORCE | SWIOTLB_VERBOSE);
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/virtio_config.h>
|
||||
#include <linux/virtio_anchor.h>
|
||||
#include <linux/cc_platform.h>
|
||||
#include <linux/platform-feature.h>
|
||||
|
||||
#include <asm/tlbflush.h>
|
||||
#include <asm/fixmap.h>
|
||||
@ -245,7 +245,7 @@ void __init sev_setup_arch(void)
|
||||
swiotlb_adjust_size(size);
|
||||
|
||||
/* Set restricted memory access for virtio. */
|
||||
platform_set(PLATFORM_VIRTIO_RESTRICTED_MEM_ACCESS);
|
||||
virtio_set_mem_acc_cb(virtio_require_restricted_mem_acc);
|
||||
}
|
||||
|
||||
static unsigned long pg_level_to_pfn(int level, pte_t *kpte, pgprot_t *ret_prot)
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/kexec.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/virtio_anchor.h>
|
||||
|
||||
#include <xen/features.h>
|
||||
#include <xen/events.h>
|
||||
@ -195,7 +196,8 @@ static void __init xen_hvm_guest_init(void)
|
||||
if (xen_pv_domain())
|
||||
return;
|
||||
|
||||
xen_set_restricted_virtio_memory_access();
|
||||
if (IS_ENABLED(CONFIG_XEN_VIRTIO_FORCE_GRANT))
|
||||
virtio_set_mem_acc_cb(virtio_require_restricted_mem_acc);
|
||||
|
||||
init_hvm_pv_info();
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/edd.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/virtio_anchor.h>
|
||||
|
||||
#include <xen/xen.h>
|
||||
#include <xen/events.h>
|
||||
@ -109,7 +110,9 @@ static DEFINE_PER_CPU(struct tls_descs, shadow_tls_desc);
|
||||
|
||||
static void __init xen_pv_init_platform(void)
|
||||
{
|
||||
xen_set_restricted_virtio_memory_access();
|
||||
/* PV guests can't operate virtio devices without grants. */
|
||||
if (IS_ENABLED(CONFIG_XEN_VIRTIO))
|
||||
virtio_set_mem_acc_cb(virtio_require_restricted_mem_acc);
|
||||
|
||||
populate_extra_pte(fix_to_virt(FIX_PARAVIRT_BOOTMAP));
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
config VIRTIO_ANCHOR
|
||||
bool
|
||||
|
||||
config VIRTIO
|
||||
tristate
|
||||
select VIRTIO_ANCHOR
|
||||
help
|
||||
This option is selected by any driver which implements the virtio
|
||||
bus, such as CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_MMIO, CONFIG_RPMSG
|
||||
|
@ -1,5 +1,6 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
obj-$(CONFIG_VIRTIO) += virtio.o virtio_ring.o
|
||||
obj-$(CONFIG_VIRTIO_ANCHOR) += virtio_anchor.o
|
||||
obj-$(CONFIG_VIRTIO_PCI_LIB) += virtio_pci_modern_dev.o
|
||||
obj-$(CONFIG_VIRTIO_PCI_LIB_LEGACY) += virtio_pci_legacy_dev.o
|
||||
obj-$(CONFIG_VIRTIO_MMIO) += virtio_mmio.o
|
||||
|
@ -2,10 +2,10 @@
|
||||
#include <linux/virtio.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/virtio_config.h>
|
||||
#include <linux/virtio_anchor.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/idr.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform-feature.h>
|
||||
#include <uapi/linux/virtio_ids.h>
|
||||
|
||||
/* Unique numbering for virtio devices. */
|
||||
@ -174,7 +174,7 @@ static int virtio_features_ok(struct virtio_device *dev)
|
||||
|
||||
might_sleep();
|
||||
|
||||
if (platform_has(PLATFORM_VIRTIO_RESTRICTED_MEM_ACCESS)) {
|
||||
if (virtio_check_mem_acc_cb(dev)) {
|
||||
if (!virtio_has_feature(dev, VIRTIO_F_VERSION_1)) {
|
||||
dev_warn(&dev->dev,
|
||||
"device must provide VIRTIO_F_VERSION_1\n");
|
||||
|
18
drivers/virtio/virtio_anchor.c
Normal file
18
drivers/virtio/virtio_anchor.c
Normal file
@ -0,0 +1,18 @@
|
||||
// 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);
|
@ -355,4 +355,13 @@ config XEN_VIRTIO
|
||||
|
||||
If in doubt, say n.
|
||||
|
||||
config XEN_VIRTIO_FORCE_GRANT
|
||||
bool "Require Xen virtio support to use grants"
|
||||
depends on XEN_VIRTIO
|
||||
help
|
||||
Require virtio for Xen guests to use grant mappings.
|
||||
This will avoid the need to give the backend the right to map all
|
||||
of the guest memory. This will need support on the backend side
|
||||
(e.g. qemu or kernel, depending on the virtio device types used).
|
||||
|
||||
endmenu
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include <linux/of.h>
|
||||
#include <linux/pfn.h>
|
||||
#include <linux/xarray.h>
|
||||
#include <linux/virtio_anchor.h>
|
||||
#include <linux/virtio.h>
|
||||
#include <xen/xen.h>
|
||||
#include <xen/xen-ops.h>
|
||||
#include <xen/grant_table.h>
|
||||
@ -287,6 +289,14 @@ bool xen_is_grant_dma_device(struct device *dev)
|
||||
return has_iommu;
|
||||
}
|
||||
|
||||
bool xen_virtio_mem_acc(struct virtio_device *dev)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_XEN_VIRTIO_FORCE_GRANT))
|
||||
return true;
|
||||
|
||||
return xen_is_grant_dma_device(dev->dev.parent);
|
||||
}
|
||||
|
||||
void xen_grant_setup_dma_ops(struct device *dev)
|
||||
{
|
||||
struct xen_grant_dma_data *data;
|
||||
|
@ -205,7 +205,7 @@ static void do_poweroff(void)
|
||||
static void do_reboot(void)
|
||||
{
|
||||
shutting_down = SHUTDOWN_POWEROFF; /* ? */
|
||||
ctrl_alt_del();
|
||||
orderly_reboot();
|
||||
}
|
||||
|
||||
static struct shutdown_handler shutdown_handlers[] = {
|
||||
|
@ -89,7 +89,7 @@ EXPORT_SYMBOL_GPL(xen_front_pgdir_shbuf_get_dir_start);
|
||||
* shared by the frontend itself) or map the provided granted
|
||||
* references onto the backing storage (buf->pages).
|
||||
*
|
||||
* \param buf shared buffer which grants to be maped.
|
||||
* \param buf shared buffer which grants to be mapped.
|
||||
* \return zero on success or a negative number on failure.
|
||||
*/
|
||||
int xen_front_pgdir_shbuf_map(struct xen_front_pgdir_shbuf *buf)
|
||||
@ -110,7 +110,7 @@ EXPORT_SYMBOL_GPL(xen_front_pgdir_shbuf_map);
|
||||
* shared by the frontend itself) or unmap the provided granted
|
||||
* references.
|
||||
*
|
||||
* \param buf shared buffer which grants to be unmaped.
|
||||
* \param buf shared buffer which grants to be unmapped.
|
||||
* \return zero on success or a negative number on failure.
|
||||
*/
|
||||
int xen_front_pgdir_shbuf_unmap(struct xen_front_pgdir_shbuf *buf)
|
||||
|
@ -45,7 +45,6 @@ mandatory-y += msi.h
|
||||
mandatory-y += pci.h
|
||||
mandatory-y += percpu.h
|
||||
mandatory-y += pgalloc.h
|
||||
mandatory-y += platform-feature.h
|
||||
mandatory-y += preempt.h
|
||||
mandatory-y += rwonce.h
|
||||
mandatory-y += sections.h
|
||||
|
@ -1,8 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_PLATFORM_FEATURE_H
|
||||
#define _ASM_GENERIC_PLATFORM_FEATURE_H
|
||||
|
||||
/* Number of arch specific feature flags. */
|
||||
#define PLATFORM_ARCH_FEAT_N 0
|
||||
|
||||
#endif /* _ASM_GENERIC_PLATFORM_FEATURE_H */
|
@ -1,19 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _PLATFORM_FEATURE_H
|
||||
#define _PLATFORM_FEATURE_H
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <asm/platform-feature.h>
|
||||
|
||||
/* The platform features are starting with the architecture specific ones. */
|
||||
|
||||
/* Used to enable platform specific DMA handling for virtio devices. */
|
||||
#define PLATFORM_VIRTIO_RESTRICTED_MEM_ACCESS (0 + PLATFORM_ARCH_FEAT_N)
|
||||
|
||||
#define PLATFORM_FEAT_N (1 + PLATFORM_ARCH_FEAT_N)
|
||||
|
||||
void platform_set(unsigned int feature);
|
||||
void platform_clear(unsigned int feature);
|
||||
bool platform_has(unsigned int feature);
|
||||
|
||||
#endif /* _PLATFORM_FEATURE_H */
|
19
include/linux/virtio_anchor.h
Normal file
19
include/linux/virtio_anchor.h
Normal file
@ -0,0 +1,19 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LINUX_VIRTIO_ANCHOR_H
|
||||
#define _LINUX_VIRTIO_ANCHOR_H
|
||||
|
||||
#ifdef CONFIG_VIRTIO_ANCHOR
|
||||
struct virtio_device;
|
||||
|
||||
bool virtio_require_restricted_mem_acc(struct virtio_device *dev);
|
||||
extern bool (*virtio_check_mem_acc_cb)(struct virtio_device *dev);
|
||||
|
||||
static inline void virtio_set_mem_acc_cb(bool (*func)(struct virtio_device *))
|
||||
{
|
||||
virtio_check_mem_acc_cb = func;
|
||||
}
|
||||
#else
|
||||
#define virtio_set_mem_acc_cb(func) do { } while (0)
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_VIRTIO_ANCHOR_H */
|
@ -5,6 +5,7 @@
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/efi.h>
|
||||
#include <linux/virtio_anchor.h>
|
||||
#include <xen/features.h>
|
||||
#include <asm/xen/interface.h>
|
||||
#include <xen/interface/vcpu.h>
|
||||
@ -217,6 +218,7 @@ static inline void xen_preemptible_hcall_end(void) { }
|
||||
#ifdef CONFIG_XEN_GRANT_DMA_OPS
|
||||
void xen_grant_setup_dma_ops(struct device *dev);
|
||||
bool xen_is_grant_dma_device(struct device *dev);
|
||||
bool xen_virtio_mem_acc(struct virtio_device *dev);
|
||||
#else
|
||||
static inline void xen_grant_setup_dma_ops(struct device *dev)
|
||||
{
|
||||
@ -225,6 +227,13 @@ static inline bool xen_is_grant_dma_device(struct device *dev)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
struct virtio_device;
|
||||
|
||||
static inline bool xen_virtio_mem_acc(struct virtio_device *dev)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif /* CONFIG_XEN_GRANT_DMA_OPS */
|
||||
|
||||
#endif /* INCLUDE_XEN_OPS_H */
|
||||
|
@ -52,14 +52,6 @@ bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
|
||||
extern u64 xen_saved_max_mem_size;
|
||||
#endif
|
||||
|
||||
#include <linux/platform-feature.h>
|
||||
|
||||
static inline void xen_set_restricted_virtio_memory_access(void)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_XEN_VIRTIO) && xen_domain())
|
||||
platform_set(PLATFORM_VIRTIO_RESTRICTED_MEM_ACCESS);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_XEN_UNPOPULATED_ALLOC
|
||||
int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages);
|
||||
void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages);
|
||||
|
@ -7,7 +7,7 @@ obj-y = fork.o exec_domain.o panic.o \
|
||||
cpu.o exit.o softirq.o resource.o \
|
||||
sysctl.o capability.o ptrace.o user.o \
|
||||
signal.o sys.o umh.o workqueue.o pid.o task_work.o \
|
||||
extable.o params.o platform-feature.o \
|
||||
extable.o params.o \
|
||||
kthread.o sys_ni.o nsproxy.o \
|
||||
notifier.o ksysfs.o cred.o reboot.o \
|
||||
async.o range.o smpboot.o ucount.o regset.o
|
||||
|
@ -1,27 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/cache.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/platform-feature.h>
|
||||
|
||||
#define PLATFORM_FEAT_ARRAY_SZ BITS_TO_LONGS(PLATFORM_FEAT_N)
|
||||
static unsigned long __read_mostly platform_features[PLATFORM_FEAT_ARRAY_SZ];
|
||||
|
||||
void platform_set(unsigned int feature)
|
||||
{
|
||||
set_bit(feature, platform_features);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(platform_set);
|
||||
|
||||
void platform_clear(unsigned int feature)
|
||||
{
|
||||
clear_bit(feature, platform_features);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(platform_clear);
|
||||
|
||||
bool platform_has(unsigned int feature)
|
||||
{
|
||||
return test_bit(feature, platform_features);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(platform_has);
|
Loading…
Reference in New Issue
Block a user