From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937083AbdAJMyN (ORCPT ); Tue, 10 Jan 2017 07:54:13 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:46927 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936221AbdAJMyI (ORCPT ); Tue, 10 Jan 2017 07:54:08 -0500 X-AuditID: b6c32a2d-f79316d0000033a5-85-5874d96c5df1 From: Bartlomiej Zolnierkiewicz To: Michael Schmitz Cc: Tejun Heo , Geert Uytterhoeven , linux-ide@vger.kernel.org, Linux/m68k , Linux Kernel Development Subject: Re: [PATCH 0/3] ata: add m68k/Atari Falcon PATA support Date: Tue, 10 Jan 2017 13:53:53 +0100 Message-id: <3939493.HXZ6C33pKV@amdc3058> User-Agent: KMail/4.13.3 (Linux/3.13.0-96-generic; KDE/4.13.3; x86_64; ; ) In-reply-to: MIME-version: 1.0 Content-transfer-encoding: 7Bit Content-type: text/plain; charset=us-ascii X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjleLIzCtJLcpLzFFi42LZdlhTSzfnZkmEweI7+hbPbu1lsji24xGT xeVdc9gslj9Zy2wxt3U6u8Wv5UcZHdg8ds66y+6xaVUnm8ehwx2MHidbv7F4fN4kF8AaxWWT kpqTWZZapG+XwJXxbeVUpoIbMhU9uy+wNTBuEOti5OSQEDCR2LliNSuELSZx4d56ti5GLg4h gaWMEic+fWKBcNqZJM52TmPuYuQA69h/3AgivpxRovH8Bqiir0AdPTeYQEaxCVhJTGxfxQhi iwhoSZy/eZ4RpIhZ4ByjxKJ9v9hAEsICDhJdd3rBilgEVCXe/9wMFucV0JTo+nSCBcQWFfCS 2LKvnQlkM6dAsMTvVxwQJYISPybfAythFpCX2Ld/KiuErSNx9tg6sF0SAsvYJf6tuckKcbWs xKYDzBBvukhcurES6mVhiVfHt7BD2NISf5feYoSwpzNKbP8tATFnM6PEqt0ToI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AuM8riTc0MTcxNzawMLe0NDFSEudtnP0sXEggPbEk NTs1tSC1CKaPiYNTqoFxxpk5a31LXr2ojE1UOXVVN/144rUOTvHlk5huL+Sqv7vo4SQl40ML Q084cTy4x2sb0nfj2dwqD3cXrtbN1wwPiRvarb541WA/l82d6I5DF+0b8g8ZXs7hrpubc+r0 sc+zXpovLDneXRP4+3vpodjotU98HnvOFLuwV4JZLdl3+auOwz8jq36bKbEUZyQaajEXFScC AEBXlzPDAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170110125403epcas5p399b1d6966f81d4846303f20eaa65c2e8 X-Msg-Generator: CA X-Sender-IP: 203.254.230.27 X-Local-Sender: =?UTF-8?B?QmFydGxvbWllaiBab2xuaWVya2lld2ljehtTUlBPTC1LZXJu?= =?UTF-8?B?ZWwgKFRQKRvsgrzshLHsoITsnpAbU2VuaW9yIFNvZnR3YXJlIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?QmFydGxvbWllaiBab2xuaWVya2lld2ljehtTUlBPTC1LZXJu?= =?UTF-8?B?ZWwgKFRQKRtTYW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBF?= =?UTF-8?B?bmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 105P X-HopCount: 7 X-CMS-RootMailID: 20161230140139epcas5p160eda5a6a77be084e21f12002c85cc2a X-RootMTR: 20161230140139epcas5p160eda5a6a77be084e21f12002c85cc2a References: <1483106478-1382-1-git-send-email-b.zolnierkie@samsung.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Friday, January 06, 2017 10:01:49 AM Michael Schmitz wrote: > Hi Bartlomiej, > > thanks for caring to support our legacy PATA systems! > > On Sat, Dec 31, 2016 at 3:01 AM, Bartlomiej Zolnierkiewicz > wrote: > > Hi, > > > > This patchset adds m68k/Atari Falcon PATA support to libata. > > The major difference in the new libata's pata_falcon host > > driver when compared to legacy IDE's falconide host driver is > > that we are using polled PIO mode and thus avoiding the need > > for STDMA locking magic altogether. > > I don't suppose this is the default libata mode for PIO? No, by default it is used only for some commands (i.e. IDENTIFY, SET FEATURES - XFER MODE). > How is polling implemented in libata? Sleeping for something > approximating the average seek latency shouldn't hurt but spinning > wont be acceptable for a low performance single CPU architecture like > the Falcon. You can find actual implementation in libata-sff.c. Please see ata_sff_pio_task() for the main polling logic: fsm_start: WARN_ON_ONCE(ap->hsm_task_state == HSM_ST_IDLE); /* * This is purely heuristic. This is a fast path. * Sometimes when we enter, BSY will be cleared in * a chk-status or two. If not, the drive is probably seeking * or something. Snooze for a couple msecs, then * chk-status again. If still busy, queue delayed work. */ status = ata_sff_busy_wait(ap, ATA_BUSY, 5); if (status & ATA_BUSY) { spin_unlock_irq(ap->lock); ata_msleep(ap, 2); spin_lock_irq(ap->lock); status = ata_sff_busy_wait(ap, ATA_BUSY, 10); if (status & ATA_BUSY) { ata_sff_queue_pio_task(link, ATA_SHORT_PAUSE); goto out_unlock; } } /* * hsm_move() may trigger another command to be processed. * clean the link beforehand. */ ap->sff_pio_task_link = NULL; /* move the HSM */ poll_next = ata_sff_hsm_move(ap, qc, status, 1); /* another command or interrupt handler * may be running at this point. */ if (poll_next) goto fsm_start; out_unlock: ata_sff_busy_wait()'s last argument is number of 10uS waits so first check (50uS) should be quite quick. If device is still busy we sleep for 2ms. Then we quickly (100uS) busy wait and if needed queue delayed work (with ATA_SHORT_PAUSE == 16 ms delay). Overall the current heuristic looks fine and spinning should be minimal. > > Tested under ARAnyM emulator. > > Not sure that the emulator is really feature complete enough - I'll > get this tested on my Falcon in the next few weeks. I'm a bit worried Great! > about IDE still generating interrupts on seek completion (did you spot > anything like that, Geert?). > > Cheers, > > Michael BTW according to comment in arch/m68k/atari/stdma.c: /* On the Falcon, the IDE bus uses just the ACSI/Floppy interrupt, but */ /* not the ST-DMA chip itself. So falhd.c needs not to lock the */ /* chip. The interrupt is routed to falhd.c if IDE is configured, the */ /* model is a Falcon and the interrupt was caused by the HD controller */ /* (can be determined by looking at its status register). */ it should be okay to use IDE at the same time as SCSI/Floppy which is what the new driver does (the old one is serialized operations by ST-DMA related IRQ handling magic). Also the comment itself may need some fixups as on Falcon it is SCSI not ACSI (according to the earlier comment in same file) and the old IDE host driver name is not falhd.c but falconide.c. Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics