Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a Medusa image #1806

Merged
merged 17 commits into from
Jun 13, 2024
Merged

Adds a Medusa image #1806

merged 17 commits into from
Jun 13, 2024

Conversation

Aaron-Hartwig
Copy link
Contributor

@Aaron-Hartwig Aaron-Hartwig commented Jun 3, 2024

The primary purpose of this PR is to sketch out an initial stab at an image for Medusa, our QSFP front IO test fixture (details on that in RFD 405). The Medusa-specific logic lives in medusa-seq-server. The current goal is just to support hardware bringup, and thus that sequencer just attempts to power on the front IO board and then program its FPGAs. It also checks the status of the various power rails on Medusa and exposes an interface to control those rails (on Sidecar this functionality is handled by the FPGA).

An adjacent piece of work here is that Medusa does not have any fans to control and that broke the previous mold of "everything with thermal has fans". thermal logs sensor data and wants to control fan speeds off that data. So the Medusa thermal BSP looks a bit odd compared to the others. Additionally, the transceivers task had a thermal-control feature flag added to gate the interactions with thermal (Sidecar will have this feature set, Medusa will not).

Lastly, there's some ugliness that I did for the sake of expediency given my personal situation. Until I can actually land #1805, Medusa simply copies some code from Sidecar. Once this PR lands, I will extend #1805 to cleanup Medusa as well.

Closes #1571

@Aaron-Hartwig
Copy link
Contributor Author

I'm opening this branch up as a draft PR just so we know where this work is at with my leave looming. There is a bunch of copy/paste here that can get addressed properly once #1805 lands.

@Aaron-Hartwig Aaron-Hartwig marked this pull request as ready for review June 3, 2024 21:53
aapoalas

This comment was marked as resolved.

Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

Overall, this looks good! You know a lot more about Medusa's design than I do, so I focused on the code rather than on what it's doing. I left some style suggestions, most of which aren't really a big deal.

I do think it would be nice to make the task-thermal-api dependency in drv-transcievers-server optional, so that the thermal API doesn't have to be compiled in when thermal control is disabled. This could potentially make Medusa builds slightly faster, which is probably nice to have. Other than that, my suggestions were just minor style nits.

app/medusa/src/main.rs Show resolved Hide resolved
app/medusa/src/main.rs Show resolved Hide resolved
drv/medusa-seq-api/src/lib.rs Outdated Show resolved Hide resolved
Comment on lines +77 to +104
if ident_valid && checksum_valid {
ringbuf_entry!(Trace::SkipLoadingFrontIOControllerBitstream {
fpga_id: i
});
} else {
ringbuf_entry!(Trace::LoadingFrontIOControllerBitstream {
fpga_id: i
});

if let Err(e) = controller.load_bitstream(self.auxflash_task) {
ringbuf_entry!(Trace::FpgaBitstreamError(u32::from(e)));
return Err(e);
}

(ident, ident_valid) = controller.ident_valid()?;
ringbuf_entry!(Trace::FrontIOControllerIdent {
fpga_id: i,
ident
});

controller.write_checksum()?;
(checksum, checksum_valid) = controller.checksum_valid()?;
ringbuf_entry!(Trace::FrontIOControllerChecksum {
fpga_id: i,
checksum,
expected: FrontIOController::short_checksum(),
});
}
Copy link
Member

Choose a reason for hiding this comment

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

style nit, take it or leave it: i might consider using continue here so that the rest of the code doesn't drift to the right; others may disagree with me on this though:

Suggested change
if ident_valid && checksum_valid {
ringbuf_entry!(Trace::SkipLoadingFrontIOControllerBitstream {
fpga_id: i
});
} else {
ringbuf_entry!(Trace::LoadingFrontIOControllerBitstream {
fpga_id: i
});
if let Err(e) = controller.load_bitstream(self.auxflash_task) {
ringbuf_entry!(Trace::FpgaBitstreamError(u32::from(e)));
return Err(e);
}
(ident, ident_valid) = controller.ident_valid()?;
ringbuf_entry!(Trace::FrontIOControllerIdent {
fpga_id: i,
ident
});
controller.write_checksum()?;
(checksum, checksum_valid) = controller.checksum_valid()?;
ringbuf_entry!(Trace::FrontIOControllerChecksum {
fpga_id: i,
checksum,
expected: FrontIOController::short_checksum(),
});
}
if ident_valid && checksum_valid {
ringbuf_entry!(Trace::SkipLoadingFrontIOControllerBitstream {
fpga_id: i
});
continue;
}
ringbuf_entry!(Trace::LoadingFrontIOControllerBitstream {
fpga_id: i
});
if let Err(e) = controller.load_bitstream(self.auxflash_task) {
ringbuf_entry!(Trace::FpgaBitstreamError(u32::from(e)));
return Err(e);
}
(ident, ident_valid) = controller.ident_valid()?;
ringbuf_entry!(Trace::FrontIOControllerIdent {
fpga_id: i,
ident
});
controller.write_checksum()?;
(checksum, checksum_valid) = controller.checksum_valid()?;
ringbuf_entry!(Trace::FrontIOControllerChecksum {
fpga_id: i,
checksum,
expected: FrontIOController::short_checksum(),
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hear you on this, but I'm going to opt to keep it the way it is right now. This file is just copy/paste from https://github.com/oxidecomputer/hubris/blob/master/drv/sidecar-mainboard-controller/src/front_io.rs to get a quick solution here. In #1805, which I've not attempted to land before I go on leave, this could get addressed properly.

Comment on lines +77 to +80
if ident_valid && checksum_valid {
ringbuf_entry!(Trace::SkipLoadingFrontIOControllerBitstream {
fpga_id: i
});
Copy link
Member

Choose a reason for hiding this comment

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

it might be nice to have a comment here saying that we don't need to do anything because we are already running the expected bitstream. or, we could rename the ringbuf entry to something like FrontIOControllerBitstreamAlreadyLoaded so that it's clear to the reader why we stop here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I state in the comment above, I'm going to leave this file as pure copy/paste as possible for now just to keep Sidecar/medusa as identical as possible until I can better unify the Front IO control stuff via #1805.

drv/transceivers-server/src/main.rs Outdated Show resolved Hide resolved
task/net/src/bsp/medusa_a.rs Outdated Show resolved Hide resolved
task/thermal/Cargo.toml Outdated Show resolved Hide resolved
task/thermal/src/bsp/medusa_a.rs Show resolved Hide resolved
task/thermal/src/bsp/medusa_a.rs Outdated Show resolved Hide resolved
@Aaron-Hartwig Aaron-Hartwig enabled auto-merge (squash) June 13, 2024 20:41
@Aaron-Hartwig Aaron-Hartwig merged commit c7f0b3e into master Jun 13, 2024
104 checks passed
@Aaron-Hartwig Aaron-Hartwig deleted the cbiffle/medusa branch June 13, 2024 20:49
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.

Create an application TOML for the QSFP tester
4 participants