Re: Installation error in Fedora

2021-06-01 Thread Florian Bezdeka
On 01.06.21 20:45, Ralf Ramsauer wrote:
> Hi,
> 
> On 18/05/2021 17:00, Florian Bezdeka wrote:
 /home/prashant/jailhouse/hypervisor/arch/x86/vcpu.c: In function
 ‘vcpu_reset’:
 /home/prashant/jailhouse/hypervisor/arch/x86/vcpu.c:429:9: warning:
 ‘memset’ offset [0, 127] is out of the bounds [0, 0] [-Warray-bounds]
   429 | memset(_data->guest_regs, 0,
 sizeof(cpu_data->guest_regs));
   |
 ^~
>> This is a warning and treated as error due to -Wall.
>>
>> This warning is GCC 11 specific, the code compiles with GCC 10, but
>> fails with GCC 11.
>>
>> I looked into that a few days ago and considered that as gcc bug. In my
>> eyes the array boundarys are not correctly "detected" by gcc and that
>> might be the reason for the warning. Not sure if it was already reported
>> upstream to the gcc guys.
> 
> Do you have workaround to suppress this warning? I just hit that warning
> as well…

I reported [1] to the gcc project some days ago. It has been marked as
duplicate of [2] which is not resolved yet. There are several
workarounds mentioned in [2], maybe volatile does the trick...

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100834
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578

HTH,
Florian

> 
> Thanks
>   Ralf
> 


-- 
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/cbfe2115-6595-4a17-f400-86efd51028d1%40siemens.com.


Re: Installation error in Fedora

2021-06-01 Thread Ralf Ramsauer
Hi,

On 18/05/2021 17:00, Florian Bezdeka wrote:
>>> /home/prashant/jailhouse/hypervisor/arch/x86/vcpu.c: In function
>>> ‘vcpu_reset’:
>>> /home/prashant/jailhouse/hypervisor/arch/x86/vcpu.c:429:9: warning:
>>> ‘memset’ offset [0, 127] is out of the bounds [0, 0] [-Warray-bounds]
>>>   429 | memset(_data->guest_regs, 0,
>>> sizeof(cpu_data->guest_regs));
>>>   |
>>> ^~
> This is a warning and treated as error due to -Wall.
> 
> This warning is GCC 11 specific, the code compiles with GCC 10, but
> fails with GCC 11.
> 
> I looked into that a few days ago and considered that as gcc bug. In my
> eyes the array boundarys are not correctly "detected" by gcc and that
> might be the reason for the warning. Not sure if it was already reported
> upstream to the gcc guys.

Do you have workaround to suppress this warning? I just hit that warning
as well…

Thanks
  Ralf

-- 
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/eb84ab67-7711-841b-6d7b-99718e1fecd3%40oth-regensburg.de.


Re: The right configuration to partition pci device into inmate for QEMU

2021-06-01 Thread Jan Kiszka
On 01.06.21 12:04, along li wrote:
> 1.  about  Invalid PCI MMCONFIG write, device 02:00:0, reg:110, size:4"
> I don't know why show this when use original  .c configuration.
> After I added this, it  doesn't  show error.  I don't know why.
>  {
>  .phys_start = 0xb000,//mmconfig
>  .virt_start = 0xb000,
>  .size = 0x1000,
>  .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
> },

The PCI memory-mappped config region is special. Jailhouse needs to
intercept it in order to manage PCI device accesses, their visibility,
MSI/MSI-X programming and also allow for injecting the virtual shared
memory devices. If you pass the whole region through, guest may see
devices they do not own, and they will program MSI vectors that are not
valid in the light of interrupt remapping.

> 
> 2.  about qemu version
> The qemu on  ubuntu 18.04 default is 2.11.1 , it run failed.    The
> network card e1000e  will go down after ifup  eth1.
> I change to qemu-6.0.0 , it sucess. Maybe qemu-4.2.1 is also ok. 
> 

"failed" is a vague term, so hard to say what is the real problem.

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/06029a86-0a3d-0456-f3f8-51d123b27a1f%40siemens.com.


Re: How to partition PCI devices to none-root cells in rpi4b?

2021-06-01 Thread Jan Kiszka
On 01.06.21 12:40, along li wrote:
> Is UART different from other  devices? I see some uart-8250.c  code. 
> The  uart is  especially   treated ?
> 

Only in so far as the hypervisor may use a UART for its own outputs. But
there is no special handling of it when it comes to guest accesses.
That's also why you may get a mess on the console when both the
hypervisor and a guest write to the same UART.

> Will some demos which show  how to  partition  network devices or some
> other devices into   inmates   be done?
> I have tryed  in rpi4b.  like  zynqmp-zcu102-linux-demo.c ,   I added
> the mem regions and irq.  But, the  network cann't seen in inmate.
>  

You will have to adjust the inmate dts/dtb as well in order to make the
device visible. That is not done automatically by the Jailhouse runtime.

Jan

