Re: [PATCH 11/12] platform-msi: Add platform check for subdevice irq domain
From: Leon Romanovsky
Date: Mon Feb 08 2021 - 03:23:28 EST
On Wed, Feb 03, 2021 at 12:56:44PM -0800, Megha Dey wrote:
> From: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
>
> The pci_subdevice_msi_create_irq_domain() should fail if the underlying
> platform is not able to support IMS (Interrupt Message Storage). Otherwise,
> the isolation of interrupt is not guaranteed.
>
> For x86, IMS is only supported on bare metal for now. We could enable it
> in the virtualization environments in the future if interrupt HYPERCALL
> domain is supported or the hardware has the capability of interrupt
> isolation for subdevices.
>
> Cc: David Woodhouse <dwmw@xxxxxxxxxxxx>
> Cc: Leon Romanovsky <leon@xxxxxxxxxx>
> Cc: Kevin Tian <kevin.tian@xxxxxxxxx>
> Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Link: https://lore.kernel.org/linux-pci/87pn4nk7nn.fsf@xxxxxxxxxxxxxxxxxxxxxxx/
> Link: https://lore.kernel.org/linux-pci/877dqrnzr3.fsf@xxxxxxxxxxxxxxxxxxxxxxx/
> Link: https://lore.kernel.org/linux-pci/877dqqmc2h.fsf@xxxxxxxxxxxxxxxxxxxxxxx/
> Signed-off-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
> Signed-off-by: Megha Dey <megha.dey@xxxxxxxxx>
> ---
> arch/x86/pci/common.c | 74 +++++++++++++++++++++++++++++++++++++++++++++
> drivers/base/platform-msi.c | 8 +++++
> include/linux/msi.h | 1 +
> 3 files changed, 83 insertions(+)
>
> diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
> index 3507f45..263ccf6 100644
> --- a/arch/x86/pci/common.c
> +++ b/arch/x86/pci/common.c
> @@ -12,6 +12,8 @@
> #include <linux/init.h>
> #include <linux/dmi.h>
> #include <linux/slab.h>
> +#include <linux/iommu.h>
> +#include <linux/msi.h>
>
> #include <asm/acpi.h>
> #include <asm/segment.h>
> @@ -724,3 +726,75 @@ struct pci_dev *pci_real_dma_dev(struct pci_dev *dev)
> return dev;
> }
> #endif
> +
> +#ifdef CONFIG_DEVICE_MSI
Sorry for my naive question, but I see it in all your patches in this series
and wonder why did you wrap everything with ifdefs?.
All *.c code is wrapped with those ifdefs, which is hard to navigate and
unlikely to give any code/size optimization benefit if kernel is compiled
without CONFIG_DEVICE_MSI. The more common approach is to put those
ifdef in the public header files and leave to the compiler to drop not
called functions.
Thanks