mbox

[PULL,00/20] acpi,pc,pci fixes and enhancements

Message ID 1392050814-31814-1-git-send-email-mst@redhat.com
State New
Headers show

Pull-request

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

Message

Michael S. Tsirkin Feb. 10, 2014, 4:47 p.m. UTC
The following changes since commit 2b2449f7e467957778ca006904471b231dc0ac8e:

  Merge remote-tracking branch 'remotes/borntraeger/tags/kvm-s390-20140131' into staging (2014-02-04 18:46:33 +0000)

are available in the git repository at:


  git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 417c45ab2f847c0a47b1232f611aa886df6a97d5:

  ACPI: Remove commented-out code from HPET._CRS (2014-02-10 11:09:33 +0200)

----------------------------------------------------------------
acpi,pc,pci fixes and enhancements

Most changes here are hotplug related:

This merges hotplug infrastructure changes by Igor,
some acpi related fixes, and PC fixes.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

----------------------------------------------------------------
Gabriel L. Somlo (1):
      ACPI: Remove commented-out code from HPET._CRS

Igor Mammedov (14):
      pcihp: replace enable|disable_device() with oneliners
      pcihp: make PCI hotplug mmio handlers indifferent to PCI_HOTPLUG_ADDR
      pcihp: make pci_read() mmio calback compatible with legacy ACPI hotplug
      pcihp: remove unused AcpiPciHpPciStatus.device_present field
      hw:piix4:acpi: reuse pcihp code for legacy PCI hotplug
      define hotplug interface
      qdev: add to BusState "hotplug-handler" link
      qdev: add "hotpluggable" property to Device
      hw/acpi: move typeinfo to the file end
      qdev:pci: refactor PCIDevice to use generic "hotpluggable" property
      acpi/piix4pm: convert ACPI PCI hotplug to use hotplug-handler API
      pci/shpc: convert SHPC hotplug to use hotplug-handler API
      pci/pcie: convert PCIE hotplug to use hotplug-handler API
      hw/pci: switch to a generic hotplug handling for PCIDevice

Michael S. Tsirkin (5):
      pcihp: reduce number of device check events
      qtest: don't report signals if qtest driver enabled
      pc_piix: enable legacy hotplug for Xen
      pc.c: better error message on initrd sizing failure
      loader: document that errno is set

 include/hw/acpi/acpi.h         |   1 +
 include/hw/acpi/pcihp.h        |  17 ++-
 include/hw/hotplug.h           |  78 ++++++++++
 include/hw/loader.h            |   7 +
 include/hw/pci/pci.h           |  13 --
 include/hw/pci/pci_bus.h       |   2 -
 include/hw/pci/pcie.h          |   5 +
 include/hw/pci/shpc.h          |   8 +
 include/hw/qdev-core.h         |  15 ++
 include/sysemu/qtest.h         |   2 +
 hw/acpi/pcihp.c                | 127 +++++++++-------
 hw/acpi/piix4.c                | 322 ++++++++++-------------------------------
 hw/core/hotplug.c              |  48 ++++++
 hw/core/qdev.c                 |  50 ++++++-
 hw/display/cirrus_vga.c        |   2 +-
 hw/display/qxl.c               |   2 +-
 hw/display/vga-pci.c           |   2 +-
 hw/display/vmware_vga.c        |   2 +-
 hw/i386/acpi-build.c           |   4 +-
 hw/i386/pc.c                   |   4 +-
 hw/i386/pc_piix.c              |  11 ++
 hw/ide/piix.c                  |   4 +-
 hw/isa/piix4.c                 |   2 +-
 hw/pci-bridge/pci_bridge_dev.c |   9 ++
 hw/pci-host/piix.c             |   6 +-
 hw/pci/pci.c                   |  40 +----
 hw/pci/pcie.c                  |  65 +++++----
 hw/pci/pcie_port.c             |   8 +
 hw/pci/shpc.c                  | 124 ++++++++++------
 hw/usb/hcd-ehci-pci.c          |   2 +-
 hw/usb/hcd-ohci.c              |   2 +-
 hw/usb/hcd-uhci.c              |   2 +-
 hw/usb/hcd-xhci.c              |   2 +-
 qtest.c                        |   5 +
 vl.c                           |   2 +-
 hw/core/Makefile.objs          |   1 +
 hw/i386/acpi-dsdt-hpet.dsl     |   3 -
 tests/Makefile                 |   2 +-
 38 files changed, 540 insertions(+), 461 deletions(-)
 create mode 100644 include/hw/hotplug.h
 create mode 100644 hw/core/hotplug.c

Comments

Peter Maydell Feb. 13, 2014, 4:29 p.m. UTC | #1
On 10 February 2014 16:47, Michael S. Tsirkin <mst@redhat.com> wrote:
> The following changes since commit 2b2449f7e467957778ca006904471b231dc0ac8e:
>
>   Merge remote-tracking branch 'remotes/borntraeger/tags/kvm-s390-20140131' into staging (2014-02-04 18:46:33 +0000)
>
> are available in the git repository at:
>
>
>   git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
>
> for you to fetch changes up to 417c45ab2f847c0a47b1232f611aa886df6a97d5:
>
>   ACPI: Remove commented-out code from HPET._CRS (2014-02-10 11:09:33 +0200)

Applied, thanks.

