Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qemu V7.0 virt changed value of GIC_IRQ_PHANDLE #27

Closed
tibersam opened this issue May 30, 2022 · 3 comments
Closed

qemu V7.0 virt changed value of GIC_IRQ_PHANDLE #27

tibersam opened this issue May 30, 2022 · 3 comments

Comments

@tibersam
Copy link

Hi all,

For the time server our team ported a timer into the qemu v7.0 virt platform. We also do not provide a dtb for the vm during compilation but let the seL4 system modify the system device tree during runtime. When we tried to run the vm_serial_server example, however we did not get any output.

The root of the problem was a wrong value of GIC_IRQ_PHANDLE, in our case it moved from 0x8001 to 0x8002. The Linux kernel did not initialize the virtual pci interface because of the wrong phandle value and therefore hvc0 was also not initialized. In our qemu dtb the phandle was used by the cpu.

I then looked more into how the qemu virt platform assigns these phandle values. They are incremented for each added phandle. Also the cpu cores are added to the device tree before the gic and for each cpu core a new phandle is assigned to it. Therefore, depending on the number of available cores, the phandle value will also change.

I am not sure how to take it from here. Possible solutions to mitigate this problem could be:

  • Document this problem in the howto. Something along the lines if a custome qemu is used, look into that qemus dtb and update GIC_IRQ_PHANDLE value accordingly.
  • Automatically find the gic in the devicetree during compilation time and set the GIC_IRQ_PHANDLE to the correct value.
  • Parse the dtb at runtime to find the correct phandle and use that for the added devices during runtime.
tibersam pushed a commit to Hensoldt-Cyber/camkes-vm that referenced this issue May 31, 2022
@tibersam
Copy link
Author

The Linux kernel will fail with "virtio-pci 0000:00:01.0: of_irq_parse_pci() failed with rc=-22". If you find this error and virtual pci devices are not working, the wrong phandle is the culprit.

axel-h pushed a commit to Hensoldt-Cyber/camkes-vm that referenced this issue Jul 26, 2022
axel-h pushed a commit to Hensoldt-Cyber/camkes-vm that referenced this issue Oct 4, 2022
@chrisguikema
Copy link
Contributor

@tibersam I just pushed up a PR that deals with this issue. Can you pull it down and check if the PR resolves it? Thanks!

@axel-h
Copy link
Member

axel-h commented Oct 27, 2022

Closing this, because #52 was merged and we use DTB paths now.

@axel-h axel-h closed this as completed Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants