your patch "x86, 8042: Enable A20 using KBC to fix S3 resume on some MSI laptops"
Ondrej,
I see two problems with this patch: For one, on a system without i8042 the code at the place it got inserted ought to incur a stall of 1s (50us * I8042_CTL_TIMEOUT [10000] * 2). I believe that this code should not be run before i8042_controller_check() completed successfully, but at the very least the second call to i8042_command() should be conditional upon the first being successful (effectively halving the stall).
Second, considering that enabling A20 (even if just in a fake way), is a core system operation, I don't think it belongs into a driver that is only optionally present in the kernel.
Jan
Quoted 9 lines · Jan Beulich
Ondrej,
I see two problems with this patch: For one, on a system without i8042 the code at the place it got inserted ought to incur a stall of 1s (50us *
I8042_CTL_TIMEOUT[10000] * 2). I believe that this code should not be run beforei8042_controller_check()completed successfully, but at the very least the second call toi8042_command()should be conditional upon the first being successful (effectively halving the stall).
I believe that all PnP-capable systems without 8042 will exit with -ENODEV after x86_platform.i8042_detect(). Old non-PnP systems usually have 8042.
Quoted 3 lines
Second, considering that enabling A20 (even if just in a fake way), is a core system operation, I don't think it belongs into a driver that is only optionally present in the kernel.
The first version of this patch added A20 enabling to early init code. But that could be dangerous as it was run before any 8042 detection, possibly breaking systems without 8042. I haven't found a better place for this.
Signature · 1 line
Ondrej Zary
Quoted 12 lines
Quoted 1 line
Quoted 1 line · Ondrej Zary
Quoted 9 lines · Jan Beulich
Ondrej,
I see two problems with this patch: For one, on a system without i8042 the code at the place it got inserted ought to incur a stall of 1s (50us *
I8042_CTL_TIMEOUT[10000] * 2). I believe that this code should not be run beforei8042_controller_check()completed successfully, but at the very least the second call toi8042_command()should be conditional upon the first being successful (effectively halving the stall).
Quoted 2 lines
I believe that all PnP-capable systems without 8042 will exit with
-ENODEVafterx86_platform.i8042_detect().
How that, with default_i8042_detect() being just "return 1;"?
Quoted 1 line
Old non-PnP systems usually have 8042.
Sure.
Quoted 7 lines
Quoted 3 lines
Second, considering that enabling A20 (even if just in a fake way), is a core system operation, I don't think it belongs into a driver that is only optionally present in the kernel.
The first version of this patch added A20 enabling to early init code. But that could be dangerous as it was run before any 8042 detection, possibly breaking systems without 8042. I haven't found a better place for this.
I realize that the change would be more intrusive, but imo that's not an excuse for not doing it properly.
Jan
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · Ondrej Zary
Quoted 9 lines · Jan Beulich
Ondrej,
I see two problems with this patch: For one, on a system without i8042 the code at the place it got inserted ought to incur a stall of 1s (50us *
I8042_CTL_TIMEOUT[10000] * 2). I believe that this code should not be run beforei8042_controller_check()completed successfully, but at the very least the second call toi8042_command()should be conditional upon the first being successful (effectively halving the stall).
Quoted 4 lines
Quoted 2 lines
I believe that all PnP-capable systems without 8042 will exit with
-ENODEVafterx86_platform.i8042_detect().How that, with
default_i8042_detect()being just "return 1;"?
Oops, I meant i8042_pnp_init(). But looking at the code again, it always returns 0, even when the controller is not found.
So probably the right place is after i8042_controller_check().
Quoted 8 lines
Quoted 1 line
Old non-PnP systems usually have 8042.
Sure.
Quoted 4 lines
Quoted 3 lines
Second, considering that enabling A20 (even if just in a fake way), is a core system operation, I don't think it belongs into a driver that is only optionally present in the kernel.
Quoted 7 lines
Quoted 4 lines
The first version of this patch added A20 enabling to early init code. But that could be dangerous as it was run before any 8042 detection, possibly breaking systems without 8042. I haven't found a better place for this.
I realize that the change would be more intrusive, but imo that's not an excuse for not doing it properly.
What's "properly"? Doing extra 8042 detection somewhere else does not look right.
Signature · 1 line
Ondrej Zary
Quoted 13 lines
Quoted 1 line
Quoted 1 line · Ondrej Zary
Quoted 11 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · Ondrej Zary
Quoted 3 lines · Jan Beulich
Second, considering that enabling A20 (even if just in a fake way), is a core system operation, I don't think it belongs into a driver that is only optionally present in the kernel.
The first version of this patch added A20 enabling to early init code. But that could be dangerous as it was run before any 8042 detection, possibly breaking systems without 8042. I haven't found a better place for this.
Quoted 5 lines
Quoted 2 lines
I realize that the change would be more intrusive, but imo that's not an excuse for not doing it properly.
What's "properly"? Doing extra 8042 detection somewhere else does not look right.
Why?
Jan
Quoted 6 lines · Jan Beulich
Quoted 3 lines
What's "properly"? Doing extra 8042 detection somewhere else does not look right.
Why?
Because it is time consuming, and threatens to step on things.
Enabling A20 is one thing, but this is something else... if we have the KBC, we want to enable A20 *again* just in case. Having the i8042 code in one place makes sense to me. This doesn't have to be done early. The affected systems are *extremely* unlikely to ever be run without the i8042 driver loaded, and the failure mode benign enough (if you actually want to run a specific laptop without the keyboard driver, you can't suspend it) that there really is no point to have yet another driver for the same hardware that would stomp on each other.
-hpa