All of lore.kernel.org
 help / color / mirror / Atom feed
* [irq-msi] questions about irq msi_desc usage
@ 2025-12-17  1:58 Chao Xie
  2025-12-17 20:41 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Chao Xie @ 2025-12-17  1:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: tglx

I intend to upstream a driver for a new bus, which utilizes MSI IRQ. 
I have some questions regarding how to implement MSI IRQ support for it:
1. To define my own private data structure, should I follow the PCI MSI
    approach and add a structure like struct my_private_intr_desc to 
    the union? 
    struct msi_desc {
       ...
       union {
           struct pci_msi_desc     pci;
           struct msi_desc_data    data;
    +++   struct private_intr_desc   private_intr;
       };
     }; 
     I think I can make use of data.docckie.ptr to point to my private data
     structure, but I do not find any example in kernel, and not sure whether
      It is right or not.

2.   If I use data.dcookie.ptr to point to my private data structure,
      should this association be initialized in msi_domain_ops.set_desc()?

3. The Type 1 interrupt of this bus is similar to MSI. 
    Specifically, its configuration space includes registers such as 
    interrupt_enable, interrupt_mask, and interrupt_data, with the following
    specifications:
    • Interrupt Enable: The software configures this register to
       control whether the interrupt function of the Entity is enabled.
    • Interrupt Data: The software configures the start number of
       interrupt vectors into this register. When the Entity reports an
       interrupt, it shall follow the rules below:
       (1) When one interrupt vector is enabled, the interrupt data
             reported by the Entity shall be X, where X is the value
             configured in the Interrupt Data register.
       (2) When N interrupt vectors are enabled, the interrupt data
             reported by the Entity shall range from X to X+N-1, and
             the value shall correspond to the sequence of interrupt
             vectors. X is the value configured in the Interrupt Data
             register.
    • Interrupt Address: The software configures the interrupt
      address allocated by the interrupt subsystem into this register.
    • Interrupt Mask: The software configures this register to
      control whether the interrupt reporting corresponding to the
      Entity is masked. Its 32 bits correspond to 32 interrupt vector
      numbers respectively.
  In this case, when allocating msi_desc, should I follow the PCI MSI
  model where one msi_desc represents multiple interrupts 
  (i.e.,set msi_desc.nvec_used = n)? If this is the correct approach, 
  is itfeasible to add a judgment similar to PCI MSI in
  msi_domain_get_virq() as follows:
         if (dev_is_pci(dev) && domid == MSI_DEFAULT_DOMAIN)
            devmsi = to_pci_dev(dev)->msi_enabled;
  +++ if (dev_is_my_private(dev) && domid == MSI_DEFAULT_DOMAIN)
  +++    devmsi = to_my_private_entity(dev)->is_type1;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-17 20:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-17  1:58 [irq-msi] questions about irq msi_desc usage Chao Xie
2025-12-17 20:41 ` Thomas Gleixner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.