Skip to contentSkip to conversation

About the crossbar and xen

Xen-devel Denis Obrezkov 4 participants 14 messages Jul 10, 2019 – Jul 15, 2019

lore
Share & tools
lore
#0 lore raw

Hello,

so, I think I understood why uart doesn't work, that's because all the irqs are routed to the crossbar not to GIC, so, xen can't deal with them.

One thing I am concerned of is the:

	interrupt-controller@48281000 {
		compatible = "ti,omap5-wugen-mpu", "ti,omap4-wugen-mpu";
		interrupt-controller;
		#interrupt-cells = <0x00000003>;
		reg = <0x00000000 0x48281000 0x00000000 0x00001000>;
		interrupt-parent = <0x00000002>;
		phandle = <0x00000008>;
	};

And this is an interrupt-parent for the crossbar. So, it is not clear for me how it participates in interrupt processing. Any thoughts?

Here is my device tree: https://pastebin.com/Xec57Jcr

Signature · 6 lines
Regards, Denis Obrezkov

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 14 lines · Denis Obrezkov

Hello,

so, I think I understood why uart doesn't work, that's because all the irqs are routed to the crossbar not to GIC, so, xen can't deal with them.

One thing I am concerned of is the:

	interrupt-controller@48281000 {
		compatible = "ti,omap5-wugen-mpu", "ti,omap4-wugen-mpu";
		interrupt-controller;
		#interrupt-cells = <0x00000003>;
		reg = <0x00000000 0x48281000 0x00000000 0x00001000>;
		interrupt-parent = <0x00000002>;
		phandle = <0x00000008>;
	};
Quoted 4 lines

And this is an interrupt-parent for the crossbar. So, it is not clear for me how it participates in interrupt processing. Any thoughts?

Here is my device tree: https://pastebin.com/Xec57Jcr

Hi Denis,

If you look at the GIC node (compatible = "arm,cortex-a15-gic";) the phandle is:

  phandle = <0x00000002>;

I think that means that interrupts go to the GIC via Crossbar; i.e. the parent interrupt controller of Crossbar is the GIC.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw

Hi,

Quoted 6 lines · Stefano Stabellini
  phandle = <0x00000002>;

I think that means that interrupts go to the GIC via Crossbar; i.e. the parent interrupt controller of Crossbar is the GIC.

But the crossbar's interrupt-parent node is 0x00000008 and phandle value 0x00000008 belongs to

