qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Daniel Henrique Barboza <danielhb413@gmail.com>,
	Bernhard Beschow <shentey@gmail.com>,
	qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, "Aurelien Jarno" <aurelien@aurel32.net>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	"Antony Pavlov" <antonynpavlov@gmail.com>,
	"BALATON Zoltan" <balaton@eik.bme.hu>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Bin Meng" <bin.meng@windriver.com>,
	"Kevin Wolf" <kwolf@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Jan Kiszka" <jan.kiszka@web.de>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Hanna Reitz" <hreitz@redhat.com>,
	qemu-arm@nongnu.org, "Magnus Damm" <magnus.damm@gmail.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	qemu-block@nongnu.org
Subject: Re: [PATCH v4 5/7] hw/ppc/e500: Implement pflash handling
Date: Sat, 29 Oct 2022 00:42:35 +0200	[thread overview]
Message-ID: <202ae9ed-c1d1-ea57-6c50-b9c24f12dd5e@linaro.org> (raw)
In-Reply-To: <eea963b8-f6d9-b345-376e-7fd6dad73cd4@gmail.com>

On 28/10/22 17:09, Daniel Henrique Barboza wrote:
> Bernhard,
> 
> The 32 builds aren't fancying this patch. The issue is down there:
> 
> On 10/18/22 18:01, Bernhard Beschow wrote:
>> Allows e500 boards to have their root file system reside on flash using
>> only builtin devices located in the eLBC memory region.
>>
>> Note that the flash memory area is only created when a -pflash 
>> argument is
>> given, and that the size is determined by the given file. The idea is to
>> put users into control.
>>
>> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>> ---
>>   docs/system/ppc/ppce500.rst | 16 ++++++++
>>   hw/ppc/Kconfig              |  1 +
>>   hw/ppc/e500.c               | 79 +++++++++++++++++++++++++++++++++++++
>>   3 files changed, 96 insertions(+)

