Skip to content

KVM: x86: x86.{c,h} spring cleaning

Sean Christopherson kvm lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest30 patches 61 repliesIn review
  2. v340 patches 78 repliesSuperseded
  3. v215 patches 36 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v111 patches21 repliesSuperseded

Changes in v4 from the cover letter

- Drop the GPR API cleanups (already applied).
- Collect more tags. [Yosry, Kai
- Chunked the x86.c => regs.c code movement into several patches, so that the bulk move is as close to a pure move as is reasonably possible. [Yosry]
- Drop a redundant BUILD_BUG_ON() from store_regs().
- Fix various changelog goofs. [Kai]
- Fix alignment goofs in kvm_get_{,feature_}msr_index_list(). [Kai]
- Drop the defunct x86.h include from mtrr.c. [Kai]
- Fix whitespace goofs. [Kai]
- Rewrite the changelog for the bulk regs.c move to better explain why only a tiny amount of EFER code is moved. [Yosry]
- Move "struct kvm_x86_msr_filter" and "struct kvm_x86_pmu_event_filter" to msrs.c and pmu.c respectively. [Kai]
- Rename LDT helpers to vmx_{load,store}_ldt(), and call out that they will hopefully be replaced by kernel helpers in the near future. [Kai]
- Drop the kvm_cpu_get_apicid() code movement (sent a separate patch to kill it off entirely). [Kai]
- Add more detail to explain why using VALID_MASK defines outside of x86.c is dangerous. [Yosry, Kai]
- Bury kvm_arch_interrupt_allowed() in x86.c as kvm_is_interrupt_allowed(). [Kai]
- Move kvm_find_async_pf_gfn() prototype to x86.h. [Sashiko]

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/30KVM: x86: Extract REGS and SREGS runtime sync code to helpersarch/x86/kvm/x86.c+15 -22 replies
2/30KVM: x86: Move get_segment_base() to regs.h, as kvm_get_segment_base()arch/x86/kvm/regs.h arch/x86/kvm/x86.c+7 -72 replies
3/30KVM: x86: Rename __{g,s}et_sregs2() => kvm_x86_vcpu_ioctl_{g,s}et_sregs2()arch/x86/kvm/x86.c+10 -63 replies
4/30KVM: x86: Move the bulk of register specific code from x86.c to regs.carch/x86/kvm/Makefile arch/x86/kvm/regs.c arch/x86/kvm/regs.h +2 more+906 -8871 reply
5/30KVM: x86: Move local APIC specific helpers out of asm/kvm_host.harch/x86/include/asm/kvm_host.h arch/x86/kvm/irq.c arch/x86/kvm/lapic.h+12 -122 replies
6/30KVM: x86: Move kvm_caps and kvm_host_values to asm/kvm_host.harch/x86/include/asm/kvm_host.h arch/x86/kvm/x86.h+44 -454 replies
7/30KVM: x86: Swap the include order between x86.h and mmu.harch/x86/kvm/mmu.h arch/x86/kvm/x86.h+6 -61 reply
8/30KVM: x86: Move tdp_enabled from kvm_host.h to mmu.harch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu.h+6 -81 reply
9/30KVM: x86: Move eager_page_split to mmu.{c,h}arch/x86/kvm/mmu.h arch/x86/kvm/mmu/mmu.c arch/x86/kvm/x86.c +1 more+4 -52 replies
10/30KVM: x86/hyperv: Eliminate an unnecessary include of x86.h in hyperv.harch/x86/kvm/cpuid.c arch/x86/kvm/hyperv.h+3 -11 reply
11/30KVM: x86: Move kvm_{load,put}_guest_fpu() to fpu.harch/x86/kvm/fpu.h arch/x86/kvm/x86.c+26 -242 replies
12/30KVM: x86: Extract get/set MSR (list) ioctl logic to helpersarch/x86/kvm/x86.c+78 -571 reply
13/30KVM: x86: Expose several TSC helpers via x86.h for use by MSR codearch/x86/kvm/x86.c arch/x86/kvm/x86.h+22 -190 replies
14/30KVM: x86: Move the bulk of MSR specific code from x86.c to msrs.{c,h}arch/x86/kvm/Makefile arch/x86/kvm/msrs.c arch/x86/kvm/msrs.h +3 more+2867 -27941 reply
15/30KVM: x86: Move register helper declarations from kvm_host.h => regs.harch/x86/include/asm/kvm_host.h arch/x86/kvm/regs.h+18 -191 reply
16/30KVM: x86: Move kvm_{g,s}et_segment() to inline helpers in regs.harch/x86/include/asm/kvm_host.h arch/x86/kvm/regs.h arch/x86/kvm/x86.c+12 -141 reply
17/30KVM: x86: Move MSR helper declarations from kvm_host.h => msrs.harch/x86/include/asm/kvm_host.h arch/x86/kvm/msrs.h+31 -291 reply
18/30KVM: x86: Move "struct kvm_x86_msr_filter" definition to msrs.carch/x86/include/asm/kvm_host.h arch/x86/kvm/msrs.c+15 -139 replies
19/30KVM: x86/pmu: Move "struct kvm_x86_pmu_event_filter" definition to pmu.carch/x86/include/asm/kvm_host.h arch/x86/kvm/pmu.c+13 -122 replies
20/30KVM: x86: Move MMU helper declarations from kvm_host.h => mmu.harch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu.h+71 -701 reply
21/30KVM: x86: Move LLDT assembly wrappers into VMXarch/x86/include/asm/kvm_host.h arch/x86/kvm/vmx/vmx.c+15 -151 reply
22/30KVM: x86: Move misc "VALID MASK" defines from kvm_host.h => x86.carch/x86/include/asm/kvm_host.h arch/x86/kvm/x86.c+33 -341 reply
23/30KVM: x86: Move __kvm_irq_line_state() from kvm_host.h => ioapic.harch/x86/include/asm/kvm_host.h arch/x86/kvm/ioapic.h+12 -121 reply
24/30KVM: x86: Move IRQ-related helper declarations from kvm_host.h => irq.harch/x86/include/asm/kvm_host.h arch/x86/kvm/irq.h arch/x86/kvm/svm/nested.c +1 more+8 -52 replies
25/30KVM: x86: Move kvm_pv_send_ipi() declaration from kvm_host.h => lapic.harch/x86/include/asm/kvm_host.h arch/x86/kvm/lapic.h+3 -41 reply
26/30KVM: x86: Don't treat interrupts as allowed just because a nested run is pendingarch/x86/kvm/svm/svm.c arch/x86/kvm/vmx/vmx.c+7 -48 replies
27/30KVM: x86: Rework kvm_arch_interrupt_allowed() into kvm_is_interrupt_allowed()arch/x86/include/asm/kvm_host.h arch/x86/kvm/x86.c+15 -90 replies
28/30KVM: x86/mmu: Move kvm_arch_async_page_ready() below kvm_tdp_page_fault()arch/x86/kvm/mmu/mmu.c+31 -311 reply
29/30KVM: x86/mmu: Move kvm_mmu_do_page_fault() from mmu_internal.h => mmu.carch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/mmu_internal.h+66 -671 reply
30/30KVM: x86: Move a pile of stuff from kvm_host.h => x86.harch/x86/include/asm/kvm_host.h arch/x86/kvm/ioapic.c arch/x86/kvm/x86.h+198 -1992 replies

Reviews trailers per patch

27 of 30 patches have a Reviewed-by or Acked-by.

PatchKai HuangYosry AhmedBinbin Wu
1/30R-b R-b
2/30R-b R-b
3/30R-b
4/30R-b R-b
5/30R-b R-b R-b
6/30R-b R-b
7/30R-b R-b
8/30R-b R-b R-b
9/30R-b R-b R-b
10/30R-b R-b
11/30R-b R-b R-b
12/30R-b R-b R-b
13/30R-b
14/30R-b R-b
15/30R-b R-b
16/30R-b R-b R-b
17/30R-b R-b
18/30R-b R-b
19/30R-b R-b
20/30R-b R-b R-b
21/30R-b
22/30R-b R-b R-b
23/30R-b R-b R-b
24/30R-b R-b R-b
25/30R-b R-b R-b
26/30
27/30
28/30R-b R-b R-b
29/30R-b R-b R-b
30/30

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v4 thread

Cover letter [PATCH v4 00/30] KVM: x86: x86.{c,h} spring cleaning

It's still technically spring!

Perform spring cleaning on x86.{c,h} and asm/kvm_host.h, by adding regs.c (the kvm_cache_regs.h => regs.h is already applied) and msrs.{c,h}, and moving relevant code out of x86.c.

v4:
- Drop the GPR API cleanups (already applied).
- Collect more tags. [Yosry, Kai
- Chunked the x86.c => regs.c code movement into several patches, so that the bulk move is as close to a pure move as is reasonably possible. [Yosry]
- Drop a redundant BUILD_BUG_ON() from store_regs().
- Fix various changelog goofs. [Kai]
- Fix alignment goofs in kvm_get_{,feature_}msr_index_list(). [Kai]
- Drop the defunct x86.h include from mtrr.c. [Kai]
- Fix whitespace goofs. [Kai]
- Rewrite the changelog for the bulk regs.c move to better explain why only a tiny amount of EFER code is moved. [Yosry]
- Move "struct kvm_x86_msr_filter" and "struct kvm_x86_pmu_event_filter" to msrs.c and pmu.c respectively. [Kai]
- Rename LDT helpers to vmx_{load,store}_ldt(), and call out that they will hopefully be replaced by kernel helpers in the near future. [Kai]
- Drop the kvm_cpu_get_apicid() code movement (sent a separate patch to kill it off entirely). [Kai]
- Add more detail to explain why using VALID_MASK defines outside of x86.c is dangerous. [Yosry, Kai]
- Bury kvm_arch_interrupt_allowed() in x86.c as kvm_is_interrupt_allowed(). [Kai]
- Move kvm_find_async_pf_gfn() prototype to x86.h. [Sashiko]

v3:
- Collect more tags. [David, Binbin, Yosry]
- Use kvm_run_sync_regs_{from,to}_user() instead of kvm_run_{g,s}et_regs(). [Kai]
- Fix a variety of typos. [Binbin]
- Everything beyond patch 15...

v2:
- https://lore.kernel.org/all/[email protected]
- Collect tags. [Yosry, Kai]
- Fix some truly egregious goofs. [Binbin]
- Rename kvm_cache_regs.h => regs.h, add regs.c. [Yosry, because he complained, not because he actually suggested this :-D ]
- Drop superfluous casting/masking of e*x() usage. [Kai]

v1: https://lore.kernel.org/all/[email protected]

Sean Christopherson (30):
KVM: x86: Extract REGS and SREGS runtime sync code to helpers
KVM: x86: Move get_segment_base() to regs.h, as kvm_get_segment_base()
KVM: x86: Rename __{g,s}et_sregs2() =>

    kvm_x86_vcpu_ioctl_{g,s}et_sregs2()

KVM: x86: Move the bulk of register specific code from x86.c to regs.c
KVM: x86: Move local APIC specific helpers out of asm/kvm_host.h
KVM: x86: Move kvm_caps and kvm_host_values to asm/kvm_host.h
KVM: x86: Swap the include order between x86.h and mmu.h
KVM: x86: Move tdp_enabled from kvm_host.h to mmu.h
KVM: x86: Move eager_page_split to mmu.{c,h}
KVM: x86/hyperv: Eliminate an unnecessary include of x86.h in hyperv.h
KVM: x86: Move kvm_{load,put}_guest_fpu() to fpu.h
KVM: x86: Extract get/set MSR (list) ioctl logic to helpers
KVM: x86: Expose several TSC helpers via x86.h for use by MSR code
KVM: x86: Move the bulk of MSR specific code from x86.c to msrs.{c,h}
KVM: x86: Move register helper declarations from kvm_host.h => regs.h
KVM: x86: Move kvm_{g,s}et_segment() to inline helpers in regs.h
KVM: x86: Move MSR helper declarations from kvm_host.h => msrs.h
KVM: x86: Move "struct kvm_x86_msr_filter" definition to msrs.c
KVM: x86/pmu: Move "struct kvm_x86_pmu_event_filter" definition to
pmu.c
KVM: x86: Move MMU helper declarations from kvm_host.h => mmu.h
KVM: x86: Move LLDT assembly wrappers into VMX
KVM: x86: Move misc "VALID MASK" defines from kvm_host.h => x86.c
KVM: x86: Move __kvm_irq_line_state() from kvm_host.h => ioapic.h
KVM: x86: Move IRQ-related helper declarations from kvm_host.h =>
irq.h
KVM: x86: Move kvm_pv_send_ipi() declaration from kvm_host.h =>
lapic.h
KVM: x86: Don't treat interrupts as allowed just because a nested run
is pending
KVM: x86: Rework kvm_arch_interrupt_allowed() into
kvm_is_interrupt_allowed()
KVM: x86/mmu: Move kvm_arch_async_page_ready() below
kvm_tdp_page_fault()
KVM: x86/mmu: Move kvm_mmu_do_page_fault() from mmu_internal.h =>
mmu.c
KVM: x86: Move a pile of stuff from kvm_host.h => x86.h

 arch/x86/include/asm/kvm_host.h |  470 +---
 arch/x86/kvm/Makefile           |    4 +-
 arch/x86/kvm/cpuid.c            |    1 +
 arch/x86/kvm/fpu.h              |   26 +
 arch/x86/kvm/hyperv.h           |    3 +-
 arch/x86/kvm/ioapic.c           |    1 +
 arch/x86/kvm/ioapic.h           |   12 +
 arch/x86/kvm/irq.c              |    7 +
 arch/x86/kvm/irq.h              |    6 +
 arch/x86/kvm/lapic.h            |    8 +
 arch/x86/kvm/mmu.h              |   90 +-
 arch/x86/kvm/mmu/mmu.c          |  132 +-
 arch/x86/kvm/mmu/mmu_internal.h |   66 -
 arch/x86/kvm/msrs.c             | 2745 +++++++++++++++++++++++
 arch/x86/kvm/msrs.h             |  156 ++
 arch/x86/kvm/mtrr.c             |    2 +-
 arch/x86/kvm/pmu.c              |   12 +
 arch/x86/kvm/regs.c             |  875 ++++++++
 arch/x86/kvm/regs.h             |   60 +
 arch/x86/kvm/svm/nested.c       |    1 +
 arch/x86/kvm/svm/svm.c          |    6 +-
 arch/x86/kvm/vmx/nested.c       |    1 +
 arch/x86/kvm/vmx/vmx.c          |   23 +-
 arch/x86/kvm/x86.c              | 3709 +------------------------------
 arch/x86/kvm/x86.h              |  354 +--
 25 files changed, 4457 insertions(+), 4313 deletions(-)
 create mode 100644 arch/x86/kvm/msrs.c
 create mode 100644 arch/x86/kvm/msrs.h
 create mode 100644 arch/x86/kvm/regs.c

base-commit: c1f7303302927f9cbf4efedf70f0512cde168c65

Signature · 1 line
2.54.0.1136.gdb2ca164c4-goog