Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965163AbcKQSI6 (ORCPT ); Thu, 17 Nov 2016 13:08:58 -0500 Received: from mail-co1nam03on0059.outbound.protection.outlook.com ([104.47.40.59]:57312 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S964845AbcKQSIx (ORCPT ); Thu, 17 Nov 2016 13:08:53 -0500 From: Rafal Ozieblo To: Nicolas Ferre , Harini Katakam CC: "harini.katakam@xilinx.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [RFC PATCH 2/2] net: macb: Add 64 bit addressing support for GEM Thread-Topic: [RFC PATCH 2/2] net: macb: Add 64 bit addressing support for GEM Thread-Index: AQHSQM0mlMF9RYMdA0O6HcZ/ouUay6DdK3SAgAAAdXA= Date: Thu, 17 Nov 2016 13:35:28 +0000 Message-ID: References: In-Reply-To: Accept-Language: pl-PL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=rafalo@cadence.com; x-originating-ip: [213.131.238.28] x-microsoft-exchange-diagnostics: 1;BN3PR07MB2516;7:dKyr6hnEiq5Hqe3pTWxFqTB3fSxB5Vf9IscTcwNlBQylVzMSb0yzzBPlv+/YqKERKJdaANii1Y8cNHg5eores0CMrAzyZmImwhalyBXuiEsb/pV5JFQCHD4Mf6vLntSFi/UwTEIU/kR7BcxTIOgKsBOF6wXA5ErNkUAU8t3ZK/rtYhxIIPSsWlOPdZJCcgDROjzHU/4qEIQTZ8MjbDmtgzYbCRMgJ3hgDYTTrLmfBilCDrsPNFc8vPpGqMR5bLpYy06KGSIzMF95ZU2HavRPUHAYjiuQe2DIiyh2rRjn0k9i6536Znsalr9cJCyXd1P+7HU6R1Dn0vzyroV82S4RCHREOAdOaI/0yo6HzdTU+fY=;20:e/kHIy5yBJNVY9Wwv3m8KrFerYKo5RorYsgJiOXkEMqKpsW48z/aL1Arb2ZZnsCY8tlw+QooOpUeN7XKNzaIZ25aaKKqw9oJadaOs+0VtYmBZ3/jedhY/n/bgSKxptLafCQsG2RprghndJbLupjY4/jfbFpNN9aCGmHFbIJE2e2Xj3V8wqV9IWPK9+QBDw7zJFNwQ3uvKllN+SYQ1CmEyrDcDHH2Bh0HSvCYqJlH2s81mrTfjuE8Qy96bqGfAN1r x-ms-office365-filtering-correlation-id: 8733248a-d428-4bf6-5609-08d40eee9854 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN3PR07MB2516; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(192813158149592)(72806322054110); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040281)(6060326)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041223)(6061324);SRVR:BN3PR07MB2516;BCL:0;PCL:0;RULEID:;SRVR:BN3PR07MB2516; x-forefront-prvs: 01294F875B x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(7916002)(189002)(199003)(377454003)(36092001)(24454002)(13464003)(9686002)(8936002)(3280700002)(3660700001)(81156014)(81166006)(101416001)(189998001)(6506003)(87936001)(50986999)(76176999)(54356999)(229853002)(5001770100001)(97736004)(2906002)(4326007)(102836003)(6116002)(3846002)(2900100001)(77096005)(92566002)(122556002)(66066001)(106356001)(106116001)(99286002)(105586002)(68736007)(76576001)(5660300001)(74316002)(7846002)(7736002)(305945005)(8666005)(2950100002)(7696004)(8676002)(86362001)(33656002)(7059030)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR07MB2516;H:BN3PR07MB2516.namprd07.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Nov 2016 13:35:28.3659 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2516 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id uAHI96LP012787 Content-Length: 2870 Lines: 63 -----Original Message----- From: Nicolas Ferre [mailto:nicolas.ferre@atmel.com] Sent: 17 listopada 2016 14:29 To: Harini Katakam; Rafal Ozieblo Cc: harini.katakam@xilinx.com; netdev@vger.kernel.org; linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 2/2] net: macb: Add 64 bit addressing support for GEM > Le 17/11/2016 à 13:21, Harini Katakam a écrit : > > Hi Rafal, > > > > On Thu, Nov 17, 2016 at 5:20 PM, Rafal Ozieblo wrote: > >> Hello, > >> I think, there could a bug in your patch. > >> > >>> + > >>> +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT > >>> + dmacfg |= GEM_BIT(ADDR64); #endif > >> > >> You enable 64 bit addressing (64b dma bus width) always when appropriate architecture config option is enabled. > >> But there are some legacy controllers which do not support that feature. According Cadence hardware team: > >> "64 bit addressing was added in July 2013. Earlier version do not have it. > >> This feature was enhanced in release August 2014 to have separate upper address values for transmit and receive." > >> > >>> /* Bitfields in NSR */ > >>> @@ -474,6 +479,10 @@ > >>> struct macb_dma_desc { > >> > u32 addr; > >>> u32 ctrl; > >>> +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT > >>> + u32 addrh; > >>> + u32 resvd; > >>> +#endif > >>> }; > >> > >> It will not work for legacy hardware. Old descriptor is 2 words wide, the new one is 4 words wide. > >> If you enable CONFIG_ARCH_DMA_ADDR_T_64BIT but hardware doesn't > >> support it at all, you will miss every second descriptor. > >> > > > > True, this feature is not available in all of Cadence IP versions. > > In fact, the IP version Zynq does not support this. But the one in ZynqMP does. > > So, we enable kernel config for 64 bit DMA addressing for this SoC and > > hence the driver picks it up. My assumption was that if the legacy IP > > does not support > > 64 bit addressing, then this DMA option wouldn't be enabled. > > > > There is a design config register in Cadence IP which is being read to > > check for 64 bit address support - DMA mask is set based on that. > > But the addition of two descriptor words cannot be based on this runtime check. > > For this reason, all the static changes were placed under this check. > > We have quite a bunch of options in this driver to determinate what is the real capacity of the underlying hardware. > If HW configuration registers are not appropriate, and it seems they are not, I would advice to simply use the DT compatibility string. > > Best regards, > -- > Nicolas Ferre HW configuration registers are appropriate. The issue is that this code doesn’t use the capability bit to switch between different dma descriptors (2 words vs. 4 words). DMA descriptor size is chosen based on kernel configuration, not based on hardware capabilities. Regards, Rafal Ozieblo