Skip to content

Hart drivers#95

Open
remexre wants to merge 2 commits intotrunkfrom
remexre/hart-drivers
Open

Hart drivers#95
remexre wants to merge 2 commits intotrunkfrom
remexre/hart-drivers

Conversation

@remexre
Copy link
Copy Markdown
Member

@remexre remexre commented Mar 21, 2026

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 3 times, most recently from 4755e12 to b417917 Compare April 9, 2026 01:27
remexre added 2 commits April 8, 2026 20:29
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 b417917 to 8a2d52f Compare April 9, 2026 01:29
@remexre remexre requested a review from jastintime April 9, 2026 01:29
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