qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel.a@redhat.com>
To: qemu-devel@nongnu.org
Cc: mst@redhat.com
Subject: [Qemu-devel] [PATCH v2 0/3] hw/pcie: better hotplug/hotunplug support
Date: Mon, 23 Jun 2014 14:15:23 +0300	[thread overview]
Message-ID: <1403522126-3697-1-git-send-email-marcel.a@redhat.com> (raw)

v1 -> v2:
 - Addressed Michael S. Tsirkin's comments:
   - patch 2/3:
     - Added "power controller present" to compat_props.
   - patch 3/3:
     - Unplug all bus functions on hot-unplug, not only function 0.
   - Minor code refactoring

The current code is broken: it does surprise removal which crashes guests.

Reimplemented the steps:
 - Hotplug triggers both 'present detect change' and
   'attention button pressed'.

 - Hotunplug starts by triggering 'attention button pressed',
   then waits for the OS to power off the device and only
   then detaches it.

Fixes CVE-2014-3471.

patch 1/3: trivial debug message fix
patch 2/3: enable 'power controller' to receive power events from guests
patch 3/3: the actual hotplug/hotunplug implementation.

Tested with Linux and Windows guests and with an e1000 with "PCIe" capability.
Notes:
    Windows requires devices to be pci express in order to enable
    hotplug functionality, so we need to think about converting
    virtio devices to pci express.
    Linux outputs a "Surprise Removal/Addition" info message because
    we trigger 2 events in the same time, however this warning
    can be disregarded or a kernel patch submitted for our scenario.

Marcel Apfelbaum (3):
  hw/pcie: corrected a debug message
  hw/pcie: implement power controller functionality
  hw/pcie: better hotplug/hotunplug support

 hw/pci-bridge/ioh3420.c            |  7 +++++
 hw/pci-bridge/xio3130_downstream.c |  7 +++++
 hw/pci/pcie.c                      | 64 +++++++++++++++++++++++++++++++++-----
 include/hw/i386/pc.h               | 11 ++++++-
 include/hw/pci/pci.h               |  3 ++
 include/hw/pci/pcie.h              |  2 ++
 include/hw/pci/pcie_regs.h         |  2 ++
 7 files changed, 88 insertions(+), 8 deletions(-)

-- 
1.8.3.1

             reply	other threads:[~2014-06-23 11:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-23 11:15 Marcel Apfelbaum [this message]
2014-06-23 11:15 ` [Qemu-devel] [PATCH v2 1/3] hw/pcie: corrected a debug message Marcel Apfelbaum
2014-06-23 11:41   ` Michael S. Tsirkin
2014-06-23 11:45     ` Marcel Apfelbaum
2014-06-23 11:15 ` [Qemu-devel] [PATCH v2 2/3] hw/pcie: implement power controller functionality Marcel Apfelbaum
2014-06-23 11:15 ` [Qemu-devel] [PATCH v2 3/3] hw/pcie: better hotplug/hotunplug support Marcel Apfelbaum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403522126-3697-1-git-send-email-marcel.a@redhat.com \
    --to=marcel.a@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).