Message ID | 47f0502d076c071260a87953cbabadfc85d278cf.1687515463.git.haibo1.xu@intel.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | RISCV: Add KVM_GET_REG_LIST API | expand |
Context | Check | Description |
---|---|---|
conchuod/cover_letter | success | Series has a cover letter |
conchuod/tree_selection | success | Guessed tree name to be for-next at HEAD 4681dacadeef |
conchuod/fixes_present | success | Fixes tag not required for -next series |
conchuod/maintainers_pattern | success | MAINTAINERS pattern errors before the patch: 6 and now 6 |
conchuod/verify_signedoff | success | Signed-off-by tag matches author and committer |
conchuod/kdoc | success | Errors and warnings before: 0 this patch: 0 |
conchuod/build_rv64_clang_allmodconfig | success | Errors and warnings before: 8 this patch: 8 |
conchuod/module_param | success | Was 0 now: 0 |
conchuod/build_rv64_gcc_allmodconfig | success | Errors and warnings before: 8 this patch: 8 |
conchuod/build_rv32_defconfig | success | Build OK |
conchuod/dtb_warn_rv64 | success | Errors and warnings before: 20 this patch: 20 |
conchuod/header_inline | success | No static functions without inline keyword in header files |
conchuod/checkpatch | fail | ERROR: Macros with complex values should be enclosed in parentheses |
conchuod/build_rv64_nommu_k210_defconfig | success | Build OK |
conchuod/verify_fixes | success | No Fixes tag |
conchuod/build_rv64_nommu_virt_defconfig | success | Build OK |
On Fri, Jun 23, 2023 at 06:40:11PM +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@ventanamicro.com> > Signed-off-by: Haibo Xu <haibo1.xu@intel.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 b956ee410996..3beb6b62de0a 100644 > --- a/tools/testing/selftests/kvm/get-reg-list.c > +++ b/tools/testing/selftests/kvm/get-reg-list.c > @@ -52,6 +52,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])) > + > static const char *config_name(struct vcpu_reg_list *c) > { > struct vcpu_reg_sublist *s; > @@ -189,6 +193,16 @@ static void run_test(struct vcpu_reg_list *c) > return; > } > > + for_each_sublist(c, s) > + blessed_n += s->regs_n; > + blessed_reg = calloc(blessed_n, sizeof(__u64)); > + > + n = 0; > + for_each_sublist(c, s) { > + for (i = 0; i < s->regs_n; ++i) > + blessed_reg[n++] = s->regs[i]; > + } > + > /* > * We only test that we can get the register and then write back the > * same value. Some registers may allow other values to be written > @@ -198,8 +212,11 @@ static void run_test(struct vcpu_reg_list *c) > * be written need to have the other values tested, then we should > * create a new set of tests for those in a new independent test > * executable. > + * > + * Only do the get/set tests on present, blessed list registers, > + * since we don't know the capabilities of any new registers. > */ > - for_each_reg(i) { > + for_each_present_blessed_reg(i) { > uint8_t addr[2048 / 8]; > struct kvm_one_reg reg = { > .id = reg_list->reg[i], > @@ -242,16 +259,6 @@ static void run_test(struct vcpu_reg_list *c) > } > } > > - for_each_sublist(c, s) > - blessed_n += s->regs_n; > - blessed_reg = calloc(blessed_n, sizeof(__u64)); > - > - n = 0; > - for_each_sublist(c, s) { > - for (i = 0; i < s->regs_n; ++i) > - blessed_reg[n++] = s->regs[i]; > - } > - > for_each_new_reg(i) > ++new_regs; > > -- > 2.34.1 > Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Thanks, drew
On Tue, Jun 27, 2023 at 5:11 PM Andrew Jones <ajones@ventanamicro.com> wrote: > > On Fri, Jun 23, 2023 at 06:40:11PM +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@ventanamicro.com> > > Signed-off-by: Haibo Xu <haibo1.xu@intel.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 b956ee410996..3beb6b62de0a 100644 > > --- a/tools/testing/selftests/kvm/get-reg-list.c > > +++ b/tools/testing/selftests/kvm/get-reg-list.c > > @@ -52,6 +52,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])) > > + > > static const char *config_name(struct vcpu_reg_list *c) > > { > > struct vcpu_reg_sublist *s; > > @@ -189,6 +193,16 @@ static void run_test(struct vcpu_reg_list *c) > > return; > > } > > > > + for_each_sublist(c, s) > > + blessed_n += s->regs_n; > > + blessed_reg = calloc(blessed_n, sizeof(__u64)); > > + > > + n = 0; > > + for_each_sublist(c, s) { > > + for (i = 0; i < s->regs_n; ++i) > > + blessed_reg[n++] = s->regs[i]; > > + } > > + > > /* > > * We only test that we can get the register and then write back the > > * same value. Some registers may allow other values to be written > > @@ -198,8 +212,11 @@ static void run_test(struct vcpu_reg_list *c) > > * be written need to have the other values tested, then we should > > * create a new set of tests for those in a new independent test > > * executable. > > + * > > + * Only do the get/set tests on present, blessed list registers, > > + * since we don't know the capabilities of any new registers. > > */ > > - for_each_reg(i) { > > + for_each_present_blessed_reg(i) { > > uint8_t addr[2048 / 8]; > > struct kvm_one_reg reg = { > > .id = reg_list->reg[i], > > @@ -242,16 +259,6 @@ static void run_test(struct vcpu_reg_list *c) > > } > > } > > > > - for_each_sublist(c, s) > > - blessed_n += s->regs_n; > > - blessed_reg = calloc(blessed_n, sizeof(__u64)); > > - > > - n = 0; > > - for_each_sublist(c, s) { > > - for (i = 0; i < s->regs_n; ++i) > > - blessed_reg[n++] = s->regs[i]; > > - } > > - > > for_each_new_reg(i) > > ++new_regs; > > > > -- > > 2.34.1 > > > > Reviewed-by: Andrew Jones <ajones@ventanamicro.com> > > Thanks, > drew Thanks for the review!
diff --git a/tools/testing/selftests/kvm/get-reg-list.c b/tools/testing/selftests/kvm/get-reg-list.c index b956ee410996..3beb6b62de0a 100644 --- a/tools/testing/selftests/kvm/get-reg-list.c +++ b/tools/testing/selftests/kvm/get-reg-list.c @@ -52,6 +52,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])) + static const char *config_name(struct vcpu_reg_list *c) { struct vcpu_reg_sublist *s; @@ -189,6 +193,16 @@ static void run_test(struct vcpu_reg_list *c) return; } + for_each_sublist(c, s) + blessed_n += s->regs_n; + blessed_reg = calloc(blessed_n, sizeof(__u64)); + + n = 0; + for_each_sublist(c, s) { + for (i = 0; i < s->regs_n; ++i) + blessed_reg[n++] = s->regs[i]; + } + /* * We only test that we can get the register and then write back the * same value. Some registers may allow other values to be written @@ -198,8 +212,11 @@ static void run_test(struct vcpu_reg_list *c) * be written need to have the other values tested, then we should * create a new set of tests for those in a new independent test * executable. + * + * Only do the get/set tests on present, blessed list registers, + * since we don't know the capabilities of any new registers. */ - for_each_reg(i) { + for_each_present_blessed_reg(i) { uint8_t addr[2048 / 8]; struct kvm_one_reg reg = { .id = reg_list->reg[i], @@ -242,16 +259,6 @@ static void run_test(struct vcpu_reg_list *c) } } - for_each_sublist(c, s) - blessed_n += s->regs_n; - blessed_reg = calloc(blessed_n, sizeof(__u64)); - - n = 0; - for_each_sublist(c, s) { - for (i = 0; i < s->regs_n; ++i) - blessed_reg[n++] = s->regs[i]; - } - for_each_new_reg(i) ++new_regs;
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@ventanamicro.com> Signed-off-by: Haibo Xu <haibo1.xu@intel.com> --- tools/testing/selftests/kvm/get-reg-list.c | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-)