-- PMM
Stefano Stabellini Feb. 18, 2014, 12:16 p.m. UTC | #2
On Thu, 13 Feb 2014, Peter Maydell wrote:
> On 10 February 2014 16:47, Michael S. Tsirkin <mst@redhat.com> wrote:
> > The following changes since commit 2b2449f7e467957778ca006904471b231dc0ac8e:
> >
> >   Merge remote-tracking branch 'remotes/borntraeger/tags/kvm-s390-20140131' into staging (2014-02-04 18:46:33 +0000)
> >
> > are available in the git repository at:
> >
> >
> >   git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
> >
> > for you to fetch changes up to 417c45ab2f847c0a47b1232f611aa886df6a97d5:
> >
> >   ACPI: Remove commented-out code from HPET._CRS (2014-02-10 11:09:33 +0200)
> 
> Applied, thanks.

It looks like that this series breaks disk unplug
(hw/ide/piix.c:pci_piix3_xen_ide_unplug).

I bisected it and the problem is caused by:

commit 5e95494380ecf83c97d28f72134ab45e0cace8f9
Author: Igor Mammedov <imammedo@redhat.com>
Date:   Wed Feb 5 16:36:52 2014 +0100

    hw/pci: switch to a generic hotplug handling for PCIDevice
    
    make qdev_unplug()/device_set_realized() to call hotplug handler's
    plug/unplug methods if available and remove not needed anymore
    hot(un)plug handling from PCIDevice.
    
    In case if hotplug handler is not available, revert to the legacy
    hotplug method for compatibility with not yet converted buses.
    
    Signed-off-by: Igor Mammedov <imammedo@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Paolo Bonzini Feb. 18, 2014, 12:27 p.m. UTC | #3
Il 18/02/2014 13:16, Stefano Stabellini ha scritto:
> It looks like that this series breaks disk unplug
> (hw/ide/piix.c:pci_piix3_xen_ide_unplug).
>
> I bisected it and the problem is caused by:
>
> commit 5e95494380ecf83c97d28f72134ab45e0cace8f9
> Author: Igor Mammedov <imammedo@redhat.com>
> Date:   Wed Feb 5 16:36:52 2014 +0100
>
>     hw/pci: switch to a generic hotplug handling for PCIDevice
>
>     make qdev_unplug()/device_set_realized() to call hotplug handler's
>     plug/unplug methods if available and remove not needed anymore
>     hot(un)plug handling from PCIDevice.
>
>     In case if hotplug handler is not available, revert to the legacy
>     hotplug method for compatibility with not yet converted buses.
>
>     Signed-off-by: Igor Mammedov <imammedo@redhat.com>
>     Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>     Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
>

What exactly breaks?

Paolo
Stefano Stabellini Feb. 18, 2014, 12:45 p.m. UTC | #4
On Tue, 18 Feb 2014, Paolo Bonzini wrote:
> Il 18/02/2014 13:16, Stefano Stabellini ha scritto:
> > It looks like that this series breaks disk unplug
> > (hw/ide/piix.c:pci_piix3_xen_ide_unplug).
> > 
> > I bisected it and the problem is caused by:
> > 
> > commit 5e95494380ecf83c97d28f72134ab45e0cace8f9
> > Author: Igor Mammedov <imammedo@redhat.com>
> > Date:   Wed Feb 5 16:36:52 2014 +0100
> > 
> >     hw/pci: switch to a generic hotplug handling for PCIDevice
> > 
> >     make qdev_unplug()/device_set_realized() to call hotplug handler's
> >     plug/unplug methods if available and remove not needed anymore
> >     hot(un)plug handling from PCIDevice.
> > 
> >     In case if hotplug handler is not available, revert to the legacy
> >     hotplug method for compatibility with not yet converted buses.
> > 
> >     Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> >     Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> >     Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > 
> > 
> 
> What exactly breaks?

Disk unplug: hw/ide/piix.c:pci_piix3_xen_ide_unplug (see the beginning
of the email :-P).
It is called by hw/xen/xen_platform.c:platform_fixed_ioport_writew, in
response to the guest writing to a magic ioport specifically to unplug
the emulated disk.
With this patch after the guest boots I can still access both xvda and
sda for the same disk, leading to fs corruptions.
Paolo Bonzini Feb. 18, 2014, 1:10 p.m. UTC | #5
Il 18/02/2014 13:45, Stefano Stabellini ha scritto:
> Disk unplug: hw/ide/piix.c:pci_piix3_xen_ide_unplug (see the beginning
> of the email :-P).
> It is called by hw/xen/xen_platform.c:platform_fixed_ioport_writew, in
> response to the guest writing to a magic ioport specifically to unplug
> the emulated disk.
> With this patch after the guest boots I can still access both xvda and
> sda for the same disk, leading to fs corruptions.

Ok, the last paragraph is what I was missing.

So this is dc->unplug for the PIIX3 IDE device.  Because PCI declares a 
hotplug handler, dc->unplug is not called anymore.

But unlike other dc->unplug callbacks, pci_piix3_xen_ide_unplug doesn't 
free the device, it just drops the disks underneath.  I think the 
simplest solution is to _not_ make it a dc->unplug callback at all, and 
call pci_piix3_xen_ide_unplug from unplug_disks instead of qdev_unplug. 
  qdev_unplug means "ask guest to start unplug", which is not what Xen 
wants to do here.

Paolo