Re: [kvm-unit-tests PATCH 5/9] s390x: topology: Refine stsi header test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2023-10-11 at 13:16 +0200, Janosch Frank wrote:
> On 10/11/23 10:56, Nina Schoetterl-Glausch wrote:
> > Add checks for length field.
> > Also minor refactor.
> > 
> > Signed-off-by: Nina Schoetterl-Glausch <nsg@xxxxxxxxxxxxx>
> > ---
> >   s390x/topology.c | 15 +++++++++------
> >   1 file changed, 9 insertions(+), 6 deletions(-)
> > 
> > diff --git a/s390x/topology.c b/s390x/topology.c
> > index 5374582f..0ba57986 100644
> > --- a/s390x/topology.c
> > +++ b/s390x/topology.c
> > @@ -187,18 +187,22 @@ static void stsi_check_maxcpus(struct sysinfo_15_1_x *info)
> >   }
> >   
> >   /*
> > - * stsi_check_mag
> > + * stsi_check_header
> >    * @info: Pointer to the stsi information
> > + * @sel2: stsi selector 2 value
> >    *
> >    * MAG field should match the architecture defined containers
> >    * when MNEST as returned by SCLP matches MNEST of the SYSIB.
> >    */
> > -static void stsi_check_mag(struct sysinfo_15_1_x *info)
> > +static void stsi_check_header(struct sysinfo_15_1_x *info, int sel2)
> >   {
> >   	int i;
> >   
> > -	report_prefix_push("MAG");
> > +	report_prefix_push("Header");
> >   
> > +	report(IS_ALIGNED(info->length, 8), "Length %d multiple of 8", info->length);
> 
> STSI 15 works on Words, not DWords, no?
> So we need to check length against 4, not 8.

The header is 16 bytes.
Topology list entries are 8 or 16, so it must be a multiple of 8 at least.

> 
> > +	report(info->length < PAGE_SIZE, "Length %d in bounds", info->length);
> > +	report(sel2 == info->mnest, "Valid mnest");
> >   	stsi_check_maxcpus(info);
> >   
> >   	/*
> > @@ -326,7 +330,6 @@ static int stsi_get_sysib(struct sysinfo_15_1_x *info, int sel2)
> >   
> >   	if (max_nested_lvl >= sel2) {
> >   		report(!ret, "Valid instruction");
> > -		report(sel2 == info->mnest, "Valid mnest");
> >   	} else {
> >   		report(ret, "Invalid instruction");
> >   	}
> > @@ -365,7 +368,7 @@ static void check_sysinfo_15_1_x(struct sysinfo_15_1_x *info, int sel2)
> >   		goto vertical;
> >   	}
> >   
> > -	stsi_check_mag(info);
> > +	stsi_check_header(info, sel2);
> >   	stsi_check_tle_coherency(info);
> >   
> >   vertical:
> > @@ -378,7 +381,7 @@ vertical:
> >   		goto end;
> >   	}
> >   
> > -	stsi_check_mag(info);
> > +	stsi_check_header(info, sel2);
> >   	stsi_check_tle_coherency(info);
> >   	report_prefix_pop();
> >   
> 





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux