All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
To: "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 1/2] hw/intc/riscv_aplic.c fix non-KVM --enable-debug build
Date: Tue, 29 Aug 2023 19:35:51 -0300	[thread overview]
Message-ID: <347984ea-3532-45b5-a9d7-1c3539b99b76@ventanamicro.com> (raw)
In-Reply-To: <19b33c0d-fe00-a108-81cf-eed4b0b238f5@linaro.org>



On 8/29/23 11:17, Philippe Mathieu-Daudé wrote:
> On 29/8/23 14:21, Daniel Henrique Barboza wrote:
>> Commit 6df0b37e2ab breaks a --enable-debug build in a non-KVM
>> environment with the following error:
>>
>> /usr/bin/ld: libqemu-riscv64-softmmu.fa.p/hw_intc_riscv_aplic.c.o: in function `riscv_kvm_aplic_request':
>> ./qemu/build/../hw/intc/riscv_aplic.c:486: undefined reference to `kvm_set_irq'
>> collect2: error: ld returned 1 exit status
>>
>> This happens because the debug build will poke into the
>> 'if (is_kvm_aia(aplic->msimode))' block and fail to find a reference to
>> the KVM only function riscv_kvm_aplic_request().
>>
>> Make riscv_kvm_aplic_request() a no-op if we're not building KVM.
>>
>> Fixes: 6df0b37e2ab ("target/riscv: update APLIC and IMSIC to support KVM AIA")
>> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
>> ---
>>   hw/intc/riscv_aplic.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c
>> index 592c3ce768..b634738bda 100644
>> --- a/hw/intc/riscv_aplic.c
>> +++ b/hw/intc/riscv_aplic.c
>> @@ -483,7 +483,9 @@ static uint32_t riscv_aplic_idc_claimi(RISCVAPLICState *aplic, uint32_t idc)
>>   static void riscv_kvm_aplic_request(void *opaque, int irq, int level)
>>   {
>> +#ifdef CONFIG_KVM
>>       kvm_set_irq(kvm_state, irq, !!level);
>> +#endif
>>   }
> 
> Can we use kvm_enabled() to let the compiler elide KVM code
> when !CONFIG_KVM?
> 
> -- >8 --
> diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c
> index 592c3ce768..f28d0d3237 100644
> @@ -155,7 +155,7 @@
>    */
>   static bool is_kvm_aia(bool msimode)
>   {
> -    return kvm_irqchip_in_kernel() && msimode;
> +    return kvm_enabled() && kvm_irqchip_in_kernel() && msimode;

Apparently we can't:


$ git diff
diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c
index b634738bda..f28d0d3237 100644
--- a/hw/intc/riscv_aplic.c
+++ b/hw/intc/riscv_aplic.c
@@ -155,7 +155,7 @@
   */
  static bool is_kvm_aia(bool msimode)
  {
-    return kvm_irqchip_in_kernel() && msimode;
+    return kvm_enabled() && kvm_irqchip_in_kernel() && msimode;
  }
  
  static uint32_t riscv_aplic_read_input_word(RISCVAPLICState *aplic,
@@ -483,9 +483,7 @@ static uint32_t riscv_aplic_idc_claimi(RISCVAPLICState *aplic, uint32_t idc)
  
  static void riscv_kvm_aplic_request(void *opaque, int irq, int level)
  {
-#ifdef CONFIG_KVM
      kvm_set_irq(kvm_state, irq, !!level);
-#endif
  }

Same error appears:


/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


Thanks,


Daniel



>   }
> ---
> 


  reply	other threads:[~2023-08-29 22:43 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 [this message]
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
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=347984ea-3532-45b5-a9d7-1c3539b99b76@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=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.