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

dragonball: introduce pci msi/msix interrupt #8662

Merged
merged 1 commit into from Dec 22, 2023

Conversation

studychao
Copy link
Member

@studychao studychao commented Dec 14, 2023

introduce msi/msix mod to maintain information for PCI Message Signalled Interrupt Extended Capability. It will be initialized when parsing pci configuration space and used when getting interrupt capabilities.

fixes: #8661

Signed-off-by: Gerry Liu gerry@linux.alibaba.com
Signed-off-by: Zizheng Bian zizheng.bian@linux.alibaba.com
Signed-off-by: Shifang Feng fengshifang@linux.alibaba.com
Signed-off-by: Yang Su yang.su@linux.alibaba.com
Signed-off-by: Zha Bin zhabin@linux.alibaba.com
Signed-off-by: Xin Lin jingshan@linux.alibaba.com
Signed-off-by: Chao Wu chaowu@linux.alibaba.com


v2

  1. update vm-memory to 0.10.0 in order to keep consistent with other crates in Dragonball.
  2. change according to @justxuewei comments
  3. modify msix to reduce hard code and add comments.

@katacontainersbot katacontainersbot added the size/huge Largest and most complex task (probably needs breaking into small pieces) label Dec 14, 2023
Copy link
Member

@justxuewei justxuewei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @studychao! I don't have enough time to go through your code, leaving msix.rs unreviewed. I'll review the rest part later. Here is some comments.

@@ -18,3 +18,7 @@ log = "0.4.14"
downcast-rs = "1.2.0"
byteorder = "1.4.3"
thiserror = "1"
vm-memory = "0.9.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please upgrade vm-memory to 0.10.0 to keep consistent with others.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, I found dbs_acpi's vm-memory is still 0.9.0. Do we upgrade that as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vm-memory in pci part is upgraded.
dbs_acpi part will be taken care in later PR.

src/dragonball/src/dbs_pci/src/msi.rs Outdated Show resolved Hide resolved
impl MsiCap {
/// Create a new PCI MSI capability structure.
pub fn new(next: u8, mut msg_ctl: u16) -> Self {
let cap_id_next = (next as u16) << 8 | PciCapabilityID::MessageSignalledInterrupts as u16;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: PciCapabilityID -> PciCapabilityId

src/dragonball/src/dbs_pci/src/msi.rs Outdated Show resolved Hide resolved
src/dragonball/src/dbs_pci/src/msi.rs Outdated Show resolved Hide resolved
src/dragonball/src/dbs_pci/src/msi.rs Show resolved Hide resolved
// Safe to unwrap() because we have just enabled interrupt successfully.
let group = intr_manager.get_group().unwrap();
for idx in 0..self.num_enabled_vectors() {
if (self.mask_bits >> idx) & 0x1 != 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use VECTOR_MASK_BIT = 0x1 as aforementioned.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed.

src/dragonball/src/dbs_pci/src/msi.rs Outdated Show resolved Hide resolved
) -> std::io::Result<()> {
if self.enabled() {
for idx in 0..self.num_enabled_vectors() {
match ((self.mask_bits >> idx) & 0x1, (mask >> idx) & 0x1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use VECTOR_MASK_BIT?

let group = intr_manager.get_group().unwrap();
group.unmask(idx as InterruptIndex)?;
}
_ => {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some debug level logs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug log added.

@studychao
Copy link
Member Author

studychao commented Dec 19, 2023

@justxuewei hi, I have updated the PR according to your suggestion. Please take a look.

@studychao studychao force-pushed the pci/4-upstream branch 2 times, most recently from 37b9384 to 0afd77a Compare December 20, 2023 03:49
Copy link
Member

@justxuewei justxuewei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, thanks @studychao!

@studychao
Copy link
Member Author

/test

@studychao
Copy link
Member Author

/test

@studychao
Copy link
Member Author

/test-arm

@studychao
Copy link
Member Author

/test

@studychao
Copy link
Member Author

/test-s390x

introduce msi/msix mod to maintain information for PCI Message Signalled
Interrupt Extended Capability. It will be initialized when parsing pci
configuration space and used when getting interrupt capabilities.

fixes: kata-containers#8661

Signed-off-by: Gerry Liu <gerry@linux.alibaba.com>
Signed-off-by: Zizheng Bian <zizheng.bian@linux.alibaba.com>
Signed-off-by: Shifang Feng <fengshifang@linux.alibaba.com>
Signed-off-by: Yang Su <yang.su@linux.alibaba.com>
Signed-off-by: Zha Bin <zhabin@linux.alibaba.com>
Signed-off-by: Xin Lin <jingshan@linux.alibaba.com>
Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
@studychao
Copy link
Member Author

/test

@studychao studychao merged commit 555136c into kata-containers:main Dec 22, 2023
168 of 176 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test runtime-rs size/huge Largest and most complex task (probably needs breaking into small pieces)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dragonball: add msi/msix interrupt capability struct for pci emulation
4 participants