From patchwork Tue Feb 25 11:49:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1244086 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=vGetfByx; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48RdG94ScXz9sPk for ; Tue, 25 Feb 2020 23:16:49 +1100 (AEDT) Received: from localhost ([::1]:53906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Z8p-0001Pw-EV for incoming@patchwork.ozlabs.org; Tue, 25 Feb 2020 07:16:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49447) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Ykd-0000md-Dl for qemu-devel@nongnu.org; Tue, 25 Feb 2020 06:51:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6YkZ-00071S-Gq for qemu-devel@nongnu.org; Tue, 25 Feb 2020 06:51:47 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:38654) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j6YkZ-0006ul-9Z for qemu-devel@nongnu.org; Tue, 25 Feb 2020 06:51:43 -0500 Received: by mail-wm1-x332.google.com with SMTP id a9so2847316wmj.3 for ; Tue, 25 Feb 2020 03:51:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EF1xxDl20iyMhk1ftjp9b02tb0F6Nx8GjS3T9tHjvyw=; b=vGetfByxwgBaTrHblfZFuUYcGpdoyOdJUFxe0n8C6IrgIDpXQr4NC3Eel9rrNzV5+Z qfiC56z8sAPhlHo3NhnadunEizOpseZeHoRoMgobimnPAUHZjtR1FR7epEIEjWU9Tr+u kw1TahW6BWo8l7X0yxaGq+Y2qy2LcxgUe5EhoGZ5mSIHimeTe3NmSRHsCqxZc/Z0W3vS 32JnYZ7C9LpziwuUukohj0lsShYMtAb9c4VcYZhGnrJyx698VNTkyG6CLStBdABrHvLl rpN7E8JhVQ3Ub0zCnBGtooArLPwB4oKBDCzqz8IPS9BSj3BsmR9dnBbpUBwHWoKcU278 27aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=EF1xxDl20iyMhk1ftjp9b02tb0F6Nx8GjS3T9tHjvyw=; b=JnuEAqDoR1odG7FmjfVapNSOCHd3lgxigbJ2p4SojAKzD5Y6DJRzRP8KXczN8gpzhn qFPeCc8ikAMzZjv0dGAdvEyNZe4Zm6iJ4TtwtGPg2G2XJSpe5MI/2Nk78ggvvcj1fcAc LFvr0lHjLcEotqIZCN55Box9ECNrNvAtp6s9mUDvKSA1d4poY3iA6gMAzsk0B1KzJqtq Xl+k4r3ZnIGURL0ko5HDw7Th0vfDFSTkYNeUoszVcgS7fmiyQ9e7Id2MVa+4ns1EIDoy ZYtwkQbFV3DsK+iWhRPPs1YL0v6iLSnGkHmXCVi9Lprl56cQXIpaj1loxWI5G8cDmpVd UHGg== X-Gm-Message-State: APjAAAWnbAbOk0k2KWz8NGDms0kvkucHEbB6IhHZMLFgCfYVvmyQqTBl 5bb9/LlV5VI9HAe6usT8+PhpfEeO X-Google-Smtp-Source: APXvYqyrz7+e11O0/5bVoICh0a/UKA9qof4SlHhGZUTkx761cDcK7TZfq1TxIMhZCCvkW3DNpRxWHA== X-Received: by 2002:a7b:c109:: with SMTP id w9mr4830674wmi.14.1582631502111; Tue, 25 Feb 2020 03:51:42 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id b67sm3922326wmc.38.2020.02.25.03.51.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Feb 2020 03:51:41 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 038/136] s390x/s390-virtio-ccw: use memdev for RAM Date: Tue, 25 Feb 2020 12:49:28 +0100 Message-Id: <1582631466-13880-38-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582631466-13880-1-git-send-email-pbonzini@redhat.com> References: <1582631466-13880-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::332 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: David Hildenbrand Acked-by: Cornelia Huck Tested-by: Halil Pasic Acked-by: Halil Pasic Reviewed-by: Richard Henderson Message-Id: <20200219160953.13771-39-imammedo@redhat.com> --- hw/s390x/s390-virtio-ccw.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index e759eb5..a89cf4c 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -154,14 +154,12 @@ static void virtio_ccw_register_hcalls(void) virtio_ccw_hcall_early_printk); } -static void s390_memory_init(ram_addr_t mem_size) +static void s390_memory_init(MemoryRegion *ram) { MemoryRegion *sysmem = get_system_memory(); - MemoryRegion *ram = g_new(MemoryRegion, 1); Error *local_err = NULL; /* allocate RAM for core */ - memory_region_allocate_system_memory(ram, NULL, "s390.ram", mem_size); memory_region_add_subregion(sysmem, 0, ram); /* @@ -245,7 +243,7 @@ static void ccw_init(MachineState *machine) s390_sclp_init(); /* init memory + setup max page size. Required for the CPU model */ - s390_memory_init(machine->ram_size); + s390_memory_init(machine->ram); /* init CPUs (incl. CPU model) early so s390_has_feature() works */ s390_init_cpus(machine); @@ -471,6 +469,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) hc->plug = s390_machine_device_plug; hc->unplug_request = s390_machine_device_unplug_request; nc->nmi_monitor_handler = s390_nmi; + mc->default_ram_id = "s390.ram"; } static inline bool machine_get_aes_key_wrap(Object *obj, Error **errp)