Re: one question about MSI-X support for vPCI

2020-11-18 Thread Peter pan
Hi, Jan,

After some investigation, I found the root cause of the issue: the carrier 
is not
changed to be on if we open virtual NIC in inmate firstly, attached patch 
can
fix this issue, please help to review, by the way where I can upstream this 
patch?
Thanks.

Best Regards,
Jiafei.

在2020年11月18日星期三 UTC+8 下午6:01:51 写道:

> On 18.11.20 10:50, Peter pan wrote: 
> > Hi, Jan, 
> > 
> > I have one new issue and not sure it is a know issue. 
> > 
> > The issue is: when I ifconfig up ivshmem-net NIC in root cell firstly 
> > and then ifconfig up ivshmem NIC in inmate cell (runing Linux),  I can 
> > ping through between two NICs, but if I ifconfig up NIC in inmate cell 
> > before ifconfig up the NIC in root cell, I can't ping through between 
> > two NICs, and I found NIC in inmate can only receive packet sending from 
> > root cell NIC, but NIC in root cell can't receive any packet and there 
> > is also no irq received for ivshmem NIC. 
> > 
>
> The link states of both virtual NICs are up (ethtool)? Is there any 
> ivshmem-net interrupt received at all on the root side? There should be 
> a few during setup at least. 
>
> Check that the interrupt line on the root side is really free, and also 
> that GICD is properly intercepted by Jailhouse (check mappings). 
>
> Jan 
>
> -- 
> Siemens AG, T RDA IOT 
> Corporate Competence Center Embedded Linux 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/581e32ac-d032-4108-b4fe-21286e6b2085n%40googlegroups.com.
>From 828eecf2c696410a30bfd7c5c7a0d384c4bec7c5 Mon Sep 17 00:00:00 2001
From: Jiafei Pan 
Date: Thu, 19 Nov 2020 15:34:47 +0800
Subject: [PATCH] ivshmem-net: set carrier on if device has been opened

When virtual NIC is opened in inmate firstly, and then
open virtual NIC in root cell, virtual NIC in inmate
can't transmit packets out. The roor cause of this
issue is although state has been changed to be RUN
in process of "open", but carrier need to set to be on
after state of peer is changed to be RUN, otherwise
network stack will not transmit packet to virtual NIC.

Signed-off-by: Jiafei Pan 
---
 drivers/net/ivshmem-net.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ivshmem-net.c b/drivers/net/ivshmem-net.c
index 18d5a15dbec2..8aab21b3febe 100644
--- a/drivers/net/ivshmem-net.c
+++ b/drivers/net/ivshmem-net.c
@@ -623,6 +623,12 @@ static void ivshm_net_state_change(struct work_struct *work)
 			netif_carrier_off(ndev);
 			ivshm_net_do_stop(ndev);
 		}
+		/* In case of it has been already opened, so state is RUN,
+		 * set Carrier on when remote goes to RUN.
+		 */
+		if (peer_state == IVSHM_NET_STATE_RUN)
+			netif_carrier_on(ndev);
+
 		break;
 	}
 
-- 
2.17.1



zephyr ARM64 SMP runs on Jailhouse

2020-11-18 Thread Peng Fan
Just share info, we have enabled zephyr ARM64 SMP on Jailhouse using i.MX8M

Regards,
Peng.

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/DB6PR0402MB276052104C2CE78B10D2BD5188E00%40DB6PR0402MB2760.eurprd04.prod.outlook.com.


Re: one question about MSI-X support for vPCI

2020-11-18 Thread Jan Kiszka
On 18.11.20 10:50, Peter pan wrote:
> Hi, Jan,
> 
> I have one new issue and not sure it is a know issue.
> 
> The issue is: when I ifconfig up ivshmem-net NIC in root cell firstly
> and then ifconfig up ivshmem NIC in inmate cell (runing Linux),  I can
> ping through between two NICs, but if I ifconfig up NIC in inmate cell
> before ifconfig up the NIC in root cell, I can't ping through between
> two NICs, and I found NIC in inmate can only receive packet sending from
> root cell NIC, but NIC in root cell can't receive any packet and there
> is also no irq received for ivshmem NIC.
> 

The link states of both virtual NICs are up (ethtool)? Is there any
ivshmem-net interrupt received at all on the root side? There should be
a few during setup at least.

Check that the interrupt line on the root side is really free, and also
that GICD is properly intercepted by Jailhouse (check mappings).

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/9ea3bc46-677d-7e23-0bff-70d0218898da%40siemens.com.


Re: one question about MSI-X support for vPCI

2020-11-18 Thread Peter pan
Hi, Jan,

I have one new issue and not sure it is a know issue.

The issue is: when I ifconfig up ivshmem-net NIC in root cell firstly and 
then ifconfig up ivshmem NIC in inmate cell (runing Linux),  I can ping 
through between two NICs, but if I ifconfig up NIC in inmate cell before 
ifconfig up the NIC in root cell, I can't ping through between two NICs, 
and I found NIC in inmate can only receive packet sending from root cell 
NIC, but NIC in root cell can't receive any packet and there is also no irq 
received for ivshmem NIC.

Thanks.

Best Regards,
Jiafei.

在2020年11月13日星期五 UTC+8 下午5:55:52 写道:

