Re: [PATCH kvm-unit-tests 6/9] s390x: detect installed memory

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

 



On 10.01.2018 22:53, David Hildenbrand wrote:
> Unfortunately, there is no easy way to simply read out the amount
> of installed memory. We have to probe (via TEST PROTECTION) for installed
> memory in a given range.
> 
> Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
> ---
>  lib/s390x/asm/arch_def.h | 12 +++++++++++
>  lib/s390x/io.c           |  1 +
>  lib/s390x/sclp.c         | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
>  lib/s390x/sclp.h         |  1 +
>  s390x/Makefile           |  1 +
>  5 files changed, 67 insertions(+)
>  create mode 100644 lib/s390x/sclp.c
> 
> diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
> index 72e5c60..ae27ab2 100644
> --- a/lib/s390x/asm/arch_def.h
> +++ b/lib/s390x/asm/arch_def.h
> @@ -151,4 +151,16 @@ struct cpuid {
>  	uint64_t reserved : 15;
>  };
>  
> +static inline int tprot(unsigned long addr)
> +{
> +	int cc;
> +
> +	asm volatile(
> +		"	tprot	%1,0\n"
> +		"	ipm	%0\n"
> +		"	srl	%0,28\n"
> +		: "=d" (cc) : "Q" (addr) : "cc");
> +	return cc;
> +}
> +
>  #endif
> diff --git a/lib/s390x/io.c b/lib/s390x/io.c
> index 3121a78..eb4d171 100644
> --- a/lib/s390x/io.c
> +++ b/lib/s390x/io.c
> @@ -43,6 +43,7 @@ void setup()
>  	setup_args_progname(ipl_args);
>  	setup_facilities();
>  	sclp_ascii_setup();
> +	sclp_memory_setup();
>  }
>  
>  void exit(int code)
> diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
> new file mode 100644
> index 0000000..ee56820
> --- /dev/null
> +++ b/lib/s390x/sclp.c
> @@ -0,0 +1,52 @@
> +/*
> + * s390x SCLP driver
> + *
> + * Copyright (c) 2017 Red Hat Inc
> + *
> + * Authors:
> + *  David Hildenbrand <david@xxxxxxxxxx>
> + *
> + * This code is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Library General Public License version 2.
> + */
> +
> +#include <libcflat.h>
> +#include <asm/page.h>
> +#include <asm/arch_def.h>
> +#include "sclp.h"
> +
> +static char _sccb[PAGE_SIZE] __attribute__((__aligned__(4096)));

Could we maybe re-use the sccb buffer from sclp-write.c ?

Maybe it would also make sense to merge sclp-write.c with sclp.c ?

 Thomas




[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