Skip to contentSkip to conversation

Host protected area on suspend/resume

DISCUSSION Matthew Garrett 5 participants 7 messages Jul 12, 2005 – Jul 13, 2005 libata

lore
Share & tools
lore
#0 lore raw

On boot, Linux will attempt to disable the host protected area on a disk. After a suspend/resume cycle, the BIOS may reenable it (seen on a Thinkpad T40 and R40). As a result, the kernel is now unable to access the HPA.

Is there any issue with just adding a call to idedisk_check_hpa() in the IDE resume code?

Signature · 1 line
Matthew Garrett | [email protected]
#1 lore raw
Quoted 3 lines · Matthew Garrett

On boot, Linux will attempt to disable the host protected area on a disk. After a suspend/resume cycle, the BIOS may reenable it (seen on a Thinkpad T40 and R40). As a result, the kernel is now unable to access the HPA.

Is there any issue with just adding a call to idedisk_check_hpa() in the IDE resume code?

This has come up several times now. One thing I'm curious about is
why we are disabling HPA on boot without consent from the user. AFAIK, HPA is mostly used to implement hidden recovery/suspend storage areas and disabling automatically on boot increases the likeliness of destroying them. What do we gain by disabling HPA on boot? Are there some dumb machines which unnecessarily sets HPA and reduces the capacity of drives excessively? Even in such cases, wouldn't it be better to do idedisk_check_hpa() only when kernel parameter explicitly says so?

Signature · 1 line
tejun
#2 lore raw
Quoted 8 lines · Tejun Heo

This has come up several times now. One thing I'm curious about is
why we are disabling HPA on boot without consent from the user. AFAIK, HPA is mostly used to implement hidden recovery/suspend storage areas and disabling automatically on boot increases the likeliness of destroying them. What do we gain by disabling HPA on boot? Are there some dumb machines which unnecessarily sets HPA and reduces the capacity of drives excessively? Even in such cases, wouldn't it be better to do idedisk_check_hpa() only when kernel parameter explicitly says so?

I'm not sure why we're doing it, but reverting this behaviour is likely to make some systems unbootable (install with kernel which disables HPA, format entire drive, put filesystem on it).

Signature · 1 line
Matthew Garrett | [email protected]
#3 lore raw
Quoted 7 lines · Matthew Garrett
Quoted 1 line · Tejun Heo

This has come up several times now. One thing I'm curious about is why we are disabling HPA on boot without consent from the user. AFAIK, HPA is mostly used to implement hidden recovery/suspend storage areas and disabling automatically on boot increases the likeliness of destroying them. What do we gain by disabling HPA on boot? Are there some dumb machines which unnecessarily sets HPA and reduces the capacity of drives excessively? Even in such cases, wouldn't it be better to do idedisk_check_hpa() only when kernel parameter explicitly says so?

I'm not sure why we're doing it, but reverting this behaviour is likely to make some systems unbootable (install with kernel which disables HPA, format entire drive, put filesystem on it).

Yeah... it will immediately make disks unusable. sad, sad.

Signature · 1 line
tejun
#4 lore raw
In reply to Tejun Heo
Quoted 18 lines · Tejun Heo
Quoted 7 lines · Matthew Garrett

On boot, Linux will attempt to disable the host protected area on a disk. After a suspend/resume cycle, the BIOS may reenable it (seen on a Thinkpad T40 and R40). As a result, the kernel is now unable to access the HPA.

Is there any issue with just adding a call to idedisk_check_hpa() in the IDE resume code?

This has come up several times now. One thing I'm curious about is
why we are disabling HPA on boot without consent from the user. AFAIK, HPA is mostly used to implement hidden recovery/suspend storage areas and disabling automatically on boot increases the likeliness of destroying them. What do we gain by disabling HPA on boot? Are there some dumb machines which unnecessarily sets HPA and reduces the capacity of drives excessively? Even in such cases, wouldn't it be better to do idedisk_check_hpa() only when kernel parameter explicitly says so?

Quoted 2 lines

--
tejun

Crawling out from under my rock, I agree with Tejun.

Always enabling access to HPA seems very strange.

It also eliminates the ability to use the IDE Offset feature. IIUC, the offset feature is a boolean flag that, when true, basically tells the drive that all LBA references are into the HPA area.

By using the HPA in conjunction with the Offset flag, one has the ability to have two complete disk layouts. Each could have its own boot sector, partition table, and partitions. I have never used this feature, but I do have DOS based tools that supposidely control the HPA config. and the state of the offset boolean.

I routinely perform "forensic image aquires". Normally that is a simple "dd if=/dev/hdx.....".

For me the untlimate would be to have Linux support for something like:
disable offset
dd normal sectors
enable offset
dd hpa sectors

That way I capture the areas as seperate images and if 2 boot sectors, partition tables, partitions etc. exist I can analyse them seperately.

Conclusion, automatically overriding HPA seems to be outside of the normal Linux way of doing things. At a minimum, there should be a flag to prevent it from happening. If it is needed there are existing userspace linux tools that can modify the HPA config.

FYI: In addition to HPA potentially reducing usable disk size, the size can also be artificially reduced via DCO. I am not aware of any Linux tools for addressing/eliminating artificial DCO restrictions.

Greg

Signature · 3 lines
Greg Freemyer
The Norcross Group
Forensics for the 21st Century
#5 lore raw
In reply to Tejun Heo
Quoted 3 lines · Tejun Heo
Quoted 2 lines · Matthew Garrett

On boot, Linux will attempt to disable the host protected area on a disk. After a suspend/resume cycle, the BIOS may reenable it (seen on a

...

Quoted 5 lines

This has come up several times now. One thing I'm curious about is
why we are disabling HPA on boot without consent from the user. AFAIK, HPA is mostly used to implement hidden recovery/suspend storage areas and disabling automatically on boot increases the likeliness of destroying them. What do we gain by disabling HPA on boot?

It simply implies one _must_not_ use linux-kernel 2.6 to prepare IDE drives, stay with 2.4 series for drive preparation until the bug is fixed.

I'd noticed the issue but ignored it as I still setup systems with 2.4 prior to installing 2.6.

--Grant.

#6 lore raw
In reply to Tejun Heo
Quoted 9 lines · On Tue, 12 Jul 2005 23:49:35 +0900 Tejun Heo wrote:
Quoted 7 lines · Matthew Garrett

On boot, Linux will attempt to disable the host protected area on a disk. After a suspend/resume cycle, the BIOS may reenable it (seen on a Thinkpad T40 and R40). As a result, the kernel is now unable to access the HPA.

Is there any issue with just adding a call to idedisk_check_hpa() in the IDE resume code?

Quoted 8 lines

This has come up several times now. One thing I'm curious about is
why we are disabling HPA on boot without consent from the user. AFAIK, HPA is mostly used to implement hidden recovery/suspend storage areas and disabling automatically on boot increases the likeliness of destroying them. What do we gain by disabling HPA on boot? Are there some dumb machines which unnecessarily sets HPA and reduces the capacity of drives excessively? Even in such cases, wouldn't it be better to do idedisk_check_hpa() only when kernel parameter explicitly says so?

Support for disabling HPA during boot is needed mainly for old machines with BIOS limitations. Some disks have jumpers which limit capacity to 32 GB, so that such old BIOSes can recognize the disk without hanging at boot; disabling HPA gives access to the whole capacity.