Skip to content

Commit a5ee44c

Browse files
committed
Merge tag 'for-linus-6.12a-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen fix from Juergen Gross: "A single fix for a build failure introduced this merge window" * tag 'for-linus-6.12a-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen: Remove dependency between pciback and privcmd
2 parents 10e93e1 + 0fd2a74 commit a5ee44c

File tree

5 files changed

+44
-12
lines changed

5 files changed

+44
-12
lines changed

drivers/xen/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ config XEN_SCSI_BACKEND
261261
config XEN_PRIVCMD
262262
tristate "Xen hypercall passthrough driver"
263263
depends on XEN
264-
imply XEN_PCIDEV_BACKEND
265264
default m
266265
help
267266
The hypercall passthrough driver allows privileged user programs to

drivers/xen/acpi.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,27 @@ int xen_acpi_get_gsi_info(struct pci_dev *dev,
125125
return 0;
126126
}
127127
EXPORT_SYMBOL_GPL(xen_acpi_get_gsi_info);
128+
129+
static get_gsi_from_sbdf_t get_gsi_from_sbdf;
130+
static DEFINE_RWLOCK(get_gsi_from_sbdf_lock);
131+
132+
void xen_acpi_register_get_gsi_func(get_gsi_from_sbdf_t func)
133+
{
134+
write_lock(&get_gsi_from_sbdf_lock);
135+
get_gsi_from_sbdf = func;
136+
write_unlock(&get_gsi_from_sbdf_lock);
137+
}
138+
EXPORT_SYMBOL_GPL(xen_acpi_register_get_gsi_func);
139+
140+
int xen_acpi_get_gsi_from_sbdf(u32 sbdf)
141+
{
142+
int ret = -EOPNOTSUPP;
143+
144+
read_lock(&get_gsi_from_sbdf_lock);
145+
if (get_gsi_from_sbdf)
146+
ret = get_gsi_from_sbdf(sbdf);
147+
read_unlock(&get_gsi_from_sbdf_lock);
148+
149+
return ret;
150+
}
151+
EXPORT_SYMBOL_GPL(xen_acpi_get_gsi_from_sbdf);

drivers/xen/privcmd.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -850,15 +850,13 @@ static long privcmd_ioctl_mmap_resource(struct file *file,
850850
static long privcmd_ioctl_pcidev_get_gsi(struct file *file, void __user *udata)
851851
{
852852
#if defined(CONFIG_XEN_ACPI)
853-
int rc = -EINVAL;
853+
int rc;
854854
struct privcmd_pcidev_get_gsi kdata;
855855

856856
if (copy_from_user(&kdata, udata, sizeof(kdata)))
857857
return -EFAULT;
858858

859-
if (IS_REACHABLE(CONFIG_XEN_PCIDEV_BACKEND))
860-
rc = pcistub_get_gsi_from_sbdf(kdata.sbdf);
861-
859+
rc = xen_acpi_get_gsi_from_sbdf(kdata.sbdf);
862860
if (rc < 0)
863861
return rc;
864862

drivers/xen/xen-pciback/pci_stub.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ static struct pci_dev *pcistub_device_get_pci_dev(struct xen_pcibk_device *pdev,
227227
}
228228

229229
#ifdef CONFIG_XEN_ACPI
230-
int pcistub_get_gsi_from_sbdf(unsigned int sbdf)
230+
static int pcistub_get_gsi_from_sbdf(unsigned int sbdf)
231231
{
232232
struct pcistub_device *psdev;
233233
int domain = (sbdf >> 16) & 0xffff;
@@ -242,7 +242,6 @@ int pcistub_get_gsi_from_sbdf(unsigned int sbdf)
242242

243243
return psdev->gsi;
244244
}
245-
EXPORT_SYMBOL_GPL(pcistub_get_gsi_from_sbdf);
246245
#endif
247246

248247
struct pci_dev *pcistub_get_pci_dev_by_slot(struct xen_pcibk_device *pdev,
@@ -1757,11 +1756,19 @@ static int __init xen_pcibk_init(void)
17571756
bus_register_notifier(&pci_bus_type, &pci_stub_nb);
17581757
#endif
17591758

1759+
#ifdef CONFIG_XEN_ACPI
1760+
xen_acpi_register_get_gsi_func(pcistub_get_gsi_from_sbdf);
1761+
#endif
1762+
17601763
return err;
17611764
}
17621765

17631766
static void __exit xen_pcibk_cleanup(void)
17641767
{
1768+
#ifdef CONFIG_XEN_ACPI
1769+
xen_acpi_register_get_gsi_func(NULL);
1770+
#endif
1771+
17651772
#ifdef CONFIG_PCI_IOV
17661773
bus_unregister_notifier(&pci_bus_type, &pci_stub_nb);
17671774
#endif

include/xen/acpi.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
#include <linux/types.h>
3737

38+
typedef int (*get_gsi_from_sbdf_t)(u32 sbdf);
39+
3840
#ifdef CONFIG_XEN_DOM0
3941
#include <asm/xen/hypervisor.h>
4042
#include <xen/xen.h>
@@ -72,6 +74,8 @@ int xen_acpi_get_gsi_info(struct pci_dev *dev,
7274
int *gsi_out,
7375
int *trigger_out,
7476
int *polarity_out);
77+
void xen_acpi_register_get_gsi_func(get_gsi_from_sbdf_t func);
78+
int xen_acpi_get_gsi_from_sbdf(u32 sbdf);
7579
#else
7680
static inline void xen_acpi_sleep_register(void)
7781
{
@@ -89,12 +93,12 @@ static inline int xen_acpi_get_gsi_info(struct pci_dev *dev,
8993
{
9094
return -1;
9195
}
92-
#endif
9396

94-
#ifdef CONFIG_XEN_PCI_STUB
95-
int pcistub_get_gsi_from_sbdf(unsigned int sbdf);
96-
#else
97-
static inline int pcistub_get_gsi_from_sbdf(unsigned int sbdf)
97+
static inline void xen_acpi_register_get_gsi_func(get_gsi_from_sbdf_t func)
98+
{
99+
}
100+
101+
static inline int xen_acpi_get_gsi_from_sbdf(u32 sbdf)
98102
{
99103
return -1;
100104
}

0 commit comments

Comments
 (0)