]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64/sve: Fix vq_present() macro to yield a bool
authorZhang Lei <zhang.lei@jp.fujitsu.com>
Wed, 3 Jul 2019 17:42:50 +0000 (18:42 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 5 Jul 2019 10:07:51 +0000 (12:07 +0200)
commitece16a1444a1b712c6769a4690d703182a8f75cf
tree7e090af67f4e2b5e91305538daec75be26828cf9
parentbf7b1c86cd9916fa17cebf9e4a98a649140f5392
KVM: arm64/sve: Fix vq_present() macro to yield a bool

The original implementation of vq_present() relied on aggressive
inlining in order for the compiler to know that the code is
correct, due to some const-casting issues.  This was causing sparse
and clang to complain, while GCC compiled cleanly.

Commit 5dc82993abdd addressed this problem, but since vq_present()
is no longer a function, there is now no implicit casting of the
returned value to the return type (bool).

In set_sve_vls(), this uncast bit value is compared against a bool,
and so may spuriously compare as unequal when both are nonzero.  As
a result, KVM may reject valid SVE vector length configurations as
invalid, and vice versa.

Fix it by forcing the returned value to a bool.

Signed-off-by: Zhang Lei <zhang.lei@jp.fujitsu.com>
Fixes: 5dc82993abdd ("KVM: arm64: Implement vq_present() as a macro")
Signed-off-by: Dave Martin <Dave.Martin@arm.com> [commit message rewrite]
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/arm64/kvm/guest.c