From patchwork Fri Jul 24 09:55:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Fedin X-Patchwork-Id: 499645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 14D08140A98 for ; Fri, 24 Jul 2015 19:57:37 +1000 (AEST) Received: from localhost ([::1]:44290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIZjT-0000ur-0N for incoming@patchwork.ozlabs.org; Fri, 24 Jul 2015 05:57:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIZi0-0006T8-5D for qemu-devel@nongnu.org; Fri, 24 Jul 2015 05:56:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIZhw-0004uH-6M for qemu-devel@nongnu.org; Fri, 24 Jul 2015 05:56:04 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:32948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIZhw-0004u3-0X for qemu-devel@nongnu.org; Fri, 24 Jul 2015 05:56:00 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NRZ00J9BKX7FK90@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 24 Jul 2015 10:55:55 +0100 (BST) X-AuditID: cbfec7f4-f79c56d0000012ee-9c-55b20baba173 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id EF.3D.04846.BAB02B55; Fri, 24 Jul 2015 10:55:55 +0100 (BST) Received: from fedinw7x64.rnd.samsung.ru ([106.109.131.169]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NRZ007OMKX15F50@eusync3.samsung.com>; Fri, 24 Jul 2015 10:55:55 +0100 (BST) From: Pavel Fedin To: qemu-devel@nongnu.org Date: Fri, 24 Jul 2015 12:55:43 +0300 Message-id: <39d09477cf12da90b37ea7cf871e37ce27d019a8.1437731107.git.p.fedin@samsung.com> X-Mailer: git-send-email 2.4.4 In-reply-to: References: In-reply-to: References: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMLMWRmVeSWpSXmKPExsVy+t/xq7qruTeFGkxfLWLx4vU/Rov5W86w Wsw584DF4njvDhaLts/f2S3uvv7M4sDmsXPWXXaPliNvWT3uXNvD5vHk2mamAJYoLpuU1JzM stQifbsErowpmw4xF8yQrOh6GtfAOF2oi5GTQ0LAROLdiaeMELaYxIV769m6GLk4hASWMkq8 eHKMHcJpY5LYs28RE0gVm4C6xOmvH1hAbBEBSYnfXaeZQYqYBR4xSlxrO8cMkhAWiJXYvWUB G4jNIqAqsXXrZrBmXoFoiV3da5kg1slJXLk+HayGU8Bc4sGJvWBDhQTMJBY/3seES3wCI/8C RoZVjKKppckFxUnpuYZ6xYm5xaV56XrJ+bmbGCFB92UH4+JjVocYBTgYlXh4D0zaGCrEmlhW XJl7iFGCg1lJhJfhGFCINyWxsiq1KD++qDQntfgQozQHi5I479xd70OEBNITS1KzU1MLUotg skwcnFINjBGr2vyXrOQtXdFhd+SkhFLDjJ2O12fpSTUvz0gT+ei3rUMpS4z5Q7Be5ltNwUda hxKMFyQfnMy8fU9Y7FXXkC95ppJlkopCa+99qTxmWBQWeNAudu4Uu78C/utlJkn867lw7Ia9 ytfb31Xsm+14Xoj98Pv4Y6vJ5jU1C975ygcrN6hZ3V3KocRSnJFoqMVcVJwIACvSTSY2AgAA X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 210.118.77.14 Cc: Peter Maydell , Shlomo Pongratz , Shlomo Pongratz , Christoffer Dall , Eric Auger Subject: [Qemu-devel] [PATCH v7 1/6] Merge memory_region_init_reservation() into memory_region_init_io() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Just speficying ops = NULL in some cases can be more convenient than having two functions. GICv3 code is going to use this. GICv2 code can be refactored in a similar way, killing some code duplication. Signed-off-by: Pavel Fedin Acked-by: Paolo Bonzini --- include/exec/memory.h | 14 +++++++++++--- memory.c | 10 +--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 1394715..3b5e44e 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -436,6 +436,9 @@ void memory_region_init_alias(MemoryRegion *mr, * memory_region_init_rom_device: Initialize a ROM memory region. Writes are * handled via callbacks. * + * If NULL callbacks pointer is given, then I/O space is not supposed to be + * handled by QEMU itself. Any access via the memory API will cause an abort(). + * * @mr: the #MemoryRegion to be initialized. * @owner: the object that tracks the region's reference count * @ops: callbacks for write access handling. @@ -458,16 +461,21 @@ void memory_region_init_rom_device(MemoryRegion *mr, * A reservation region primariy serves debugging purposes. It claims I/O * space that is not supposed to be handled by QEMU itself. Any access via * the memory API will cause an abort(). + * This function is deprecated. Use memory_region_init_io() with NULL + * callbacks instead. * * @mr: the #MemoryRegion to be initialized * @owner: the object that tracks the region's reference count * @name: used for debugging; not visible to the user or ABI * @size: size of the region. */ -void memory_region_init_reservation(MemoryRegion *mr, - struct Object *owner, +static inline void memory_region_init_reservation(MemoryRegion *mr, + Object *owner, const char *name, - uint64_t size); + uint64_t size) +{ + memory_region_init_io(mr, owner, NULL, mr, name, size); +} /** * memory_region_init_iommu: Initialize a memory region that translates diff --git a/memory.c b/memory.c index 0acebb1..b843952 100644 --- a/memory.c +++ b/memory.c @@ -1187,7 +1187,7 @@ void memory_region_init_io(MemoryRegion *mr, uint64_t size) { memory_region_init(mr, owner, name, size); - mr->ops = ops; + mr->ops = ops ? ops : &unassigned_mem_ops; mr->opaque = opaque; mr->terminates = true; } @@ -1307,14 +1307,6 @@ void memory_region_init_iommu(MemoryRegion *mr, notifier_list_init(&mr->iommu_notify); } -void memory_region_init_reservation(MemoryRegion *mr, - Object *owner, - const char *name, - uint64_t size) -{ - memory_region_init_io(mr, owner, &unassigned_mem_ops, mr, name, size); -} - static void memory_region_finalize(Object *obj) { MemoryRegion *mr = MEMORY_REGION(obj);