On Mon, 15 Dec 2014, Ted Unangst wrote: > On Wed, Dec 10, 2014 at 00:32, Stefan Fritsch wrote: > > > --- a/sys/arch/amd64/conf/GENERIC > > +++ b/sys/arch/amd64/conf/GENERIC > > @@ -39,6 +39,8 @@ isa0 at amdpcib? > > isa0 at tcpcib? > > pci* at mainbus0 > > > > +paravirt0 at mainbus0 > > + > > acpi0 at bios0 > > acpitimer* at acpi? > > acpihpet* at acpi? > > diff --git a/sys/arch/amd64/conf/files.amd64 > > b/sys/arch/amd64/conf/files.amd64 > > index 103b653..a73d5d8 100644 > > --- a/sys/arch/amd64/conf/files.amd64 > > +++ b/sys/arch/amd64/conf/files.amd64 > > @@ -80,6 +80,12 @@ device mainbus: isabus, pcibus, mainbus > > attach mainbus at root > > file arch/amd64/amd64/mainbus.c mainbus > > > > +device paravirt > > +attach paravirt at mainbus > > +file arch/amd64/amd64/paravirt.c paravirt needs-flag > > + > > +file arch/amd64/amd64/codepatch.c > > Can you explain why this needs to be a device? It doesn't appear to be > doing any device like things. >
Only in order to get a flags field that can be tweaked with config(8). And to allow disable via config(8), though that could also be achieved with a flag. Tweaking the behavior with a flags value is necessary because hypervisors not always announce what they are capable of. One reason for this is that qemu is responsible for setting most of the cpuid flags but the kvm kernel module offers some interfaces in all cases. Another reason seems to be simple oversight, for example Illuminos KVM forgot to add the cpuid stuff from Linux KVM. And if there is some bug it may be a good idea to have a simple way to check if it is related to the paravirt stuff. I have just noticed that there is support in config(8) to set non-devices related int values. But this does not seem to be supported in the in-kernel UKC. And I can't see right now how config finds the valid int values in the kernel. Or is it just necessary to add the name of the variable prepended by an underscore to the config tool? Would this be preferred over introducing the paravirt device? But being able to set this from the in-kernel UKC would be nice, too.
