Skip to content

Tags: ehabkost/qemu-hacks

Tags

work/qom-macros-autoconvert-v4

Toggle work/qom-macros-autoconvert-v4's commit message
qom: Automated conversion of type checking boilerplate

Latest version of this series can be found at the branch:
https://github.com/ehabkost/qemu-hacks/tree/work/qom-macros-autoconvert

This is an extension of the series previously submitted by
Daniel[1], including a script that will convert existing type
checker macros automatically.

[1] https://lore.kernel.org/qemu-devel/20200723181410.3145233-1-berrange@redhat.com/

Link to series v4:
https://github.com/ehabkost/qemu-hacks/tree/work/qom-macros-autoconvert-v4

Changes from series v3 to v4:
* Rebased to machine-next
* Removed patches that will be submitted separately:
  * TYPE_INFO changes
  * Patches to crypto code from Daniel
* Rerun conversion scripts.  Additional automated changes are in "(pass 3)" patches
* Conversion script changes:
  * Included copyright headers
  * Added scripts/codeconverter/ to MAINTAINERS

Link to series v3:
https://lore.kernel.org/qemu-devel/20200825192110.3528606-1-ehabkost@redhat.com/
https://github.com/ehabkost/qemu-hacks/tree/work/qom-macros-autoconvert-v3

Changes from series v2 to v3:
* Additional automated changes are in "(pass 2)" patches
  to make review easier, but they can be squashed into the
  original patches later
* Patch "sifive_u: Rename memmap enum constants"
  had to be redone due to conflicts on rebase
* Removed reference to _Generic at
  "qom: Make type checker functions accept const pointers"
* Made converter script a little more flexible, and added
  experimental code to check instance/class size on TypeInfo vars
* Fixed bug I have introduced on usage of OBJECT_DECLARE_SIMPLE_TYPE
  (bug reported by Roman Bolshakov <r.bolshakov@yadro.com>)
* New patches added to series:
  + nubus: Rename class type checking macros
  + imx_ccm: Rename IMX_GET_CLASS macro
  + mos6522: Rename QOM macros
  + x86-iommu: Rename QOM type macros
  + rdma: Rename INTERFACE_RDMA_PROVIDER_CLASS macro
  + s390-virtio-ccw: Rename S390_MACHINE_CLASS macro
  + swim: Rename struct SWIM to Swim
  + migration: Rename class type checking macros
  + arm: Fix typo in AARCH64_CPU_GET_CLASS definition
  + rx: Rename QOM type check macros
  + rx: Move typedef RXCPU to cpu-qom.h
  + [automated] Use TYPE_INFO macro (pass 2)
  + [automated] Move QOM typedefs and add missing includes (pass 2)
  + [automated] Use DECLARE_*CHECKER* macros (pass 2)
  + [automated] Use OBJECT_DECLARE_TYPE where possible (pass 2)
  + [automated] Remove redundant instance_size/class_size fields

Link to series v2:
https://lore.kernel.org/qemu-devel/20200820001236.1284548-1-ehabkost@redhat.com/
https://github.com/ehabkost/qemu-hacks/tree/work/qom-macros-autoconvert-v2

Changes from series v1 to v2:
* Don't skip TypeCheckMacro conversion if typedefs
  are found in typedefs.h
* Don't look for typedefs if type check macro uses "struct [...]"
* "qom: Fix G_DEFINE_AUTOPTR_CLEANUP_FUNC" was squashed
  in the original buggy patch
* 18 new patches that fix inconsistencies in the code,
  and make automated changes without --force possible
* pl110:
  * Fix typo on commit message
  * Rename enum values to VERSION_*
* "[automated]" patches (without --force):
  * Re-ran script after after the changes mentioned above.
    Now the patches change many more QOM type checker macros
* "[semi-automated] Use DECLARE_*CHECKER* when possible (--force mode)":
  * Now the patch touches very few macros, and all of them
    have comments explaining why they are unusual
* Maintainers are now CCed in the cleanup patches
  (except for the automated ones, because they are too large)
* TYPE_INFO macro: added commit message note suggested by Daniel
* Added more details to commit message of "Rename enum constants" patches
* Removed confusing paragraph mentioning _Generic from "Make type
  checker functions accept const pointers" commit message

