Message ID | 1418397300-10870-3-git-send-email-feng.wu@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, 2014-12-12 at 23:14 +0800, Feng Wu wrote: > This patch adds a new member capability to struct irq_remap_ops, > this new function ops can be used to check whether some > features are supported, such as VT-d Posted-Interrupts. > + /* Check some capability is supported */ > + bool (*capability)(enum irq_remap_cap); > + Does this need to be a function call? Or could we just have a set of flags in the irq_remap_ops instead, with less overhead to check them?
> -----Original Message----- > From: David Woodhouse [mailto:dwmw2@infradead.org] > Sent: Wednesday, January 28, 2015 11:23 PM > To: Wu, Feng > Cc: tglx@linutronix.de; mingo@redhat.com; hpa@zytor.com; x86@kernel.org; > gleb@kernel.org; pbonzini@redhat.com; joro@8bytes.org; > alex.williamson@redhat.com; jiang.liu@linux.intel.com; eric.auger@linaro.org; > linux-kernel@vger.kernel.org; iommu@lists.linux-foundation.org; > kvm@vger.kernel.org > Subject: Re: [v3 02/26] iommu: Add new member capability to struct > irq_remap_ops > > On Fri, 2014-12-12 at 23:14 +0800, Feng Wu wrote: > > This patch adds a new member capability to struct irq_remap_ops, > > this new function ops can be used to check whether some > > features are supported, such as VT-d Posted-Interrupts. > > > + /* Check some capability is supported */ > > + bool (*capability)(enum irq_remap_cap); > > + > > Does this need to be a function call? Or could we just have a set of > flags in the irq_remap_ops instead, with less overhead to check them? Sounds a good idea, I will follow this in the next post! Thanks for the comments! Thanks, Feng > > -- > David Woodhouse Open Source Technology > Centre > David.Woodhouse@intel.com Intel > Corporation
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h index 6ba2431..f67ae08 100644 --- a/arch/x86/include/asm/irq_remapping.h +++ b/arch/x86/include/asm/irq_remapping.h @@ -31,6 +31,10 @@ struct irq_alloc_info; #ifdef CONFIG_IRQ_REMAP +enum irq_remap_cap { + IRQ_POSTING_CAP = 0, +}; + extern void setup_irq_remapping_ops(void); extern int irq_remapping_supported(void); extern void set_irq_remapping_broken(void); diff --git a/drivers/iommu/irq_remapping.h b/drivers/iommu/irq_remapping.h index 4bd791d..2d991b2 100644 --- a/drivers/iommu/irq_remapping.h +++ b/drivers/iommu/irq_remapping.h @@ -28,6 +28,7 @@ struct irq_data; struct msi_msg; struct irq_domain; struct irq_alloc_info; +enum irq_remap_cap; extern int disable_irq_remap; extern int irq_remap_broken; @@ -39,6 +40,9 @@ struct irq_remap_ops { /* Check whether Interrupt Remapping is supported */ int (*supported)(void); + /* Check some capability is supported */ + bool (*capability)(enum irq_remap_cap); + /* Initializes hardware and makes it ready for remapping interrupts */ int (*prepare)(void);