mbox series

[v2,0/5] hw: Replace some magic by definitions

Message ID 20201012132017.3423954-1-f4bug@amsat.org
Headers show
Series hw: Replace some magic by definitions | expand

Message

Philippe Mathieu-Daudé Oct. 12, 2020, 1:20 p.m. UTC
A bunch of trivial cleanups, replacing magic
values by definitions to make the code easier
to review.

Since v1:
- Addressed Peter review comment on versatile PCI controller
- Added Thomas R-b tag

Expected to be merged via qemu-trivial@.

Regards,

Phil.

Philippe Mathieu-Daudé (5):
  hw: Replace magic value by PCI_NUM_PINS definition
  hw/pci-host/pam: Use ARRAY_SIZE() instead of magic value
  hw/pci-host/versatile: Add the MEMORY_WINDOW_COUNT definition
  hw/pci-host/versatile: Add the PCI_BAR_COUNT definition
  tests/qtest: Replace magic value by NANOSECONDS_PER_SECOND definition

 hw/arm/virt.c           |  4 ++--
 hw/mips/gt64xxx_pci.c   |  2 +-
 hw/pci-host/pam.c       |  2 +-
 hw/pci-host/versatile.c | 46 ++++++++++++++++++++++-------------------
 tests/qtest/rtc-test.c  |  2 +-
 5 files changed, 30 insertions(+), 26 deletions(-)

-- 
2.26.2

Comments

Peter Maydell Oct. 12, 2020, 1:43 p.m. UTC | #1
On Mon, 12 Oct 2020 at 14:20, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Note from Peter Maydell:
>
>  The versatile/realview PCI controller has:
>    * three memory windows in the system address space
>      - those are represented by the pci_mem_window[] array
>      - mem_win_size[] holds the size of each window
>        (which is fixed but varies between the different
>        implementations of this controller on different boards)
>      - the device IMAPn registers allow the guest to
>        configure the mapping from "a CPU access to an
>        address in window n" to "a PCI address on the PCI bus,
>        and our imap[] array holds those register values
>
> Use self-explicit MEMORY_WINDOW_COUNT definition instead of
> a magic value.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
Richard Henderson Oct. 13, 2020, 11:35 p.m. UTC | #2
On 10/12/20 6:20 AM, Philippe Mathieu-Daudé wrote:
> Philippe Mathieu-Daudé (5):
>   hw: Replace magic value by PCI_NUM_PINS definition
>   hw/pci-host/pam: Use ARRAY_SIZE() instead of magic value
>   hw/pci-host/versatile: Add the MEMORY_WINDOW_COUNT definition
>   hw/pci-host/versatile: Add the PCI_BAR_COUNT definition
>   tests/qtest: Replace magic value by NANOSECONDS_PER_SECOND definition

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~