Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754583AbdCTUph (ORCPT ); Mon, 20 Mar 2017 16:45:37 -0400 Received: from mail-bn3nam01on0042.outbound.protection.outlook.com ([104.47.33.42]:59648 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753316AbdCTUpd (ORCPT ); Mon, 20 Mar 2017 16:45:33 -0400 Authentication-Results: cavium.com; dkim=none (message not signed) header.d=none;cavium.com; dmarc=none action=none header.from=caviumnetworks.com; Subject: Re: [PATCH v12 4/9] mmc: cavium: Work-around hardware bug on cn6xxx and cnf7xxx To: Ulf Hansson , Jan Glauber References: <20170310132507.32025-1-jglauber@cavium.com> <20170310132507.32025-5-jglauber@cavium.com> Cc: "linux-mmc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Steven J . Hill" , David Daney From: David Daney Message-ID: <6dc8a2a3-ca79-745a-c716-2188319b9378@caviumnetworks.com> Date: Mon, 20 Mar 2017 13:45:25 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: SN1PR07CA0022.namprd07.prod.outlook.com (10.162.170.160) To BL2PR07MB2417.namprd07.prod.outlook.com (10.167.101.141) X-MS-Office365-Filtering-Correlation-Id: fdb5373c-b56f-4820-5adf-08d46fd20af8 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BL2PR07MB2417; X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2417;3:m+O1Tz31BfP14xhpx6DUU74qAEQvzD4FJa6EorwMeAkwggkdYgl93M33vXBwmN3482czLdbg+51aUW43ynQ+YFi9Rk4/u+rETkBSkfZRQejTqPsFaNSKncrGyp6AYBkXciMtgWcman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nS27T04szA7dXgweuluG53xDSuIvnpE4wxf7QEd4K4f8VAclgAwQDaAtIQ3i7xXF7qQo291GqQuwsF3oFkWdWdHEwE+rR44d7wO8rDfAzWFcsZhnHMh2S7mH76LbhY+ThQhIVeIfJvAoIjX27Gs6C6/mUVtS+SRD7c4Iko/+wYLGbmhswvtZfVZOKOMwrah7wo5AvJ9TCHrYe7cRsvRl+v9opVEcmXcaKEVDWD7rKfmP7j02RTkNvdaFKnR4wbPCrU66jxV6ptp8W3pImanls0D91Vh0B1yMgpXQmmGkps3sL5EZhroPlPEgK6e4GrY27Uct04NL8x+o5G8GGx55s9CU9ieKnsYNORqSoY6koNXZGGpK7Jhl2O1cd4oVbuolsZp3ld8r0GqUMOxFoP9utlWlxW+8pmIV3jAsUxmt3iUOuAASjE5Eag6J+TuZOk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123555025)(20161123560025)(20161123564025)(20161123558025)(20161123562025)(6072148);SRVR:BL2PR07MB2417;BCL:0;PCL:0;RULEID:;SRVR:BL2PR07MB2417; X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2417;4:4eqN2SRJzvyPFa6z1NJlLnOtIWulkbqzbQl9qQAuLTq7ydu8S1qc7+rIGt39GGbeaSG0SS/tjsZqdvdvIKwLL4EywsiSaU7dNy8H9R5lCnK49lo59WQeImfY0fWL3RvLCAVp4ZthBfag47sNY4Vme76YLvU1DqUzs03QQRTsHzu/TJi7ItcpTB0GQnNuUqQ0QnucLq/5zhLsYUaypculvPBLqxY19DwlfHysnZjP1jCxI5M0tn1NFYF84HUpxYK1Th19vpY1NKqEKPQPqp4CJcCRVFuP6FWdiTnCoCHzuqxnAcYkur/CiZP6XgWXySSSYb4i9g87M3dB5Oo7KjTy9KJSHnNI0UFkMpON5MR37MfEvVC0SPn+OOysdMsWL2nMUyfxGKdwahdqarjp98KBZRQcyY0Q7TFfilImqV2EMmC0aF69BeX+TgYY5rMEN/2xp53BWvI7xyM1BjoMQFpMlU4EcgLwcQUBQMu8DK9r9OxUXqHLugLgrNHI6nAemfXUtIPfetqCEXcdBazws3fIx03pb9as8uFZk33UXJjFdsQQnDNvAB/e4GolOCdE0VcsEiyuWS1bFLYVqXfVRrp0ZcuYMDeDGarGtgnoXrWaprc= X-Forefront-PRVS: 02524402D6 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39830400002)(39450400003)(39410400002)(24454002)(377454003)(8676002)(47776003)(65956001)(65806001)(66066001)(5660300001)(305945005)(2950100002)(42882006)(229853002)(83506001)(6486002)(54906002)(6512007)(53546009)(6506006)(53936002)(25786008)(7736002)(81166006)(31696002)(230700001)(54356999)(4326008)(76176999)(23676002)(38730400002)(33646002)(189998001)(50986999)(6246003)(2906002)(64126003)(6116002)(50466002)(3846002)(36756003)(4001350100001)(42186005)(53416004)(31686004)(32563001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2PR07MB2417;H:ddl.caveonetworks.com;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTDJQUjA3TUIyNDE3OzIzOjNIQTVzdUQrdm9IMVY5Yi9vcGdYREpobm85?= =?utf-8?B?RkFCcEJiRExIN0dvSE1iZWt2elh2aTBHZ204V3V6ZzkzT2REamZVVzBrMWRX?= =?utf-8?B?RjZ5d0NZVUxvcUZ6R1c1TUsyVzZ3NjlaZjBCRlFBSWhvejJNTklLN1RmUkdl?= =?utf-8?B?dnhFMnB5UXlhcjQ3NktRaDVlbGZnYTFXQjFQYXdWZXlxMXdFUWNZTC90VFVr?= =?utf-8?B?NExHMnByY1E1d3FRT1RJd3ppNW9YdERBbkFQV3g5QW5rTnFyVVNxeWk1S1Zi?= =?utf-8?B?UmJFb0VQTnhINWhmRlJVZE1ydjd6dStHYTVBVjcy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t0To3oGemRTQb+HjRZUoGn5QUwEk2w==;24:d9u37Y0OT09Dq7xafxiVu+/PtFxWBI8rYlSwRuBdBv/MkwShsiqtx9GYXyuTFHisQVSKgBZUZhGtO5PbI++g/QdK21CjBZoV/mJ0y/Pj+gc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2417;7:tqXPuR1vL+yzkvkzPKBkNSQzV3n6xlvw56r7QmC1mP13By5F5pRoNZ4EH/xQPG+OEkSumBMW8v46kIsBT8sDXFRrvUnFq62hScT7lh54DE3eB1V7C62pk/6nwkaVkpOWr+WS/ir6M13SPrCGXgHFFCVP9WZB/Nfgk9g91ym++WfjHbbr1qdINPCpzFpQQKjhgAceso5eAtQYhmpv0UDfVDodV4BlRtuv7IawV9g1BUkyDnStxhpNBuV0Za1XXM60ErJ/vjapL37GvYDogTqjiIZnaWswtBKL02Bg9iqw1PLUHTj9MEnE2fo5JS9NjYeLgbcYNGKror2E30jYb+Hz1w== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2017 20:45:27.7961 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR07MB2417 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1745 Lines: 50 On 03/17/2017 07:13 AM, Ulf Hansson wrote: > On 10 March 2017 at 14:25, Jan Glauber wrote: >> Prevent data corruption on cn6xxx and cnf7xxx. >> Due to an imperfection in the design of the MMC bus hardware, >> the 2nd to last cache block of a DMA read must be locked into the L2 >> cache. >> [...] >> +/** >> + * Unlock a memory region in the L2 cache >> + * >> + * @start - start address to unlock >> + * @len - length to unlock in bytes >> + */ >> +void l2c_unlock_mem_region(u64 start, u64 len) >> +{ >> + u64 end; >> + >> + /* Round start/end to cache line boundaries */ >> + end = ALIGN(start + len - 1, CVMX_CACHE_LINE_SIZE); >> + start = ALIGN(start, CVMX_CACHE_LINE_SIZE); >> + >> + while (start <= end) { >> + l2c_unlock_line(start); >> + start += CVMX_CACHE_LINE_SIZE; >> + } >> +} >> +EXPORT_SYMBOL_GPL(l2c_unlock_mem_region); > > It seems like we should be able to implement these functions in the > octeon mmc driver, instead of having to export some SoC specific APIs. > You only need to figure out how to find the correct CACHE_LINE_SIZE, > but that should be possible to fix. It doesn't matter which source file the code lives in. If you are happy having it in drivers/mmc/host/cavium-pltfm-octeon.c (or whatever we end up calling the file), it could be put there. CVMX_CACHE_LINE_SIZE == 128. It will never change. > > My point is really that we should avoid exporting SoC specific APIs > which shall be called from drivers. This is old fashion. Some people find it objectionable to see 1-off architecture specific in-line asm in a driver file, but I agree that putting it as close to the user as possible makes sense. David Daney