mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge tag 'linux-user-for-7.0-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging
linux-user pull request 20220106 update netlink entries nios2 fixes /proc/self/maps fixes set/getscheduler update prctl cleanup and fixes target_signal.h cleanup and some trivial fixes # gpg: Signature made Thu 06 Jan 2022 02:41:07 AM PST # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [undefined] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [undefined] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * tag 'linux-user-for-7.0-pull-request' of https://gitlab.com/laurent_vivier/qemu: (27 commits) linux-user: netlink: update IFLA_BRPORT entries linux-user: netlink: Add IFLA_VFINFO_LIST linux-user: netlink: update IFLA entries linux-user/syscall.c: malloc to g_try_malloc linux-user/nios2: Use set_sigmask in do_rt_sigreturn linux-user/nios2: Fix sigmask in setup_rt_frame linux-user/nios2: Fix EA vs PC confusion linux-user/nios2: Map a real kuser page linux-user/elfload: Rename ARM_COMMPAGE to HI_COMMPAGE linux-user/nios2: Fixes for signal frame setup linux-user/nios2: Properly emulate EXCP_TRAP linux-user/syscall.c: fix missed flag for shared memory in open_self_maps linux-user: call set/getscheduler set/getparam directly linux-user: add sched_getattr support linux-user/signal: Map exit signals in SIGCHLD siginfo_t target/sh4: Implement prctl_unalign_sigbus target/hppa: Implement prctl_unalign_sigbus target/alpha: Implement prctl_unalign_sigbus linux-user: Add code for PR_GET/SET_UNALIGN linux-user: Disable more prctl subcodes ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
@@ -174,13 +174,23 @@ void cpu_exec_unrealizefn(CPUState *cpu)
|
||||
cpu_list_remove(cpu);
|
||||
}
|
||||
|
||||
/*
|
||||
* This can't go in hw/core/cpu.c because that file is compiled only
|
||||
* once for both user-mode and system builds.
|
||||
*/
|
||||
static Property cpu_common_props[] = {
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
/*
|
||||
* Create a memory property for softmmu CPU object,
|
||||
* so users can wire up its memory. (This can't go in hw/core/cpu.c
|
||||
* because that file is compiled only once for both user-mode
|
||||
* and system builds.) The default if no link is set up is to use
|
||||
* Create a property for the user-only object, so users can
|
||||
* adjust prctl(PR_SET_UNALIGN) from the command-line.
|
||||
* Has no effect if the target does not support the feature.
|
||||
*/
|
||||
DEFINE_PROP_BOOL("prctl-unalign-sigbus", CPUState,
|
||||
prctl_unalign_sigbus, false),
|
||||
#else
|
||||
/*
|
||||
* Create a memory property for softmmu CPU object, so users can
|
||||
* wire up its memory. The default if no link is set up is to use
|
||||
* the system address space.
|
||||
*/
|
||||
DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION,
|
||||
|
||||
@@ -413,6 +413,9 @@ struct CPUState {
|
||||
|
||||
bool ignore_memory_transaction_failures;
|
||||
|
||||
/* Used for user-only emulation of prctl(PR_SET_UNALIGN). */
|
||||
bool prctl_unalign_sigbus;
|
||||
|
||||
struct hax_vcpu_state *hax_vcpu;
|
||||
|
||||
struct hvf_vcpu_state *hvf;
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* AArch64 specific prctl functions for linux-user
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#ifndef AARCH64_TARGET_PRCTL_H
|
||||
#define AARCH64_TARGET_PRCTL_H
|
||||
|
||||
static abi_long do_prctl_get_vl(CPUArchState *env)
|
||||
{
|
||||
ARMCPU *cpu = env_archcpu(env);
|
||||
if (cpu_isar_feature(aa64_sve, cpu)) {
|
||||
return ((cpu->env.vfp.zcr_el[1] & 0xf) + 1) * 16;
|
||||
}
|
||||
return -TARGET_EINVAL;
|
||||
}
|
||||
#define do_prctl_get_vl do_prctl_get_vl
|
||||
|
||||
static abi_long do_prctl_set_vl(CPUArchState *env, abi_long arg2)
|
||||
{
|
||||
/*
|
||||
* We cannot support either PR_SVE_SET_VL_ONEXEC or PR_SVE_VL_INHERIT.
|
||||
* Note the kernel definition of sve_vl_valid allows for VQ=512,
|
||||
* i.e. VL=8192, even though the current architectural maximum is VQ=16.
|
||||
*/
|
||||
if (cpu_isar_feature(aa64_sve, env_archcpu(env))
|
||||
&& arg2 >= 0 && arg2 <= 512 * 16 && !(arg2 & 15)) {
|
||||
ARMCPU *cpu = env_archcpu(env);
|
||||
uint32_t vq, old_vq;
|
||||
|
||||
old_vq = (env->vfp.zcr_el[1] & 0xf) + 1;
|
||||
vq = MAX(arg2 / 16, 1);
|
||||
vq = MIN(vq, cpu->sve_max_vq);
|
||||
|
||||
if (vq < old_vq) {
|
||||
aarch64_sve_narrow_vq(env, vq);
|
||||
}
|
||||
env->vfp.zcr_el[1] = vq - 1;
|
||||
arm_rebuild_hflags(env);
|
||||
return vq * 16;
|
||||
}
|
||||
return -TARGET_EINVAL;
|
||||
}
|
||||
#define do_prctl_set_vl do_prctl_set_vl
|
||||
|
||||
static abi_long do_prctl_reset_keys(CPUArchState *env, abi_long arg2)
|
||||
{
|
||||
ARMCPU *cpu = env_archcpu(env);
|
||||
|
||||
if (cpu_isar_feature(aa64_pauth, cpu)) {
|
||||
int all = (PR_PAC_APIAKEY | PR_PAC_APIBKEY |
|
||||
PR_PAC_APDAKEY | PR_PAC_APDBKEY | PR_PAC_APGAKEY);
|
||||
int ret = 0;
|
||||
Error *err = NULL;
|
||||
|
||||
if (arg2 == 0) {
|
||||
arg2 = all;
|
||||
} else if (arg2 & ~all) {
|
||||
return -TARGET_EINVAL;
|
||||
}
|
||||
if (arg2 & PR_PAC_APIAKEY) {
|
||||
ret |= qemu_guest_getrandom(&env->keys.apia,
|
||||
sizeof(ARMPACKey), &err);
|
||||
}
|
||||
if (arg2 & PR_PAC_APIBKEY) {
|
||||
ret |= qemu_guest_getrandom(&env->keys.apib,
|
||||
sizeof(ARMPACKey), &err);
|
||||
}
|
||||
if (arg2 & PR_PAC_APDAKEY) {
|
||||
ret |= qemu_guest_getrandom(&env->keys.apda,
|
||||
sizeof(ARMPACKey), &err);
|
||||
}
|
||||
if (arg2 & PR_PAC_APDBKEY) {
|
||||
ret |= qemu_guest_getrandom(&env->keys.apdb,
|
||||
sizeof(ARMPACKey), &err);
|
||||
}
|
||||
if (arg2 & PR_PAC_APGAKEY) {
|
||||
ret |= qemu_guest_getrandom(&env->keys.apga,
|
||||
sizeof(ARMPACKey), &err);
|
||||
}
|
||||
if (ret != 0) {
|
||||
/*
|
||||
* Some unknown failure in the crypto. The best
|
||||
* we can do is log it and fail the syscall.
|
||||
* The real syscall cannot fail this way.
|
||||
*/
|
||||
qemu_log_mask(LOG_UNIMP, "PR_PAC_RESET_KEYS: Crypto failure: %s",
|
||||
error_get_pretty(err));
|
||||
error_free(err);
|
||||
return -TARGET_EIO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return -TARGET_EINVAL;
|
||||
}
|
||||
#define do_prctl_reset_keys do_prctl_reset_keys
|
||||
|
||||
static abi_long do_prctl_set_tagged_addr_ctrl(CPUArchState *env, abi_long arg2)
|
||||
{
|
||||
abi_ulong valid_mask = PR_TAGGED_ADDR_ENABLE;
|
||||
ARMCPU *cpu = env_archcpu(env);
|
||||
|
||||
if (cpu_isar_feature(aa64_mte, cpu)) {
|
||||
valid_mask |= PR_MTE_TCF_MASK;
|
||||
valid_mask |= PR_MTE_TAG_MASK;
|
||||
}
|
||||
|
||||
if (arg2 & ~valid_mask) {
|
||||
return -TARGET_EINVAL;
|
||||
}
|
||||
env->tagged_addr_enable = arg2 & PR_TAGGED_ADDR_ENABLE;
|
||||
|
||||
if (cpu_isar_feature(aa64_mte, cpu)) {
|
||||
switch (arg2 & PR_MTE_TCF_MASK) {
|
||||
case PR_MTE_TCF_NONE:
|
||||
case PR_MTE_TCF_SYNC:
|
||||
case PR_MTE_TCF_ASYNC:
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write PR_MTE_TCF to SCTLR_EL1[TCF0].
|
||||
* Note that the syscall values are consistent with hw.
|
||||
*/
|
||||
env->cp15.sctlr_el[1] =
|
||||
deposit64(env->cp15.sctlr_el[1], 38, 2, arg2 >> PR_MTE_TCF_SHIFT);
|
||||
|
||||
/*
|
||||
* Write PR_MTE_TAG to GCR_EL1[Exclude].
|
||||
* Note that the syscall uses an include mask,
|
||||
* and hardware uses an exclude mask -- invert.
|
||||
*/
|
||||
env->cp15.gcr_el1 =
|
||||
deposit64(env->cp15.gcr_el1, 0, 16, ~arg2 >> PR_MTE_TAG_SHIFT);
|
||||
arm_rebuild_hflags(env);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#define do_prctl_set_tagged_addr_ctrl do_prctl_set_tagged_addr_ctrl
|
||||
|
||||
static abi_long do_prctl_get_tagged_addr_ctrl(CPUArchState *env)
|
||||
{
|
||||
ARMCPU *cpu = env_archcpu(env);
|
||||
abi_long ret = 0;
|
||||
|
||||
if (env->tagged_addr_enable) {
|
||||
ret |= PR_TAGGED_ADDR_ENABLE;
|
||||
}
|
||||
if (cpu_isar_feature(aa64_mte, cpu)) {
|
||||
/* See do_prctl_set_tagged_addr_ctrl. */
|
||||
ret |= extract64(env->cp15.sctlr_el[1], 38, 2) << PR_MTE_TCF_SHIFT;
|
||||
ret = deposit64(ret, PR_MTE_TAG_SHIFT, 16, ~env->cp15.gcr_el1);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#define do_prctl_get_tagged_addr_ctrl do_prctl_get_tagged_addr_ctrl
|
||||
|
||||
#endif /* AARCH64_TARGET_PRCTL_H */
|
||||
@@ -1,24 +1,6 @@
|
||||
#ifndef AARCH64_TARGET_SIGNAL_H
|
||||
#define AARCH64_TARGET_SIGNAL_H
|
||||
|
||||
/* this struct defines a stack used during syscall handling */
|
||||
|
||||
typedef struct target_sigaltstack {
|
||||
abi_ulong ss_sp;
|
||||
abi_int ss_flags;
|
||||
abi_ulong ss_size;
|
||||
} target_stack_t;
|
||||
|
||||
|
||||
/*
|
||||
* sigaltstack controls
|
||||
*/
|
||||
#define TARGET_SS_ONSTACK 1
|
||||
#define TARGET_SS_DISABLE 2
|
||||
|
||||
#define TARGET_MINSIGSTKSZ 2048
|
||||
#define TARGET_SIGSTKSZ 8192
|
||||
|
||||
#include "../generic/signal.h"
|
||||
|
||||
#define TARGET_SEGV_MTEAERR 8 /* Asynchronous ARM MTE error */
|
||||
|
||||
@@ -15,32 +15,8 @@ struct target_pt_regs {
|
||||
#endif
|
||||
#define UNAME_MINIMUM_RELEASE "3.8.0"
|
||||
#define TARGET_CLONE_BACKWARDS
|
||||
#define TARGET_MINSIGSTKSZ 2048
|
||||
#define TARGET_MCL_CURRENT 1
|
||||
#define TARGET_MCL_FUTURE 2
|
||||
#define TARGET_MCL_ONFAULT 4
|
||||
|
||||
#define TARGET_PR_SVE_SET_VL 50
|
||||
#define TARGET_PR_SVE_GET_VL 51
|
||||
|
||||
#define TARGET_PR_PAC_RESET_KEYS 54
|
||||
# define TARGET_PR_PAC_APIAKEY (1 << 0)
|
||||
# define TARGET_PR_PAC_APIBKEY (1 << 1)
|
||||
# define TARGET_PR_PAC_APDAKEY (1 << 2)
|
||||
# define TARGET_PR_PAC_APDBKEY (1 << 3)
|
||||
# define TARGET_PR_PAC_APGAKEY (1 << 4)
|
||||
|
||||
#define TARGET_PR_SET_TAGGED_ADDR_CTRL 55
|
||||
#define TARGET_PR_GET_TAGGED_ADDR_CTRL 56
|
||||
# define TARGET_PR_TAGGED_ADDR_ENABLE (1UL << 0)
|
||||
/* MTE tag check fault modes */
|
||||
# define TARGET_PR_MTE_TCF_SHIFT 1
|
||||
# define TARGET_PR_MTE_TCF_NONE (0UL << TARGET_PR_MTE_TCF_SHIFT)
|
||||
# define TARGET_PR_MTE_TCF_SYNC (1UL << TARGET_PR_MTE_TCF_SHIFT)
|
||||
# define TARGET_PR_MTE_TCF_ASYNC (2UL << TARGET_PR_MTE_TCF_SHIFT)
|
||||
# define TARGET_PR_MTE_TCF_MASK (3UL << TARGET_PR_MTE_TCF_SHIFT)
|
||||
/* MTE tag inclusion mask */
|
||||
# define TARGET_PR_MTE_TAG_SHIFT 3
|
||||
# define TARGET_PR_MTE_TAG_MASK (0xffffUL << TARGET_PR_MTE_TAG_SHIFT)
|
||||
|
||||
#endif /* AARCH64_TARGET_SYSCALL_H */
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#include "../generic/target_prctl_unalign.h"
|
||||
@@ -62,7 +62,6 @@ typedef struct target_sigaltstack {
|
||||
#define TARGET_SA_SIGINFO 0x00000040
|
||||
|
||||
#define TARGET_MINSIGSTKSZ 4096
|
||||
#define TARGET_SIGSTKSZ 16384
|
||||
|
||||
/* From <asm/gentrap.h>. */
|
||||
#define TARGET_GEN_INTOVF -1 /* integer overflow */
|
||||
|
||||
@@ -63,7 +63,6 @@ struct target_pt_regs {
|
||||
#define TARGET_UAC_NOPRINT 1
|
||||
#define TARGET_UAC_NOFIX 2
|
||||
#define TARGET_UAC_SIGBUS 4
|
||||
#define TARGET_MINSIGSTKSZ 4096
|
||||
#define TARGET_MCL_CURRENT 0x2000
|
||||
#define TARGET_MCL_FUTURE 0x4000
|
||||
#define TARGET_MCL_ONFAULT 0x8000
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
/* No special prctl support required. */
|
||||
@@ -1,24 +1,6 @@
|
||||
#ifndef ARM_TARGET_SIGNAL_H
|
||||
#define ARM_TARGET_SIGNAL_H
|
||||
|
||||
/* this struct defines a stack used during syscall handling */
|
||||
|
||||
typedef struct target_sigaltstack {
|
||||
abi_ulong ss_sp;
|
||||
abi_int ss_flags;
|
||||
abi_ulong ss_size;
|
||||
} target_stack_t;
|
||||
|
||||
|
||||
/*
|
||||
* sigaltstack controls
|
||||
*/
|
||||
#define TARGET_SS_ONSTACK 1
|
||||
#define TARGET_SS_DISABLE 2
|
||||
|
||||
#define TARGET_MINSIGSTKSZ 2048
|
||||
#define TARGET_SIGSTKSZ 8192
|
||||
|
||||
#include "../generic/signal.h"
|
||||
|
||||
#define TARGET_ARCH_HAS_SETUP_FRAME
|
||||
|
||||
@@ -27,7 +27,6 @@ struct target_pt_regs {
|
||||
|
||||
#define TARGET_CLONE_BACKWARDS
|
||||
|
||||
#define TARGET_MINSIGSTKSZ 2048
|
||||
#define TARGET_MCL_CURRENT 1
|
||||
#define TARGET_MCL_FUTURE 2
|
||||
#define TARGET_MCL_ONFAULT 4
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
/* No special prctl support required. */
|
||||
@@ -1,24 +1,6 @@
|
||||
#ifndef CRIS_TARGET_SIGNAL_H
|
||||
#define CRIS_TARGET_SIGNAL_H
|
||||
|
||||
/* this struct defines a stack used during syscall handling */
|
||||
|
||||
typedef struct target_sigaltstack {
|
||||
abi_ulong ss_sp;
|
||||
abi_int ss_flags;
|
||||
abi_ulong ss_size;
|
||||
} target_stack_t;
|
||||
|
||||
|
||||
/*
|
||||
* sigaltstack controls
|
||||
*/
|
||||
#define TARGET_SS_ONSTACK 1
|
||||
#define TARGET_SS_DISABLE 2
|
||||
|
||||
#define TARGET_MINSIGSTKSZ 2048
|
||||
#define TARGET_SIGSTKSZ 8192
|
||||
|
||||
#include "../generic/signal.h"
|
||||
|
||||
#define TARGET_ARCH_HAS_SETUP_FRAME
|
||||
|
||||
@@ -39,7 +39,6 @@ struct target_pt_regs {
|
||||
};
|
||||
|
||||
#define TARGET_CLONE_BACKWARDS2
|
||||
#define TARGET_MINSIGSTKSZ 2048
|
||||
#define TARGET_MCL_CURRENT 1
|
||||
#define TARGET_MCL_FUTURE 2
|
||||
#define TARGET_MCL_ONFAULT 4
|
||||
|
||||
+57
-9
@@ -390,11 +390,11 @@ enum {
|
||||
|
||||
/* The commpage only exists for 32 bit kernels */
|
||||
|
||||
#define ARM_COMMPAGE (intptr_t)0xffff0f00u
|
||||
#define HI_COMMPAGE (intptr_t)0xffff0f00u
|
||||
|
||||
static bool init_guest_commpage(void)
|
||||
{
|
||||
void *want = g2h_untagged(ARM_COMMPAGE & -qemu_host_page_size);
|
||||
void *want = g2h_untagged(HI_COMMPAGE & -qemu_host_page_size);
|
||||
void *addr = mmap(want, qemu_host_page_size, PROT_READ | PROT_WRITE,
|
||||
MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
|
||||
|
||||
@@ -1099,6 +1099,47 @@ static void init_thread(struct target_pt_regs *regs, struct image_info *infop)
|
||||
regs->estatus = 0x3;
|
||||
}
|
||||
|
||||
#define LO_COMMPAGE TARGET_PAGE_SIZE
|
||||
|
||||
static bool init_guest_commpage(void)
|
||||
{
|
||||
static const uint8_t kuser_page[4 + 2 * 64] = {
|
||||
/* __kuser_helper_version */
|
||||
[0x00] = 0x02, 0x00, 0x00, 0x00,
|
||||
|
||||
/* __kuser_cmpxchg */
|
||||
[0x04] = 0x3a, 0x6c, 0x3b, 0x00, /* trap 16 */
|
||||
0x3a, 0x28, 0x00, 0xf8, /* ret */
|
||||
|
||||
/* __kuser_sigtramp */
|
||||
[0x44] = 0xc4, 0x22, 0x80, 0x00, /* movi r2, __NR_rt_sigreturn */
|
||||
0x3a, 0x68, 0x3b, 0x00, /* trap 0 */
|
||||
};
|
||||
|
||||
void *want = g2h_untagged(LO_COMMPAGE & -qemu_host_page_size);
|
||||
void *addr = mmap(want, qemu_host_page_size, PROT_READ | PROT_WRITE,
|
||||
MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
|
||||
|
||||
if (addr == MAP_FAILED) {
|
||||
perror("Allocating guest commpage");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (addr != want) {
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(addr, kuser_page, sizeof(kuser_page));
|
||||
|
||||
if (mprotect(addr, qemu_host_page_size, PROT_READ)) {
|
||||
perror("Protecting guest commpage");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
page_set_flags(LO_COMMPAGE, LO_COMMPAGE + TARGET_PAGE_SIZE,
|
||||
PAGE_READ | PAGE_EXEC | PAGE_VALID);
|
||||
return true;
|
||||
}
|
||||
|
||||
#define ELF_EXEC_PAGESIZE 4096
|
||||
|
||||
#define USE_ELF_CORE_DUMP
|
||||
@@ -2160,8 +2201,13 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
|
||||
return sp;
|
||||
}
|
||||
|
||||
#ifndef ARM_COMMPAGE
|
||||
#define ARM_COMMPAGE 0
|
||||
#if defined(HI_COMMPAGE)
|
||||
#define LO_COMMPAGE 0
|
||||
#elif defined(LO_COMMPAGE)
|
||||
#define HI_COMMPAGE 0
|
||||
#else
|
||||
#define HI_COMMPAGE 0
|
||||
#define LO_COMMPAGE 0
|
||||
#define init_guest_commpage() true
|
||||
#endif
|
||||
|
||||
@@ -2361,7 +2407,7 @@ static void pgb_static(const char *image_name, abi_ulong orig_loaddr,
|
||||
}
|
||||
|
||||
loaddr &= -align;
|
||||
if (ARM_COMMPAGE) {
|
||||
if (HI_COMMPAGE) {
|
||||
/*
|
||||
* Extend the allocation to include the commpage.
|
||||
* For a 64-bit host, this is just 4GiB; for a 32-bit host we
|
||||
@@ -2372,14 +2418,16 @@ static void pgb_static(const char *image_name, abi_ulong orig_loaddr,
|
||||
if (sizeof(uintptr_t) == 8 || loaddr >= 0x80000000u) {
|
||||
hiaddr = (uintptr_t) 4 << 30;
|
||||
} else {
|
||||
offset = -(ARM_COMMPAGE & -align);
|
||||
offset = -(HI_COMMPAGE & -align);
|
||||
}
|
||||
} else if (LO_COMMPAGE) {
|
||||
loaddr = MIN(loaddr, LO_COMMPAGE & -align);
|
||||
}
|
||||
|
||||
addr = pgb_find_hole(loaddr, hiaddr - loaddr, align, offset);
|
||||
if (addr == -1) {
|
||||
/*
|
||||
* If ARM_COMMPAGE, there *might* be a non-consecutive allocation
|
||||
* If HI_COMMPAGE, there *might* be a non-consecutive allocation
|
||||
* that can satisfy both. But as the normal arm32 link base address
|
||||
* is ~32k, and we extend down to include the commpage, making the
|
||||
* overhead only ~96k, this is unlikely.
|
||||
@@ -2400,7 +2448,7 @@ static void pgb_dynamic(const char *image_name, long align)
|
||||
* All we need is a commpage that satisfies align.
|
||||
* If we do not need a commpage, leave guest_base == 0.
|
||||
*/
|
||||
if (ARM_COMMPAGE) {
|
||||
if (HI_COMMPAGE) {
|
||||
uintptr_t addr, commpage;
|
||||
|
||||
/* 64-bit hosts should have used reserved_va. */
|
||||
@@ -2410,7 +2458,7 @@ static void pgb_dynamic(const char *image_name, long align)
|
||||
* By putting the commpage at the first hole, that puts guest_base
|
||||
* just above that, and maximises the positive guest addresses.
|
||||
*/
|
||||
commpage = ARM_COMMPAGE & -align;
|
||||
commpage = HI_COMMPAGE & -align;
|
||||
addr = pgb_find_hole(commpage, -commpage, align, 0);
|
||||
assert(addr != -1);
|
||||
guest_base = addr;
|
||||
|
||||
@@ -138,6 +138,9 @@ enum {
|
||||
QEMU_IFLA_PROP_LIST,
|
||||
QEMU_IFLA_ALT_IFNAME,
|
||||
QEMU_IFLA_PERM_ADDRESS,
|
||||
QEMU_IFLA_PROTO_DOWN_REASON,
|
||||
QEMU_IFLA_PARENT_DEV_NAME,
|
||||
QEMU_IFLA_PARENT_DEV_BUS_NAME,
|
||||
QEMU___IFLA_MAX
|
||||
};
|
||||
|
||||
@@ -179,6 +182,8 @@ enum {
|
||||
QEMU_IFLA_BRPORT_BACKUP_PORT,
|
||||
QEMU_IFLA_BRPORT_MRP_RING_OPEN,
|
||||
QEMU_IFLA_BRPORT_MRP_IN_OPEN,
|
||||
QEMU_IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT,
|
||||
QEMU_IFLA_BRPORT_MCAST_EHT_HOSTS_CNT,
|
||||
QEMU___IFLA_BRPORT_MAX
|
||||
};
|
||||
|
||||
@@ -268,6 +273,37 @@ enum {
|
||||
QEMU___RTA_MAX
|
||||
};
|
||||
|
||||
enum {
|
||||
QEMU_IFLA_VF_STATS_RX_PACKETS,
|
||||
QEMU_IFLA_VF_STATS_TX_PACKETS,
|
||||
QEMU_IFLA_VF_STATS_RX_BYTES,
|
||||
QEMU_IFLA_VF_STATS_TX_BYTES,
|
||||
QEMU_IFLA_VF_STATS_BROADCAST,
|
||||
QEMU_IFLA_VF_STATS_MULTICAST,
|
||||
QEMU_IFLA_VF_STATS_PAD,
|
||||
QEMU_IFLA_VF_STATS_RX_DROPPED,
|
||||
QEMU_IFLA_VF_STATS_TX_DROPPED,
|
||||
QEMU__IFLA_VF_STATS_MAX,
|
||||
};
|
||||
|
||||
enum {
|
||||
QEMU_IFLA_VF_UNSPEC,
|
||||
QEMU_IFLA_VF_MAC,
|
||||
QEMU_IFLA_VF_VLAN,
|
||||
QEMU_IFLA_VF_TX_RATE,
|
||||
QEMU_IFLA_VF_SPOOFCHK,
|
||||
QEMU_IFLA_VF_LINK_STATE,
|
||||
QEMU_IFLA_VF_RATE,
|
||||
QEMU_IFLA_VF_RSS_QUERY_EN,
|
||||
QEMU_IFLA_VF_STATS,
|
||||
QEMU_IFLA_VF_TRUST,
|
||||
QEMU_IFLA_VF_IB_NODE_GUID,
|
||||
QEMU_IFLA_VF_IB_PORT_GUID,
|
||||
QEMU_IFLA_VF_VLAN_LIST,
|
||||
QEMU_IFLA_VF_BROADCAST,
|
||||
QEMU__IFLA_VF_MAX,
|
||||
};
|
||||
|
||||
TargetFdTrans **target_fd_trans;
|
||||
QemuMutex target_fd_trans_lock;
|
||||
unsigned int target_fd_max;
|
||||
@@ -573,6 +609,8 @@ static abi_long host_to_target_slave_data_bridge_nlattr(struct nlattr *nlattr,
|
||||
/* uin32_t */
|
||||
case QEMU_IFLA_BRPORT_COST:
|
||||
case QEMU_IFLA_BRPORT_BACKUP_PORT:
|
||||
case QEMU_IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT:
|
||||
case QEMU_IFLA_BRPORT_MCAST_EHT_HOSTS_CNT:
|
||||
u32 = NLA_DATA(nlattr);
|
||||
*u32 = tswap32(*u32);
|
||||
break;
|
||||
@@ -805,6 +843,145 @@ static abi_long host_to_target_data_xdp_nlattr(struct nlattr *nlattr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static abi_long host_to_target_data_vlan_list_nlattr(struct nlattr *nlattr,
|
||||
void *context)
|
||||
{
|
||||
struct ifla_vf_vlan_info *vlan_info;
|
||||
|
||||
switch (nlattr->nla_type) {
|
||||
/* struct ifla_vf_vlan_info */
|
||||
case IFLA_VF_VLAN_INFO:
|
||||
vlan_info = NLA_DATA(nlattr);
|
||||
vlan_info->vf = tswap32(vlan_info->vf);
|
||||
vlan_info->vlan = tswap32(vlan_info->vlan);
|
||||
vlan_info->qos = tswap32(vlan_info->qos);
|
||||
break;
|
||||
default:
|
||||
qemu_log_mask(LOG_UNIMP, "Unknown host VLAN LIST type: %d\n",
|
||||
nlattr->nla_type);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static abi_long host_to_target_data_vf_stats_nlattr(struct nlattr *nlattr,
|
||||
void *context)
|
||||
{
|
||||
uint64_t *u64;
|
||||
|
||||
switch (nlattr->nla_type) {
|
||||
/* uint64_t */
|
||||
case QEMU_IFLA_VF_STATS_RX_PACKETS:
|
||||
case QEMU_IFLA_VF_STATS_TX_PACKETS:
|
||||
case QEMU_IFLA_VF_STATS_RX_BYTES:
|
||||
case QEMU_IFLA_VF_STATS_TX_BYTES:
|
||||
case QEMU_IFLA_VF_STATS_BROADCAST:
|
||||
case QEMU_IFLA_VF_STATS_MULTICAST:
|
||||
case QEMU_IFLA_VF_STATS_PAD:
|
||||
case QEMU_IFLA_VF_STATS_RX_DROPPED:
|
||||
case QEMU_IFLA_VF_STATS_TX_DROPPED:
|
||||
u64 = NLA_DATA(nlattr);
|
||||
*u64 = tswap64(*u64);
|
||||
break;
|
||||
default:
|
||||
qemu_log_mask(LOG_UNIMP, "Unknown host VF STATS type: %d\n",
|
||||
nlattr->nla_type);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static abi_long host_to_target_data_vfinfo_nlattr(struct nlattr *nlattr,
|
||||
void *context)
|
||||
{
|
||||
struct ifla_vf_mac *mac;
|
||||
struct ifla_vf_vlan *vlan;
|
||||
struct ifla_vf_vlan_info *vlan_info;
|
||||
struct ifla_vf_spoofchk *spoofchk;
|
||||
struct ifla_vf_rate *rate;
|
||||
struct ifla_vf_link_state *link_state;
|
||||
struct ifla_vf_rss_query_en *rss_query_en;
|
||||
struct ifla_vf_trust *trust;
|
||||
struct ifla_vf_guid *guid;
|
||||
|
||||
switch (nlattr->nla_type) {
|
||||
/* struct ifla_vf_mac */
|
||||
case QEMU_IFLA_VF_MAC:
|
||||
mac = NLA_DATA(nlattr);
|
||||
mac->vf = tswap32(mac->vf);
|
||||
break;
|
||||
/* struct ifla_vf_broadcast */
|
||||
case QEMU_IFLA_VF_BROADCAST:
|
||||
break;
|
||||
/* struct struct ifla_vf_vlan */
|
||||
case QEMU_IFLA_VF_VLAN:
|
||||
vlan = NLA_DATA(nlattr);
|
||||
vlan->vf = tswap32(vlan->vf);
|
||||
vlan->vlan = tswap32(vlan->vlan);
|
||||
vlan->qos = tswap32(vlan->qos);
|
||||
break;
|
||||
/* struct ifla_vf_vlan_info */
|
||||
case QEMU_IFLA_VF_TX_RATE:
|
||||
vlan_info = NLA_DATA(nlattr);
|
||||
vlan_info->vf = tswap32(vlan_info->vf);
|
||||
vlan_info->vlan = tswap32(vlan_info->vlan);
|
||||
vlan_info->qos = tswap32(vlan_info->qos);
|
||||
break;
|
||||
/* struct ifla_vf_spoofchk */
|
||||
case QEMU_IFLA_VF_SPOOFCHK:
|
||||
spoofchk = NLA_DATA(nlattr);
|
||||
spoofchk->vf = tswap32(spoofchk->vf);
|
||||
spoofchk->setting = tswap32(spoofchk->setting);
|
||||
break;
|
||||
/* struct ifla_vf_rate */
|
||||
case QEMU_IFLA_VF_RATE:
|
||||
rate = NLA_DATA(nlattr);
|
||||
rate->vf = tswap32(rate->vf);
|
||||
rate->min_tx_rate = tswap32(rate->min_tx_rate);
|
||||
rate->max_tx_rate = tswap32(rate->max_tx_rate);
|
||||
break;
|
||||
/* struct ifla_vf_link_state */
|
||||
case QEMU_IFLA_VF_LINK_STATE:
|
||||
link_state = NLA_DATA(nlattr);
|
||||
link_state->vf = tswap32(link_state->vf);
|
||||
link_state->link_state = tswap32(link_state->link_state);
|
||||
break;
|
||||
/* struct ifla_vf_rss_query_en */
|
||||
case QEMU_IFLA_VF_RSS_QUERY_EN:
|
||||
rss_query_en = NLA_DATA(nlattr);
|
||||
rss_query_en->vf = tswap32(rss_query_en->vf);
|
||||
rss_query_en->setting = tswap32(rss_query_en->setting);
|
||||
break;
|
||||
/* struct ifla_vf_trust */
|
||||
case QEMU_IFLA_VF_TRUST:
|
||||
trust = NLA_DATA(nlattr);
|
||||
trust->vf = tswap32(trust->vf);
|
||||
trust->setting = tswap32(trust->setting);
|
||||
break;
|
||||
/* struct ifla_vf_guid */
|
||||
case QEMU_IFLA_VF_IB_NODE_GUID:
|
||||
case QEMU_IFLA_VF_IB_PORT_GUID:
|
||||
guid = NLA_DATA(nlattr);
|
||||
guid->vf = tswap32(guid->vf);
|
||||
guid->guid = tswap32(guid->guid);
|
||||
break;
|
||||
/* nested */
|
||||
case QEMU_IFLA_VF_VLAN_LIST:
|
||||
return host_to_target_for_each_nlattr(RTA_DATA(nlattr), nlattr->nla_len,
|
||||
NULL,
|
||||
host_to_target_data_vlan_list_nlattr);
|
||||
case QEMU_IFLA_VF_STATS:
|
||||
return host_to_target_for_each_nlattr(RTA_DATA(nlattr), nlattr->nla_len,
|
||||
NULL,
|
||||
host_to_target_data_vf_stats_nlattr);
|
||||
default:
|
||||
qemu_log_mask(LOG_UNIMP, "Unknown host VFINFO type: %d\n",
|
||||
nlattr->nla_type);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
|
||||
{
|
||||
uint32_t *u32;
|
||||
@@ -818,9 +995,12 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
|
||||
case QEMU_IFLA_ADDRESS:
|
||||
case QEMU_IFLA_BROADCAST:
|
||||
case QEMU_IFLA_PERM_ADDRESS:
|
||||
case QEMU_IFLA_PHYS_PORT_ID:
|
||||
/* string */
|
||||
case QEMU_IFLA_IFNAME:
|
||||
case QEMU_IFLA_QDISC:
|
||||
case QEMU_IFLA_PARENT_DEV_NAME:
|
||||
case QEMU_IFLA_PARENT_DEV_BUS_NAME:
|
||||
break;
|
||||
/* uin8_t */
|
||||
case QEMU_IFLA_OPERSTATE:
|
||||
@@ -939,6 +1119,10 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
|
||||
return host_to_target_for_each_nlattr(RTA_DATA(rtattr), rtattr->rta_len,
|
||||
NULL,
|
||||
host_to_target_data_xdp_nlattr);
|
||||
case QEMU_IFLA_VFINFO_LIST:
|
||||
return host_to_target_for_each_nlattr(RTA_DATA(rtattr), rtattr->rta_len,
|
||||
NULL,
|
||||
host_to_target_data_vfinfo_nlattr);
|
||||
default:
|
||||
qemu_log_mask(LOG_UNIMP, "Unknown host QEMU_IFLA type: %d\n",
|
||||
rtattr->rta_type);
|
||||
|
||||
@@ -55,6 +55,21 @@
|
||||
#define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */
|
||||
#define TARGET_SIG_SETMASK 2 /* for setting the signal mask */
|
||||
|
||||
/* this struct defines a stack used during syscall handling */
|
||||
typedef struct target_sigaltstack {
|
||||
abi_ulong ss_sp;
|
||||
abi_int ss_flags;
|
||||
abi_ulong ss_size;
|
||||
} target_stack_t;
|
||||
|
||||
/*
|
||||
* sigaltstack controls
|
||||
*/
|
||||
#define TARGET_SS_ONSTACK 1
|
||||
#define TARGET_SS_DISABLE 2
|
||||
|
||||
#define TARGET_MINSIGSTKSZ 2048
|
||||
|
||||
/* bit-flags */
|
||||
#define TARGET_SS_AUTODISARM (1U << 31) /* disable sas during sighandling */
|
||||
/* mask for all SS_xxx flags */
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Generic prctl unalign functions for linux-user
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#ifndef GENERIC_TARGET_PRCTL_UNALIGN_H
|
||||
#define GENERIC_TARGET_PRCTL_UNALIGN_H
|
||||
|
||||
static abi_long do_prctl_get_unalign(CPUArchState *env, target_long arg2)
|
||||
{
|
||||
CPUState *cs = env_cpu(env);
|
||||
uint32_t res = PR_UNALIGN_NOPRINT;
|
||||
if (cs->prctl_unalign_sigbus) {
|
||||
res |= PR_UNALIGN_SIGBUS;
|
||||
}
|
||||
return put_user_u32(res, arg2);
|
||||
}
|
||||
#define do_prctl_get_unalign do_prctl_get_unalign
|
||||
|
||||
static abi_long do_prctl_set_unalign(CPUArchState *env, target_long arg2)
|
||||
{
|
||||
env_cpu(env)->prctl_unalign_sigbus = arg2 & PR_UNALIGN_SIGBUS;
|
||||
return 0;
|
||||
}
|
||||
#define do_prctl_set_unalign do_prctl_set_unalign
|
||||
|
||||
#endif /* GENERIC_TARGET_PRCTL_UNALIGN_H */
|
||||
@@ -0,0 +1 @@
|
||||
/* No special prctl support required. */
|
||||
@@ -18,17 +18,6 @@
|
||||
#ifndef HEXAGON_TARGET_SIGNAL_H
|
||||
#define HEXAGON_TARGET_SIGNAL_H
|
||||
|
||||
typedef struct target_sigaltstack {
|
||||
abi_ulong ss_sp;
|
||||
abi_int ss_flags;
|
||||
abi_ulong ss_size;
|
||||
} target_stack_t;
|
||||
|
||||
#define TARGET_SS_ONSTACK 1
|
||||
#define TARGET_SS_DISABLE 2
|
||||
|
||||
#define TARGET_MINSIGSTKSZ 2048
|
||||
|
||||
#include "../generic/signal.h"
|
||||
|
||||
#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user