linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vernon Yang <vernon2gm@gmail.com>
To: lkp@intel.com
Cc: ajones@ventanamicro.com, anup@brainfault.org,
	atishp@rivosinc.com, conor.dooley@microchip.com,
	kbuild-all@lists.01.org, linux-mm@kvack.org,
	Vernon Yang <vernon2gm@gmail.com>
Subject: [PATCH] RISC-V: KVM: fixup undefined reference to riscv_cbom_block_size
Date: Mon, 10 Oct 2022 09:33:29 +0800	[thread overview]
Message-ID: <20221010013329.199167-1-vernon2gm@gmail.com> (raw)
In-Reply-To: <202210091222.xuZquaM9-lkp@intel.com>

When some RISC-V compilers do not support the Zicbom extension,
the build system auto disable the CONFIG_RISCV_ISA_ZICBOM, so the
source code of the relevant function is not compiled, resulting
in the definition of the riscv_cbom_block_size variable cannot
be found

So add conditional compilation to fix it

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Vernon Yang <vernon2gm@gmail.com>
---
 arch/riscv/kvm/vcpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c
index a032c4f0d600..08a6c3cb695d 100644
--- a/arch/riscv/kvm/vcpu.c
+++ b/arch/riscv/kvm/vcpu.c
@@ -256,7 +256,7 @@ static int kvm_riscv_vcpu_get_reg_config(struct kvm_vcpu *vcpu,
 	unsigned long reg_num = reg->id & ~(KVM_REG_ARCH_MASK |
 					    KVM_REG_SIZE_MASK |
 					    KVM_REG_RISCV_CONFIG);
-	unsigned long reg_val;
+	unsigned long reg_val = 0;
 
 	if (KVM_REG_SIZE(reg->id) != sizeof(unsigned long))
 		return -EINVAL;
@@ -268,7 +268,9 @@ static int kvm_riscv_vcpu_get_reg_config(struct kvm_vcpu *vcpu,
 	case KVM_REG_RISCV_CONFIG_REG(zicbom_block_size):
 		if (!riscv_isa_extension_available(vcpu->arch.isa, ZICBOM))
 			return -EINVAL;
+#ifdef CONFIG_RISCV_ISA_ZICBOM
 		reg_val = riscv_cbom_block_size;
+#endif
 		break;
 	default:
 		return -EINVAL;
-- 
2.25.1



  reply	other threads:[~2022-10-10  1:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-09  4:12 [linux-next:master 11281/12775] vcpu.c:undefined reference to `riscv_cbom_block_size' kernel test robot
2022-10-10  1:33 ` Vernon Yang [this message]
2022-10-10  6:42   ` [PATCH] RISC-V: KVM: fixup undefined reference to riscv_cbom_block_size Conor Dooley
2022-10-10  6:59     ` Andrew Jones
2022-10-10  7:05       ` Conor Dooley
2022-10-10  6:44   ` Andrew Jones

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=20221010013329.199167-1-vernon2gm@gmail.com \
    --to=vernon2gm@gmail.com \
    --cc=ajones@ventanamicro.com \
    --cc=anup@brainfault.org \
    --cc=atishp@rivosinc.com \
    --cc=conor.dooley@microchip.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox