ravynsoft / ravynos

A BSD-based OS project that aims to provide source and binary compatibility with macOS® and a similar user experience.
https://www.ravynos.com
Other
5.68k stars 192 forks source link

i915kms.ko GVT-g mediated passthrough enablement #349

Closed markshank closed 2 years ago

markshank commented 2 years ago

This goes a different direction that we originally started with. So I undid some of ayeed and mszoek prep work.

I simply lifted the pci_iomap_range code from Linux and dropped it into the Kernel tree. I had expected to have to butcher it up to get it to work. Imagine my surprise when I only had to comment out two lines that weren't needed for my use case. It just compiled and worked!

I suspect that because of how close to Linux original it is, I have it in the wrong place in the tree. That should probably be revisited if we want to submit it upstream.

I tested it on bare metal with ravynOS to satisfy myself that I didn't break it there. I have had various degrees of success in FreeBSD virtual machines. I haven't found a way to test it with ravynOS in a VM yet. That's why I have created this pull request. So I can have it in a ravynOS iso.

mszoek commented 2 years ago

Be careful - we can't just drop GPL code into the kernel without potentially tainting the whole thing. This code looks pretty trivial and I think even if we were to write an original implementation it would look virtually identical - so maybe is OK. Copyright (and therefore licensing) doesn't apply to something that has just one obvious solution, and this appears to be such a case. This StackOverflow post expresses it pretty well:

In copyright law, expression is copyrightable, and ideas are not copyrightable. In particular, expression is copyrightable only insofar as that expression is distinct from the idea is expresses. This is closely related to the "merger doctrine," which states that when an idea can only be expressed in a limited number of ways, then expressions of that idea are not copyrightable: that is, the idea and the expression are inextricably "merged" with one another.

markshank commented 2 years ago

I spent a little time looking around for a better place for this code. The best I could come up with on short notice is in drm-kmod with the i915 source. Would that make it upstream worthy?

And I should uncomment the two lines of code and wrap them with "#ifdef __linux__" and "#endif" instead.