All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
To: "Richard Henderson" <richard.henderson@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	qemu-devel@nongnu.org
Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com,
	bmeng@tinylab.org, liweiwei@iscas.ac.cn,
	zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com
Subject: Re: [PATCH 2/2] hw/riscv/virt.c: fix non-KVM --enable-debug build
Date: Tue, 29 Aug 2023 20:51:42 -0300	[thread overview]
Message-ID: <40938464-2008-aff3-ffb7-37fbb16615d3@ventanamicro.com> (raw)
In-Reply-To: <63d099a2-ac5e-1ce9-3663-10e317d7dc5a@linaro.org>



On 8/29/23 20:30, Richard Henderson wrote:
> On 8/29/23 16:09, Daniel Henrique Barboza wrote:
>>> -- >8 --
>>> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
>>> @@ -79,7 +79,9 @@
>>>   /* KVM AIA only supports APLIC MSI. APLIC Wired is always emulated by QEMU. */
>>>   static bool virt_use_kvm_aia(RISCVVirtState *s)
>>>   {
>>> -    return kvm_irqchip_in_kernel() && s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC;
>>> +    return kvm_enabled()
>>> +        && kvm_irqchip_in_kernel()
>>> +        && s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC;
>>>   }
>>> ---
>>
>> It doesn't work. Same error:
>>
>> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
>> index 388e52a294..ac710006e7 100644
>> --- a/hw/riscv/virt.c
>> +++ b/hw/riscv/virt.c
>> @@ -79,7 +79,8 @@
>>   /* KVM AIA only supports APLIC MSI. APLIC Wired is always emulated by QEMU. */
>>   static bool virt_use_kvm_aia(RISCVVirtState *s)
>>   {
>> -    return kvm_irqchip_in_kernel() && s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC;
>> +    return kvm_enabled() &&
>> +           kvm_irqchip_in_kernel() && s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC;
>>   }
>>
>>   static const MemMapEntry virt_memmap[] = {
>> diff --git a/target/riscv/kvm_riscv.h b/target/riscv/kvm_riscv.h
>> index 01be45cc69..7d4b7c60e2 100644
>> --- a/target/riscv/kvm_riscv.h
>> +++ b/target/riscv/kvm_riscv.h
>> @@ -22,19 +22,9 @@
>>   void kvm_riscv_init_user_properties(Object *cpu_obj);
>>   void kvm_riscv_reset_vcpu(RISCVCPU *cpu);
>>   void kvm_riscv_set_irq(RISCVCPU *cpu, int irq, int level);
>> -
>> -#ifdef CONFIG_KVM
>>   void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift,
>>                             uint64_t aia_irq_num, uint64_t aia_msi_num,
>>                             uint64_t aplic_base, uint64_t imsic_base,
>>                             uint64_t guest_num);
>> -#else
>> -static inline void kvm_riscv_aia_create(MachineState *machine,
>> -                                uint64_t group_shift, uint64_t aia_irq_num,
>> -                                uint64_t aia_msi_num, uint64_t aplic_base,
>> -                                uint64_t imsic_base, uint64_t guest_num) {
>> -    g_assert_not_reached();
>> -}
>> -#endif
>>
>>
>>
>> /usr/bin/ld: libqemu-riscv64-softmmu.fa.p/hw_riscv_virt.c.o: in function `virt_machine_init':
>> /home/danielhb/work/qemu/build/../hw/riscv/virt.c:1466: undefined reference to `kvm_riscv_aia_create'
>> collect2: error: ld returned 1 exit status
>>
>>
>> I'm no compiler expert by any means but it seems that the --enable-debug build does not strip things
>> out like the usual build does, e.g. it won't elide a 'if kvm_enabled()' block out by checking that
>> kvm_enabled() is always false.
> 
> The compiler certainly does eliminate 0 && foo(), even at -O0.
> 
> There must be something else going on.
> Pointer to your tree?

It's this tree:

https://github.com/alistair23/qemu/tree/riscv-to-apply.next


Building using --enable-debug fails:


[danielhb@grind build]$ ../configure --target-list=riscv64-softmmu --enable-debug && make -j
(...)
0.so /usr/lib64/libcairo-gobject.so /usr/lib64/libcairo.so /usr/lib64/libgdk_pixbuf-2.0.so /usr/lib64/libX11.so /usr/lib64/libvirglrenderer.so /usr/lib64/libcacard.so /usr/lib64/libusbredirparser.so /usr/lib64/libusb-1.0.so -lbrlapi @block.syms -lnuma /usr/lib64/liburing.so -lm /usr/lib64/libfuse3.so -lpthread /usr/lib64/iscsi/libiscsi.so -laio /usr/lib64/libcurl.so /usr/lib64/libnfs.so /usr/lib64/libssh.so -lrbd -lrados -lbz2 -lutil -Wl,--end-group
/usr/bin/ld: libqemu-riscv64-softmmu.fa.p/hw_riscv_virt.c.o: in function `virt_machine_init':
/home/danielhb/work/qemu/build/../hw/riscv/virt.c:1465: undefined reference to `kvm_riscv_aia_create'
/usr/bin/ld: libqemu-riscv64-softmmu.fa.p/hw_intc_riscv_aplic.c.o: in function `riscv_kvm_aplic_request':
/home/danielhb/work/qemu/build/../hw/intc/riscv_aplic.c:486: undefined reference to `kvm_set_irq'
collect2: error: ld returned 1 exit status

Building without --enable-debug works. gitlab CI doesn't seem to care with it because it's all
green with this tree.


The commits that introduced these errors are listed in the 'Fixes' tag of patches 1 and 2.


Thanks,

Daniel








> 
> r~


  reply	other threads:[~2023-08-29 23:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 12:21 [PATCH 0/2] riscv: fix --enable-debug in riscv-to-apply.next Daniel Henrique Barboza
2023-08-29 12:21 ` [PATCH 1/2] hw/intc/riscv_aplic.c fix non-KVM --enable-debug build Daniel Henrique Barboza
2023-08-29 14:17   ` Philippe Mathieu-Daudé
2023-08-29 22:35     ` Daniel Henrique Barboza
2023-08-29 12:21 ` [PATCH 2/2] hw/riscv/virt.c: " Daniel Henrique Barboza
2023-08-29 14:18   ` Philippe Mathieu-Daudé
2023-08-29 23:09     ` Daniel Henrique Barboza
2023-08-29 23:30       ` Richard Henderson
2023-08-29 23:51         ` Daniel Henrique Barboza [this message]
2023-08-30  1:26           ` Richard Henderson
2023-08-30  9:34             ` Daniel Henrique Barboza
2023-08-30 13:49               ` Richard Henderson

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=40938464-2008-aff3-ffb7-37fbb16615d3@ventanamicro.com \
    --to=dbarboza@ventanamicro.com \
    --cc=alistair.francis@wdc.com \
    --cc=bmeng@tinylab.org \
    --cc=liweiwei@iscas.ac.cn \
    --cc=palmer@rivosinc.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=zhiwei_liu@linux.alibaba.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.