From patchwork Thu Jan 10 13:49:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Pallardy X-Patchwork-Id: 155161 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1915816jaa; Thu, 10 Jan 2019 05:49:34 -0800 (PST) X-Google-Smtp-Source: ALg8bN5eOZsBo24I5HwRHDMzFU/K3ytGWcDCLqf9qiGEN52aRnTBnCvt9lCQWJOCbqp7CvVd2Bqg X-Received: by 2002:a63:1204:: with SMTP id h4mr9435310pgl.51.1547128174695; Thu, 10 Jan 2019 05:49:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547128174; cv=none; d=google.com; s=arc-20160816; b=D/mc5+unVM3eOWYcb3oczhcOcC7siUg+nd5S/lUoOrQXrh/7X8/+vcP+x7WnjliL0u 5yCOJl3vbGyuVQw1IEVqPEPUuO/kwlaDnMo9lyRjSATH8qpSFViSqTCSUEBMlSRX1GJF j5A04C2NVoCiE34pzyFzyv+/l3XNiCiG1NAQqbd0D09ZWejBBy30C50aYov83ak3EFQw KcUSlP++uwMEUVmjKikjCG3JYXASIVzhrY1ndaNWpVeYXCX14IJ+TQ61bvGlxDse8+zA pwkuwNHSDvuJpnwlfCXLpXzNNn6gZyOJEZ7OpRqQWJ5v+WAPnwxe9xs9opIGln7eRJxa fPSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=cI9A+allQFcEpqsaTSUhcuR3/wZymitu3e5NCjn3BsY=; b=LHRaZeOUNYukoC+PUoWUEpIdfC4UEhwG8BqBTJN6OHbrTuPHjKlSMKtO14uXCY9ZYT uu/1Y207N4bTgGxe+Bz3j7gEwBDnC5wE6j/cJ2+CnzUBOh7WpCZHDFh+QclorEPGItjG frsEOXcJZayUhKx/74lQu/kZ5rv3AKlfJ/MPp119hhy0p+iAHjqjcEBk9WN8qvPJoEqQ uU7Fcn5oTGnfIXZDQlf/F5iYK+3xKyTfxEOlX3sxezEU4ommy8dyAGrDvKt4c8u/9gIl wVz5RbcQqOeVpR/cl3g6/zm4mEAB8qiDGVCnScsIgv3jtjZL8ZGL67SubkV7uaU2MZ0Q uRoQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x8si9294437plo.259.2019.01.10.05.49.34; Thu, 10 Jan 2019 05:49:34 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729098AbfAJNtc (ORCPT + 31 others); Thu, 10 Jan 2019 08:49:32 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:32071 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729023AbfAJNt2 (ORCPT ); Thu, 10 Jan 2019 08:49:28 -0500 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0ADfOr8008990; Thu, 10 Jan 2019 14:49:24 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2ptwtdsw0u-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 10 Jan 2019 14:49:24 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E345234; Thu, 10 Jan 2019 13:49:23 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas22.st.com [10.75.90.92]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C6CEE504D; Thu, 10 Jan 2019 13:49:23 +0000 (GMT) Received: from SAFEX1HUBCAS21.st.com (10.75.90.45) by Safex1hubcas22.st.com (10.75.90.92) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 10 Jan 2019 14:49:23 +0100 Received: from localhost (10.201.20.178) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 10 Jan 2019 14:49:22 +0100 From: Loic Pallardy To: , CC: , , , , , Loic Pallardy Subject: [PATCH v2 4/7] remoteproc: add warning on resource table cast Date: Thu, 10 Jan 2019 14:49:08 +0100 Message-ID: <1547128151-44077-5-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547128151-44077-1-git-send-email-loic.pallardy@st.com> References: <1547128151-44077-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.20.178] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-10_05:, , signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Today resource table supports only 32bit address fields. This is not compliant with 64bit platform for which addresses are cast in 32bit. This patch adds warn messages when address cast is done. Signed-off-by: Loic Pallardy --- Changes from v1: - modify implementation to display warning message only when data are modified by cast operation --- drivers/remoteproc/remoteproc_core.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 18a1bbf820c9..0ecd37993f41 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -45,6 +45,8 @@ #include "remoteproc_internal.h" +#define HIGH_BITS_MASK 0xFFFFFFFF00000000ULL + static DEFINE_MUTEX(rproc_list_mutex); static LIST_HEAD(rproc_list); @@ -772,6 +774,10 @@ static int rproc_alloc_carveout(struct rproc *rproc, dev_dbg(dev, "carveout mapped 0x%x to %pad\n", mem->da, &dma); } else { + /* Update device address as undefined by requester */ + if ((u64)dma & HIGH_BITS_MASK) + dev_warn(dev, "DMA address cast in 32bit to fit resource table format\n"); + mem->da = (u32)dma; } @@ -1115,6 +1121,7 @@ static int rproc_alloc_registered_carveouts(struct rproc *rproc) struct rproc_mem_entry *entry, *tmp; struct fw_rsc_carveout *rsc; struct device *dev = &rproc->dev; + u64 pa; int ret; list_for_each_entry_safe(entry, tmp, &rproc->carveouts, node) { @@ -1151,10 +1158,15 @@ static int rproc_alloc_registered_carveouts(struct rproc *rproc) /* Use va if defined else dma to generate pa */ if (entry->va) - rsc->pa = (u32)rproc_va_to_pa(entry->va); + pa = (u64)rproc_va_to_pa(entry->va); else - rsc->pa = (u32)entry->dma; + pa = (u64)entry->dma; + + if (((u64)pa) & HIGH_BITS_MASK) + dev_warn(dev, + "Physical address cast in 32bit to fit resource table format\n"); + rsc->pa = (u32)pa; rsc->da = entry->da; rsc->len = entry->len; }