Skip to content

--flash-gpu-escriptor: Keep bay power if already on#283

Merged
JohnAZoidberg merged 3 commits intomainfrom
keep-bay-power
Mar 12, 2026
Merged

--flash-gpu-escriptor: Keep bay power if already on#283
JohnAZoidberg merged 3 commits intomainfrom
keep-bay-power

Conversation

@JohnAZoidberg
Copy link
Member

@JohnAZoidberg JohnAZoidberg commented Mar 11, 2026

84ffa84 made sure to turn on and off the bay power to enable programming the EEPROM even with bad eeprom (which would cause EC not to turn on bay power).

But this would cause issue for reprogramming a good eeprom because the power is already on and it would turn it off afterwards.

So if the bay power if turned off for a GPU when windows with nvidia driver is running, the driver crashes and bluescreens Windows.

Fixes #240

@JohnAZoidberg JohnAZoidberg requested review from Copilot and kiram9 and removed request for kiram9 March 11, 2026 03:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts --flash_gpu_descriptor behavior to avoid toggling expansion bay GPU power when it’s already enabled, preventing NVIDIA driver crashes/BSOD during EEPROM reprogramming on Windows.

Changes:

  • Adds a GPIO read (gpu_3v_5v_en) to decide whether bay power needs to be forced on during GPU EEPROM writes.
  • Attempts to only disable bay power after flashing if it was enabled by this command (via force_power).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@JohnAZoidberg
Copy link
Member Author

image

Use hide whitespace option to review

84ffa84 made sure to turn on and off
the bay power to enable programming the EEPROM even with bad eeprom
(which would cause EC not to turn on bay power).

But this would cause issue for reprogramming a good eeprom because the
power is already on and it would turn it off afterwards.

So if the bay power if turned off for a GPU when windows with nvidia
driver is running, the driver crashes and bluescreens Windows.

Signed-off-by: Daniel Schaefer <dhs@frame.work>
Signed-off-by: Daniel Schaefer <dhs@frame.work>
@JohnAZoidberg JohnAZoidberg changed the title --flash_gpu_descriptor: Keep bay power if already on --flash-gpu_-escriptor: Keep bay power if already on Mar 12, 2026
@JohnAZoidberg JohnAZoidberg changed the title --flash-gpu_-escriptor: Keep bay power if already on --flash-gpu-escriptor: Keep bay power if already on Mar 12, 2026
@JohnAZoidberg JohnAZoidberg requested a review from Copilot March 12, 2026 01:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 1356 to 1368
if let Ok(ExpansionBayBoard::DualInterposer) = info.expansion_bay_board() {
/* Force power to the GPU if we are writing the EEPROM */
let res = self.set_gpio("gpu_3v_5v_en", true);
if let Err(err) = res {
error!("Failed to set ALW power to GPU off {:?}", err);
return Err(err);
// If bay power is on already, we don't need to enable/disable it
if !self.get_gpio("gpu_3v_5v_en")? {
// Force power to the GPU if we are writing the EEPROM
let res = self.set_gpio("gpu_3v_5v_en", true);
if let Err(err) = res {
error!("Failed to set ALW power to GPU on {:?}", err);
return Err(err);
}
println!("Forcing Power to GPU");
os_specific::sleep(100_000);
force_power = true;
}
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dry_run currently skips the actual EEPROM writes inside the chunk loop, but the bay-power GPIO manipulation and the initial sleep still run even in dry-run mode. This means --dry-run can still change hardware power state (and potentially impact a running OS/driver). Consider guarding the get_gpio/set_gpio/sleep block (and the later power-off restore) with if !dry_run, consistent with other flash paths in this module.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm that's a good idea

Signed-off-by: Daniel Schaefer <dhs@frame.work>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@JohnAZoidberg JohnAZoidberg merged commit deb7c7a into main Mar 12, 2026
12 checks passed
@JohnAZoidberg JohnAZoidberg deleted the keep-bay-power branch March 12, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants