From patchwork Thu Oct 5 03:11:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 114825 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp119026qgn; Wed, 4 Oct 2017 20:11:40 -0700 (PDT) X-Received: by 10.98.223.137 with SMTP id d9mr22423998pfl.171.1507173100102; Wed, 04 Oct 2017 20:11:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507173100; cv=none; d=google.com; s=arc-20160816; b=NKzTbu+GXfVkmH7omzAkqZ4J1hVyCG8jALzTCUjVRmksxR/+SCHamBGtE6i+e9DToW CtKZ/S68QNh4OSmbVzrOaL+UQjbaOsqrRJBS2haejuhv2xux8fQeEaDFRJscJXxQhmP6 zNb4yIkhjKh4GLW4+EAnRpZ+q2gNKfDrcnmWI/2fF8hbq3QieV2ZABOdgEZDDp6euRA9 Ab7U3zt4seoOC6+R2lIxqzVkTWUvr+C9JQrPo04zhuqXG8I1gnXo9IkUDojZ1BPx7m/4 Qm2pDgizfP0Ie3C2RdlKAJICZKbR7TvOe8/ncAHorXI9SvZ8ovn/7uhnil0wM2L3wV54 iXIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=itG2a4bwnhs35GWqvL4VstaVYBlrxvBaIzat8LJcVl4=; b=v8g/6GDTXkqdfcQb/2wj1mSwCNTuLmUjNGFLxpW+TWrkp/xAiVlpbGJz5X4a+8cRcD YSV5ItKxP4QOdtJKkDgpvN4/uEhVuW7sPdLDj4XMHYDNW5w7hWkSHOo62AeB5CORDQW4 Jpm9Abli7W7C3k0a2MUcdsCRIU6VkOhTexAr9Y5iXXujSHK+CYYpy86/L8a6sgeGe1Ey v2tf0k0bqZWMALv0KUeOrz61BTmHPPlatt2zSV9B088k7b5h2O5jH+61dyzo9isbgLOH 2PFsBWHb40kXVZMKph++e3+lDtDc3ovxocGnL/vkOb1zh5ZB9lcVO+oKSuUd3pLo6jl+ pj2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e7G14jLJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x24si12173858pge.709.2017.10.04.20.11.39; Wed, 04 Oct 2017 20:11:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e7G14jLJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751430AbdJEDLh (ORCPT + 26 others); Wed, 4 Oct 2017 23:11:37 -0400 Received: from mail-pg0-f52.google.com ([74.125.83.52]:45461 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751345AbdJEDLe (ORCPT ); Wed, 4 Oct 2017 23:11:34 -0400 Received: by mail-pg0-f52.google.com with SMTP id b192so4494340pga.2 for ; Wed, 04 Oct 2017 20:11:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=itG2a4bwnhs35GWqvL4VstaVYBlrxvBaIzat8LJcVl4=; b=e7G14jLJkcS8ujZ+VUyutV39UZfWihc2JGekOCUHsWla3FglwXFnW9NTtBgA82I6UU jSOfx7SeWzC+VfghKtWZ8JoDLXVGlHpnzb7fkkl5vltzHn4igjZXaTrsaEoOhoxFoU2N xIwz3+8bTmexWOZAAqhiKmTM/1NqAJQRgtTBs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=itG2a4bwnhs35GWqvL4VstaVYBlrxvBaIzat8LJcVl4=; b=bJz4zDBUZx0SfnrueVa/GZ1KRSGC7v3VlfpdTehFu9ZHuo2TuaJIsJ2i4/8uUHuW6L GDj7Xq4B8I5X2oPJ7nf3bhMTpcUbx6L+9BXx6qOFvyVBCxy3dG/uUKphjI7BjN+ezghW w6JLUBQfS2Ic9jB6d8iJVg2Bs3C/ovyf4QY/pv4jcAw+UZXFIyuJ8DOtsEneS0ybukVJ VjsERXsXb2TedihXu3sFKMFNNNN71DHDvvm2X1cb8f2T/tAEPaRdWT2/0TQTHI4HONf2 G8mv5JuxQF5w0i5gDzoOwZbHtPNYpumw3FJ5BGTwC0cxvBqwxeu/2OeknqbjuQDn30SR 6svw== X-Gm-Message-State: AHPjjUgpdpncP+Oeh2kwLiQJl2jfu0UEemrSIu8RlRzZncAtmpnBYcTI E3ux/VT1TGHviv14ywBeQmQGJg== X-Google-Smtp-Source: AOwi7QDA12A5OxSIFAI3xPoGdsHyXz1ClhUZjzY+WPr3PzYaRP8VFIMQRJzJAU1wLi+wXkuJnQ3Scg== X-Received: by 10.84.129.193 with SMTP id b59mr22269700plb.30.1507173093326; Wed, 04 Oct 2017 20:11:33 -0700 (PDT) Received: from localhost.localdomain (ip68-111-217-79.sd.sd.cox.net. [68.111.217.79]) by smtp.gmail.com with ESMTPSA id 11sm10514877pfs.187.2017.10.04.20.11.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 20:11:32 -0700 (PDT) From: Bjorn Andersson To: Andy Gross , David Brown Cc: Stephen Boyd , Arun Kumar Neelakantam , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/2] soc: qcom: smem: Rename "uncached" accessors Date: Wed, 4 Oct 2017 20:11:27 -0700 Message-Id: <20171005031128.11658-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171005031128.11658-1-bjorn.andersson@linaro.org> References: <20171005031128.11658-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation for adding accessors for "cached" entries rename the "uncached" accessors. Also rename "first" cached entry to "last", as the cached list grows backwards. Signed-off-by: Bjorn Andersson --- Changes since v2: - Updated commit message, per Stephen's review. Chances since v1: - None drivers/soc/qcom/smem.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) -- 2.12.0 diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index 18ec52f2078a..b451dbc4aa39 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -245,14 +245,14 @@ struct qcom_smem { }; static struct smem_private_entry * -phdr_to_last_private_entry(struct smem_partition_header *phdr) +phdr_to_last_uncached_entry(struct smem_partition_header *phdr) { void *p = phdr; return p + le32_to_cpu(phdr->offset_free_uncached); } -static void *phdr_to_first_cached_entry(struct smem_partition_header *phdr) +static void *phdr_to_last_cached_entry(struct smem_partition_header *phdr) { void *p = phdr; @@ -260,7 +260,7 @@ static void *phdr_to_first_cached_entry(struct smem_partition_header *phdr) } static struct smem_private_entry * -phdr_to_first_private_entry(struct smem_partition_header *phdr) +phdr_to_first_uncached_entry(struct smem_partition_header *phdr) { void *p = phdr; @@ -268,7 +268,7 @@ phdr_to_first_private_entry(struct smem_partition_header *phdr) } static struct smem_private_entry * -private_entry_next(struct smem_private_entry *e) +uncached_entry_next(struct smem_private_entry *e) { void *p = e; @@ -276,7 +276,7 @@ private_entry_next(struct smem_private_entry *e) le32_to_cpu(e->size); } -static void *entry_to_item(struct smem_private_entry *e) +static void *uncached_entry_to_item(struct smem_private_entry *e) { void *p = e; @@ -300,9 +300,9 @@ static int qcom_smem_alloc_private(struct qcom_smem *smem, void *cached; phdr = smem->partitions[host]; - hdr = phdr_to_first_private_entry(phdr); - end = phdr_to_last_private_entry(phdr); - cached = phdr_to_first_cached_entry(phdr); + hdr = phdr_to_first_uncached_entry(phdr); + end = phdr_to_last_uncached_entry(phdr); + cached = phdr_to_last_cached_entry(phdr); while (hdr < end) { if (hdr->canary != SMEM_PRIVATE_CANARY) { @@ -315,7 +315,7 @@ static int qcom_smem_alloc_private(struct qcom_smem *smem, if (le16_to_cpu(hdr->item) == item) return -EEXIST; - hdr = private_entry_next(hdr); + hdr = uncached_entry_next(hdr); } /* Check that we don't grow into the cached region */ @@ -460,8 +460,8 @@ static void *qcom_smem_get_private(struct qcom_smem *smem, struct smem_private_entry *e, *end; phdr = smem->partitions[host]; - e = phdr_to_first_private_entry(phdr); - end = phdr_to_last_private_entry(phdr); + e = phdr_to_first_uncached_entry(phdr); + end = phdr_to_last_uncached_entry(phdr); while (e < end) { if (e->canary != SMEM_PRIVATE_CANARY) { @@ -476,10 +476,10 @@ static void *qcom_smem_get_private(struct qcom_smem *smem, *size = le32_to_cpu(e->size) - le16_to_cpu(e->padding_data); - return entry_to_item(e); + return uncached_entry_to_item(e); } - e = private_entry_next(e); + e = uncached_entry_next(e); } return ERR_PTR(-ENOENT); From patchwork Thu Oct 5 03:11:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 114826 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp119149qgn; Wed, 4 Oct 2017 20:11:52 -0700 (PDT) X-Received: by 10.101.74.4 with SMTP id s4mr4733971pgq.259.1507173112616; Wed, 04 Oct 2017 20:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507173112; cv=none; d=google.com; s=arc-20160816; b=BS9qSzRkCEOZ4GMOyCjcpb78E3AbRK74gjDgnaSUSNlacAB1poLb+tfQt3IfjJvw28 NxXCucD61S1qrJON3+kdz/UbY/e4bEmG6McU5sUwWfkQX+viTD46Tew1tBX7OHEsAZbx 2nLscR6UYWEZ6EkRXbwFeS6pGXbYkP0RhK0KfU+Sl+1qWuaNKrv+CSAvMealwQzT+bpV IoPN9TEKyKgFKf8lqCBMOYAAd+sCDcpzm+1DNSuR5ZIOcou0klz2TdttPiEx9Ovhzzbj MzDgrrcuhhOy+pfgqRemDuK/+pT4EDhRgf9GFOVi8XUiVf3UF1xa1sk3e6CgX6U1QTFX bNwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=099HmhZ0hEYYpjtrzSS0frSL3NWdbxPHjcW4nmrAHnM=; b=zf4lugeSRxOfESHZ4X1iXCbdDsXRdR13SmFyuJtt2iG+l5OudO8Ud0ZH403aYMCh1P 34P80S0eNUTTU1roAuzzuHpIWpdoLs2j5hhz/gjggxtKWmyOIgUSWXwFcNjbcDWxyLsc 3RZ1kWNHoUfNI15vh61EgtjTl1zUMcdi0ObtFH6QSRJ7GujettsayLnD/6Ku8P+Ll0ph avwBZABPo5kpw8IimL6bGYtRyspobf8/JiS/kV78Udbf6LXiRXz+uopEpFD/k1D6hSLS 4f8iEei22syb30PYLt1VGDrDj+x8YcNkp/njdOomh2xuXPUPKOwCSLZu8ej1i+h8WRp+ wPEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kY/5OPEi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si4165505plt.334.2017.10.04.20.11.52; Wed, 04 Oct 2017 20:11:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kY/5OPEi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751474AbdJEDLu (ORCPT + 26 others); Wed, 4 Oct 2017 23:11:50 -0400 Received: from mail-pg0-f41.google.com ([74.125.83.41]:47480 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751398AbdJEDLf (ORCPT ); Wed, 4 Oct 2017 23:11:35 -0400 Received: by mail-pg0-f41.google.com with SMTP id r25so5186586pgn.4 for ; Wed, 04 Oct 2017 20:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=099HmhZ0hEYYpjtrzSS0frSL3NWdbxPHjcW4nmrAHnM=; b=kY/5OPEiC8uMH+K9HwbRzHzwYQljzQvwcKKPIBkupK+oo+knktHp+/3/7Pzy9793EU utZNwvsMpQpZP6CQjHF4sFzjR1JLnJikbNT6djH3K1QPgZJvS6FSAJJHijKvxRagyuBw JuoGZawFirbgkjGghDDWUMYRv4+JckgG4+Ma0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=099HmhZ0hEYYpjtrzSS0frSL3NWdbxPHjcW4nmrAHnM=; b=UObY625+jRPK9dBXZrvTvIpUKeu4unAsQv/nf1ui6xszK/mkPGly24IyX0rHfs3AuF k9L2BPrHyA47JBa9muC3MnFt6QzpCkAQGlLW8YhHW4E1QwAM3AKoyvjcR3/oIMqgdyBU gYQZ4Kf+oAyLoH7RGtN87d7bLykSeWcymiAZt/D1PL2octGFlEXoSXf70ISF7osQUddW AtIncNKDoemum5Zya3GNRoHdRa3OqeQN1PL+5tGRvcD4rg7g0OIg3A1R1Icn+MUIFpEX ofNUAoAwnk8oai4wScI1JZHJarM23U8HOdPbi+mBFynOypV215TbLcPUVphh2iGT4kUz 2NiA== X-Gm-Message-State: AHPjjUjdL+hIVsweNJ5M0cnXHd2xg+oGDC0AsRFKd7igSYgX86F6oALk ppAjLV+QHWr9TdHMn1XgwPXsbg== X-Google-Smtp-Source: AOwi7QBMY1/SiPdxJKaZU4WKdJAX33/mwbCBme/67SG/igoYdeyDojL0ee9hfow1/66g1YbWIKqpqQ== X-Received: by 10.84.130.67 with SMTP id 61mr22110875plc.131.1507173094579; Wed, 04 Oct 2017 20:11:34 -0700 (PDT) Received: from localhost.localdomain (ip68-111-217-79.sd.sd.cox.net. [68.111.217.79]) by smtp.gmail.com with ESMTPSA id 11sm10514877pfs.187.2017.10.04.20.11.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 20:11:33 -0700 (PDT) From: Bjorn Andersson To: Andy Gross , David Brown Cc: Stephen Boyd , Arun Kumar Neelakantam , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/2] soc: qcom: smem: Support getting cached entries Date: Wed, 4 Oct 2017 20:11:28 -0700 Message-Id: <20171005031128.11658-3-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171005031128.11658-1-bjorn.andersson@linaro.org> References: <20171005031128.11658-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On msm8996 cached SMEM items are used for storing the GLINK FIFOs, so for items not found in the uncached list we need to also search the cased list for these items. Signed-off-by: Bjorn Andersson --- Changes since v2: - None Changes since v1: - phdr_to_first_cached_entry() endian conversion - e->size is a le32, not le16 drivers/soc/qcom/smem.c | 69 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 8 deletions(-) -- 2.12.0 Reviewed-by: Stephen Boyd diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index b451dbc4aa39..c28275be0038 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -52,7 +52,8 @@ * * Items in the non-cached region are allocated from the start of the partition * while items in the cached region are allocated from the end. The free area - * is hence the region between the cached and non-cached offsets. + * is hence the region between the cached and non-cached offsets. The header of + * cached items comes after the data. * * * To synchronize allocations in the shared memory heaps a remote spinlock must @@ -140,6 +141,7 @@ struct smem_header { * @flags: flags for the partition (currently unused) * @host0: first processor/host with access to this partition * @host1: second processor/host with access to this partition + * @cacheline: alignment for "cached" entries * @reserved: reserved entries for later use */ struct smem_ptable_entry { @@ -148,7 +150,8 @@ struct smem_ptable_entry { __le32 flags; __le16 host0; __le16 host1; - __le32 reserved[8]; + __le32 cacheline; + __le32 reserved[7]; }; /** @@ -230,6 +233,7 @@ struct smem_region { * @hwlock: reference to a hwspinlock * @partitions: list of pointers to partitions affecting the current * processor/host + * @cacheline: list of cacheline sizes for each host * @num_regions: number of @regions * @regions: list of the memory regions defining the shared memory */ @@ -239,6 +243,7 @@ struct qcom_smem { struct hwspinlock *hwlock; struct smem_partition_header *partitions[SMEM_HOST_COUNT]; + size_t cacheline[SMEM_HOST_COUNT]; unsigned num_regions; struct smem_region regions[0]; @@ -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 + le32_to_cpu(phdr->size) - ALIGN(sizeof(*phdr), cacheline); +} + 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 - le32_to_cpu(e->size); +} + /* Pointer to the one and only smem handle */ static struct qcom_smem *__smem; @@ -458,18 +486,17 @@ static void *qcom_smem_get_private(struct qcom_smem *smem, { struct smem_partition_header *phdr; struct smem_private_entry *e, *end; + size_t cacheline; phdr = smem->partitions[host]; + cacheline = smem->cacheline[host]; + e = phdr_to_first_uncached_entry(phdr); end = phdr_to_last_uncached_entry(phdr); while (e < end) { - if (e->canary != SMEM_PRIVATE_CANARY) { - dev_err(smem->dev, - "Found invalid canary in host %d partition\n", - host); - return ERR_PTR(-EINVAL); - } + if (e->canary != SMEM_PRIVATE_CANARY) + goto invalid_canary; if (le16_to_cpu(e->item) == item) { if (size != NULL) @@ -482,7 +509,32 @@ static void *qcom_smem_get_private(struct qcom_smem *smem, e = uncached_entry_next(e); } + /* Item was not found in the uncached list, search the cached list */ + + e = phdr_to_first_cached_entry(phdr, cacheline); + end = phdr_to_last_cached_entry(phdr); + + while (e > end) { + if (e->canary != SMEM_PRIVATE_CANARY) + goto invalid_canary; + + if (le16_to_cpu(e->item) == item) { + if (size != NULL) + *size = le32_to_cpu(e->size) - + le16_to_cpu(e->padding_data); + + return cached_entry_to_item(e); + } + + e = cached_entry_next(e, cacheline); + } + return ERR_PTR(-ENOENT); + +invalid_canary: + dev_err(smem->dev, "Found invalid canary in host %d partition\n", host); + + return ERR_PTR(-EINVAL); } /** @@ -659,6 +711,7 @@ static int qcom_smem_enumerate_partitions(struct qcom_smem *smem, } smem->partitions[remote_host] = header; + smem->cacheline[remote_host] = le32_to_cpu(entry->cacheline); } return 0;