mirror of
https://github.com/mii443/qemu.git
synced 2025-12-16 17:18:49 +00:00
Merge remote-tracking branch 'remotes/dg-gitlab/tags/ppc-for-6.1-20210709' into staging
ppc patch queue 2021-07-09
Here's a (probably) final pull request before the qemu-6.1 soft
freeze. Includes:
* Implementation of the new H_RPT_INVALIDATE hypercall
* Virtual Open Firmware for pSeries and pegasos2 machine types.
This is an experimental minimal Open Firmware implementation which
works by delegating nearly everything to qemu itself via a special
hypercall.
* A number of cleanups to the ppc soft MMU code
* Fix to handling of two-level radix mode translations for the
powernv machine type
* Update the H_GET_CPU_CHARACTERISTICS call with newly defined bits.
This will allow more flexible handling of possible future CPU
Spectre-like flaws
* Correctly treat mtmsrd as an illegal instruction on BookE cpus
* Firmware update for the ppce500 machine type
# gpg: Signature made Fri 09 Jul 2021 06:16:42 BST
# gpg: using RSA key 75F46586AE61A66CC44E87DC6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" [full]
# gpg: aka "David Gibson (Red Hat) <dgibson@redhat.com>" [full]
# gpg: aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>" [full]
# gpg: aka "David Gibson (kernel.org) <dwg@kernel.org>" [unknown]
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E 87DC 6C38 CACA 20D9 B392
* remotes/dg-gitlab/tags/ppc-for-6.1-20210709: (33 commits)
target/ppc: Support for H_RPT_INVALIDATE hcall
linux-headers: Update
spapr: Fix implementation of Open Firmware client interface
target/ppc: Don't compile ppc_tlb_invalid_all without TCG
ppc/pegasos2: Implement some RTAS functions with VOF
ppc/pegasos2: Fix use of && instead of &
ppc/pegasos2: Use Virtual Open Firmware as firmware replacement
target/ppc/spapr: Update H_GET_CPU_CHARACTERISTICS L1D cache flush bits
target/ppc: Allow virtual hypervisor on CPU without HV
ppc/pegasos2: Introduce Pegasos2MachineState structure
target/ppc: mtmsrd is an illegal instruction on BookE
spapr: Implement Open Firmware client interface
docs/system: ppc: Update ppce500 documentation with eTSEC support
roms/u-boot: Bump ppce500 u-boot to v2021.07 to add eTSEC support
target/ppc: change ppc_hash32_xlate to use mmu_idx
target/ppc: introduce mmu-books.h
target/ppc: changed ppc_hash64_xlate to use mmu_idx
target/ppc: fix address translation bug for radix mmus
target/ppc: Fix compilation with DEBUG_BATS debug option
target/ppc: Fix compilation with FLUSH_ALL_TLBS debug option
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "hw/ppc/spapr_xive.h" /* For SpaprXive */
|
||||
#include "hw/ppc/xics.h" /* For ICSState */
|
||||
#include "hw/ppc/spapr_tpm_proxy.h"
|
||||
#include "hw/ppc/vof.h"
|
||||
|
||||
struct SpaprVioBus;
|
||||
struct SpaprPhbState;
|
||||
@@ -74,8 +75,10 @@ typedef enum {
|
||||
#define SPAPR_CAP_CCF_ASSIST 0x09
|
||||
/* Implements PAPR FWNMI option */
|
||||
#define SPAPR_CAP_FWNMI 0x0A
|
||||
/* Support H_RPT_INVALIDATE */
|
||||
#define SPAPR_CAP_RPT_INVALIDATE 0x0B
|
||||
/* Num Caps */
|
||||
#define SPAPR_CAP_NUM (SPAPR_CAP_FWNMI + 1)
|
||||
#define SPAPR_CAP_NUM (SPAPR_CAP_RPT_INVALIDATE + 1)
|
||||
|
||||
/*
|
||||
* Capability Values
|
||||
@@ -180,6 +183,7 @@ struct SpaprMachineState {
|
||||
uint64_t kernel_addr;
|
||||
uint32_t initrd_base;
|
||||
long initrd_size;
|
||||
Vof *vof;
|
||||
uint64_t rtc_offset; /* Now used only during incoming migration */
|
||||
struct PPCTimebase tb;
|
||||
bool has_graphics;
|
||||
@@ -398,10 +402,13 @@ struct SpaprMachineState {
|
||||
#define H_CPU_CHAR_THR_RECONF_TRIG PPC_BIT(6)
|
||||
#define H_CPU_CHAR_CACHE_COUNT_DIS PPC_BIT(7)
|
||||
#define H_CPU_CHAR_BCCTR_FLUSH_ASSIST PPC_BIT(9)
|
||||
|
||||
#define H_CPU_BEHAV_FAVOUR_SECURITY PPC_BIT(0)
|
||||
#define H_CPU_BEHAV_L1D_FLUSH_PR PPC_BIT(1)
|
||||
#define H_CPU_BEHAV_BNDS_CHK_SPEC_BAR PPC_BIT(2)
|
||||
#define H_CPU_BEHAV_FLUSH_COUNT_CACHE PPC_BIT(5)
|
||||
#define H_CPU_BEHAV_NO_L1D_FLUSH_ENTRY PPC_BIT(7)
|
||||
#define H_CPU_BEHAV_NO_L1D_FLUSH_UACCESS PPC_BIT(8)
|
||||
|
||||
/* Each control block has to be on a 4K boundary */
|
||||
#define H_CB_ALIGNMENT 4096
|
||||
@@ -542,8 +549,9 @@ struct SpaprMachineState {
|
||||
#define H_SCM_UNBIND_MEM 0x3F0
|
||||
#define H_SCM_UNBIND_ALL 0x3FC
|
||||
#define H_SCM_HEALTH 0x400
|
||||
#define H_RPT_INVALIDATE 0x448
|
||||
|
||||
#define MAX_HCALL_OPCODE H_SCM_HEALTH
|
||||
#define MAX_HCALL_OPCODE H_RPT_INVALIDATE
|
||||
|
||||
/* The hcalls above are standardized in PAPR and implemented by pHyp
|
||||
* as well.
|
||||
@@ -558,7 +566,9 @@ struct SpaprMachineState {
|
||||
/* Client Architecture support */
|
||||
#define KVMPPC_H_CAS (KVMPPC_HCALL_BASE + 0x2)
|
||||
#define KVMPPC_H_UPDATE_DT (KVMPPC_HCALL_BASE + 0x3)
|
||||
#define KVMPPC_HCALL_MAX KVMPPC_H_UPDATE_DT
|
||||
/* 0x4 was used for KVMPPC_H_UPDATE_PHANDLE in SLOF */
|
||||
#define KVMPPC_H_VOF_CLIENT (KVMPPC_HCALL_BASE + 0x5)
|
||||
#define KVMPPC_HCALL_MAX KVMPPC_H_VOF_CLIENT
|
||||
|
||||
/*
|
||||
* The hcall range 0xEF00 to 0xEF80 is reserved for use in facilitating
|
||||
@@ -770,7 +780,7 @@ void spapr_load_rtas(SpaprMachineState *spapr, void *fdt, hwaddr addr);
|
||||
#define SPAPR_IS_PCI_LIOBN(liobn) (!!((liobn) & 0x80000000))
|
||||
#define SPAPR_PCI_DMA_WINDOW_NUM(liobn) ((liobn) & 0xff)
|
||||
|
||||
#define RTAS_SIZE 2048
|
||||
#define RTAS_MIN_SIZE 20 /* hv_rtas_size in SLOF */
|
||||
#define RTAS_ERROR_LOG_MAX 2048
|
||||
|
||||
/* Offset from rtas-base where error log is placed */
|
||||
@@ -932,6 +942,7 @@ extern const VMStateDescription vmstate_spapr_cap_nested_kvm_hv;
|
||||
extern const VMStateDescription vmstate_spapr_cap_large_decr;
|
||||
extern const VMStateDescription vmstate_spapr_cap_ccf_assist;
|
||||
extern const VMStateDescription vmstate_spapr_cap_fwnmi;
|
||||
extern const VMStateDescription vmstate_spapr_cap_rpt_invalidate;
|
||||
|
||||
static inline uint8_t spapr_get_cap(SpaprMachineState *spapr, int cap)
|
||||
{
|
||||
@@ -956,4 +967,16 @@ bool spapr_check_pagesize(SpaprMachineState *spapr, hwaddr pagesize,
|
||||
void spapr_set_all_lpcrs(target_ulong value, target_ulong mask);
|
||||
hwaddr spapr_get_rtas_addr(void);
|
||||
bool spapr_memory_hot_unplug_supported(SpaprMachineState *spapr);
|
||||
|
||||
void spapr_vof_reset(SpaprMachineState *spapr, void *fdt, Error **errp);
|
||||
void spapr_vof_quiesce(MachineState *ms);
|
||||
bool spapr_vof_setprop(MachineState *ms, const char *path, const char *propname,
|
||||
void *val, int vallen);
|
||||
target_ulong spapr_h_vof_client(PowerPCCPU *cpu, SpaprMachineState *spapr,
|
||||
target_ulong opcode, target_ulong *args);
|
||||
target_ulong spapr_vof_client_architecture_support(MachineState *ms,
|
||||
CPUState *cs,
|
||||
target_ulong ovec_addr);
|
||||
void spapr_vof_client_dt_finalize(SpaprMachineState *spapr, void *fdt);
|
||||
|
||||
#endif /* HW_SPAPR_H */
|
||||
|
||||
58
include/hw/ppc/vof.h
Normal file
58
include/hw/ppc/vof.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Virtual Open Firmware
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#ifndef HW_VOF_H
|
||||
#define HW_VOF_H
|
||||
|
||||
typedef struct Vof {
|
||||
uint64_t top_addr; /* copied from rma_size */
|
||||
GArray *claimed; /* array of SpaprOfClaimed */
|
||||
uint64_t claimed_base;
|
||||
GHashTable *of_instances; /* ihandle -> SpaprOfInstance */
|
||||
uint32_t of_instance_last;
|
||||
char *bootargs;
|
||||
long fw_size;
|
||||
} Vof;
|
||||
|
||||
int vof_client_call(MachineState *ms, Vof *vof, void *fdt,
|
||||
target_ulong args_real);
|
||||
uint64_t vof_claim(Vof *vof, uint64_t virt, uint64_t size, uint64_t align);
|
||||
void vof_init(Vof *vof, uint64_t top_addr, Error **errp);
|
||||
void vof_cleanup(Vof *vof);
|
||||
void vof_build_dt(void *fdt, Vof *vof);
|
||||
uint32_t vof_client_open_store(void *fdt, Vof *vof, const char *nodename,
|
||||
const char *prop, const char *path);
|
||||
|
||||
#define TYPE_VOF_MACHINE_IF "vof-machine-if"
|
||||
|
||||
typedef struct VofMachineIfClass VofMachineIfClass;
|
||||
DECLARE_CLASS_CHECKERS(VofMachineIfClass, VOF_MACHINE, TYPE_VOF_MACHINE_IF)
|
||||
|
||||
struct VofMachineIfClass {
|
||||
InterfaceClass parent;
|
||||
target_ulong (*client_architecture_support)(MachineState *ms, CPUState *cs,
|
||||
target_ulong vec);
|
||||
void (*quiesce)(MachineState *ms);
|
||||
bool (*setprop)(MachineState *ms, const char *path, const char *propname,
|
||||
void *val, int vallen);
|
||||
};
|
||||
|
||||
/*
|
||||
* Initial stack size is from
|
||||
* https://www.devicetree.org/open-firmware/bindings/ppc/release/ppc-2_1.html#REF27292
|
||||
*
|
||||
* "Client programs shall be invoked with a valid stack pointer (r1) with
|
||||
* at least 32K bytes of memory available for stack growth".
|
||||
*/
|
||||
#define VOF_STACK_SIZE 0x8000
|
||||
|
||||
#define VOF_MEM_READ(pa, buf, size) \
|
||||
address_space_read(&address_space_memory, \
|
||||
(pa), MEMTXATTRS_UNSPECIFIED, (buf), (size))
|
||||
#define VOF_MEM_WRITE(pa, buf, size) \
|
||||
address_space_write(&address_space_memory, \
|
||||
(pa), MEMTXATTRS_UNSPECIFIED, (buf), (size))
|
||||
|
||||
#endif /* HW_VOF_H */
|
||||
@@ -33,6 +33,8 @@
|
||||
#define KVM_FEATURE_PV_SCHED_YIELD 13
|
||||
#define KVM_FEATURE_ASYNC_PF_INT 14
|
||||
#define KVM_FEATURE_MSI_EXT_DEST_ID 15
|
||||
#define KVM_FEATURE_HC_MAP_GPA_RANGE 16
|
||||
#define KVM_FEATURE_MIGRATION_CONTROL 17
|
||||
|
||||
#define KVM_HINTS_REALTIME 0
|
||||
|
||||
@@ -54,6 +56,7 @@
|
||||
#define MSR_KVM_POLL_CONTROL 0x4b564d05
|
||||
#define MSR_KVM_ASYNC_PF_INT 0x4b564d06
|
||||
#define MSR_KVM_ASYNC_PF_ACK 0x4b564d07
|
||||
#define MSR_KVM_MIGRATION_CONTROL 0x4b564d08
|
||||
|
||||
struct kvm_steal_time {
|
||||
uint64_t steal;
|
||||
@@ -90,6 +93,16 @@ struct kvm_clock_pairing {
|
||||
/* MSR_KVM_ASYNC_PF_INT */
|
||||
#define KVM_ASYNC_PF_VEC_MASK GENMASK(7, 0)
|
||||
|
||||
/* MSR_KVM_MIGRATION_CONTROL */
|
||||
#define KVM_MIGRATION_READY (1 << 0)
|
||||
|
||||
/* KVM_HC_MAP_GPA_RANGE */
|
||||
#define KVM_MAP_GPA_RANGE_PAGE_SZ_4K 0
|
||||
#define KVM_MAP_GPA_RANGE_PAGE_SZ_2M (1 << 0)
|
||||
#define KVM_MAP_GPA_RANGE_PAGE_SZ_1G (1 << 1)
|
||||
#define KVM_MAP_GPA_RANGE_ENC_STAT(n) (n << 4)
|
||||
#define KVM_MAP_GPA_RANGE_ENCRYPTED KVM_MAP_GPA_RANGE_ENC_STAT(1)
|
||||
#define KVM_MAP_GPA_RANGE_DECRYPTED KVM_MAP_GPA_RANGE_ENC_STAT(0)
|
||||
|
||||
/* Operations for KVM_HC_MMU_OP */
|
||||
#define KVM_MMU_OP_WRITE_PTE 1
|
||||
|
||||
@@ -167,6 +167,13 @@ extern "C" {
|
||||
#define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */
|
||||
#define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */
|
||||
|
||||
/* 64 bpp RGB */
|
||||
#define DRM_FORMAT_XRGB16161616 fourcc_code('X', 'R', '4', '8') /* [63:0] x:R:G:B 16:16:16:16 little endian */
|
||||
#define DRM_FORMAT_XBGR16161616 fourcc_code('X', 'B', '4', '8') /* [63:0] x:B:G:R 16:16:16:16 little endian */
|
||||
|
||||
#define DRM_FORMAT_ARGB16161616 fourcc_code('A', 'R', '4', '8') /* [63:0] A:R:G:B 16:16:16:16 little endian */
|
||||
#define DRM_FORMAT_ABGR16161616 fourcc_code('A', 'B', '4', '8') /* [63:0] A:B:G:R 16:16:16:16 little endian */
|
||||
|
||||
/*
|
||||
* Floating point 64bpp RGB
|
||||
* IEEE 754-2008 binary16 half-precision float
|
||||
|
||||
@@ -233,7 +233,7 @@ enum tunable_id {
|
||||
ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */
|
||||
/*
|
||||
* Add your fresh new tunable attribute above and remember to update
|
||||
* tunable_strings[] in net/core/ethtool.c
|
||||
* tunable_strings[] in net/ethtool/common.c
|
||||
*/
|
||||
__ETHTOOL_TUNABLE_COUNT,
|
||||
};
|
||||
@@ -297,7 +297,7 @@ enum phy_tunable_id {
|
||||
ETHTOOL_PHY_EDPD,
|
||||
/*
|
||||
* Add your fresh new phy tunable attribute above and remember to update
|
||||
* phy_tunable_strings[] in net/core/ethtool.c
|
||||
* phy_tunable_strings[] in net/ethtool/common.c
|
||||
*/
|
||||
__ETHTOOL_PHY_TUNABLE_COUNT,
|
||||
};
|
||||
|
||||
@@ -611,6 +611,7 @@
|
||||
#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
|
||||
#define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
|
||||
#define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */
|
||||
#define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */
|
||||
|
||||
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
|
||||
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
#define VIRTIO_ID_SOUND 25 /* virtio sound */
|
||||
#define VIRTIO_ID_FS 26 /* virtio filesystem */
|
||||
#define VIRTIO_ID_PMEM 27 /* virtio pmem */
|
||||
#define VIRTIO_ID_BT 28 /* virtio bluetooth */
|
||||
#define VIRTIO_ID_MAC80211_HWSIM 29 /* virtio mac80211-hwsim */
|
||||
#define VIRTIO_ID_BT 40 /* virtio bluetooth */
|
||||
|
||||
#endif /* _LINUX_VIRTIO_IDS_H */
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
#include "standard-headers/linux/virtio_ids.h"
|
||||
#include "standard-headers/linux/virtio_config.h"
|
||||
|
||||
/* The feature bitmap for virtio vsock */
|
||||
#define VIRTIO_VSOCK_F_SEQPACKET 1 /* SOCK_SEQPACKET supported */
|
||||
|
||||
struct virtio_vsock_config {
|
||||
uint64_t guest_cid;
|
||||
} QEMU_PACKED;
|
||||
@@ -65,6 +68,7 @@ struct virtio_vsock_hdr {
|
||||
|
||||
enum virtio_vsock_type {
|
||||
VIRTIO_VSOCK_TYPE_STREAM = 1,
|
||||
VIRTIO_VSOCK_TYPE_SEQPACKET = 2,
|
||||
};
|
||||
|
||||
enum virtio_vsock_op {
|
||||
@@ -91,4 +95,9 @@ enum virtio_vsock_shutdown {
|
||||
VIRTIO_VSOCK_SHUTDOWN_SEND = 2,
|
||||
};
|
||||
|
||||
/* VIRTIO_VSOCK_OP_RW flags values */
|
||||
enum virtio_vsock_rw {
|
||||
VIRTIO_VSOCK_SEQ_EOR = 1,
|
||||
};
|
||||
|
||||
#endif /* _LINUX_VIRTIO_VSOCK_H */
|
||||
|
||||
Reference in New Issue
Block a user