get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/290/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 290,
    "url": "http://patchwork.ozlabs.org/api/patches/290/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1221546450-15761-4-git-send-email-ehrhardt@linux.vnet.ibm.com/",
    "project": {
        "id": 2,
        "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api",
        "name": "Linux PPC development",
        "link_name": "linuxppc-dev",
        "list_id": "linuxppc-dev.lists.ozlabs.org",
        "list_email": "linuxppc-dev@lists.ozlabs.org",
        "web_url": "https://github.com/linuxppc/wiki/wiki",
        "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git",
        "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/",
        "list_archive_url": "https://lore.kernel.org/linuxppc-dev/",
        "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/",
        "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"
    },
    "msgid": "<1221546450-15761-4-git-send-email-ehrhardt@linux.vnet.ibm.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/1221546450-15761-4-git-send-email-ehrhardt@linux.vnet.ibm.com/",
    "date": "2008-09-16T06:27:30",
    "name": "kvmppc: magic page paravirtualization - guest part",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "f79a075c51b9f8762e776e7bd61e430dc18d23d6",
    "submitter": {
        "id": 151,
        "url": "http://patchwork.ozlabs.org/api/people/151/?format=api",
        "name": null,
        "email": "ehrhardt@linux.vnet.ibm.com"
    },
    "delegate": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/users/47/?format=api",
        "username": "hollisb",
        "first_name": "Hollis",
        "last_name": "Blanchard",
        "email": "hollis@penguinppc.org"
    },
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1221546450-15761-4-git-send-email-ehrhardt@linux.vnet.ibm.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/290/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/290/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linuxppc-dev-bounces+patchwork=ozlabs.org@ozlabs.org>",
        "X-Original-To": [
            "patchwork@ozlabs.org",
            "linuxppc-dev@ozlabs.org"
        ],
        "Delivered-To": [
            "patchwork@ozlabs.org",
            "linuxppc-dev@ozlabs.org"
        ],
        "Received": [
            "from ozlabs.org (localhost [127.0.0.1])\n\tby ozlabs.org (Postfix) with ESMTP id D6C21DE5D0\n\tfor <patchwork@ozlabs.org>; Tue, 16 Sep 2008 16:29:39 +1000 (EST)",
            "from mtagate8.de.ibm.com (mtagate8.de.ibm.com [195.212.29.157])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(Client CN \"mtagate8.de.ibm.com\", Issuer \"Equifax\" (verified OK))\n\tby ozlabs.org (Postfix) with ESMTPS id E0956DE086\n\tfor <linuxppc-dev@ozlabs.org>; Tue, 16 Sep 2008 16:29:09 +1000 (EST)",
            "from d12nrmr1607.megacenter.de.ibm.com\n\t(d12nrmr1607.megacenter.de.ibm.com [9.149.167.49])\n\tby mtagate8.de.ibm.com (8.13.8/8.13.8) with ESMTP id m8G6RwE3076902\n\tfor <linuxppc-dev@ozlabs.org>; Tue, 16 Sep 2008 06:27:58 GMT",
            "from d12av01.megacenter.de.ibm.com (d12av01.megacenter.de.ibm.com\n\t[9.149.165.212])\n\tby d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.1) with\n\tESMTP id m8G6RweE4321416\n\tfor <linuxppc-dev@ozlabs.org>; Tue, 16 Sep 2008 08:27:58 +0200",
            "from d12av01.megacenter.de.ibm.com (loopback [127.0.0.1])\n\tby d12av01.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP\n\tid m8G6RtRJ025229\n\tfor <linuxppc-dev@ozlabs.org>; Tue, 16 Sep 2008 08:27:55 +0200",
            "from localhost.localdomain (dyn-9-152-198-109.boeblingen.de.ibm.com\n\t[9.152.198.109])\n\tby d12av01.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with\n\tESMTP id m8G6Rsbv024799; Tue, 16 Sep 2008 08:27:55 +0200"
        ],
        "From": "ehrhardt@linux.vnet.ibm.com",
        "To": "linuxppc-dev@ozlabs.org, kvm-ppc@vger.kernel.org",
        "Subject": "[PATCH 3/3] kvmppc: magic page paravirtualization - guest part",
        "Date": "Tue, 16 Sep 2008 08:27:30 +0200",
        "Message-Id": "<1221546450-15761-4-git-send-email-ehrhardt@linux.vnet.ibm.com>",
        "X-Mailer": "git-send-email 1.5.4.3",
        "In-Reply-To": "<1221546450-15761-1-git-send-email-ehrhardt@linux.vnet.ibm.com>",
        "References": "<1221546450-15761-1-git-send-email-ehrhardt@linux.vnet.ibm.com>",
        "Cc": "hollisb@us.ibm.com",
        "X-BeenThere": "linuxppc-dev@ozlabs.org",
        "X-Mailman-Version": "2.1.11",
        "Precedence": "list",
        "List-Id": "Linux on PowerPC Developers Mail List <linuxppc-dev.ozlabs.org>",
        "List-Unsubscribe": "<https://ozlabs.org/mailman/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=unsubscribe>",
        "List-Archive": "<http://ozlabs.org/pipermail/linuxppc-dev>",
        "List-Post": "<mailto:linuxppc-dev@ozlabs.org>",
        "List-Help": "<mailto:linuxppc-dev-request@ozlabs.org?subject=help>",
        "List-Subscribe": "<https://ozlabs.org/mailman/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "linuxppc-dev-bounces+patchwork=ozlabs.org@ozlabs.org",
        "Errors-To": "linuxppc-dev-bounces+patchwork=ozlabs.org@ozlabs.org"
    },
    "content": "From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>\n\nThis patch adds the guest handling for the magic page mechanism. A Hypervisor\ncan modify the device tree passed to the guest. Using that already existing\ninterface a guest can simply detect available hypervisor features and agree\non the supported ones using hypercalls.\nIn this example it is checked for the feature switch \"feature,pv-magicpage\"\nin the hypervisor node and additional data which represents the size the\nhypervisor requests in \"data,pv-magicpage-size\".\nWhen the guest reads that data and wants to support it the memory is allocated\nand passed to the hypervisor using the KVM_HCALL_RESERVE_MAGICPAGE hypercall.\n\nSigned-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>",
    "diff": "diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c\n--- a/arch/powerpc/kernel/kvm.c\n+++ b/arch/powerpc/kernel/kvm.c\n@@ -22,9 +22,62 @@\n #include <linux/percpu.h>\n #include <linux/mm.h>\n #include <linux/kvm_para.h>\n+#include <linux/bootmem.h>\n+#include <asm/fixmap.h>\n+#include <asm/epapr_hcalls.h>\n+\n+/*\n+ * this is guest memory granted to the hypervisor;\n+ * the hypervisor can place data in this area and rewrite\n+ * privileged instructions to read from this area without\n+ * trapping.\n+ * Only the Hypervisor needs to be aware of the structure layout\n+ * which makes the guest more felxible - the guest only guarantees\n+ * the size which is requested by the hypervisor and read from a\n+ * device tree entry.\n+ */\n+static void *kvm_magicpage;\n+\n+static void __init kvmppc_register_magic_page(void)\n+{\n+\tunsigned long gvaddr;\n+\tunsigned long gpaddr;\n+\tint size;\n+\tlong err;\n+\n+\tsize = kvmppc_pv_read_data(KVM_PVDATA_MAGICPAGE_SIZE);\n+\tif (size < 0) {\n+\t\tprintk(KERN_ERR \"%s: couldn't read size for kvmppc style \"\n+\t\t\t\"paravirtualization support (got %d)\\n\",\n+\t\t\t__func__, size);\n+\t\treturn;\n+\t}\n+\n+\t/* FIXME Guest SMP needs that percpu which */\n+\tkvm_magicpage = alloc_bootmem(size);\n+\tif (!kvm_magicpage) {\n+\t\tprintk(KERN_ERR \"%s - failed to allocate %d bytes\\n\",\n+\t\t\t __func__, size);\n+\t\treturn;\n+\t}\n+\tgpaddr = (unsigned long)__pa(kvm_magicpage);\n+\tgvaddr = fix_to_virt(FIX_KVM_PV);\n+\n+\terr = epapr_hypercall_2in_1out(KVM_HCALL_RESERVE_MAGICPAGE,\n+\t\t\t\t\tgvaddr, gpaddr);\n+\tif (err)\n+\t\tprintk(KERN_ERR \"%s: couldn't register pv mem\\n\", __func__);\n+\telse\n+\t\tprintk(KERN_NOTICE \"%s: registered %d bytes for pv mem support\"\n+\t\t\t\" (gvaddr 0x%08lx gpaddr 0x%08lx)\\n\",\n+\t\t\t __func__, size, gvaddr, gpaddr);\n+}\n \n void __init kvm_guest_init(void)\n {\n \tif (!kvm_para_available())\n \t\treturn;\n+\n+\tif (kvm_para_has_feature(KVM_FEATURE_PPCPV_MAGICPAGE))\n+\t\tkvmppc_register_magic_page();\n }\ndiff --git a/include/asm-powerpc/fixmap.h b/include/asm-powerpc/fixmap.h\n--- a/include/asm-powerpc/fixmap.h\n+++ b/include/asm-powerpc/fixmap.h\n@@ -36,7 +36,7 @@\n  *\n  * these 'compile-time allocated' memory buffers are\n  * fixed-size 4k pages. (or larger if used with an increment\n- * highger than 1) use fixmap_set(idx,phys) to associate\n+ * higher than 1) use fixmap_set(idx,phys) to associate\n  * physical memory with fixmap indices.\n  *\n  * TLB entries of such buffers will not be flushed across\n@@ -44,6 +44,14 @@\n  */\n enum fixed_addresses {\n \tFIX_HOLE,\n+#ifdef CONFIG_KVM_GUEST\n+\t/*\n+\t * reserved virtual address space for paravirtualization - needs to be\n+\t *  <=32k away from base address 0 to be able to reach it with\n+\t * immediate addressing using base 0 instead of needing a register.\n+\t */\n+\tFIX_KVM_PV,\n+#endif\n #ifdef CONFIG_HIGHMEM\n \tFIX_KMAP_BEGIN,\t/* reserved pte's for temporary kernel mappings */\n \tFIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,\ndiff --git a/include/asm-powerpc/kvm_para.h b/include/asm-powerpc/kvm_para.h\n--- a/include/asm-powerpc/kvm_para.h\n+++ b/include/asm-powerpc/kvm_para.h\n@@ -26,10 +26,18 @@\n \n #include <linux/of.h>\n \n+#define KVM_HCALL_RESERVE_MAGICPAGE\t0\n+\n+#define KVM_PVDATA_MAGICPAGE_SIZE\t\"data,pv-magicpage-size\"\n+\n+/* List of PV features supported, returned as a bitfield */\n+#define KVM_FEATURE_PPCPV_MAGICPAGE\t0\n+\n static struct kvmppc_para_features {\n \tchar *dtcell;\n \tint feature;\n } para_features[] = {\n+\t{ \"feature,pv-magicpage\", KVM_FEATURE_PPCPV_MAGICPAGE }\n };\n \n static inline int kvm_para_available(void)\n@@ -67,6 +75,24 @@\n \treturn features;\n }\n \n+/* reads the specified data field out of the hypervisor node */\n+static inline int kvmppc_pv_read_data(char *dtcell)\n+{\n+\tstruct device_node *dn;\n+\tconst int *dtval;\n+\n+\tdn = of_find_node_by_path(\"/hypervisor\");\n+\tif (!dn)\n+\t\treturn -EINVAL;\n+\n+\tdtval = of_get_property(dn, dtcell, NULL);\n+\tof_node_put(dn);\n+\tif (dtval)\n+\t\treturn *dtval;\n+\telse\n+\t\treturn -EINVAL;\n+}\n+\n void kvm_guest_init(void);\n \n #endif /* __KERNEL__ */\n",
    "prefixes": []
}