You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/05/05 07:51:38 UTC

[GitHub] [incubator-nuttx] sonicyang opened a new pull request #974: x86_64: Jailhouse support

sonicyang opened a new pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974


   ## Summary
   
   Jailhouse (https://github.com/siemens/jailhouse) is a partitioning hypervisor based on Linux.
   
   This patch adds ability to make Nuttx bootable as a Jailhouse cell.
   It includes 3 parts:
    * Because Jailhouse execute code from 0x0 without a BIOS, a option to remove multiboot header is added
    * Because Jailhouse kickstart the CPU at realmode, a stub to bring the CPU into protected mode is added.
    * Because in a Jailhouse environment, the interrupt controllers are initialized by Linux and IO-APIC related operation are not supported by Jailhouse, an option is added to disable the APIC/IO-APIC/8259 initialization and IO-APIC/8259 related operations. 
   
   ## Testing
   
   ostest can run on Jailhouse.
   
   ## Other comments
   
   1. I will be glad to provide a example jailhouse cell config if needed.
   2. You need to have a PCI/PCI-E based serial device to have an output, because Jailhouse don't support 8259 and IO-APIC, which the legacy COM port is hooked to. (at least I can get it working reliably.)
   3. Or you can force the Nuttx 16550 serial driver to output in polling mode, but commenting out the following in `driver/serial/serial.c:1062`. This will allow you to run ostest with legacy COM port, but not nsh because serial RX requires interrupt handling.
   ```
     1062   if (up_interrupt_context() || sched_idletask())                                                                                                                     
   ```
   4. Maybe we can add a option config to disable TX interrupt of serial interface?
   5. I am working on a PCI-E framework and a example serial driver.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-623990238


   @sonicyang @btashton I am also intersting in the pcie support, we have RISCV SoC with PCIE as slave. It will be great if the new pcie subsystem support on x86 platform and slave mode.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
btashton commented on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-624441004


   We can put it in a follow on patch with a defconfig and a readme (happy to document my setup since I am new to it).  This is really cool and I want to explore it more some time.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] sonicyang commented on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
sonicyang commented on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-624457184


   @btashton Seems like PR #944 breaks my bootstrap code.
   I am fixing this at the moment.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] sonicyang edited a comment on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
sonicyang edited a comment on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-624439927


   @btashton  The memory address and PIO regions might not be properly configured .
   
   I am using a custom config.
   Let me fire up my test machine and paste as a gist first.
   Should it be included in this patch?
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] sonicyang commented on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
sonicyang commented on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-624442896


   @btashton Good, because I always works on a real host machine.
   
   Willing to see some one test it out on a qemu+Jailhouse environment.
   
   Here is my config:
   https://gist.github.com/sonicyang/6503b9607e82cd92400f71f278823dd6
   
   Some points:
     1. I allocated a quite large memory block for Nuttx
     2. You should adjust the low memory physical address according to your root-cell config, find a piece of large and reserved memory for it.
     3. For your reference, I created my root config with:
   ```
   sudo jailhouse config create -c ttyS1 --mem-hv 128M --mem-inmates 1536M sysconfig.c
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] sonicyang commented on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
sonicyang commented on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-625766601


   @btashton 
   As you have merged this, 
   I guess you had good news on making this run on QEMU + Jailhouse environment?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] sonicyang edited a comment on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
sonicyang edited a comment on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-624523205


   @btashton Here is the patch.
   
   Nan, that's not your fault.
   I did this patch while you were fixing the 4M -> 1M issue.
   I should have check and found out this issue when I rebased.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
btashton commented on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-623916357


   @sonicyang I'll try and give this more of a review tomorrow (it's very late for me).  I did see your comment about PCI.  I was actually starting to work on this before I got distracted by fixing the CI system.  Maybe we can chat more on this.  I was going to start by implementing part of the  /dev/pci character device interface that freebsd implements.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] sonicyang commented on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
sonicyang commented on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-624439927


   @sonicyang The memory address and PIO regions might not be properly configured .
   
   I am using a custom config.
   Let me fire up my test machine and paste as a gist first.
   Should it be included in this patch?
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
btashton commented on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-624439132


   @sonicyang I think I got fairly far through setting up jailhouse, but I am afraid I am a little lost.
   I created the jailhouse environment via https://github.com/siemens/jailhouse-images which was fine and when I start qemu I am able to run the demo applications in cells no problem.
   
   I built nuttx with the flag to turn off multiboot2 and the acpi config flags you added and also turned on raw bin output.  When I try to load `nuttx.bin` into the cell it fails
   ```
   root@demo~# jailhouse cell load tiny-demo nuttx.bin
   JAILHOUSE_CELL_LOAD: invalid argument
   ```
   
   Also which cell config were you using?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-623990238


   @sonicyang @btashton I am also intersting in the pcie support, we have RISCV SoC with PCIE as slave. It will be great if the new pcie subsystem support non x86 platform and slave mode.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] sonicyang commented on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
sonicyang commented on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-624523205


   @btashton Here is the patch.
   
   Nan, that not your fault.
   I did this patch while you were fixing the 4M -> 1M issue.
   I should have check and found out this issue when I rebased.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
btashton commented on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-624495400


   I was not able to get my jailroot environment working correctly tonight (kept getting MMIO and PIO crashes unrelated to NuttX).  I'll try it again another time, in the meantime once you have that bootstrap fix (sorry my fix broke this) ready I'll be happy to merge this in.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
btashton commented on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-625847667


   Unfortunately not... I think I needed to be compiling the configurations inside QEMU because I was getting really weird crashes and kernel header issues.  I still want to revisit it, but I wanted to get moving on the PCI stuff for a bit before trying again. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] sonicyang commented on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
sonicyang commented on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-623938877


   @btashton Thank you, I will wait.
   
    The PCI-e patch I am preparing to proposed a PR is a framework and APIs toward architecture dependpart. On top of this, having a character device user-space interface might be a good idea.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] sonicyang commented on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
sonicyang commented on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-624146496


   @xiaoxiang781216 I ported the PCI support from the Jailhouse inmate library, which is master only.
   I am afraid I am not a pro on PCI-E, so cannot promise much about it.
   But, yeah, having multi-arch support is important I think.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] sonicyang commented on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
sonicyang commented on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-623913713


   This is affected by PR #973. Without it, the processor core will crash instantly on cell start.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton edited a comment on pull request #974: x86_64: Jailhouse support

Posted by GitBox <gi...@apache.org>.
btashton edited a comment on pull request #974:
URL: https://github.com/apache/incubator-nuttx/pull/974#issuecomment-624495400


   I was not able to get my jailhouse environment working correctly tonight (kept getting MMIO and PIO crashes unrelated to NuttX).  I'll try it again another time, in the meantime once you have that bootstrap fix (sorry my fix broke this) ready I'll be happy to merge this in.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org