Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/814715/?format=api
{ "id": 814715, "url": "http://patchwork.ozlabs.org/api/patches/814715/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170917232010.14183-6-f4bug@amsat.org/", "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": "<20170917232010.14183-6-f4bug@amsat.org>", "list_archive_url": null, "date": "2017-09-17T23:20:09", "name": "[v3,5/6] mips: MIPSCPU model subclasses", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "7bd3f63f6653677ab5c62fafd9d2f5f15c75692d", "submitter": { "id": 70924, "url": "http://patchwork.ozlabs.org/api/people/70924/?format=api", "name": "Philippe Mathieu-Daudé", "email": "f4bug@amsat.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170917232010.14183-6-f4bug@amsat.org/mbox/", "series": [ { "id": 3548, "url": "http://patchwork.ozlabs.org/api/series/3548/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3548", "date": "2017-09-17T23:20:04", "name": "QOMify MIPS cpu", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/3548/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/814715/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814715/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>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"I2jIr8VO\"; dkim-atps=neutral" ], "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 3xwQGs6m2kz9s7G\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 09:25:25 +1000 (AEST)", "from localhost ([::1]:33977 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 1dtiwG-0006fA-31\n\tfor incoming@patchwork.ozlabs.org; Sun, 17 Sep 2017 19:25:24 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:42722)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dtirr-0003VK-0I\n\tfor qemu-devel@nongnu.org; Sun, 17 Sep 2017 19:20:56 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dtirl-0007cS-WA\n\tfor qemu-devel@nongnu.org; Sun, 17 Sep 2017 19:20:51 -0400", "from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:34877)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dtirl-0007c4-M0\n\tfor qemu-devel@nongnu.org; Sun, 17 Sep 2017 19:20:45 -0400", "by mail-qt0-x243.google.com with SMTP id l25so4700028qtf.2\n\tfor <qemu-devel@nongnu.org>; Sun, 17 Sep 2017 16:20:45 -0700 (PDT)", "from yoga.offpageads.com ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tz75sm4132114qkb.71.2017.09.17.16.20.41\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tSun, 17 Sep 2017 16:20:44 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=WH47DGzhGg/7MTs2UOJFelOD0aPeeRSfqCILGV5EQ3k=;\n\tb=I2jIr8VOplxvI/0a38NDY0nPHRidnCHqELoj/UH5ecQgsjaapNzIrxXc7AktK1Iofn\n\tJBAucTM5vMsJY3I37fJRcFd8SEtyZePtSuk6M36WwTNMZ+7CVmNSQ8OJTKzfm6Mm6kbT\n\tF5ujH2Tyqg9vuwUZCzuepm/XxpWuNnYH3ABWPpXxsE1XpjQoDWu+sZCDFnFHQ37e64dn\n\tce7Yj9PblLHdkV0PkQtc5Hd3rkspwXzV3FnY66tEaBvio19oyxmirX8ysTfwUriiI0M3\n\tzFk/QkY8mCQhy9xnYMNHTppw2SqY3lzHCTUOeAlq9g9WVm68c8tEQcZBvdETEajTtIvS\n\tSjxA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references:mime-version:content-transfer-encoding;\n\tbh=WH47DGzhGg/7MTs2UOJFelOD0aPeeRSfqCILGV5EQ3k=;\n\tb=W+BK4Mdc1Vw2RadMMqpIxyQYUTGrg2Y66iTtL5Zf8+R/z0t216dvqNjQFH59gbU8AU\n\t08hdeHxbVSX/F+Un+6I2xMwVbFGpVxcEkdwImo0ghUXCMXQeEiHwWwG1euOS1F/1pxuE\n\tR3vSwKNhT2kBlntJBZvF1cYy8PjYDLieFGPMP8DJa43vm/tHBQbng4cdgDeEJHwqOL5N\n\tEbZvzd608525llxzvXfawX16rXLw6qkym3zvc+l1hgRSMUt3KYesn312tl72ceTxHP3w\n\tMK/qD8q7vSYCn2tbjcp2hvlUdtqbkRuAuOW3hi25A2nh+1Wf1ywXaY91KC41p4/1McPc\n\tRftw==", "X-Gm-Message-State": "AHPjjUiypZfRW9CX1kYwxPdccs1X7NCwUsaykfLffLtv09IVuQMs4jeQ\n\tCK8vLnHvMc2Scg==", "X-Google-Smtp-Source": "AOwi7QCJJ1bsTBNXopQjOuvTtxYAfP0u0oyBeOabVT5HQTUtfgCo+1/PeGpAgSM3OUqMFDgWmR+USg==", "X-Received": "by 10.200.42.244 with SMTP id c49mr6384584qta.46.1505690445207; \n\tSun, 17 Sep 2017 16:20:45 -0700 (PDT)", "From": "=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>", "To": "Igor Mammedov <imammedo@redhat.com>,\n\tEduardo Habkost <ehabkost@redhat.com>, \n\tAurelien Jarno <aurelien@aurel32.net>,\n\tYongbok Kim <yongbok.kim@imgtec.com>,\n\tMarcel Apfelbaum <marcel@redhat.com>", "Date": "Sun, 17 Sep 2017 20:20:09 -0300", "Message-Id": "<20170917232010.14183-6-f4bug@amsat.org>", "X-Mailer": "git-send-email 2.14.1", "In-Reply-To": "<20170917232010.14183-1-f4bug@amsat.org>", "References": "<20170917232010.14183-1-f4bug@amsat.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-detected-operating-system": "by eggs.gnu.org: Genre and OS details not\n\trecognized.", "X-Received-From": "2607:f8b0:400d:c0d::243", "Subject": "[Qemu-devel] [PATCH v3 5/6] mips: MIPSCPU model subclasses", "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": "Thomas Huth <thuth@redhat.com>, James Hogan <james.hogan@imgtec.com>,\n\t=?utf-8?q?Herv=C3=A9_Poussineau?= <hpoussin@reactos.org>,\n\tqemu-devel@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?=\n\t<f4bug@amsat.org>", "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": "From: Igor Mammedov <imammedo@redhat.com>\n\nRegister separate QOM types for each mips cpu model,\nso it would be possible to reuse generic CPU creation\nroutines.\n\nSigned-off-by: Igor Mammedov <imammedo@redhat.com>\nSigned-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n[PMD: use internal.h, use void* to hold cpu_def in MIPSCPUClass,\n mark MIPSCPU abstract, address Eduardo Habkost review]\nTested-by: James Hogan <james.hogan@imgtec.com>\nReviewed-by: Eduardo Habkost <ehabkost@redhat.com>\n---\n target/mips/cpu-qom.h | 1 +\n target/mips/internal.h | 59 ++++++++++++++++++++++++++++++++++++++++++++\n target/mips/cpu.c | 50 ++++++++++++++++++++++++++++++++++++-\n target/mips/translate.c | 13 +++++-----\n target/mips/translate_init.c | 58 ++-----------------------------------------\n 5 files changed, 117 insertions(+), 64 deletions(-)", "diff": "diff --git a/target/mips/cpu-qom.h b/target/mips/cpu-qom.h\nindex 3f5bf23823..ee58606afe 100644\n--- a/target/mips/cpu-qom.h\n+++ b/target/mips/cpu-qom.h\n@@ -49,6 +49,7 @@ typedef struct MIPSCPUClass {\n \n DeviceRealize parent_realize;\n void (*parent_reset)(CPUState *cpu);\n+ const struct mips_def_t *cpu_def;\n } MIPSCPUClass;\n \n typedef struct MIPSCPU MIPSCPU;\ndiff --git a/target/mips/internal.h b/target/mips/internal.h\nindex cf4c9db427..45ded3484c 100644\n--- a/target/mips/internal.h\n+++ b/target/mips/internal.h\n@@ -7,6 +7,65 @@\n #ifndef MIPS_INTERNAL_H\n #define MIPS_INTERNAL_H\n \n+\n+/* MMU types, the first four entries have the same layout as the\n+ CP0C0_MT field. */\n+enum mips_mmu_types {\n+ MMU_TYPE_NONE,\n+ MMU_TYPE_R4000,\n+ MMU_TYPE_RESERVED,\n+ MMU_TYPE_FMT,\n+ MMU_TYPE_R3000,\n+ MMU_TYPE_R6000,\n+ MMU_TYPE_R8000\n+};\n+\n+struct mips_def_t {\n+ const char *name;\n+ int32_t CP0_PRid;\n+ int32_t CP0_Config0;\n+ int32_t CP0_Config1;\n+ int32_t CP0_Config2;\n+ int32_t CP0_Config3;\n+ int32_t CP0_Config4;\n+ int32_t CP0_Config4_rw_bitmask;\n+ int32_t CP0_Config5;\n+ int32_t CP0_Config5_rw_bitmask;\n+ int32_t CP0_Config6;\n+ int32_t CP0_Config7;\n+ target_ulong CP0_LLAddr_rw_bitmask;\n+ int CP0_LLAddr_shift;\n+ int32_t SYNCI_Step;\n+ int32_t CCRes;\n+ int32_t CP0_Status_rw_bitmask;\n+ int32_t CP0_TCStatus_rw_bitmask;\n+ int32_t CP0_SRSCtl;\n+ int32_t CP1_fcr0;\n+ int32_t CP1_fcr31_rw_bitmask;\n+ int32_t CP1_fcr31;\n+ int32_t MSAIR;\n+ int32_t SEGBITS;\n+ int32_t PABITS;\n+ int32_t CP0_SRSConf0_rw_bitmask;\n+ int32_t CP0_SRSConf0;\n+ int32_t CP0_SRSConf1_rw_bitmask;\n+ int32_t CP0_SRSConf1;\n+ int32_t CP0_SRSConf2_rw_bitmask;\n+ int32_t CP0_SRSConf2;\n+ int32_t CP0_SRSConf3_rw_bitmask;\n+ int32_t CP0_SRSConf3;\n+ int32_t CP0_SRSConf4_rw_bitmask;\n+ int32_t CP0_SRSConf4;\n+ int32_t CP0_PageGrain_rw_bitmask;\n+ int32_t CP0_PageGrain;\n+ target_ulong CP0_EBaseWG_rw_bitmask;\n+ int insn_flags;\n+ enum mips_mmu_types mmu_type;\n+};\n+\n+extern const struct mips_def_t mips_defs[];\n+extern const int mips_defs_number;\n+\n enum CPUMIPSMSADataFormat {\n DF_BYTE = 0,\n DF_HALF,\ndiff --git a/target/mips/cpu.c b/target/mips/cpu.c\nindex e3ef835599..1a9a3ed94d 100644\n--- a/target/mips/cpu.c\n+++ b/target/mips/cpu.c\n@@ -146,14 +146,36 @@ static void mips_cpu_initfn(Object *obj)\n CPUState *cs = CPU(obj);\n MIPSCPU *cpu = MIPS_CPU(obj);\n CPUMIPSState *env = &cpu->env;\n+ MIPSCPUClass *mcc = MIPS_CPU_GET_CLASS(obj);\n \n cs->env_ptr = env;\n+ env->cpu_model = mcc->cpu_def;\n \n if (tcg_enabled()) {\n mips_tcg_init();\n }\n }\n \n+static char *mips_cpu_type_name(const char *cpu_model)\n+{\n+ return g_strdup_printf(\"%s-\" TYPE_MIPS_CPU, cpu_model);\n+}\n+\n+static ObjectClass *mips_cpu_class_by_name(const char *cpu_model)\n+{\n+ ObjectClass *oc;\n+ char *typename;\n+\n+ if (cpu_model == NULL) {\n+ return NULL;\n+ }\n+\n+ typename = mips_cpu_type_name(cpu_model);\n+ oc = object_class_by_name(typename);\n+ g_free(typename);\n+ return oc;\n+}\n+\n static void mips_cpu_class_init(ObjectClass *c, void *data)\n {\n MIPSCPUClass *mcc = MIPS_CPU_CLASS(c);\n@@ -166,6 +188,7 @@ static void mips_cpu_class_init(ObjectClass *c, void *data)\n mcc->parent_reset = cc->reset;\n cc->reset = mips_cpu_reset;\n \n+ cc->class_by_name = mips_cpu_class_by_name;\n cc->has_work = mips_cpu_has_work;\n cc->do_interrupt = mips_cpu_do_interrupt;\n cc->cpu_exec_interrupt = mips_cpu_exec_interrupt;\n@@ -193,14 +216,39 @@ static const TypeInfo mips_cpu_type_info = {\n .parent = TYPE_CPU,\n .instance_size = sizeof(MIPSCPU),\n .instance_init = mips_cpu_initfn,\n- .abstract = false,\n+ .abstract = true,\n .class_size = sizeof(MIPSCPUClass),\n .class_init = mips_cpu_class_init,\n };\n \n+static void mips_cpu_cpudef_class_init(ObjectClass *oc, void *data)\n+{\n+ MIPSCPUClass *mcc = MIPS_CPU_CLASS(oc);\n+ mcc->cpu_def = data;\n+}\n+\n+static void mips_register_cpudef_type(const struct mips_def_t *def)\n+{\n+ char *typename = mips_cpu_type_name(def->name);\n+ TypeInfo ti = {\n+ .name = typename,\n+ .parent = TYPE_MIPS_CPU,\n+ .class_init = mips_cpu_cpudef_class_init,\n+ .class_data = (void *)def,\n+ };\n+\n+ type_register(&ti);\n+ g_free(typename);\n+}\n+\n static void mips_cpu_register_types(void)\n {\n+ int i;\n+\n type_register_static(&mips_cpu_type_info);\n+ for (i = 0; i < mips_defs_number; i++) {\n+ mips_register_cpudef_type(&mips_defs[i]);\n+ }\n }\n \n type_init(mips_cpu_register_types)\ndiff --git a/target/mips/translate.c b/target/mips/translate.c\nindex 94c38e8755..f7128bc91d 100644\n--- a/target/mips/translate.c\n+++ b/target/mips/translate.c\n@@ -20525,16 +20525,15 @@ void cpu_mips_realize_env(CPUMIPSState *env)\n \n MIPSCPU *cpu_mips_init(const char *cpu_model)\n {\n+ ObjectClass *oc;\n MIPSCPU *cpu;\n- CPUMIPSState *env;\n- const mips_def_t *def;\n \n- def = cpu_mips_find_by_name(cpu_model);\n- if (!def)\n+ oc = cpu_class_by_name(TYPE_MIPS_CPU, cpu_model);\n+ if (oc == NULL) {\n return NULL;\n- cpu = MIPS_CPU(object_new(TYPE_MIPS_CPU));\n- env = &cpu->env;\n- env->cpu_model = def;\n+ }\n+\n+ cpu = MIPS_CPU(object_new(object_class_get_name(oc)));\n \n object_property_set_bool(OBJECT(cpu), true, \"realized\", NULL);\n \ndiff --git a/target/mips/translate_init.c b/target/mips/translate_init.c\nindex 255d25bacd..8bbded46c4 100644\n--- a/target/mips/translate_init.c\n+++ b/target/mips/translate_init.c\n@@ -51,64 +51,9 @@\n #define MIPS_CONFIG5 \\\n ((0 << CP0C5_M))\n \n-/* MMU types, the first four entries have the same layout as the\n- CP0C0_MT field. */\n-enum mips_mmu_types {\n- MMU_TYPE_NONE,\n- MMU_TYPE_R4000,\n- MMU_TYPE_RESERVED,\n- MMU_TYPE_FMT,\n- MMU_TYPE_R3000,\n- MMU_TYPE_R6000,\n- MMU_TYPE_R8000\n-};\n-\n-struct mips_def_t {\n- const char *name;\n- int32_t CP0_PRid;\n- int32_t CP0_Config0;\n- int32_t CP0_Config1;\n- int32_t CP0_Config2;\n- int32_t CP0_Config3;\n- int32_t CP0_Config4;\n- int32_t CP0_Config4_rw_bitmask;\n- int32_t CP0_Config5;\n- int32_t CP0_Config5_rw_bitmask;\n- int32_t CP0_Config6;\n- int32_t CP0_Config7;\n- target_ulong CP0_LLAddr_rw_bitmask;\n- int CP0_LLAddr_shift;\n- int32_t SYNCI_Step;\n- int32_t CCRes;\n- int32_t CP0_Status_rw_bitmask;\n- int32_t CP0_TCStatus_rw_bitmask;\n- int32_t CP0_SRSCtl;\n- int32_t CP1_fcr0;\n- int32_t CP1_fcr31_rw_bitmask;\n- int32_t CP1_fcr31;\n- int32_t MSAIR;\n- int32_t SEGBITS;\n- int32_t PABITS;\n- int32_t CP0_SRSConf0_rw_bitmask;\n- int32_t CP0_SRSConf0;\n- int32_t CP0_SRSConf1_rw_bitmask;\n- int32_t CP0_SRSConf1;\n- int32_t CP0_SRSConf2_rw_bitmask;\n- int32_t CP0_SRSConf2;\n- int32_t CP0_SRSConf3_rw_bitmask;\n- int32_t CP0_SRSConf3;\n- int32_t CP0_SRSConf4_rw_bitmask;\n- int32_t CP0_SRSConf4;\n- int32_t CP0_PageGrain_rw_bitmask;\n- int32_t CP0_PageGrain;\n- target_ulong CP0_EBaseWG_rw_bitmask;\n- int insn_flags;\n- enum mips_mmu_types mmu_type;\n-};\n-\n /*****************************************************************************/\n /* MIPS CPU definitions */\n-static const mips_def_t mips_defs[] =\n+const mips_def_t mips_defs[] =\n {\n {\n .name = \"4Kc\",\n@@ -808,6 +753,7 @@ static const mips_def_t mips_defs[] =\n \n #endif\n };\n+const int mips_defs_number = ARRAY_SIZE(mips_defs);\n \n static const mips_def_t *cpu_mips_find_by_name (const char *name)\n {\n", "prefixes": [ "v3", "5/6" ] }