Skip to content

Remove vm-memory dependency and DeviceIo changing - #18

Merged
jiangliu merged 2 commits into
rust-vmm:masterfrom
liujing2:rm-mem-dep
Jan 14, 2020
Merged

Remove vm-memory dependency and DeviceIo changing#18
jiangliu merged 2 commits into
rust-vmm:masterfrom
liujing2:rm-mem-dep

Conversation

@liujing2

Copy link
Copy Markdown

No description provided.

jiangliu
jiangliu previously approved these changes Jan 14, 2020
@liujing2
liujing2 requested a review from jiangliu January 14, 2020 02:41
@liujing2 liujing2 changed the title Remove vm-memory dependency Remove vm-memory dependency and DeviceIo changing Jan 14, 2020
Comment thread src/lib.rs
pub trait DeviceIo: Send {
/// Read from the guest physical address `addr` to `data`.
fn read(&mut self, addr: IoAddress, data: &mut [u8]);
/// Read from guest physical address `base + offset` of the registered

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: We can write this as: "Read from the guest physical address base starting at offset. Result is placed in data." and then we don't need to specify what each argument is doing as it is more clear from the text. Same re-phrasing would be needed for write.

Unrelated to this change, but can someone remind me again why we don't return data? Having return values in function parameters is a bit of an anti-pattern.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unrelated to this change, but can someone remind me again why we don't return data? Having return values in function parameters is a bit of an anti-pattern.

It's more efficient, as it allows for a zero copy from the device into the KVM run IO/MMIO data structure.

Jing Liu added 2 commits January 14, 2020 18:05
Use u64 for guest memory address type since this can make
vm-device independent from on vm-memory.

Signed-off-by: Jing Liu <jing2.liu@linux.intel.com>
Change DeviceIo interface parameters to base and offset, so that
devices with several IO ranges can use it to locate right range.

Signed-off-by: Jing Liu <jing2.liu@linux.intel.com>
@jiangliu
jiangliu merged commit 06b9e00 into rust-vmm:master Jan 14, 2020
sameo pushed a commit to sameo/vm-device that referenced this pull request Jan 14, 2020
As suggested from
rust-vmm#18 (comment)

Suggested-by: Andreea Florescu <fandree@amazon.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
sameo pushed a commit that referenced this pull request Jan 14, 2020
As suggested from
#18 (comment)

Suggested-by: Andreea Florescu <fandree@amazon.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
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.

5 participants