All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Huacai Chen <chenhuacai@gmail.com>
Cc: Huacai Chen <zltjiangshi@gmail.com>,
	Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [PATCH V9 6/6] hw/mips: Add Loongson-3 machine support
Date: Thu, 24 Sep 2020 17:40:03 +0200	[thread overview]
Message-ID: <4a461bbc-3765-4d3c-7e7b-952dab564af1@amsat.org> (raw)
In-Reply-To: <CAAhV-H5OysVNvGzD066eVqA+-k2+GJDjwSGR0hJT0VUh3Ld83A@mail.gmail.com>

On 9/16/20 11:49 AM, Huacai Chen wrote:
> Hi, Philippe,
> 
> On Wed, Sep 16, 2020 at 3:56 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>>
>> Hi Huacai,
>>
>> On 9/16/20 4:12 AM, Huacai Chen wrote:
...
>> hw/mips/loongson3_virt.c:373:15: note: each undeclared identifier is
>> reported only once for each function it appears in
>> hw/mips/loongson3_virt.c:373:15: error: excess elements in struct
>> initializer [-Werror]
>> hw/mips/loongson3_virt.c:373:15: note: (near initialization for 'freq_reg')
>> hw/mips/loongson3_virt.c:374:9: error: unknown field 'addr' specified in
>> initializer
>>          .addr = (uintptr_t)(&freq)
>>          ^
>> hw/mips/loongson3_virt.c:374:17: error: excess elements in struct
>> initializer [-Werror]
>>          .addr = (uintptr_t)(&freq)
>>                  ^
>> hw/mips/loongson3_virt.c:374:17: note: (near initialization for 'freq_reg')
>> hw/mips/loongson3_virt.c:372:24: error: storage size of 'freq_reg' isn't
>> known
>>      struct kvm_one_reg freq_reg = {
>>                         ^
>> hw/mips/loongson3_virt.c:380:41: error: 'KVM_GET_ONE_REG' undeclared
>> (first use in this function)
>>          ret = kvm_vcpu_ioctl(first_cpu, KVM_GET_ONE_REG, &freq_reg);
>>                                          ^
>> hw/mips/loongson3_virt.c:372:24: error: unused variable 'freq_reg'
>> [-Werror=unused-variable]
>>      struct kvm_one_reg freq_reg = {
>>                         ^
>> hw/mips/loongson3_virt.c: In function 'init_loongson_params':
>> hw/mips/loongson3_virt.c:467:25: error: cast from pointer to integer of
>> different size [-Werror=pointer-to-int-cast]
>>      lp->memory_offset = (unsigned long long)init_memory_map(p)
>>                          ^
> I guess this happens on a 32bit platform where pointer is 32bit, and
> could you please suggest a best solution for this? Maybe use uintptr_t
> instead of unsigned long long?

Since the machine doesn't have to know the EFI structures
layout, I'd change your method to fill EFI structures as i.e.:

/*
 * @ptr: Pointer to fill
 * @size: Buffer size available at @ptr
 * Returns: Structure size filled on success, -1 on error.
 */
size_t fill_efi_memory_map_loongson(char *ptr, size_t size);

And move that to hw/mips/loongson_efi.{c,h}.

Then you don't need to worry about host pointer size, you just
exchange buffer/size, then caller can round up and increment an
offset.

BTW the EFI helpers are not endian safe.

You should use the helpers described in docs/devel/loads-stores.rst:

stw_le_p, stl_le_p(), ... (as I don't expect big-endian guests).

Regards,

Phil.


  parent reply	other threads:[~2020-09-24 16:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16  2:12 [PATCH V9 0/6] mips: Add Loongson-3 machine support Huacai Chen
2020-09-16  2:12 ` [PATCH V9 1/6] linux-headers: Update MIPS KVM type defintition Huacai Chen
2020-09-16  2:12 ` [PATCH V9 2/6] target/mips: Fix PageMask with variable page size Huacai Chen
2020-09-16  2:12 ` [PATCH V9 3/6] target/mips: Add loongson-ext lswc2 group of instructions (Part 1) Huacai Chen
2020-09-16  7:46   ` Philippe Mathieu-Daudé
2020-09-16  7:58     ` Huacai Chen
2020-09-16 15:15   ` Richard Henderson
2020-09-19  0:44     ` Huacai Chen
2020-09-16  2:12 ` [PATCH V9 4/6] target/mips: Add loongson-ext lswc2 group of instructions (Part 2) Huacai Chen
2020-09-16  2:12 ` [PATCH V9 5/6] target/mips: Add loongson-ext lsdc2 group of instructions Huacai Chen
2020-09-16  2:12 ` [PATCH V9 6/6] hw/mips: Add Loongson-3 machine support Huacai Chen
2020-09-16  7:56   ` Philippe Mathieu-Daudé
2020-09-16  8:08     ` Philippe Mathieu-Daudé
2020-09-16  9:49     ` Huacai Chen
2020-09-16 10:47       ` Philippe Mathieu-Daudé
2020-09-17  7:53         ` Philippe Mathieu-Daudé
2020-09-19  1:00           ` Huacai Chen
2020-09-19 13:59             ` Philippe Mathieu-Daudé
2020-09-21  2:12               ` chen huacai
2020-09-17  8:09       ` Philippe Mathieu-Daudé
2020-09-24 15:40       ` Philippe Mathieu-Daudé [this message]
2020-09-25  4:28         ` Huacai Chen
2020-09-17  7:56 ` [PATCH V9 0/6] mips: " Philippe Mathieu-Daudé
2020-09-21  2:25   ` chen huacai
2020-09-17  8:22 ` Aleksandar Markovic
2020-09-21  2:19   ` chen huacai

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=4a461bbc-3765-4d3c-7e7b-952dab564af1@amsat.org \
    --to=f4bug@amsat.org \
    --cc=aleksandar.qemu.devel@gmail.com \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=aurelien@aurel32.net \
    --cc=chenhuacai@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zltjiangshi@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.