Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752382AbdHOULi (ORCPT ); Tue, 15 Aug 2017 16:11:38 -0400 Received: from mx0a-00010702.pphosted.com ([148.163.156.75]:34405 "EHLO mx0b-00010702.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751031AbdHOULg (ORCPT ); Tue, 15 Aug 2017 16:11:36 -0400 Subject: Re: [PATCH] tpm_tis: fix stall after iowrite*()s To: Alexander Stein Cc: linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org, tpmdd-devel@lists.sourceforge.net, harisokn@gmail.com, julia.cartwright@ni.com, gratian.crisan@ni.com, scott.hartman@ni.com, chris.graf@ni.com, brad.mouring@ni.com, jonathan.david@ni.com, peterhuewe@gmx.de, tpmdd@selhorst.net, jarkko.sakkinen@linux.intel.com, jgunthorpe@obsidianresearch.com, eric.gardiner@ni.com References: <20170804215651.29247-1-haris.okanovic@ni.com> <20170814225347.30670-1-haris.okanovic@ni.com> <1619753.FtnHesjV4E@ws-stein> From: Haris Okanovic Message-ID: <64235ce1-f554-ba54-12ab-a91dd77db2db@ni.com> Date: Tue, 15 Aug 2017 15:10:33 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1619753.FtnHesjV4E@ws-stein> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [130.164.62.171] X-ClientProxiedBy: MWHPR15CA0041.namprd15.prod.outlook.com (10.173.226.155) To MWHPR04MB0702.namprd04.prod.outlook.com (10.172.167.139) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7506685a-c662-4f11-d75f-08d4e419b38b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:MWHPR04MB0702; X-Microsoft-Exchange-Diagnostics: 1;MWHPR04MB0702;3:WPnaR0qCG9AgN7XaFwMyLPZce1220gMjisrO2ortd6ge3nf+iNiEcRDW2nUO3aaYWxtS/SBVM98pMQvFblal56XRy/DotIucMV96MUhPIehY7bkL0psdrtqGaXvbkmMyFI3MVdtqFlmIS2Qc2kSOfKKATNGJ0sFptolJuIXlhGUDaXl3TJbYYjmaDBcFIqRMFfDjxvzpopv9dmLtG+TUei5m4q8sjGqca1YnKtI+YJfAicLd9aF2O/scJGD7sAr3;25:bDtI5CFThpXXJznplc+yQ9bklUo3KZ8IRBvFCVcA0FtQKgPCy2Re9fKilGKfCKhdfoEGxblg7DN60RQIkfiy8pfv5jQIWozCQjPlBMTtwQRWvHKr3SEoKnS0Hlq0UPRbMPDSDZGOZBGmcF4384cnJogWjoKuT851E6Iy1FgrfpbOvsyI1qnJuhmQDVcU19hYqm/rRo8tcQ8Q5oJD7C+AtjhRBW4OIIRn5MUKwgDBOlJI4MwFVJGYjv7HDjVELrXLAXizmqeOEVD+iyEbrULvgAudFjKXfToUUa7e3DM5k/ckHzE18zt/kL/DHon1lOG/djmikvQLuwGiAJA1N6cBcQ==;31:vdgj+AcMMzjwie7yiJgKjjPK8JLhL/U37wF1WhU1pnlgGKxY/WzeAjW4XEnEWJ6Ic+lDa3qtCXVfuHdfRZ9VGTAmGCykwQzZxlJnmSYRABmF0N20n9sujfZIY/29vOm5VVgVQcvba8MmgM39aQooM81ivgAJg3UuIAZMOQWxc2yhsOMBE3DB/L25hT5tDDsrR8l2HVBiq7s8BtCr/T6Sc4F8bdRKtHI6VUeIsRNx1Qc= X-MS-TrafficTypeDiagnostic: MWHPR04MB0702: X-Microsoft-Exchange-Diagnostics: 1;MWHPR04MB0702;20:XRDaO7ZqQhRRuocfwATcSXeb4GZWda+SeFMoH/RGZcw7KuMaAxdtzN58UGIEn4wWVTfeaHDUuDwA8RLmmCLdB9an6iWTGsRhBnPY/qiOrHXxAPPf4ivoCCiMeKakRqQcgL70vmlY8pzxMP8+Sj9o1OdLhOInacwfoXGPvwEinIaCWzOcg5szc6013j0g3dtfz0nf0GPgeyd0Cy2wbWIUKSjwkmTjMo+ky6hp36iujJy2pddosNh+p8v8xpMnsiR0L9lUmxH9GD1CfB35V0j/YAUGa09+8qMAweAe5oXgletLcnMWTRwucprNBZMOasVHMIK8mbVTbKlRJIwvYcmjp+opnt/U3OiBmIf82FHmi83aBYcJVyBDsYwIa7IqC3Mk/iFQFo8tBzKAkKKB66v0ip3auzPj7abB+iypeACjfr91+Xg1hn6PXXdSTy8qZBJ3zrJAqo7IFgDWsOfkQMUABN9KitH3lB1gHFMQNiwApgf8WYgXNatXR51wbHumUZfU0e8qC3BW2G0NWdJHHuLx9SaPUTWZRfPbgcYib9/z8qdImVGIYibUrUqUrrtZarCAwlKnyT8zx6/f2SfXU1wOB14vR2bBkizHWV/lzAlM0q8=;4:bFbQBL8lb3xWPQNH704PEVdcWTsfw0ad2FofCzJ2PS3XKNHcld77FfnxBWk4L22JtbCCWxb2cx0jUZzLd9BWjLy7dzjpNBzuM0Louy+VA0JsJzXRBPF59/+Fn7l7pLm9oZ6h0o5x+70EYwXUosyf3BfY2LaeZVQSxFOaJxnwvEOeOe4v9RLlZtl/2AiY1DRyon7VdTfitTDEE5KJsbn6iD3U50gp9VP7oD73JjDrPzIDZc04Tll2tgRgNfuGYhMT X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(6041248)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:MWHPR04MB0702;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:MWHPR04MB0702; X-Forefront-PRVS: 04004D94E2 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(7370300001)(4630300001)(6009001)(199003)(24454002)(189002)(377454003)(230700001)(47776003)(6486002)(83506001)(6506006)(6246003)(64126003)(65806001)(36756003)(4001350100001)(4326008)(110136004)(229853002)(65956001)(3846002)(6116002)(31696002)(6916009)(53936002)(66066001)(50466002)(478600001)(305945005)(86362001)(2950100002)(6666003)(6512007)(25786009)(68736007)(81166006)(42186005)(5660300001)(23676002)(8676002)(53546010)(81156014)(33646002)(97736004)(2906002)(7736002)(189998001)(76176999)(8666007)(101416001)(31686004)(65826007)(105586002)(54356999)(106356001)(7350300001)(50986999);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR04MB0702;H:harisdt.amer.corp.natinst.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjA0TUIwNzAyOzIzOmNLKzhJMnJxMFZJZDBqY0JmOFo2MDJPb1VC?= =?utf-8?B?UE1laTRoOHlrU2w4YURiZENjNVFjZFA0QSsrRm5seHJFbklqalVhVm1XdHBD?= =?utf-8?B?UzYwdk50WVFkZTVNbEl6YzFlcHg4cStBaTFES3kvSDZ6TVVoUlBWLzRWd3VO?= =?utf-8?B?ZFl1ZVZkWkhhWGxHaVBPYUQyQWQ5K09vc0o2d2UrYm43czRsL0J5KzJFekdZ?= =?utf-8?B?V1dhTGV6NGlvUHNPTTE5aHgxQkNxeFlQdFF4MHNza21DelBpV0tGdVBTcTFm?= =?utf-8?B?anozZEZqTFE4bkh0TzZKV2hucWhmSEJqYnRYMFBqS1NmbDdneDNFS3EvcTdE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v+ZSW9JJtLod9ERazdQWMAgBbpXZt2UknHWyEgil7Hlm112QsMVZ6OISZcxyrS/VXCzF0uzDqhGI+QTlfltdMQ==;5:0+tYAeK0+YJR1DhH9e8N70XqFigEYl2Wm2tbgwdm03xaswTsYUOVuQOVrWvsKuAOHMD7wqq36epS2S8U3AogPUj8Bw1ziqITXXCPDUO2dJv8zAPRSnOkyUo7D7aj3+3B2cGCjPqnBOnA8oJAATWRuw==;24:/ezlBZ1+NER7in2ot29LHsK0EbmBWWqg+3/syJfQazhww7fQM423cr+Xdm6mPInEF4A1Hww17JjEaYXA3sEVd4oALxmGgibIZhw8tq96QWA=;7:L/vfJe2gJ/F3oonJnwWkRjCsvzvnY0ZwCCELjBHtphpM+KPKzXeB/zjzePEhv6LGd2nhjRByVgBuXs53BdleB16EHCX6Ow7UoWjGVhBSNPzPW6Lzp8QRCio+65W2ZmKPywRJrUz1sKraxGiyZrnlZt/jkocm45eApiuVrbpFa0Z4kwF9SbBR2+FYBU86XC/yf6WXrf1kL1/jVWDqf+sOCjc1KiyjEOdU7OgwXIM+6DQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ni.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2017 20:10:38.3996 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0702 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-08-15_14:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_policy_notspam policy=outbound_policy score=30 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=30 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1708150333 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1297 Lines: 45 On 08/15/2017 01:11 AM, Alexander Stein wrote: > On Monday 14 August 2017 17:53:47, Haris Okanovic wrote: >> --- a/drivers/char/tpm/tpm_tis.c >> +++ b/drivers/char/tpm/tpm_tis.c >> @@ -52,6 +52,22 @@ static inline struct tpm_tis_tcg_phy >> *to_tpm_tis_tcg_phy(struct tpm_tis_data *da return container_of(data, >> struct tpm_tis_tcg_phy, priv); >> } >> >> +static inline void tpm_tis_iowrite8(u8 b, void __iomem *iobase, u32 addr) >> +{ >> + iowrite8(b, iobase + addr); >> +#ifdef CONFIG_PREEMPT_RT_FULL >> + ioread8(iobase + TPM_ACCESS(0)); >> +#endif >> +} > > Maybe add some comment why an iorad8 is actually requried after each write on > RT. Currently it is rather obvious why this additional read is necessary. But > is this still the case in a year? > Sure. I re-added the tpm_tis_flush() function with comments to explain what's going. Calling it from tpm_tis_iowrite8() and tpm_tis_iowrite32(). Will post a PATCH v2 shortly. >> +static inline void tpm_tis_iowrite32(u32 b, void __iomem *iobase, u32 addr) >> +{ >> + iowrite32(b, iobase + addr); >> +#ifdef CONFIG_PREEMPT_RT_FULL >> + ioread8(iobase + TPM_ACCESS(0)); >> +#endif >> +} > > Same applies here. Or add a comment above both functions describing their > purpose. > > Just my 2 cents > > Best regards, > Alexander >