[PATCH v5 10/13] KVM: selftests: Only do get/set tests on present blessed list
Andrew Jones
ajones at ventanamicro.com
Mon Jul 3 01:18:35 PDT 2023
On Sat, Jul 01, 2023 at 09:42:58PM +0800, Haibo Xu wrote:
> Only do the get/set tests on present and blessed registers
> since we don't know the capabilities of any new ones.
>
> Suggested-by: Andrew Jones <ajones at ventanamicro.com>
> Signed-off-by: Haibo Xu <haibo1.xu at intel.com>
> Reviewed-by: Andrew Jones <ajones at ventanamicro.com>
> ---
> tools/testing/selftests/kvm/get-reg-list.c | 29 ++++++++++++++--------
> 1 file changed, 18 insertions(+), 11 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/get-reg-list.c b/tools/testing/selftests/kvm/get-reg-list.c
> index c61090806007..74fb6f6fdd09 100644
> --- a/tools/testing/selftests/kvm/get-reg-list.c
> +++ b/tools/testing/selftests/kvm/get-reg-list.c
> @@ -49,6 +49,10 @@ extern int vcpu_configs_n;
> for_each_reg_filtered(i) \
> if (!find_reg(blessed_reg, blessed_n, reg_list->reg[i]))
>
> +#define for_each_present_blessed_reg(i) \
> + for ((i) = 0; (i) < blessed_n; ++(i)) \
> + if (find_reg(reg_list->reg, reg_list->n, blessed_reg[i]))
I just realized this is backwards. We need 'i' to index reg_list->reg in
the body of the loop. That means we need to write this as
#define for_each_present_blessed_reg(i) \
for_each_reg(i) \
if (find_reg(blessed_reg, blessed_n, reg_list->reg[i]))
(Which, in hindsight, makes sense since we're replacing a for_each_reg()
loop.)
Thanks,
drew
More information about the linux-riscv
mailing list