Changeset View
Changeset View
Standalone View
Standalone View
lib/libkvm/kvm_powerpc64.h
- This file was added.
/*- | |||||
* Copyright (c) 2019 Leandro Lupori | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in the | |||||
* documentation and/or other materials provided with the distribution. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* | |||||
* $FreeBSD$ | |||||
*/ | |||||
#ifndef __KVM_POWERPC64_H__ | |||||
#define __KVM_POWERPC64_H__ | |||||
#define PPC64_KERNBASE 0x100100ULL | |||||
/* Page params */ | |||||
#define PPC64_PAGE_SHIFT 12 | |||||
#define PPC64_PAGE_SIZE (1ULL << PPC64_PAGE_SHIFT) | |||||
#define PPC64_PAGE_MASK (PPC64_PAGE_SIZE - 1) | |||||
/* Large (huge) page params */ | |||||
#define PPC64_LP_PAGE_SHIFT 24 | |||||
#define PPC64_LP_PAGE_SIZE (1ULL << PPC64_LP_PAGE_SHIFT) | |||||
#define PPC64_LP_PAGE_MASK 0x00ffffffULL | |||||
/* SLB */ | |||||
#define PPC64_SEGMENT_LENGTH 0x10000000ULL | |||||
/* Virtual real-mode VSID in LPARs */ | |||||
#define PPC64_VSID_VRMA 0x1ffffffULL | |||||
#define PPC64_SLBV_L 0x0000000000000100ULL /* Large page selector */ | |||||
#define PPC64_SLBV_CLASS 0x0000000000000080ULL /* Class selector */ | |||||
#define PPC64_SLBV_LP_MASK 0x0000000000000030ULL | |||||
#define PPC64_SLBV_VSID_MASK 0x3ffffffffffff000ULL /* Virtual seg ID mask */ | |||||
#define PPC64_SLBV_VSID_SHIFT 12 | |||||
#define PPC64_SLBE_B_MASK 0x0000000006000000ULL | |||||
#define PPC64_SLBE_B_256MB 0x0000000000000000ULL | |||||
#define PPC64_SLBE_VALID 0x0000000008000000ULL /* SLB entry valid */ | |||||
#define PPC64_SLBE_INDEX_MASK 0x0000000000000fffULL /* SLB index mask*/ | |||||
/* Effective seg ID mask */ | |||||
#define PPC64_SLBE_ESID_MASK 0xfffffffff0000000ULL | |||||
#define PPC64_SLBE_ESID_SHIFT 28 | |||||
/* PTE */ | |||||
#define PPC64_LPTEH_VSID_SHIFT 12 | |||||
#define PPC64_LPTEH_AVPN_MASK 0xffffffffffffff80ULL | |||||
#define PPC64_LPTEH_B_MASK 0xc000000000000000ULL | |||||
#define PPC64_LPTEH_B_256MB 0x0000000000000000ULL | |||||
#define PPC64_LPTEH_BIG 0x0000000000000004ULL /* 4kb/16Mb page */ | |||||
#define PPC64_LPTEH_HID 0x0000000000000002ULL | |||||
#define PPC64_LPTEH_VALID 0x0000000000000001ULL | |||||
#define PPC64_LPTEL_RPGN 0xfffffffffffff000ULL | |||||
#define PPC64_LPTEL_LP_MASK 0x00000000000ff000ULL | |||||
#define PPC64_LPTEL_NOEXEC 0x0000000000000004ULL | |||||
/* Supervisor (U: RW, S: RW) */ | |||||
#define PPC64_LPTEL_BW 0x0000000000000002ULL | |||||
/* Both Read Only (U: RO, S: RO) */ | |||||
#define PPC64_LPTEL_BR 0x0000000000000003ULL | |||||
#define PPC64_LPTEL_RW PPC64_LPTEL_BW | |||||
#define PPC64_LPTEL_RO PPC64_LPTEL_BR | |||||
typedef uint64_t ppc64_physaddr_t; | |||||
typedef struct { | |||||
uint64_t slbv; | |||||
uint64_t slbe; | |||||
} ppc64_slb_entry_t; | |||||
typedef struct { | |||||
uint64_t pte_hi; | |||||
uint64_t pte_lo; | |||||
} ppc64_pt_entry_t; | |||||
#endif /* !__KVM_POWERPC64_H__ */ |