-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Auto max pa #6543
Auto max pa #6543
Conversation
unsigned int b = 0; | ||
|
||
if (IS_ENABLED(CFG_AUTO_MAX_PA_BITS)) | ||
return size_bits; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size_bits
is an index in const uint8_t map[] = { 32, 36, 40, 42, 44, 48, 52, };
, not the size in bits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and no. It's an index in that map, but it's also the PARange
field in ID_AA64MMFR0_EL1
and the IPS
field in TCR_EL1
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, my bad. This si ok.
uint8_t b = CFG_CORE_ARM64_PA_BITS; | ||
|
||
if (IS_ENABLED(CFG_AUTO_MAX_PA_BITS)) { | ||
const uint8_t map[] = { 32, 36, 40, 42, 44, 48, 52, }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe too much code in an inline function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, it's a bit on the heavy side. Would you prefer to move this into core/arch/arm/mm/core_mmu.c
or even core/arch/arm/mm/core_mmu_lpae.c
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
core_mmu_lpae.c
unsigned int b = 0; | ||
|
||
if (IS_ENABLED(CFG_AUTO_MAX_PA_BITS)) | ||
return size_bits; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, my bad. This si ok.
Update |
|
||
COMPILE_TIME_ASSERT(CFG_CORE_ARM64_PA_BITS >= 32); | ||
static_assert(CFG_CORE_ARM64_PA_BITS >= 32); | ||
static_assert(CFG_CORE_ARM64_PA_BITS <= 52); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function never returns TCR_PS_BITS_4PB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll update.
const uint8_t map[] = { 32, 36, 40, 42, 44, 48, 52, }; | ||
unsigned int size_bits = get_physical_addr_size_bits(); | ||
|
||
size_bits = MIN(size_bits, ARRAY_SIZE(map) - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert(size_bits < ARRAY_SIZE(map))
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to be future-proof. If Arm adds another value it's nice not to cause any breakage.
Update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
for commits
"core: arm64.h: add read_id_aa64mmfr0_el1()" and
"core: add CFG_AUTO_MAX_PA_BITS".
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
for commit
"plat-vexpress: use CFG_AUTO_MAX_PA_BITS on virtual platforms".
Add a read function for the system register ID_AA64MMFR0_EL1 and the mask ID_AA64MMFR0_EL1_PARANGE_MASK to extract the PARange field. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
Add the configuration variable CFG_AUTO_MAX_PA_BITS that enables automatic discovery of maximal PA supported by the hardware. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
By default set CFG_AUTO_MAX_PA_BITS=y on the virtual platforms fvp and qemu_armv8a to allow automatic configuration of the maximal supported physical address. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
1c3a17a
to
c99e4c3
Compare
Tags applied |
No description provided.