Link to series v1:
https://lore.kernel.org/qemu-devel/20200813222625.243136-1-ehabkost@redhat.com/
https://github.com/ehabkost/qemu-hacks/tree/work/qom-macros-autoconvert-v1

The series is divided in the sections below:

Original patches from Daniel
----------------------------

Patches 1-2 are the ones originally submitted by Daniel.

They introduce the macros:
* OBJECT_DECLARE_TYPE
* OBJECT_DECLARE_SIMPLE_TYPE
* OBJECT_DEFINE_TYPE
* OBJECT_DEFINE_TYPE_WITH_INTERFACES
* OBJECT_DEFINE_ABSTRACT_TYPE

Changes to new macros
---------------------

Patches 3-5 extend the macros introduced by Daniel.  It
includes small bug fixes, change the arguments to a few macros,
and introduce a few new macros:

* DECLARE_INSTANCE_CHECKER
* DECLARE_CLASS_CHECKERS
* DECLARE_OBJ_CHECKERS

Automated code conversion
-------------------------

Patch 6 is the code conversion script that will look for common
patterns and change them to use the new macros.

Patches 7-18 are all automatically generated by that script, to
gradually transform existing code into DECLARE_*CHECKER or
OBJECT_DECLARE*_TYPE macros.

work/qom-macros-autoconvert-v2

Toggle work/qom-macros-autoconvert-v2's commit message
qom: Automated conversion of type checking boilerplate

This is an extension of the series previously submitted by
Daniel[1], including a script that will convert existing type
checker macros automatically.

Changes from series v1 to v2:
* Don't skip TypeCheckMacro conversion if typedefs
  are found in typedefs.h
* Don't look for typedefs if type check macro uses "struct [...]"
* "qom: Fix G_DEFINE_AUTOPTR_CLEANUP_FUNC" was squashed
  in the original buggy patch
* 18 new patches that fix inconsistencies in the code,
  and make automated changes without --force possible
* pl110:
  * Fix typo on commit message
  * Rename enum values to VERSION_*
* "[automated]" patches (without --force):
  * Re-ran script after after the changes mentioned above.
    Now the patches change many more QOM type checker macros
* "[semi-automated] Use DECLARE_*CHECKER* when possible (--force mode)":
  * Now the patch touches very few macros, and all of them
    have comments explaining why they are unusual
* Maintainers are now CCed in the cleanup patches
  (except for the automated ones, because they are too large)
* TYPE_INFO macro: added commit message note suggested by Daniel
* Added more details to commit message of "Rename enum constants" patches
* Removed confusing paragraph mentioning _Generic from "Make type
  checker functions accept const pointers" commit message

Link to series v1:
https://lore.kernel.org/qemu-devel/20200813222625.243136-1-ehabkost@redhat.com/

The series is divided in the sections below:

Constant renaming
-----------------

Patches 1-10 will just rename existing constants that will
conflict with the type checker function names.

Fix and cleanups of existing code
---------------------------------

Patches 11-41 are changes to existing code
that will either fix existing issues, delete unused and broken
macros, or move typedefs around to make code conversion easier.

Original patches from Daniel
----------------------------

Patches 42-43 are the ones originally submitted by Daniel.

They introduce the macros:
* OBJECT_DECLARE_TYPE
* OBJECT_DECLARE_SIMPLE_TYPE
* OBJECT_DEFINE_TYPE
* OBJECT_DEFINE_TYPE_WITH_INTERFACES
* OBJECT_DEFINE_ABSTRACT_TYPE

Changes to new macros
---------------------

Patches 44-48 extend the macros introduced by Daniel.  It
includes small bug fixes, change the arguments to a few macros,
and introduce a few new macros:

* DECLARE_INSTANCE_CHECKER
* DECLARE_CLASS_CHECKERS
* DECLARE_OBJ_CHECKERS
* TYPE_INFO

Automated code conversion
-------------------------

Patch 49 is the code conversion script that will look for common
patterns and change them to use the new macros.

Patches 50-56 are all automatically generated by that script, to
gradually transform existing code into DECLARE_*CHECKER or
OBJECT_DECLARE*_TYPE macros.

Original crypto QOM patches from Daniel
---------------------------------------

Patches 57-58 are the patches originally sent by Daniel to
convert the crypto QOM code to use the new macros, rebased and
updated to pass additional arguments to OBJECT_DECLARE_*.