> 
> 在2021年5月14日星期五 UTC+8 下午6:10:37 写道:
> 
> On 14.05.21 05:08, along li wrote:
> > Dear community,
> >
> > For X86 platform, the  tutorial  pdf talks some about  how to
> partition
> > pci device into none-root cells.     
> > tutorial: 
> >
>  
> https://events.static.linuxfound.org/sites/events/files/slides/ELCE2016-Jailhouse-Tutorial.pdf
> 
> 
> 
> >
> 
>  
> >
> 
> >
> > But how to do this in arm64 platforms, there is no  document.
> >
> > Well how to do this, Are there  some configuration demos ?
> >
> 
> Plenty, though understanding the details requires a bit knowledge about
> the respective platforms. If you look at
> configs/arm64/zynqmp-zcu102-linux-demo.c, e.g., you can see that it
> gets
> a UART assigned by handing over the MMIO region and (IIRC) GIC IRQ 54.
> But, as I already explained, there can be more complex challenges when
> you also need to enable / clock the respective device, and those
> controls are shared with the root cell.
> 
> 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/0520cade-198a-4f89-95e4-cd5fbc6c1ae2n%40googlegroups.com
> .


-- 
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/47600e22-8b78-f08d-0d75-94df09a3de64%40siemens.com.


Re: How to partition PCI devices to none-root cells in rpi4b?

2021-06-01 Thread along li
Is UART different from other  devices? I see some uart-8250.c  code.  The  
uart is  especially   treated ?

Will some demos which show  how to  partition  network devices or some 
other devices into   inmates   be done?
I have tryed  in rpi4b.  like  zynqmp-zcu102-linux-demo.c ,   I added the 
mem regions and irq.  But, the  network cann't seen in inmate.
 

在2021年5月14日星期五 UTC+8 下午6:10:37 写道:

> On 14.05.21 05:08, along li wrote:
> > Dear community,
> > 
> > For X86 platform, the  tutorial  pdf talks some about  how to partition
> > pci device into none-root cells. 
> > tutorial: 
> >  
> https://events.static.linuxfound.org/sites/events/files/slides/ELCE2016-Jailhouse-Tutorial.pdf
> > <
> https://events.static.linuxfound.org/sites/events/files/slides/ELCE2016-Jailhouse-Tutorial.pdf
> >
> > 
> > But how to do this in arm64 platforms, there is no  document.
> > 
> > Well how to do this, Are there  some configuration demos ?
> > 
>
> Plenty, though understanding the details requires a bit knowledge about
> the respective platforms. If you look at
> configs/arm64/zynqmp-zcu102-linux-demo.c, e.g., you can see that it gets
> a UART assigned by handing over the MMIO region and (IIRC) GIC IRQ 54.
> But, as I already explained, there can be more complex challenges when
> you also need to enable / clock the respective device, and those
> controls are shared with the root cell.
>
> 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/0520cade-198a-4f89-95e4-cd5fbc6c1ae2n%40googlegroups.com.


Re: The right configuration to partition pci device into inmate for QEMU

2021-06-01 Thread along li
1.  about  Invalid PCI MMCONFIG write, device 02:00:0, reg:110, size:4"
I don't know why show this when use original  .c configuration.
After I added this, it  doesn't  show error.  I don't know why.
 {
 .phys_start = 0xb000,//mmconfig
 .virt_start = 0xb000,
 .size = 0x1000,
 .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},

2.  about qemu version
The qemu on  ubuntu 18.04 default is 2.11.1 , it run failed.The network 
card e1000e  will go down after ifup  eth1.
I change to qemu-6.0.0 , it sucess. Maybe qemu-4.2.1 is also ok. 


在2021年6月1日星期二 UTC+8 上午1:49:08 写道:

> On 31.05.21 07:00, along li wrote:
> > When I run  qemu demo. try to partition pci device into inmate.
> > I failed.
> > 
> > After some lone time trying , I sucess.
> > The PCI device  e1000e  is partitioned into inmate and ping sucess in
> > inmate.
> > what the defference is:
> > 1. I  add this into root.c(qemu-x86.c) and  qemu-linux-demo.c
> > {
> > .phys_start = 0xb000,//mmconfig
> > .virt_start = 0xb000,
> > .size = 0x1000,
> > .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
> > },
>
> This is wrong, "jailhouse config check" should also complain. You will
> eventually loose interrupts or get even worse behaviour.
>
> > or It will show   "Invalid PCI MMCONFIG write, device 02:00:0, reg:110,
> > size:4"
> > 
>
> You need to address the root cause: The guest tries to access a PCI
> config registers, likely related to PCI capability that has no write
> permission in your config yet. See also the good-old Jailhouse tutorial.
>
> > 
> > 2. use qemu-6.0 to run the qemu demo.
> > When use qemu -2..11.1 to run the demo the network  card cann't run 
> sucess.
> > It  turns off  after I turn  on it use  ifconfig  up  command.
> > 
> > well, may it help someone.  whe to try the qemu demo for pci partition.
> > 
>
> I'm on 4.2.1 to 6.0 here, those seem to have no issue with changing
> resource layout. Possibly, we have to lift the lower version boundary by
> now, though.
>
> Can you be more specific in regards to what didn't work? Did you try to
> compare if /proc/iomem in the root cell is comparable across those qemu
> versions?
>
> 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/f572fb5e-9d0a-4b8d-abc5-7aab1590aa58n%40googlegroups.com.


