[PATCH v3 0/9] target/arm: Implement SEL2 physical and virtual timers

Peter Maydell posted 9 patches 1 month, 1 week ago
include/hw/arm/bsa.h       |   2 +
target/arm/cpu.h           |   2 +
target/arm/gtimer.h        |  14 +-
target/arm/internals.h     |   5 +-
hw/arm/sbsa-ref.c          |   2 +
hw/arm/virt.c              |   2 +
target/arm/cpu.c           |   4 +
target/arm/helper.c        | 324 ++++++++++++++++++++++++++++++-------
target/arm/tcg/op_helper.c |   8 +-
9 files changed, 296 insertions(+), 67 deletions(-)
[PATCH v3 0/9] target/arm: Implement SEL2 physical and virtual timers
Posted by Peter Maydell 1 month, 1 week ago
This patchset is a respin of Alex's patches, with some extra fixes
for bugs I discovered along the way in our existing code (and
a bit of refactoring to make the fixes straightforward). It is:

Based-on: 20250130182309.717346-1-peter.maydell@linaro.org
("target/arm: Clean up some corner cases of sysreg traps")

because it wants to use the renamed CP_ACCESS_* constants that
that patchset introduced.

The bugfixes are not super exciting as they mostly are oddball
corner cases, but I've cc'd them to stable anyway. The actual
implementation of the missing SEL2 timers also should go to stable.

Alex Bennée (4):
  target/arm: Implement SEL2 physical and virtual timers
  target/arm: document the architectural names of our GTIMERs
  hw/arm: enable secure EL2 timers for virt machine
  hw/arm: enable secure EL2 timers for sbsa machine

Peter Maydell (5):
  target/arm: Apply correct timer offset when calculating deadlines
  target/arm: Don't apply CNTVOFF_EL2 for EL2_VIRT timer
  target/arm: Make CNTPS_* UNDEF from Secure EL1 when Secure EL2 is
    enabled
  target/arm: Always apply CNTVOFF_EL2 for CNTV_TVAL_EL02 accesses
  target/arm: Refactor handling of timer offset for direct register
    accesses

 include/hw/arm/bsa.h       |   2 +
 target/arm/cpu.h           |   2 +
 target/arm/gtimer.h        |  14 +-
 target/arm/internals.h     |   5 +-
 hw/arm/sbsa-ref.c          |   2 +
 hw/arm/virt.c              |   2 +
 target/arm/cpu.c           |   4 +
 target/arm/helper.c        | 324 ++++++++++++++++++++++++++++++-------
 target/arm/tcg/op_helper.c |   8 +-
 9 files changed, 296 insertions(+), 67 deletions(-)

-- 
2.34.1


Re: [PATCH v3 0/9] target/arm: Implement SEL2 physical and virtual timers
Posted by Peter Maydell 2 weeks, 6 days ago
Ping? Patches 1-5 need review here.

thanks
-- PMM

On Tue, 4 Feb 2025 at 12:50, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> This patchset is a respin of Alex's patches, with some extra fixes
> for bugs I discovered along the way in our existing code (and
> a bit of refactoring to make the fixes straightforward). It is:
>
> Based-on: 20250130182309.717346-1-peter.maydell@linaro.org
> ("target/arm: Clean up some corner cases of sysreg traps")
>
> because it wants to use the renamed CP_ACCESS_* constants that
> that patchset introduced.
>
> The bugfixes are not super exciting as they mostly are oddball
> corner cases, but I've cc'd them to stable anyway. The actual
> implementation of the missing SEL2 timers also should go to stable.
>
> Alex Bennée (4):
>   target/arm: Implement SEL2 physical and virtual timers
>   target/arm: document the architectural names of our GTIMERs
>   hw/arm: enable secure EL2 timers for virt machine
>   hw/arm: enable secure EL2 timers for sbsa machine
>
> Peter Maydell (5):
>   target/arm: Apply correct timer offset when calculating deadlines
>   target/arm: Don't apply CNTVOFF_EL2 for EL2_VIRT timer
>   target/arm: Make CNTPS_* UNDEF from Secure EL1 when Secure EL2 is
>     enabled
>   target/arm: Always apply CNTVOFF_EL2 for CNTV_TVAL_EL02 accesses
>   target/arm: Refactor handling of timer offset for direct register
>     accesses
>
>  include/hw/arm/bsa.h       |   2 +
>  target/arm/cpu.h           |   2 +
>  target/arm/gtimer.h        |  14 +-
>  target/arm/internals.h     |   5 +-
>  hw/arm/sbsa-ref.c          |   2 +
>  hw/arm/virt.c              |   2 +
>  target/arm/cpu.c           |   4 +
>  target/arm/helper.c        | 324 ++++++++++++++++++++++++++++++-------
>  target/arm/tcg/op_helper.c |   8 +-
>  9 files changed, 296 insertions(+), 67 deletions(-)
>
Re: [PATCH v3 0/9] target/arm: Implement SEL2 physical and virtual timers
Posted by Michael Tokarev 4 days, 14 hours ago
04.02.2025 15:50, Peter Maydell wrote:
> This patchset is a respin of Alex's patches, with some extra fixes
> for bugs I discovered along the way in our existing code (and
> a bit of refactoring to make the fixes straightforward). It is:
> 
> Based-on: 20250130182309.717346-1-peter.maydell@linaro.org
> ("target/arm: Clean up some corner cases of sysreg traps")
> 
> because it wants to use the renamed CP_ACCESS_* constants that
> that patchset introduced.
> 
> The bugfixes are not super exciting as they mostly are oddball
> corner cases, but I've cc'd them to stable anyway. The actual
> implementation of the missing SEL2 timers also should go to stable.
> 
> Alex Bennée (4):
>    target/arm: Implement SEL2 physical and virtual timers
>    target/arm: document the architectural names of our GTIMERs
>    hw/arm: enable secure EL2 timers for virt machine
>    hw/arm: enable secure EL2 timers for sbsa machine
> 
> Peter Maydell (5):
>    target/arm: Apply correct timer offset when calculating deadlines
>    target/arm: Don't apply CNTVOFF_EL2 for EL2_VIRT timer
>    target/arm: Make CNTPS_* UNDEF from Secure EL1 when Secure EL2 is
>      enabled
>    target/arm: Always apply CNTVOFF_EL2 for CNTV_TVAL_EL02 accesses
>    target/arm: Refactor handling of timer offset for direct register
>      accesses

Hi!

Which stable series this patchset is supposed to be applied to?
(Current active stable series are 7.2, 8.2 and 9.2)

Or put it in other words, is it supposed to go earlier than the
most recent stable series, 9.2?

For example, the very first patch, "Apply correct timer offset when calculating
deadlines", does not apply to 8.2 because it lacks v8.2.0-2122-g2808d3b38a
"target/arm: Implement FEAT_ECV CNTPOFF_EL2 handling" which touches the same
line in target/arm/helper.c:gt_recalc_timer().

Thanks,

/mjt

Re: [PATCH v3 0/9] target/arm: Implement SEL2 physical and virtual timers
Posted by Alex Bennée 4 days, 7 hours ago
Michael Tokarev <mjt@tls.msk.ru> writes:

> 04.02.2025 15:50, Peter Maydell wrote:
>> This patchset is a respin of Alex's patches, with some extra fixes
>> for bugs I discovered along the way in our existing code (and
>> a bit of refactoring to make the fixes straightforward). It is:
>> Based-on: 20250130182309.717346-1-peter.maydell@linaro.org
>> ("target/arm: Clean up some corner cases of sysreg traps")
>> because it wants to use the renamed CP_ACCESS_* constants that
>> that patchset introduced.
>> The bugfixes are not super exciting as they mostly are oddball
>> corner cases, but I've cc'd them to stable anyway. The actual
>> implementation of the missing SEL2 timers also should go to stable.
>> Alex Bennée (4):
>>    target/arm: Implement SEL2 physical and virtual timers
>>    target/arm: document the architectural names of our GTIMERs
>>    hw/arm: enable secure EL2 timers for virt machine
>>    hw/arm: enable secure EL2 timers for sbsa machine
>> Peter Maydell (5):
>>    target/arm: Apply correct timer offset when calculating deadlines
>>    target/arm: Don't apply CNTVOFF_EL2 for EL2_VIRT timer
>>    target/arm: Make CNTPS_* UNDEF from Secure EL1 when Secure EL2 is
>>      enabled
>>    target/arm: Always apply CNTVOFF_EL2 for CNTV_TVAL_EL02 accesses
>>    target/arm: Refactor handling of timer offset for direct register
>>      accesses
>
> Hi!
>
> Which stable series this patchset is supposed to be applied to?
> (Current active stable series are 7.2, 8.2 and 9.2)
>
> Or put it in other words, is it supposed to go earlier than the
> most recent stable series, 9.2?

I'd just do 9.2 because I think as you've found too much has changed.
That should become available in backports while we wait for trixie to
stabilise this year.

>
> For example, the very first patch, "Apply correct timer offset when calculating
> deadlines", does not apply to 8.2 because it lacks v8.2.0-2122-g2808d3b38a
> "target/arm: Implement FEAT_ECV CNTPOFF_EL2 handling" which touches the same
> line in target/arm/helper.c:gt_recalc_timer().
>
> Thanks,
>
> /mjt

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro