Re: [PATCH 2/2] soc: qcom: smem: Support getting cached entries

From: Stephen Boyd
Date: Fri Aug 11 2017 - 19:36:52 EST


On 08/10/2017 12:37 PM, Bjorn Andersson wrote:
> @@ -252,6 +257,14 @@ phdr_to_last_uncached_entry(struct smem_partition_header *phdr)
> return p + le32_to_cpu(phdr->offset_free_uncached);
> }
>
> +static void *phdr_to_first_cached_entry(struct smem_partition_header *phdr,
> + size_t cacheline)
> +{
> + void *p = phdr;
> +
> + return p + phdr->size - ALIGN(sizeof(*phdr), cacheline);

le32_to_cpu(phrd->size) ?

> +}
> +
> static void *phdr_to_last_cached_entry(struct smem_partition_header *phdr)
> {
> void *p = phdr;
> @@ -276,6 +289,14 @@ uncached_entry_next(struct smem_private_entry *e)
> le32_to_cpu(e->size);
> }
>
> +static struct smem_private_entry *
> +cached_entry_next(struct smem_private_entry *e, size_t cacheline)
> +{
> + void *p = e;
> +
> + return p - le32_to_cpu(e->size) - ALIGN(sizeof(*e), cacheline);
> +}
> +
> static void *uncached_entry_to_item(struct smem_private_entry *e)
> {
> void *p = e;
> @@ -283,6 +304,13 @@ static void *uncached_entry_to_item(struct smem_private_entry *e)
> return p + sizeof(*e) + le16_to_cpu(e->padding_hdr);
> }
>
> +static void *cached_entry_to_item(struct smem_private_entry *e)
> +{
> + void *p = e;
> +
> + return p - le16_to_cpu(e->size);

But it's a le32?

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project