> Thanks Jan, now it works with INTx.
>
> Jiafei.
>
> 在2020年11月12日星期四 UTC+8 下午9:05:15 写道:
>
>> On 12.11.20 09:50, Peter pan wrote: 
>> > Dear Jailhouse Community, 
>> > 
>> > I am runing Jailhouse on kernel v5.4, and port some ivshmem patches 
>> > from http://git.kiszka.org/?p=linux.git;a=summary 
>> >  
>> > 
>> > The issue I have is uio_shmem and ivshmem-net will probe failed when I 
>> > use MSI-X mode for vPCI after I run Jailhouse enable command.  Please 
>> > find the folowing log: 
>> > 
>> > [   21.581019] jailhouse: loading out-of-tree module taints kernel. 
>> > 
>> > [   30.000988] pci-host-generic fb50.pci: host bridge /pci@0 
>> ranges: 
>> > 
>> > [   30.000997] pci-host-generic fb50.pci:   MEM 
>> > 0xfb60..0xfb603fff -> 0xfb60 
>> > 
>> > [   30.001028] pci-host-generic fb50.pci: ECAM at [mem 
>> > 0xfb50-0xfb5f] for [bus 00] 
>> > 
>> > [   30.001081] pci-host-generic fb50.pci: PCI host bridge to bus 
>> 0003:00 
>> > 
>> > [   30.001085] pci_bus 0003:00: root bus resource [bus 00] 
>> > 
>> > [   30.001087] pci_bus 0003:00: root bus resource [mem 
>> > 0xfb60-0xfb603fff] 
>> > 
>> > [   30.001105] pci 0003:00:00.0: [110a:4106] type 00 class 0xff 
>> > 
>> > [   30.001128] pci 0003:00:00.0: reg 0x10: [mem 0x-0x0fff] 
>> > 
>> > [   30.001136] pci 0003:00:00.0: reg 0x14: [mem 0x-0x01ff] 
>> > 
>> > [   30.001340] pci 0003:00:01.0: [110a:4106] type 00 class 0xff0001 
>> > 
>> > [   30.001359] pci 0003:00:01.0: reg 0x10: [mem 0x-0x0fff] 
>> > 
>> > [   30.001368] pci 0003:00:01.0: reg 0x14: [mem 0x-0x01ff] 
>> > 
>> > [   30.002389] pci 0003:00:00.0: BAR 0: assigned [mem 
>> 0xfb60-0xfb600fff] 
>> > 
>> > [   30.002397] pci 0003:00:01.0: BAR 0: assigned [mem 
>> 0xfb601000-0xfb601fff] 
>> > 
>> > [   30.002403] pci 0003:00:00.0: BAR 1: assigned [mem 
>> 0xfb602000-0xfb6021ff] 
>> > 
>> > [   30.002409] pci 0003:00:01.0: BAR 1: assigned [mem 
>> 0xfb602200-0xfb6023ff] 
>> > 
>> > [   30.002478] uio_ivshmem 0003:00:00.0: enabling device ( -> 0002) 
>> > 
>> > [   30.002505] uio_ivshmem 0003:00:00.0: state_table at 
>> > 0xfb70, size 0x1000 
>> > 
>> > [   30.002512] uio_ivshmem 0003:00:00.0: rw_section at 
>> > 0xfb701000, size 0x9000 
>> > 
>> > [   30.002520] uio_ivshmem 0003:00:00.0: input_sections at 
>> > 0xfb70a000, size 0x6000 
>> > 
>> > [   30.002524] uio_ivshmem 0003:00:00.0: output_section at 
>> > 0xfb70a000, size 0x2000 
>> > 
>> > [   30.002576] uio_ivshmem: probe of 0003:00:00.0 failed with error -28 
>> > 
>> > [   30.002620] ivshmem-net 0003:00:01.0: enabling device ( -> 0002) 
>> > 
>> > [   30.002664] ivshmem-net 0003:00:01.0: TX memory at 
>> > 0xfb801000, size 0x0007f000 
>> > 
>> > [   30.002667] ivshmem-net 0003:00:01.0: RX memory at 
>> > 0xfb88, size 0x0007f000 
>> > 
>> > [   30.047630] ivshmem-net: probe of 0003:00:01.0 failed with error -28 
>> > 
>> > [   30.047714] The Jailhouse is opening. 
>> > 
>> > 
>> > After some investigation I found the dts node of vPIC is added to root 
>> > cell by using vpci_template.dts,  the Jailhouse 
>> > driver create_vpci_of_overlay() in driver/pci.c can't add the handler 
>> of 
>> > "msi-parent" to this PCI node,  but the kernel driver of the virtual 
>> PCI 
>> > device use the following function  
>> > ret = pci_alloc_irq_vectors(pdev, 1, 2, PCI_IRQ_LEGACY | PCI_IRQ_MSIX); 
>> > So the  driver will probe MSIX irq for the device, because there is no 
>> > msi controller is speficied to vPCI, the result is no irq-domain is 
>> > provided to this PCI and irq allocated failed. 
>> > 
>> > so how to fix such issue? Appreciate any comments and suggestions, 
>> thanks. 
>>
>> The vPCI support in Jailhouse injects interrupts as legacy INTx. For 
>> that, you need to provide up to 4 (less if you have less ivshmem 
>> devices) consecutive SPIs that are not in use by real devices (in any 
>> cell). See other arm64 configs, specifically look for vpci_irq_base. 
>>
>> Jan 
>> -- 
>> Siemens AG, T RDA IOT 
>> Corporate Competence Center Embedded Linux 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this