* [RFC PATCH] PCI: designware: Skip allocating own MSI domain if using external MSI domain
@ 2018-10-25 2:47 Shawn Lin
2018-11-13 5:45 ` Gustavo Pimentel
0 siblings, 1 reply; 3+ messages in thread
From: Shawn Lin @ 2018-10-25 2:47 UTC (permalink / raw)
To: Jingoo Han, Gustavo Pimentel
Cc: Lorenzo Pieralisi, linux-pci, Marc Zyngier, Shawn Lin
On some platform, external MSI domain is using instead of the one
created by designware driver. For instance, if using GIC-V3-ITS
as a MSI domain, we only need set msi-map in the devicetree but
never need any bit in the designware driver to handle MSI stuff.
So skip allocating its own MSI domain for that case.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 29a0575..39254b1 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -278,6 +278,10 @@ int dw_pcie_allocate_domains(struct pcie_port *pp)
return -ENOMEM;
}
+ /* Rely on the external MSI domain */
+ if (device_property_read_bool(dev, "msi-map"))
+ return 0;
+
pp->msi_domain = pci_msi_create_irq_domain(fwnode,
&dw_pcie_msi_domain_info,
pp->irq_domain);
@@ -433,7 +437,8 @@ int dw_pcie_host_init(struct pcie_port *pp)
if (ret)
pci->num_viewport = 2;
- if (IS_ENABLED(CONFIG_PCI_MSI)) {
+ if (IS_ENABLED(CONFIG_PCI_MSI) &&
+ !device_property_read_bool(dev, "msi-map")) {
/*
* If a specific SoC driver needs to change the
* default number of vectors, it needs to implement
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH] PCI: designware: Skip allocating own MSI domain if using external MSI domain
2018-10-25 2:47 [RFC PATCH] PCI: designware: Skip allocating own MSI domain if using external MSI domain Shawn Lin
@ 2018-11-13 5:45 ` Gustavo Pimentel
2018-11-13 6:21 ` Shawn Lin
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo Pimentel @ 2018-11-13 5:45 UTC (permalink / raw)
To: Shawn Lin, Jingoo Han, Gustavo Pimentel
Cc: Lorenzo Pieralisi, linux-pci@vger.kernel.org, Marc Zyngier
Hi Shawn,
I'd suggest to change the designware by dwc on the patch title.
On 25/10/2018 03:47, Shawn Lin wrote:
> On some platform, external MSI domain is using instead of the one
> created by designware driver. For instance, if using GIC-V3-ITS
> as a MSI domain, we only need set msi-map in the devicetree but
> never need any bit in the designware driver to handle MSI stuff.
> So skip allocating its own MSI domain for that case.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>
> ---
>
> drivers/pci/controller/dwc/pcie-designware-host.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 29a0575..39254b1 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -278,6 +278,10 @@ int dw_pcie_allocate_domains(struct pcie_port *pp)
> return -ENOMEM;
> }
>
> + /* Rely on the external MSI domain */
> + if (device_property_read_bool(dev, "msi-map"))
> + return 0;
> +
I would suggest to read this property only in the init of the host and
configuring it in a Boolean variable to be created in the pp structure and use
it to verify the feature presence or not.
> pp->msi_domain = pci_msi_create_irq_domain(fwnode,
> &dw_pcie_msi_domain_info,
> pp->irq_domain);
> @@ -433,7 +437,8 @@ int dw_pcie_host_init(struct pcie_port *pp)
> if (ret)
> pci->num_viewport = 2;
>
> - if (IS_ENABLED(CONFIG_PCI_MSI)) {
> + if (IS_ENABLED(CONFIG_PCI_MSI) &&
> + !device_property_read_bool(dev, "msi-map")) {
You could use the previous boolean variable here also.
> /*
> * If a specific SoC driver needs to change the
> * default number of vectors, it needs to implement
>
You should protect the dw_pcie_free_msi(), since it uses the pp->msi_domain and
pp->msi_irq also, maybe using the boolean variable also.
Regards,
Gustavo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC PATCH] PCI: designware: Skip allocating own MSI domain if using external MSI domain
2018-11-13 5:45 ` Gustavo Pimentel
@ 2018-11-13 6:21 ` Shawn Lin
0 siblings, 0 replies; 3+ messages in thread
From: Shawn Lin @ 2018-11-13 6:21 UTC (permalink / raw)
To: Gustavo Pimentel, Jingoo Han
Cc: shawn.lin, Lorenzo Pieralisi, linux-pci@vger.kernel.org,
Marc Zyngier
Hi Gustavo,
On 2018/11/13 13:45, Gustavo Pimentel wrote:
> Hi Shawn,
>
> I'd suggest to change the designware by dwc on the patch title.
>
Ok.
> On 25/10/2018 03:47, Shawn Lin wrote:
>> On some platform, external MSI domain is using instead of the one
>> created by designware driver. For instance, if using GIC-V3-ITS
>> as a MSI domain, we only need set msi-map in the devicetree but
>> never need any bit in the designware driver to handle MSI stuff.
>> So skip allocating its own MSI domain for that case.
>>
>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>>
>> ---
>>
>> drivers/pci/controller/dwc/pcie-designware-host.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
>> index 29a0575..39254b1 100644
>> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
>> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
>> @@ -278,6 +278,10 @@ int dw_pcie_allocate_domains(struct pcie_port *pp)
>> return -ENOMEM;
>> }
>>
>> + /* Rely on the external MSI domain */
>> + if (device_property_read_bool(dev, "msi-map"))
>> + return 0;
>> +
>
> I would suggest to read this property only in the init of the host and
> configuring it in a Boolean variable to be created in the pp structure and use
> it to verify the feature presence or not.
>
Will do.
>> pp->msi_domain = pci_msi_create_irq_domain(fwnode,
>> &dw_pcie_msi_domain_info,
>> pp->irq_domain);
>> @@ -433,7 +437,8 @@ int dw_pcie_host_init(struct pcie_port *pp)
>> if (ret)
>> pci->num_viewport = 2;
>>
>> - if (IS_ENABLED(CONFIG_PCI_MSI)) {
>> + if (IS_ENABLED(CONFIG_PCI_MSI) &&
>> + !device_property_read_bool(dev, "msi-map")) {
>
> You could use the previous boolean variable here also.
>
>> /*
>> * If a specific SoC driver needs to change the
>> * default number of vectors, it needs to implement
>>
>
> You should protect the dw_pcie_free_msi(), since it uses the pp->msi_domain and
> pp->msi_irq also, maybe using the boolean variable also.
Yeah, will fix.
Thanks for your comment.
>
> Regards,
> Gustavo
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-13 6:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-25 2:47 [RFC PATCH] PCI: designware: Skip allocating own MSI domain if using external MSI domain Shawn Lin
2018-11-13 5:45 ` Gustavo Pimentel
2018-11-13 6:21 ` Shawn Lin
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).