-
Notifications
You must be signed in to change notification settings - Fork 268
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
x86_64 virtio:get irqnum support for x86_64 virtio dev #97
base: main
Are you sure you want to change the base?
Conversation
pub unsafe fn new() -> Self { | ||
Acpi { | ||
rsdp: AcpiTables::search_for_rsdp_bios(LocalAcpiHandler).unwrap(), | ||
aml_context: AmlContext::new(Box::new(LocalAmlHandler), DebugVerbosity::None), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we eliminate the dependency of the crate aml
to avoid alloc
in axhal
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, we can't for now. Because both acpi
and aml
crate rely on alloc
. Crate acpi
is used to parse ACPI table and Crate aml
is used to invoke ACPI method. Both are need to finish the job of getting irq routing from PCI device pin to APIC pin.
Although the developers of acpi
and aml
crate offer another crate rsdp
for environment without heap alloctors, it only finds and parses RSDP
and cannot parse the data and methods in ACPI table.
Crate aml
is hard to eliminate since we need to invoke ACPI method _PRT
to get irq routing from PCI device pin to APIC pin.
However, if we accept a legacy way, we may get irq number of PCI device without ACPI completely.
It seems that PCI device irq pin connects to two APIC pins in many motherboards (e.g. in current arceos qemu environment, virtio-net PCI device pinA is connected to APIC pin both 11 and 22) , one (e.g. 11) is for compatibility with PIC, and can be readed from PCI configuration space under IRQ Line
field.
Since arceos disables PIC and uses APIC only, I think it is better to use the pin specialized for APIC (which needs to get from ACPI) and neglect the pin for PIC.
By the way, using the PIC one(e.g. 11) has another (small) programming problem.
Current virtio_drivers
crate on github, which is responsible for parsing virtio PCI configuration space, doesn't have a method to read IRQ Line
field. We may need to add this method if we choose the legacy solution.
Any suggestions are welcome and appreciated.😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we drop the legacy IRQ support and use MSI instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can. It seems to be a much better solution. I will try it later.
Can we drop the legacy IRQ support and use MSI instead?
f488812
to
25d75ce
Compare
This PR
Since the virtio framework in the main branch does not currently support interrupts, this PR provides the
get_pci_irq_vector
function for fetching x86_64 device interrupt numbers.