diff mbox series

[kvm-unit-tests,v5,2/2] s390x: sclp: Implement extended-length-SCCB facility

Message ID 20230601164537.31769-3-pmorel@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series Fixing infinite loop on SCLP READ SCP INFO error | expand

Commit Message

Pierre Morel June 1, 2023, 4:45 p.m. UTC
When the extended-length-SCCB facility is present use a big
buffer already at first try when calling sclp_read_scp_info()
to avoid the SCLP_RC_INSUFFICIENT_SCCB_LENGTH error.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
 lib/s390x/sclp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Pierre Morel June 1, 2023, 4:58 p.m. UTC | #1
On 6/1/23 18:45, Pierre Morel wrote:
> When the extended-length-SCCB facility is present use a big
> buffer already at first try when calling sclp_read_scp_info()
> to avoid the SCLP_RC_INSUFFICIENT_SCCB_LENGTH error.
>
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
>   lib/s390x/sclp.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
> index adf357b..e44d299 100644
> --- a/lib/s390x/sclp.c
> +++ b/lib/s390x/sclp.c
> @@ -17,13 +17,14 @@
>   #include "sclp.h"
>   #include <alloc_phys.h>
>   #include <alloc_page.h>
> +#include <asm/facility.h>
>   
>   extern unsigned long stacktop;
>   
>   static uint64_t storage_increment_size;
>   static uint64_t max_ram_size;
>   static uint64_t ram_size;
> -char _read_info[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
> +char _read_info[2 * PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
>   static ReadInfo *read_info;
>   struct sclp_facilities sclp_facilities;
>   
> @@ -114,6 +115,8 @@ static void sclp_read_scp_info(ReadInfo *ri, int length)
>   void sclp_read_info(void)
>   {
This line must go away.....v
>   	sclp_read_scp_info((void *)_read_info, SCCB_SIZE);

Sorry for the noise.


> +	sclp_read_scp_info((void *)_read_info,
> +		test_facility(140) ? sizeof(_read_info) : SCCB_SIZE);
>   	read_info = (ReadInfo *)_read_info;
>   }
>
diff mbox series

Patch

diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index adf357b..e44d299 100644
--- a/lib/s390x/sclp.c
+++ b/lib/s390x/sclp.c
@@ -17,13 +17,14 @@ 
 #include "sclp.h"
 #include <alloc_phys.h>
 #include <alloc_page.h>
+#include <asm/facility.h>
 
 extern unsigned long stacktop;
 
 static uint64_t storage_increment_size;
 static uint64_t max_ram_size;
 static uint64_t ram_size;
-char _read_info[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
+char _read_info[2 * PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
 static ReadInfo *read_info;
 struct sclp_facilities sclp_facilities;
 
@@ -114,6 +115,8 @@  static void sclp_read_scp_info(ReadInfo *ri, int length)
 void sclp_read_info(void)
 {
 	sclp_read_scp_info((void *)_read_info, SCCB_SIZE);
+	sclp_read_scp_info((void *)_read_info,
+		test_facility(140) ? sizeof(_read_info) : SCCB_SIZE);
 	read_info = (ReadInfo *)_read_info;
 }