interrupt-controller@48281000 {
		compatible = "ti,omap5-wugen-mpu", "ti,omap4-wugen-mpu";

For me it looks like interrupts from crossbar goes to wugen and the from wugen to GIC. But I don't quite understand it.

Signature · 6 lines
Regards, Denis Obrezkov

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#3 lore raw
Quoted 10 lines · Denis Obrezkov

Hi,

Quoted 6 lines · Stefano Stabellini
  phandle = <0x00000002>;

I think that means that interrupts go to the GIC via Crossbar; i.e. the parent interrupt controller of Crossbar is the GIC.

Quoted 7 lines

But the crossbar's interrupt-parent node is 0x00000008 and phandle value 0x00000008 belongs to

interrupt-controller@48281000 {
		compatible = "ti,omap5-wugen-mpu", "ti,omap4-wugen-mpu";

For me it looks like interrupts from crossbar goes to wugen and the from wugen to GIC. But I don't quite understand it.

Hi Denis,

I only read your email and got a partial picture. I read the full device tree now and the hierarchy is as follow:

- crossbar routes to phandle 8
- phandle 8 is omap5-wugen-mpu and routes to phandle 2
- phandle 2 is the GIC

So:

crossbar -> omap5-wugen-mpu -> GIC

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw

Hi,

Quoted 24 lines · Stefano Stabellini
Quoted 10 lines · Denis Obrezkov

Hi,

Quoted 6 lines · Stefano Stabellini
  phandle = <0x00000002>;

I think that means that interrupts go to the GIC via Crossbar; i.e. the parent interrupt controller of Crossbar is the GIC.

Quoted 7 lines

But the crossbar's interrupt-parent node is 0x00000008 and phandle value 0x00000008 belongs to

interrupt-controller@48281000 {
		compatible = "ti,omap5-wugen-mpu", "ti,omap4-wugen-mpu";

For me it looks like interrupts from crossbar goes to wugen and the from wugen to GIC. But I don't quite understand it.

Hi Denis,

I only read your email and got a partial picture. I read the full device tree now and the hierarchy is as follow:

Quoted 8 lines

- crossbar routes to phandle 8
- phandle 8 is omap5-wugen-mpu and routes to phandle 2
- phandle 2 is the GIC

So:

crossbar -> omap5-wugen-mpu -> GIC

I am interested whether we should do something with omap5-wugen-mpu. I found that crossbar is connected to GIC. And on some schemes in trm it is connected via omap5-wugen-mpu. So, it is not clear for me whether it should be handled in xen.

Signature · 6 lines
Regards, Denis Obrezkov

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#5 lore raw

Denis,

Not sure if you gone through this - the interrupt routing is described in the TRM chapter on interrupt controllers. In my edition (large file, don't want to redownload unless needed.), this is chapter 17. Table 17-2 (in my edition) should address a lot of what you are asking. It shows the IRQ Input line (aka GIC ID number), the IRQ cross bar instance along with the config register and some description. Figure 17-1 shows the the layout.

From what I can tell, the cross bar is so the interrupt can be sent to the other processor on the die besides the cortex-a (aka MPU in the TRM). Mapping the TRM names to DT names might still be bit of work but this should give you an idea what to look for in the Linux kernel to backout the names used.

Quoted 38 lines · On Wednesday, July 10, 2019 22:43:37 Denis Obrezkov wrote:

Hi,

Quoted 23 lines · Stefano Stabellini
Quoted 8 lines · Denis Obrezkov

Hi,

Quoted 4 lines · Stefano Stabellini
  phandle = <0x00000002>;

I think that means that interrupts go to the GIC via Crossbar; i.e. the parent interrupt controller of Crossbar is the GIC.

Quoted 8 lines

But the crossbar's interrupt-parent node is 0x00000008 and phandle value 0x00000008 belongs to
interrupt-controller@48281000 {

		compatible = "ti,omap5-wugen-mpu", "ti,omap4-wugen-mpu";

For me it looks like interrupts from crossbar goes to wugen and the from wugen to GIC. But I don't quite understand it.

Hi Denis,

I only read your email and got a partial picture. I read the full device tree now and the hierarchy is as follow:

Quoted 7 lines

- crossbar routes to phandle 8
- phandle 8 is omap5-wugen-mpu and routes to phandle 2
- phandle 2 is the GIC

So:

crossbar -> omap5-wugen-mpu -> GIC

I am interested whether we should do something with omap5-wugen-mpu. I found that crossbar is connected to GIC. And on some schemes in trm it is connected via omap5-wugen-mpu. So, it is not clear for me whether it should be handled in xen.

Signature · 7 lines
Hunyue Yau
http://www.hy-research.com/

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#6 lore raw

Hi,

Quoted 6 lines
Quoted 5 lines

I am interested whether we should do something with omap5-wugen-mpu. I found that crossbar is connected to GIC. And on some schemes in trm it is connected via omap5-wugen-mpu. So, it is not clear for me whether it should be handled in xen.

Also, I am interested in how to add the crossbar. I can see two options as we discussed earlier. The first option is to remove the crossbar but for me it might cause some problems since a guest might want to use it. The second option is to expose the crossbar and intercept all the calls to it. But the problem is that now xen supports only one interrupt-controller. And at the same time most of the SPI IRQs are mapped to the crossbar. So, when xen checks whether the main interrupt-controller is the same as the one to who external interrupts are mapped it fails. (xen/common/device_tree.c:dt_irq_translate()).
And I don't think that I should change interrupt-parent option of devices to map them to the GIC because it is essentially the first option mentioned above. So, it seems that probably interrupt-parent finding decision logic should be changed a bit? Like to find a GIC node not in a direct interrupt-parent but transitively in one of ancestors:

UART -> crossbar -> wugen -> GIC

What do you think?

Signature · 6 lines
Regards, Denis Obrezkov

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#7 lore raw
Quoted 1 line · Denis Obrezkov

Hi,

Hi,

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

I am interested whether we should do something with omap5-wugen-mpu. I found that crossbar is connected to GIC. And on some schemes in trm it is connected via omap5-wugen-mpu. So, it is not clear for me whether it should be handled in xen.

I don't know much about omap5-wugen-mpu, so I will leave Hunyue and Iain to provide feedback here.

Quoted 18 lines
Quoted 1 line

Also, I am interested in how to add the crossbar. I can see two options as we discussed earlier. The first option is to remove the crossbar but for me it might cause some problems since a guest might want to use it. The second option is to expose the crossbar and intercept all the calls to it. But the problem is that now xen supports only one interrupt-controller. And at the same time most of the SPI IRQs are mapped to the crossbar. So, when xen checks whether the main interrupt-controller is the same as the one to who external interrupts are mapped it fails. (xen/common/device_tree.c:dt_irq_translate()).
And I don't think that I should change interrupt-parent option of devices to map them to the GIC because it is essentially the first option mentioned above. So, it seems that probably interrupt-parent finding decision logic should be changed a bit? Like to find a GIC node not in a direct interrupt-parent but transitively in one of ancestors:

Quoted 3 lines

UART -> crossbar -> wugen -> GIC

What do you think?

Have you looked at the series I pointed out earlier on? It extends Xen to support other interrupt controller parent.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#8 lore raw

Hi,

Quoted 6 lines · Julien Grall
Quoted 2 lines

What do you think?

Have you looked at the series I pointed out earlier on? It extends Xen to support other interrupt controller parent.

Yes, but you said once that these patch series wasn't accepted because maintainers didn't like something. So, I wanted to understand whether this approach is acceptable.

Signature · 6 lines
Regards, Denis Obrezkov

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#9 lore raw
Quoted 1 line · Denis Obrezkov

Hi,

Hi,

Quoted 11 lines · Julien Grall
Quoted 7 lines
Quoted 3 lines

What do you think?

Have you looked at the series I pointed out earlier on? It extends Xen to support other interrupt controller parent.

Yes, but you said once that these patch series wasn't accepted because maintainers didn't like something. So, I wanted to understand whether this approach is acceptable.

The series was reviewed publicly. Looking through the series, I don't think major concern on the approach suggested.

How about you have a try at the series and see how far you can go? We can discuss about improvement once you have the crossbar up and running.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#10 lore raw
In reply to Julien Grall

[This mail incorporates comments raised on IRC. I have made some of this more verbose to provide context to people that haven't seen the IRC comments.]

This will be a bunch of facts on the am5. Someone else will have relate it back to Xen.

1 - The WUGen is a hardware block on the MPU block that can turn interrupts into wake up events if the MPU is in certain deeper sleep states. This applies only to certain interrupts. We can confirm this by looking at the DT's register address. Per the TRM, they are registers for the MPU's PRCM (Power/Reset/Clock Management). In short, this block makes interrupts a possible wake up source.

2 - Earlier kernels did not expose that HW block. See this patch that introduced the WUGen -
https://github.com/torvalds/linux/commit/7136d457f365ecc93ddffcdd42ab49a8473f260b
I suspect looking at the before part of the patch should provide clues on how to handle the WUGen.

3 - This may be redundant but more definitions (in the human sense) here:
https://www.mjmwired.net/kernel/Documentation/devicetree/bindings/interrupt-controller/ti,omap4-wugen-mpu

4 - For the UART case, I suspect the flow Dennis pointed out is about right. However, that may be different depending on the interrupt source.

Unknowns from my point of view -

a - Does Xen virtualize power management? If so, this may have have an impact. I would not recommend adding PM virtualization in GSoC. It is tugging on a very long string.

b - If Xen does not virtualize that, someone needs to decide how much to leave to the guess.

c - I wonder if we can do a half way hack where the kernel sets up the PM but Xen hooks to get the interrupt. The HW will do its PM thing and Xen can process the interrupt.

Guesses/possible hacks -
- For the interrupts we care about, the cross bar can route things to the MPU unconditionally. This would break the other HW blocks but most of them aren't needed for boot.

Quoted 37 lines · On Thursday, July 11, 2019 18:32:22 Julien Grall wrote:
Quoted 1 line · Denis Obrezkov

Hi,

Hi,

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I am interested whether we should do something with omap5-wugen-mpu. I found that crossbar is connected to GIC. And on some schemes in trm it is connected via omap5-wugen-mpu. So, it is not clear for me whether it should be handled in xen.

I don't know much about omap5-wugen-mpu, so I will leave Hunyue and Iain to provide feedback here.

Quoted 16 lines

Also, I am interested in how to add the crossbar. I can see two options as we discussed earlier. The first option is to remove the crossbar but for me it might cause some problems since a guest might want to use it. The second option is to expose the crossbar and intercept all the calls to it. But the problem is that now xen supports only one interrupt-controller. And at the same time most of the SPI IRQs are mapped to the crossbar. So, when xen checks whether the main interrupt-controller is the same as the one to who external interrupts are mapped it fails. (xen/common/device_tree.c:dt_irq_translate()).
And I don't think that I should change interrupt-parent option of devices to map them to the GIC because it is essentially the first option mentioned above. So, it seems that probably interrupt-parent finding decision logic should be changed a bit? Like to find a GIC node not in a direct interrupt-parent but transitively in one of ancestors:

Quoted 3 lines

UART -> crossbar -> wugen -> GIC

What do you think?

Have you looked at the series I pointed out earlier on? It extends Xen to support other interrupt controller parent.

Cheers,

Signature · 7 lines
Hunyue Yau
http://www.hy-research.com/

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#11 lore raw

Hi,

Quoted 2 lines · Hunyue Yau

[This mail incorporates comments raised on IRC. I have made some of this mHi,ore verbose to provide context to people that haven't seen the IRC comments.]

Thank you for the summary!

Quoted 20 lines

This will be a bunch of facts on the am5. Someone else will have relate it back to Xen.

1 - The WUGen is a hardware block on the MPU block that can turn interrupts into wake up events if the MPU is in certain deeper sleep states. This applies only to certain interrupts. We can confirm this by looking at the DT's register address. Per the TRM, they are registers for the MPU's PRCM (Power/Reset/Clock Management). In short, this block makes interrupts a possible wake up source.

2 - Earlier kernels did not expose that HW block. See this patch that introduced the WUGen -
https://github.com/torvalds/linux/commit/7136d457f365ecc93ddffcdd42ab49a8473f260b
I suspect looking at the before part of the patch should provide clues on how to handle the WUGen.

3 - This may be redundant but more definitions (in the human sense) here:
https://www.mjmwired.net/kernel/Documentation/devicetree/bindings/interrupt-controller/ti,omap4-wugen-mpu

Quoted 8 lines

4 - For the UART case, I suspect the flow Dennis pointed out is about right. However, that may be different depending on the interrupt source.

Unknowns from my point of view -

a - Does Xen virtualize power management? If so, this may have have an impact. I would not recommend adding PM virtualization in GSoC. It is tugging on a very long string.

Xen does not virtualize power management at the moment. I agree that this is too big for the scope of the GSoC.

Quoted 7 lines

b - If Xen does not virtualize that, someone needs to decide how much to leave to the guess.

c - I wonder if we can do a half way hack where the kernel sets up the PM but Xen hooks to get the interrupt. The HW will do its PM thing and Xen can process the interrupt.

Hmmm, the question here is whether the UART would be usuable before Dom0 is setting up the PM? If not, then, we would need to deal with it in Xen.

Quoted 5 lines

Guesses/possible hacks -
- For the interrupts we care about, the cross bar can route things to the MPU unconditionally. This would break the other HW blocks but most of them aren't needed for boot.

Sorry for my ignorance, which HW blocks are you talking about?

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#12 lore raw
Quoted 52 lines · On Friday, July 12, 2019 16:13:32 Julien Grall wrote:

Hi,

Quoted 3 lines · Hunyue Yau

[This mail incorporates comments raised on IRC. I have made some of this mHi,ore verbose to provide context to people that haven't seen the IRC comments.]

Thank you for the summary!

Quoted 22 lines

This will be a bunch of facts on the am5. Someone else will have relate it back to Xen.

1 - The WUGen is a hardware block on the MPU block that can turn interrupts
into wake up events if the MPU is in certain deeper sleep states. This applies only to certain interrupts. We can confirm this by looking at the DT's register address. Per the TRM, they are registers for the MPU's PRCM (Power/Reset/Clock Management). In short, this block makes interrupts a possible wake up source.

2 - Earlier kernels did not expose that HW block. See this patch that introduced the WUGen -
https://github.com/torvalds/linux/commit/7136d457f365ecc93ddffcdd42ab49a84
73f260b I suspect looking at the before part of the patch should provide clues on how to handle the WUGen.

3 - This may be redundant but more definitions (in the human sense) here:
https://www.mjmwired.net/kernel/Documentation/devicetree/bindings/interrup
t-controller/ti,omap4-wugen-mpu

Quoted 8 lines

4 - For the UART case, I suspect the flow Dennis pointed out is about right. However, that may be different depending on the interrupt source.

Unknowns from my point of view -

a - Does Xen virtualize power management? If so, this may have have an impact. I would not recommend adding PM virtualization in GSoC. It is tugging on a very long string.

Xen does not virtualize power management at the moment. I agree that this is too big for the scope of the GSoC.

Quoted 6 lines

b - If Xen does not virtualize that, someone needs to decide how much to leave to the guess.

c - I wonder if we can do a half way hack where the kernel sets up the PM but Xen hooks to get the interrupt. The HW will do its PM thing and Xen can process the interrupt.

Hmmm, the question here is whether the UART would be usuable before Dom0 is setting up the PM? If not, then, we would need to deal with it in Xen.

Quoted 6 lines
Quoted 4 lines

Guesses/possible hacks -
- For the interrupts we care about, the cross bar can route things to the MPU unconditionally. This would break the other HW blocks but most of them aren't needed for boot.

Sorry for my ignorance, which HW blocks are you talking about?

The HW blocks I am referring to are stuff like EVE, IPU, and DSP. Initially, we can even ignore the PRUSS. This should leave just sending interrupts to the MPU. As I understand it, there is no current support for those right now anyways. I think EVE/IPU/DSP require a working cmem driver which is not fully upstreamed. BBAI does use them but that requires a specific kernel.

PRUSS would be nice (aka the PRU stuff) eventually as the bits are upstream but not critical for now.

Quoted 2 lines

Cheers,

Signature · 7 lines
Hunyue Yau
http://www.hy-research.com/

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#13 lore raw

Hi,

Quoted 60 lines · Hunyue Yau z
Quoted 52 lines · On Friday, July 12, 2019 16:13:32 Julien Grall wrote:

Hi,

Quoted 3 lines · Hunyue Yau

[This mail incorporates comments raised on IRC. I have made some of this mHi,ore verbose to provide context to people that haven't seen the IRC comments.]

Thank you for the summary!

Quoted 22 lines

This will be a bunch of facts on the am5. Someone else will have relate it back to Xen.

1 - The WUGen is a hardware block on the MPU block that can turn interrupts
into wake up events if the MPU is in certain deeper sleep states. This applies only to certain interrupts. We can confirm this by looking at the DT's register address. Per the TRM, they are registers for the MPU's PRCM (Power/Reset/Clock Management). In short, this block makes interrupts a possible wake up source.

2 - Earlier kernels did not expose that HW block. See this patch that introduced the WUGen -
https://github.com/torvalds/linux/commit/7136d457f365ecc93ddffcdd42ab49a84
73f260b I suspect looking at the before part of the patch should provide clues on how to handle the WUGen.

3 - This may be redundant but more definitions (in the human sense) here:
https://www.mjmwired.net/kernel/Documentation/devicetree/bindings/interrup
t-controller/ti,omap4-wugen-mpu

Quoted 8 lines

4 - For the UART case, I suspect the flow Dennis pointed out is about right. However, that may be different depending on the interrupt source.

Unknowns from my point of view -

a - Does Xen virtualize power management? If so, this may have have an impact. I would not recommend adding PM virtualization in GSoC. It is tugging on a very long string.

Xen does not virtualize power management at the moment. I agree that this is too big for the scope of the GSoC.

Quoted 6 lines

b - If Xen does not virtualize that, someone needs to decide how much to leave to the guess.

c - I wonder if we can do a half way hack where the kernel sets up the PM but Xen hooks to get the interrupt. The HW will do its PM thing and Xen can process the interrupt.

Hmmm, the question here is whether the UART would be usuable before Dom0 is setting up the PM? If not, then, we would need to deal with it in Xen.

Quoted 6 lines
Quoted 4 lines

Guesses/possible hacks -
- For the interrupts we care about, the cross bar can route things to the MPU unconditionally. This would break the other HW blocks but most of them aren't needed for boot.

Sorry for my ignorance, which HW blocks are you talking about?

Quoted 8 lines

The HW blocks I am referring to are stuff like EVE, IPU, and DSP. Initially, we can even ignore the PRUSS. This should leave just sending interrupts to the MPU. As I understand it, there is no current support for those right now anyways. I think EVE/IPU/DSP require a working cmem driver which is not fully upstreamed. BBAI does use them but that requires a specific kernel.

PRUSS would be nice (aka the PRU stuff) eventually as the bits are upstream but not critical for now.

Thank you for the clarification. My knowledge on the board is limited, so I will take yours comments as granted :).

Cheers,

Quoted 4 lines
Quoted 3 lines

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel