Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/817488/?format=api
{ "id": 817488, "url": "http://patchwork.ozlabs.org/api/patches/817488/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1506083624-20621-7-git-send-email-amarnath.valluri@intel.com/", "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": "<1506083624-20621-7-git-send-email-amarnath.valluri@intel.com>", "list_archive_url": null, "date": "2017-09-22T12:33:42", "name": "[v7,6/8] tpm-backend: Move realloc_buffer() implementation to tpm-tis model", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "8a9d52152ecc08ae95562bc0078aee10acd65ef0", "submitter": { "id": 71320, "url": "http://patchwork.ozlabs.org/api/people/71320/?format=api", "name": "Valluri, Amarnath", "email": "amarnath.valluri@intel.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1506083624-20621-7-git-send-email-amarnath.valluri@intel.com/mbox/", "series": [ { "id": 4614, "url": "http://patchwork.ozlabs.org/api/series/4614/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=4614", "date": "2017-09-22T12:33:37", "name": "Provide support for the software TPM emulator", "version": 7, "mbox": "http://patchwork.ozlabs.org/series/4614/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/817488/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/817488/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 3xzCpq24F0z9sRW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 22:44:18 +1000 (AEST)", "from localhost ([::1]:58678 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 1dvNJX-0001aO-44\n\tfor incoming@patchwork.ozlabs.org; Fri, 22 Sep 2017 08:44:15 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:56491)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <amarnath.valluri@intel.com>) id 1dvN8e-0000hT-J0\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 08:33:07 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <amarnath.valluri@intel.com>) id 1dvN8c-0005xR-60\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 08:33:00 -0400", "from mga07.intel.com ([134.134.136.100]:27337)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <amarnath.valluri@intel.com>)\n\tid 1dvN8b-0005pe-So\n\tfor qemu-devel@nongnu.org; Fri, 22 Sep 2017 08:32:58 -0400", "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga105.jf.intel.com with ESMTP; 22 Sep 2017 05:32:57 -0700", "from avallurigigabyte.fi.intel.com ([10.237.68.147])\n\tby FMSMGA003.fm.intel.com with ESMTP; 22 Sep 2017 05:32:56 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.42,427,1500966000\"; d=\"scan'208\";a=\"902897870\"", "From": "Amarnath Valluri <amarnath.valluri@intel.com>", "To": "qemu-devel@nongnu.org", "Date": "Fri, 22 Sep 2017 15:33:42 +0300", "Message-Id": "<1506083624-20621-7-git-send-email-amarnath.valluri@intel.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1506083624-20621-1-git-send-email-amarnath.valluri@intel.com>", "References": "<1506083624-20621-1-git-send-email-amarnath.valluri@intel.com>", "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": "134.134.136.100", "Subject": "[Qemu-devel] [PATCH v7 6/8] tpm-backend: Move realloc_buffer()\n\timplementation to tpm-tis model", "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": "Amarnath Valluri <amarnath.valluri@intel.com>, =?utf-8?q?Marc-Andr?=\n\t=?utf-8?b?w6kgTHVyZWF1?= <marcandre.lureau@gmail.com>,\n\tStefan Berger <stefanb@linux.vnet.ibm.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": "buffer reallocation is very unlikely to be backend specific. Hence move inside\nthe tis.\n\nSigned-off-by: Amarnath Valluri <amarnath.valluri@intel.com>\nReviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>\nReviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n---\n backends/tpm.c | 9 ---------\n hw/tpm/tpm_passthrough.c | 12 ------------\n hw/tpm/tpm_tis.c | 14 ++++++++++++--\n include/sysemu/tpm_backend.h | 12 ------------\n 4 files changed, 12 insertions(+), 35 deletions(-)", "diff": "diff --git a/backends/tpm.c b/backends/tpm.c\nindex 6ade9e4..ffc9d88 100644\n--- a/backends/tpm.c\n+++ b/backends/tpm.c\n@@ -78,15 +78,6 @@ bool tpm_backend_had_startup_error(TPMBackend *s)\n return k->ops->had_startup_error(s);\n }\n \n-size_t tpm_backend_realloc_buffer(TPMBackend *s, TPMSizedBuffer *sb)\n-{\n- TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);\n-\n- assert(k->ops->realloc_buffer);\n-\n- return k->ops->realloc_buffer(sb);\n-}\n-\n void tpm_backend_deliver_request(TPMBackend *s)\n {\n g_thread_pool_push(s->thread_pool, (gpointer)TPM_BACKEND_CMD_PROCESS_CMD,\ndiff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c\nindex fb7dad8..82e7003 100644\n--- a/hw/tpm/tpm_passthrough.c\n+++ b/hw/tpm/tpm_passthrough.c\n@@ -258,17 +258,6 @@ static bool tpm_passthrough_get_startup_error(TPMBackend *tb)\n return tpm_pt->had_startup_error;\n }\n \n-static size_t tpm_passthrough_realloc_buffer(TPMSizedBuffer *sb)\n-{\n- size_t wanted_size = 4096; /* Linux tpm.c buffer size */\n-\n- if (sb->size != wanted_size) {\n- sb->buffer = g_realloc(sb->buffer, wanted_size);\n- sb->size = wanted_size;\n- }\n- return sb->size;\n-}\n-\n static void tpm_passthrough_cancel_cmd(TPMBackend *tb)\n {\n TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);\n@@ -460,7 +449,6 @@ static const TPMDriverOps tpm_passthrough_driver = {\n .opts = tpm_passthrough_cmdline_opts,\n .desc = \"Passthrough TPM backend driver\",\n .create = tpm_passthrough_create,\n- .realloc_buffer = tpm_passthrough_realloc_buffer,\n .reset = tpm_passthrough_reset,\n .had_startup_error = tpm_passthrough_get_startup_error,\n .cancel_cmd = tpm_passthrough_cancel_cmd,\ndiff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c\nindex a6440fe..d5118e7 100644\n--- a/hw/tpm/tpm_tis.c\n+++ b/hw/tpm/tpm_tis.c\n@@ -963,6 +963,16 @@ static int tpm_tis_do_startup_tpm(TPMState *s)\n return tpm_backend_startup_tpm(s->be_driver);\n }\n \n+static void tpm_tis_realloc_buffer(TPMSizedBuffer *sb)\n+{\n+ size_t wanted_size = 4096; /* Linux tpm.c buffer size */\n+\n+ if (sb->size != wanted_size) {\n+ sb->buffer = g_realloc(sb->buffer, wanted_size);\n+ sb->size = wanted_size;\n+ }\n+}\n+\n /*\n * Get the TPMVersion of the backend device being used\n */\n@@ -1010,9 +1020,9 @@ static void tpm_tis_reset(DeviceState *dev)\n tis->loc[c].state = TPM_TIS_STATE_IDLE;\n \n tis->loc[c].w_offset = 0;\n- tpm_backend_realloc_buffer(s->be_driver, &tis->loc[c].w_buffer);\n+ tpm_tis_realloc_buffer(&tis->loc[c].w_buffer);\n tis->loc[c].r_offset = 0;\n- tpm_backend_realloc_buffer(s->be_driver, &tis->loc[c].r_buffer);\n+ tpm_tis_realloc_buffer(&tis->loc[c].r_buffer);\n }\n \n tpm_tis_do_startup_tpm(s);\ndiff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h\nindex 809eec2..6163edf 100644\n--- a/include/sysemu/tpm_backend.h\n+++ b/include/sysemu/tpm_backend.h\n@@ -85,8 +85,6 @@ struct TPMDriverOps {\n /* returns true if nothing will ever answer TPM requests */\n bool (*had_startup_error)(TPMBackend *t);\n \n- size_t (*realloc_buffer)(TPMSizedBuffer *sb);\n-\n void (*reset)(TPMBackend *t);\n \n void (*cancel_cmd)(TPMBackend *t);\n@@ -141,16 +139,6 @@ int tpm_backend_startup_tpm(TPMBackend *s);\n bool tpm_backend_had_startup_error(TPMBackend *s);\n \n /**\n- * tpm_backend_realloc_buffer:\n- * @s: the backend\n- * @sb: the TPMSizedBuffer to re-allocated to the size suitable for the\n- * backend.\n- *\n- * This function returns the size of the allocated buffer\n- */\n-size_t tpm_backend_realloc_buffer(TPMBackend *s, TPMSizedBuffer *sb);\n-\n-/**\n * tpm_backend_deliver_request:\n * @s: the backend to send the request to\n *\n", "prefixes": [ "v7", "6/8" ] }