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

pci: add pci device support in dbs-cli #30

Merged
merged 2 commits into from
Jan 22, 2024
Merged

Conversation

studychao
Copy link
Member

  1. attach pci device during the boot time of Dragonball.
  2. hot plug pci device when the Dragonball is running.
  3. prepare to hot unplug pci device when the Dragonball is running.
  4. hot unplug pci device when the Dragonball is running.

fixes: #29

Signed-off-by: Chao Wu <[email protected]>
Copy link
Contributor

@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, a few comments here.

README.md Outdated

You can choose to attach a pci device during the boot time of Dragonball.
```
./dbs-cli create --log-file $LOG_FILE --log-level $LOG_LEVEL --kernel-path $KERNEL_PATH --rootfs $ROOTFS_PATH --boot-args "console=ttyS0 tty0 reboot=k debug panic=1 root=/dev/vda1" --hostdev-id $HOST_DEVICE_ID --sysfs-path $SYSFS_PATH --bus-slot-func $BUS_SLOT_FUNC --vendor-device-id $VENDOR_DEVICE_ID
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you give an example of how to acquire those values? For example:

Get Xxxxxx's hostdev-id by lspci

$ lspci
02:00.0 Xxxxxx
$ HOST_DEVICE_ID="02:00.0"

I think leaving the part of adding PCI device is enough. Otherwise, it looks too complicated to read.

--hostdev-id $HOST_DEVICE_ID \
--sysfs-path $SYSFS_PATH \
--bus-slot-func $BUS_SLOT_FUNC \
--vendor-device-id $VENDOR_DEVICE_ID

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@@ -153,6 +157,31 @@ impl CliInstance {
.expect("failed to set vsock socket path");
}

if !args.host_device.hostdev_id.is_none() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if !args.host_device.hostdev_id.is_none() {
if let Some(hostdev_id) = args.host_device.hostdev_id {

Copy link
Member Author

Choose a reason for hiding this comment

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

actually this is for checking whether user provide hostdev_id and bus_slot_func in the command line (which are the must parameters) and I was being lazy to just check one of the parameters......

I have completed this part and also added a comment above.

Comment on lines 163 to 167
hostdev_id: args
.host_device
.hostdev_id
.expect("There has to be hostdev_id if you want to add host device."),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
hostdev_id: args
.host_device
.hostdev_id
.expect("There has to be hostdev_id if you want to add host device."),
hostdev_id,

Copy link
Member Author

Choose a reason for hiding this comment

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

ditto.

@studychao studychao force-pushed the pci branch 2 times, most recently from 7413e45 to 12b8357 Compare January 22, 2024 03:06
1. attach pci device during the boot time of Dragonball.
2. hot plug pci device when the Dragonball is running.
3. prepare to hot unplug pci device when the Dragonball is running.
4. hot unplug pci device when the Dragonball is running.

fixes: openanolis#29

Signed-off-by: Chao Wu <[email protected]>
Copy link
Contributor

@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 studychao merged commit bf44848 into openanolis:main Jan 22, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

Add pci support into dbs-cli
2 participants