Skip to content

Commit 9d46083

Browse files
allenpaistyhicks
authored andcommitted
Hyper-V: pci: controller: Introduce arch-specific init/exit interface
To allow architectures to run specific code before init or after exit. Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com> Signed-off-by: Boqun Feng (Microsoft) <boqun.feng@gmail.com> Signed-off-by: Allen Pais <apais@microsoft.com> [tyhicks: Forward port around commit 7d815f4 ("PCI: hv: Add check for hyperv_initialized in init_hv_pci_drv()") Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com>
1 parent 0d20750 commit 9d46083

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

arch/x86/include/asm/mshyperv.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,14 @@ static inline u8 hv_msi_irq_delivery_mode(void)
227227
return dest_Fixed;
228228
}
229229

230+
/* Architecture specific Hyper-V PCI MSI initialization and cleanup routines */
231+
static inline int hv_pci_arch_init(void)
232+
{
233+
return 0;
234+
}
235+
236+
static inline void hv_pci_arch_free(void) {}
237+
230238
#ifdef CONFIG_X86_64
231239
void hv_apic_init(void);
232240
void __init hv_init_spinlocks(void);

drivers/pci/controller/pci-hyperv.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3501,13 +3501,21 @@ static void __exit exit_hv_pci_drv(void)
35013501
hvpci_block_ops.read_block = NULL;
35023502
hvpci_block_ops.write_block = NULL;
35033503
hvpci_block_ops.reg_blk_invalidate = NULL;
3504+
3505+
hv_pci_arch_free();
35043506
}
35053507

35063508
static int __init init_hv_pci_drv(void)
35073509
{
3510+
int ret;
3511+
35083512
if (!hv_is_hyperv_initialized())
35093513
return -ENODEV;
35103514

3515+
ret = hv_pci_arch_init();
3516+
if (ret)
3517+
return ret;
3518+
35113519
/* Set the invalid domain number's bit, so it will not be used */
35123520
set_bit(HVPCI_DOM_INVALID, hvpci_dom_map);
35133521

0 commit comments

Comments
 (0)