Files
kernel/include/linux/hypervisor.h
Huacai Chen 154bfe9acb PCI: Extend isolated function probing to LoongArch
commit a02fd05661d73a8507dd70dd820e9b984490c545 upstream.

Like s390 and the jailhouse hypervisor, LoongArch's PCI architecture allows
passing isolated PCI functions to a guest OS instance. So it is possible
that there is a multi-function device without function 0 for the host or
guest.

Allow probing such functions by adding a IS_ENABLED(CONFIG_LOONGARCH) case
in the hypervisor_isolated_pci_functions() helper.

This is similar to commit 189c6c33ff ("PCI: Extend isolated function
probing to s390").

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20250624062927.4037734-1-chenhuacai@loongson.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-20 18:30:14 +02:00

47 lines
799 B
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __LINUX_HYPEVISOR_H
#define __LINUX_HYPEVISOR_H
/*
* Generic Hypervisor support
* Juergen Gross <jgross@suse.com>
*/
#ifdef CONFIG_X86
#include <asm/jailhouse_para.h>
#include <asm/x86_init.h>
static inline void hypervisor_pin_vcpu(int cpu)
{
x86_platform.hyper.pin_vcpu(cpu);
}
#else /* !CONFIG_X86 */
#include <linux/of.h>
static inline void hypervisor_pin_vcpu(int cpu)
{
}
static inline bool jailhouse_paravirt(void)
{
return of_find_compatible_node(NULL, NULL, "jailhouse,cell");
}
#endif /* !CONFIG_X86 */
static inline bool hypervisor_isolated_pci_functions(void)
{
if (IS_ENABLED(CONFIG_S390))
return true;
if (IS_ENABLED(CONFIG_LOONGARCH))
return true;
return jailhouse_paravirt();
}
#endif /* __LINUX_HYPEVISOR_H */