Re: Writing configuration files

2021-06-01 Thread Jan Kiszka
On 01.06.21 09:32, Prashant Kalikotay wrote:
> 
> On 31/05/21 10:16 PM, Jan Kiszka wrote:
>> On 28.05.21 14:10, Prashant Kalikotay wrote:
>>> Dear all,
>>>
>>>     I am trying to write configuration files for the root and
>>> the non-root cells for an arm64 based system. I have checked the video
>>> https://youtu.be/7fiJbwmhnRw and also the pdf. I could just infer from
>>> these that I have to write the config files using the already existing
>>> ones eg: amd-seatle.c and other files. But what I am not able to
>>> understand is how do I come up with the different values in the config
>>> files as in other files.
>>>
>>> For Example:
>>>
>>> This is small portion of amd-seattle.c how do we come up with the values
>>> in the mem_regions[] as 20, irqchips[] as 3, hypervisor_memory.
>> These a C-structures - the array sizes derive from the number of
>> elements we fill in below.
>>
>>> phys_start = 0x83e000, and all othe r values in the config files.
>>> Which document has been used. Any pointer to any of the documents of the
>>> various config files listed in the configs would be a lot helpful.
>>>
>> Concepts should have been explained in the tutorial you cited, details
>> are unfortunately not specified. Therefore, you need to study existing
>> configs and translate that knowledge to your specific target.
>>
>> If you understand that partitioning concepts and mechanisms in
>> Jailhouse, doing so should be possible (you can always ask for concrete
>> details here). If not, even a detailed specification of the config
>> format would likely not help because you always have to apply that to
>> your concrete case, and the abstraction level of Jailhouse is fairly low.
>>
>> Jan
>>
> Thanks for your reply Jan,
> 
>    I am trying to write
> configuration file for a arm64 based system. My doubt is how to go about
> allocating memory regions for the root and non-root cells. How do I come
> up with these addresses
> 
> phys_start = _/0x83e000 /_. 
> 

Memory regions describe portions of the physical address space, mapped
into a cell (guest).

For the root cell, study how the real system looks like (device tree,
/proc/iomem of a booted Linus). On x86, the latter is what "jailhouse
config create" does as well. For other archs, we are lacking comparable
support, but the task is often simpler.

If you want to hand out a certain amount of RAM to a non-root cell, you
need to

 - make sure that the root cell does not use that (mem=... or device
   tree reservation)
 - define a memory region in the non-root cell config with the
   corresponding phys_start and size values
 - decide whether to map it 1:1 (virt_start == phys_start) or to make it
   appear in the cell at a different address
 - tell the cell where to find it (e.g. via device tree -> jailhouse
   cell linux ... will do that on startup)

HTH,
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/90615fdb-97e3-a700-936b-9e348e859880%40siemens.com.


Re: Writing configuration files

2021-06-01 Thread Prashant Kalikotay


On 31/05/21 10:16 PM, Jan Kiszka wrote:

On 28.05.21 14:10, Prashant Kalikotay wrote:

Dear all,

     I am trying to write configuration files for the root and
the non-root cells for an arm64 based system. I have checked the video
https://youtu.be/7fiJbwmhnRw and also the pdf. I could just infer from
these that I have to write the config files using the already existing
ones eg: amd-seatle.c and other files. But what I am not able to
understand is how do I come up with the different values in the config
files as in other files.

For Example:

This is small portion of amd-seattle.c how do we come up with the values
in the mem_regions[] as 20, irqchips[] as 3, hypervisor_memory.

These a C-structures - the array sizes derive from the number of
elements we fill in below.


phys_start = 0x83e000, and all othe r values in the config files.
Which document has been used. Any pointer to any of the documents of the
various config files listed in the configs would be a lot helpful.


Concepts should have been explained in the tutorial you cited, details
are unfortunately not specified. Therefore, you need to study existing
configs and translate that knowledge to your specific target.

If you understand that partitioning concepts and mechanisms in
Jailhouse, doing so should be possible (you can always ask for concrete
details here). If not, even a detailed specification of the config
format would likely not help because you always have to apply that to
your concrete case, and the abstraction level of Jailhouse is fairly low.

Jan


Thanks for your reply Jan,

   I am trying to write 
configuration file for a arm64 based system. My doubt is how to go about 
allocating memory regions for the root and non-root cells. How do I come 
up with these addresses


phys_start =_/0x83e000 /_.

Regards,
Prashant K

--
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/914726a1-7178-321f-42fb-012ec241266a%40cimware.in.