libata: implement libata.force module parameter
Subsystems (2)
PATCH 1/1 libata: implement libata.force module parameter
This patch implements libata.force module parameter which can selectively override ATA port, link and device configurations including cable type, SATA PHY SPD limit, transfer mode and NCQ.
For example, you can say "use 1.5Gbps for all fan-out ports attached to the second port but allow 3.0Gbps for the PMP device itself, oh, the device attached to the third fan-out port chokes on NCQ and shouldn't go over UDMA4" by the following.
libata.force=2:1.5g,2.15:3.0g,2.03:noncq,udma4
---
I guess it's about time we add something like this. More than anything else this should help debugging and can serve as a last resort to work around problems.
Thanks.
Documentation/kernel-parameters.txt | 35 +++ drivers/ata/libata-core.c | 375 +++++++++++++++++++++++++++++++++++- drivers/ata/libata-eh.c | 8 drivers/ata/libata.h | 1 4 files changed, 415 insertions(+), 4 deletions(-)
Documentation/kernel-parameters.txt +35 -0
@@ -895,6 +895,41 @@ and is between 256 and 4096 characters. It is defined in the file when set. Format: <int> + libata.force= [LIBATA] Force configurations. The format is comma + separated list of "[ID:]VAL" where ID is + PORT[:DEVICE]. PORT and DEVICE are decimal numbers + matching port, link or device. Basically, it matches + the ATA ID string printed on console by libata. If + the whole ID part is omitted, the last PORT and DEVICE + values are used. If ID hasn't been specified yet, the + configuration applies to all ports, links and devices. + + If only DEVICE is omitted, the parameter applies to + the port and all links and devices behind it. DEVICE + number of 0 either selects the first device or the + first fan-out link behind PMP device. It does not + select the host link. DEVICE number of 15 selects the + host link and device attached to it. + + The VAL specifies the configuration to force. As long + as there's no ambiguity shortcut notation is allowed. + For example, both 1.5 and 1.5G would work for 1.5Gbps. + The following configurations can be forced. + + * Cable type: 40c, 80c, short40c, unk, ign or sata. + Any ID with matching PORT is used. + + * SATA link speed limit: 1.5Gbps or 3.0Gbps. + + * Transfer mode: pio[0-7], mwdma[0-4] and udma[0-7]. + udma[/][16,25,33,44,66,100,133] notation is also + allowed. + + * [no]ncq: Turn on or off NCQ. + + If there are multiple matching configurations changing + the same attribute, the last one is used. + load_ramdisk= [RAM] List of ramdisks to load from floppy See Documentation/ramdisk.txt.
drivers/ata/libata-core.c +374 -1
427 lines not on this page · raw message
drivers/ata/libata-eh.c +5 -3
@@ -2393,9 +2393,11 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, }/* PDIAG- should have been released, ask cable type if post-reset */ -if (ata_is_host_link (link) && ap->ops->cable_detect && - (ehc->i.flags &ATA_EHI_DID_RESET )) - ap->cbl = ap->ops->cable_detect (ap); +if ((ehc->i.flags &ATA_EHI_DID_RESET ) &&ata_is_host_link (link)) { +if (ap->ops->cable_detect) + ap->cbl = ap->ops->cable_detect (ap); +ata_force_cbl (ap); + }/* Configure new devices forward such that user doesn't see * device detection messages backwards.
drivers/ata/libata.h +1 -0
@@ -61,6 +61,7 @@ extern int atapi_passthru16;extern int libata_fua;extern int libata_noacpi;extern int libata_allow_tpm; +extern void ata_force_cbl (struct ata_port *ap);extern struct ata_queued_cmd *ata_qc_new_init (struct ata_device *dev); extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, u64 block, u32 n_block, unsigned int tf_flags,
Quoted 17 lines · Tejun Heo
This patch implements libata.force module parameter which can selectively override ATA port, link and device configurations including cable type, SATA PHY SPD limit, transfer mode and NCQ.
For example, you can say "use 1.5Gbps for all fan-out ports attached to the second port but allow 3.0Gbps for the PMP device itself, oh, the device attached to the third fan-out port chokes on NCQ and shouldn't go over UDMA4" by the following.
libata.force=2:1.5g,2.15:3.0g,2.03:noncq,udma4
Signed-off-by Tejun Heo <[email protected]>---
I guess it's about time we add something like this. More than anything else this should help debugging and can serve as a last resort to work around problems.
Quoted 7 lines
Thanks.
Documentation/kernel-parameters.txt | 35 +++ drivers/ata/libata-core.c | 375 +++++++++++++++++++++++++++++++++++- drivers/ata/libata-eh.c | 8 drivers/ata/libata.h | 1 4 files changed, 415 insertions(+), 4 deletions(-)
ACK, but it breaks the build due to section type conflicts:
drivers/ata/libata-core.c:108: error: ata_force_param_buf causes a section type conflict
Given that the data is marked __initdata and the code is marked __init, I cannot see the problem.
Quoted 26 lines · Jeff Garzik
Quoted 17 lines · Tejun Heo
This patch implements libata.force module parameter which can selectively override ATA port, link and device configurations including cable type, SATA PHY SPD limit, transfer mode and NCQ.
For example, you can say "use 1.5Gbps for all fan-out ports attached to the second port but allow 3.0Gbps for the PMP device itself, oh, the device attached to the third fan-out port chokes on NCQ and shouldn't go over UDMA4" by the following.
libata.force=2:1.5g,2.15:3.0g,2.03:noncq,udma4
Signed-off-by Tejun Heo <[email protected]>---
I guess it's about time we add something like this. More than anything else this should help debugging and can serve as a last resort to work around problems.Quoted 7 lines
Thanks.
Documentation/kernel-parameters.txt | 35 +++ drivers/ata/libata-core.c | 375 +++++++++++++++++++++++++++++++++++- drivers/ata/libata-eh.c | 8 drivers/ata/libata.h | 1 4 files changed, 415 insertions(+), 4 deletions(-)
Quoted 7 lines
ACK, but it breaks the build due to section type conflicts:
drivers/ata/libata-core.c:108: error:ata_force_param_bufcauses a section type conflictGiven that the data is marked
__initdataand the code is marked__init, I cannot see the problem.
the data is marked as "const"
Quoted 27 lines · Jeff Garzik
Quoted 17 lines · Tejun Heo
This patch implements libata.force module parameter which can selectively override ATA port, link and device configurations including cable type, SATA PHY SPD limit, transfer mode and NCQ.
For example, you can say "use 1.5Gbps for all fan-out ports attached to the second port but allow 3.0Gbps for the PMP device itself, oh, the device attached to the third fan-out port chokes on NCQ and shouldn't go over UDMA4" by the following.
libata.force=2:1.5g,2.15:3.0g,2.03:noncq,udma4
Signed-off-by Tejun Heo <[email protected]>---
I guess it's about time we add something like this. More than anything else this should help debugging and can serve as a last resort to work around problems.Quoted 8 lines
Thanks.
Documentation/kernel-parameters.txt| 35 +++drivers/ata/libata-core.c| 375
+++++++++++++++++++++++++++++++++++-drivers/ata/libata-eh.c | 8 drivers/ata/libata.h | 1 4 files changed, 415 insertions(+), 4 deletions(-)
Quoted 7 lines
ACK, but it breaks the build due to section type conflicts:
drivers/ata/libata-core.c:108: error:ata_force_param_bufcauses a section type conflictGiven that the data is marked
__initdataand the code is marked__init, I cannot see the problem.
I have lost the actual patch.
But what you see is what happens when you mix const and non-const data in the same section.
Look for use of __initdata for const data and replace it with __initconst.
And modpost cannot warn about it as gcc errors out before we look at the .o file with modpost.
Sam
Quoted 8 lines · Sam Ravnborg
I have lost the actual patch.
But what you see is what happens when you mix const and non-const data in the same section.Look for use of
__initdatafor const data and replace it with__initconst.And modpost cannot warn about it as gcc errors out before we look at the .o file with modpost.
OIC, thanks. Hmmm... in init.h, I see __{dev|cpu|mem}initconst but no __initconst. The data structure in question is used from module init function tagged properly with __init. What should be done here?
Signature · 1 line
tejun
Quoted 5 lines · Tejun Heo
Quoted 4 lines · Sam Ravnborg
I have lost the actual patch.
But what you see is what happens when you mix const and non-const data in the same section.
Quoted 8 lines
Quoted 4 lines
Look for use of
__initdatafor const data and replace it with__initconst.And modpost cannot warn about it as gcc errors out before we look at the .o file with modpost.
OIC, thanks. Hmmm... in
init.h, I see __{dev|cpu|mem}initconst but no__initconst. The data structure in question is used from module init function tagged properly with__init. What should be done here?
PING.
Signature · 1 line
tejun
Quoted 27 lines · Jeff Garzik
Quoted 17 lines · Tejun Heo
This patch implements libata.force module parameter which can selectively override ATA port, link and device configurations including cable type, SATA PHY SPD limit, transfer mode and NCQ.
For example, you can say "use 1.5Gbps for all fan-out ports attached to the second port but allow 3.0Gbps for the PMP device itself, oh, the device attached to the third fan-out port chokes on NCQ and shouldn't go over UDMA4" by the following.
libata.force=2:1.5g,2.15:3.0g,2.03:noncq,udma4
Signed-off-by Tejun Heo <[email protected]>---
I guess it's about time we add something like this. More than anything else this should help debugging and can serve as a last resort to work around problems.Quoted 8 lines
Thanks.
Documentation/kernel-parameters.txt | 35 +++ drivers/ata/libata-core.c | 375 +++++++++++++++++++++++++++++++++++- drivers/ata/libata-eh.c | 8
drivers/ata/libata.h| 1 4 files changed, 415
insertions(+), 4 deletions(-)
Quoted 7 lines
ACK, but it breaks the build due to section type conflicts:
drivers/ata/libata-core.c:108: error:ata_force_param_bufcauses a section type conflictGiven that the data is marked
__initdataand the code is marked__init, I cannot see the problem.
Jeff, this no longer causes build failure whether libata is configured built-in or as a module. I have no idea what's going on but there doesn't seem to be a proper solution on the horizon yet. I think we can go ahead and commit this one and convert it to __initdataconst when it becomes available.
Thanks.
Signature · 1 line
tejun
This patch implements libata.force module parameter which can selectively override ATA port, link and device configurations including cable type, SATA PHY SPD limit, transfer mode and NCQ.
For example, you can say "use 1.5Gbps for all fan-out ports attached to the second port but allow 3.0Gbps for the PMP device itself, oh, the device attached to the third fan-out port chokes on NCQ and shouldn't go over UDMA4" by the following.
libata.force=2:1.5g,2.15:3.0g,2.03:noncq,udma4
---
Okay, the build failure is dependent on compiler version. 4.1.2 fails but 4.2.1 is okay. I was using 4.2.1 so I didn't know about it. const is dropped from the offending structure and comment is added.
Documentation/kernel-parameters.txt | 35 +++ drivers/ata/libata-core.c | 380 +++++++++++++++++++++++++++++++++++- drivers/ata/libata-eh.c | 8 drivers/ata/libata.h | 1 4 files changed, 420 insertions(+), 4 deletions(-)
Documentation/kernel-parameters.txt +35 -0
@@ -945,6 +945,41 @@ and is between 256 and 4096 characters. It is defined in the file when set. Format: <int> + libata.force= [LIBATA] Force configurations. The format is comma + separated list of "[ID:]VAL" where ID is + PORT[:DEVICE]. PORT and DEVICE are decimal numbers + matching port, link or device. Basically, it matches + the ATA ID string printed on console by libata. If + the whole ID part is omitted, the last PORT and DEVICE + values are used. If ID hasn't been specified yet, the + configuration applies to all ports, links and devices. + + If only DEVICE is omitted, the parameter applies to + the port and all links and devices behind it. DEVICE + number of 0 either selects the first device or the + first fan-out link behind PMP device. It does not + select the host link. DEVICE number of 15 selects the + host link and device attached to it. + + The VAL specifies the configuration to force. As long + as there's no ambiguity shortcut notation is allowed. + For example, both 1.5 and 1.5G would work for 1.5Gbps. + The following configurations can be forced. + + * Cable type: 40c, 80c, short40c, unk, ign or sata. + Any ID with matching PORT is used. + + * SATA link speed limit: 1.5Gbps or 3.0Gbps. + + * Transfer mode: pio[0-7], mwdma[0-4] and udma[0-7]. + udma[/][16,25,33,44,66,100,133] notation is also + allowed. + + * [no]ncq: Turn on or off NCQ. + + If there are multiple matching configurations changing + the same attribute, the last one is used. + load_ramdisk= [RAM] List of ramdisks to load from floppy See Documentation/ramdisk.txt.
drivers/ata/libata-core.c +379 -1
432 lines not on this page · raw message
drivers/ata/libata-eh.c +5 -3
@@ -2393,9 +2393,11 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, }/* PDIAG- should have been released, ask cable type if post-reset */ -if (ata_is_host_link (link) && ap->ops->cable_detect && - (ehc->i.flags &ATA_EHI_DID_RESET )) - ap->cbl = ap->ops->cable_detect (ap); +if ((ehc->i.flags &ATA_EHI_DID_RESET ) &&ata_is_host_link (link)) { +if (ap->ops->cable_detect) + ap->cbl = ap->ops->cable_detect (ap); +ata_force_cbl (ap); + }/* Configure new devices forward such that user doesn't see * device detection messages backwards.
drivers/ata/libata.h +1 -0
@@ -61,6 +61,7 @@ extern int atapi_passthru16;extern int libata_fua;extern int libata_noacpi;extern int libata_allow_tpm; +extern void ata_force_cbl (struct ata_port *ap);extern struct ata_queued_cmd *ata_qc_new_init (struct ata_device *dev); extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, u64 block, u32 n_block, unsigned int tf_flags,
Quoted 3 lines · Tejun Heo
This patch implements libata.force module parameter which can selectively override ATA port, link and device configurations including cable type, SATA PHY SPD limit, transfer mode and NCQ.
...
Documentation/kernel-parameters.txt and is between 256 and 4096 characters. It is defined in the file · line 951
Quoted 4 lines
Documentation/kernel-parameters.txt +4
-0+ libata.force= [LIBATA] Force configurations. The format is comma + separated list of "[ID:]VAL" where ID is + PORT[:DEVICE]. PORT and DEVICE are decimal numbers + matching port, link or device. Basically, it matches
..
Mmm.. not a NAK, but is there also a way to set/change these on the fly?
I ask because, on my 4-core test system here, libata enumerates the ports differently depending upon whether I boot with a 32-bit kernel or a 64-bit kernel.
Major PITA, that, and it's just the kind of thing that spoils fixed "PORT:DEVICE" module parameters, too.
Now mind you, it's more likely the PCI layer that does the reverse order thing, but the end result is that my drives/ports are numbered differently depending upon which kernel I happen to boot with.
??
Quoted 4 lines · Mark Lord
Quoted 3 lines · Tejun Heo
This patch implements libata.force module parameter which can selectively override ATA port, link and device configurations including cable type, SATA PHY SPD limit, transfer mode and NCQ.
Quoted 8 lines
...
Documentation/kernel-parameters.txt and is between 256 and 4096 characters. It is defined in the file · line 951
Quoted 4 lines
Documentation/kernel-parameters.txt +4
-0+ libata.force= [LIBATA] Force configurations. The format is comma + separated list of "[ID:]VAL" where ID is + PORT[:DEVICE]. PORT and DEVICE are decimal numbers + matching port, link or device. Basically, it matches..
Mmm.. not a NAK, but is there also a way to set/change these on the fly?
What do you mean by 'on the fly'? While the system is running? If so, I think that should be done through other interfaces - pass through, sysfs, etc...
Quoted 10 lines
I ask because, on my 4-core test system here, libata enumerates the ports differently depending upon whether I boot with a 32-bit kernel or a 64-bit kernel.
Major PITA, that, and it's just the kind of thing that spoils fixed "PORT:DEVICE" module parameters, too.
Now mind you, it's more likely the PCI layer that does the reverse order thing, but the end result is that my drives/ports are numbered differently depending upon which kernel I happen to boot with.
Heck... That's ugly. libata.force is mainly conceived as debugging / installation helper, so using fixed PORT is good enough but maybe allowing bus_id as PORT is useful? Something like [00:1f.2]:00?
Signature · 1 line
tejun
Quoted 10 lines · Tejun Heo
Quoted 9 lines · Mark Lord
Quoted 3 lines · Tejun Heo
This patch implements libata.force module parameter which can selectively override ATA port, link and device configurations including cable type, SATA PHY SPD limit, transfer mode and NCQ.
...
Quoted 4 lines
Documentation/kernel-parameters.txt +4
-0+ libata.force= [LIBATA] Force configurations. The format is comma + separated list of "[ID:]VAL" where ID is + PORT[:DEVICE]. PORT and DEVICE are decimal numbers + matching port, link or device. Basically, it matches
Quoted 7 lines
Quoted 3 lines
..
Mmm.. not a NAK, but is there also a way to set/change these on the fly?
What do you mean by 'on the fly'? While the system is running? If so, I think that should be done through other interfaces - pass through, sysfs, etc...
..
Yes, that's the type of thing I had in mind.
Some way to accomplish similar forced settings *after* libata is loaded.
Quoted 7 lines
Quoted 3 lines
Now mind you, it's more likely the PCI layer that does the reverse order thing, but the end result is that my drives/ports are numbered differently depending upon which kernel I happen to boot with.
Heck... That's ugly. libata.force is mainly conceived as debugging / installation helper, so using fixed PORT is good enough but maybe allowing
bus_idas PORT is useful? Something like [00:1f.2]:00?
..
It's just plain ugly the way it works, but livable (barely). We might actually have a use here for something similar to "ide=reverse", which was intended for exactly this kind of situation.
But such usability flags seem to be in disfavour nowadays.
Cheers!
Jeff Garzik
AppliedQuoted 17 lines · Tejun Heo
This patch implements libata.force module parameter which can selectively override ATA port, link and device configurations including cable type, SATA PHY SPD limit, transfer mode and NCQ.
For example, you can say "use 1.5Gbps for all fan-out ports attached to the second port but allow 3.0Gbps for the PMP device itself, oh, the device attached to the third fan-out port chokes on NCQ and shouldn't go over UDMA4" by the following.
libata.force=2:1.5g,2.15:3.0g,2.03:noncq,udma4
Signed-off-by Tejun Heo <[email protected]>---
Okay, the build failure is dependent on compiler version. 4.1.2 fails but 4.2.1 is okay. I was using 4.2.1 so I didn't know about it. const is dropped from the offending structure and comment is added.
Quoted 5 lines
Documentation/kernel-parameters.txt | 35 +++ drivers/ata/libata-core.c | 380 +++++++++++++++++++++++++++++++++++- drivers/ata/libata-eh.c | 8 drivers/ata/libata.h | 1 4 files changed, 420 insertions(+), 4 deletions(-)
applied