Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757580Ab0HOABK (ORCPT ); Sat, 14 Aug 2010 20:01:10 -0400 Received: from smtp-out.google.com ([74.125.121.35]:30295 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757521Ab0HOABG (ORCPT ); Sat, 14 Aug 2010 20:01:06 -0400 DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=mime-version:date:message-id:subject:from:to:cc: content-type:x-system-of-record; b=QxuYxH4tJmBPVFmgwYMnwcXIkg6LWB2YoHVhggNUTF/XQKlt5EaZRrDonEFnvEB3A dUmMWuCcz68IHOuokll1Q== MIME-Version: 1.0 Date: Sat, 14 Aug 2010 17:00:59 -0700 Message-ID: Subject: [PATCH] 2.6.35 libata support for > 512 byte sectors (e.g. 4K Native) From: Grant Grundler To: Jeff Garzik , Tejun Heo Cc: Linux IDE , Matthew Wilcox , Gwendal Grignou , LKML Content-Type: multipart/mixed; boundary=0016362835ce50d77a048dd169d9 X-System-Of-Record: true Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 15591 Lines: 246 --0016362835ce50d77a048dd169d9 Content-Type: text/plain; charset=UTF-8 Attached patch enables my x86 machine to recognize and talk to a "Native 4K" SATA device. When I started working on this, I didn't know Matthew Wilcox had posted a similar patch 2 years ago: http://git.kernel.org/?p=linux/kernel/git/willy/ata.git;a=shortlog;h=refs/heads/ata-large-sectors Gwendal Grignou pointed me at the the above code and small portions of this patch include Matthew's work. That's why Mathew is first on the "Signed-off-by:". I've NOT included his use of a bitmap to determine 512 vs Native for ATA command block size - just used a simple table. And bugs are almost certainly mine. Lastly, the patch has been tested with a native 4K 'Engineering Sample' drive provided by Hitachi GST. Signed-off-by: Matthew Wilcox Signed-off-by: Grant Grundler Reviewed-by: Gwendal Grignou ----- Gwendal's review of this patch had him concerned about access to "dev->sdev->sector_size" may have risks (e.g. sdev goes away before dev does). I didn't like adding additional fields to ata_dev that duplicate what scsi is doing and this seems to be working so far. But since I don't know how dev->sdev is protected/syncronized (despite how libata and scsi are joined at the hip), I hope someone else can comment on if my usage of dev->sdev->sector_size is a problem and why. I believe use of ata_id_logical_per_physical_sectors() was wrong. I've replaced it with ata_id_log2_per_physical_sector() and cleaned up how block size word and alignment are referenced. It's alot easier to read where those functions are used now. Here is the kernel output from hotplugging the SATA drive on my machine (using Marvell 7042 controller): [ 2468.301218] ata4: exception Emask 0x10 SAct 0x0 SErr 0x4010000 action 0xe frozen [ 2468.301225] ata4: edma_err_cause=00000010 pp_flags=00000000, dev connect [ 2468.301240] ata4: SError: { PHYRdyChg DevExch } [ 2468.301257] ata4: hard resetting link [ 2471.701117] ata4: SATA link up 1.5 Gbps (SStatus 113 SControl 300) [ 2471.740390] ata4.00: HPA detected: current 9770670, native 78165360 [ 2471.740399] ata4.00: ATA-7: Hitachi HTSxxxxxxxxxxxx, yyyyyyyy, max UDMA/100 [ 2471.740402] ata4.00: 9770670 sectors, multi 0: LBA48 NCQ (depth 31/32) [ 2471.764465] ata4.00: configured for UDMA/100 [ 2471.764501] ata4: EH complete [ 2471.764988] scsi 4:0:0:0: Direct-Access ATA Hitachi HTSxxxxxxxxxxxx PQ: 0 ANSI: 5 [ 2471.782914] sd 4:0:0:0: [sdd] 9770670 4096-byte logical blocks: (40.0 GB/37.2 GiB) [ 2471.787093] sd 4:0:0:0: [sdd] Write Protect is off [ 2471.787120] sd 4:0:0:0: [sdd] Mode Sense: 00 3a 00 00 [ 2471.788768] sd 4:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 2471.792293] sd 4:0:0:0: [sdd] 9770670 4096-byte logical blocks: (40.0 GB/37.2 GiB) [ 2471.792834] sd 4:0:0:0: Attached scsi generic sg3 type 0 [ 2471.799370] sdd: unknown partition table [ 2471.845582] sd 4:0:0:0: [sdd] 9770670 4096-byte logical blocks: (40.0 GB/37.2 GiB) [ 2471.853763] sd 4:0:0:0: [sdd] Attached SCSI disk I was able to dd to/from the device and pull SMART data (not shown and probably not able to share.) If someone has "Advanced Format Developers Kit" SATA drives from idema.org, I'd appreciate any test reports. thanks grant [ patch NOT inlined because gmail will word-wrap and make a mess of it. Please use attached filed.] --0016362835ce50d77a048dd169d9 Content-Type: application/octet-stream; name="2.6.35-libata_4k_block_support-01" Content-Disposition: attachment; filename="2.6.35-libata_4k_block_support-01" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gcv3162m0 ZGlmZiAtLWdpdCBhL2RyaXZlcnMvYXRhL2xpYmF0YS1zY3NpLmMgYi9kcml2ZXJzL2F0YS9saWJh dGEtc2NzaS5jCmluZGV4IGE1NDI3M2QuLjE2ZDJiYmYgMTAwNjQ0Ci0tLSBhL2RyaXZlcnMvYXRh L2xpYmF0YS1zY3NpLmMKKysrIGIvZHJpdmVycy9hdGEvbGliYXRhLXNjc2kuYwpAQCAtNTIsNyAr NTIsNiBAQAogCiAjaW5jbHVkZSAibGliYXRhLmgiCiAKLSNkZWZpbmUgU0VDVE9SX1NJWkUJCTUx MgogI2RlZmluZSBBVEFfU0NTSV9SQlVGX1NJWkUJNDA5NgogCiBzdGF0aWMgREVGSU5FX1NQSU5M T0NLKGF0YV9zY3NpX3JidWZfbG9jayk7CkBAIC01MTYsNyArNTE1LDcgQEAgaW50IGF0YV9jbWRf aW9jdGwoc3RydWN0IHNjc2lfZGV2aWNlICpzY3NpZGV2LCB2b2lkIF9fdXNlciAqYXJnKQogCW1l bXNldChzY3NpX2NtZCwgMCwgc2l6ZW9mKHNjc2lfY21kKSk7CiAKIAlpZiAoYXJnc1szXSkgewot CQlhcmdzaXplID0gU0VDVE9SX1NJWkUgKiBhcmdzWzNdOworCQlhcmdzaXplID0gQVRBX1NFQ1Rf U0laRSAqIGFyZ3NbM107CiAJCWFyZ2J1ZiA9IGttYWxsb2MoYXJnc2l6ZSwgR0ZQX0tFUk5FTCk7 CiAJCWlmIChhcmdidWY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--0016362835ce50d77a048dd169d9-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/