[1] https://lore.kernel.org/qemu-devel/20200723181410.3145233-1-berrange@redhat.com/

work/qom-macros-autoconvert-v1

Toggle work/qom-macros-autoconvert-v1's commit message
qom: Automated conversion of type checking boilerplate

This is an extension of the series previously submitted by
Daniel[1], including a script that will convert existing type
checker macros automatically.

The series is divided in the following sections:

Constant renaming
-----------------

Patches 1-10 will just rename existing constants that will
conflict with the type checker function names.

Fix and cleanups of existing code
---------------------------------

Patches 11-25 are changes to existing code
that will either fix existing issues, delete unused and broken
macros, or move typedefs around to make code conversion easier.

Original patches from Daniel
----------------------------

Patches 24-25 are the ones originally submitted by Daniel.

They introduce the macros:
* OBJECT_DECLARE_TYPE
* OBJECT_DECLARE_SIMPLE_TYPE
* OBJECT_DEFINE_TYPE
* OBJECT_DEFINE_TYPE_WITH_INTERFACES
* OBJECT_DEFINE_ABSTRACT_TYPE

Changes to new macros
---------------------

Patches 26-31 extend the macros introduced by Daniel.  It
includes small bug fixes, change the arguments to a few macros,
and introduce a few new macros:

* DECLARE_INSTANCE_CHECKER
* DECLARE_CLASS_CHECKERS
* DECLARE_OBJ_CHECKERS
* TYPE_INFO

Automated code conversion
-------------------------

Patch 32 is the code conversion script that will look for common
patterns and change them to use the new macros.

Patches 33-39 are all automatically generated by that script, to
gradually transform existing code into DECLARE_*CHECKER or
OBJECT_DECLARE*_TYPE macros.

Original crypto QOM patches from Daniel
---------------------------------------

Patches 40-41 are the patches originally sent by Daniel to
convert the crypto QOM code to use the new macros, rebased and
updated to pass additional arguments to OBJECT_DECLARE_*.

[1] https://lore.kernel.org/qemu-devel/20200723181410.3145233-1-berrange@redhat.com/

qemu-kvm-0.12.1.2-2.162.el6

Toggle qemu-kvm-0.12.1.2-2.162.el6's commit message
atapi: Add 'medium ready' to 'medium not ready' transition on cd change

RH-Author: Amit Shah <amit.shah@redhat.com>
Message-id: <80e8b9dd61ae17dfc9a04298823e8911f985b499.1304051889.git.amit.shah@redhat.com>
Patchwork-id: 23146
O-Subject: [RHEL6.2 qemu-kvm PATCH 3/3] atapi: Add 'medium ready' to 'medium not ready' transition on cd change
Bugzilla: 700065
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>

MMC-5 Table F.1 lists errors that can be thrown for the TEST_UNIT_READY
command.  Going from medium not ready to medium ready states is
communicated by throwing an error.

This adds the missing 'tray opened' event that we fail to report to
guests.  After doing this, older Linux guests properly revalidate a disc
on the change command.  HSM violation errors, which caused Linux guests
to do a soft-reset of the link, also go away:

ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6
sr 1:0:0:0: CDB: Test Unit Ready: 00 00 00 00 00 00
ata2.00: cmd a0/00:00:00:00:00/00:00:00:00:00/a0 tag 0
         res 01/60:00:00:00:00/00:00:00:00:00/a0 Emask 0x3 (HSM violation)
ata2.00: status: { ERR }
ata2: soft resetting link
ata2.00: configured for MWDMA2
ata2: EH complete

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 4b9b709)

Bugzilla: 700065

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 hw/ide/core.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

v0.14.1

Toggle v0.14.1's commit message
Stable release 0.14.1

qemu-kvm-0.12.1.2-2.161.el6

Toggle qemu-kvm-0.12.1.2-2.161.el6's commit message
Fix phys memory client - pass guest physical address not region offset

RH-Author: Michael S. Tsirkin <mst@redhat.com>
Message-id: <20110502215949.GA27599@redhat.com>
Patchwork-id: 23364
O-Subject: [PATCH RHEL 6.1.z/6.2] Fix phys memory client - pass guest physical address not region offset
Bugzilla: 700859
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>

