xen patch

- Rework Xen disk unplug to work with newer command line
   options.
 -----BEGIN PGP SIGNATURE-----
 
 iQFOBAABCgA4FiEE+AwAYwjiLP2KkueYDPVXL9f7Va8FAl+gGt0aHGFudGhvbnku
 cGVyYXJkQGNpdHJpeC5jb20ACgkQDPVXL9f7Va9mPQf+J9g428iiESN6qwiwL7G8
 c9fXeFoav5+ZckRxzXQHAxNexoB0szkx8Qfs7IOuR9095kfJp8H7mR6/NA2LW+GY
 n6AxGNcyPJdjx2yTVYJt/SYPfOk7f37Qi9cJIPvgPZQBehd9WLStCp7Kf6WzCMX4
 qSUFej6bAzC/m6msoTHVO0sMOqhrlMe9YXs4CgGbQez6Al28QtM5Bq4EsPohB2VL
 oyuPx3iYgu2O11yh/XRNH9lm4tJV8E80r6lolBaa5IUuNYeqw4Qtyu/lgune96bc
 OGhO9VcEscpAizoq1eo0uYP/xyu0yJdGWogVDWJjZktdnF/ii27t00tbireTCPEF
 lA==
 =YaAn
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20201102' into staging

xen patch

- Rework Xen disk unplug to work with newer command line
  options.

# gpg: Signature made Mon 02 Nov 2020 14:42:37 GMT
# gpg:                using RSA key F80C006308E22CFD8A92E7980CF5572FD7FB55AF
# gpg:                issuer "anthony.perard@citrix.com"
# gpg: Good signature from "Anthony PERARD <anthony.perard@gmail.com>" [marginal]
# gpg:                 aka "Anthony PERARD <anthony.perard@citrix.com>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 5379 2F71 024C 600F 778A  7161 D8D5 7199 DF83 42C8
#      Subkey fingerprint: F80C 0063 08E2 2CFD 8A92  E798 0CF5 572F D7FB 55AF

* remotes/aperard/tags/pull-xen-20201102:
  xen: rework pci_piix3_xen_ide_unplug

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-11-02 16:05:47 +00:00
commit b139d11ae1
1 changed files with 13 additions and 14 deletions

View File

@ -164,30 +164,29 @@ static void pci_piix_ide_realize(PCIDevice *dev, Error **errp)
int pci_piix3_xen_ide_unplug(DeviceState *dev, bool aux)
{
PCIIDEState *pci_ide;
DriveInfo *di;
int i;
IDEDevice *idedev;
IDEBus *idebus;
BlockBackend *blk;
pci_ide = PCI_IDE(dev);
for (i = aux ? 1 : 0; i < 4; i++) {
di = drive_get_by_index(IF_IDE, i);
if (di != NULL && !di->media_cd) {
BlockBackend *blk = blk_by_legacy_dinfo(di);
DeviceState *ds = blk_get_attached_dev(blk);
idebus = &pci_ide->bus[i / 2];
blk = idebus->ifs[i % 2].blk;
if (blk && idebus->ifs[i % 2].drive_kind != IDE_CD) {
if (!(i % 2)) {
idedev = idebus->master;
} else {
idedev = idebus->slave;
}
blk_drain(blk);
blk_flush(blk);
if (ds) {
blk_detach_dev(blk, ds);
}
pci_ide->bus[di->bus].ifs[di->unit].blk = NULL;
if (!(i % 2)) {
idedev = pci_ide->bus[di->bus].master;
} else {
idedev = pci_ide->bus[di->bus].slave;
}
blk_detach_dev(blk, DEVICE(idedev));
idebus->ifs[i % 2].blk = NULL;
idedev->conf.blk = NULL;
monitor_remove_blk(blk);
blk_unref(blk);