[PATCH 00/11] hw/m68k/next-cube: refactor to fix Coverity issue

Peter Maydell posted 11 patches 3 years, 3 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210115201206.17347-1-peter.maydell@linaro.org
Maintainers: Thomas Huth <huth@tuxfamily.org>
include/hw/m68k/next-cube.h |  15 ++-
hw/m68k/next-cube.c         | 238 +++++++++++++++++++++++-------------
2 files changed, 168 insertions(+), 85 deletions(-)
[PATCH 00/11] hw/m68k/next-cube: refactor to fix Coverity issue
Posted by Peter Maydell 3 years, 3 months ago
Currently the next-cube board code open-codes a lot of handling of
interrupts and some miscellaneous registers. This series refactors
that to move most of it into a proper QOM device. (The main motivation
here is to fix the Coverity issue CID 1421962 which is a trivial
memory leak of the memory returned by qemu_allocate_irqs().)
    
In the real hardware this functionality seems to be the responsibility
of the Peripheral Controller (PC) chip, so we name the device that.

To ease review, I structured the change as a sequence of commits:
the first commit creates the skeleton of the NeXTPC device with no
content, but with a backdoor pointer to the NeXTState machine's state
struct. That allows subsequent commits to move parts of the code and
still have refactored and non-refactored code using the same struct
data fields.  Eventually all the code and data fields can be
transferred to the new device, and we remove the backdoor pointer.

Tested with make check and make check-acceptance (which does have
a boot test for the board.)

thanks
-- PMM

Peter Maydell (11):
  hw/m68k/next-cube: Make next_irq() function static
  hw/m68k/next-cube: Move register/interrupt functionality into a device
  hw/m68k/next-cube: Move mmio_ops into NeXTPC device
  hw/m68k/next-cube: Move scr_ops into NeXTPC device
  hw/m68k/next-cube: Make next_irq take NeXTPC* as its opaque
  hw/m68k/next-cube: Move int_status and int_mask to NeXTPC struct
  hw/m68k/next-cube: Make next_irq GPIO inputs to NEXT_PC device
  hw/m68k/next-cube: Move rtc into NeXTPC struct
  hw/m68k/next-cube: Remove unused fields from NeXTState
  hw/m68k/next-cube: Add vmstate for NeXTPC device
  hw/m68k/next-cube: Add missing header comment to next-cube.h

 include/hw/m68k/next-cube.h |  15 ++-
 hw/m68k/next-cube.c         | 238 +++++++++++++++++++++++-------------
 2 files changed, 168 insertions(+), 85 deletions(-)

-- 
2.20.1