* [PATCH] KVM: selftests: Fix compile error for non-x86 vm_compute_max_gfn()
@ 2021-12-21 12:56 Anup Patel
2021-12-21 17:22 ` Shuah Khan
0 siblings, 1 reply; 4+ messages in thread
From: Anup Patel @ 2021-12-21 12:56 UTC (permalink / raw)
To: Paolo Bonzini, Shuah Khan, Atish Patra
Cc: Sean Christopherson, Palmer Dabbelt, Paul Walmsley, Albert Ou,
Alistair Francis, Anup Patel, kvm, kvm-riscv, linux-riscv,
linux-kernel, linux-kselftest, Anup Patel
The inline version of vm_compute_max_gfn() in kvm_util.h directly
access members of "struct kvm_vm" which causes compile errors for
non-x86 architectures because lib/elf.c includes "kvm_util.h" before
"kvm_util_internal.h".
This patch fixes above described compile error by converting inline
version of vm_compute_max_gfn() into a macro.
Fixes: c8cc43c1eae2 ("selftests: KVM: avoid failures due to reserved
HyperTransport region")
Signed-off-by: Anup Patel <anup.patel@wdc.com>
---
tools/testing/selftests/kvm/include/kvm_util.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h
index da2b702da71a..2279e340ca58 100644
--- a/tools/testing/selftests/kvm/include/kvm_util.h
+++ b/tools/testing/selftests/kvm/include/kvm_util.h
@@ -74,10 +74,8 @@ enum vm_guest_mode {
#if defined(__x86_64__)
unsigned long vm_compute_max_gfn(struct kvm_vm *vm);
#else
-static inline unsigned long vm_compute_max_gfn(struct kvm_vm *vm)
-{
- return ((1ULL << vm->pa_bits) >> vm->page_shift) - 1;
-}
+#define vm_compute_max_gfn(vm) \
+ ((unsigned long)(((1ULL << (vm)->pa_bits) >> (vm)->page_shift) - 1))
#endif
#define MIN_PAGE_SIZE (1U << MIN_PAGE_SHIFT)
--
2.25.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: selftests: Fix compile error for non-x86 vm_compute_max_gfn()
2021-12-21 12:56 [PATCH] KVM: selftests: Fix compile error for non-x86 vm_compute_max_gfn() Anup Patel
@ 2021-12-21 17:22 ` Shuah Khan
2021-12-21 17:23 ` Paolo Bonzini
0 siblings, 1 reply; 4+ messages in thread
From: Shuah Khan @ 2021-12-21 17:22 UTC (permalink / raw)
To: Anup Patel, Paolo Bonzini, Shuah Khan, Atish Patra
Cc: Sean Christopherson, Palmer Dabbelt, Paul Walmsley, Albert Ou,
Alistair Francis, Anup Patel, kvm, kvm-riscv, linux-riscv,
linux-kernel, linux-kselftest, Shuah Khan
On 12/21/21 5:56 AM, Anup Patel wrote:
> The inline version of vm_compute_max_gfn() in kvm_util.h directly
> access members of "struct kvm_vm" which causes compile errors for
> non-x86 architectures because lib/elf.c includes "kvm_util.h" before
> "kvm_util_internal.h".
>
> This patch fixes above described compile error by converting inline
> version of vm_compute_max_gfn() into a macro.
Thank you for the patch. Please include the actual compile error in the
change log and send v2,
thanks,
-- Shuah
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: selftests: Fix compile error for non-x86 vm_compute_max_gfn()
2021-12-21 17:22 ` Shuah Khan
@ 2021-12-21 17:23 ` Paolo Bonzini
2021-12-22 3:28 ` Anup Patel
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2021-12-21 17:23 UTC (permalink / raw)
To: Shuah Khan, Anup Patel, Shuah Khan, Atish Patra
Cc: Sean Christopherson, Palmer Dabbelt, Paul Walmsley, Albert Ou,
Alistair Francis, Anup Patel, kvm, kvm-riscv, linux-riscv,
linux-kernel, linux-kselftest
On 12/21/21 18:22, Shuah Khan wrote:
> On 12/21/21 5:56 AM, Anup Patel wrote:
>> The inline version of vm_compute_max_gfn() in kvm_util.h directly
>> access members of "struct kvm_vm" which causes compile errors for
>> non-x86 architectures because lib/elf.c includes "kvm_util.h" before
>> "kvm_util_internal.h".
>>
>> This patch fixes above described compile error by converting inline
>> version of vm_compute_max_gfn() into a macro.
>
> Thank you for the patch. Please include the actual compile error in the
> change log and send v2,
Hi, a similar patch is already queued and should get to Linus today or
tomorrow.
Paolo
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: selftests: Fix compile error for non-x86 vm_compute_max_gfn()
2021-12-21 17:23 ` Paolo Bonzini
@ 2021-12-22 3:28 ` Anup Patel
0 siblings, 0 replies; 4+ messages in thread
From: Anup Patel @ 2021-12-22 3:28 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Shuah Khan, Anup Patel, Shuah Khan, Atish Patra,
Sean Christopherson, Palmer Dabbelt, Paul Walmsley, Albert Ou,
Alistair Francis, KVM General, kvm-riscv, linux-riscv,
linux-kernel@vger.kernel.org List, linux-kselftest
On Tue, Dec 21, 2021 at 10:53 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 12/21/21 18:22, Shuah Khan wrote:
> > On 12/21/21 5:56 AM, Anup Patel wrote:
> >> The inline version of vm_compute_max_gfn() in kvm_util.h directly
> >> access members of "struct kvm_vm" which causes compile errors for
> >> non-x86 architectures because lib/elf.c includes "kvm_util.h" before
> >> "kvm_util_internal.h".
> >>
> >> This patch fixes above described compile error by converting inline
> >> version of vm_compute_max_gfn() into a macro.
> >
> > Thank you for the patch. Please include the actual compile error in the
> > change log and send v2,
>
> Hi, a similar patch is already queued and should get to Linus today or
> tomorrow.
Thanks Paolo, I missed Andrew's fix for this.
Regards,
Anup
>
> Paolo
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-22 3:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21 12:56 [PATCH] KVM: selftests: Fix compile error for non-x86 vm_compute_max_gfn() Anup Patel
2021-12-21 17:22 ` Shuah Khan
2021-12-21 17:23 ` Paolo Bonzini
2021-12-22 3:28 ` Anup Patel
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 read-only IMAP folder(s) and NNTP newsgroup(s).