From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Hanjun Guo <hanjun.guo@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linuxarm@huawei.com, Thomas Gleixner <tglx@linutronix.de>,
Greg KH <gregkh@linuxfoundation.org>,
Tomasz Nowicki <tn@semihalf.com>, Ma Jun <majun258@huawei.com>,
Kefeng Wang <wangkefeng.wang@huawei.com>,
Agustin Vega-Frias <agustinv@codeaurora.org>,
Sinan Kaya <okaya@codeaurora.org>,
Charles Garcia Tobin <charles.garcia-tobin@arm.com>,
huxinwei@huawei.com, yimin@huawei.com,
Jon Masters <jcm@redhat.com>
Subject: Re: [PATCH v6 09/14] ACPI: platform: setup MSI domain for ACPI based platform device
Date: Mon, 2 Jan 2017 22:17:04 +0100 [thread overview]
Message-ID: <CAJZ5v0hoF_EryMTSc+C0cYAM_fNEDykF6p9KnJ2VuZtg4p9YbA@mail.gmail.com> (raw)
In-Reply-To: <1483363905-2806-10-git-send-email-hanjun.guo@linaro.org>
On Mon, Jan 2, 2017 at 2:31 PM, Hanjun Guo <hanjun.guo@linaro.org> wrote:
> With the platform msi domain created, we can set up the msi domain
> for a platform device when it's probed.
>
> In order to do that, we need to get the domain that the platform
> device connecting to, so the iort_get_platform_device_domain() is
> introduced to retrieve the domain from iort.
>
> After the domain is retrieved, we need a proper way to set the
> domain to paltform device, as some platform devices such as an
> irqchip needs the msi irqdomain to be the interrupt parent domain,
> we need to get irqdomain before platform device is probed but after
> the platform device is allocated (the time slot of setting the
> msi domain also works for other cases). So simply call
> acpi_configure_pmsi_domain() in acpi_platform_notify() for
> platform devices will work.
>
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
ACK for the glue.c part.
> ---
> drivers/acpi/arm64/iort.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> drivers/acpi/glue.c | 6 ++++++
> include/linux/acpi_iort.h | 3 +++
> 3 files changed, 52 insertions(+)
>
> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index bc68d93..6b72fcb 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c
> @@ -527,6 +527,49 @@ struct irq_domain *iort_get_device_domain(struct device *dev, u32 req_id)
> return irq_find_matching_fwnode(handle, DOMAIN_BUS_PCI_MSI);
> }
>
> +/**
> + * iort_get_platform_device_domain() - Find MSI domain related to a
> + * platform device
> + * @dev: the dev pointer associated with the platform device
> + *
> + * Returns: the MSI domain for this device, NULL otherwise
> + */
> +static struct irq_domain *iort_get_platform_device_domain(struct device *dev)
> +{
> + struct acpi_iort_node *node, *msi_parent;
> + struct fwnode_handle *iort_fwnode;
> + struct acpi_iort_its_group *its;
> +
> + /* find its associated iort node */
> + node = iort_scan_node(ACPI_IORT_NODE_NAMED_COMPONENT,
> + iort_match_node_callback, dev);
> + if (!node)
> + return NULL;
> +
> + /* then find its msi parent node */
> + msi_parent = iort_node_get_id(node, NULL, IORT_MSI_TYPE, 0);
> + if (!msi_parent)
> + return NULL;
> +
> + /* Move to ITS specific data */
> + its = (struct acpi_iort_its_group *)msi_parent->node_data;
> +
> + iort_fwnode = iort_find_domain_token(its->identifiers[0]);
> + if (!iort_fwnode)
> + return NULL;
> +
> + return irq_find_matching_fwnode(iort_fwnode, DOMAIN_BUS_PLATFORM_MSI);
> +}
> +
> +void acpi_configure_pmsi_domain(struct device *dev)
> +{
> + struct irq_domain *msi_domain;
> +
> + msi_domain = iort_get_platform_device_domain(dev);
> + if (msi_domain)
> + dev_set_msi_domain(dev, msi_domain);
> +}
> +
> static int __get_pci_rid(struct pci_dev *pdev, u16 alias, void *data)
> {
> u32 *rid = data;
> diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
> index f8d6564..4a73f27 100644
> --- a/drivers/acpi/glue.c
> +++ b/drivers/acpi/glue.c
> @@ -6,6 +6,8 @@
> *
> * This file is released under the GPLv2.
> */
> +
> +#include <linux/acpi_iort.h>
> #include <linux/export.h>
> #include <linux/init.h>
> #include <linux/list.h>
> @@ -14,6 +16,7 @@
> #include <linux/rwsem.h>
> #include <linux/acpi.h>
> #include <linux/dma-mapping.h>
> +#include <linux/platform_device.h>
>
> #include "internal.h"
>
> @@ -315,6 +318,9 @@ static int acpi_platform_notify(struct device *dev)
> if (!adev)
> goto out;
>
> + if (dev->bus == &platform_bus_type)
> + acpi_configure_pmsi_domain(dev);
> +
> if (type && type->setup)
> type->setup(dev);
> else if (adev->handler && adev->handler->bind)
> diff --git a/include/linux/acpi_iort.h b/include/linux/acpi_iort.h
> index ef99fd52..33f5ac3 100644
> --- a/include/linux/acpi_iort.h
> +++ b/include/linux/acpi_iort.h
> @@ -38,6 +38,7 @@
> /* IOMMU interface */
> void iort_set_dma_mask(struct device *dev);
> const struct iommu_ops *iort_iommu_configure(struct device *dev);
> +void acpi_configure_pmsi_domain(struct device *dev);
> #else
> static inline void acpi_iort_init(void) { }
> static inline bool iort_node_match(u8 type) { return false; }
> @@ -58,6 +59,8 @@ static inline void iort_set_dma_mask(struct device *dev) { }
> static inline
> const struct iommu_ops *iort_iommu_configure(struct device *dev)
> { return NULL; }
> +
> +static inline void acpi_configure_pmsi_domain(struct device *dev) { }
> #endif
>
> #define IORT_ACPI_DECLARE(name, table_id, fn) \
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-01-02 21:17 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-02 13:31 [PATCH v6 00/14] ACPI platform MSI support and its example mbigen Hanjun Guo
2017-01-02 13:31 ` [PATCH v6 01/14] ACPI: ARM64: IORT: minor cleanup for iort_match_node_callback() Hanjun Guo
2017-01-03 14:08 ` Lorenzo Pieralisi
2017-01-04 7:56 ` Hanjun Guo
2017-01-02 13:31 ` [PATCH v6 02/14] irqchip: gic-v3-its: keep the head file include in alphabetic order Hanjun Guo
2017-01-11 10:20 ` Matthias Brugger
2017-01-11 10:20 ` Matthias Brugger
2017-01-11 14:16 ` Hanjun Guo
2017-01-02 13:31 ` [PATCH v6 03/14] ACPI: ARM64: IORT: add missing comment for iort_dev_find_its_id() Hanjun Guo
2017-01-04 14:34 ` Lorenzo Pieralisi
2017-01-05 6:05 ` Hanjun Guo
2017-01-05 9:53 ` Lorenzo Pieralisi
2017-01-02 13:31 ` [PATCH v6 04/14] irqchip: gicv3-its: platform-msi: refactor its_pmsi_prepare() Hanjun Guo
2017-01-11 10:31 ` Matthias Brugger
2017-01-02 13:31 ` [PATCH v6 05/14] ACPI: platform-msi: retrieve dev id from IORT Hanjun Guo
2017-01-03 8:43 ` Tomasz Nowicki
2017-01-03 9:37 ` Tomasz Nowicki
2017-01-03 11:24 ` Tomasz Nowicki
2017-01-04 19:18 ` Lorenzo Pieralisi
2017-01-05 12:45 ` Hanjun Guo
2017-01-05 15:15 ` Lorenzo Pieralisi
2017-01-10 13:39 ` Hanjun Guo
2017-01-10 14:57 ` Lorenzo Pieralisi
2017-01-11 14:15 ` Hanjun Guo
2017-01-02 13:31 ` [PATCH v6 06/14] irqchip: gicv3-its: platform-msi: refactor its_pmsi_init() to prepare for ACPI Hanjun Guo
2017-01-03 7:41 ` Tomasz Nowicki
2017-01-04 7:02 ` Hanjun Guo
2017-01-04 7:29 ` Tomasz Nowicki
2017-01-04 8:25 ` Hanjun Guo
2017-01-04 9:02 ` Marc Zyngier
2017-01-04 10:19 ` Hanjun Guo
2017-01-02 13:31 ` [PATCH v6 07/14] irqchip: gicv3-its: platform-msi: scan MADT to create platform msi domain Hanjun Guo
2017-01-02 13:31 ` [PATCH v6 08/14] ACPI: ARM64: IORT: rework iort_node_get_id() Hanjun Guo
2017-01-04 17:58 ` Lorenzo Pieralisi
2017-01-05 8:19 ` Hanjun Guo
2017-01-02 13:31 ` [PATCH v6 09/14] ACPI: platform: setup MSI domain for ACPI based platform device Hanjun Guo
2017-01-02 21:17 ` Rafael J. Wysocki [this message]
2017-01-02 13:31 ` [PATCH v6 10/14] ACPI: ARM64: IORT: rework iort_node_get_id() for NC->SMMU->ITS case Hanjun Guo
2017-01-02 22:30 ` Sinan Kaya
2017-01-03 0:08 ` Hanjun Guo
2017-01-02 13:31 ` [PATCH v6 11/14] msi: platform: make platform_msi_create_device_domain() ACPI aware Hanjun Guo
2017-01-04 16:49 ` Lorenzo Pieralisi
2017-01-02 13:31 ` [PATCH v6 12/14] irqchip: mbigen: drop module owner Hanjun Guo
2017-01-02 13:31 ` [PATCH v6 13/14] irqchip: mbigen: introduce mbigen_of_create_domain() Hanjun Guo
2017-01-02 13:31 ` [PATCH v6 14/14] irqchip: mbigen: Add ACPI support Hanjun Guo
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=CAJZ5v0hoF_EryMTSc+C0cYAM_fNEDykF6p9KnJ2VuZtg4p9YbA@mail.gmail.com \
--to=rafael@kernel.org \
--cc=agustinv@codeaurora.org \
--cc=charles.garcia-tobin@arm.com \
--cc=gregkh@linuxfoundation.org \
--cc=hanjun.guo@linaro.org \
--cc=huxinwei@huawei.com \
--cc=jcm@redhat.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=lorenzo.pieralisi@arm.com \
--cc=majun258@huawei.com \
--cc=marc.zyngier@arm.com \
--cc=okaya@codeaurora.org \
--cc=rjw@rjwysocki.net \
--cc=tglx@linutronix.de \
--cc=tn@semihalf.com \
--cc=wangkefeng.wang@huawei.com \
--cc=yimin@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).