From nobody Mon Feb 9 21:12:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1629382856; cv=none; d=zohomail.com; s=zohoarc; b=hpfgDLlkkhZTlPIt1ZCCIrOjl8y+x8cL/SrzFzSyky3ocLBwp2QfS6WaF+cjB9t3IDciUuNvxcS8y/y0RemaZlV8f4opfU39opCoE/Dki0PsncLvK/87B2NjYGQ3Treup3bwF6SmSLIK4VzgBf3Dwgqe6XJ+VDwyVEv+o4vYO7M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629382856; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=S5J953m8jthIx8YKw7RXWxnSJEtO9PzEi6CmU+gZmWk=; b=bdyuYc28ZKlh0OM6bC9aDLRpHtncsf7ymQHljCQYavPySjT+VsjivdcjnnQdolXzfOVclxiVsUL+kD1F+G6SniXhpCneVWoM9swj0sSs6phScgMWfaP8UBcfv2GZ+adM/IY9gfCSgyFDGe1HtpzEAUTTa7CYA194+BSuxi/9FSk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1629382856083838.5602177158132; Thu, 19 Aug 2021 07:20:56 -0700 (PDT) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-468-4Qo4jEhBNFaD_4wkuwSOBA-1; Thu, 19 Aug 2021 10:20:51 -0400 Received: by mail-wm1-f69.google.com with SMTP id m13-20020a7bcf2d000000b002e6cd9941a9so3558010wmg.1 for ; Thu, 19 Aug 2021 07:20:51 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (163.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.163]) by smtp.gmail.com with ESMTPSA id n10sm2984641wrw.76.2021.08.19.07.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 07:20:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629382855; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S5J953m8jthIx8YKw7RXWxnSJEtO9PzEi6CmU+gZmWk=; b=B2nXs2/wnXkL8ocPPSKkwFP/eU0ogdX7ruMTgb/Sk6bpVNgY7sgo8ymDtst7DXBGI2FfdU p0LcqK4bcbteHVwZIuyTAVIYgweoXmaw0MZuBGiZHoWlFAdZHLImpyJifSPA7JgCvKRSRE GgddaWTs6+D2fxmWGRH8KIYaA91HjO8= X-MC-Unique: 4Qo4jEhBNFaD_4wkuwSOBA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S5J953m8jthIx8YKw7RXWxnSJEtO9PzEi6CmU+gZmWk=; b=d50vJx4Y6KxzqBNdEr4tnTUt+UfKMMzIZgaoys2Kgfzt7a68P9PEnv4NAEG3uE1Wqt Kj/r8q6mXz01kR9k/uHt3jMxRoc3UK5wpv+SpYoF7gTPhYM+CuJOhcB76FvFvDerY1OP QLj8a14g1apDQxfORLXSUPl8qnhyGg+zN/M/JwfEo5Z6bTMgv3xU/lxoVKYOAUD1SYTv ttHFWcvJUla2RXGxhxwrzSxsfPW06pEZGrdRd1RhT/K6SAE9AetVIIVrhgwG1v+ScnDP RWi6BJy+G+z9M609dzRWSOG0iAdr90m35MlbV9m3Ie7TN/VtBE0yKlPcDk5GfxmgSS3/ mGhQ== X-Gm-Message-State: AOAM533AHRDIRXPRE1HXRu2rsQjNUSiP4wG1h6Fjd5Blb38AlJBPsZRz 9Tyy0T875GZQBwL1KlCZ3CrIkl7cAiJYf8MZIUcLTh20SpTKn7GkYBBMHnJLAXB9QJvzVQZf12o GzPUC6D4I6zZBow== X-Received: by 2002:a7b:cc16:: with SMTP id f22mr13857452wmh.99.1629382850592; Thu, 19 Aug 2021 07:20:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwljsaK8xTKC3ZxT9A69p0K+bI18Pkfe97AyeppN9b9VIrWOghxSBpZCtS3dKIT74BP9VJCnA== X-Received: by 2002:a7b:cc16:: with SMTP id f22mr13857427wmh.99.1629382850326; Thu, 19 Aug 2021 07:20:50 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Paolo Bonzini , Peter Xu , Gerd Hoffmann , "Edgar E. Iglesias" , Alistair Francis , Jianxian Wen , Mark Cave-Ayland , qemu-arm@nongnu.org, David Hildenbrand , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 2/6] memory: Introduce address_space_create() Date: Thu, 19 Aug 2021 16:20:35 +0200 Message-Id: <20210819142039.2825366-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210819142039.2825366-1-philmd@redhat.com> References: <20210819142039.2825366-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1629382857026100001 Introduce address_space_create(). In is similar to address_space_init() but returns a pointer to a heap allocated AddressSpace. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/memory.h | 14 ++++++++++++++ softmmu/memory.c | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index c3d417d317f..b353a48c25f 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -2418,6 +2418,20 @@ MemTxResult memory_region_dispatch_write(MemoryRegio= n *mr, */ void address_space_init(AddressSpace *as, MemoryRegion *root, const char *= name); =20 +/** + * address_space_create: Create and initializes an address space + * + * @root: a #MemoryRegion that routes addresses for the address space + * @name: an address space name. The name is only used for debugging + * output. + * + * Returns pointer to initialized #AddressSpace. + * + * The caller is responsible for releasing the pointer returned + * with address_space_destroy() after use. + */ +AddressSpace *address_space_create(MemoryRegion *root, const char *name); + /** * address_space_destroy: destroy an address space * diff --git a/softmmu/memory.c b/softmmu/memory.c index 185f978c925..16a2b518d8d 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -2937,6 +2937,16 @@ void address_space_init(AddressSpace *as, MemoryRegi= on *root, const char *name) address_space_update_ioeventfds(as); } =20 +AddressSpace *address_space_create(MemoryRegion *root, const char *name) +{ + AddressSpace *as; + + as =3D g_new(AddressSpace, 1); + address_space_init(as, root, name); + + return as; +} + static void do_address_space_destroy(AddressSpace *as) { assert(QTAILQ_EMPTY(&as->listeners)); --=20 2.31.1