← Documents Documentation/virt/kvm/arm/vcpu-features.rst GitHub 원문 ↗

Linux 6.18.37 · 가상화 / KVM / ARM

arm64 vCPU feature 선택

KVM_ARM_VCPU_INIT opt-in bitmap과 writable ID register mask로 guest CPU model을 제한하는 절차입니다.

Source pathDocumentation/virt/kvm/arm/vcpu-features.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

vcpu-features.rst:1-48

KVM_ARM_VCPU_INIT opt-in bitmap과 writable ID register mask로 guest CPU model을 제한하는 절차입니다.

API 이름, register, function ID, source path와 error code는 원문 표기를 유지했습니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 ===============================
4 vCPU feature selection on arm64
5 ===============================
6
7 KVM/arm64 provides two mechanisms that allow userspace to configure
8 the CPU features presented to the guest.
9
10 KVM_ARM_VCPU_INIT
11 =================
12
13 The ``KVM_ARM_VCPU_INIT`` ioctl accepts a bitmap of feature flags
14 (``struct kvm_vcpu_init::features``). Features enabled by this interface are
15 *opt-in* and may change/extend UAPI. See :ref:`KVM_ARM_VCPU_INIT` for complete
16 documentation of the features controlled by the ioctl.
17
18 Otherwise, all CPU features supported by KVM are described by the architected
19 ID registers.
20
21 The ID Registers
22 ================
23
24 The Arm architecture specifies a range of *ID Registers* that describe the set
25 of architectural features supported by the CPU implementation. KVM initializes
26 the guest's ID registers to the maximum set of CPU features supported by the
27 system. The ID register values may be VM-scoped in KVM, meaning that the
28 values could be shared for all vCPUs in a VM.
29
30 KVM allows userspace to *opt-out* of certain CPU features described by the ID
31 registers by writing values to them via the ``KVM_SET_ONE_REG`` ioctl. The ID
32 registers are mutable until the VM has started, i.e. userspace has called
33 ``KVM_RUN`` on at least one vCPU in the VM. Userspace can discover what fields
34 are mutable in the ID registers using the ``KVM_ARM_GET_REG_WRITABLE_MASKS``.
35 See the :ref:`ioctl documentation <KVM_ARM_GET_REG_WRITABLE_MASKS>` for more
36 details.
37
38 Userspace is allowed to *limit* or *mask* CPU features according to the rules
39 outlined by the architecture in DDI0487J.a D19.1.3 'Principles of the ID
40 scheme for fields in ID register'. KVM does not allow ID register values that
41 exceed the capabilities of the system.
42
43 .. warning::
44 It is **strongly recommended** that userspace modify the ID register values
45 before accessing the rest of the vCPU's CPU register state. KVM may use the
46 ID register values to control feature emulation. Interleaving ID register
47 modification with other system register accesses may lead to unpredictable
48 behavior.
49

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

KVM_ARM_VCPU_INIT opt-in feature

1-20

KVM/arm64는 userspace가 guest에 제시할 CPU feature를 구성하는 두 mechanism을 제공합니다. 일부는 `KVM_ARM_VCPU_INIT` bitmap으로 명시적으로 opt-in하고, 나머지 architecture feature는 ID register로 기술합니다.

`KVM_ARM_VCPU_INIT` ioctl은 `struct kvm_vcpu_init::features` bitmap을 받습니다. 이 interface의 feature는 opt-in이며 UAPI가 확장될 수 있으므로 각 flag의 완전한 계약은 `KVM_ARM_VCPU_INIT` ioctl 문서를 따라야 합니다.

.. SPDX-License-Identifier: GPL-2.0

===============================
vCPU feature selection on arm64
===============================

KVM/arm64 provides two mechanisms that allow userspace to configure
the CPU features presented to the guest.

KVM_ARM_VCPU_INIT
=================

The ``KVM_ARM_VCPU_INIT`` ioctl accepts a bitmap of feature flags
(``struct kvm_vcpu_init::features``). Features enabled by this interface are
*opt-in* and may change/extend UAPI. See :ref:`KVM_ARM_VCPU_INIT` for complete
documentation of the features controlled by the ioctl.

Otherwise, all CPU features supported by KVM are described by the architected
ID registers.

ID register 기반 feature 제한

21-48

Arm ID Register는 CPU implementation이 지원하는 architectural feature 집합을 나타냅니다. KVM은 guest ID register를 system이 지원하는 최대 feature 집합으로 초기화하며, 값이 VM scope라 한 VM의 모든 vCPU가 공유할 수 있습니다.

Userspace는 `KVM_SET_ONE_REG`로 특정 ID register field를 낮춰 feature를 opt-out할 수 있습니다. ID register는 VM의 어느 vCPU에도 아직 `KVM_RUN`을 호출하지 않은 동안만 변경할 수 있습니다.

`KVM_ARM_GET_REG_WRITABLE_MASKS`는 각 ID register에서 변경 가능한 field를 알려줍니다. Userspace는 Arm DDI0487J.a D19.1.3의 ID scheme 원칙에 따라 feature를 제한하거나 mask할 수 있지만 host system 능력을 넘는 값은 KVM이 허용하지 않습니다.

arm64 CPU model 고정 순서
KVM_ARM_VCPU_INIT으로 opt-in feature 선택KVM_ARM_GET_REG_WRITABLE_MASKS로 mutable field 조회KVM_SET_ONE_REG로 ID register feature 제한나머지 vCPU register state 접근·설정첫 KVM_RUN 뒤 CPU model 고정

ID register가 feature emulation에 영향을 주므로 다른 register보다 먼저 확정합니다.

ID register 수정과 다른 system register access를 섞으면 KVM이 feature emulation을 구성하는 도중 상태가 어긋나 예측할 수 없는 동작이 생길 수 있습니다. 따라서 userspace는 나머지 vCPU CPU register state에 접근하기 전에 ID register 값을 먼저 변경하는 것이 강하게 권장됩니다.

The ID Registers
================

The Arm architecture specifies a range of *ID Registers* that describe the set
of architectural features supported by the CPU implementation. KVM initializes
the guest's ID registers to the maximum set of CPU features supported by the
system. The ID register values may be VM-scoped in KVM, meaning that the
values could be shared for all vCPUs in a VM.

KVM allows userspace to *opt-out* of certain CPU features described by the ID
registers by writing values to them via the ``KVM_SET_ONE_REG`` ioctl. The ID
registers are mutable until the VM has started, i.e. userspace has called
``KVM_RUN`` on at least one vCPU in the VM. Userspace can discover what fields
are mutable in the ID registers using the ``KVM_ARM_GET_REG_WRITABLE_MASKS``.
See the :ref:`ioctl documentation <KVM_ARM_GET_REG_WRITABLE_MASKS>` for more
details.

Userspace is allowed to *limit* or *mask* CPU features according to the rules
outlined by the architecture in DDI0487J.a D19.1.3 'Principles of the ID
scheme for fields in ID register'. KVM does not allow ID register values that
exceed the capabilities of the system.

.. warning::
   It is **strongly recommended** that userspace modify the ID register values
   before accessing the rest of the vCPU's CPU register state. KVM may use the
   ID register values to control feature emulation. Interleaving ID register
   modification with other system register accesses may lead to unpredictable
   behavior.