[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ed65312a-245c-4fa5-91ad-5d620cab7c6b@nvidia.com>
Date: Thu, 17 Oct 2024 23:49:47 -0500
From: Shanker Donthineni <sdonthineni@...dia.com>
To: Steven Price <steven.price@....com>, kvm@...r.kernel.org,
kvmarm@...ts.linux.dev
Cc: Catalin Marinas <catalin.marinas@....com>, Marc Zyngier <maz@...nel.org>,
Will Deacon <will@...nel.org>, James Morse <james.morse@....com>,
Oliver Upton <oliver.upton@...ux.dev>,
Suzuki K Poulose <suzuki.poulose@....com>, Zenghui Yu
<yuzenghui@...wei.com>, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, Joey Gouly <joey.gouly@....com>,
Alexandru Elisei <alexandru.elisei@....com>,
Christoffer Dall <christoffer.dall@....com>, Fuad Tabba <tabba@...gle.com>,
linux-coco@...ts.linux.dev,
Ganapatrao Kulkarni <gankulkarni@...amperecomputing.com>,
Gavin Shan <gshan@...hat.com>, Alper Gun <alpergun@...gle.com>
Subject: Re: [PATCH v5 17/19] irqchip/gic-v3-its: Share ITS tables with a
non-trusted hypervisor
Hi Steve,
On 8/19/24 08:19, Steven Price wrote:
> External email: Use caution opening links or attachments
>
>
> Within a realm guest the ITS is emulated by the host. This means the
> allocations must have been made available to the host by a call to
> set_memory_decrypted(). Introduce an allocation function which performs
> this extra call.
>
> For the ITT use a custom genpool-based allocator that calls
> set_memory_decrypted() for each page allocated, but then suballocates
> the size needed for each ITT. Note that there is no mechanism
> implemented to return pages from the genpool, but it is unlikely the
> peak number of devices will so much larger than the normal level - so
> this isn't expected to be an issue.
>
> Co-developed-by: Suzuki K Poulose <suzuki.poulose@....com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@....com>
> Tested-by: Will Deacon <will@...nel.org>
> Signed-off-by: Steven Price <steven.price@....com>
> ---
> Changes since v3:
> * Use BIT() macro.
> * Use a genpool based allocator in its_create_device() to avoid
> allocating a full page.
> * Fix subject to drop "realm" and use gic-v3-its.
> * Add error handling to ITS alloc/free.
> Changes since v2:
> * Drop 'shared' from the new its_xxx function names as they are used
> for non-realm guests too.
> * Don't handle the NUMA_NO_NODE case specially - alloc_pages_node()
> should do the right thing.
> * Drop a pointless (void *) cast.
> ---
> drivers/irqchip/irq-gic-v3-its.c | 139 ++++++++++++++++++++++++++-----
> 1 file changed, 116 insertions(+), 23 deletions(-)
>
...
> +
> +static void *itt_alloc_pool(int node, int size)
> +{
> + unsigned long addr;
> + struct page *page;
> +
> + if (size >= PAGE_SIZE) {
> + page = its_alloc_pages_node(node,
> + GFP_KERNEL | __GFP_ZERO,
> + get_order(size));
> +
> + return page_address(page);
> + }
> +
> + do {
> + addr = gen_pool_alloc(itt_pool, size);
> + if (addr)
> + break;
> +
> + page = its_alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO, 1);
Two (2^1) pages are allocated here, but only one page is being added to the pool.
Is this a typo or intentional?
> + if (!page)
> + break;
> +
> + gen_pool_add(itt_pool, (unsigned long)page_address(page),
> + PAGE_SIZE, node);
> + } while (!addr);
> +
> + return (void *)addr;
> +}
> +
> +static void itt_free_pool(void *addr, int size)
-Shanker
Powered by blists - more mailing lists