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

Enable user mode network backend support in qemu #1457

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

wangpc-pp
Copy link
Collaborator

@wangpc-pp wangpc-pp commented Apr 10, 2024

If libslirp is found during configuration, it will be enabled.
So we just need install libslirp before building.

@cmuellner
Copy link
Collaborator

Are you sure that this is needed?
Afaik that's automatically discovered and enabled if the library is available.
So, I believe the only thing needed is to install libslirp-dev or libslirp-devel.

@TommyMurphyTM1234
Copy link
Collaborator

Are you sure that this is needed? Afaik that's automatically discovered and enabled if the library is available. So, I believe the only thing needed is to install libslirp-dev or libslirp-devel.

And only specifically when -netdev user is employed - which may not be the common case?

I agree with @cmuellner that such dependencies should be installed rather than built - unless there is a compelling case for building them from scratch as part of the riscv-gnu-toolchain build process.

Perhaps the potential dependency should be mentioned in the readme? But it's difficult to keep up with all possible dependencies for all situations on all platforms as evidenced by a few open issues:

@wangpc-pp
Copy link
Collaborator Author

Are you sure that this is needed? Afaik that's automatically discovered and enabled if the library is available. So, I believe the only thing needed is to install libslirp-dev or libslirp-devel.

I think it's not enough, it complains:

network backend 'user' is not compiled into this binary

And as the doc says, we still need to enable it explicitly:

... this might be caused by the missing "user" mode backend. In that case, please install libslirp first ("dnf install libslirp-devel" on > Fedora and "apt-get install libslirp-dev" on Debian for example), recompile your QEMU with --enable-slirp, then try again.

@TommyMurphyTM1234
Copy link
Collaborator

The title of this PR seems to be misleading?
This change seems to configure QEMU to enable slirp support.
But the package still needs to be installed separately?
Slirp is no longer a submodule of QEMU since 7.2.0 as per the release notes that I linked above.

@cmuellner
Copy link
Collaborator

cmuellner commented Apr 10, 2024

Are you sure that this is needed? Afaik that's automatically discovered and enabled if the library is available. So, I believe the only thing needed is to install libslirp-dev or libslirp-devel.

I think it's not enough, it complains:

network backend 'user' is not compiled into this binary

And as the doc says, we still need to enable it explicitly:

... this might be caused by the missing "user" mode backend. In that case, please install libslirp first ("dnf install libslirp-devel" on > Fedora and "apt-get install libslirp-dev" on Debian for example), recompile your QEMU with --enable-slirp, then try again.

I've built QEMU here without any config flags and it states the following during the build process:

[...]
  Network backends                                                                                                                                                                                                                            
    AF_XDP support                               : NO                                                                                                                                                                                         
    slirp support                                : YES 4.7.0                                                                                                                                                                                  
    vde support                                  : NO                                                                                                                                                                                         
    netmap support                               : NO                                                                                                                                                                                         
    l2tpv3 support                               : YES
[...]

And the built qemu-system-riscv64 can be used with -netdev user,id=net1 -device virtio-net-device,netdev=net1.

I think that --enable-slirp is default if libsirp is found during configuration.

@cmuellner cmuellner changed the title Enable building libslirp of qemu Enable user mode network backend support in qemu Apr 10, 2024
@wangpc-pp
Copy link
Collaborator Author

The title of this PR seems to be misleading?

Yeah, I will change it.

This change seems to configure QEMU to enable slirp support.
But the package still needs to be installed separately?

Yes, slirp supoprt is added and we will build libslirp.so too after a

Slirp is no longer a submodule of QEMU since 7.2.0 as per the release notes that I linked above.

Are you sure that this is needed? Afaik that's automatically discovered and enabled if the library is available. So, I believe the only thing needed is to install libslirp-dev or libslirp-devel.

I think it's not enough, it complains:

network backend 'user' is not compiled into this binary

And as the doc says, we still need to enable it explicitly:

... this might be caused by the missing "user" mode backend. In that case, please install libslirp first ("dnf install libslirp-devel" on > Fedora and "apt-get install libslirp-dev" on Debian for example), recompile your QEMU with --enable-slirp, then try again.

I've built QEMU here without any config flags and it states the following during the build process:

[...]
  Network backends                                                                                                                                                                                                                            
    AF_XDP support                               : NO                                                                                                                                                                                         
    slirp support                                : YES 4.7.0                                                                                                                                                                                  
    vde support                                  : NO                                                                                                                                                                                         
    netmap support                               : NO                                                                                                                                                                                         
    l2tpv3 support                               : YES
[...]

And the built qemu-system-riscv64 can be used with -netdev user,id=net1 -device virtio-net-device,netdev=net1.

I think that --enable-slirp is default if libsirp is found during configuration.

Yeah, you're right. Maybe we should add it to README.td?

@cmuellner
Copy link
Collaborator

And the built qemu-system-riscv64 can be used with -netdev user,id=net1 -device virtio-net-device,netdev=net1.
I think that --enable-slirp is default if libsirp is found during configuration.

Yeah, you're right. Maybe we should add it to README.td?

Fine for me.
If so, then please also make sure it is installed in the CI/CD script.

If `libslirp` is found during configuration, it will be enabled.
So we just need install `libslirp` before building.
Copy link
Collaborator

@cmuellner cmuellner left a comment

Choose a reason for hiding this comment

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

LGTM

@cmuellner cmuellner merged commit 65cf14a into riscv-collab:master Apr 10, 2024
20 checks passed
@cmuellner
Copy link
Collaborator

Thanks!

@wangpc-pp wangpc-pp deleted the master-enable-slirp branch April 10, 2024 17:38
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.

3 participants