On 1/3/20 2:06 PM, Igor Mammedov wrote:
> On Tue, 31 Dec 2019 16:58:10 +0100
> Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
>> Hi Igor,
>>
>> On 12/31/19 2:02 PM, Igor Mammedov wrote:
>>> Series removes ad hoc RAM allocation API (memory_region_allocate_system_memory)
>>> and consolidates it around hostmem backend. It allows to
>>> * resolve conflicts between global -mem-prealloc and hostmem's "policy" option
>>> fixing premature allocation before binding policy is applied
>>> * simplify complicated memory allocation routines which had to deal with 2 ways
>>> to allocate RAM.
>>> * it allows to reuse hostmem backends of a choice for main RAM without adding
>>> extra CLI options to duplicate hostmem features.
>>> Recent case was -mem-shared, to enable vhost-user on targets that don't
>>> support hostmem backends [1] (ex: s390)
>>> * move RAM allocation from individual boards into generic machine code and
>>> provide them with prepared MemoryRegion.
>>> * clean up deprecated NUMA features which were tied to the old API (see patches)
>>> - "numa: remove deprecated -mem-path fallback to anonymous RAM"
>>> - "numa: remove deprecated implicit RAM distribution between nodes"
>>> - "forbid '-numa node,mem' for 5.0 and newer machine types"
>>>
>>> Conversion introduces a new machine.ram-memdev property and wrapper code that
>>> aliases global -mem-path and -mem-alloc into automatically created hostmem
>>> backend properties (provided ram-memdev was not set explicitly by user).
>>> And then follows bulk of trivial patches that incrementally convert individual
>>> boards to using machine.ram-memdev provided MemoryRegion.
>>>
>>> Board conversion typically involves:
>>> * providing MachineClass::default_ram_size and MachineClass::default_ram_id
>>> so generic code could create default backend if user didn't explicitly provide
>>> ram-memdev or -m options
>>> * dropping memory_region_allocate_system_memory() call
>>> * using covinience MachineState::ram MemoryRegion, which points to MemoryRegion
>>> allocated by ram-memdev
>>> On top of that for some boards:
>>> * added missing ram_size checks (typically it were boards with fixed ram size)
>>> * ram_size fixups were replaced by checks and hard errors, forcing user to
>>> provide correct "-m" values instead of ignoring it and continuing running.
>>>
>>> After all boards are converted the old API is removed and memory allocation
>>> routines are cleaned up.
>>
>> I'm replying to the cover because multiple patches are concerned.
>>
>> Compiling arm/lm32/mips64el/ppc on 32-bit host I get:
> what host/gcc version are you building on,
> my fedora 30-32bit setup I did reproduce only a couple of errors.
I'm using the qemu:debian-win32-cross docker image from
tests/docker/dockerfiles/debian-win32-cross.docker:
$ i686-w64-mingw32.shared-gcc --version
i686-w64-mingw32.shared-gcc (GCC) 5.5.0
You can build the image running:
$ make docker-image-debian-win32-cross
>>
>> CC hw/arm/digic_boards.o
>> hw/arm/digic_boards.c: In function 'digic4_board_init':
>> hw/arm/digic_boards.c:57:22: error: format '%lli' expects argument of
>> type 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned
>> int}' [-Werror=format=]
>> error_report("Invalid RAM size, should be %" PRIi64 " Bytes",
>> ^
>> cc1: all warnings being treated as errors
>> rules.mak:69: recipe for target 'hw/arm/digic_boards.o' failed
>> make: *** [hw/arm/digic_boards.o] Error 1
>> CC hw/arm/musicpal.o
>> hw/arm/musicpal.c: In function 'musicpal_init':
>> hw/arm/musicpal.c:1598:22: error: format '%lli' expects argument of type
>> 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned int}'
>> [-Werror=format=]
>> error_report("Invalid RAM size, should be %" PRIi64 " Bytes",
>> ^
>> cc1: all warnings being treated as errors
>> rules.mak:69: recipe for target 'hw/arm/musicpal.o' failed
>> make: *** [hw/arm/musicpal.o] Error 1
>> CC hw/arm/nseries.o
>> hw/arm/nseries.c: In function 'n8x0_init':
>> hw/arm/nseries.c:1316:22: error: format '%lli' expects argument of type
>> 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned int}'
>> [-Werror=format=]
>> error_report("Invalid RAM size, should be %" PRIi64 " Bytes",
>> ^
>> cc1: all warnings being treated as errors
>> rules.mak:69: recipe for target 'hw/arm/nseries.o' failed
>> make: *** [hw/arm/nseries.o] Error 1
>> CC hw/arm/omap_sx1.o
>> hw/arm/omap_sx1.c: In function 'sx1_init':
>> hw/arm/omap_sx1.c:119:22: error: format '%lli' expects argument of type
>> 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned int}'
>> [-Werror=format=]
>> error_report("Invalid RAM size, should be %" PRIi64 " Bytes",
>> ^
>> cc1: all warnings being treated as errors
>> rules.mak:69: recipe for target 'hw/arm/omap_sx1.o' failed
>> make: *** [hw/arm/omap_sx1.o] Error 1
>> CC hw/arm/palm.o
>> hw/arm/palm.c: In function 'palmte_init':
>> hw/arm/palm.c:202:22: error: format '%lli' expects argument of type
>> 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned int}'
>> [-Werror=format=]
>> error_report("Invalid RAM size, should be %" PRIi64 " Bytes",
>> ^
>> cc1: all warnings being treated as errors
>> rules.mak:69: recipe for target 'hw/arm/palm.o' failed
>> make: *** [hw/arm/palm.o] Error 1
>> CC hw/arm/collie.o
>> hw/arm/collie.c: In function 'collie_init':
>> hw/arm/collie.c:32:22: error: format '%lli' expects argument of type
>> 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned int}'
>> [-Werror=format=]
>> error_report("Invalid RAM size, should be %" PRIi64 " Bytes",
>> ^
>> cc1: all warnings being treated as errors
>> rules.mak:69: recipe for target 'hw/arm/collie.o' failed
>> make: *** [hw/arm/collie.o] Error 1
>> CC hw/arm/mps2.o
>> hw/arm/mps2.c: In function 'mps2_common_init':
>> hw/arm/mps2.c:121:22: error: format '%lli' expects argument of type
>> 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned int}'
>> [-Werror=format=]
>> error_report("Invalid RAM size, should be %" PRIi64 " Bytes",
>> ^
>> cc1: all warnings being treated as errors
>> rules.mak:69: recipe for target 'hw/arm/mps2.o' failed
>> make: *** [hw/arm/mps2.o] Error 1
>> CC hw/arm/mps2-tz.o
>> hw/arm/mps2-tz.c: In function 'mps2tz_common_init':
>> hw/arm/mps2-tz.c:391:22: error: format '%lli' expects argument of type
>> 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned int}'
>> [-Werror=format=]
>> error_report("Invalid RAM size, should be %" PRIi64 " Bytes",
>> ^
>> cc1: all warnings being treated as errors
>> rules.mak:69: recipe for target 'hw/arm/mps2-tz.o' failed
>> make: *** [hw/arm/mps2-tz.o] Error 1
>> CC hw/lm32/lm32_boards.o
>> hw/lm32/lm32_boards.c: In function 'lm32_evr_init':
>> hw/lm32/lm32_boards.c:89:22: error: format '%lli' expects argument of
>> type 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned
>> int}' [-Werror=format=]
>> error_report("Invalid RAM size, should be %" PRIi64 " Bytes",
>> ^
>> hw/lm32/lm32_boards.c: In function 'lm32_uclinux_init':
>> hw/lm32/lm32_boards.c:179:22: error: format '%lli' expects argument of
>> type 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned
>> int}' [-Werror=format=]
>> error_report("Invalid RAM size, should be %" PRIi64 " Bytes",
>> ^
>> cc1: all warnings being treated as errors
>> rules.mak:69: recipe for target 'hw/lm32/lm32_boards.o' failed
>> make: *** [hw/lm32/lm32_boards.o] Error 1
>> CC hw/lm32/milkymist.o
>> hw/lm32/milkymist.c: In function 'milkymist_init':
>> hw/lm32/milkymist.c:100:22: error: format '%lli' expects argument of
>> type 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned
>> int}' [-Werror=format=]
>> error_report("Invalid RAM size, should be %" PRIi64 " Bytes",
>> ^
>> cc1: all warnings being treated as errors
>> CC hw/mips/mips_fulong2e.o
>> hw/mips/mips_fulong2e.c: In function 'mips_fulong2e_init':
>> hw/mips/mips_fulong2e.c:317:22: error: format '%ld' expects argument of
>> type 'long int', but argument 2 has type 'long long int' [-Werror=format=]
>> error_report("Invalid RAM size, should be %ld", 256 * MiB);
>> ^
>> cc1: all warnings being treated as errors
>> CC hw/ppc/ppc405_boards.o
>> hw/ppc/ppc405_boards.c: In function 'ref405ep_init':
>> hw/ppc/ppc405_boards.c:165:22: error: format '%lli' expects argument of
>> type 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned
>> int}' [-Werror=format=]
>> error_report("Invalid RAM size, should be %" PRIi64 " Bytes",
>> ^
>> hw/ppc/ppc405_boards.c: In function 'taihu_405ep_init':
>> hw/ppc/ppc405_boards.c:435:22: error: format '%lli' expects argument of
>> type 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned
>> int}' [-Werror=format=]
>> error_report("Invalid RAM size, should be %" PRIi64 " Bytes",
>> ^
>> cc1: all warnings being treated as errors
>> rules.mak:69: recipe for target 'hw/ppc/ppc405_boards.o' failed
>> make: *** [hw/ppc/ppc405_boards.o] Error 1
>> CC hw/ppc/ppc4xx_devs.o
>> hw/ppc/ppc4xx_devs.c: In function 'ppc4xx_sdram_adjust':
>> hw/ppc/ppc4xx_devs.c:704:39: error: format '%lli' expects argument of
>> type 'long long int', but argument 3 has type 'ram_addr_t {aka const
>> unsigned int}' [-Werror=format=]
>> char *t = g_strdup_printf("%s%" PRIi64 "%s", s,
>> sdram_bank_sizes[i],
>> ^
>> hw/ppc/ppc4xx_devs.c:709:22: error: format '%lli' expects argument of
>> type 'long long int', but argument 2 has type 'ram_addr_t {aka unsigned
>> int}' [-Werror=format=]
>> error_report("Invalid RAM size, unable to fit all RAM into RAM
>> banks"
>> ^
>> cc1: all warnings being treated as errors
>> rules.mak:69: recipe for target 'hw/ppc/ppc4xx_devs.o' failed
>> make: *** [hw/ppc/ppc4xx_devs.o] Error 1
>> CC hw/ppc/e500.o
>> hw/ppc/e500.c: In function 'ppce500_init':
>> hw/ppc/e500.c:909:22: error: format '%ld' expects argument of type 'long
>> int', but argument 2 has type 'long long int' [-Werror=format=]
>> error_report("RAM size must be multiple of %ld", RAM_SIZES_ALIGN);
>> ^
>> cc1: all warnings being treated as errors
>>
>>
>