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

Implement PCI emulation #9

Merged
merged 1 commit into from Jun 21, 2022
Merged

Implement PCI emulation #9

merged 1 commit into from Jun 21, 2022

Conversation

ray90514
Copy link
Contributor

@ray90514 ray90514 commented Jun 21, 2022

This commit implements PCI emulation.

Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

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

Split the proposed changes into two pull requests: one is for PCI emulation, and another is the basis of virtio-blk.

@ray90514 ray90514 changed the title Implement virtio-blk Implement PCI emulation Jun 21, 2022
configs/linux.config Outdated Show resolved Hide resolved
Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

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

Rework the git commit messages. In order to make it informative, you should mention the following:

  1. Summarize the proposed changes: at least Virtio shall be addressed.
  2. Describe the functionalities of PCI specific changes and the limitation.
  3. How further virtio-blk makes use of the work.
    See https://cbea.ms/git-commit/

src/vm.c Outdated Show resolved Hide resolved
src/pci.c Outdated Show resolved Hide resolved
configs/linux.config Outdated Show resolved Hide resolved
@ray90514 ray90514 force-pushed the master branch 2 times, most recently from e386f2c to a205896 Compare June 21, 2022 08:07
src/pci.c Outdated Show resolved Hide resolved
src/pci.c Show resolved Hide resolved
@jserv jserv requested a review from RinHizakura June 21, 2022 08:55
src/vm.h Show resolved Hide resolved
Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

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

Improve your English writing:

There is only a PCI functionality be implemented, which is mapping internal space to io space or mmio space through BAR.

Fix grammar mistakes. Grammarly can help.

src/pci.c Outdated Show resolved Hide resolved
@jserv
Copy link
Contributor

jserv commented Jun 21, 2022

It is not worthy to mention "Virtio is a specification of para-virtualization" since the project assumes people know KVM. Instead, you should express the rationale between the proposed change and further pull requests which hopefully build up usable virtio-blk.

src/pci.c Outdated Show resolved Hide resolved
serial_handle(&v->serial, run);
} else {
for (int i = 0; i < run->io.count; i++) {
bus_handle_io(&v->io_bus, data, is_write, addr, run->io.size);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it make sense to also register serial UART as an io_bus object? So the emulated hardware with read and write method could be implemented on the same abstraction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I suppose so.

Copy link
Contributor

Choose a reason for hiding this comment

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

@RinHizakura, I tend to merge this pull request and then think of further abstractions. Can you create a new issue which consolidates serial UART refactoring?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure, I'll create an issue that mentions this later.

@ray90514 ray90514 force-pushed the master branch 3 times, most recently from 2c23bb0 to 0641c20 Compare June 21, 2022 11:40
Emulate the mechanism to access PCI config spaces on port
0xCF8/0xCFC. There is only a PCI functionality implemented,
which is mapping internal space to io space or mmio space through
BAR.

Each virtio-pci device has its own PCI config space and virtio config
space. The PCI config space can be registered to PCI bus by
pci_register_dev(). After the PCI device initialization, Guest Linux can
access the virtio config space. Our virtio-blk devices is based on
virtio-pci.

Without option "pci=conf1", the kernel doesn't find a PCI bus
and therefore also doesn't find the virtio-blk devices.
@jserv jserv merged commit a8fda18 into sysprog21:master Jun 21, 2022
@jserv
Copy link
Contributor

jserv commented Jun 21, 2022

Thank @ray90514 for contributing!

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.

None yet

3 participants