diff mbox series

[kvm-unit-tests,1/4] s390x: sclp: Only fetch read info byte 134 if cpu entries are above it

Message ID 20210510150015.11119-2-frankja@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: cpumodel: Add sclp checks | expand

Commit Message

Janosch Frank May 10, 2021, 3 p.m. UTC
The cpu offset tells us where the cpu entries are in the sclp read
info structure.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 lib/s390x/sclp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

David Hildenbrand May 11, 2021, 11:39 a.m. UTC | #1
On 10.05.21 17:00, Janosch Frank wrote:
> The cpu offset tells us where the cpu entries are in the sclp read
> info structure.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>   lib/s390x/sclp.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
> index 7a9b2c52..f11c2035 100644
> --- a/lib/s390x/sclp.c
> +++ b/lib/s390x/sclp.c
> @@ -138,7 +138,8 @@ void sclp_facilities_setup(void)
>   	assert(read_info);
>   
>   	cpu = sclp_get_cpu_entries();
> -	sclp_facilities.has_diag318 = read_info->byte_134_diag318;
> +	if (read_info->offset_cpu > 134)
> +		sclp_facilities.has_diag318 = read_info->byte_134_diag318;
>   	for (i = 0; i < read_info->entries_cpu; i++, cpu++) {
>   		/*
>   		 * The logic for only reading the facilities from the
> 

Reviewed-by: David Hildenbrand <david@redhat.com>
Cornelia Huck May 11, 2021, 4:32 p.m. UTC | #2
On Mon, 10 May 2021 15:00:12 +0000
Janosch Frank <frankja@linux.ibm.com> wrote:

> The cpu offset tells us where the cpu entries are in the sclp read
> info structure.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  lib/s390x/sclp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
diff mbox series

Patch

diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index 7a9b2c52..f11c2035 100644
--- a/lib/s390x/sclp.c
+++ b/lib/s390x/sclp.c
@@ -138,7 +138,8 @@  void sclp_facilities_setup(void)
 	assert(read_info);
 
 	cpu = sclp_get_cpu_entries();
-	sclp_facilities.has_diag318 = read_info->byte_134_diag318;
+	if (read_info->offset_cpu > 134)
+		sclp_facilities.has_diag318 = read_info->byte_134_diag318;
 	for (i = 0; i < read_info->entries_cpu; i++, cpu++) {
 		/*
 		 * The logic for only reading the facilities from the