Re: [PATCH 01/13] KVM: Add KVM_GET_LAPIC_W_EXTAPIC and KVM_SET_LAPIC_W_EXTAPIC for extapic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 04, 2023 at 09:53:35AM +0000, Manali Shukla wrote:
>There are four additional extended LVT registers available in extended
>APIC register space which can be used for additional interrupt sources
>like instruction based sampling and many more.
>
>Please refer to AMD programmers's manual Volume 2, Section 16.4.5 for
>more details on extapic.
>https://bugzilla.kernel.org/attachment.cgi?id=304653
>
>Adds two new vcpu-based IOCTLs to save and restore the local APIC
>registers with extended APIC register space for a single vcpu. It
>works same as KVM_GET_LAPIC and KVM_SET_LAPIC IOCTLs. The only
>differece is the size of APIC page which is copied/restored by kernel.
>In case of KVM_GET_LAPIC_W_EXTAPIC and KVM_SET_LAPIC_W_EXTAPIC IOCTLs,
>kernel copies/restores the APIC page with extended APIC register space
>located at APIC offsets 400h-530h.
>
>KVM_GET_LAPIC_W_EXTAPIC and KVM_SET_LAPIC_W_EXTAPIC IOCTLs are used
>when extended APIC is enabled in the guest.
>
>Document KVM_GET_LAPIC_W_EXTAPIC, KVM_SET_LAPIC_W_EXTAPIC ioctls.
>
>Signed-off-by: Manali Shukla <manali.shukla@xxxxxxx>
>---
> Documentation/virt/kvm/api.rst  | 23 +++++++++++++++++++++++
> arch/x86/include/uapi/asm/kvm.h |  5 +++++
> arch/x86/kvm/lapic.c            | 12 +++++++-----
> arch/x86/kvm/lapic.h            |  6 ++++--
> arch/x86/kvm/x86.c              | 24 +++++++++++++-----------
> include/uapi/linux/kvm.h        | 10 ++++++++++
> 6 files changed, 62 insertions(+), 18 deletions(-)
>
>diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
>index 73db30cb60fb..7239d4f1ecf3 100644
>--- a/Documentation/virt/kvm/api.rst
>+++ b/Documentation/virt/kvm/api.rst
>@@ -1961,6 +1961,18 @@ error.
> Reads the Local APIC registers and copies them into the input argument.  The
> data format and layout are the same as documented in the architecture manual.
> 
>+::
>+
>+  #define KVM_APIC_EXT_REG_SIZE 0x540
>+  struct kvm_lapic_state_w_extapic {
>+        __u8 regs[KVM_APIC_EXT_REG_SIZE];
>+  };

The size of this new structure is also hard-coded. Do you think it is better to
make the new structure extensible so that next time KVM needn't add more uAPIs
for future local APIC extensions?



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux