linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 00/13] arm64/kvm: use common sysreg definitions
@ 2017-01-31 18:05 Mark Rutland
  2017-01-31 18:05 ` [RFC PATCH 01/13] arm64: sysreg: sort by encoding Mark Rutland
                   ` (13 more replies)
  0 siblings, 14 replies; 16+ messages in thread
From: Mark Rutland @ 2017-01-31 18:05 UTC (permalink / raw)
  To: linux-arm-kernel

Whenever we add new functionality involving new system registers, we need to
add sys_reg() definitions so that we can access the registers regardless of
whether the toolchain can assemble them. At the same time, we have to add
duplicate definitions of the register encodings to KVM's sysreg tables, so that
we can handle any configurable traps. This redundancy is unfortunate, and
defining the encodings directly in the sysreg tables can make those tables
difficult to read.

This series attempts to address both of these issues by allowing us to use
common sys_reg() mnemonics in <asm/sysreg.h> to initialise KVM's sysreg tables.
To that end, this series tries to make <asm/sysreg.h> the canonical location
for common sysreg encodings.

Largely, I've only attacked the AArch64-native SYS encodings required by KVM
today, though for the debug and perfmon groups it was easier to take the whole
group from the ARM ARM than to filter them to only what KVM needed. I've
ignored CP{15,14} registers for now, but these could be encoded similarly.

To verify that I haven't accidentally broken KVM, I've diffed sys_regs.o and
sys_regs_generic_v8.o on a section-by-section basis before and after the series
is applied. The .text, .data, and .rodata sections (and most others) are
identical. The __bug_table section, and some .debug* sections differ, and this
appears to be due to line numbers changing due to removed lines.

One thing I wasn't sure how to address was banks of registers such as
PMEVCNTR<n>_EL0. We currently enumerate all cases for our GICv3 definitions,
but it seemed painful to expand ~30 cases for PMEVCNTR<n>_EL0 and friends, and
for these I've made the macros take an 'n' parameter.

The series is based on the arm64/for-next/core branch, since it relies on
commit c9ee0f98662a6e35 ("arm64: cpufeature: Define helpers for sys_reg id")
for the definition of SYS_DESC().

Thanks,
Mark.

Mark Rutland (13):
  arm64: sysreg: sort by encoding
  arm64: sysreg: add debug system registers
  arm64: sysreg: add performance monitor registers
  arm64: sysreg: subsume GICv3 sysreg definitions
  arm64: sysreg: add register encodings used by KVM
  arm64: sysreg: add Set/Way sys encodings
  arm64: kvm: add SYS_DESC()
  arm64: kvm: Use common debug sysreg definitions
  arm64: kvm: Use common performance monitor sysreg definitions
  arm64: kvm: Use common GICv3 sysreg definitions
  arm64: kvm: use common invariant sysreg definitions
  arm64: kvm: Use common sysreg definitions
  arm64: kvm: Use common Set/Way sys definitions

 arch/arm64/include/asm/arch_gicv3.h  |  81 ++-------
 arch/arm64/include/asm/sysreg.h      | 158 +++++++++++++++-
 arch/arm64/kernel/head.S             |   8 +-
 arch/arm64/kvm/sys_regs.c            | 344 +++++++++++------------------------
 arch/arm64/kvm/sys_regs.h            |   5 +
 arch/arm64/kvm/sys_regs_generic_v8.c |   4 +-
 6 files changed, 276 insertions(+), 324 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-02-24 12:16 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-31 18:05 [RFC PATCH 00/13] arm64/kvm: use common sysreg definitions Mark Rutland
2017-01-31 18:05 ` [RFC PATCH 01/13] arm64: sysreg: sort by encoding Mark Rutland
2017-01-31 18:05 ` [RFC PATCH 02/13] arm64: sysreg: add debug system registers Mark Rutland
2017-01-31 18:05 ` [RFC PATCH 03/13] arm64: sysreg: add performance monitor registers Mark Rutland
2017-01-31 18:05 ` [RFC PATCH 04/13] arm64: sysreg: subsume GICv3 sysreg definitions Mark Rutland
2017-01-31 18:05 ` [RFC PATCH 05/13] arm64: sysreg: add register encodings used by KVM Mark Rutland
2017-01-31 18:05 ` [RFC PATCH 06/13] arm64: sysreg: add Set/Way sys encodings Mark Rutland
2017-01-31 18:05 ` [RFC PATCH 07/13] arm64: kvm: add SYS_DESC() Mark Rutland
2017-01-31 18:05 ` [RFC PATCH 08/13] arm64: kvm: Use common debug sysreg definitions Mark Rutland
2017-01-31 18:05 ` [RFC PATCH 09/13] arm64: kvm: Use common performance monitor " Mark Rutland
2017-01-31 18:05 ` [RFC PATCH 10/13] arm64: kvm: Use common GICv3 " Mark Rutland
2017-01-31 18:05 ` [RFC PATCH 11/13] arm64: kvm: use common invariant " Mark Rutland
2017-01-31 18:05 ` [RFC PATCH 12/13] arm64: kvm: Use common " Mark Rutland
2017-01-31 18:05 ` [RFC PATCH 13/13] arm64: kvm: Use common Set/Way sys definitions Mark Rutland
2017-02-24 10:16 ` [RFC PATCH 00/13] arm64/kvm: use common sysreg definitions Christoffer Dall
2017-02-24 12:16   ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).