Re: [PATCH v13 0/8] pv event interface between host and guest

Gleb Natapov
2013-03-04T11:22:50Z

On Mon, Mar 04, 2013 at 11:05:37AM +0100, Paolo Bonzini wrote:
> > Guest uses acpi_get_devices() to discover a platform device by
> > its name (QEMU0001). Then you put the driver for the platform device
> > into drivers/platform/x86/ and QEMU/kvm/Xen all will be able to use it.
>
> Just to clarify it for Hu Tao, the read from a random ioport is how the
> ACPI code will detect presence of the device.
>
Actually no (at least in the long run, for the first version it may be
OK). Since we want to move DSDT generation into QEMU if device will not
be present QEMU will not generate corresponded Device() in DSDT, or it
will generate it with _STA() { Return (0x00)} hard coded. Seabios can do
the same if we will pass it info about device presence via fw_cfg. Not
sure Kevin will like it now when we plan to move DSDT into QEMU anyway :)

> Something like this should work (in SeaBIOS's src/acpi-dsdt-isa.dsl):
>
> Device(PEVT) {
> Name(_HID, EisaId("QEMU0001"))
> OperationRegion(PEOR, SystemIO, 0x505, 0x01)
> Field(PEOR, ByteAcc, NoLock, Preserve) {
> PEPT, 8,
> }
>
> Method(_STA, 0, NotSerialized) {
> Store(PEPT, Local0)
> If (LEqual(Local0, Zero)) {
> Return (0x00)
> } Else {
> Return (0x0F)
> }
> }
>
> Name(_CRS, ResourceTemplate() {
> IO(Decode16, 0x505, 0x505, 0x01, 0x01)
> })
> }
>
> Please test this with a QEMU option like "-M pc-1.4". The device should
> _not_ be detected if you're doing it right.
>

--
Gleb.