Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/813108/?format=api
{ "id": 813108, "url": "http://patchwork.ozlabs.org/api/patches/813108/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/150525509384.11068.12660058285712851211.stgit@bahia.lan/", "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": "<150525509384.11068.12660058285712851211.stgit@bahia.lan>", "list_archive_url": null, "date": "2017-09-12T22:24:53", "name": "[v2,1/2] spapr: introduce common helper to write HPT address to KVM PR", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "b6350932e41dbd2f2d655d599677547ded69ee33", "submitter": { "id": 69178, "url": "http://patchwork.ozlabs.org/api/people/69178/?format=api", "name": "Greg Kurz", "email": "groug@kaod.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/150525509384.11068.12660058285712851211.stgit@bahia.lan/mbox/", "series": [ { "id": 2784, "url": "http://patchwork.ozlabs.org/api/series/2784/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2784", "date": "2017-09-12T22:24:44", "name": "spapr: fix migration with nested KVM PR", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/2784/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/813108/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/813108/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 3xsKBP0Svzz9t4X\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 08:25:49 +1000 (AEST)", "from localhost ([::1]:38986 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 1drtcp-0003G4-4Q\n\tfor incoming@patchwork.ozlabs.org; Tue, 12 Sep 2017 18:25:47 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:52157)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <groug@kaod.org>) id 1drtc6-000358-DF\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 18:25:08 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <groug@kaod.org>) id 1drtc1-0005ar-Sx\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 18:25:02 -0400", "from 8.mo2.mail-out.ovh.net ([188.165.52.147]:42428)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <groug@kaod.org>) id 1drtc1-0005Za-JV\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 18:24:57 -0400", "from player770.ha.ovh.net (b6.ovh.net [213.186.33.56])\n\tby mo2.mail-out.ovh.net (Postfix) with ESMTP id 523D3AA673\n\tfor <qemu-devel@nongnu.org>; Wed, 13 Sep 2017 00:24:56 +0200 (CEST)", "from bahia.lan (gar31-1-82-66-74-139.fbx.proxad.net [82.66.74.139])\n\t(Authenticated sender: groug@kaod.org)\n\tby player770.ha.ovh.net (Postfix) with ESMTPA id 11EF83C006C;\n\tWed, 13 Sep 2017 00:24:54 +0200 (CEST)" ], "From": "Greg Kurz <groug@kaod.org>", "To": "qemu-devel@nongnu.org", "Date": "Wed, 13 Sep 2017 00:24:53 +0200", "Message-ID": "<150525509384.11068.12660058285712851211.stgit@bahia.lan>", "In-Reply-To": "<150525508489.11068.5231444460720976552.stgit@bahia.lan>", "References": "<150525508489.11068.5231444460720976552.stgit@bahia.lan>", "User-Agent": "StGit/0.17.1-46-g6855-dirty", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "X-Ovh-Tracer-Id": "6825205235612227923", "X-VR-SPAMSTATE": "OK", "X-VR-SPAMSCORE": "-100", "X-VR-SPAMCAUSE": "gggruggvucftvghtrhhoucdtuddrfeelledrgedvgdduieeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]", "X-Received-From": "188.165.52.147", "Subject": "[Qemu-devel] [PATCH v2 1/2] spapr: introduce common helper to write\n\tHPT address to KVM PR", "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": "qemu-ppc@nongnu.org, David Gibson <david@gibson.dropbear.id.au>", "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": "When running with KVM PR, if a new HPT is allocated we need to inform\nKVM about the HPT address and size. This is currently done with a hack\nwhich is open-coded in several places.\n\nThis patch consolidate the code in a dedicated helper that records\nthe HPT address and size in the sPAPR context, and then does the\nmagic for KVM PR.\n\nNote that ppc_spapr_reset() now resets all devices and CPUs before\nallocating the HPT. This allows to drop the hack from spapr_cpu_reset().\n\nSigned-off-by: Greg Kurz <groug@kaod.org>\n---\n hw/ppc/spapr.c | 31 ++++++++++++++++++++++++++-----\n hw/ppc/spapr_cpu_core.c | 15 ---------------\n hw/ppc/spapr_hcall.c | 16 +---------------\n include/hw/ppc/spapr.h | 1 +\n 4 files changed, 28 insertions(+), 35 deletions(-)", "diff": "diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c\nindex f680f28a15ea..97f8afdbd7fe 100644\n--- a/hw/ppc/spapr.c\n+++ b/hw/ppc/spapr.c\n@@ -1309,6 +1309,25 @@ void spapr_free_hpt(sPAPRMachineState *spapr)\n close_htab_fd(spapr);\n }\n \n+void spapr_install_hpt(sPAPRMachineState *spapr, void *htab, uint32_t shift)\n+{\n+ assert(htab);\n+\n+ spapr->htab = htab;\n+ spapr->htab_shift = shift;\n+\n+ /*\n+ * This is a hack for the benefit of KVM PR - it abuses the SDR1\n+ * slot in kvm_sregs to communicate the userspace address of the\n+ * HPT\n+ */\n+ if (kvm_enabled()) {\n+ target_ulong sdr1 = (target_ulong)(uintptr_t)spapr->htab\n+ | (spapr->htab_shift - 18);\n+ kvmppc_update_sdr1(sdr1);\n+ }\n+}\n+\n void spapr_reallocate_hpt(sPAPRMachineState *spapr, int shift,\n Error **errp)\n {\n@@ -1339,16 +1358,17 @@ void spapr_reallocate_hpt(sPAPRMachineState *spapr, int shift,\n /* kernel-side HPT not needed, allocate in userspace instead */\n size_t size = 1ULL << shift;\n int i;\n+ void *htab;\n \n- spapr->htab = qemu_memalign(size, size);\n- if (!spapr->htab) {\n+ htab = qemu_memalign(size, size);\n+ if (!htab) {\n error_setg_errno(errp, errno,\n \"Could not allocate HPT of order %d\", shift);\n return;\n }\n \n- memset(spapr->htab, 0, size);\n- spapr->htab_shift = shift;\n+ memset(htab, 0, size);\n+ spapr_install_hpt(spapr, htab, shift);\n \n for (i = 0; i < size / HASH_PTE_SIZE_64; i++) {\n DIRTY_HPTE(HPTE(spapr->htab, i));\n@@ -1405,6 +1425,8 @@ static void ppc_spapr_reset(void)\n /* Check for unknown sysbus devices */\n foreach_dynamic_sysbus_device(find_unknown_sysbus_device, NULL);\n \n+ qemu_devices_reset();\n+\n if (kvm_enabled() && kvmppc_has_cap_mmu_radix()) {\n /* If using KVM with radix mode available, VCPUs can be started\n * without a HPT because KVM will start them in radix mode.\n@@ -1414,7 +1436,6 @@ static void ppc_spapr_reset(void)\n spapr_setup_hpt_and_vrma(spapr);\n }\n \n- qemu_devices_reset();\n spapr_clear_pending_events(spapr);\n \n /*\ndiff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c\nindex c08ee7571a50..c20b5c64b045 100644\n--- a/hw/ppc/spapr_cpu_core.c\n+++ b/hw/ppc/spapr_cpu_core.c\n@@ -73,7 +73,6 @@ void spapr_cpu_parse_features(sPAPRMachineState *spapr)\n \n static void spapr_cpu_reset(void *opaque)\n {\n- sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());\n PowerPCCPU *cpu = opaque;\n CPUState *cs = CPU(cpu);\n CPUPPCState *env = &cpu->env;\n@@ -86,20 +85,6 @@ static void spapr_cpu_reset(void *opaque)\n cs->halted = 1;\n \n env->spr[SPR_HIOR] = 0;\n-\n- /*\n- * This is a hack for the benefit of KVM PR - it abuses the SDR1\n- * slot in kvm_sregs to communicate the userspace address of the\n- * HPT\n- */\n- if (kvm_enabled()) {\n- env->spr[SPR_SDR1] = (target_ulong)(uintptr_t)spapr->htab\n- | (spapr->htab_shift - 18);\n- if (kvmppc_put_books_sregs(cpu) < 0) {\n- error_report(\"Unable to update SDR1 in KVM\");\n- exit(1);\n- }\n- }\n }\n \n static void spapr_cpu_destroy(PowerPCCPU *cpu)\ndiff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c\nindex 57bb411394ed..7892cd3e7ffa 100644\n--- a/hw/ppc/spapr_hcall.c\n+++ b/hw/ppc/spapr_hcall.c\n@@ -730,15 +730,7 @@ static target_ulong h_resize_hpt_commit(PowerPCCPU *cpu,\n pending->hpt, newsize);\n if (rc == H_SUCCESS) {\n qemu_vfree(spapr->htab);\n- spapr->htab = pending->hpt;\n- spapr->htab_shift = pending->shift;\n-\n- if (kvm_enabled()) {\n- /* For KVM PR, update the HPT pointer */\n- target_ulong sdr1 = (target_ulong)(uintptr_t)spapr->htab\n- | (spapr->htab_shift - 18);\n- kvmppc_update_sdr1(sdr1);\n- }\n+ spapr_install_hpt(spapr, pending->hpt, pending->shift);\n \n pending->hpt = NULL; /* so it's not free()d */\n }\n@@ -1564,12 +1556,6 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,\n * the point this is called, nothing should have been\n * entered into the existing HPT */\n spapr_reallocate_hpt(spapr, maxshift, &error_fatal);\n- if (kvm_enabled()) {\n- /* For KVM PR, update the HPT pointer */\n- target_ulong sdr1 = (target_ulong)(uintptr_t)spapr->htab\n- | (spapr->htab_shift - 18);\n- kvmppc_update_sdr1(sdr1);\n- }\n }\n }\n \ndiff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h\nindex c1b365f56431..30e5805acca4 100644\n--- a/include/hw/ppc/spapr.h\n+++ b/include/hw/ppc/spapr.h\n@@ -709,4 +709,5 @@ void spapr_do_system_reset_on_cpu(CPUState *cs, run_on_cpu_data arg);\n int spapr_vcpu_id(PowerPCCPU *cpu);\n PowerPCCPU *spapr_find_cpu(int vcpu_id);\n \n+void spapr_install_hpt(sPAPRMachineState *spapr, void *htab, uint32_t shift);\n #endif /* HW_SPAPR_H */\n", "prefixes": [ "v2", "1/2" ] }