Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/814154/?format=api
{ "id": 814154, "url": "http://patchwork.ozlabs.org/api/patches/814154/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170915084030.40988-13-aik@ozlabs.ru/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170915084030.40988-13-aik@ozlabs.ru>", "list_archive_url": null, "date": "2017-09-15T08:40:29", "name": "[qemu,v2,12/13] memory: Get rid of address_space_init_shareable", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "4c1e015541f6e694f653b03c1014d863f52a71eb", "submitter": { "id": 7621, "url": "http://patchwork.ozlabs.org/api/people/7621/?format=api", "name": "Alexey Kardashevskiy", "email": "aik@ozlabs.ru" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170915084030.40988-13-aik@ozlabs.ru/mbox/", "series": [ { "id": 3250, "url": "http://patchwork.ozlabs.org/api/series/3250/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3250", "date": "2017-09-15T08:40:21", "name": "memory: Reduce memory use", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/3250/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/814154/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814154/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtpsg6bv4z9sPr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 18:46:31 +1000 (AEST)", "from localhost ([::1]:51975 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsmGb-0004Ch-Sn\n\tfor incoming@patchwork.ozlabs.org; Fri, 15 Sep 2017 04:46:29 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:38268)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <aik@ozlabs.ru>) id 1dsmB9-00071d-On\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 04:40:53 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <aik@ozlabs.ru>) id 1dsmB7-0002Yr-DQ\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 04:40:51 -0400", "from ozlabs.ru ([107.173.13.209]:44668)\n\tby eggs.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <aik@ozlabs.ru>) id 1dsmB7-0002Ql-4J\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 04:40:49 -0400", "from vpl1.ozlabs.ibm.com (localhost [IPv6:::1])\n\tby ozlabs.ru (Postfix) with ESMTP id 913133A60065;\n\tFri, 15 Sep 2017 04:42:02 -0400 (EDT)" ], "From": "Alexey Kardashevskiy <aik@ozlabs.ru>", "To": "qemu-devel@nongnu.org", "Date": "Fri, 15 Sep 2017 18:40:29 +1000", "Message-Id": "<20170915084030.40988-13-aik@ozlabs.ru>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": "<20170915084030.40988-1-aik@ozlabs.ru>", "References": "<20170915084030.40988-1-aik@ozlabs.ru>", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 3.x [fuzzy]", "X-Received-From": "107.173.13.209", "Subject": "[Qemu-devel] [PATCH qemu v2 12/13] memory: Get rid of\n\taddress_space_init_shareable", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "Alexey Kardashevskiy <aik@ozlabs.ru>, Paolo Bonzini <pbonzini@redhat.com>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "Since FlatViews are shared now and ASes not, this gets rid of\naddress_space_init_shareable().\n\nSigned-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>\n---\n\nSquash to the previous one? It is a separate patch to make review easier,\nmostly.\n---\n include/exec/memory.h | 17 -----------------\n include/hw/arm/armv7m.h | 2 +-\n cpus.c | 5 +++--\n hw/arm/armv7m.c | 9 ++++-----\n memory.c | 10 ----------\n target/arm/cpu.c | 16 ++++++++--------\n target/i386/cpu.c | 5 +++--\n 7 files changed, 19 insertions(+), 45 deletions(-)", "diff": "diff --git a/include/exec/memory.h b/include/exec/memory.h\nindex 04993f8eca..a550dc21e5 100644\n--- a/include/exec/memory.h\n+++ b/include/exec/memory.h\n@@ -1584,23 +1584,6 @@ MemTxResult memory_region_dispatch_write(MemoryRegion *mr,\n void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name);\n \n /**\n- * address_space_init_shareable: return an address space for a memory region,\n- * creating it if it does not already exist\n- *\n- * @root: a #MemoryRegion that routes addresses for the address space\n- * @name: an address space name. The name is only used for debugging\n- * output.\n- *\n- * This function will return a pointer to an existing AddressSpace\n- * which was initialized with the specified MemoryRegion, or it will\n- * create and initialize one if it does not already exist. The ASes\n- * are reference-counted, so the memory will be freed automatically\n- * when the AddressSpace is destroyed via address_space_destroy.\n- */\n-AddressSpace *address_space_init_shareable(MemoryRegion *root,\n- const char *name);\n-\n-/**\n * address_space_destroy: destroy an address space\n *\n * Releases all resources associated with an address space. After an address space\ndiff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h\nindex 10eb058027..008000fe11 100644\n--- a/include/hw/arm/armv7m.h\n+++ b/include/hw/arm/armv7m.h\n@@ -21,7 +21,7 @@ typedef struct {\n SysBusDevice parent_obj;\n /*< public >*/\n \n- AddressSpace *source_as;\n+ AddressSpace source_as;\n MemoryRegion iomem;\n uint32_t base;\n MemoryRegion *source_memory;\ndiff --git a/cpus.c b/cpus.c\nindex 9bed61eefc..c9a624003a 100644\n--- a/cpus.c\n+++ b/cpus.c\n@@ -1764,8 +1764,9 @@ void qemu_init_vcpu(CPUState *cpu)\n /* If the target cpu hasn't set up any address spaces itself,\n * give it the default one.\n */\n- AddressSpace *as = address_space_init_shareable(cpu->memory,\n- \"cpu-memory\");\n+ AddressSpace *as = g_new0(AddressSpace, 1);\n+\n+ address_space_init(as, cpu->memory, \"cpu-memory\");\n cpu->num_ases = 1;\n cpu_address_space_init(cpu, as, 0);\n }\ndiff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c\nindex b64a409b40..4900339646 100644\n--- a/hw/arm/armv7m.c\n+++ b/hw/arm/armv7m.c\n@@ -41,7 +41,7 @@ static MemTxResult bitband_read(void *opaque, hwaddr offset,\n \n /* Find address in underlying memory and round down to multiple of size */\n addr = bitband_addr(s, offset) & (-size);\n- res = address_space_read(s->source_as, addr, attrs, buf, size);\n+ res = address_space_read(&s->source_as, addr, attrs, buf, size);\n if (res) {\n return res;\n }\n@@ -66,7 +66,7 @@ static MemTxResult bitband_write(void *opaque, hwaddr offset, uint64_t value,\n \n /* Find address in underlying memory and round down to multiple of size */\n addr = bitband_addr(s, offset) & (-size);\n- res = address_space_read(s->source_as, addr, attrs, buf, size);\n+ res = address_space_read(&s->source_as, addr, attrs, buf, size);\n if (res) {\n return res;\n }\n@@ -79,7 +79,7 @@ static MemTxResult bitband_write(void *opaque, hwaddr offset, uint64_t value,\n } else {\n buf[bitpos >> 3] &= ~bit;\n }\n- return address_space_write(s->source_as, addr, attrs, buf, size);\n+ return address_space_write(&s->source_as, addr, attrs, buf, size);\n }\n \n static const MemoryRegionOps bitband_ops = {\n@@ -111,8 +111,7 @@ static void bitband_realize(DeviceState *dev, Error **errp)\n return;\n }\n \n- s->source_as = address_space_init_shareable(s->source_memory,\n- \"bitband-source\");\n+ address_space_init(&s->source_as, s->source_memory, \"bitband-source\");\n }\n \n /* Board init. */\ndiff --git a/memory.c b/memory.c\nindex f3da9379df..06052e63a0 100644\n--- a/memory.c\n+++ b/memory.c\n@@ -2793,16 +2793,6 @@ static void do_address_space_destroy(AddressSpace *as)\n g_free(as);\n }\n \n-AddressSpace *address_space_init_shareable(MemoryRegion *root, const char *name)\n-{\n- AddressSpace *as;\n-\n- as = g_malloc0(sizeof *as);\n- address_space_init(as, root, name);\n-\n- return as;\n-}\n-\n void address_space_destroy(AddressSpace *as)\n {\n /* Flush out anything from MemoryListeners listening in on this */\ndiff --git a/target/arm/cpu.c b/target/arm/cpu.c\nindex a1acce3c7a..8874763b4b 100644\n--- a/target/arm/cpu.c\n+++ b/target/arm/cpu.c\n@@ -678,6 +678,9 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)\n CPUARMState *env = &cpu->env;\n int pagebits;\n Error *local_err = NULL;\n+#ifndef CONFIG_USER_ONLY\n+ AddressSpace *as;\n+#endif\n \n cpu_exec_realizefn(cs, &local_err);\n if (local_err != NULL) {\n@@ -868,24 +871,21 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)\n \n #ifndef CONFIG_USER_ONLY\n if (cpu->has_el3 || arm_feature(env, ARM_FEATURE_M_SECURITY)) {\n- AddressSpace *as;\n+ as = g_new0(AddressSpace, 1);\n \n cs->num_ases = 2;\n \n if (!cpu->secure_memory) {\n cpu->secure_memory = cs->memory;\n }\n- as = address_space_init_shareable(cpu->secure_memory,\n- \"cpu-secure-memory\");\n+ address_space_init(as, cpu->secure_memory, \"cpu-secure-memory\");\n cpu_address_space_init(cs, as, ARMASIdx_S);\n } else {\n cs->num_ases = 1;\n }\n-\n- cpu_address_space_init(cs,\n- address_space_init_shareable(cs->memory,\n- \"cpu-memory\"),\n- ARMASIdx_NS);\n+ as = g_new0(AddressSpace, 1);\n+ address_space_init(as, cs->memory, \"cpu-memory\");\n+ cpu_address_space_init(cs, as, ARMASIdx_NS);\n #endif\n \n qemu_init_vcpu(cs);\ndiff --git a/target/i386/cpu.c b/target/i386/cpu.c\nindex 69676e13e1..11178300ee 100644\n--- a/target/i386/cpu.c\n+++ b/target/i386/cpu.c\n@@ -3741,10 +3741,11 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)\n \n #ifndef CONFIG_USER_ONLY\n if (tcg_enabled()) {\n- AddressSpace *as_normal = address_space_init_shareable(cs->memory,\n- \"cpu-memory\");\n+ AddressSpace *as_normal = g_new0(AddressSpace, 1);\n AddressSpace *as_smm = g_new(AddressSpace, 1);\n \n+ address_space_init(as_normal, cs->memory, \"cpu-memory\");\n+\n cpu->cpu_as_mem = g_new(MemoryRegion, 1);\n cpu->cpu_as_root = g_new(MemoryRegion, 1);\n \n", "prefixes": [ "qemu", "v2", "12/13" ] }