All of lore.kernel.org
 help / color / mirror / Atom feed
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ARM: Enable GICv2m on 32-bit virt machine
Date: Fri, 04 Dec 2015 08:54:49 +0000	[thread overview]
Message-ID: <566154D9.3050809@arm.com> (raw)
In-Reply-To: <00a901d12e6d$f953b2a0$ebfb17e0$@samsung.com>

On 04/12/15 08:30, Pavel Fedin wrote:
>  Hello!
> 
>>  Proposed solution
>>  -----------------
>>
>>  I have studied the code a bit more, and i see that proper MSI domains should have domain->ops
>> == &msi_domain_ops. Based on this, i
>> can suggest the following fix (copypasted from console, so tabs lost, don't pay attention
>> please):
> 
>  Damn, sorry, stupid me, pushed "send" before looking at test build results, and overlooked a stupid typo (struct irq_domain, not
> struct irqdomain).
>  The proper patch is (ignore spaces again plz, if confirmed good and working, i'll post it as appropriate):
> 
> $ git diff
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 53e4632..8531f89 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -43,10 +43,10 @@ static struct irq_domain *pci_msi_get_domain(struct pci_dev *dev)
>         struct irq_domain *domain;
> 
>         domain = dev_get_msi_domain(&dev->dev);
> -       if (domain)
> -               return domain;
> +       if (!domain)
> +               domain = arch_get_pci_msi_domain(dev);
> 
> -       return arch_get_pci_msi_domain(dev);
> +       return irq_domain_is_generic_msi(domain) ? domain : NULL;
>  }
> 
>  static int pci_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
> diff --git a/include/linux/msi.h b/include/linux/msi.h
> index f71a25e..c8591a2 100644
> --- a/include/linux/msi.h
> +++ b/include/linux/msi.h
> @@ -268,6 +268,7 @@ int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,
>  struct irq_domain *msi_create_irq_domain(struct fwnode_handle *fwnode,
>                                          struct msi_domain_info *info,
>                                          struct irq_domain *parent);
> +bool irq_domain_is_generic_msi(struct irq_domain *domain);
>  int msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev,
>                           int nvec);
>  void msi_domain_free_irqs(struct irq_domain *domain, struct device *dev);
> diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
> index 6b0c0b7..3182aa1 100644
> --- a/kernel/irq/msi.c
> +++ b/kernel/irq/msi.c
> @@ -253,6 +253,17 @@ struct irq_domain *msi_create_irq_domain(struct fwnode_handle *fwnode,
>  }
> 
>  /**
> + * irq_domain_is_generic_msi - Check whether the irqdomain belongs to us
> + * @domain:    The domain to check
> + *
> + * Returns: test result (true or false)
> + */
> +bool irq_domain_is_generic_msi(struct irq_domain *domain)
> +{
> +       return domain && (domain->ops == &msi_domain_ops);
> +}
> +
> +/**
>   * msi_domain_alloc_irqs - Allocate interrupts from a MSI interrupt domain
>   * @domain:    The domain to allocate from
>   * @dev:       Pointer to device struct of the device for which the interrupts
> 
> Actually this looks very similar to Marc's fix, just method of
> checking is different. Feel free to use whatever you like more.

For what is worth, Bjorn has queued the fix for 4.5, but I'm trying to
get it applied to 4.3/4.4 instead, as current mainline is affected.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

      reply	other threads:[~2015-12-04  8:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27 11:34 [PATCH v2] ARM: Enable GICv2m on 32-bit virt machine Pavel Fedin
2015-12-03 23:38 ` Tyler Baker
2015-12-04  8:08   ` Marc Zyngier
2015-12-04 23:18     ` Tyler Baker
2015-12-04  8:20   ` Pavel Fedin
2015-12-04  8:30     ` Pavel Fedin
2015-12-04  8:54       ` Marc Zyngier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=566154D9.3050809@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.