When we're trying to get a newly registered phys memory client updated
with the current page mappings, we end up passing the region offset
(a ram_addr_t) as the start address rather than the actual guest
physical memory address (target_phys_addr_t).  If your guest has less
than 3.5G of memory, these are coincidentally the same thing.  If
there's more, the region offset for the memory above 4G starts over
at 0, so the set_memory client will overwrite it's lower memory entries.

Instead, keep track of the guest phsyical address as we're walking the
tables and pass that to the set_memory client.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Upstream status: posted, code upstream is significantly different,
		this implements the same idea
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=700859
Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=3293172

Impact: adding device by hotplug then triggering VM stop
followed by VM start causes, at best, broken networking,
and at worst, guest memory corruption.

This is partially mitigated by the fact that
- When the device is added on the command line, phys_map
  is NULL so we exit early and do not trigger this bug.
  So only hotplug-added devices are affected.
- As a result of another bug, vhost is actually inactive
  after hotplug until VM is stopped and then restarted.
  This can happen e.g. if migration fails and management
  restarts the VM at source.
  So while the memory tables are incorrect, it does not
  corrupt memory and networking works until VM stop and start.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>

qemu-kvm-0.12.1.2-2.160.el6

Toggle qemu-kvm-0.12.1.2-2.160.el6's commit message
Ignore pci unplug requests for unpluggable devices.

RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <1303898392-17877-1-git-send-email-kraxel@redhat.com>
Patchwork-id: 22919
O-Subject: [RHEL-6.1 kvm PATCH] Ignore pci unplug requests for unpluggable devices.
Bugzilla: 699789
RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
RH-Acked-by: Petr Matousek <pmatouse@redhat.com>

bugzilla: EMBARGOED CVE-2011-1751

This patch makes qemu ignore unplug requests from the guest for pci
devices which are tagged as non-hotpluggable.  Trouble spot is the
piix4 chipset with the ISA bridge.  Requests to unplug that one will
make it go away together with all ISA bus devices, which are not
prepared to be unplugged and thus don't cleanup, leaving active
qemu timers behind in free'ed memory.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/acpi.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

qemu-kvm-0.12.1.2-2.159.el6

Toggle qemu-kvm-0.12.1.2-2.159.el6's commit message
acpi_piix4: Maintain RHEL6.0 migration

RH-Author: Alex Williamson <alex.williamson@redhat.com>
Message-id: <20110413150223.19102.11982.stgit@s20.home>
Patchwork-id: 22113
O-Subject: [RHEL6.1 qemu-kvm PATCH] acpi_piix4: Maintain RHEL6.0 migration
Bugzilla: 694095
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=694095
Brew build: https://brewweb.devel.redhat.com/taskinfo?taskID=3255154
Upstream statis: N/A, RHEL specific

A side effect of upstream e8ec057 (8c19e00 in qemu-kvm-rhel6.git) is to
associate the piix4_pm device with a PCI device, which gets represented
in the save state entry with an ID string of '0000:00:01.3/piix4_pm'.
This breaks 6.1->6.0 migration.  Hotplug isn't supported for this device
and it's already unique, so we can safely use the old style vmstate
registration to maintain the same ID string as previous RHEL6.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---

 hw/acpi.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>

qemu-kvm-0.12.1.2-2.158.el6

Toggle qemu-kvm-0.12.1.2-2.158.el6's commit message
atapi: GESN: implement 'media' subcommand

RH-Author: Markus Armbruster <armbru@redhat.com>
Message-id: <m3lizfe8yc.fsf_-_@blackfin.pond.sub.org>
Patchwork-id: 22017
O-Subject: [PATCH RHEL6.1 qemu-kvm v4 6/6] atapi: GESN: implement 'media'
	subcommand
Bugzilla: 558256
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>

Implement the 'media' sub-command of the GET_EVENT_STATUS_NOTIFICATION
command.  This helps us report tray open, tray closed, no media, media
present states to the guest.

Newer Linux kernels (2.6.38+) rely on this command to revalidate discs
after media change.

This patch also sends out tray open/closed status to the guest driver
when requested e.g. via the CDROM_DRIVE_STATUS ioctl (thanks Markus).
Without such notification, the guest and qemu's tray open/close status
was frequently out of sync, causing installers like Anaconda detecting
no disc instead of tray open, confusing them terribly.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/ide/core.c     |  113 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 hw/ide/internal.h |    6 +++
 2 files changed, 115 insertions(+), 4 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>