>> @@ -1024,6 +1061,48 @@ void ppce500_init(MachineState *machine)
>>                                   pmc->platform_bus_base,
>>                                   &pms->pbus_dev->mmio);
>> +    dinfo = drive_get(IF_PFLASH, 0, 0);
>> +    if (dinfo) {
>> +        BlockBackend *blk = blk_by_legacy_dinfo(dinfo);
>> +        BlockDriverState *bs = blk_bs(blk);
>> +        uint64_t size = bdrv_getlength(bs);
>> +        uint64_t mmio_size = pms->pbus_dev->mmio.size;
> 
> ^ here. The issue is that on a 32 bit system it is not possible to cast the
> Int128 type to uint64_t:
> 
> FAILED: libqemu-ppc64-softmmu.fa.p/hw_ppc_e500.c.o
> 3746cc -m32 -Ilibqemu-ppc64-softmmu.fa.p -I. -I.. -Itarget/ppc 
> -I../target/ppc -I../dtc/libfdt -Iqapi -Itrace -Iui -Iui/shader 
> -I/usr/include/pixman-1 -I/usr/include/glib-2.0 
> -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 
> -fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O2 -g 
> -isystem /builds/danielhb/qemu/linux-headers -isystem linux-headers 
> -iquote . -iquote /builds/danielhb/qemu -iquote 
> /builds/danielhb/qemu/include -iquote /builds/danielhb/qemu/tcg/i386 
> -pthread -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE 
> -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes 
> -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes 
> -fno-strict-aliasing -fno-common -fwrapv -Wold-style-declaration 
> -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k 
> -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs 
> -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 
> -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi 
> -fstack-protector-strong -fPIE -isystem../linux-headers 
> -isystemlinux-headers -DNEED_CPU_H 
> '-DCONFIG_TARGET="ppc64-softmmu-config-target.h"' 
> '-DCONFIG_DEVICES="ppc64-softmmu-config-devices.h"' -MD -MQ 
> libqemu-ppc64-softmmu.fa.p/hw_ppc_e500.c.o -MF 
> libqemu-ppc64-softmmu.fa.p/hw_ppc_e500.c.o.d -o 
> libqemu-ppc64-softmmu.fa.p/hw_ppc_e500.c.o -c ../hw/ppc/e500.c
> 3747../hw/ppc/e500.c: In function 'ppce500_init':
> 3748../hw/ppc/e500.c:1069:30: error: incompatible types when 
> initializing type 'uint64_t' {aka 'long long unsigned int'} using type 
> 'Int128'
> 3749 1069 |         uint64_t mmio_size = pms->pbus_dev->mmio.size;
> 3750      |                              ^~~
> 3751[3207/5331] Compiling C object 
> libqemu-ppc64-softmmu.fa.p/hw_ppc_mpc8544_guts.c.o
> 
> 
> What I did to solve the problem is this:
> 
> 
> +         uint64_t mmio_size = int128_get64(pms->pbus_dev->mmio.size); >
> This will get the lower 64 bits and return an uint64_t.
> 
> Note that this function will assert if mmio.size is bigger than 
> UINT64_MAX, but
> since you're doing an error(1) on the "if size > mmio_size" conditional, 
> this
> assert() is not introducing a new side effect. We'll just fail earlier with
> a different error message.

Simply use:

   memory_region_size(pms->pbus_dev->mmio);



  parent reply	other threads:[~2022-10-28 22:43 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 21:01 [PATCH v4 0/7] ppc/e500: Add support for two types of flash, cleanup Bernhard Beschow
2022-10-18 21:01 ` [PATCH v4 1/7] docs/system/ppc/ppce500: Use qemu-system-ppc64 across the board(s) Bernhard Beschow
2022-10-18 21:01 ` [PATCH v4 2/7] hw/block/pflash_cfi0{1, 2}: Error out if device length isn't a power of two Bernhard Beschow
2022-10-18 21:01 ` [PATCH v4 3/7] hw/sd/sdhci-internal: Unexport ESDHC defines Bernhard Beschow
2022-10-18 21:01 ` [PATCH v4 4/7] hw/sd/sdhci: Rename ESDHC_* defines to USDHC_* Bernhard Beschow
2022-10-18 21:01 ` [PATCH v4 5/7] hw/ppc/e500: Implement pflash handling Bernhard Beschow
2022-10-26 17:03   ` Daniel Henrique Barboza
2022-10-27 21:11   ` Philippe Mathieu-Daudé
2022-10-28 15:09   ` Daniel Henrique Barboza
2022-10-28 16:03     ` B
2022-10-28 22:42     ` Philippe Mathieu-Daudé [this message]
2022-10-29  9:29       ` Daniel Henrique Barboza
2022-10-29 11:24         ` Bernhard Beschow
2022-10-18 21:01 ` [PATCH v4 6/7] hw/sd/sdhci: Implement Freescale eSDHC device model Bernhard Beschow
2022-10-27 21:40   ` Philippe Mathieu-Daudé
2022-10-29 11:33     ` Bernhard Beschow
2022-10-29 13:04       ` Bernhard Beschow
2022-10-29 18:28         ` Bernhard Beschow
2022-10-29 23:10           ` Philippe Mathieu-Daudé
2022-10-30 11:46             ` Bernhard Beschow
2022-10-31 12:11               ` Philippe Mathieu-Daudé
2022-11-01 10:49                 ` Bernhard Beschow
2022-12-16 14:38                   ` Bernhard Beschow
2022-10-18 21:01 ` [PATCH v4 7/7] hw/ppc/e500: Add Freescale eSDHC to e500plat Bernhard Beschow
2022-10-26 17:11   ` Daniel Henrique Barboza
2022-10-27 21:12   ` Philippe Mathieu-Daudé
2022-10-23  8:36 ` [PATCH v4 0/7] ppc/e500: Add support for two types of flash, cleanup Bernhard Beschow
2022-10-26 17:18 ` Daniel Henrique Barboza
2022-10-26 19:51   ` B
2022-10-26 21:40     ` Daniel Henrique Barboza
2022-10-31 12:13   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202ae9ed-c1d1-ea57-6c50-b9c24f12dd5e@linaro.org \
    --to=philmd@linaro.org \
    --cc=alistair@alistair23.me \
    --cc=antonynpavlov@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=balaton@eik.bme.hu \
    --cc=bin.meng@windriver.com \
    --cc=danielhb413@gmail.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=f4bug@amsat.org \
    --cc=hreitz@redhat.com \
    --cc=jan.kiszka@web.de \
    --cc=kwolf@redhat.com \
    --cc=magnus.damm@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=shentey@gmail.com \
    --cc=ysato@users.sourceforge.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).