From patchwork Sat Feb 23 08:48:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 1047324 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="bemWZ7Bm"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44621n5bGlz9sDL for ; Sat, 23 Feb 2019 19:49:01 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727168AbfBWIs5 (ORCPT ); Sat, 23 Feb 2019 03:48:57 -0500 Received: from mail-eopbgr00050.outbound.protection.outlook.com ([40.107.0.50]:8064 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726043AbfBWIs4 (ORCPT ); Sat, 23 Feb 2019 03:48:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GAf4nhmHdLry0AG8wO4p2T0U5PDrNaQsC8bzTBBaMpg=; b=bemWZ7Bmh9+3JHQfTz5fYi37d2WtKe7qDwPACf+jIq71xtsli0opBn+p+8+loXU+GeNviSYWr3CoOECO0OORTq4fGBTZljTdQEATYuxATiWNP5jWc73o41nCJSPHEPQ93g9EauIBLkLXjg3fXHA2BiTr4O2B1h6S43iGQOWq10Q= Received: from VI1PR0402MB2800.eurprd04.prod.outlook.com (10.172.255.18) by VI1PR0402MB3855.eurprd04.prod.outlook.com (52.134.16.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.15; Sat, 23 Feb 2019 08:48:52 +0000 Received: from VI1PR0402MB2800.eurprd04.prod.outlook.com ([fe80::74fe:7d24:1e75:3477]) by VI1PR0402MB2800.eurprd04.prod.outlook.com ([fe80::74fe:7d24:1e75:3477%5]) with mapi id 15.20.1643.019; Sat, 23 Feb 2019 08:48:52 +0000 From: Ioana Ciornei To: Leo Li CC: Roy Pledge , Ioana Ciocoi Radulescu , Laurentiu Tudor , Horia Geanta , "brouer@redhat.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Ioana Ciornei Subject: [PATCH 2/3] soc: fsl: dpio: configure cache stashing destination Thread-Topic: [PATCH 2/3] soc: fsl: dpio: configure cache stashing destination Thread-Index: AQHUy1Sa6XcjNUTofUqAEtVAuu5zgw== Date: Sat, 23 Feb 2019 08:48:52 +0000 Message-ID: <20190223084816.28985-3-ioana.ciornei@nxp.com> References: <20190223084816.28985-1-ioana.ciornei@nxp.com> In-Reply-To: <20190223084816.28985-1-ioana.ciornei@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN6PR04CA0061.namprd04.prod.outlook.com (2603:10b6:805:2a::38) To VI1PR0402MB2800.eurprd04.prod.outlook.com (2603:10a6:800:ad::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=ioana.ciornei@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.8.3 x-originating-ip: [64.157.242.222] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d81edf30-b85d-4511-b68b-08d6996bbc78 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0402MB3855; x-ms-traffictypediagnostic: VI1PR0402MB3855: x-microsoft-exchange-diagnostics: =?iso-8859-1?q?1=3BVI1PR0402MB3855=3B23?= =?iso-8859-1?q?=3A/eiDqIDdsQJlbrCdPNTqXS6GlpmasHhg58THeDvHb2xDaBgg?= =?iso-8859-1?q?hb4S46b3wZumKkNNJ5KE+yjOeltMxhwA4RA5AhqA1RBPgts61Xo?= =?iso-8859-1?q?eodOLFosLH6VKi3eGvxDGbQNoO6slQY20GPgAMzApq8cf4IrzHE?= =?iso-8859-1?q?ZQFBm01Xpa8TxATq+A/ObQcuD/fNUnjXt/n4ybdR7Xla3co07Le?= =?iso-8859-1?q?YRulgUx/TSz9e682GJ++sJIt3pGBtFLqvPAPGanYqzLrkPqdZ7L?= =?iso-8859-1?q?MmSgzVL14NI/4GawT9Sj0s9V2iKCthCdeCOjkpTFzI6s3QKTihK?= =?iso-8859-1?q?DpNtiiB+3zQq1w6fxAAB0pBiLKBBFF2ez6e2zXqLVuuwhTGGkQ+?= =?iso-8859-1?q?H9XmtsrxWaP2P942rerBDSVztbdCeXy1RYV1n+/RpJzmuP5NgoB?= =?iso-8859-1?q?2G8QJF9B6Ls0eNBcQ7Yp3hHB5gR15kXVpSW2NUSzYYV409WDkZR?= =?iso-8859-1?q?RqkyBF3Vo9nU1ghtFMa2SljzKww5zX/TLFlqHohM/pHNNYF6LOP?= =?iso-8859-1?q?XNn0A73nr4wtKi8zqZEkGy82sSB3itEvNyG2JgWtNQwJWDnDq3/?= =?iso-8859-1?q?24m+HAl7fr34xpkpuaWYGGMyDp7rZuj5Jvh+5NNbNxDfWOyyyeZ?= =?iso-8859-1?q?lBZZaJAMkCF53A1U+othwFuezzbN/FzInqqZEKwi7yc2SaqYBNC?= =?iso-8859-1?q?3MJJz6hKDNZ1yjKLZrLlTMiQVzycC6ZjoNTSjIqLwqMxKTH0JUG?= =?iso-8859-1?q?XLfzdeSyYvSxgAXQ9IWd4W5xQa72zcoOf5BDuiwwBQLrrrNkOw0?= =?iso-8859-1?q?PqXpuanm2WSHdaRD3nXdvAsfo3fWFspd3rDoQTk6TpaeLBj7cZo?= =?iso-8859-1?q?H4HdCW2l0ba2hxKjkkwtivya6nqtDHRFkPsxZ5C52IGs77Lf6hQ?= =?iso-8859-1?q?5ESXRKLWFr31k7twluXTmSHoom2hCtRsl5rnvRz9vJdwWILfrzH?= =?iso-8859-1?q?aAoBTy7fqwFhD2EXOpl1TOjJ4BPR36jlwhnKny44c/cCujqIILF?= =?iso-8859-1?q?GNtnjCxiRDtQLsW1rctsw/KTc6Uk4ylPgs3l3ZKIQDRWnfSiXqI?= =?iso-8859-1?q?ci2T7pJ3zDLPrI1oAH7NUbTvao/wl6OMsqbGrHpHLvKw1DBh9ON?= =?iso-8859-1?q?Hjg2Jua2q4mKimfM0/z3A6Q5oFcSez63RX9Gh0hMG3BRxzhjaNa?= =?iso-8859-1?q?cQqFeV2Sv5PN/29B6YsOBbxic8m3sRjQBEKadU4TdrXXvtrgR7G?= =?iso-8859-1?q?cjOB2IUFe2eGsO0ySRVVLDXV16/hMQjuyhVUB4xq/MZcieMribg?= =?iso-8859-1?q?dgmat16HcUdvQ2Z9JGjvBPAyjC/Jc5jM/LZEElp4do/I5gd3asS?= =?iso-8859-1?q?Jls+umUg?= x-microsoft-antispam-prvs: x-forefront-prvs: 0957AD37A0 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(136003)(39860400002)(376002)(396003)(346002)(189003)(199004)(486006)(14454004)(50226002)(71190400001)(26005)(11346002)(44832011)(186003)(2616005)(478600001)(71200400001)(99286004)(52116002)(68736007)(4326008)(102836004)(2906002)(25786009)(446003)(476003)(76176011)(6636002)(6862004)(105586002)(6506007)(6436002)(54906003)(386003)(8936002)(3846002)(305945005)(8676002)(37006003)(6486002)(86362001)(5660300002)(106356001)(53936002)(256004)(7736002)(97736004)(6512007)(66066001)(36756003)(316002)(81166006)(6116002)(1076003)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0402MB3855; H:VI1PR0402MB2800.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: /uybtH3vYCVOlZFtezoGUkj8WpSFcctl2qSnYZhVqZ08qdmBg99tvUBW2HRpc+yJlqTEa8h2nLtDB36g+u77KKN0CkSpq1qfh3nW3CM1bheBqFnUGnJYpEsu92oEzvq/nppJ+I55oH4Do++gbwUebLQoUV3Qkc3yfNoXbomL/WWpaXLIYAZNGKcz+exSvGjwuBMWVF97AWUOzsYCH1J29I6pgZy6/PKN/T8VRsQL4sBurNN9YGMs0Gb49p02Sw/10M6m6R0zl0wjAJUCyw0EjUUR7q87qzyJB34LRxqivAapIvO7YFP1lt6MAocCop+OAG9jFtaQlBkwUiX0w6gJzjA0+mHqlt/rrSt6NrvkH7j3ksQxESCKCrV6Z+mISSCRZlhlymn9O2eKz+7OAR3teEs3Ism0sB+0gVTdthg5Cz0= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d81edf30-b85d-4511-b68b-08d6996bbc78 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Feb 2019 08:48:50.6639 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3855 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Depending on the SoC version and the CPU id, configure the cache stashing destination for a specific dpio. Signed-off-by: Ioana Ciornei --- drivers/soc/fsl/Kconfig | 1 + drivers/soc/fsl/dpio/dpio-cmd.h | 5 ++++ drivers/soc/fsl/dpio/dpio-driver.c | 52 ++++++++++++++++++++++++++++++++++++++ drivers/soc/fsl/dpio/dpio.c | 16 ++++++++++++ drivers/soc/fsl/dpio/dpio.h | 5 ++++ 5 files changed, 79 insertions(+) diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig index 8f80e8b..61f8e14 100644 --- a/drivers/soc/fsl/Kconfig +++ b/drivers/soc/fsl/Kconfig @@ -22,6 +22,7 @@ config FSL_GUTS config FSL_MC_DPIO tristate "QorIQ DPAA2 DPIO driver" depends on FSL_MC_BUS + select SOC_BUS help Driver for the DPAA2 DPIO object. A DPIO provides queue and buffer management facilities for software to interact with diff --git a/drivers/soc/fsl/dpio/dpio-cmd.h b/drivers/soc/fsl/dpio/dpio-cmd.h index 5814d2f..e13fd3a 100644 --- a/drivers/soc/fsl/dpio/dpio-cmd.h +++ b/drivers/soc/fsl/dpio/dpio-cmd.h @@ -26,6 +26,7 @@ #define DPIO_CMDID_DISABLE DPIO_CMD(0x003) #define DPIO_CMDID_GET_ATTR DPIO_CMD(0x004) #define DPIO_CMDID_RESET DPIO_CMD(0x005) +#define DPIO_CMDID_SET_STASHING_DEST DPIO_CMD(0x120) struct dpio_cmd_open { __le32 dpio_id; @@ -47,4 +48,8 @@ struct dpio_rsp_get_attr { __le32 qbman_version; }; +struct dpio_stashing_dest { + u8 sdest; +}; + #endif /* _FSL_DPIO_CMD_H */ diff --git a/drivers/soc/fsl/dpio/dpio-driver.c b/drivers/soc/fsl/dpio/dpio-driver.c index a28799b..c0cdc89 100644 --- a/drivers/soc/fsl/dpio/dpio-driver.c +++ b/drivers/soc/fsl/dpio/dpio-driver.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -32,6 +33,46 @@ struct dpio_priv { static cpumask_var_t cpus_unused_mask; +static const struct soc_device_attribute ls1088a_soc[] = { + {.family = "QorIQ LS1088A"}, + { /* sentinel */ } +}; + +static const struct soc_device_attribute ls2080a_soc[] = { + {.family = "QorIQ LS2080A"}, + { /* sentinel */ } +}; + +static const struct soc_device_attribute ls2088a_soc[] = { + {.family = "QorIQ LS2088A"}, + { /* sentinel */ } +}; + +static const struct soc_device_attribute lx2160a_soc[] = { + {.family = "QorIQ LX2160A"}, + { /* sentinel */ } +}; + +static int dpaa2_dpio_get_cluster_sdest(struct fsl_mc_device *dpio_dev, int cpu) +{ + int cluster_base, cluster_size; + + if (soc_device_match(ls1088a_soc)) { + cluster_base = 2; + cluster_size = 4; + } else if (soc_device_match(ls2080a_soc) || + soc_device_match(ls2088a_soc) || + soc_device_match(lx2160a_soc)) { + cluster_base = 0; + cluster_size = 2; + } else { + dev_err(&dpio_dev->dev, "unknown SoC version\n"); + return -1; + } + + return cluster_base + cpu / cluster_size; +} + static irqreturn_t dpio_irq_handler(int irq_num, void *arg) { struct device *dev = (struct device *)arg; @@ -89,6 +130,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) int err = -ENOMEM; struct device *dev = &dpio_dev->dev; int possible_next_cpu; + int sdest; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -145,6 +187,16 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) desc.cpu = possible_next_cpu; cpumask_clear_cpu(possible_next_cpu, cpus_unused_mask); + sdest = dpaa2_dpio_get_cluster_sdest(dpio_dev, desc.cpu); + if (sdest >= 0) { + err = dpio_set_stashing_destination(dpio_dev->mc_io, 0, + dpio_dev->mc_handle, + sdest); + if (err) + dev_err(dev, "dpio_set_stashing_destination failed for cpu%d\n", + desc.cpu); + } + /* * Set the CENA regs to be the cache inhibited area of the portal to * avoid coherency issues if a user migrates to another core. diff --git a/drivers/soc/fsl/dpio/dpio.c b/drivers/soc/fsl/dpio/dpio.c index 521bc69..af74c59 100644 --- a/drivers/soc/fsl/dpio/dpio.c +++ b/drivers/soc/fsl/dpio/dpio.c @@ -166,6 +166,22 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io, return 0; } +int dpio_set_stashing_destination(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 sdest) +{ + struct fsl_mc_command cmd = { 0 }; + struct dpio_stashing_dest *dpio_cmd; + + cmd.header = mc_encode_cmd_header(DPIO_CMDID_SET_STASHING_DEST, + cmd_flags, token); + dpio_cmd = (struct dpio_stashing_dest *)cmd.params; + dpio_cmd->sdest = sdest; + + return mc_send_command(mc_io, &cmd); +} + /** * dpio_get_api_version - Get Data Path I/O API version * @mc_io: Pointer to MC portal's DPIO object diff --git a/drivers/soc/fsl/dpio/dpio.h b/drivers/soc/fsl/dpio/dpio.h index b2ac4ba..da06f72 100644 --- a/drivers/soc/fsl/dpio/dpio.h +++ b/drivers/soc/fsl/dpio/dpio.h @@ -75,6 +75,11 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io, u16 token, struct dpio_attr *attr); +int dpio_set_stashing_destination(struct fsl_mc_io *mc_io, + u32 cmd_flags, + u16 token, + u8 dest); + int dpio_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 *major_ver,