mbox series

[v4,0/4] Enable writable for idregs DFR0,PFR0, MMFR{0,1,2}

Message ID 20230607194554.87359-1-jingzhangos@google.com (mailing list archive)
Headers show
Series Enable writable for idregs DFR0,PFR0, MMFR{0,1,2} | expand

Message

Jing Zhang June 7, 2023, 7:45 p.m. UTC
This patch series enable userspace writable for below idregs:
ID_AA64DFR0_EL1, ID_DFR0_EL1, ID_AA64PFR0_EL1, ID_AA64MMFR{0, 1, 2}_EL1.

It is based on below series [2] which add infrastructure for writable idregs.

---

* v3 -> v4
  - Rebase on v11 of writable idregs series at [2].

* v2 -> v3
  - Rebase on v6 of writable idregs series.
  - Enable writable for ID_AA64PFR0_EL1 and ID_AA64MMFR{0, 1, 2}_EL1.

* v1 -> v2
  - Rebase on latest patch series [1] of enabling writable ID register.

[1] https://lore.kernel.org/all/20230402183735.3011540-1-jingzhangos@google.com
[2] https://lore.kernel.org/all/20230602005118.2899664-1-jingzhangos@google.com

[v1] https://lore.kernel.org/all/20230326011950.405749-1-jingzhangos@google.com
[v2] https://lore.kernel.org/all/20230403003723.3199828-1-jingzhangos@google.com
[v3] https://lore.kernel.org/all/20230405172146.297208-1-jingzhangos@google.com

---

Jing Zhang (4):
  KVM: arm64: Enable writable for ID_AA64DFR0_EL1
  KVM: arm64: Enable writable for ID_DFR0_EL1
  KVM: arm64: Enable writable for ID_AA64PFR0_EL1
  KVM: arm64: Enable writable for ID_AA64MMFR{0, 1, 2}_EL1

 arch/arm64/kvm/sys_regs.c | 78 +++++++++++++++++++++++++++++++++------
 1 file changed, 67 insertions(+), 11 deletions(-)


base-commit: 01b532e41af091a48287dd45f763db4b887bcdfc

Comments

Oliver Upton June 26, 2023, 8:52 p.m. UTC | #1
Hi Jing,

On Wed, Jun 07, 2023 at 07:45:50PM +0000, Jing Zhang wrote:
> 
> This patch series enable userspace writable for below idregs:
> ID_AA64DFR0_EL1, ID_DFR0_EL1, ID_AA64PFR0_EL1, ID_AA64MMFR{0, 1, 2}_EL1.
> 
> It is based on below series [2] which add infrastructure for writable idregs.

Could you implement some tests for these changes? We really need to see
that userspace is only allowed to select a subset of features that're
provided by the host, and that the CPU feature set never exceeds what
the host can support.

Additionally, there are places in the kernel where we use host ID
register values for the sake of emulation (DBGDIDR, LORegion). These
both should instead be using the _guest_ ID register values.
Jing Zhang July 5, 2023, 7:25 p.m. UTC | #2
Hi Oliver,

On Mon, Jun 26, 2023 at 1:52 PM Oliver Upton <oliver.upton@linux.dev> wrote:
>
> Hi Jing,
>
> On Wed, Jun 07, 2023 at 07:45:50PM +0000, Jing Zhang wrote:
> >
> > This patch series enable userspace writable for below idregs:
> > ID_AA64DFR0_EL1, ID_DFR0_EL1, ID_AA64PFR0_EL1, ID_AA64MMFR{0, 1, 2}_EL1.
> >
> > It is based on below series [2] which add infrastructure for writable idregs.
>
> Could you implement some tests for these changes? We really need to see
> that userspace is only allowed to select a subset of features that're
> provided by the host, and that the CPU feature set never exceeds what
> the host can support.
Sure, will add a selftest for these.
>
> Additionally, there are places in the kernel where we use host ID
> register values for the sake of emulation (DBGDIDR, LORegion). These
> both should instead be using the _guest_ ID register values.
Will add a new commit for these change.
>
> --
> Thanks,
> Oliver

Thanks,
Jing