Thread (40 messages) 40 messages, 2 authors, 2018-07-05

Re: [PATCH v3 01/17] platform-msi: allow creation of MSI domain without interrupt number

From: Miquel Raynal <miquel.raynal@bootlin.com>
Date: 2018-06-29 14:43:23
Also in: linux-arm-kernel

Hi Marc,

Marc Zyngier [off-list ref] wrote on Fri, 29 Jun 2018 15:38:31
+0100:
On Fri, 29 Jun 2018 08:40:35 +0100,
Miquel Raynal [off-list ref] wrote:
quoted
Hi Marc,

Marc Zyngier [off-list ref] wrote on Thu, 28 Jun 2018 12:12:04
+0100:
  
quoted
On 22/06/18 16:14, Miquel Raynal wrote:  
quoted
platform_msi_alloc_priv_data() checks that a number of interrupts is
always given. This extra-check has no real impact and just prevents
uselessly the user to create an MSI tree domain: remove it.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/base/platform-msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/platform-msi.c b/drivers/base/platform-msi.c
index 60d6cc618f1c..9f001f4ccc0f 100644
--- a/drivers/base/platform-msi.c
+++ b/drivers/base/platform-msi.c
@@ -203,7 +203,7 @@ platform_msi_alloc_priv_data(struct device *dev, unsigned int nvec,
 	 * accordingly (which would impact the max number of MSI
 	 * capable devices).
 	 */
-	if (!dev->msi_domain || !write_msi_msg || !nvec || nvec > MAX_DEV_MSIS)
+	if (!dev->msi_domain || !write_msi_msg || nvec > MAX_DEV_MSIS)
 		return ERR_PTR(-EINVAL);
 
 	if (dev->msi_domain->bus_token != DOMAIN_BUS_PLATFORM_MSI) {
    
Huh... It's not that simple.

Yes, it allows you to get a tree via platform_msi_create_device_domain
(assuming that's why you're changing it -- your commit message doesn't
say much)  
Indeed. That was exactly my intention.
  
quoted
but it also has some impact on the way msi_domain_prepare_irqs
works (see how it is called from platform_msi_create_device_domain).

Importantly, the msi_prepare callback takes nvec as a parameter, and
that ends up trickling down to the irqchip, or whatever will setup the
MSI domain. Things like the GICv3 ITS do rely on that to carve out the
LPI space that subsequently gets used to populate the domain.

So no, you can't do it like that. If you really want a tree, add a
helper that does so.  
So if I understand correctly, what should be done is writting a new
helper that would do something similar to
platform_msi_create_device_domain(), but creating instead a tree domain
and still giving msi_domain_prepare_irqs() a meaningful number (as
nvec) that would be the maximum number of MSIs that could be allocated.
Am I right here?  
What I have in mind is the following (untested) patch. Let me know if
that works for you.
Ok, that's really close to what I wrote this morning, cool. I was not
sure that was the only thing to modify.

Thanks,
Miquèl

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help