kconfig: don't select VPCI if building a shim-only binary
PATCH v2 1/1 kconfig: don't select VPCI if building a shim-only binary
Add dummy replacements for some functions used outside of the vpci code, and also a guard in vmsi.c to prevent vpci arch specific helpers from being compiled if the option is not selected.
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Wei Liu <[email protected]>
--- xen/arch/x86/Kconfig | 2 +- xen/arch/x86/hvm/vmsi.c | 2 ++ xen/include/xen/vpci.h | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-)
xen/arch/x86/Kconfig +1 -1
@@ -23,7 +23,7 @@ config X86 select HAS_PCI select HAS_PDX select HAS_UBSAN - select HAS_VPCI + select HAS_VPCI if !PV_SHIM_EXCLUSIVE select NUMA config ARCH_DEFCONFIG
xen/arch/x86/hvm/vmsi.c +2 -0
@@ -624,6 +624,7 @@ void msix_write_completion(struct vcpu *v)gdprintk (XENLOG_WARNING ,"MSI-X write completion failure\n" ); } +#ifdef CONFIG_HAS_VPCI static unsigned int msi_gflags (uint16_t data,uint64_t addr,bool masked) {/*
@@ -867,3 +868,4 @@ int vpci_msix_arch_print(const struct vpci_msix *msix) return 0; } +#endif /* CONFIG_HAS_VPCI */
xen/include/xen/vpci.h +26 -0
@@ -210,6 +210,32 @@ static inline unsigned int vmsix_entry_nr(const struct vpci_msix *msix,#else /* !CONFIG_HAS_VPCI */ struct vpci_vcpu {}; + +static inline int vpci_add_handlers (struct pci_dev *pdev) +{ +return 0 ; +} + +static inline void vpci_dump_msi (void ) { } + +static inline uint32_t vpci_read (pci_sbdf_t sbdf,unsigned int reg, +unsigned int size) +{ +ASSERT_UNREACHABLE (); +return ~(uint32_t )0 ; +} + +static inline void vpci_write (pci_sbdf_t sbdf,unsigned int reg, +unsigned int size,uint32_t data) +{ +ASSERT_UNREACHABLE (); +} + +static inline bool __must_check vpci_process_pending (struct vcpu *v) +{ +ASSERT_UNREACHABLE (); +return false; +}#endif #endif
Signature · 7 lines
2.16.3 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 27.03.18 at 17:30, <[email protected]> wrote:
Add dummy replacements for some functions used outside of the vpci code, and also a guard in
vmsi.cto prevent vpci arch specific helpers from being compiled if the option is not selected.Reported-by Wei Liu <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
with one remark:
Quoted 1 line
+static inline bool
__must_checkvpci_process_pending(struct vcpu *v)
I don't think you really need the __must_check here; if you agree, I'm sure this could be dropped while committing.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 27.03.18 at 17:30, <[email protected]> wrote:
Add dummy replacements for some functions used outside of the vpci code, and also a guard in
vmsi.cto prevent vpci arch specific helpers from being compiled if the option is not selected.Reported-by Wei Liu <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
Quoted 7 lines
Reviewed-by Jan Beulich <[email protected]>with one remark:
Quoted 1 line
+static inline bool
__must_checkvpci_process_pending(struct vcpu *v)I don't think you really need the
__must_checkhere; if you agree, I'm sure this could be dropped while committing.
I've keep the __must_check to prevent users that don't have VPCI enabled from adding usages of vpci_process_pending that don't check the return value, but TBH I expect people adding or changing usages of vpci_process_pending to have VPCI enabled.
I'm fine with you removing the __must_check at commit time.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Roger Pau Monne
Add dummy replacements for some functions used outside of the vpci code, and also a guard in
vmsi.cto prevent vpci arch specific helpers from being compiled if the option is not selected.Reported-by Wei Liu <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel