[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 7/9] xen/arm: create shared memory nodes in guest device tree



Hi Penny,

On 21/07/2022 14:21, Penny Zheng wrote:
+#ifdef CONFIG_STATIC_SHM
+static int __init make_shm_memory_node(const struct domain *d,
+                                       void *fdt,
+                                       int addrcells, int sizecells,
+                                       const struct meminfo *mem)
+{
+    unsigned int i = 0;
+    int res = 0;
+
+    if ( mem->nr_banks == 0 )
+        return -ENOENT;
+
+    /*
+     * For each shared memory region, a range is exposed under
+     * the /reserved-memory node as a child node. Each range sub-node is
+     * named xen-shmem@<address>.
+     */
+    dt_dprintk("Create xen-shmem node\n");
+
+    for ( ; i < mem->nr_banks; i++ )
+    {
+        uint64_t start = mem->bank[i].start;
+        uint64_t size = mem->bank[i].size;
+        /* Placeholder for xen-shmem@ + a 64-bit number + \0 */
+        char buf[27];
+        const char compat[] = "xen,shared-memory-v1";
+        __be32 reg[addrcells + sizecells];

This doesn't build for me:

arch/arm/domain_build.c: In function ‘make_shm_memory_node’:
arch/arm/domain_build.c:1380:9: error: ISO C90 forbids variable length array ‘reg’ [-Werror=vla]
         __be32 reg[addrcells + sizecells];
         ^~~~~~

I haven't yet review the patch. But I think we would want to dynamically allocate 'reg' like we do in other places unless it is possible to know the maximum size of the array.

Cheers,

--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.