From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Likely Subject: [RFC PATCH 1/7] devicetree: Add 8k instead of double dtb size when reserving extra memory Date: Tue, 06 Apr 2010 22:10:02 -0600 Message-ID: <20100407041002.20274.51604.stgit@angua> References: <20100407040129.20274.44284.stgit@angua> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20100407040129.20274.44284.stgit@angua> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org To: qemu-devel-qX2TKyscuCcdnm+yROfE0A@public.gmane.org, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org List-Id: devicetree@vger.kernel.org If a small 'seed' dtb file is loaded into qemu and then heavily modified (say for runtime population of all the device nodes), then 2x the dtb size turns out not to be very much. This patch changes the device tree loading code to add a fixed 8k of additional space to the dtb buffer. Signed-off-by: Grant Likely --- device_tree.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/device_tree.c b/device_tree.c index 426a631..bad4810 100644 --- a/device_tree.c +++ b/device_tree.c @@ -41,8 +41,8 @@ void *load_device_tree(const char *filename_path, int *sizep) goto fail; } - /* Expand to 2x size to give enough room for manipulation. */ - dt_size *= 2; + /* Expand size to give enough room for manipulation. */ + dt_size += 8 * 1024; /* First allocate space in qemu for device tree */ fdt = qemu_mallocz(dt_size); From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NzMae-0008Dv-Le for qemu-devel@nongnu.org; Wed, 07 Apr 2010 00:10:08 -0400 Received: from [140.186.70.92] (port=34663 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NzMad-0008DN-Eq for qemu-devel@nongnu.org; Wed, 07 Apr 2010 00:10:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NzMac-0001mK-1P for qemu-devel@nongnu.org; Wed, 07 Apr 2010 00:10:07 -0400 Received: from mail-pw0-f45.google.com ([209.85.160.45]:55195) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NzMab-0001kv-TB for qemu-devel@nongnu.org; Wed, 07 Apr 2010 00:10:06 -0400 Received: by mail-pw0-f45.google.com with SMTP id 6so554258pwi.4 for ; Tue, 06 Apr 2010 21:10:05 -0700 (PDT) Sender: Grant Likely From: Grant Likely Date: Tue, 06 Apr 2010 22:10:02 -0600 Message-ID: <20100407041002.20274.51604.stgit@angua> In-Reply-To: <20100407040129.20274.44284.stgit@angua> References: <20100407040129.20274.44284.stgit@angua> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RFC PATCH 1/7] devicetree: Add 8k instead of double dtb size when reserving extra memory List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, devicetree-discuss@lists.ozlabs.org, jeremy.kerr@canonical.com If a small 'seed' dtb file is loaded into qemu and then heavily modified (say for runtime population of all the device nodes), then 2x the dtb size turns out not to be very much. This patch changes the device tree loading code to add a fixed 8k of additional space to the dtb buffer. Signed-off-by: Grant Likely --- device_tree.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/device_tree.c b/device_tree.c index 426a631..bad4810 100644 --- a/device_tree.c +++ b/device_tree.c @@ -41,8 +41,8 @@ void *load_device_tree(const char *filename_path, int *sizep) goto fail; } - /* Expand to 2x size to give enough room for manipulation. */ - dt_size *= 2; + /* Expand size to give enough room for manipulation. */ + dt_size += 8 * 1024; /* First allocate space in qemu for device tree */ fdt = qemu_mallocz(dt_size);