[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230130101445.GB332@quicinc.com>
Date: Mon, 30 Jan 2023 15:44:45 +0530
From: Srivatsa Vaddagiri <quic_svaddagi@...cinc.com>
To: Elliot Berman <quic_eberman@...cinc.com>
CC: Bjorn Andersson <quic_bjorande@...cinc.com>,
Alex Elder <elder@...aro.org>,
Murali Nalajala <quic_mnalajal@...cinc.com>,
Trilok Soni <quic_tsoni@...cinc.com>,
Carl van Schaik <quic_cvanscha@...cinc.com>,
Prakruthi Deepak Heragu <quic_pheragu@...cinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Arnd Bergmann <arnd@...db.de>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Jonathan Corbet <corbet@....net>,
Bagas Sanjaya <bagasdotme@...il.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Marc Zyngier <maz@...nel.org>,
Jassi Brar <jassisinghbrar@...il.com>,
Sudeep Holla <sudeep.holla@....com>,
<linux-arm-msm@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-doc@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v9 12/27] gunyah: rsc_mgr: Add RPC for sharing memory
* Elliot Berman <quic_eberman@...cinc.com> [2023-01-20 14:46:11]:
> +static int gh_rm_mem_lend_common(struct gh_rm *rm, u32 message_id, struct gh_rm_mem_parcel *p)
> +{
> + size_t msg_size = 0, initial_n_mem_entries = p->n_mem_entries;
> + void *msg;
> + __le32 *resp;
> + struct gh_mem_share_req_header *req_header;
> + struct gh_mem_share_req_acl_section *acl_section;
> + struct gh_mem_share_req_mem_section *mem_section;
> + u32 *mem_attr_section;
> + size_t resp_size;
> + int ret;
> +
> + if (!p->acl_entries || !p->n_acl_entries || !p->mem_entries || !p->n_mem_entries ||
> + p->n_acl_entries > U8_MAX || p->mem_handle != GH_MEM_HANDLE_INVAL)
> + return -EINVAL;
> +
> + if (initial_n_mem_entries > GH_RM_MAX_MEM_ENTRIES)
> + initial_n_mem_entries = GH_RM_MAX_MEM_ENTRIES;
> +
> + /* The format of the message goes:
> + * request header
> + * ACL entries (which VMs get what kind of access to this memory parcel)
> + * Memory entries (list of memory regions to share)
> + * Memory attributes (currently unused, we'll hard-code the size to 0)
> + */
> + msg_size += sizeof(struct gh_mem_share_req_header);
> + msg_size += offsetof(struct gh_mem_share_req_acl_section, entries[p->n_acl_entries]);
> + msg_size += offsetof(struct gh_mem_share_req_mem_section, entries[initial_n_mem_entries]);
> + msg_size += sizeof(u32); /* for memory attributes, currently unused */
> +
> + msg = kzalloc(msg_size, GFP_KERNEL);
> + if (!msg)
> + return -ENOMEM;
> +
> + ret = gh_rm_platform_pre_mem_share(rm, p);
Hmm ..I think gh_rm_platform_pre_mem_share() is not yet defined as of this
patch, so you probably want this in a later patch.
> + if (ret) {
> + kfree(msg);
> + return ret;
> + }
> +
Powered by blists - more mailing lists