From patchwork Thu Jul 5 11:59:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 939896 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; 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 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41LxJQ4lzpz9s2g for ; Thu, 5 Jul 2018 22:00:38 +1000 (AEST) Received: from localhost ([::1]:52007 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fb2w8-0000j1-5E for incoming@patchwork.ozlabs.org; Thu, 05 Jul 2018 08:00:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fb2vO-0000gw-Js for qemu-devel@nongnu.org; Thu, 05 Jul 2018 07:59:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fb2vK-0002HJ-NY for qemu-devel@nongnu.org; Thu, 05 Jul 2018 07:59:50 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34164 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fb2vK-0002Fe-JD for qemu-devel@nongnu.org; Thu, 05 Jul 2018 07:59:46 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 13FB7401EF02 for ; Thu, 5 Jul 2018 11:59:46 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-172.ams2.redhat.com [10.36.116.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 644BA2026D74; Thu, 5 Jul 2018 11:59:44 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 5 Jul 2018 13:59:32 +0200 Message-Id: <20180705115943.29402-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 05 Jul 2018 11:59:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 05 Jul 2018 11:59:46 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'david@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v1 00/11] memory-device: complete refactoring X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S . Tsirkin" , David Hildenbrand , Markus Armbruster , Stefan Hajnoczi , Igor Mammedov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This is another part of the original series [PATCH v4 00/14] MemoryDevice: use multi stage hotplug handlers And is based on [PATCH v3 0/4] pc-dimm: pre_plug "slot" and "addr" assignment This series completes refactoring of pre_plug, plug and unplug logic of memory devices. With this as a basis, one can easily have e.g. virtio based memory devices (virtio-mem, virtio-pmem, virtio-fs?) with minor modifications on e.g. x86 and s390x. Unfortunately, the "addr" property is already used for virtio devices, so we will have to deal with device specific properties. So set_addr() for memory devices is introduced to handle that (we already have get_addr()). The only way I see to avoid that would be for virtio based devices to introduce an indirection: E.g. right now for my virtio-mem prototype: ... -object memory-backend-ram,id=mem0,size=8G \ -device virtio-mem-pci,id=vm0,memdev=mem0,node=0,phys-addr=0x12345 To something like: ... -object memory-backend-ram,id=mem0,size=8G \ -object virtio-mem-backend,id=vmb0,memdev=mem0,addr=0x12345 \ -device virtio-mem-pci,id=vm0,vmem=vmb0 \ Or something like (that might be interesting for virtio-pmem): ... -device virtio-mem-pci \ /* a virtio-mem bus */ -object memory-backend-ram,id=mem0,size=8G \ -device virtio-mem-backend,memdev=mem0,addr=0x12345 \ But both alternatives have their pros and cons. Opinions? David Hildenbrand (11): memory-device: fix error message when hinted address is too small memory-device: introduce separate config option memory-device: get_region_size()/get_plugged_size() might fail memory-device: convert get_region_size() to get_memory_region() memory-device: document MemoryDeviceClass memory-device: add device class function set_addr() pc-dimm: implement memory device class function set_addr() memory-device: complete factoring out pre_plug handling memory-device: complete factoring out plug handling memory-device: complete factoring out unplug handling memory-device: trace when pre_assigning/assigning/unassigning addresses default-configs/i386-softmmu.mak | 3 +- default-configs/ppc64-softmmu.mak | 3 +- default-configs/x86_64-softmmu.mak | 3 +- hw/Makefile.objs | 2 +- hw/mem/Makefile.objs | 4 +- hw/mem/memory-device.c | 60 +++++++++++++++++++----- hw/mem/pc-dimm.c | 75 +++++++++++++++++------------- hw/mem/trace-events | 5 +- include/hw/mem/memory-device.h | 30 ++++++++---- qapi/misc.json | 2 +- 10 files changed, 126 insertions(+), 61 deletions(-)