xen: Remove dependency between pciback and privcmd

Commit 2fae6bb7be ("xen/privcmd: Add new syscall to get gsi from dev")
adds a weak reverse dependency to the config XEN_PRIVCMD definition, that
dependency causes xen-privcmd can't be loaded on domU, because dependent
xen-pciback isn't always be loaded successfully on domU.

To solve above problem, remove that dependency, and do not call
pcistub_get_gsi_from_sbdf() directly, instead add a hook in
drivers/xen/apci.c, xen-pciback register the real call function, then in
privcmd_ioctl_pcidev_get_gsi call that hook.

Fixes: 2fae6bb7be ("xen/privcmd: Add new syscall to get gsi from dev")
Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Message-ID: <20241012084537.1543059-1-Jiqian.Chen@amd.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
Jiqian Chen
2024-10-12 16:45:37 +08:00
committed by Juergen Gross
parent bf56c41016
commit 0fd2a74330
5 changed files with 44 additions and 12 deletions

View File

@@ -35,6 +35,8 @@
#include <linux/types.h>
typedef int (*get_gsi_from_sbdf_t)(u32 sbdf);
#ifdef CONFIG_XEN_DOM0
#include <asm/xen/hypervisor.h>
#include <xen/xen.h>
@@ -72,6 +74,8 @@ int xen_acpi_get_gsi_info(struct pci_dev *dev,
int *gsi_out,
int *trigger_out,
int *polarity_out);
void xen_acpi_register_get_gsi_func(get_gsi_from_sbdf_t func);
int xen_acpi_get_gsi_from_sbdf(u32 sbdf);
#else
static inline void xen_acpi_sleep_register(void)
{
@@ -89,12 +93,12 @@ static inline int xen_acpi_get_gsi_info(struct pci_dev *dev,
{
return -1;
}
#endif
#ifdef CONFIG_XEN_PCI_STUB
int pcistub_get_gsi_from_sbdf(unsigned int sbdf);
#else
static inline int pcistub_get_gsi_from_sbdf(unsigned int sbdf)
static inline void xen_acpi_register_get_gsi_func(get_gsi_from_sbdf_t func)
{
}
static inline int xen_acpi_get_gsi_from_sbdf(u32 sbdf)
{
return -1;
}