Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1550809
| From | Marc Zyngier <marc.zyngier@arm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap |
| Date | 2017-01-04 14:50 +0100 |
| Message-ID | <sVU70-5lr-35@gated-at.bofh.it> (permalink) |
| References | <sVTXj-5hJ-7@gated-at.bofh.it> <sVU70-5lr-21@gated-at.bofh.it> |
| Organization | ARM Ltd |
Hi Eric,
On 04/01/17 13:32, Eric Auger wrote:
> This new function checks whether all platform and PCI
> MSI domains implement IRQ remapping. This is useful to
> understand whether VFIO passthrough is safe with respect
> to interrupts.
>
> On ARM typically an MSI controller can sit downstream
> to the IOMMU without preventing VFIO passthrough.
> As such any assigned device can write into the MSI doorbell.
> In case the MSI controller implements IRQ remapping, assigned
> devices will not be able to trigger interrupts towards the
> host. On the contrary, the assignment must be emphasized as
> unsafe with respect to interrupts.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>
> ---
>
> v4 -> v5:
> - Handle DOMAIN_BUS_FSL_MC_MSI domains
> - Check parents
> ---
> include/linux/irqdomain.h | 1 +
> kernel/irq/irqdomain.c | 41 +++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 42 insertions(+)
>
> diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
> index ab017b2..281a40f 100644
> --- a/include/linux/irqdomain.h
> +++ b/include/linux/irqdomain.h
> @@ -219,6 +219,7 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
> void *host_data);
> extern struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec,
> enum irq_domain_bus_token bus_token);
> +extern bool irq_domain_check_msi_remap(void);
> extern void irq_set_default_host(struct irq_domain *host);
> extern int irq_domain_alloc_descs(int virq, unsigned int nr_irqs,
> irq_hw_number_t hwirq, int node,
> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index 8c0a0ae..700caea 100644
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -278,6 +278,47 @@ struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec,
> EXPORT_SYMBOL_GPL(irq_find_matching_fwspec);
>
> /**
> + * irq_domain_is_msi_remap - Check if @domain or any parent
> + * has MSI remapping support
> + * @domain: domain pointer
> + */
> +static bool irq_domain_is_msi_remap(struct irq_domain *domain)
> +{
> + struct irq_domain *h = domain;
> +
> + for (; h; h = h->parent) {
> + if (h->flags & IRQ_DOMAIN_FLAG_MSI_REMAP)
> + return true;
> + }
> + return false;
> +}
> +
> +/**
> + * irq_domain_check_msi_remap() - Checks whether all MSI
> + * irq domains implement IRQ remapping
> + */
> +bool irq_domain_check_msi_remap(void)
> +{
> + struct irq_domain *h;
> + bool ret = true;
> +
> + mutex_lock(&irq_domain_mutex);
> + list_for_each_entry(h, &irq_domain_list, link) {
> + if (((h->bus_token & DOMAIN_BUS_PCI_MSI) ||
> + (h->bus_token & DOMAIN_BUS_PLATFORM_MSI) ||
> + (h->bus_token & DOMAIN_BUS_FSL_MC_MSI)) &&
> + !irq_domain_is_msi_remap(h)) {
(h->bus_token & DOMAIN_BUS_PCI_MSI) and co looks quite wrong. bus_token
is not a bitmap, and DOMAIN_BUS_* not a single bit value (see enum
irq_domain_bus_token). Surely this should read
(h->bus_token == DOMAIN_BUS_PCI_MSI).
Thanks,
M.
--
Jazz is not dead. It just smells funny...
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap Eric Auger <eric.auger@redhat.com> - 2017-01-04 14:50 +0100
Re: [PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap Marc Zyngier <marc.zyngier@arm.com> - 2017-01-04 14:50 +0100
Re: [PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap Auger Eric <eric.auger@redhat.com> - 2017-01-04 15:20 +0100
Re: [PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap Marc Zyngier <marc.zyngier@arm.com> - 2017-01-04 16:30 +0100
Re: [PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap Auger Eric <eric.auger@redhat.com> - 2017-01-04 17:00 +0100
Re: [PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap Auger Eric <eric.auger@redhat.com> - 2017-01-05 11:50 +0100
Re: [PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap Marc Zyngier <marc.zyngier@arm.com> - 2017-01-05 12:30 +0100
Re: [PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap Auger Eric <eric.auger@redhat.com> - 2017-01-05 12:40 +0100
Re: [PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap Marc Zyngier <marc.zyngier@arm.com> - 2017-01-05 13:00 +0100
Re: [PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap Auger Eric <eric.auger@redhat.com> - 2017-01-05 13:10 +0100
RE: [PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap Bharat Bhushan <bharat.bhushan@nxp.com> - 2017-01-06 05:30 +0100
Re: [PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap Auger Eric <eric.auger@redhat.com> - 2017-01-06 09:50 +0100
Re: [PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap Marc Zyngier <marc.zyngier@arm.com> - 2017-01-06 11:00 +0100
Re: [PATCH v5 13/17] irqdomain: irq_domain_check_msi_remap kbuild test robot <lkp@intel.com> - 2017-01-05 07:40 +0100
csiph-web