From: Michal Orzel <michal.orzel@amd.com>
To: Luca Fancellu <luca.fancellu@arm.com>, <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH v2 1/7] xen/arm: Lookup bootinfo shm bank during the mapping
Date: Thu, 16 May 2024 15:05:51 +0200 [thread overview]
Message-ID: <d5de1a67-fb91-43b3-b7d3-e5162f479a11@amd.com> (raw)
In-Reply-To: <20240515142626.3480640-2-luca.fancellu@arm.com>
Hi Luca,
On 15/05/2024 16:26, Luca Fancellu wrote:
>
>
> The current static shared memory code is using bootinfo banks when it
> needs to find the number of borrowers, so every time assign_shared_memory
> is called, the bank is searched in the bootinfo.shmem structure.
>
> There is nothing wrong with it, however the bank can be used also to
> retrieve the start address and size and also to pass less argument to
s/argument/arguments
> assign_shared_memory. When retrieving the information from the bootinfo
> bank, it's also possible to move the checks on alignment to
> process_shm_node in the early stages.
>
> So create a new function find_shm_bank_by_id() which takes a
> 'struct shared_meminfo' structure and the shared memory ID, to look for a
> bank with a matching ID, take the physical host address and size from the
> bank, pass the bank to assign_shared_memory() removing the now unnecessary
> arguments and finally remove the acquire_nr_borrower_domain() function
> since now the information can be extracted from the passed bank.
> Move the "xen,shm-id" parsing early in process_shm to bail out quickly in
> case of errors (unlikely), as said above, move the checks on alignment
> to process_shm_node.
>
> Drawback of this change is that now the bootinfo are used also when the
> bank doesn't need to be allocated, however it will be convinient later
s/convinient/convenient
> to use it as an argument for assign_shared_memory when dealing with
> the use case where the Host physical address is not supplied by the user.
>
> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
> ---
> v2 changes:
> - fix typo commit msg, renamed find_shm() to find_shm_bank_by_id(),
> swap region size check different from zero and size alignment, remove
> not necessary BUGON(). (Michal)
> ---
> xen/arch/arm/static-shmem.c | 101 +++++++++++++++++++-----------------
> 1 file changed, 54 insertions(+), 47 deletions(-)
>
> diff --git a/xen/arch/arm/static-shmem.c b/xen/arch/arm/static-shmem.c
> index 78881dd1d3f7..0afc86c43f85 100644
> --- a/xen/arch/arm/static-shmem.c
> +++ b/xen/arch/arm/static-shmem.c
> @@ -19,29 +19,22 @@ static void __init __maybe_unused build_assertions(void)
> offsetof(struct shared_meminfo, bank)));
> }
>
> -static int __init acquire_nr_borrower_domain(struct domain *d,
> - paddr_t pbase, paddr_t psize,
> - unsigned long *nr_borrowers)
> +static const struct membank __init *
> +find_shm_bank_by_id(const struct membanks *shmem, const char *shm_id)
> {
> - const struct membanks *shmem = bootinfo_get_shmem();
> unsigned int bank;
>
> - /* Iterate reserved memory to find requested shm bank. */
> for ( bank = 0 ; bank < shmem->nr_banks; bank++ )
> {
> - paddr_t bank_start = shmem->bank[bank].start;
> - paddr_t bank_size = shmem->bank[bank].size;
> -
> - if ( (pbase == bank_start) && (psize == bank_size) )
> + if ( strncmp(shm_id, shmem->bank[bank].shmem_extra->shm_id,
Does it really need to be strncmp? You validated it a few times already.
Other than that:
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
~Michal
next prev parent reply other threads:[~2024-05-16 13:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-15 14:26 [PATCH v2 0/7] Static shared memory followup v2 - pt2 Luca Fancellu
2024-05-15 14:26 ` [PATCH v2 1/7] xen/arm: Lookup bootinfo shm bank during the mapping Luca Fancellu
2024-05-16 13:05 ` Michal Orzel [this message]
2024-05-15 14:26 ` [PATCH v2 2/7] xen/arm: Wrap shared memory mapping code in one function Luca Fancellu
2024-05-16 13:19 ` Michal Orzel
2024-05-16 13:24 ` Luca Fancellu
2024-05-15 14:26 ` [PATCH v2 3/7] xen/p2m: put reference for level 2 superpage Luca Fancellu
2024-05-16 13:42 ` Michal Orzel
2024-05-15 14:26 ` [PATCH v2 4/7] xen/arm: Parse xen,shared-mem when host phys address is not provided Luca Fancellu
2024-05-20 9:34 ` Michal Orzel
2024-05-15 14:26 ` [PATCH v2 5/7] xen/arm: Rework heap page allocation outside allocate_bank_memory Luca Fancellu
2024-05-20 9:42 ` Michal Orzel
2024-05-15 14:26 ` [PATCH v2 6/7] xen/arm: Implement the logic for static shared memory from Xen heap Luca Fancellu
2024-05-20 11:16 ` Michal Orzel
2024-05-20 12:44 ` Luca Fancellu
2024-05-20 13:01 ` Michal Orzel
2024-05-20 13:11 ` Luca Fancellu
2024-05-20 13:13 ` Michal Orzel
2024-05-15 14:26 ` [PATCH v2 7/7] xen/docs: Describe static shared memory when host address is not provided Luca Fancellu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d5de1a67-fb91-43b3-b7d3-e5162f479a11@amd.com \
--to=michal.orzel@amd.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=bertrand.marquis@arm.com \
--cc=julien@xen.org \
--cc=luca.fancellu@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.