Skip to content

Hart drivers#95

Open
remexre wants to merge 2 commits into
remexre/clang-supportfrom
remexre/hart-drivers
Open

Hart drivers#95
remexre wants to merge 2 commits into
remexre/clang-supportfrom
remexre/hart-drivers

Conversation

@remexre
Copy link
Copy Markdown
Member

@remexre remexre commented Mar 21, 2026

Stacked on #102.

We need to ensure that tasks are only scheduled on harts with the same
register_save_area size, meaning we need to track which harts have which
size.

It's easiest to keep track of this if we hook that tracking into
ordinary device detection, so this device class exists for that purpose.

/**
* The current task.
*/
struct task *task;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

should this be in this pr?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removed as of 0f56a8d.

Comment thread src/kernel/include/devices/hart.h Outdated
* A hart device.
*
* Currently, these devices are for "normal" SMP systems, where each hart runs
* its own copy of the kernel, makes its own scheduling decisions, etc. When we
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

copy is not good wording

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in d0a84a9

* 1024-bit vector registers. This would result in two hart groups, one for the
* X100 cores and one for the A100 cores.
*/
struct hart_group {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

does this need a refcount?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

added a todo for this in c66e856

Comment thread src/kernel/drivers/riscv_cpu.c Outdated
} else {
print("Devicetree device {cstr} did not have the thead,vlenb property",
node->name);
vlen = VLEN_1024;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

should this be VLEN_UNKNOWN?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in b417917

Comment thread src/kernel/main.c Outdated
run_selftests();

struct hart_locals *hart_locals = get_hart_locals();
print("{uptr}", hart_locals->hart);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

zap

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removed as of 0f56a8d.

Copy link
Copy Markdown
Member Author

@remexre remexre left a comment

Choose a reason for hiding this comment

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

reviewed in meeting

@remexre remexre force-pushed the remexre/hart-drivers branch from 60f3888 to 9e10d53 Compare March 28, 2026 17:25
@remexre remexre force-pushed the remexre/hart-drivers branch 4 times, most recently from b417917 to 8a2d52f Compare April 9, 2026 01:29
@remexre remexre requested a review from jastintime April 9, 2026 01:29
@remexre remexre force-pushed the remexre/hart-drivers branch from 8a2d52f to 4a2ab8d Compare April 25, 2026 15:23
@remexre remexre changed the base branch from trunk to remexre/clang-support April 25, 2026 15:23
@remexre remexre force-pushed the remexre/hart-drivers branch 2 times, most recently from dc7e2eb to 838abab Compare April 25, 2026 18:40
remexre added 2 commits April 26, 2026 02:25
We need to ensure that tasks are only scheduled on harts with the same
register_save_area size, meaning we need to track which harts have which
size.

It's easiest to keep track of this if we hook that tracking into
ordinary device detection, so this device class exists for that purpose.

Because init_boothart_hart_locals_late panics if it cannot find the hart
device for the boothart, this will not boot at the moment, though it
will build. The next patch fixes this.

Signed-off-by: Amy Ringo <me@remexre.com>
This restores the ability to boot, since the hart will now be properly
detected.

Signed-off-by: Amy Ringo <me@remexre.com>
@remexre remexre force-pushed the remexre/hart-drivers branch from 838abab to 0e53e89 Compare April 26, 2026 08:41
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.

1 participant