Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * This program is free software; you can redistribute it and/or modify
0004  * it under the terms of the GNU General Public License, version 2, as
0005  * published by the Free Software Foundation.
0006  *
0007  * This program is distributed in the hope that it will be useful,
0008  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0009  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0010  * GNU General Public License for more details.
0011  *
0012  * You should have received a copy of the GNU General Public License
0013  * along with this program; if not, write to the Free Software
0014  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0015  *
0016  * Copyright IBM Corp. 2008
0017  *
0018  * Authors: Hollis Blanchard <hollisb@us.ibm.com>
0019  */
0020 
0021 #ifndef _UAPI__POWERPC_KVM_PARA_H__
0022 #define _UAPI__POWERPC_KVM_PARA_H__
0023 
0024 #include <linux/types.h>
0025 
0026 /*
0027  * Additions to this struct must only occur at the end, and should be
0028  * accompanied by a KVM_MAGIC_FEAT flag to advertise that they are present
0029  * (albeit not necessarily relevant to the current target hardware platform).
0030  *
0031  * Struct fields are always 32 or 64 bit aligned, depending on them being 32
0032  * or 64 bit wide respectively.
0033  *
0034  * See Documentation/virt/kvm/ppc-pv.rst
0035  */
0036 struct kvm_vcpu_arch_shared {
0037     __u64 scratch1;
0038     __u64 scratch2;
0039     __u64 scratch3;
0040     __u64 critical;     /* Guest may not get interrupts if == r1 */
0041     __u64 sprg0;
0042     __u64 sprg1;
0043     __u64 sprg2;
0044     __u64 sprg3;
0045     __u64 srr0;
0046     __u64 srr1;
0047     __u64 dar;      /* dear on BookE */
0048     __u64 msr;
0049     __u32 dsisr;
0050     __u32 int_pending;  /* Tells the guest if we have an interrupt */
0051     __u32 sr[16];
0052     __u32 mas0;
0053     __u32 mas1;
0054     __u64 mas7_3;
0055     __u64 mas2;
0056     __u32 mas4;
0057     __u32 mas6;
0058     __u32 esr;
0059     __u32 pir;
0060 
0061     /*
0062      * SPRG4-7 are user-readable, so we can only keep these consistent
0063      * between the shared area and the real registers when there's an
0064      * intervening exit to KVM.  This also applies to SPRG3 on some
0065      * chips.
0066      *
0067      * This suffices for access by guest userspace, since in PR-mode
0068      * KVM, an exit must occur when changing the guest's MSR[PR].
0069      * If the guest kernel writes to SPRG3-7 via the shared area, it
0070      * must also use the shared area for reading while in kernel space.
0071      */
0072     __u64 sprg4;
0073     __u64 sprg5;
0074     __u64 sprg6;
0075     __u64 sprg7;
0076 };
0077 
0078 #define KVM_SC_MAGIC_R0     0x4b564d21 /* "KVM!" */
0079 
0080 #define KVM_HCALL_TOKEN(num)     _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, num)
0081 
0082 #include <asm/epapr_hcalls.h>
0083 
0084 #define KVM_FEATURE_MAGIC_PAGE  1
0085 
0086 /* Magic page flags from host to guest */
0087 
0088 #define KVM_MAGIC_FEAT_SR       (1 << 0)
0089 
0090 /* MASn, ESR, PIR, and high SPRGs */
0091 #define KVM_MAGIC_FEAT_MAS0_TO_SPRG7    (1 << 1)
0092 
0093 /* Magic page flags from guest to host */
0094 
0095 #define MAGIC_PAGE_FLAG_NOT_MAPPED_NX   (1 << 0)
0096 
0097 
0098 #endif /* _UAPI__POWERPC_KVM_PARA_H__ */