qemu-s390x
[Top][All Lists]
Advanced

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

Re: [qemu-s390x] [PATCH v1 1/2] s390x/kvm: legacy_s390_alloc() only supp


From: Christian Borntraeger
Subject: Re: [qemu-s390x] [PATCH v1 1/2] s390x/kvm: legacy_s390_alloc() only supports one allocation
Date: Thu, 28 Jun 2018 14:42:42 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0


On 06/28/2018 01:38 PM, David Hildenbrand wrote:
> We always allocate at a fixed address, a second allocation can therefore
> of course never work. We would simply overwrite mappings.
> 
> This can e.g. happen in s390_memory_init(), if trying to allocate more
> than > 8TB. Let's just bail out, as there is no need for supporting it
> (legacy handling for z/VM).
> 
> Signed-off-by: David Hildenbrand <address@hidden>

Reviewed-by: Christian Borntraeger <address@hidden>

> ---
>  target/s390x/kvm.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
> index ac370da281..bbac3454e3 100644
> --- a/target/s390x/kvm.c
> +++ b/target/s390x/kvm.c
> @@ -752,12 +752,20 @@ int kvm_s390_mem_op(S390CPU *cpu, vaddr addr, uint8_t 
> ar, void *hostbuf,
>   */
>  static void *legacy_s390_alloc(size_t size, uint64_t *align, bool shared)
>  {
> -    void *mem;
> +    static void *mem;
> +
> +    if (mem) {
> +        /* we only support one allocation, which is enough for initial ram */
> +        return NULL;
> +    }
>  
>      mem = mmap((void *) 0x800000000ULL, size,
>                 PROT_EXEC|PROT_READ|PROT_WRITE,
>                 MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
> -    return mem == MAP_FAILED ? NULL : mem;
> +    if (mem == MAP_FAILED) {
> +        mem = NULL;
> +    }
> +    return mem;
>  }
>  
>  static uint8_t const *sw_bp_inst;
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]