From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487959209673851.1792556336691; Fri, 24 Feb 2017 10:00:09 -0800 (PST) Received: from localhost ([::1]:38991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chKA3-0004hJ-SO for importer@patchew.org; Fri, 24 Feb 2017 13:00:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrE-0007rE-97 for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrB-0002En-5y for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:40 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36851) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrA-0002Eg-SQ for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:37 -0500 Received: by mail-wm0-x242.google.com with SMTP id r18so4053891wmd.3 for ; Fri, 24 Feb 2017 09:40:36 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=8mc8VR85CFYzU+nPSe3oRDT/OxAggcYPh9IWgPRQwes=; b=TB9BomqfaIt35ycP2jz0visyWDxJHM4F/Q3k6qLGWuz+ThyAXmbc4YeC8hMyJyzRD8 j38WuToxJiEJmugZqbNOsaAbiRbL6xJAXZwHDK7JX30zgBxCmBXfDSGaZY+Q2D7EDuWV kt4LWBZLIfEeOvR3sSNcz/rGLmZm6udXDk2gfebo8vrLiHyo2hEQ0mWZ3G84NhRpmuTr FKZOWGPUvMEOYvVCG9ZUWZF6Uj1uzaRUbtMJnex/aXu6q9eDTPkCLGFxjuFA1YU2HxwD ymYHlBZAIbZbGsefbMBBS54Pk24gQT601LDCb6I4dp+D4lfCerDDIEimKiERqw2JjKnt qatw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=8mc8VR85CFYzU+nPSe3oRDT/OxAggcYPh9IWgPRQwes=; b=WfthHoGkYek5JxboUIHk6fd172m0ICCDJeP9aAuY6Twu3Sss4pFIAlM2LykyntmlC4 RUPruGuNmoepXoxphLFU59xDvTGiDvxtwgElmQADz2Xit+9DuGJwi6K/qosgE9/8vpnU 7pMy3xSPitnvJyM6SmnVfa6pZM3WMinZWE27F77WISRXJER4OOb4ZtrG2GMWRlBg3Sn/ gMpbhboUaOPovORaq9mfBCl4YbfcuEkE1bOVzkF0ZmjxZFN3ywCOI8BFhZP8q17AyTc8 7/XUvxa8oZyGBE41/RXfDxLOVPjjr1sVTSi4Ds23hSeTnRdUowsLM3S0OM5m7Zp1AkjR c8nQ== X-Gm-Message-State: AMke39kzxilBHaGGkf0NvXPZMwpHQbkw9tlIGR9xzDIIIAvT+w6GGKpAH+XEHqpb/nGH4w== X-Received: by 10.28.50.135 with SMTP id y129mr3704080wmy.2.1487958035345; Fri, 24 Feb 2017 09:40:35 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:14 +0100 Message-Id: <1487958030-51417-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 01/17] cpu-exec: unify icount_decr and tcg_exit_req X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The icount interrupt flag and tcg_exit_req serve almost the same purpose, let's make them completely the same. The former TB_EXIT_REQUESTED and TB_EXIT_ICOUNT_EXPIRED cases are unified, since we can distinguish them from the value of the interrupt flag. Signed-off-by: Paolo Bonzini --- cpu-exec.c | 70 ++++++++++++++++++++++---------------------= ---- include/exec/gen-icount.h | 53 +++++++++++++++++------------------ include/qom/cpu.h | 15 +++++----- qom/cpu.c | 2 +- tcg/tcg.h | 1 - translate-all.c | 2 +- translate-common.c | 13 ++++----- 7 files changed, 71 insertions(+), 85 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 142a586..8f094c8 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -185,12 +185,6 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *c= pu, TranslationBlock *itb) cc->set_pc(cpu, last_tb->pc); } } - if (tb_exit =3D=3D TB_EXIT_REQUESTED) { - /* We were asked to stop executing TBs (probably a pending - * interrupt. We've now stopped, so clear the flag. - */ - atomic_set(&cpu->tcg_exit_req, 0); - } return ret; } =20 @@ -537,6 +531,7 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, Tran= slationBlock *tb, SyncClocks *sc) { uintptr_t ret; + int32_t insns_left; =20 if (unlikely(atomic_read(&cpu->exit_request))) { return; @@ -546,8 +541,15 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, Tra= nslationBlock *tb, ret =3D cpu_tb_exec(cpu, tb); tb =3D (TranslationBlock *)(ret & ~TB_EXIT_MASK); *tb_exit =3D ret & TB_EXIT_MASK; - switch (*tb_exit) { - case TB_EXIT_REQUESTED: + if (*tb_exit !=3D TB_EXIT_REQUESTED) { + *last_tb =3D tb; + return; + } + + *last_tb =3D NULL; + insns_left =3D atomic_read(&cpu->icount_decr.u32); + atomic_set(&cpu->icount_decr.u16.high, 0); + if (insns_left < 0) { /* Something asked us to stop executing * chained TBs; just continue round the main * loop. Whatever requested the exit will also @@ -559,38 +561,30 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, Tr= anslationBlock *tb, * or cpu->interrupt_request. */ smp_mb(); - *last_tb =3D NULL; - break; - case TB_EXIT_ICOUNT_EXPIRED: - { - /* Instruction counter expired. */ -#ifdef CONFIG_USER_ONLY - abort(); -#else - int insns_left =3D cpu->icount_decr.u32; - *last_tb =3D NULL; - if (cpu->icount_extra && insns_left >=3D 0) { - /* Refill decrementer and continue execution. */ - cpu->icount_extra +=3D insns_left; - insns_left =3D MIN(0xffff, cpu->icount_extra); - cpu->icount_extra -=3D insns_left; - cpu->icount_decr.u16.low =3D insns_left; - } else { - if (insns_left > 0) { - /* Execute remaining instructions. */ - cpu_exec_nocache(cpu, insns_left, tb, false); - align_clocks(sc, cpu); - } - cpu->exception_index =3D EXCP_INTERRUPT; - cpu_loop_exit(cpu); - } - break; -#endif + return; } - default: - *last_tb =3D tb; - break; + + /* Instruction counter expired. */ + assert(use_icount); +#ifndef CONFIG_USER_ONLY + if (cpu->icount_extra) { + /* Refill decrementer and continue execution. */ + cpu->icount_extra +=3D insns_left; + insns_left =3D MIN(0xffff, cpu->icount_extra); + cpu->icount_extra -=3D insns_left; + cpu->icount_decr.u16.low =3D insns_left; + } else { + /* Execute any remaining instructions, then let the main loop + * handle the next event. + */ + if (insns_left > 0) { + cpu_exec_nocache(cpu, insns_left, tb, false); + align_clocks(sc, cpu); + } + cpu->exception_index =3D EXCP_INTERRUPT; + cpu_loop_exit(cpu); } +#endif } =20 /* main execution loop */ diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h index 050de59..62d462e 100644 --- a/include/exec/gen-icount.h +++ b/include/exec/gen-icount.h @@ -6,58 +6,55 @@ /* Helpers for instruction counting code generation. */ =20 static int icount_start_insn_idx; -static TCGLabel *icount_label; static TCGLabel *exitreq_label; =20 static inline void gen_tb_start(TranslationBlock *tb) { - TCGv_i32 count, flag, imm; + TCGv_i32 count, imm; =20 exitreq_label =3D gen_new_label(); - flag =3D tcg_temp_new_i32(); - tcg_gen_ld_i32(flag, cpu_env, - offsetof(CPUState, tcg_exit_req) - ENV_OFFSET); - tcg_gen_brcondi_i32(TCG_COND_NE, flag, 0, exitreq_label); - tcg_temp_free_i32(flag); - - if (!(tb->cflags & CF_USE_ICOUNT)) { - return; + if (tb->cflags & CF_USE_ICOUNT) { + count =3D tcg_temp_local_new_i32(); + } else { + count =3D tcg_temp_new_i32(); } =20 - icount_label =3D gen_new_label(); - count =3D tcg_temp_local_new_i32(); tcg_gen_ld_i32(count, cpu_env, -ENV_OFFSET + offsetof(CPUState, icount_decr.u32)); =20 - imm =3D tcg_temp_new_i32(); - /* We emit a movi with a dummy immediate argument. Keep the insn index - * of the movi so that we later (when we know the actual insn count) - * can update the immediate argument with the actual insn count. */ - icount_start_insn_idx =3D tcg_op_buf_count(); - tcg_gen_movi_i32(imm, 0xdeadbeef); + if (tb->cflags & CF_USE_ICOUNT) { + imm =3D tcg_temp_new_i32(); + /* We emit a movi with a dummy immediate argument. Keep the insn i= ndex + * of the movi so that we later (when we know the actual insn coun= t) + * can update the immediate argument with the actual insn count. = */ + icount_start_insn_idx =3D tcg_op_buf_count(); + tcg_gen_movi_i32(imm, 0xdeadbeef); + + tcg_gen_sub_i32(count, count, imm); + tcg_temp_free_i32(imm); + } + + tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, exitreq_label); =20 - tcg_gen_sub_i32(count, count, imm); - tcg_temp_free_i32(imm); + if (tb->cflags & CF_USE_ICOUNT) { + tcg_gen_st16_i32(count, cpu_env, + -ENV_OFFSET + offsetof(CPUState, icount_decr.u16.= low)); + } =20 - tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, icount_label); - tcg_gen_st16_i32(count, cpu_env, - -ENV_OFFSET + offsetof(CPUState, icount_decr.u16.low)= ); tcg_temp_free_i32(count); } =20 static void gen_tb_end(TranslationBlock *tb, int num_insns) { - gen_set_label(exitreq_label); - tcg_gen_exit_tb((uintptr_t)tb + TB_EXIT_REQUESTED); - if (tb->cflags & CF_USE_ICOUNT) { /* Update the num_insn immediate parameter now that we know * the actual insn count. */ tcg_set_insn_param(icount_start_insn_idx, 1, num_insns); - gen_set_label(icount_label); - tcg_gen_exit_tb((uintptr_t)tb + TB_EXIT_ICOUNT_EXPIRED); } =20 + gen_set_label(exitreq_label); + tcg_gen_exit_tb((uintptr_t)tb + TB_EXIT_REQUESTED); + /* Terminate the linked list. */ tcg_ctx.gen_op_buf[tcg_ctx.gen_op_buf[0].prev].next =3D 0; } diff --git a/include/qom/cpu.h b/include/qom/cpu.h index f69b240..1bc3ad2 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -275,11 +275,11 @@ struct qemu_work_item; * @stopped: Indicates the CPU has been artificially stopped. * @unplug: Indicates a pending CPU unplug request. * @crash_occurred: Indicates the OS reported a crash (panic) for this CPU - * @tcg_exit_req: Set to force TCG to stop executing linked TBs for this - * CPU and return to its top level loop. * @singlestep_enabled: Flags for single-stepping. * @icount_extra: Instructions until next timer event. - * @icount_decr: Number of cycles left, with interrupt flag in high bit. + * @icount_decr: Low 16 bits: number of cycles left, only used in icount m= ode. + * High 16 bits: Set to -1 to force TCG to stop executing linked TBs for t= his + * CPU and return to its top level loop (even in non-icount mode). * This allows a single read-compare-cbranch-write sequence to test * for both decrementer underflow and exceptions. * @can_do_io: Nonzero if memory-mapped IO is safe. Deterministic execution @@ -381,10 +381,6 @@ struct CPUState { /* TODO Move common fields from CPUArchState here. */ int cpu_index; /* used by alpha TCG */ uint32_t halted; /* used by alpha, cris, ppc TCG */ - union { - uint32_t u32; - icount_decr_u16 u16; - } icount_decr; uint32_t can_do_io; int32_t exception_index; /* used by m68k TCG */ =20 @@ -397,7 +393,10 @@ struct CPUState { offset from AREG0. Leave this field at the end so as to make the (absolute value) offset as small as possible. This reduces code size, especially for hosts without large memory offsets. */ - uint32_t tcg_exit_req; + union { + uint32_t u32; + icount_decr_u16 u16; + } icount_decr; =20 bool hax_vcpu_dirty; struct hax_vcpu_state *hax_vcpu; diff --git a/qom/cpu.c b/qom/cpu.c index ed87c50..7e005af 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -123,7 +123,7 @@ void cpu_exit(CPUState *cpu) atomic_set(&cpu->exit_request, 1); /* Ensure cpu_exec will see the exit request after TCG has exited. */ smp_wmb(); - atomic_set(&cpu->tcg_exit_req, 1); + atomic_set(&cpu->icount_decr.u16.high, -1); } =20 int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu, diff --git a/tcg/tcg.h b/tcg/tcg.h index 631c6f6..167aa30 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -1108,7 +1108,6 @@ static inline unsigned get_mmuidx(TCGMemOpIdx oi) #define TB_EXIT_MASK 3 #define TB_EXIT_IDX0 0 #define TB_EXIT_IDX1 1 -#define TB_EXIT_ICOUNT_EXPIRED 2 #define TB_EXIT_REQUESTED 3 =20 #ifdef HAVE_TCG_QEMU_TB_EXEC diff --git a/translate-all.c b/translate-all.c index 5f44ec8..1a21e3f 100644 --- a/translate-all.c +++ b/translate-all.c @@ -1958,7 +1958,7 @@ void dump_opcount_info(FILE *f, fprintf_function cpu_= fprintf) void cpu_interrupt(CPUState *cpu, int mask) { cpu->interrupt_request |=3D mask; - cpu->tcg_exit_req =3D 1; + cpu->icount_decr.u16.high =3D -1; } =20 /* diff --git a/translate-common.c b/translate-common.c index 5e989cd..77762fd 100644 --- a/translate-common.c +++ b/translate-common.c @@ -43,14 +43,11 @@ static void tcg_handle_interrupt(CPUState *cpu, int mas= k) return; } =20 - if (use_icount) { - cpu->icount_decr.u16.high =3D 0xffff; - if (!cpu->can_do_io - && (mask & ~old_mask) !=3D 0) { - cpu_abort(cpu, "Raised interrupt while not in I/O function"); - } - } else { - cpu->tcg_exit_req =3D 1; + cpu->icount_decr.u16.high =3D -1; + if (use_icount && + !cpu->can_do_io + && (mask & ~old_mask) !=3D 0) { + cpu_abort(cpu, "Raised interrupt while not in I/O function"); } } =20 --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487958799537725.4034562961652; Fri, 24 Feb 2017 09:53:19 -0800 (PST) Received: from localhost ([::1]:38950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chK3Q-000638-VF for importer@patchew.org; Fri, 24 Feb 2017 12:53:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrE-0007rF-91 for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrB-0002F2-Qd for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:40 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:36851) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrB-0002Ej-KL for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:37 -0500 Received: by mail-wm0-x244.google.com with SMTP id r18so4053922wmd.3 for ; Fri, 24 Feb 2017 09:40:37 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=wk+Eqr3Znz4osivFBnWipmLSUiJ/M92ZMtzRUDCFz88=; b=Bju6uMbNq568Rt0Nvdwvohbs/urp5MHMzkAWyBK5CAmfBC7PmBPiXHvL5Z4M0o+uRe uH/MTVaDOHi+ZNQzOjAFnOzaC/A4DQg0JWFpEfwLTHMXXH1M/wgOrpimXWEstitgtlwO GzUcjVl5QE9LUTCXxu0MiSjRfBFURLOxE9ddXRktm1lU3Gwwv1BJKaR8SO5eFun0M9fS Y0ofWg1UGNP5ihkKamPw3A/ts7HP2hMklzvRjH/cJpC1O97MezVVn4+or9G1oMMP7eRv a+6zUik9FlGkD44brNDQEgLg1zo9URmanV3yVGD7oHKEHAZRVrXxJfd5hS3v7dveC/zW aRJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=wk+Eqr3Znz4osivFBnWipmLSUiJ/M92ZMtzRUDCFz88=; b=I0YYyFMtfyjwYpIHfPokxaHntlv5sqpP1a2+vb785FtBCvv9QIwBw8hQWiFZup9Gwf WBIRhdMHqWED67Ih0/6Y8M0bR6cl37Y6d0w6marC68fvhAdbNFOuWx8hekkBlBXYsZRI QPGXLRkSpmhVYTgoETJNa43JqfPiJO3FG8RlKlaNC0QaZhU9K9C4dNhkVKXKNANaSvdy 04ZYbDu2QZPPWLYnnynf/4fM9lgL39qW/oT7/BEzPrBZEQAEtQWUXhC1RAONVzWZ8ms7 BYSMoPbjKjV+djguhflIVjxR+Ezy37PO5mOjBudgrnzjOPDxY6byJ8bLzp2exGWTWARJ ling== X-Gm-Message-State: AMke39nrOtBFpdJG1+y/wCYAB8rGCPjDe+9xPAlnjX4m2cfuiRLX1jLoD1FC1Z0lZqbu5Q== X-Received: by 10.28.147.72 with SMTP id v69mr3822774wmd.51.1487958036344; Fri, 24 Feb 2017 09:40:36 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:15 +0100 Message-Id: <1487958030-51417-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 02/17] replay: check icount in cpu exec loop X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pavel Dovgalyuk , Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk This patch adds check to break cpu loop when icount expires without setting the TB_EXIT_ICOUNT_EXPIRED flag. It happens when there is no available translated blocks and all instructions were executed. In icount replay mode unnecessary tb_find will be called (which may cause an exception) and execution will be non-deterministic. Because cpu_loop_exec_tb cannot longjmp anymore, we can remove the anticipated call to align_clocks in cpu_loop_exec_tb, as well as the SyncClocks *sc argument. Signed-off-by: Pavel Dovgalyuk Message-Id: <002801d2810f$18809c20$4981d460$@ru> Signed-off-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- cpu-exec.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 8f094c8..7ddf66c 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -517,7 +517,10 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, *last_tb =3D NULL; } } - if (unlikely(atomic_read(&cpu->exit_request) || replay_has_interrupt()= )) { + + /* Finally, check if we need to exit to the main loop. */ + if (unlikely(atomic_read(&cpu->exit_request) + || (use_icount && cpu->icount_decr.u16.low + cpu->icount_extra =3D= =3D 0))) { atomic_set(&cpu->exit_request, 0); cpu->exception_index =3D EXCP_INTERRUPT; return true; @@ -527,8 +530,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, } =20 static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, - TranslationBlock **last_tb, int *tb_ex= it, - SyncClocks *sc) + TranslationBlock **last_tb, int *tb_ex= it) { uintptr_t ret; int32_t insns_left; @@ -579,10 +581,7 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, Tra= nslationBlock *tb, */ if (insns_left > 0) { cpu_exec_nocache(cpu, insns_left, tb, false); - align_clocks(sc, cpu); } - cpu->exception_index =3D EXCP_INTERRUPT; - cpu_loop_exit(cpu); } #endif } @@ -593,7 +592,7 @@ int cpu_exec(CPUState *cpu) { CPUClass *cc =3D CPU_GET_CLASS(cpu); int ret; - SyncClocks sc; + SyncClocks sc =3D { 0 }; =20 /* replay_interrupt may need current_cpu */ current_cpu =3D cpu; @@ -643,7 +642,7 @@ int cpu_exec(CPUState *cpu) =20 while (!cpu_handle_interrupt(cpu, &last_tb)) { TranslationBlock *tb =3D tb_find(cpu, last_tb, tb_exit); - cpu_loop_exec_tb(cpu, tb, &last_tb, &tb_exit, &sc); + cpu_loop_exec_tb(cpu, tb, &last_tb, &tb_exit); /* Try to align the host and virtual clocks if the guest is in advance */ align_clocks(&sc, cpu); --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487959015812104.81788026207767; Fri, 24 Feb 2017 09:56:55 -0800 (PST) Received: from localhost ([::1]:38971 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chK6v-0000fV-GB for importer@patchew.org; Fri, 24 Feb 2017 12:56:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrE-0007rC-8d for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrC-0002FD-KE for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:40 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:35391) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrC-0002Ez-Dg for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:38 -0500 Received: by mail-wr0-x241.google.com with SMTP id q39so3111564wrb.2 for ; Fri, 24 Feb 2017 09:40:38 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=/HPgU1GyH+MEWDlVyc/zm1uzXwwWoZY5rnAvc88YdzQ=; b=i5VXzZ4QJ4zTkvSDd0+nE29zAYWgHNsvOOHugwk16ZSstsyeyZGkoMihwrFXv+Cbhx aP4PFLXZzO8GUE3oxY5J8EYa6Frs0wc70Ctx4r4JsTrFw7KNFc7hry6xG6WFHLVFuqM7 B/hiI3Oj9xmxfb63hoiTPmiUDRBRAzl/dDazc9rB6iLIyp9tahmgXxgIV88lrFKbhwWd eNF1m5FHMpK0oYE1GX0eeCQ5xMENqPPIthPr6HEcFffRABDe3sSdbrqArAa5YIZeXSa9 i2HVkQDMfVflGIVts7r/Suc70gY4dF/V2myX875/7nOimjccMCTKqidIapTO9sZjZCTb 6IGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=/HPgU1GyH+MEWDlVyc/zm1uzXwwWoZY5rnAvc88YdzQ=; b=Q+2Wx4lDrhUgk6fiviC2BfdvFeKHc07q1vy8nMW5m+O6uiNVrEM+R7fec3ZH5OfRva SJEUMGVrTa3u2ZzD/oEcGyP3EJj6jTU8oPwEFDdzg7+M0ZloPZ7MKMIa800TgdP4iChu qffkf9Eh83iN4knYnfAGF+yTqAnczwo/iRCZEVtuIAsrisZDLpT0aZv0ND9HJiprbhOW gAA+lIwuYX+q0htzQb0WXBEYmtGlWRJDHOdwxzVeyNmTb37tiM74KFV/vgdfhIGrihUk QfgNM76N1RnDUgmM+hWlMNj8kzD+CV/gsQ4o9BFS3LIwOfRVMfnEYo2ZuIWmcoKAXTkh EPqQ== X-Gm-Message-State: AMke39mjAKzF9yIr9X2e+9cGX60FIHGvyNsyWO7RhTl+ptuqgKaI8gqStgkpnR7CqygeFw== X-Received: by 10.223.131.103 with SMTP id 94mr3587476wrd.115.1487958037210; Fri, 24 Feb 2017 09:40:37 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:16 +0100 Message-Id: <1487958030-51417-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 03/17] cpu-exec: remove unnecessary check of cpu->exit_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The cpu->exit_request check in cpu_loop_exec_tb is unnecessary, because cpu->tcg_exit_req is always set after cpu->exit_request. So let the TB exit and we will pick up the exit request later in cpu_handle_interrupt. Signed-off-by: Paolo Bonzini --- cpu-exec.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 7ddf66c..7db959c 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -535,10 +535,6 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, Tra= nslationBlock *tb, uintptr_t ret; int32_t insns_left; =20 - if (unlikely(atomic_read(&cpu->exit_request))) { - return; - } - trace_exec_tb(tb, tb->pc); ret =3D cpu_tb_exec(cpu, tb); tb =3D (TranslationBlock *)(ret & ~TB_EXIT_MASK); --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487958478570645.7056546919753; Fri, 24 Feb 2017 09:47:58 -0800 (PST) Received: from localhost ([::1]:38924 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJyG-0006Pg-KY for importer@patchew.org; Fri, 24 Feb 2017 12:47:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrE-0007rG-9i for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrD-0002FP-F4 for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:40 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:32932) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrD-0002FH-8T for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:39 -0500 Received: by mail-wm0-x242.google.com with SMTP id v77so4056920wmv.0 for ; Fri, 24 Feb 2017 09:40:39 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=4EuZhRZuIxpA5vqH2tgR3oJXd5KRowZCOPX1QGa2j14=; b=TCPtYVhkHlEc7CPECVcTKy1hBGS2T+jcBjsfRORrVhCrAL+Pt+X48I0dmPjeS8IKGA GkzmmxYym8Qk9nXQhIyiP5cCH5o8KLw+k+WpYgCmt+bW43cw38AlKCk4chb5t0nElPwq fTVSL9r2OVX5bydQGsVMPDGDRki62LAK+OgLtToDkIYXUMnV3UkWKoR16M8aSn5C5gIO pbaHtllsRXswWpVoXvjF3Qns2zywDEqhCDtCxoG6xf6rdxoe3DPYVWLbGqEJouv6MdPr RymRsPw1eUa0bQXiUXQBPxELsuJNLKd3fw9T2XWy0Erve5aiQ81pS2mXjFPZntCKOb36 cZpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=4EuZhRZuIxpA5vqH2tgR3oJXd5KRowZCOPX1QGa2j14=; b=TtAsNWUhuNzL43pv4dZcxUCwg7YRzzbamPYSmS47RW5nslRoNuTIAL4kFx9TI1tPwH M4wUQWKj2Wy7L5KqgKZ/eyqbz8bkMl5fMbtykWEsZs+aaNdKlKtPqsyKGxwRGNWrVcQJ TroEaxXh8XgA2RkW+4KZENQ+WOXSyo6tFE0+fzWKCNCj+LL2ic68Dc4Qz8VMUxJh7Oz7 kr9NSD9Y6cDOJGWpUyVlXc0O2so9zYlNsf0w+EyLpSGoklNga2ALkY7jQUfLLs3c8FkY kiPlTy/fRcYPsIjFEUzpvzgr7oHPWBVJK+SsQNPFkfBdvLTkKLY88e9PDHhUGdYKpWiQ sI6A== X-Gm-Message-State: AMke39kV/w3isc8RIKBq9rOXIq1/VmykwqRdGtN++u7qkq9WHz5gz628w4FZd1y39hUZug== X-Received: by 10.28.48.7 with SMTP id w7mr3793576wmw.78.1487958038092; Fri, 24 Feb 2017 09:40:38 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:17 +0100 Message-Id: <1487958030-51417-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 04/17] update-linux-headers: update for 4.11 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The linux-headers/asm-arm/unistd.h file has been split in three sub-files, copy them along. However, building them requires setting ARCH rather than SRCARCH. SRCARCH defaults to $(ARCH) anyway; to avoid future occurrence of the same problem use ARCH for all architectures where SRCARCH=3DARCH. Currently these are all except x86, sparc, sh and tile. Signed-off-by: Paolo Bonzini --- scripts/update-linux-headers.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers= .sh index 72cf1fb..6a370a8 100755 --- a/scripts/update-linux-headers.sh +++ b/scripts/update-linux-headers.sh @@ -75,7 +75,13 @@ for arch in $ARCHLIST; do continue fi =20 - make -C "$linux" INSTALL_HDR_PATH=3D"$tmpdir" SRCARCH=3D$arch headers_= install + if [ "$arch" =3D x86 ]; then + arch_var=3DSRCARCH + else + arch_var=3DARCH + fi + + make -C "$linux" INSTALL_HDR_PATH=3D"$tmpdir" $arch_var=3D$arch header= s_install =20 rm -rf "$output/linux-headers/asm-$arch" mkdir -p "$output/linux-headers/asm-$arch" @@ -92,6 +98,11 @@ for arch in $ARCHLIST; do cp_portable "$tmpdir/include/asm/kvm_virtio.h" "$output/include/st= andard-headers/asm-s390/" cp_portable "$tmpdir/include/asm/virtio-ccw.h" "$output/include/st= andard-headers/asm-s390/" fi + if [ $arch =3D arm ]; then + cp "$tmpdir/include/asm/unistd-eabi.h" "$output/linux-headers/asm-= arm/" + cp "$tmpdir/include/asm/unistd-oabi.h" "$output/linux-headers/asm-= arm/" + cp "$tmpdir/include/asm/unistd-common.h" "$output/linux-headers/as= m-arm/" + fi if [ $arch =3D x86 ]; then cp_portable "$tmpdir/include/asm/hyperv.h" "$output/include/standa= rd-headers/asm-x86/" cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-x8= 6/" --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487958781678404.81734584194874; Fri, 24 Feb 2017 09:53:01 -0800 (PST) Received: from localhost ([::1]:38949 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chK39-0005Jk-QA for importer@patchew.org; Fri, 24 Feb 2017 12:52:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrM-0007yk-By for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrG-0002GZ-Oj for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:48 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:34518) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrG-0002GA-A5 for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:42 -0500 Received: by mail-wm0-x241.google.com with SMTP id m70so4058762wma.1 for ; Fri, 24 Feb 2017 09:40:42 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZiP88bfg8WMAORxC9d510rmXp/7we0vh/2wONIxRyoE=; b=CMWtN2aVO3fwPP8P9USR5IBd1jprnfSa6FttQnW7HOfRj+mXHTgZT3emR+OR3LpOOa TvsL0SWMC6mUOCXMLkdn/2mlSESZi8PlwTHOC9Min8fZ68zNSLWirAYWjkZjJIa2gNhW UHg8d7yGmMqKpsFIZ7Y3rNyRqeEAYfw3jL0inbCw52QSIiXtHnhh3N7jkFUo/3DO5xMx Z+TPzMIvuVnRrlf8Yh1Y4VJuWEFIG2vgOlmLjXedbYmLRGKXkjkoGFvCSLzLoBtctsuF CAlKPwkdJor7FOSTwB98WuSNqkCUltT7gObm+i6ws+FUNcBDIXqcxpiE5RhHGk5iK8o7 rwCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ZiP88bfg8WMAORxC9d510rmXp/7we0vh/2wONIxRyoE=; b=tShbvEkU3RQz7qxEsU1F8v06Jk0dvHlYOevUotEQu2ny5hOUoy1CRbTnMOCoyRnz1O 1sh76yCdeteRsINBmjabLikhn3u6jY5OG/XmFZkQmSQejTub8u9B3UG2ahQYWwFjxm0I hQGGXQC2R6JTY2O+L8uLg7ziWz2XJpv20dnRiZ2V5XH39ORRw02idRlTrH4E98/vxi1/ uo7QUvp+AR2NswzKNEgsKYE2+1lhDLDKCyCzGPQxe2R7aLIUHFV4K/k5gXRODBD6Q7/n XHY/+mxxtUL8lhZzk1KdEP2rovAu2dVO3Ax9kIl0U0+WP9g+P2LnB1zagoeFkNgghYuF pGPA== X-Gm-Message-State: AMke39nguUg5etwLrI3abEnsGQ2aQpLMHGViu4u4I4FoINd/HRbw03BayQ2lcBipg0XqCw== X-Received: by 10.28.87.85 with SMTP id l82mr3639439wmb.135.1487958040128; Fri, 24 Feb 2017 09:40:40 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:18 +0100 Message-Id: <1487958030-51417-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 05/17] update Linux headers to 4.11 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dgilbert@redhat.com, vijay.kilari@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" virtio_mmio.h would be deleted; I am leaving it in though it was a mistake to add it. Cc: dgilbert@redhat.com Cc: vijay.kilari@gmail.com Signed-off-by: Paolo Bonzini --- include/standard-headers/asm-x86/hyperv.h | 8 + include/standard-headers/linux/input-event-codes.h | 2 +- include/standard-headers/linux/pci_regs.h | 25 ++ include/standard-headers/linux/virtio_ids.h | 1 + linux-headers/asm-arm/kvm.h | 15 + linux-headers/asm-arm/unistd-common.h | 357 ++++++++++++++++++ linux-headers/asm-arm/unistd-eabi.h | 5 + linux-headers/asm-arm/unistd-oabi.h | 17 + linux-headers/asm-arm/unistd.h | 419 +----------------= ---- linux-headers/asm-arm64/kvm.h | 13 + linux-headers/asm-powerpc/kvm.h | 27 ++ linux-headers/asm-powerpc/unistd.h | 1 + linux-headers/asm-x86/kvm_para.h | 13 +- linux-headers/linux/kvm.h | 24 +- linux-headers/linux/kvm_para.h | 2 + linux-headers/linux/userfaultfd.h | 67 +++- linux-headers/linux/vfio.h | 10 + 17 files changed, 577 insertions(+), 429 deletions(-) create mode 100644 linux-headers/asm-arm/unistd-common.h create mode 100644 linux-headers/asm-arm/unistd-eabi.h create mode 100644 linux-headers/asm-arm/unistd-oabi.h diff --git a/include/standard-headers/asm-x86/hyperv.h b/include/standard-h= eaders/asm-x86/hyperv.h index 47b38fb..eca9a2c 100644 --- a/include/standard-headers/asm-x86/hyperv.h +++ b/include/standard-headers/asm-x86/hyperv.h @@ -73,6 +73,9 @@ */ #define HV_X64_MSR_STAT_PAGES_AVAILABLE (1 << 8) =20 +/* Crash MSR available */ +#define HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE (1 << 10) + /* * Feature identification: EBX indicates which flags were specified at * partition creation. The format is the same as the partition creation @@ -144,6 +147,11 @@ */ #define HV_X64_RELAXED_TIMING_RECOMMENDED (1 << 5) =20 +/* + * Crash notification flag. + */ +#define HV_CRASH_CTL_CRASH_NOTIFY (1ULL << 63) + /* MSR used to identify the guest OS. */ #define HV_X64_MSR_GUEST_OS_ID 0x40000000 =20 diff --git a/include/standard-headers/linux/input-event-codes.h b/include/s= tandard-headers/linux/input-event-codes.h index 5c10f7e..c8b3338 100644 --- a/include/standard-headers/linux/input-event-codes.h +++ b/include/standard-headers/linux/input-event-codes.h @@ -640,7 +640,7 @@ * Control a data application associated with the currently viewed channel, * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.) */ -#define KEY_DATA 0x275 +#define KEY_DATA 0x277 =20 #define BTN_TRIGGER_HAPPY 0x2c0 #define BTN_TRIGGER_HAPPY1 0x2c0 diff --git a/include/standard-headers/linux/pci_regs.h b/include/standard-h= eaders/linux/pci_regs.h index e5a2e68..634c9c4 100644 --- a/include/standard-headers/linux/pci_regs.h +++ b/include/standard-headers/linux/pci_regs.h @@ -23,6 +23,14 @@ #define LINUX_PCI_REGS_H =20 /* + * Conventional PCI and PCI-X Mode 1 devices have 256 bytes of + * configuration space. PCI-X Mode 2 and PCIe devices have 4096 bytes of + * configuration space. + */ +#define PCI_CFG_SPACE_SIZE 256 +#define PCI_CFG_SPACE_EXP_SIZE 4096 + +/* * Under PCI, each device has 256 bytes of configuration address space, * of which the first 64 bytes are standardized as follows: */ @@ -674,6 +682,7 @@ #define PCI_EXT_CAP_ID_PMUX 0x1A /* Protocol Multiplexing */ #define PCI_EXT_CAP_ID_PASID 0x1B /* Process Address Space ID */ #define PCI_EXT_CAP_ID_DPC 0x1D /* Downstream Port Containment */ +#define PCI_EXT_CAP_ID_L1SS 0x1E /* L1 PM Substates */ #define PCI_EXT_CAP_ID_PTM 0x1F /* Precision Time Measurement */ #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PTM =20 @@ -965,6 +974,7 @@ #define PCI_EXP_DPC_STATUS 8 /* DPC Status */ #define PCI_EXP_DPC_STATUS_TRIGGER 0x01 /* Trigger Status */ #define PCI_EXP_DPC_STATUS_INTERRUPT 0x08 /* Interrupt Status */ +#define PCI_EXP_DPC_RP_BUSY 0x10 /* Root Port Busy */ =20 #define PCI_EXP_DPC_SOURCE_ID 10 /* DPC Source Identifier */ =20 @@ -977,4 +987,19 @@ #define PCI_PTM_CTRL_ENABLE 0x00000001 /* PTM enable */ #define PCI_PTM_CTRL_ROOT 0x00000002 /* Root select */ =20 +/* L1 PM Substates */ +#define PCI_L1SS_CAP 4 /* capability register */ +#define PCI_L1SS_CAP_PCIPM_L1_2 1 /* PCI PM L1.2 Support */ +#define PCI_L1SS_CAP_PCIPM_L1_1 2 /* PCI PM L1.1 Support */ +#define PCI_L1SS_CAP_ASPM_L1_2 4 /* ASPM L1.2 Support */ +#define PCI_L1SS_CAP_ASPM_L1_1 8 /* ASPM L1.1 Support */ +#define PCI_L1SS_CAP_L1_PM_SS 16 /* L1 PM Substates Support */ +#define PCI_L1SS_CTL1 8 /* Control Register 1 */ +#define PCI_L1SS_CTL1_PCIPM_L1_2 1 /* PCI PM L1.2 Enable */ +#define PCI_L1SS_CTL1_PCIPM_L1_1 2 /* PCI PM L1.1 Support */ +#define PCI_L1SS_CTL1_ASPM_L1_2 4 /* ASPM L1.2 Support */ +#define PCI_L1SS_CTL1_ASPM_L1_1 8 /* ASPM L1.1 Support */ +#define PCI_L1SS_CTL1_L1SS_MASK 0x0000000F +#define PCI_L1SS_CTL2 0xC /* Control Register 2 */ + #endif /* LINUX_PCI_REGS_H */ diff --git a/include/standard-headers/linux/virtio_ids.h b/include/standard= -headers/linux/virtio_ids.h index fe74e42..6d5c3b2 100644 --- a/include/standard-headers/linux/virtio_ids.h +++ b/include/standard-headers/linux/virtio_ids.h @@ -43,4 +43,5 @@ #define VIRTIO_ID_INPUT 18 /* virtio input */ #define VIRTIO_ID_VSOCK 19 /* virtio vsock transport */ #define VIRTIO_ID_CRYPTO 20 /* virtio crypto */ + #endif /* _LINUX_VIRTIO_IDS_H */ diff --git a/linux-headers/asm-arm/kvm.h b/linux-headers/asm-arm/kvm.h index 2fb7859..1101d55 100644 --- a/linux-headers/asm-arm/kvm.h +++ b/linux-headers/asm-arm/kvm.h @@ -87,9 +87,11 @@ struct kvm_regs { /* Supported VGICv3 address types */ #define KVM_VGIC_V3_ADDR_TYPE_DIST 2 #define KVM_VGIC_V3_ADDR_TYPE_REDIST 3 +#define KVM_VGIC_ITS_ADDR_TYPE 4 =20 #define KVM_VGIC_V3_DIST_SIZE SZ_64K #define KVM_VGIC_V3_REDIST_SIZE (2 * SZ_64K) +#define KVM_VGIC_V3_ITS_SIZE (2 * SZ_64K) =20 #define KVM_ARM_VCPU_POWER_OFF 0 /* CPU is started in OFF state */ #define KVM_ARM_VCPU_PSCI_0_2 1 /* CPU uses PSCI v0.2 */ @@ -179,10 +181,23 @@ struct kvm_arch_memory_slot { #define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2 #define KVM_DEV_ARM_VGIC_CPUID_SHIFT 32 #define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_S= HIFT) +#define KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT 32 +#define KVM_DEV_ARM_VGIC_V3_MPIDR_MASK \ + (0xffffffffULL << KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT) #define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0 #define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_= OFFSET_SHIFT) +#define KVM_DEV_ARM_VGIC_SYSREG_INSTR_MASK (0xffff) #define KVM_DEV_ARM_VGIC_GRP_NR_IRQS 3 #define KVM_DEV_ARM_VGIC_GRP_CTRL 4 +#define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5 +#define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6 +#define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO 7 +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10 +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \ + (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT) +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff +#define VGIC_LEVEL_INFO_LINE_LEVEL 0 + #define KVM_DEV_ARM_VGIC_CTRL_INIT 0 =20 /* KVM_IRQ_LINE irq field index values */ diff --git a/linux-headers/asm-arm/unistd-common.h b/linux-headers/asm-arm/= unistd-common.h new file mode 100644 index 0000000..13a74af --- /dev/null +++ b/linux-headers/asm-arm/unistd-common.h @@ -0,0 +1,357 @@ +#ifndef _ASM_ARM_UNISTD_COMMON_H +#define _ASM_ARM_UNISTD_COMMON_H 1 + +#define __NR_restart_syscall (__NR_SYSCALL_BASE + 0) +#define __NR_exit (__NR_SYSCALL_BASE + 1) +#define __NR_fork (__NR_SYSCALL_BASE + 2) +#define __NR_read (__NR_SYSCALL_BASE + 3) +#define __NR_write (__NR_SYSCALL_BASE + 4) +#define __NR_open (__NR_SYSCALL_BASE + 5) +#define __NR_close (__NR_SYSCALL_BASE + 6) +#define __NR_creat (__NR_SYSCALL_BASE + 8) +#define __NR_link (__NR_SYSCALL_BASE + 9) +#define __NR_unlink (__NR_SYSCALL_BASE + 10) +#define __NR_execve (__NR_SYSCALL_BASE + 11) +#define __NR_chdir (__NR_SYSCALL_BASE + 12) +#define __NR_mknod (__NR_SYSCALL_BASE + 14) +#define __NR_chmod (__NR_SYSCALL_BASE + 15) +#define __NR_lchown (__NR_SYSCALL_BASE + 16) +#define __NR_lseek (__NR_SYSCALL_BASE + 19) +#define __NR_getpid (__NR_SYSCALL_BASE + 20) +#define __NR_mount (__NR_SYSCALL_BASE + 21) +#define __NR_setuid (__NR_SYSCALL_BASE + 23) +#define __NR_getuid (__NR_SYSCALL_BASE + 24) +#define __NR_ptrace (__NR_SYSCALL_BASE + 26) +#define __NR_pause (__NR_SYSCALL_BASE + 29) +#define __NR_access (__NR_SYSCALL_BASE + 33) +#define __NR_nice (__NR_SYSCALL_BASE + 34) +#define __NR_sync (__NR_SYSCALL_BASE + 36) +#define __NR_kill (__NR_SYSCALL_BASE + 37) +#define __NR_rename (__NR_SYSCALL_BASE + 38) +#define __NR_mkdir (__NR_SYSCALL_BASE + 39) +#define __NR_rmdir (__NR_SYSCALL_BASE + 40) +#define __NR_dup (__NR_SYSCALL_BASE + 41) +#define __NR_pipe (__NR_SYSCALL_BASE + 42) +#define __NR_times (__NR_SYSCALL_BASE + 43) +#define __NR_brk (__NR_SYSCALL_BASE + 45) +#define __NR_setgid (__NR_SYSCALL_BASE + 46) +#define __NR_getgid (__NR_SYSCALL_BASE + 47) +#define __NR_geteuid (__NR_SYSCALL_BASE + 49) +#define __NR_getegid (__NR_SYSCALL_BASE + 50) +#define __NR_acct (__NR_SYSCALL_BASE + 51) +#define __NR_umount2 (__NR_SYSCALL_BASE + 52) +#define __NR_ioctl (__NR_SYSCALL_BASE + 54) +#define __NR_fcntl (__NR_SYSCALL_BASE + 55) +#define __NR_setpgid (__NR_SYSCALL_BASE + 57) +#define __NR_umask (__NR_SYSCALL_BASE + 60) +#define __NR_chroot (__NR_SYSCALL_BASE + 61) +#define __NR_ustat (__NR_SYSCALL_BASE + 62) +#define __NR_dup2 (__NR_SYSCALL_BASE + 63) +#define __NR_getppid (__NR_SYSCALL_BASE + 64) +#define __NR_getpgrp (__NR_SYSCALL_BASE + 65) +#define __NR_setsid (__NR_SYSCALL_BASE + 66) +#define __NR_sigaction (__NR_SYSCALL_BASE + 67) +#define __NR_setreuid (__NR_SYSCALL_BASE + 70) +#define __NR_setregid (__NR_SYSCALL_BASE + 71) +#define __NR_sigsuspend (__NR_SYSCALL_BASE + 72) +#define __NR_sigpending (__NR_SYSCALL_BASE + 73) +#define __NR_sethostname (__NR_SYSCALL_BASE + 74) +#define __NR_setrlimit (__NR_SYSCALL_BASE + 75) +#define __NR_getrusage (__NR_SYSCALL_BASE + 77) +#define __NR_gettimeofday (__NR_SYSCALL_BASE + 78) +#define __NR_settimeofday (__NR_SYSCALL_BASE + 79) +#define __NR_getgroups (__NR_SYSCALL_BASE + 80) +#define __NR_setgroups (__NR_SYSCALL_BASE + 81) +#define __NR_symlink (__NR_SYSCALL_BASE + 83) +#define __NR_readlink (__NR_SYSCALL_BASE + 85) +#define __NR_uselib (__NR_SYSCALL_BASE + 86) +#define __NR_swapon (__NR_SYSCALL_BASE + 87) +#define __NR_reboot (__NR_SYSCALL_BASE + 88) +#define __NR_munmap (__NR_SYSCALL_BASE + 91) +#define __NR_truncate (__NR_SYSCALL_BASE + 92) +#define __NR_ftruncate (__NR_SYSCALL_BASE + 93) +#define __NR_fchmod (__NR_SYSCALL_BASE + 94) +#define __NR_fchown (__NR_SYSCALL_BASE + 95) +#define __NR_getpriority (__NR_SYSCALL_BASE + 96) +#define __NR_setpriority (__NR_SYSCALL_BASE + 97) +#define __NR_statfs (__NR_SYSCALL_BASE + 99) +#define __NR_fstatfs (__NR_SYSCALL_BASE + 100) +#define __NR_syslog (__NR_SYSCALL_BASE + 103) +#define __NR_setitimer (__NR_SYSCALL_BASE + 104) +#define __NR_getitimer (__NR_SYSCALL_BASE + 105) +#define __NR_stat (__NR_SYSCALL_BASE + 106) +#define __NR_lstat (__NR_SYSCALL_BASE + 107) +#define __NR_fstat (__NR_SYSCALL_BASE + 108) +#define __NR_vhangup (__NR_SYSCALL_BASE + 111) +#define __NR_wait4 (__NR_SYSCALL_BASE + 114) +#define __NR_swapoff (__NR_SYSCALL_BASE + 115) +#define __NR_sysinfo (__NR_SYSCALL_BASE + 116) +#define __NR_fsync (__NR_SYSCALL_BASE + 118) +#define __NR_sigreturn (__NR_SYSCALL_BASE + 119) +#define __NR_clone (__NR_SYSCALL_BASE + 120) +#define __NR_setdomainname (__NR_SYSCALL_BASE + 121) +#define __NR_uname (__NR_SYSCALL_BASE + 122) +#define __NR_adjtimex (__NR_SYSCALL_BASE + 124) +#define __NR_mprotect (__NR_SYSCALL_BASE + 125) +#define __NR_sigprocmask (__NR_SYSCALL_BASE + 126) +#define __NR_init_module (__NR_SYSCALL_BASE + 128) +#define __NR_delete_module (__NR_SYSCALL_BASE + 129) +#define __NR_quotactl (__NR_SYSCALL_BASE + 131) +#define __NR_getpgid (__NR_SYSCALL_BASE + 132) +#define __NR_fchdir (__NR_SYSCALL_BASE + 133) +#define __NR_bdflush (__NR_SYSCALL_BASE + 134) +#define __NR_sysfs (__NR_SYSCALL_BASE + 135) +#define __NR_personality (__NR_SYSCALL_BASE + 136) +#define __NR_setfsuid (__NR_SYSCALL_BASE + 138) +#define __NR_setfsgid (__NR_SYSCALL_BASE + 139) +#define __NR__llseek (__NR_SYSCALL_BASE + 140) +#define __NR_getdents (__NR_SYSCALL_BASE + 141) +#define __NR__newselect (__NR_SYSCALL_BASE + 142) +#define __NR_flock (__NR_SYSCALL_BASE + 143) +#define __NR_msync (__NR_SYSCALL_BASE + 144) +#define __NR_readv (__NR_SYSCALL_BASE + 145) +#define __NR_writev (__NR_SYSCALL_BASE + 146) +#define __NR_getsid (__NR_SYSCALL_BASE + 147) +#define __NR_fdatasync (__NR_SYSCALL_BASE + 148) +#define __NR__sysctl (__NR_SYSCALL_BASE + 149) +#define __NR_mlock (__NR_SYSCALL_BASE + 150) +#define __NR_munlock (__NR_SYSCALL_BASE + 151) +#define __NR_mlockall (__NR_SYSCALL_BASE + 152) +#define __NR_munlockall (__NR_SYSCALL_BASE + 153) +#define __NR_sched_setparam (__NR_SYSCALL_BASE + 154) +#define __NR_sched_getparam (__NR_SYSCALL_BASE + 155) +#define __NR_sched_setscheduler (__NR_SYSCALL_BASE + 156) +#define __NR_sched_getscheduler (__NR_SYSCALL_BASE + 157) +#define __NR_sched_yield (__NR_SYSCALL_BASE + 158) +#define __NR_sched_get_priority_max (__NR_SYSCALL_BASE + 159) +#define __NR_sched_get_priority_min (__NR_SYSCALL_BASE + 160) +#define __NR_sched_rr_get_interval (__NR_SYSCALL_BASE + 161) +#define __NR_nanosleep (__NR_SYSCALL_BASE + 162) +#define __NR_mremap (__NR_SYSCALL_BASE + 163) +#define __NR_setresuid (__NR_SYSCALL_BASE + 164) +#define __NR_getresuid (__NR_SYSCALL_BASE + 165) +#define __NR_poll (__NR_SYSCALL_BASE + 168) +#define __NR_nfsservctl (__NR_SYSCALL_BASE + 169) +#define __NR_setresgid (__NR_SYSCALL_BASE + 170) +#define __NR_getresgid (__NR_SYSCALL_BASE + 171) +#define __NR_prctl (__NR_SYSCALL_BASE + 172) +#define __NR_rt_sigreturn (__NR_SYSCALL_BASE + 173) +#define __NR_rt_sigaction (__NR_SYSCALL_BASE + 174) +#define __NR_rt_sigprocmask (__NR_SYSCALL_BASE + 175) +#define __NR_rt_sigpending (__NR_SYSCALL_BASE + 176) +#define __NR_rt_sigtimedwait (__NR_SYSCALL_BASE + 177) +#define __NR_rt_sigqueueinfo (__NR_SYSCALL_BASE + 178) +#define __NR_rt_sigsuspend (__NR_SYSCALL_BASE + 179) +#define __NR_pread64 (__NR_SYSCALL_BASE + 180) +#define __NR_pwrite64 (__NR_SYSCALL_BASE + 181) +#define __NR_chown (__NR_SYSCALL_BASE + 182) +#define __NR_getcwd (__NR_SYSCALL_BASE + 183) +#define __NR_capget (__NR_SYSCALL_BASE + 184) +#define __NR_capset (__NR_SYSCALL_BASE + 185) +#define __NR_sigaltstack (__NR_SYSCALL_BASE + 186) +#define __NR_sendfile (__NR_SYSCALL_BASE + 187) +#define __NR_vfork (__NR_SYSCALL_BASE + 190) +#define __NR_ugetrlimit (__NR_SYSCALL_BASE + 191) +#define __NR_mmap2 (__NR_SYSCALL_BASE + 192) +#define __NR_truncate64 (__NR_SYSCALL_BASE + 193) +#define __NR_ftruncate64 (__NR_SYSCALL_BASE + 194) +#define __NR_stat64 (__NR_SYSCALL_BASE + 195) +#define __NR_lstat64 (__NR_SYSCALL_BASE + 196) +#define __NR_fstat64 (__NR_SYSCALL_BASE + 197) +#define __NR_lchown32 (__NR_SYSCALL_BASE + 198) +#define __NR_getuid32 (__NR_SYSCALL_BASE + 199) +#define __NR_getgid32 (__NR_SYSCALL_BASE + 200) +#define __NR_geteuid32 (__NR_SYSCALL_BASE + 201) +#define __NR_getegid32 (__NR_SYSCALL_BASE + 202) +#define __NR_setreuid32 (__NR_SYSCALL_BASE + 203) +#define __NR_setregid32 (__NR_SYSCALL_BASE + 204) +#define __NR_getgroups32 (__NR_SYSCALL_BASE + 205) +#define __NR_setgroups32 (__NR_SYSCALL_BASE + 206) +#define __NR_fchown32 (__NR_SYSCALL_BASE + 207) +#define __NR_setresuid32 (__NR_SYSCALL_BASE + 208) +#define __NR_getresuid32 (__NR_SYSCALL_BASE + 209) +#define __NR_setresgid32 (__NR_SYSCALL_BASE + 210) +#define __NR_getresgid32 (__NR_SYSCALL_BASE + 211) +#define __NR_chown32 (__NR_SYSCALL_BASE + 212) +#define __NR_setuid32 (__NR_SYSCALL_BASE + 213) +#define __NR_setgid32 (__NR_SYSCALL_BASE + 214) +#define __NR_setfsuid32 (__NR_SYSCALL_BASE + 215) +#define __NR_setfsgid32 (__NR_SYSCALL_BASE + 216) +#define __NR_getdents64 (__NR_SYSCALL_BASE + 217) +#define __NR_pivot_root (__NR_SYSCALL_BASE + 218) +#define __NR_mincore (__NR_SYSCALL_BASE + 219) +#define __NR_madvise (__NR_SYSCALL_BASE + 220) +#define __NR_fcntl64 (__NR_SYSCALL_BASE + 221) +#define __NR_gettid (__NR_SYSCALL_BASE + 224) +#define __NR_readahead (__NR_SYSCALL_BASE + 225) +#define __NR_setxattr (__NR_SYSCALL_BASE + 226) +#define __NR_lsetxattr (__NR_SYSCALL_BASE + 227) +#define __NR_fsetxattr (__NR_SYSCALL_BASE + 228) +#define __NR_getxattr (__NR_SYSCALL_BASE + 229) +#define __NR_lgetxattr (__NR_SYSCALL_BASE + 230) +#define __NR_fgetxattr (__NR_SYSCALL_BASE + 231) +#define __NR_listxattr (__NR_SYSCALL_BASE + 232) +#define __NR_llistxattr (__NR_SYSCALL_BASE + 233) +#define __NR_flistxattr (__NR_SYSCALL_BASE + 234) +#define __NR_removexattr (__NR_SYSCALL_BASE + 235) +#define __NR_lremovexattr (__NR_SYSCALL_BASE + 236) +#define __NR_fremovexattr (__NR_SYSCALL_BASE + 237) +#define __NR_tkill (__NR_SYSCALL_BASE + 238) +#define __NR_sendfile64 (__NR_SYSCALL_BASE + 239) +#define __NR_futex (__NR_SYSCALL_BASE + 240) +#define __NR_sched_setaffinity (__NR_SYSCALL_BASE + 241) +#define __NR_sched_getaffinity (__NR_SYSCALL_BASE + 242) +#define __NR_io_setup (__NR_SYSCALL_BASE + 243) +#define __NR_io_destroy (__NR_SYSCALL_BASE + 244) +#define __NR_io_getevents (__NR_SYSCALL_BASE + 245) +#define __NR_io_submit (__NR_SYSCALL_BASE + 246) +#define __NR_io_cancel (__NR_SYSCALL_BASE + 247) +#define __NR_exit_group (__NR_SYSCALL_BASE + 248) +#define __NR_lookup_dcookie (__NR_SYSCALL_BASE + 249) +#define __NR_epoll_create (__NR_SYSCALL_BASE + 250) +#define __NR_epoll_ctl (__NR_SYSCALL_BASE + 251) +#define __NR_epoll_wait (__NR_SYSCALL_BASE + 252) +#define __NR_remap_file_pages (__NR_SYSCALL_BASE + 253) +#define __NR_set_tid_address (__NR_SYSCALL_BASE + 256) +#define __NR_timer_create (__NR_SYSCALL_BASE + 257) +#define __NR_timer_settime (__NR_SYSCALL_BASE + 258) +#define __NR_timer_gettime (__NR_SYSCALL_BASE + 259) +#define __NR_timer_getoverrun (__NR_SYSCALL_BASE + 260) +#define __NR_timer_delete (__NR_SYSCALL_BASE + 261) +#define __NR_clock_settime (__NR_SYSCALL_BASE + 262) +#define __NR_clock_gettime (__NR_SYSCALL_BASE + 263) +#define __NR_clock_getres (__NR_SYSCALL_BASE + 264) +#define __NR_clock_nanosleep (__NR_SYSCALL_BASE + 265) +#define __NR_statfs64 (__NR_SYSCALL_BASE + 266) +#define __NR_fstatfs64 (__NR_SYSCALL_BASE + 267) +#define __NR_tgkill (__NR_SYSCALL_BASE + 268) +#define __NR_utimes (__NR_SYSCALL_BASE + 269) +#define __NR_arm_fadvise64_64 (__NR_SYSCALL_BASE + 270) +#define __NR_pciconfig_iobase (__NR_SYSCALL_BASE + 271) +#define __NR_pciconfig_read (__NR_SYSCALL_BASE + 272) +#define __NR_pciconfig_write (__NR_SYSCALL_BASE + 273) +#define __NR_mq_open (__NR_SYSCALL_BASE + 274) +#define __NR_mq_unlink (__NR_SYSCALL_BASE + 275) +#define __NR_mq_timedsend (__NR_SYSCALL_BASE + 276) +#define __NR_mq_timedreceive (__NR_SYSCALL_BASE + 277) +#define __NR_mq_notify (__NR_SYSCALL_BASE + 278) +#define __NR_mq_getsetattr (__NR_SYSCALL_BASE + 279) +#define __NR_waitid (__NR_SYSCALL_BASE + 280) +#define __NR_socket (__NR_SYSCALL_BASE + 281) +#define __NR_bind (__NR_SYSCALL_BASE + 282) +#define __NR_connect (__NR_SYSCALL_BASE + 283) +#define __NR_listen (__NR_SYSCALL_BASE + 284) +#define __NR_accept (__NR_SYSCALL_BASE + 285) +#define __NR_getsockname (__NR_SYSCALL_BASE + 286) +#define __NR_getpeername (__NR_SYSCALL_BASE + 287) +#define __NR_socketpair (__NR_SYSCALL_BASE + 288) +#define __NR_send (__NR_SYSCALL_BASE + 289) +#define __NR_sendto (__NR_SYSCALL_BASE + 290) +#define __NR_recv (__NR_SYSCALL_BASE + 291) +#define __NR_recvfrom (__NR_SYSCALL_BASE + 292) +#define __NR_shutdown (__NR_SYSCALL_BASE + 293) +#define __NR_setsockopt (__NR_SYSCALL_BASE + 294) +#define __NR_getsockopt (__NR_SYSCALL_BASE + 295) +#define __NR_sendmsg (__NR_SYSCALL_BASE + 296) +#define __NR_recvmsg (__NR_SYSCALL_BASE + 297) +#define __NR_semop (__NR_SYSCALL_BASE + 298) +#define __NR_semget (__NR_SYSCALL_BASE + 299) +#define __NR_semctl (__NR_SYSCALL_BASE + 300) +#define __NR_msgsnd (__NR_SYSCALL_BASE + 301) +#define __NR_msgrcv (__NR_SYSCALL_BASE + 302) +#define __NR_msgget (__NR_SYSCALL_BASE + 303) +#define __NR_msgctl (__NR_SYSCALL_BASE + 304) +#define __NR_shmat (__NR_SYSCALL_BASE + 305) +#define __NR_shmdt (__NR_SYSCALL_BASE + 306) +#define __NR_shmget (__NR_SYSCALL_BASE + 307) +#define __NR_shmctl (__NR_SYSCALL_BASE + 308) +#define __NR_add_key (__NR_SYSCALL_BASE + 309) +#define __NR_request_key (__NR_SYSCALL_BASE + 310) +#define __NR_keyctl (__NR_SYSCALL_BASE + 311) +#define __NR_semtimedop (__NR_SYSCALL_BASE + 312) +#define __NR_vserver (__NR_SYSCALL_BASE + 313) +#define __NR_ioprio_set (__NR_SYSCALL_BASE + 314) +#define __NR_ioprio_get (__NR_SYSCALL_BASE + 315) +#define __NR_inotify_init (__NR_SYSCALL_BASE + 316) +#define __NR_inotify_add_watch (__NR_SYSCALL_BASE + 317) +#define __NR_inotify_rm_watch (__NR_SYSCALL_BASE + 318) +#define __NR_mbind (__NR_SYSCALL_BASE + 319) +#define __NR_get_mempolicy (__NR_SYSCALL_BASE + 320) +#define __NR_set_mempolicy (__NR_SYSCALL_BASE + 321) +#define __NR_openat (__NR_SYSCALL_BASE + 322) +#define __NR_mkdirat (__NR_SYSCALL_BASE + 323) +#define __NR_mknodat (__NR_SYSCALL_BASE + 324) +#define __NR_fchownat (__NR_SYSCALL_BASE + 325) +#define __NR_futimesat (__NR_SYSCALL_BASE + 326) +#define __NR_fstatat64 (__NR_SYSCALL_BASE + 327) +#define __NR_unlinkat (__NR_SYSCALL_BASE + 328) +#define __NR_renameat (__NR_SYSCALL_BASE + 329) +#define __NR_linkat (__NR_SYSCALL_BASE + 330) +#define __NR_symlinkat (__NR_SYSCALL_BASE + 331) +#define __NR_readlinkat (__NR_SYSCALL_BASE + 332) +#define __NR_fchmodat (__NR_SYSCALL_BASE + 333) +#define __NR_faccessat (__NR_SYSCALL_BASE + 334) +#define __NR_pselect6 (__NR_SYSCALL_BASE + 335) +#define __NR_ppoll (__NR_SYSCALL_BASE + 336) +#define __NR_unshare (__NR_SYSCALL_BASE + 337) +#define __NR_set_robust_list (__NR_SYSCALL_BASE + 338) +#define __NR_get_robust_list (__NR_SYSCALL_BASE + 339) +#define __NR_splice (__NR_SYSCALL_BASE + 340) +#define __NR_arm_sync_file_range (__NR_SYSCALL_BASE + 341) +#define __NR_tee (__NR_SYSCALL_BASE + 342) +#define __NR_vmsplice (__NR_SYSCALL_BASE + 343) +#define __NR_move_pages (__NR_SYSCALL_BASE + 344) +#define __NR_getcpu (__NR_SYSCALL_BASE + 345) +#define __NR_epoll_pwait (__NR_SYSCALL_BASE + 346) +#define __NR_kexec_load (__NR_SYSCALL_BASE + 347) +#define __NR_utimensat (__NR_SYSCALL_BASE + 348) +#define __NR_signalfd (__NR_SYSCALL_BASE + 349) +#define __NR_timerfd_create (__NR_SYSCALL_BASE + 350) +#define __NR_eventfd (__NR_SYSCALL_BASE + 351) +#define __NR_fallocate (__NR_SYSCALL_BASE + 352) +#define __NR_timerfd_settime (__NR_SYSCALL_BASE + 353) +#define __NR_timerfd_gettime (__NR_SYSCALL_BASE + 354) +#define __NR_signalfd4 (__NR_SYSCALL_BASE + 355) +#define __NR_eventfd2 (__NR_SYSCALL_BASE + 356) +#define __NR_epoll_create1 (__NR_SYSCALL_BASE + 357) +#define __NR_dup3 (__NR_SYSCALL_BASE + 358) +#define __NR_pipe2 (__NR_SYSCALL_BASE + 359) +#define __NR_inotify_init1 (__NR_SYSCALL_BASE + 360) +#define __NR_preadv (__NR_SYSCALL_BASE + 361) +#define __NR_pwritev (__NR_SYSCALL_BASE + 362) +#define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE + 363) +#define __NR_perf_event_open (__NR_SYSCALL_BASE + 364) +#define __NR_recvmmsg (__NR_SYSCALL_BASE + 365) +#define __NR_accept4 (__NR_SYSCALL_BASE + 366) +#define __NR_fanotify_init (__NR_SYSCALL_BASE + 367) +#define __NR_fanotify_mark (__NR_SYSCALL_BASE + 368) +#define __NR_prlimit64 (__NR_SYSCALL_BASE + 369) +#define __NR_name_to_handle_at (__NR_SYSCALL_BASE + 370) +#define __NR_open_by_handle_at (__NR_SYSCALL_BASE + 371) +#define __NR_clock_adjtime (__NR_SYSCALL_BASE + 372) +#define __NR_syncfs (__NR_SYSCALL_BASE + 373) +#define __NR_sendmmsg (__NR_SYSCALL_BASE + 374) +#define __NR_setns (__NR_SYSCALL_BASE + 375) +#define __NR_process_vm_readv (__NR_SYSCALL_BASE + 376) +#define __NR_process_vm_writev (__NR_SYSCALL_BASE + 377) +#define __NR_kcmp (__NR_SYSCALL_BASE + 378) +#define __NR_finit_module (__NR_SYSCALL_BASE + 379) +#define __NR_sched_setattr (__NR_SYSCALL_BASE + 380) +#define __NR_sched_getattr (__NR_SYSCALL_BASE + 381) +#define __NR_renameat2 (__NR_SYSCALL_BASE + 382) +#define __NR_seccomp (__NR_SYSCALL_BASE + 383) +#define __NR_getrandom (__NR_SYSCALL_BASE + 384) +#define __NR_memfd_create (__NR_SYSCALL_BASE + 385) +#define __NR_bpf (__NR_SYSCALL_BASE + 386) +#define __NR_execveat (__NR_SYSCALL_BASE + 387) +#define __NR_userfaultfd (__NR_SYSCALL_BASE + 388) +#define __NR_membarrier (__NR_SYSCALL_BASE + 389) +#define __NR_mlock2 (__NR_SYSCALL_BASE + 390) +#define __NR_copy_file_range (__NR_SYSCALL_BASE + 391) +#define __NR_preadv2 (__NR_SYSCALL_BASE + 392) +#define __NR_pwritev2 (__NR_SYSCALL_BASE + 393) +#define __NR_pkey_mprotect (__NR_SYSCALL_BASE + 394) +#define __NR_pkey_alloc (__NR_SYSCALL_BASE + 395) +#define __NR_pkey_free (__NR_SYSCALL_BASE + 396) + +#endif /* _ASM_ARM_UNISTD_COMMON_H */ diff --git a/linux-headers/asm-arm/unistd-eabi.h b/linux-headers/asm-arm/un= istd-eabi.h new file mode 100644 index 0000000..266f1fc --- /dev/null +++ b/linux-headers/asm-arm/unistd-eabi.h @@ -0,0 +1,5 @@ +#ifndef _ASM_ARM_UNISTD_EABI_H +#define _ASM_ARM_UNISTD_EABI_H 1 + + +#endif /* _ASM_ARM_UNISTD_EABI_H */ diff --git a/linux-headers/asm-arm/unistd-oabi.h b/linux-headers/asm-arm/un= istd-oabi.h new file mode 100644 index 0000000..47d9afb --- /dev/null +++ b/linux-headers/asm-arm/unistd-oabi.h @@ -0,0 +1,17 @@ +#ifndef _ASM_ARM_UNISTD_OABI_H +#define _ASM_ARM_UNISTD_OABI_H 1 + +#define __NR_time (__NR_SYSCALL_BASE + 13) +#define __NR_umount (__NR_SYSCALL_BASE + 22) +#define __NR_stime (__NR_SYSCALL_BASE + 25) +#define __NR_alarm (__NR_SYSCALL_BASE + 27) +#define __NR_utime (__NR_SYSCALL_BASE + 30) +#define __NR_getrlimit (__NR_SYSCALL_BASE + 76) +#define __NR_select (__NR_SYSCALL_BASE + 82) +#define __NR_readdir (__NR_SYSCALL_BASE + 89) +#define __NR_mmap (__NR_SYSCALL_BASE + 90) +#define __NR_socketcall (__NR_SYSCALL_BASE + 102) +#define __NR_syscall (__NR_SYSCALL_BASE + 113) +#define __NR_ipc (__NR_SYSCALL_BASE + 117) + +#endif /* _ASM_ARM_UNISTD_OABI_H */ diff --git a/linux-headers/asm-arm/unistd.h b/linux-headers/asm-arm/unistd.h index ceb5450..155571b 100644 --- a/linux-headers/asm-arm/unistd.h +++ b/linux-headers/asm-arm/unistd.h @@ -17,409 +17,14 @@ =20 #if defined(__thumb__) || defined(__ARM_EABI__) #define __NR_SYSCALL_BASE 0 +#include #else #define __NR_SYSCALL_BASE __NR_OABI_SYSCALL_BASE +#include #endif =20 -/* - * This file contains the system call numbers. - */ - -#define __NR_restart_syscall (__NR_SYSCALL_BASE+ 0) -#define __NR_exit (__NR_SYSCALL_BASE+ 1) -#define __NR_fork (__NR_SYSCALL_BASE+ 2) -#define __NR_read (__NR_SYSCALL_BASE+ 3) -#define __NR_write (__NR_SYSCALL_BASE+ 4) -#define __NR_open (__NR_SYSCALL_BASE+ 5) -#define __NR_close (__NR_SYSCALL_BASE+ 6) - /* 7 was sys_waitpid */ -#define __NR_creat (__NR_SYSCALL_BASE+ 8) -#define __NR_link (__NR_SYSCALL_BASE+ 9) -#define __NR_unlink (__NR_SYSCALL_BASE+ 10) -#define __NR_execve (__NR_SYSCALL_BASE+ 11) -#define __NR_chdir (__NR_SYSCALL_BASE+ 12) -#define __NR_time (__NR_SYSCALL_BASE+ 13) -#define __NR_mknod (__NR_SYSCALL_BASE+ 14) -#define __NR_chmod (__NR_SYSCALL_BASE+ 15) -#define __NR_lchown (__NR_SYSCALL_BASE+ 16) - /* 17 was sys_break */ - /* 18 was sys_stat */ -#define __NR_lseek (__NR_SYSCALL_BASE+ 19) -#define __NR_getpid (__NR_SYSCALL_BASE+ 20) -#define __NR_mount (__NR_SYSCALL_BASE+ 21) -#define __NR_umount (__NR_SYSCALL_BASE+ 22) -#define __NR_setuid (__NR_SYSCALL_BASE+ 23) -#define __NR_getuid (__NR_SYSCALL_BASE+ 24) -#define __NR_stime (__NR_SYSCALL_BASE+ 25) -#define __NR_ptrace (__NR_SYSCALL_BASE+ 26) -#define __NR_alarm (__NR_SYSCALL_BASE+ 27) - /* 28 was sys_fstat */ -#define __NR_pause (__NR_SYSCALL_BASE+ 29) -#define __NR_utime (__NR_SYSCALL_BASE+ 30) - /* 31 was sys_stty */ - /* 32 was sys_gtty */ -#define __NR_access (__NR_SYSCALL_BASE+ 33) -#define __NR_nice (__NR_SYSCALL_BASE+ 34) - /* 35 was sys_ftime */ -#define __NR_sync (__NR_SYSCALL_BASE+ 36) -#define __NR_kill (__NR_SYSCALL_BASE+ 37) -#define __NR_rename (__NR_SYSCALL_BASE+ 38) -#define __NR_mkdir (__NR_SYSCALL_BASE+ 39) -#define __NR_rmdir (__NR_SYSCALL_BASE+ 40) -#define __NR_dup (__NR_SYSCALL_BASE+ 41) -#define __NR_pipe (__NR_SYSCALL_BASE+ 42) -#define __NR_times (__NR_SYSCALL_BASE+ 43) - /* 44 was sys_prof */ -#define __NR_brk (__NR_SYSCALL_BASE+ 45) -#define __NR_setgid (__NR_SYSCALL_BASE+ 46) -#define __NR_getgid (__NR_SYSCALL_BASE+ 47) - /* 48 was sys_signal */ -#define __NR_geteuid (__NR_SYSCALL_BASE+ 49) -#define __NR_getegid (__NR_SYSCALL_BASE+ 50) -#define __NR_acct (__NR_SYSCALL_BASE+ 51) -#define __NR_umount2 (__NR_SYSCALL_BASE+ 52) - /* 53 was sys_lock */ -#define __NR_ioctl (__NR_SYSCALL_BASE+ 54) -#define __NR_fcntl (__NR_SYSCALL_BASE+ 55) - /* 56 was sys_mpx */ -#define __NR_setpgid (__NR_SYSCALL_BASE+ 57) - /* 58 was sys_ulimit */ - /* 59 was sys_olduname */ -#define __NR_umask (__NR_SYSCALL_BASE+ 60) -#define __NR_chroot (__NR_SYSCALL_BASE+ 61) -#define __NR_ustat (__NR_SYSCALL_BASE+ 62) -#define __NR_dup2 (__NR_SYSCALL_BASE+ 63) -#define __NR_getppid (__NR_SYSCALL_BASE+ 64) -#define __NR_getpgrp (__NR_SYSCALL_BASE+ 65) -#define __NR_setsid (__NR_SYSCALL_BASE+ 66) -#define __NR_sigaction (__NR_SYSCALL_BASE+ 67) - /* 68 was sys_sgetmask */ - /* 69 was sys_ssetmask */ -#define __NR_setreuid (__NR_SYSCALL_BASE+ 70) -#define __NR_setregid (__NR_SYSCALL_BASE+ 71) -#define __NR_sigsuspend (__NR_SYSCALL_BASE+ 72) -#define __NR_sigpending (__NR_SYSCALL_BASE+ 73) -#define __NR_sethostname (__NR_SYSCALL_BASE+ 74) -#define __NR_setrlimit (__NR_SYSCALL_BASE+ 75) -#define __NR_getrlimit (__NR_SYSCALL_BASE+ 76) /* Back compat 2GB limite= d rlimit */ -#define __NR_getrusage (__NR_SYSCALL_BASE+ 77) -#define __NR_gettimeofday (__NR_SYSCALL_BASE+ 78) -#define __NR_settimeofday (__NR_SYSCALL_BASE+ 79) -#define __NR_getgroups (__NR_SYSCALL_BASE+ 80) -#define __NR_setgroups (__NR_SYSCALL_BASE+ 81) -#define __NR_select (__NR_SYSCALL_BASE+ 82) -#define __NR_symlink (__NR_SYSCALL_BASE+ 83) - /* 84 was sys_lstat */ -#define __NR_readlink (__NR_SYSCALL_BASE+ 85) -#define __NR_uselib (__NR_SYSCALL_BASE+ 86) -#define __NR_swapon (__NR_SYSCALL_BASE+ 87) -#define __NR_reboot (__NR_SYSCALL_BASE+ 88) -#define __NR_readdir (__NR_SYSCALL_BASE+ 89) -#define __NR_mmap (__NR_SYSCALL_BASE+ 90) -#define __NR_munmap (__NR_SYSCALL_BASE+ 91) -#define __NR_truncate (__NR_SYSCALL_BASE+ 92) -#define __NR_ftruncate (__NR_SYSCALL_BASE+ 93) -#define __NR_fchmod (__NR_SYSCALL_BASE+ 94) -#define __NR_fchown (__NR_SYSCALL_BASE+ 95) -#define __NR_getpriority (__NR_SYSCALL_BASE+ 96) -#define __NR_setpriority (__NR_SYSCALL_BASE+ 97) - /* 98 was sys_profil */ -#define __NR_statfs (__NR_SYSCALL_BASE+ 99) -#define __NR_fstatfs (__NR_SYSCALL_BASE+100) - /* 101 was sys_ioperm */ -#define __NR_socketcall (__NR_SYSCALL_BASE+102) -#define __NR_syslog (__NR_SYSCALL_BASE+103) -#define __NR_setitimer (__NR_SYSCALL_BASE+104) -#define __NR_getitimer (__NR_SYSCALL_BASE+105) -#define __NR_stat (__NR_SYSCALL_BASE+106) -#define __NR_lstat (__NR_SYSCALL_BASE+107) -#define __NR_fstat (__NR_SYSCALL_BASE+108) - /* 109 was sys_uname */ - /* 110 was sys_iopl */ -#define __NR_vhangup (__NR_SYSCALL_BASE+111) - /* 112 was sys_idle */ -#define __NR_syscall (__NR_SYSCALL_BASE+113) /* syscall to call a syscal= l! */ -#define __NR_wait4 (__NR_SYSCALL_BASE+114) -#define __NR_swapoff (__NR_SYSCALL_BASE+115) -#define __NR_sysinfo (__NR_SYSCALL_BASE+116) -#define __NR_ipc (__NR_SYSCALL_BASE+117) -#define __NR_fsync (__NR_SYSCALL_BASE+118) -#define __NR_sigreturn (__NR_SYSCALL_BASE+119) -#define __NR_clone (__NR_SYSCALL_BASE+120) -#define __NR_setdomainname (__NR_SYSCALL_BASE+121) -#define __NR_uname (__NR_SYSCALL_BASE+122) - /* 123 was sys_modify_ldt */ -#define __NR_adjtimex (__NR_SYSCALL_BASE+124) -#define __NR_mprotect (__NR_SYSCALL_BASE+125) -#define __NR_sigprocmask (__NR_SYSCALL_BASE+126) - /* 127 was sys_create_module */ -#define __NR_init_module (__NR_SYSCALL_BASE+128) -#define __NR_delete_module (__NR_SYSCALL_BASE+129) - /* 130 was sys_get_kernel_syms */ -#define __NR_quotactl (__NR_SYSCALL_BASE+131) -#define __NR_getpgid (__NR_SYSCALL_BASE+132) -#define __NR_fchdir (__NR_SYSCALL_BASE+133) -#define __NR_bdflush (__NR_SYSCALL_BASE+134) -#define __NR_sysfs (__NR_SYSCALL_BASE+135) -#define __NR_personality (__NR_SYSCALL_BASE+136) - /* 137 was sys_afs_syscall */ -#define __NR_setfsuid (__NR_SYSCALL_BASE+138) -#define __NR_setfsgid (__NR_SYSCALL_BASE+139) -#define __NR__llseek (__NR_SYSCALL_BASE+140) -#define __NR_getdents (__NR_SYSCALL_BASE+141) -#define __NR__newselect (__NR_SYSCALL_BASE+142) -#define __NR_flock (__NR_SYSCALL_BASE+143) -#define __NR_msync (__NR_SYSCALL_BASE+144) -#define __NR_readv (__NR_SYSCALL_BASE+145) -#define __NR_writev (__NR_SYSCALL_BASE+146) -#define __NR_getsid (__NR_SYSCALL_BASE+147) -#define __NR_fdatasync (__NR_SYSCALL_BASE+148) -#define __NR__sysctl (__NR_SYSCALL_BASE+149) -#define __NR_mlock (__NR_SYSCALL_BASE+150) -#define __NR_munlock (__NR_SYSCALL_BASE+151) -#define __NR_mlockall (__NR_SYSCALL_BASE+152) -#define __NR_munlockall (__NR_SYSCALL_BASE+153) -#define __NR_sched_setparam (__NR_SYSCALL_BASE+154) -#define __NR_sched_getparam (__NR_SYSCALL_BASE+155) -#define __NR_sched_setscheduler (__NR_SYSCALL_BASE+156) -#define __NR_sched_getscheduler (__NR_SYSCALL_BASE+157) -#define __NR_sched_yield (__NR_SYSCALL_BASE+158) -#define __NR_sched_get_priority_max (__NR_SYSCALL_BASE+159) -#define __NR_sched_get_priority_min (__NR_SYSCALL_BASE+160) -#define __NR_sched_rr_get_interval (__NR_SYSCALL_BASE+161) -#define __NR_nanosleep (__NR_SYSCALL_BASE+162) -#define __NR_mremap (__NR_SYSCALL_BASE+163) -#define __NR_setresuid (__NR_SYSCALL_BASE+164) -#define __NR_getresuid (__NR_SYSCALL_BASE+165) - /* 166 was sys_vm86 */ - /* 167 was sys_query_module */ -#define __NR_poll (__NR_SYSCALL_BASE+168) -#define __NR_nfsservctl (__NR_SYSCALL_BASE+169) -#define __NR_setresgid (__NR_SYSCALL_BASE+170) -#define __NR_getresgid (__NR_SYSCALL_BASE+171) -#define __NR_prctl (__NR_SYSCALL_BASE+172) -#define __NR_rt_sigreturn (__NR_SYSCALL_BASE+173) -#define __NR_rt_sigaction (__NR_SYSCALL_BASE+174) -#define __NR_rt_sigprocmask (__NR_SYSCALL_BASE+175) -#define __NR_rt_sigpending (__NR_SYSCALL_BASE+176) -#define __NR_rt_sigtimedwait (__NR_SYSCALL_BASE+177) -#define __NR_rt_sigqueueinfo (__NR_SYSCALL_BASE+178) -#define __NR_rt_sigsuspend (__NR_SYSCALL_BASE+179) -#define __NR_pread64 (__NR_SYSCALL_BASE+180) -#define __NR_pwrite64 (__NR_SYSCALL_BASE+181) -#define __NR_chown (__NR_SYSCALL_BASE+182) -#define __NR_getcwd (__NR_SYSCALL_BASE+183) -#define __NR_capget (__NR_SYSCALL_BASE+184) -#define __NR_capset (__NR_SYSCALL_BASE+185) -#define __NR_sigaltstack (__NR_SYSCALL_BASE+186) -#define __NR_sendfile (__NR_SYSCALL_BASE+187) - /* 188 reserved */ - /* 189 reserved */ -#define __NR_vfork (__NR_SYSCALL_BASE+190) -#define __NR_ugetrlimit (__NR_SYSCALL_BASE+191) /* SuS compliant getrlim= it */ -#define __NR_mmap2 (__NR_SYSCALL_BASE+192) -#define __NR_truncate64 (__NR_SYSCALL_BASE+193) -#define __NR_ftruncate64 (__NR_SYSCALL_BASE+194) -#define __NR_stat64 (__NR_SYSCALL_BASE+195) -#define __NR_lstat64 (__NR_SYSCALL_BASE+196) -#define __NR_fstat64 (__NR_SYSCALL_BASE+197) -#define __NR_lchown32 (__NR_SYSCALL_BASE+198) -#define __NR_getuid32 (__NR_SYSCALL_BASE+199) -#define __NR_getgid32 (__NR_SYSCALL_BASE+200) -#define __NR_geteuid32 (__NR_SYSCALL_BASE+201) -#define __NR_getegid32 (__NR_SYSCALL_BASE+202) -#define __NR_setreuid32 (__NR_SYSCALL_BASE+203) -#define __NR_setregid32 (__NR_SYSCALL_BASE+204) -#define __NR_getgroups32 (__NR_SYSCALL_BASE+205) -#define __NR_setgroups32 (__NR_SYSCALL_BASE+206) -#define __NR_fchown32 (__NR_SYSCALL_BASE+207) -#define __NR_setresuid32 (__NR_SYSCALL_BASE+208) -#define __NR_getresuid32 (__NR_SYSCALL_BASE+209) -#define __NR_setresgid32 (__NR_SYSCALL_BASE+210) -#define __NR_getresgid32 (__NR_SYSCALL_BASE+211) -#define __NR_chown32 (__NR_SYSCALL_BASE+212) -#define __NR_setuid32 (__NR_SYSCALL_BASE+213) -#define __NR_setgid32 (__NR_SYSCALL_BASE+214) -#define __NR_setfsuid32 (__NR_SYSCALL_BASE+215) -#define __NR_setfsgid32 (__NR_SYSCALL_BASE+216) -#define __NR_getdents64 (__NR_SYSCALL_BASE+217) -#define __NR_pivot_root (__NR_SYSCALL_BASE+218) -#define __NR_mincore (__NR_SYSCALL_BASE+219) -#define __NR_madvise (__NR_SYSCALL_BASE+220) -#define __NR_fcntl64 (__NR_SYSCALL_BASE+221) - /* 222 for tux */ - /* 223 is unused */ -#define __NR_gettid (__NR_SYSCALL_BASE+224) -#define __NR_readahead (__NR_SYSCALL_BASE+225) -#define __NR_setxattr (__NR_SYSCALL_BASE+226) -#define __NR_lsetxattr (__NR_SYSCALL_BASE+227) -#define __NR_fsetxattr (__NR_SYSCALL_BASE+228) -#define __NR_getxattr (__NR_SYSCALL_BASE+229) -#define __NR_lgetxattr (__NR_SYSCALL_BASE+230) -#define __NR_fgetxattr (__NR_SYSCALL_BASE+231) -#define __NR_listxattr (__NR_SYSCALL_BASE+232) -#define __NR_llistxattr (__NR_SYSCALL_BASE+233) -#define __NR_flistxattr (__NR_SYSCALL_BASE+234) -#define __NR_removexattr (__NR_SYSCALL_BASE+235) -#define __NR_lremovexattr (__NR_SYSCALL_BASE+236) -#define __NR_fremovexattr (__NR_SYSCALL_BASE+237) -#define __NR_tkill (__NR_SYSCALL_BASE+238) -#define __NR_sendfile64 (__NR_SYSCALL_BASE+239) -#define __NR_futex (__NR_SYSCALL_BASE+240) -#define __NR_sched_setaffinity (__NR_SYSCALL_BASE+241) -#define __NR_sched_getaffinity (__NR_SYSCALL_BASE+242) -#define __NR_io_setup (__NR_SYSCALL_BASE+243) -#define __NR_io_destroy (__NR_SYSCALL_BASE+244) -#define __NR_io_getevents (__NR_SYSCALL_BASE+245) -#define __NR_io_submit (__NR_SYSCALL_BASE+246) -#define __NR_io_cancel (__NR_SYSCALL_BASE+247) -#define __NR_exit_group (__NR_SYSCALL_BASE+248) -#define __NR_lookup_dcookie (__NR_SYSCALL_BASE+249) -#define __NR_epoll_create (__NR_SYSCALL_BASE+250) -#define __NR_epoll_ctl (__NR_SYSCALL_BASE+251) -#define __NR_epoll_wait (__NR_SYSCALL_BASE+252) -#define __NR_remap_file_pages (__NR_SYSCALL_BASE+253) - /* 254 for set_thread_area */ - /* 255 for get_thread_area */ -#define __NR_set_tid_address (__NR_SYSCALL_BASE+256) -#define __NR_timer_create (__NR_SYSCALL_BASE+257) -#define __NR_timer_settime (__NR_SYSCALL_BASE+258) -#define __NR_timer_gettime (__NR_SYSCALL_BASE+259) -#define __NR_timer_getoverrun (__NR_SYSCALL_BASE+260) -#define __NR_timer_delete (__NR_SYSCALL_BASE+261) -#define __NR_clock_settime (__NR_SYSCALL_BASE+262) -#define __NR_clock_gettime (__NR_SYSCALL_BASE+263) -#define __NR_clock_getres (__NR_SYSCALL_BASE+264) -#define __NR_clock_nanosleep (__NR_SYSCALL_BASE+265) -#define __NR_statfs64 (__NR_SYSCALL_BASE+266) -#define __NR_fstatfs64 (__NR_SYSCALL_BASE+267) -#define __NR_tgkill (__NR_SYSCALL_BASE+268) -#define __NR_utimes (__NR_SYSCALL_BASE+269) -#define __NR_arm_fadvise64_64 (__NR_SYSCALL_BASE+270) -#define __NR_pciconfig_iobase (__NR_SYSCALL_BASE+271) -#define __NR_pciconfig_read (__NR_SYSCALL_BASE+272) -#define __NR_pciconfig_write (__NR_SYSCALL_BASE+273) -#define __NR_mq_open (__NR_SYSCALL_BASE+274) -#define __NR_mq_unlink (__NR_SYSCALL_BASE+275) -#define __NR_mq_timedsend (__NR_SYSCALL_BASE+276) -#define __NR_mq_timedreceive (__NR_SYSCALL_BASE+277) -#define __NR_mq_notify (__NR_SYSCALL_BASE+278) -#define __NR_mq_getsetattr (__NR_SYSCALL_BASE+279) -#define __NR_waitid (__NR_SYSCALL_BASE+280) -#define __NR_socket (__NR_SYSCALL_BASE+281) -#define __NR_bind (__NR_SYSCALL_BASE+282) -#define __NR_connect (__NR_SYSCALL_BASE+283) -#define __NR_listen (__NR_SYSCALL_BASE+284) -#define __NR_accept (__NR_SYSCALL_BASE+285) -#define __NR_getsockname (__NR_SYSCALL_BASE+286) -#define __NR_getpeername (__NR_SYSCALL_BASE+287) -#define __NR_socketpair (__NR_SYSCALL_BASE+288) -#define __NR_send (__NR_SYSCALL_BASE+289) -#define __NR_sendto (__NR_SYSCALL_BASE+290) -#define __NR_recv (__NR_SYSCALL_BASE+291) -#define __NR_recvfrom (__NR_SYSCALL_BASE+292) -#define __NR_shutdown (__NR_SYSCALL_BASE+293) -#define __NR_setsockopt (__NR_SYSCALL_BASE+294) -#define __NR_getsockopt (__NR_SYSCALL_BASE+295) -#define __NR_sendmsg (__NR_SYSCALL_BASE+296) -#define __NR_recvmsg (__NR_SYSCALL_BASE+297) -#define __NR_semop (__NR_SYSCALL_BASE+298) -#define __NR_semget (__NR_SYSCALL_BASE+299) -#define __NR_semctl (__NR_SYSCALL_BASE+300) -#define __NR_msgsnd (__NR_SYSCALL_BASE+301) -#define __NR_msgrcv (__NR_SYSCALL_BASE+302) -#define __NR_msgget (__NR_SYSCALL_BASE+303) -#define __NR_msgctl (__NR_SYSCALL_BASE+304) -#define __NR_shmat (__NR_SYSCALL_BASE+305) -#define __NR_shmdt (__NR_SYSCALL_BASE+306) -#define __NR_shmget (__NR_SYSCALL_BASE+307) -#define __NR_shmctl (__NR_SYSCALL_BASE+308) -#define __NR_add_key (__NR_SYSCALL_BASE+309) -#define __NR_request_key (__NR_SYSCALL_BASE+310) -#define __NR_keyctl (__NR_SYSCALL_BASE+311) -#define __NR_semtimedop (__NR_SYSCALL_BASE+312) -#define __NR_vserver (__NR_SYSCALL_BASE+313) -#define __NR_ioprio_set (__NR_SYSCALL_BASE+314) -#define __NR_ioprio_get (__NR_SYSCALL_BASE+315) -#define __NR_inotify_init (__NR_SYSCALL_BASE+316) -#define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317) -#define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318) -#define __NR_mbind (__NR_SYSCALL_BASE+319) -#define __NR_get_mempolicy (__NR_SYSCALL_BASE+320) -#define __NR_set_mempolicy (__NR_SYSCALL_BASE+321) -#define __NR_openat (__NR_SYSCALL_BASE+322) -#define __NR_mkdirat (__NR_SYSCALL_BASE+323) -#define __NR_mknodat (__NR_SYSCALL_BASE+324) -#define __NR_fchownat (__NR_SYSCALL_BASE+325) -#define __NR_futimesat (__NR_SYSCALL_BASE+326) -#define __NR_fstatat64 (__NR_SYSCALL_BASE+327) -#define __NR_unlinkat (__NR_SYSCALL_BASE+328) -#define __NR_renameat (__NR_SYSCALL_BASE+329) -#define __NR_linkat (__NR_SYSCALL_BASE+330) -#define __NR_symlinkat (__NR_SYSCALL_BASE+331) -#define __NR_readlinkat (__NR_SYSCALL_BASE+332) -#define __NR_fchmodat (__NR_SYSCALL_BASE+333) -#define __NR_faccessat (__NR_SYSCALL_BASE+334) -#define __NR_pselect6 (__NR_SYSCALL_BASE+335) -#define __NR_ppoll (__NR_SYSCALL_BASE+336) -#define __NR_unshare (__NR_SYSCALL_BASE+337) -#define __NR_set_robust_list (__NR_SYSCALL_BASE+338) -#define __NR_get_robust_list (__NR_SYSCALL_BASE+339) -#define __NR_splice (__NR_SYSCALL_BASE+340) -#define __NR_arm_sync_file_range (__NR_SYSCALL_BASE+341) +#include #define __NR_sync_file_range2 __NR_arm_sync_file_range -#define __NR_tee (__NR_SYSCALL_BASE+342) -#define __NR_vmsplice (__NR_SYSCALL_BASE+343) -#define __NR_move_pages (__NR_SYSCALL_BASE+344) -#define __NR_getcpu (__NR_SYSCALL_BASE+345) -#define __NR_epoll_pwait (__NR_SYSCALL_BASE+346) -#define __NR_kexec_load (__NR_SYSCALL_BASE+347) -#define __NR_utimensat (__NR_SYSCALL_BASE+348) -#define __NR_signalfd (__NR_SYSCALL_BASE+349) -#define __NR_timerfd_create (__NR_SYSCALL_BASE+350) -#define __NR_eventfd (__NR_SYSCALL_BASE+351) -#define __NR_fallocate (__NR_SYSCALL_BASE+352) -#define __NR_timerfd_settime (__NR_SYSCALL_BASE+353) -#define __NR_timerfd_gettime (__NR_SYSCALL_BASE+354) -#define __NR_signalfd4 (__NR_SYSCALL_BASE+355) -#define __NR_eventfd2 (__NR_SYSCALL_BASE+356) -#define __NR_epoll_create1 (__NR_SYSCALL_BASE+357) -#define __NR_dup3 (__NR_SYSCALL_BASE+358) -#define __NR_pipe2 (__NR_SYSCALL_BASE+359) -#define __NR_inotify_init1 (__NR_SYSCALL_BASE+360) -#define __NR_preadv (__NR_SYSCALL_BASE+361) -#define __NR_pwritev (__NR_SYSCALL_BASE+362) -#define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363) -#define __NR_perf_event_open (__NR_SYSCALL_BASE+364) -#define __NR_recvmmsg (__NR_SYSCALL_BASE+365) -#define __NR_accept4 (__NR_SYSCALL_BASE+366) -#define __NR_fanotify_init (__NR_SYSCALL_BASE+367) -#define __NR_fanotify_mark (__NR_SYSCALL_BASE+368) -#define __NR_prlimit64 (__NR_SYSCALL_BASE+369) -#define __NR_name_to_handle_at (__NR_SYSCALL_BASE+370) -#define __NR_open_by_handle_at (__NR_SYSCALL_BASE+371) -#define __NR_clock_adjtime (__NR_SYSCALL_BASE+372) -#define __NR_syncfs (__NR_SYSCALL_BASE+373) -#define __NR_sendmmsg (__NR_SYSCALL_BASE+374) -#define __NR_setns (__NR_SYSCALL_BASE+375) -#define __NR_process_vm_readv (__NR_SYSCALL_BASE+376) -#define __NR_process_vm_writev (__NR_SYSCALL_BASE+377) -#define __NR_kcmp (__NR_SYSCALL_BASE+378) -#define __NR_finit_module (__NR_SYSCALL_BASE+379) -#define __NR_sched_setattr (__NR_SYSCALL_BASE+380) -#define __NR_sched_getattr (__NR_SYSCALL_BASE+381) -#define __NR_renameat2 (__NR_SYSCALL_BASE+382) -#define __NR_seccomp (__NR_SYSCALL_BASE+383) -#define __NR_getrandom (__NR_SYSCALL_BASE+384) -#define __NR_memfd_create (__NR_SYSCALL_BASE+385) -#define __NR_bpf (__NR_SYSCALL_BASE+386) -#define __NR_execveat (__NR_SYSCALL_BASE+387) -#define __NR_userfaultfd (__NR_SYSCALL_BASE+388) -#define __NR_membarrier (__NR_SYSCALL_BASE+389) -#define __NR_mlock2 (__NR_SYSCALL_BASE+390) -#define __NR_copy_file_range (__NR_SYSCALL_BASE+391) -#define __NR_preadv2 (__NR_SYSCALL_BASE+392) -#define __NR_pwritev2 (__NR_SYSCALL_BASE+393) =20 /* * The following SWIs are ARM private. @@ -431,22 +36,4 @@ #define __ARM_NR_usr32 (__ARM_NR_BASE+4) #define __ARM_NR_set_tls (__ARM_NR_BASE+5) =20 -/* - * The following syscalls are obsolete and no longer available for EABI. - */ -#if defined(__ARM_EABI__) -#undef __NR_time -#undef __NR_umount -#undef __NR_stime -#undef __NR_alarm -#undef __NR_utime -#undef __NR_getrlimit -#undef __NR_select -#undef __NR_readdir -#undef __NR_mmap -#undef __NR_socketcall -#undef __NR_syscall -#undef __NR_ipc -#endif - #endif /* __ASM_ARM_UNISTD_H */ diff --git a/linux-headers/asm-arm64/kvm.h b/linux-headers/asm-arm64/kvm.h index fd5a276..651ec30 100644 --- a/linux-headers/asm-arm64/kvm.h +++ b/linux-headers/asm-arm64/kvm.h @@ -201,10 +201,23 @@ struct kvm_arch_memory_slot { #define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2 #define KVM_DEV_ARM_VGIC_CPUID_SHIFT 32 #define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_S= HIFT) +#define KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT 32 +#define KVM_DEV_ARM_VGIC_V3_MPIDR_MASK \ + (0xffffffffULL << KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT) #define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0 #define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_= OFFSET_SHIFT) +#define KVM_DEV_ARM_VGIC_SYSREG_INSTR_MASK (0xffff) #define KVM_DEV_ARM_VGIC_GRP_NR_IRQS 3 #define KVM_DEV_ARM_VGIC_GRP_CTRL 4 +#define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5 +#define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6 +#define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO 7 +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10 +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \ + (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT) +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff +#define VGIC_LEVEL_INFO_LINE_LEVEL 0 + #define KVM_DEV_ARM_VGIC_CTRL_INIT 0 =20 /* Device Control API on vcpu fd */ diff --git a/linux-headers/asm-powerpc/kvm.h b/linux-headers/asm-powerpc/kv= m.h index c93cf35..4edbe4b 100644 --- a/linux-headers/asm-powerpc/kvm.h +++ b/linux-headers/asm-powerpc/kvm.h @@ -413,6 +413,26 @@ struct kvm_get_htab_header { __u16 n_invalid; }; =20 +/* For KVM_PPC_CONFIGURE_V3_MMU */ +struct kvm_ppc_mmuv3_cfg { + __u64 flags; + __u64 process_table; /* second doubleword of partition table entry */ +}; + +/* Flag values for KVM_PPC_CONFIGURE_V3_MMU */ +#define KVM_PPC_MMUV3_RADIX 1 /* 1 =3D radix mode, 0 =3D HPT */ +#define KVM_PPC_MMUV3_GTSE 2 /* global translation shootdown enb. */ + +/* For KVM_PPC_GET_RMMU_INFO */ +struct kvm_ppc_rmmu_info { + struct kvm_ppc_radix_geom { + __u8 page_shift; + __u8 level_bits[4]; + __u8 pad[3]; + } geometries[8]; + __u32 ap_encodings[8]; +}; + /* Per-vcpu XICS interrupt controller state */ #define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c) =20 @@ -573,6 +593,10 @@ struct kvm_get_htab_header { #define KVM_REG_PPC_SPRG9 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xba) #define KVM_REG_PPC_DBSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbb) =20 +/* POWER9 registers */ +#define KVM_REG_PPC_TIDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbc) +#define KVM_REG_PPC_PSSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbd) + /* Transactional Memory checkpointed state: * This is all GPRs, all VSX regs and a subset of SPRs */ @@ -596,6 +620,7 @@ struct kvm_get_htab_header { #define KVM_REG_PPC_TM_VSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U32 | 0x67) #define KVM_REG_PPC_TM_DSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x68) #define KVM_REG_PPC_TM_TAR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x69) +#define KVM_REG_PPC_TM_XER (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x6a) =20 /* PPC64 eXternal Interrupt Controller Specification */ #define KVM_DEV_XICS_GRP_SOURCES 1 /* 64-bit source attributes */ @@ -608,5 +633,7 @@ struct kvm_get_htab_header { #define KVM_XICS_LEVEL_SENSITIVE (1ULL << 40) #define KVM_XICS_MASKED (1ULL << 41) #define KVM_XICS_PENDING (1ULL << 42) +#define KVM_XICS_PRESENTED (1ULL << 43) +#define KVM_XICS_QUEUED (1ULL << 44) =20 #endif /* __LINUX_KVM_POWERPC_H */ diff --git a/linux-headers/asm-powerpc/unistd.h b/linux-headers/asm-powerpc= /unistd.h index 1e66eba..598043c 100644 --- a/linux-headers/asm-powerpc/unistd.h +++ b/linux-headers/asm-powerpc/unistd.h @@ -392,5 +392,6 @@ #define __NR_copy_file_range 379 #define __NR_preadv2 380 #define __NR_pwritev2 381 +#define __NR_kexec_file_load 382 =20 #endif /* _ASM_POWERPC_UNISTD_H_ */ diff --git a/linux-headers/asm-x86/kvm_para.h b/linux-headers/asm-x86/kvm_p= ara.h index e41c5c1..3a53979 100644 --- a/linux-headers/asm-x86/kvm_para.h +++ b/linux-headers/asm-x86/kvm_para.h @@ -45,7 +45,18 @@ struct kvm_steal_time { __u64 steal; __u32 version; __u32 flags; - __u32 pad[12]; + __u8 preempted; + __u8 u8_pad[3]; + __u32 pad[11]; +}; + +#define KVM_CLOCK_PAIRING_WALLCLOCK 0 +struct kvm_clock_pairing { + __s64 sec; + __s64 nsec; + __u64 tsc; + __u32 flags; + __u32 pad[9]; }; =20 #define KVM_STEAL_ALIGNMENT_BITS 5 diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index bb0ed71..4e082a8 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -218,7 +218,8 @@ struct kvm_hyperv_exit { struct kvm_run { /* in */ __u8 request_interrupt_window; - __u8 padding1[7]; + __u8 immediate_exit; + __u8 padding1[6]; =20 /* out */ __u32 exit_reason; @@ -651,6 +652,9 @@ struct kvm_enable_cap { }; =20 /* for KVM_PPC_GET_PVINFO */ + +#define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0) + struct kvm_ppc_pvinfo { /* out */ __u32 flags; @@ -682,7 +686,12 @@ struct kvm_ppc_smmu_info { struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ]; }; =20 -#define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0) +/* for KVM_PPC_RESIZE_HPT_{PREPARE,COMMIT} */ +struct kvm_ppc_resize_hpt { + __u64 flags; + __u32 shift; + __u32 pad; +}; =20 #define KVMIO 0xAE =20 @@ -870,6 +879,10 @@ struct kvm_ppc_smmu_info { #define KVM_CAP_S390_USER_INSTR0 130 #define KVM_CAP_MSI_DEVID 131 #define KVM_CAP_PPC_HTM 132 +#define KVM_CAP_SPAPR_RESIZE_HPT 133 +#define KVM_CAP_PPC_MMU_RADIX 134 +#define KVM_CAP_PPC_MMU_HASH_V3 135 +#define KVM_CAP_IMMEDIATE_EXIT 136 =20 #ifdef KVM_CAP_IRQ_ROUTING =20 @@ -1186,6 +1199,13 @@ struct kvm_s390_ucas_mapping { #define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device= _addr) /* Available with KVM_CAP_PPC_RTAS */ #define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO, 0xac, struct kvm_rtas_token= _args) +/* Available with KVM_CAP_SPAPR_RESIZE_HPT */ +#define KVM_PPC_RESIZE_HPT_PREPARE _IOR(KVMIO, 0xad, struct kvm_ppc_resize= _hpt) +#define KVM_PPC_RESIZE_HPT_COMMIT _IOR(KVMIO, 0xae, struct kvm_ppc_resize= _hpt) +/* Available with KVM_CAP_PPC_RADIX_MMU or KVM_CAP_PPC_HASH_MMU_V3 */ +#define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_= cfg) +/* Available with KVM_CAP_PPC_RADIX_MMU */ +#define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_inf= o) =20 /* ioctl for vm fd */ #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device) diff --git a/linux-headers/linux/kvm_para.h b/linux-headers/linux/kvm_para.h index e61661e..15b24ff 100644 --- a/linux-headers/linux/kvm_para.h +++ b/linux-headers/linux/kvm_para.h @@ -14,6 +14,7 @@ #define KVM_EFAULT EFAULT #define KVM_E2BIG E2BIG #define KVM_EPERM EPERM +#define KVM_EOPNOTSUPP 95 =20 #define KVM_HC_VAPIC_POLL_IRQ 1 #define KVM_HC_MMU_OP 2 @@ -23,6 +24,7 @@ #define KVM_HC_MIPS_GET_CLOCK_FREQ 6 #define KVM_HC_MIPS_EXIT_VM 7 #define KVM_HC_MIPS_CONSOLE_OUTPUT 8 +#define KVM_HC_CLOCK_PAIRING 9 =20 /* * hypercalls use architecture specific diff --git a/linux-headers/linux/userfaultfd.h b/linux-headers/linux/userfa= ultfd.h index 19e8453..2ed5dc3 100644 --- a/linux-headers/linux/userfaultfd.h +++ b/linux-headers/linux/userfaultfd.h @@ -11,13 +11,18 @@ =20 #include =20 -#define UFFD_API ((__u64)0xAA) /* - * After implementing the respective features it will become: - * #define UFFD_API_FEATURES (UFFD_FEATURE_PAGEFAULT_FLAG_WP | \ - * UFFD_FEATURE_EVENT_FORK) + * If the UFFDIO_API is upgraded someday, the UFFDIO_UNREGISTER and + * UFFDIO_WAKE ioctls should be defined as _IOW and not as _IOR. In + * userfaultfd.h we assumed the kernel was reading (instead _IOC_READ + * means the userland is reading). */ -#define UFFD_API_FEATURES (0) +#define UFFD_API ((__u64)0xAA) +#define UFFD_API_FEATURES (UFFD_FEATURE_EVENT_FORK | \ + UFFD_FEATURE_EVENT_REMAP | \ + UFFD_FEATURE_EVENT_MADVDONTNEED | \ + UFFD_FEATURE_MISSING_HUGETLBFS | \ + UFFD_FEATURE_MISSING_SHMEM) #define UFFD_API_IOCTLS \ ((__u64)1 << _UFFDIO_REGISTER | \ (__u64)1 << _UFFDIO_UNREGISTER | \ @@ -26,6 +31,9 @@ ((__u64)1 << _UFFDIO_WAKE | \ (__u64)1 << _UFFDIO_COPY | \ (__u64)1 << _UFFDIO_ZEROPAGE) +#define UFFD_API_RANGE_IOCTLS_BASIC \ + ((__u64)1 << _UFFDIO_WAKE | \ + (__u64)1 << _UFFDIO_COPY) =20 /* * Valid ioctl command number range with this API is from 0x00 to @@ -72,6 +80,21 @@ struct uffd_msg { } pagefault; =20 struct { + __u32 ufd; + } fork; + + struct { + __u64 from; + __u64 to; + __u64 len; + } remap; + + struct { + __u64 start; + __u64 end; + } madv_dn; + + struct { /* unused reserved fields */ __u64 reserved1; __u64 reserved2; @@ -84,9 +107,9 @@ struct uffd_msg { * Start at 0x12 and not at 0 to be more strict against bugs. */ #define UFFD_EVENT_PAGEFAULT 0x12 -#if 0 /* not available yet */ #define UFFD_EVENT_FORK 0x13 -#endif +#define UFFD_EVENT_REMAP 0x14 +#define UFFD_EVENT_MADVDONTNEED 0x15 =20 /* flags for UFFD_EVENT_PAGEFAULT */ #define UFFD_PAGEFAULT_FLAG_WRITE (1<<0) /* If this was a write fault */ @@ -104,11 +127,37 @@ struct uffdio_api { * Note: UFFD_EVENT_PAGEFAULT and UFFD_PAGEFAULT_FLAG_WRITE * are to be considered implicitly always enabled in all kernels as * long as the uffdio_api.api requested matches UFFD_API. + * + * UFFD_FEATURE_MISSING_HUGETLBFS means an UFFDIO_REGISTER + * with UFFDIO_REGISTER_MODE_MISSING mode will succeed on + * hugetlbfs virtual memory ranges. Adding or not adding + * UFFD_FEATURE_MISSING_HUGETLBFS to uffdio_api.features has + * no real functional effect after UFFDIO_API returns, but + * it's only useful for an initial feature set probe at + * UFFDIO_API time. There are two ways to use it: + * + * 1) by adding UFFD_FEATURE_MISSING_HUGETLBFS to the + * uffdio_api.features before calling UFFDIO_API, an error + * will be returned by UFFDIO_API on a kernel without + * hugetlbfs missing support + * + * 2) the UFFD_FEATURE_MISSING_HUGETLBFS can not be added in + * uffdio_api.features and instead it will be set by the + * kernel in the uffdio_api.features if the kernel supports + * it, so userland can later check if the feature flag is + * present in uffdio_api.features after UFFDIO_API + * succeeded. + * + * UFFD_FEATURE_MISSING_SHMEM works the same as + * UFFD_FEATURE_MISSING_HUGETLBFS, but it applies to shmem + * (i.e. tmpfs and other shmem based APIs). */ -#if 0 /* not available yet */ #define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0) #define UFFD_FEATURE_EVENT_FORK (1<<1) -#endif +#define UFFD_FEATURE_EVENT_REMAP (1<<2) +#define UFFD_FEATURE_EVENT_MADVDONTNEED (1<<3) +#define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4) +#define UFFD_FEATURE_MISSING_SHMEM (1<<5) __u64 features; =20 __u64 ioctls; diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h index 759b850..531cb2e 100644 --- a/linux-headers/linux/vfio.h +++ b/linux-headers/linux/vfio.h @@ -203,6 +203,16 @@ struct vfio_device_info { }; #define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7) =20 +/* + * Vendor driver using Mediated device framework should provide device_api + * attribute in supported type attribute groups. Device API string should = be one + * of the following corresponding to device flags in vfio_device_info stru= cture. + */ + +#define VFIO_DEVICE_API_PCI_STRING "vfio-pci" +#define VFIO_DEVICE_API_PLATFORM_STRING "vfio-platform" +#define VFIO_DEVICE_API_AMBA_STRING "vfio-amba" + /** * VFIO_DEVICE_GET_REGION_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 8, * struct vfio_region_info) --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487959490285467.0217717277966; Fri, 24 Feb 2017 10:04:50 -0800 (PST) Received: from localhost ([::1]:39020 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chKEY-0000Ix-Ln for importer@patchew.org; Fri, 24 Feb 2017 13:04:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrI-0007uT-21 for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrG-0002GT-Mi for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:44 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:35399) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrG-0002GH-Ck for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:42 -0500 Received: by mail-wr0-x241.google.com with SMTP id q39so3111817wrb.2 for ; Fri, 24 Feb 2017 09:40:42 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=C6/Im1/2WEL3JCSdqPJJ4NEt4+Uj60Xz+asQUaproPM=; b=TkRRLrdvZMr5kFCC9gw+Ow+7k7vU0MikLLjlyJCRHs9SmYgo3Ef6Fw5LXt5dyAWXts 7p8QfAkmRxaz9NknG5hL7G35Z0CzKWFucjBoa2OWgTMtIFUpoPNi5281J0kQea4mdFZh uFokNtdthO3+PFrWUCO0/y9BxxpDYsO6WC/FPAAsTO9QG2iESnE/27kRjXYaIh9W4VWr OC9OZlnrVOc8hZ9iR1isjygyT9TEz5qoRgwF6jIdb8+f6BcvPsw/iJk89TMUOHwRwajp D/tU7YAtZkKr1CqL0O4l38rwDDA/dO7qFnWRLOE3ax1RrKxPodsuTSUK6RNIJ/S3ycBM YUHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=C6/Im1/2WEL3JCSdqPJJ4NEt4+Uj60Xz+asQUaproPM=; b=ZrsbiSPJbBb/k7/djklm9eAAaZ5NUpow163s0R3CzsMXsx8uh7ZAur2pYkTmOIPRfA /xkGtWeD68qZk09eUUCKstvZICVKyExJE/IS8kSttYpAINX4EmAOTeiF287yZv7Cq3fR Py8pyVeGBbnfPZElBoVkQyR9aPzlDuvFytYEQWFQAbCU/TpS1eb18qbzydQnFqO+t/st MLJCoJfUA5a4BqEOJA8NTB27Y1LyZH7yb/hhB7+M7SrvRFXqsthKSmXI01GQV1+CXwTb zhs1hua7dGHudRyLX6rpjtyFQo+jRyeqGH9HkO9fYoxClGD8vCCuwZBGQ/91iacgu7W3 CDXw== X-Gm-Message-State: AMke39lXbq7TsQQmpriiOYQmZybnW2Efk/+omjxU9JsDhaQQ+Y3ZMOPqYtlxJRPQSSL4Tw== X-Received: by 10.223.172.136 with SMTP id o8mr3595936wrc.87.1487958041128; Fri, 24 Feb 2017 09:40:41 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:19 +0100 Message-Id: <1487958030-51417-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 06/17] cpus: remove ugly cast on sigbus_handler X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The cast is there because sigbus_handler is invoked via sigfd_handler. But it feels just wrong to use struct qemu_signalfd_siginfo in the prototype of a function that is passed to sigaction. Instead, do a simple-minded conversion of qemu_signalfd_siginfo to siginfo_t. Signed-off-by: Paolo Bonzini --- cpus.c | 12 +++--------- include/qemu/compatfd.h | 42 ------------------------------------------ include/qemu/osdep.h | 28 ++++++++++++++++++++++++++++ util/compatfd.c | 1 - util/main-loop.c | 5 +---- util/oslib-posix.c | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 65 insertions(+), 56 deletions(-) delete mode 100644 include/qemu/compatfd.h diff --git a/cpus.c b/cpus.c index 0bcb5b5..50cae13 100644 --- a/cpus.c +++ b/cpus.c @@ -49,10 +49,6 @@ #include "hw/nmi.h" #include "sysemu/replay.h" =20 -#ifndef _WIN32 -#include "qemu/compatfd.h" -#endif - #ifdef CONFIG_LINUX =20 #include @@ -794,11 +790,9 @@ static void sigbus_reraise(void) abort(); } =20 -static void sigbus_handler(int n, struct qemu_signalfd_siginfo *siginfo, - void *ctx) +static void sigbus_handler(int n, siginfo_t *siginfo, void *ctx) { - if (kvm_on_sigbus(siginfo->ssi_code, - (void *)(intptr_t)siginfo->ssi_addr)) { + if (kvm_on_sigbus(siginfo->si_code, siginfo->si_addr)) { sigbus_reraise(); } } @@ -809,7 +803,7 @@ static void qemu_init_sigbus(void) =20 memset(&action, 0, sizeof(action)); action.sa_flags =3D SA_SIGINFO; - action.sa_sigaction =3D (void (*)(int, siginfo_t*, void*))sigbus_handl= er; + action.sa_sigaction =3D sigbus_handler; sigaction(SIGBUS, &action, NULL); =20 prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0); diff --git a/include/qemu/compatfd.h b/include/qemu/compatfd.h deleted file mode 100644 index aa12ee9..0000000 --- a/include/qemu/compatfd.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * signalfd/eventfd compatibility - * - * Copyright IBM, Corp. 2008 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - */ - -#ifndef QEMU_COMPATFD_H -#define QEMU_COMPATFD_H - - -struct qemu_signalfd_siginfo { - uint32_t ssi_signo; /* Signal number */ - int32_t ssi_errno; /* Error number (unused) */ - int32_t ssi_code; /* Signal code */ - uint32_t ssi_pid; /* PID of sender */ - uint32_t ssi_uid; /* Real UID of sender */ - int32_t ssi_fd; /* File descriptor (SIGIO) */ - uint32_t ssi_tid; /* Kernel timer ID (POSIX timers) */ - uint32_t ssi_band; /* Band event (SIGIO) */ - uint32_t ssi_overrun; /* POSIX timer overrun count */ - uint32_t ssi_trapno; /* Trap number that caused signal */ - int32_t ssi_status; /* Exit status or signal (SIGCHLD) */ - int32_t ssi_int; /* Integer sent by sigqueue(2) */ - uint64_t ssi_ptr; /* Pointer sent by sigqueue(2) */ - uint64_t ssi_utime; /* User CPU time consumed (SIGCHLD) */ - uint64_t ssi_stime; /* System CPU time consumed (SIGCHLD) */ - uint64_t ssi_addr; /* Address that generated signal - (for hardware-generated signals) */ - uint8_t pad[48]; /* Pad size to 128 bytes (allow for - additional fields in the future) */ -}; - -int qemu_signalfd(const sigset_t *mask); - -#endif diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 56c9e22..6932709 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -297,6 +297,34 @@ void qemu_anon_ram_free(void *ptr, size_t size); # define QEMU_VMALLOC_ALIGN getpagesize() #endif =20 +#ifdef CONFIG_POSIX +struct qemu_signalfd_siginfo { + uint32_t ssi_signo; /* Signal number */ + int32_t ssi_errno; /* Error number (unused) */ + int32_t ssi_code; /* Signal code */ + uint32_t ssi_pid; /* PID of sender */ + uint32_t ssi_uid; /* Real UID of sender */ + int32_t ssi_fd; /* File descriptor (SIGIO) */ + uint32_t ssi_tid; /* Kernel timer ID (POSIX timers) */ + uint32_t ssi_band; /* Band event (SIGIO) */ + uint32_t ssi_overrun; /* POSIX timer overrun count */ + uint32_t ssi_trapno; /* Trap number that caused signal */ + int32_t ssi_status; /* Exit status or signal (SIGCHLD) */ + int32_t ssi_int; /* Integer sent by sigqueue(2) */ + uint64_t ssi_ptr; /* Pointer sent by sigqueue(2) */ + uint64_t ssi_utime; /* User CPU time consumed (SIGCHLD) */ + uint64_t ssi_stime; /* System CPU time consumed (SIGCHLD) */ + uint64_t ssi_addr; /* Address that generated signal + (for hardware-generated signals) */ + uint8_t pad[48]; /* Pad size to 128 bytes (allow for + additional fields in the future) */ +}; + +int qemu_signalfd(const sigset_t *mask); +void sigaction_invoke(struct sigaction *action, + struct qemu_signalfd_siginfo *info); +#endif + int qemu_madvise(void *addr, size_t len, int advice); =20 int qemu_open(const char *name, int flags, ...); diff --git a/util/compatfd.c b/util/compatfd.c index 9a43042..980bd33 100644 --- a/util/compatfd.c +++ b/util/compatfd.c @@ -15,7 +15,6 @@ =20 #include "qemu/osdep.h" #include "qemu-common.h" -#include "qemu/compatfd.h" #include "qemu/thread.h" =20 #include diff --git a/util/main-loop.c b/util/main-loop.c index ad10bca..ca7bb07 100644 --- a/util/main-loop.c +++ b/util/main-loop.c @@ -34,8 +34,6 @@ =20 #ifndef _WIN32 =20 -#include "qemu/compatfd.h" - /* If we have signalfd, we mask out the signals we want to handle and then * use signalfd to listen for them. We rely on whatever the current signal * handler is to dispatch the signals when we receive them. @@ -63,8 +61,7 @@ static void sigfd_handler(void *opaque) =20 sigaction(info.ssi_signo, NULL, &action); if ((action.sa_flags & SA_SIGINFO) && action.sa_sigaction) { - action.sa_sigaction(info.ssi_signo, - (siginfo_t *)&info, NULL); + sigaction_invoke(&action, &info); } else if (action.sa_handler) { action.sa_handler(info.ssi_signo); } diff --git a/util/oslib-posix.c b/util/oslib-posix.c index f631464..3d29cf6 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -603,3 +603,36 @@ void qemu_free_stack(void *stack, size_t sz) =20 munmap(stack, sz); } + +void sigaction_invoke(struct sigaction *action, + struct qemu_signalfd_siginfo *info) +{ + siginfo_t si =3D { 0 }; + si.si_signo =3D info->ssi_signo; + si.si_errno =3D info->ssi_errno; + si.si_code =3D info->ssi_code; + + /* Convert the minimal set of fields defined by POSIX. + * Positive si_code values are reserved for kernel-generated + * signals, where the valid siginfo fields are determined by + * the signal number. But according to POSIX, it is unspecified + * whether SI_USER and SI_QUEUE have values less than or equal to + * zero. + */ + if (info->ssi_code =3D=3D SI_USER || info->ssi_code =3D=3D SI_QUEUE || + info->ssi_code <=3D 0) { + /* SIGTERM, etc. */ + si.si_pid =3D info->ssi_pid; + si.si_uid =3D info->ssi_uid; + } else if (info->ssi_signo =3D=3D SIGILL || info->ssi_signo =3D=3D SIG= FPE || + info->ssi_signo =3D=3D SIGSEGV || info->ssi_signo =3D=3D SI= GBUS) { + si.si_addr =3D (void *)(uintptr_t)info->ssi_addr; + } else if (info->ssi_signo =3D=3D SIGCHLD) { + si.si_pid =3D info->ssi_pid; + si.si_status =3D info->ssi_status; + si.si_uid =3D info->ssi_uid; + } else if (info->ssi_signo =3D=3D SIGPOLL) { + si.si_band =3D info->ssi_band; + } + action->sa_sigaction(info->ssi_signo, &si, NULL); +} --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487959268219186.90497190300357; Fri, 24 Feb 2017 10:01:08 -0800 (PST) Received: from localhost ([::1]:39000 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chKB0-0005bH-TK for importer@patchew.org; Fri, 24 Feb 2017 13:01:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36301) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrJ-0007vR-5F for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrH-0002Gu-MC for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:45 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:32802) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrH-0002Gf-F3 for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:43 -0500 Received: by mail-wr0-x242.google.com with SMTP id g10so2805036wrg.0 for ; Fri, 24 Feb 2017 09:40:43 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=oX/buaOcVLZZekiBuJB43zKw9GGtxx9nLPtjnMhu9Ds=; b=quVcj/6ScYpFvT3KtGaaXmC2EzgQZ76ImjcNv9YWlvuvlEk/lYv16W5hQl4cjDNi90 O+2Icc4177PrKd5CR4LPKXnJbOCSVJINSmFJTxwtbvM8Y9HLtScBKuARepvGIXbF3UmF iFVLcq5gTUDwmwd+5s7xXTfUYuNlxIWd5qFDuw+gBBzwaqtZJDlJmuWlSqllQRC2wQuA 7bemGlVAQC3oinNW7RY9fXYByDEvAhty8hVfAz6X7ZLmOxHUavn6qhLT/Gl8W+6ndb2B +9S+goEBERTvoOn1B/Llhn8ciKz1deIyX1/B3xrNEMnkegafqQyp99ZoHOGZ3/491qzR ZNAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=oX/buaOcVLZZekiBuJB43zKw9GGtxx9nLPtjnMhu9Ds=; b=aMBaYUl9BUMY04n59FN0k0hURQrcGuXw65aezARrU2A8FiWh6XRCoQweNsy/shU9iX gmq1AsXUmoCILtzDSssTYgkuGxceHM8zIrwG94u6/0YQuhLEpqUqgfhi1ewbHG/5X1yk wnNx+bDHwIU90+Hir9/UgVp26/RZfu0yTE/2reCaBLGvMkLDBZusjPCPpIhTh7FY2zsv 4hJu/EnjNVUIRrkbGw878Aw3QT/Jo8FOktLbh4HlNz7oAe2SvK4b3G6cpLvYARJwT1x4 JCLEvqU7AvSfdTYFWx9x6piafYaRGMvoq6Q0foc9ASr72G4A12X/V5lLp95iHTb8Uxy5 lKvw== X-Gm-Message-State: AMke39k4ztRBBrcIzkICPFcvs195GE/7Ly6A4dvu59Cjwxi4dusqxTggAqEORHiLZvlmMA== X-Received: by 10.223.163.75 with SMTP id d11mr3530147wrb.74.1487958042174; Fri, 24 Feb 2017 09:40:42 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:20 +0100 Message-Id: <1487958030-51417-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 07/17] KVM: x86: cleanup SIGBUS handlers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch should have no semantic change. Signed-off-by: Paolo Bonzini --- target/i386/kvm.c | 81 ++++++++++++++++++++++++++++-----------------------= ---- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 27fd050..0c48dfd 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -469,31 +469,34 @@ int kvm_arch_on_sigbus_vcpu(CPUState *c, int code, vo= id *addr) ram_addr_t ram_addr; hwaddr paddr; =20 - if ((env->mcg_cap & MCG_SER_P) && addr - && (code =3D=3D BUS_MCEERR_AR || code =3D=3D BUS_MCEERR_AO)) { + if (code !=3D BUS_MCEERR_AR && code !=3D BUS_MCEERR_AO) { + return 1; + } + + /* Because the MCE happened while running the VCPU, KVM could have + * injected action required MCEs too. Action optional MCEs should + * be delivered to the main thread, which qemu_init_sigbus identifies + * as the "early kill" thread, but if we get one for whatever reason + * we just handle it just like the main thread would. + */ + if ((env->mcg_cap & MCG_SER_P) && addr) { ram_addr =3D qemu_ram_addr_from_host(addr); - if (ram_addr =3D=3D RAM_ADDR_INVALID || - !kvm_physical_memory_addr_from_host(c->kvm_state, addr, &paddr= )) { - fprintf(stderr, "Hardware memory error for memory used by " - "QEMU itself instead of guest system!\n"); - /* Hope we are lucky for AO MCE */ - if (code =3D=3D BUS_MCEERR_AO) { - return 0; - } else { - hardware_memory_error(); - } - } - kvm_hwpoison_page_add(ram_addr); - kvm_mce_inject(cpu, paddr, code); - } else { - if (code =3D=3D BUS_MCEERR_AO) { + if (ram_addr !=3D RAM_ADDR_INVALID && + kvm_physical_memory_addr_from_host(c->kvm_state, addr, &paddr)= ) { + kvm_hwpoison_page_add(ram_addr); + kvm_mce_inject(cpu, paddr, code); return 0; - } else if (code =3D=3D BUS_MCEERR_AR) { - hardware_memory_error(); - } else { - return 1; } + + fprintf(stderr, "Hardware memory error for memory used by " + "QEMU itself instead of guest system!\n"); + } + + if (code =3D=3D BUS_MCEERR_AR) { + hardware_memory_error(); } + + /* Hope we are lucky for AO MCE */ return 0; } =20 @@ -501,29 +504,29 @@ int kvm_arch_on_sigbus(int code, void *addr) { X86CPU *cpu =3D X86_CPU(first_cpu); =20 - if ((cpu->env.mcg_cap & MCG_SER_P) && addr && code =3D=3D BUS_MCEERR_A= O) { + if (code !=3D BUS_MCEERR_AR && code !=3D BUS_MCEERR_AO) { + return 1; + } + + if (code =3D=3D BUS_MCEERR_AR) { + hardware_memory_error(); + } + + /* Hope we are lucky for AO MCE */ + if ((cpu->env.mcg_cap & MCG_SER_P) && addr) { ram_addr_t ram_addr; hwaddr paddr; =20 - /* Hope we are lucky for AO MCE */ ram_addr =3D qemu_ram_addr_from_host(addr); - if (ram_addr =3D=3D RAM_ADDR_INVALID || - !kvm_physical_memory_addr_from_host(first_cpu->kvm_state, - addr, &paddr)) { - fprintf(stderr, "Hardware memory error for memory used by " - "QEMU itself instead of guest system!: %p\n", addr); - return 0; - } - kvm_hwpoison_page_add(ram_addr); - kvm_mce_inject(X86_CPU(first_cpu), paddr, code); - } else { - if (code =3D=3D BUS_MCEERR_AO) { - return 0; - } else if (code =3D=3D BUS_MCEERR_AR) { - hardware_memory_error(); - } else { - return 1; + if (ram_addr !=3D RAM_ADDR_INVALID && + kvm_physical_memory_addr_from_host(first_cpu->kvm_state, + addr, &paddr)) { + kvm_hwpoison_page_add(ram_addr); + kvm_mce_inject(X86_CPU(first_cpu), paddr, code); } + + fprintf(stderr, "Hardware memory error for memory used by " + "QEMU itself instead of guest system!: %p\n", addr); } return 0; } --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487958490678280.9132548129852; Fri, 24 Feb 2017 09:48:10 -0800 (PST) Received: from localhost ([::1]:38925 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJyT-0006YX-7f for importer@patchew.org; Fri, 24 Feb 2017 12:48:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrK-0007wl-9r for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrI-0002HJ-Rv for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:46 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:36859) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrI-0002H0-Iq for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:44 -0500 Received: by mail-wm0-x243.google.com with SMTP id r18so4054220wmd.3 for ; Fri, 24 Feb 2017 09:40:44 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=ansli9O1WAfXnJ3W62R31YqnelYfmVkMFCwaibqg1vw=; b=Av+Uq0c3yOJhOmRm/XhXw4Y39oMe6odCtydP1xhP5y+JOlOCHoeo0uNyaBlomfbQXt iHpGRj5QLQoDvYle5yFu5YuzyV0CJijheAOt7p6xICqEJuKUBEHNZchSKh9ouIpMDye1 nyMZaMAxPd8CWskORYSCxBS0eydv3jgILAcubeiulCXv4Ik9I7QUQyCt8BHNP4Mom4D5 oSqPijCQOAn+4/nu/XaxgVQSFcKebKB9jJk3hi4NgXTBZyTHp5xLgPJB77is3T2pJkcn HsQuhgqTaqkrRzMShT/N12i5mL+jBsoqHujhX2rJOcfWA+spJ1/RyjcD/h6Yyk4bvTHI v4tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=ansli9O1WAfXnJ3W62R31YqnelYfmVkMFCwaibqg1vw=; b=kE2OE2cdS09P86uvNx0tRug6OYoSrYvItfztLpsia1AAq2Pjzs7La/FhWYrE/1zE+9 Tw0Sn6Msf1szmKHNR1p4bvI/VMGQ3NQHl0ByoJ7SL34loYu1IeDf6W+pjub/Erux8Adj v9oQdTvKtFoar5gKd/sqTqIQKV25wq8/XhSkHlUHw+OL9XerdB61nie6Fz1r0TK4061Z 0573Dd5wxvJ4CZOE23YUgdd+A9ja6UZDx5d6hxKx/JFzyjap2CAtbQDIxRlVuHGKvTQ1 efBzBhoBVeg/3DNZhpjiNhFLSeAt37eMtEsczxKMXC3YMmolzyXY/sGO8ud/Zu1I7OTR LirA== X-Gm-Message-State: AMke39mmWTsXiQXHeeOI2hkDejUg6M6KXqGwhy0rCnnYHluWaQA1or4IgWKKWfVh+uSUWA== X-Received: by 10.28.130.212 with SMTP id e203mr3543245wmd.104.1487958043130; Fri, 24 Feb 2017 09:40:43 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:21 +0100 Message-Id: <1487958030-51417-9-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 08/17] cpus: reorganize signal handling code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Move the KVM "eat signals" code under CONFIG_LINUX, in preparation for moving it to kvm-all.c; reraise non-MCE SIGBUS immediately, without passing it to KVM. Signed-off-by: Paolo Bonzini --- cpus.c | 63 ++++++++++++++++++++++++++----------------------= ---- include/qemu/osdep.h | 9 ++++++++ target/i386/kvm.c | 15 ++----------- 3 files changed, 43 insertions(+), 44 deletions(-) diff --git a/cpus.c b/cpus.c index 50cae13..e50284f 100644 --- a/cpus.c +++ b/cpus.c @@ -792,6 +792,10 @@ static void sigbus_reraise(void) =20 static void sigbus_handler(int n, siginfo_t *siginfo, void *ctx) { + if (siginfo->si_code !=3D BUS_MCEERR_AO && siginfo->si_code !=3D BUS_M= CEERR_AR) { + sigbus_reraise(); + } + if (kvm_on_sigbus(siginfo->si_code, siginfo->si_addr)) { sigbus_reraise(); } @@ -809,6 +813,30 @@ static void qemu_init_sigbus(void) prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0); } =20 +static void dummy_signal(int sig) +{ +} + +static void qemu_kvm_init_cpu_signals(CPUState *cpu) +{ + int r; + sigset_t set; + struct sigaction sigact; + + memset(&sigact, 0, sizeof(sigact)); + sigact.sa_handler =3D dummy_signal; + sigaction(SIG_IPI, &sigact, NULL); + + pthread_sigmask(SIG_BLOCK, NULL, &set); + sigdelset(&set, SIG_IPI); + sigdelset(&set, SIGBUS); + r =3D kvm_set_signal_mask(cpu, &set); + if (r) { + fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r)); + exit(1); + } +} + static void qemu_kvm_eat_signals(CPUState *cpu) { struct timespec ts =3D { 0, 0 }; @@ -830,6 +858,9 @@ static void qemu_kvm_eat_signals(CPUState *cpu) =20 switch (r) { case SIGBUS: + if (siginfo.si_code !=3D BUS_MCEERR_AO && siginfo.si_code !=3D= BUS_MCEERR_AR) { + sigbus_reraise(); + } if (kvm_on_sigbus_vcpu(cpu, siginfo.si_code, siginfo.si_addr))= { sigbus_reraise(); } @@ -845,9 +876,7 @@ static void qemu_kvm_eat_signals(CPUState *cpu) } } while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS)= ); } - #else /* !CONFIG_LINUX */ - static void qemu_init_sigbus(void) { } @@ -855,39 +884,11 @@ static void qemu_init_sigbus(void) static void qemu_kvm_eat_signals(CPUState *cpu) { } -#endif /* !CONFIG_LINUX */ - -#ifndef _WIN32 -static void dummy_signal(int sig) -{ -} - -static void qemu_kvm_init_cpu_signals(CPUState *cpu) -{ - int r; - sigset_t set; - struct sigaction sigact; - - memset(&sigact, 0, sizeof(sigact)); - sigact.sa_handler =3D dummy_signal; - sigaction(SIG_IPI, &sigact, NULL); - - pthread_sigmask(SIG_BLOCK, NULL, &set); - sigdelset(&set, SIG_IPI); - sigdelset(&set, SIGBUS); - r =3D kvm_set_signal_mask(cpu, &set); - if (r) { - fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r)); - exit(1); - } -} =20 -#else /* _WIN32 */ static void qemu_kvm_init_cpu_signals(CPUState *cpu) { - abort(); } -#endif /* _WIN32 */ +#endif /* !CONFIG_LINUX */ =20 static QemuMutex qemu_global_mutex; static QemuCond qemu_io_proceeded_cond; diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 6932709..af37195 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -284,6 +284,15 @@ void qemu_anon_ram_free(void *ptr, size_t size); =20 #endif =20 +#if defined(CONFIG_LINUX) +#ifndef BUS_MCEERR_AR +#define BUS_MCEERR_AR 4 +#endif +#ifndef BUS_MCEERR_AO +#define BUS_MCEERR_AO 5 +#endif +#endif + #if defined(__linux__) && \ (defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)) /* Use 2 MiB alignment so transparent hugepages can be used by KVM. diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 0c48dfd..f49a786 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -64,13 +64,6 @@ * 255 kvm_msr_entry structs */ #define MSR_BUF_SIZE 4096 =20 -#ifndef BUS_MCEERR_AR -#define BUS_MCEERR_AR 4 -#endif -#ifndef BUS_MCEERR_AO -#define BUS_MCEERR_AO 5 -#endif - const KVMCapabilityInfo kvm_arch_required_capabilities[] =3D { KVM_CAP_INFO(SET_TSS_ADDR), KVM_CAP_INFO(EXT_CPUID), @@ -469,9 +462,7 @@ int kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void= *addr) ram_addr_t ram_addr; hwaddr paddr; =20 - if (code !=3D BUS_MCEERR_AR && code !=3D BUS_MCEERR_AO) { - return 1; - } + assert(code =3D=3D BUS_MCEERR_AR || code =3D=3D BUS_MCEERR_AO); =20 /* Because the MCE happened while running the VCPU, KVM could have * injected action required MCEs too. Action optional MCEs should @@ -504,9 +495,7 @@ int kvm_arch_on_sigbus(int code, void *addr) { X86CPU *cpu =3D X86_CPU(first_cpu); =20 - if (code !=3D BUS_MCEERR_AR && code !=3D BUS_MCEERR_AO) { - return 1; - } + assert(code =3D=3D BUS_MCEERR_AR || code =3D=3D BUS_MCEERR_AO); =20 if (code =3D=3D BUS_MCEERR_AR) { hardware_memory_error(); --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487959555455689.7353025141647; Fri, 24 Feb 2017 10:05:55 -0800 (PST) Received: from localhost ([::1]:39028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chKFc-0001LL-3N for importer@patchew.org; Fri, 24 Feb 2017 13:05:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrL-0007xd-40 for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrJ-0002Hf-Nb for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:47 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:36166) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrJ-0002HH-F8 for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:45 -0500 Received: by mail-wr0-x244.google.com with SMTP id o22so2190749wro.3 for ; Fri, 24 Feb 2017 09:40:45 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=Q7A53AyUw39ic4/yYr/A/qITY0+/SrC7A4JBq7Fj6i8=; b=ZKQ/4lqNlQkTVB7YbjtMVKj949bwfsT0C/O+vITpwqNxuOfxLPicmow6qCkwl/rgJA jvfEqP5VCEqF3RJVVdib60ScETsMIR1m1agn5F6UyHd0zdtyzbhwwynLbtWbtSmscBsk vsFInrVuv1t/muARQFY+zLAY9iCD2GQhYg9/irhirE7VpgUPEoveHK3/nHT+HIH6DnJO vsY76UUgH9lLwoTtwcGmmuZYLX+x2c5wroBU29jxldDPiStPX+rsILEWQSbYtVqwMB2A rCpgg9KgOWRhfH3F2fQoLIm1FS2ILhVuQCiYbLo4IkyalGFUQAA1Ccl0UYX/Ywhmw0nX ev7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=Q7A53AyUw39ic4/yYr/A/qITY0+/SrC7A4JBq7Fj6i8=; b=JQ9T2MK3kWT9LQVEoIwJ4fMGOuNBiw3Q8OK24U1UONgx+glX+GQW3WlL5As10uTMnG fGUjiRc4SjhEelwVqLS1ODdYXlK6ICRFzQbo7cnwKKi1T98m8RK5i2Cux7Myb97Kk25p B5fhLS/56barEE0I+EzArkoGaCl8gMglmkiEfItTysQqGj/+sW54cbWyS7lltaunaIyL Egxyc/OTnDNRn95Fluya6JOmI24YpGdmQ+YA03k26GDRxGNLHbGxo4ipler6yri9WP3g BPgNkdDCM9MTorHLcuOLNoF5k4mpyisB8vNeN8xGyn87uNIysD+ZFqf8F+oDvrF0cfwi jzLA== X-Gm-Message-State: AMke39m9Kms0sfLw2fM/OCnTNcIod1UN2DL5/Nodi3EVdQcOc1U2IO7o81GbXgNO6U8uYg== X-Received: by 10.223.179.78 with SMTP id k14mr4138526wrd.34.1487958044062; Fri, 24 Feb 2017 09:40:44 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:22 +0100 Message-Id: <1487958030-51417-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 09/17] KVM: remove kvm_arch_on_sigbus X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Build it on kvm_arch_on_sigbus_vcpu instead. They do the same for "action optional" SIGBUSes, and the main thread should never get "action required" SIGBUSes because it blocks the signal. Signed-off-by: Paolo Bonzini --- include/sysemu/kvm.h | 1 - kvm-all.c | 9 ++++++++- target/arm/kvm.c | 5 ----- target/i386/kvm.c | 40 +++++----------------------------------- target/mips/kvm.c | 6 ------ target/ppc/kvm.c | 5 ----- target/s390x/kvm.c | 5 ----- 7 files changed, 13 insertions(+), 58 deletions(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 3045ee7..6ecb61c 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -358,7 +358,6 @@ bool kvm_vcpu_id_is_valid(int vcpu_id); unsigned long kvm_arch_vcpu_id(CPUState *cpu); =20 int kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code, void *addr); -int kvm_arch_on_sigbus(int code, void *addr); =20 void kvm_arch_init_irq_routing(KVMState *s); =20 diff --git a/kvm-all.c b/kvm-all.c index 0c94637..a433ad3 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -2391,6 +2391,7 @@ int kvm_set_signal_mask(CPUState *cpu, const sigset_t= *sigset) =20 return r; } + int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr) { return kvm_arch_on_sigbus_vcpu(cpu, code, addr); @@ -2398,7 +2399,13 @@ int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void= *addr) =20 int kvm_on_sigbus(int code, void *addr) { - return kvm_arch_on_sigbus(code, addr); + /* Action required MCE kills the process if SIGBUS is blocked. Because + * that's what happens in the I/O thread, where we handle MCE via sign= alfd, + * we can only get action optional here. + */ + assert(code !=3D BUS_MCEERR_AR); + kvm_arch_on_sigbus_vcpu(first_cpu, code, addr); + return 0; } =20 int kvm_create_device(KVMState *s, uint64_t type, bool test) diff --git a/target/arm/kvm.c b/target/arm/kvm.c index c00b94e..6f2d590 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -564,11 +564,6 @@ int kvm_arch_on_sigbus_vcpu(CPUState *cs, int code, vo= id *addr) return 1; } =20 -int kvm_arch_on_sigbus(int code, void *addr) -{ - return 1; -} - /* The #ifdef protections are until 32bit headers are imported and can * be removed once both 32 and 64 bit reach feature parity. */ diff --git a/target/i386/kvm.c b/target/i386/kvm.c index f49a786..2adf992 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -462,14 +462,13 @@ int kvm_arch_on_sigbus_vcpu(CPUState *c, int code, vo= id *addr) ram_addr_t ram_addr; hwaddr paddr; =20 + /* If we get an action required MCE, it has been injected by KVM + * while the VM was running. An action optional MCE instead should + * be coming from the main thread, which qemu_init_sigbus identifies + * as the "early kill" thread. + */ assert(code =3D=3D BUS_MCEERR_AR || code =3D=3D BUS_MCEERR_AO); =20 - /* Because the MCE happened while running the VCPU, KVM could have - * injected action required MCEs too. Action optional MCEs should - * be delivered to the main thread, which qemu_init_sigbus identifies - * as the "early kill" thread, but if we get one for whatever reason - * we just handle it just like the main thread would. - */ if ((env->mcg_cap & MCG_SER_P) && addr) { ram_addr =3D qemu_ram_addr_from_host(addr); if (ram_addr !=3D RAM_ADDR_INVALID && @@ -491,35 +490,6 @@ int kvm_arch_on_sigbus_vcpu(CPUState *c, int code, voi= d *addr) return 0; } =20 -int kvm_arch_on_sigbus(int code, void *addr) -{ - X86CPU *cpu =3D X86_CPU(first_cpu); - - assert(code =3D=3D BUS_MCEERR_AR || code =3D=3D BUS_MCEERR_AO); - - if (code =3D=3D BUS_MCEERR_AR) { - hardware_memory_error(); - } - - /* Hope we are lucky for AO MCE */ - if ((cpu->env.mcg_cap & MCG_SER_P) && addr) { - ram_addr_t ram_addr; - hwaddr paddr; - - ram_addr =3D qemu_ram_addr_from_host(addr); - if (ram_addr !=3D RAM_ADDR_INVALID && - kvm_physical_memory_addr_from_host(first_cpu->kvm_state, - addr, &paddr)) { - kvm_hwpoison_page_add(ram_addr); - kvm_mce_inject(X86_CPU(first_cpu), paddr, code); - } - - fprintf(stderr, "Hardware memory error for memory used by " - "QEMU itself instead of guest system!: %p\n", addr); - } - return 0; -} - static int kvm_inject_mce_oldstyle(X86CPU *cpu) { CPUX86State *env =3D &cpu->env; diff --git a/target/mips/kvm.c b/target/mips/kvm.c index 998c341..3e686e7 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -186,12 +186,6 @@ int kvm_arch_on_sigbus_vcpu(CPUState *cs, int code, vo= id *addr) return 1; } =20 -int kvm_arch_on_sigbus(int code, void *addr) -{ - DPRINTF("%s\n", __func__); - return 1; -} - void kvm_arch_init_irq_routing(KVMState *s) { } diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 663d2e7..80f2728 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2563,11 +2563,6 @@ int kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code,= void *addr) return 1; } =20 -int kvm_arch_on_sigbus(int code, void *addr) -{ - return 1; -} - void kvm_arch_init_irq_routing(KVMState *s) { } diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 2536780..92cf6d4 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -2108,11 +2108,6 @@ int kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code,= void *addr) return 1; } =20 -int kvm_arch_on_sigbus(int code, void *addr) -{ - return 1; -} - void kvm_s390_io_interrupt(uint16_t subchannel_id, uint16_t subchannel_nr, uint32_t io_int_parm, uint32_t io_int_word) --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487959950552412.12729155417105; Fri, 24 Feb 2017 10:12:30 -0800 (PST) Received: from localhost ([::1]:39092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chKM1-0000Wm-9B for importer@patchew.org; Fri, 24 Feb 2017 13:12:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrO-00081J-Kv for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrK-0002I4-Kl for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:50 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:35678) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrK-0002Hj-BM for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:46 -0500 Received: by mail-wm0-x244.google.com with SMTP id u63so4043295wmu.2 for ; Fri, 24 Feb 2017 09:40:46 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=MPKqWeiiXo9VcrYUSNBi1iRTIeM96BYKgld/nw5wu+o=; b=TfV9P+Z5exxDzrVxm/4LpQRkRQ//vUXmp0e6KR+IR4Fdc+ejKweOUw7kXjmwWgtGCb W7q1KWYRGQo8eIklisg/tW9yh9aNHRtBIofJch4j7CcsvoPUl1eyVqjJZwDaJpCy4EsZ wSU/ofIw0WAl2MZ+4ZCoDG7dGsD1MDY4l3US3kywDt3Q5hvuomTmY+vUD4J0y3zQlr5S 0KlZDgkVRFcl50bG1XXBF1tNvGHcZkXnzS6CxpbBoEzLEgARbj4GaJxmEuif8remKsKW TY1/Qsq1jzgxb+T6f80652NIRmm3Y4h0d7wvNKBxl20L82jAa+EwH8AohIkHraCNCBwD qbQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=MPKqWeiiXo9VcrYUSNBi1iRTIeM96BYKgld/nw5wu+o=; b=tseCQKQf4Ph+MMHzES9mGiFfgBFGBmJJsc85xETtBRl0n5wPUxHTWITNsbgaWR3uYr gMurOFeYhp/p4RSZ11LcW/jKaQ34zHRVqFGIy1+G3yFKpGoDylB2PttoKpQe6X5T04pV ZAhEedyPmGueQJBBYVso9f2WRWsOGxqrfuylbZJH7xp22sj+QihZBSK4ezp8OB3OF/W3 Hog8a92/w4jHAZ8ZxnwDF+fN1BJn9UP7AMO1cxSStKCFMSGggJqSyBtbNcWkOR8d3w4A a0HOz96KElcOYHOQmIlFQG6WiiXkmchJEJEkS148hjk33ECsqVVTGQ0H8Lmox+oZC0zY J00w== X-Gm-Message-State: AMke39nsGMTyOX/isWOo4pHo7/wa4J6073Gy1E8b/8LUpX/yzffoFIQSJ2XGc366QPlFYQ== X-Received: by 10.28.9.13 with SMTP id 13mr3593412wmj.37.1487958045092; Fri, 24 Feb 2017 09:40:45 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:23 +0100 Message-Id: <1487958030-51417-11-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 10/17] KVM: do not use sigtimedwait to catch SIGBUS X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Call kvm_on_sigbus_vcpu asynchronously from the VCPU thread. Information for the SIGBUS can be stored in thread-local variables and processed later in kvm_cpu_exec. Signed-off-by: Paolo Bonzini --- cpus.c | 31 +++++++++++++------------------ include/sysemu/kvm.h | 5 ++++- kvm-all.c | 31 ++++++++++++++++++++++++++++++- target/arm/kvm.c | 5 ----- target/i386/kvm.c | 5 ++--- target/mips/kvm.c | 6 ------ target/ppc/kvm.c | 5 ----- target/s390x/kvm.c | 5 ----- 8 files changed, 49 insertions(+), 44 deletions(-) diff --git a/cpus.c b/cpus.c index e50284f..a2bc916 100644 --- a/cpus.c +++ b/cpus.c @@ -796,8 +796,16 @@ static void sigbus_handler(int n, siginfo_t *siginfo, = void *ctx) sigbus_reraise(); } =20 - if (kvm_on_sigbus(siginfo->si_code, siginfo->si_addr)) { - sigbus_reraise(); + if (current_cpu) { + /* Called asynchronously in VCPU thread. */ + if (kvm_on_sigbus_vcpu(current_cpu, siginfo->si_code, siginfo->si_= addr)) { + sigbus_reraise(); + } + } else { + /* Called synchronously (via signalfd) in main thread. */ + if (kvm_on_sigbus(siginfo->si_code, siginfo->si_addr)) { + sigbus_reraise(); + } } } =20 @@ -828,8 +836,9 @@ static void qemu_kvm_init_cpu_signals(CPUState *cpu) sigaction(SIG_IPI, &sigact, NULL); =20 pthread_sigmask(SIG_BLOCK, NULL, &set); - sigdelset(&set, SIG_IPI); sigdelset(&set, SIGBUS); + pthread_sigmask(SIG_SETMASK, &set, NULL); + sigdelset(&set, SIG_IPI); r =3D kvm_set_signal_mask(cpu, &set); if (r) { fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r)); @@ -847,7 +856,6 @@ static void qemu_kvm_eat_signals(CPUState *cpu) =20 sigemptyset(&waitset); sigaddset(&waitset, SIG_IPI); - sigaddset(&waitset, SIGBUS); =20 do { r =3D sigtimedwait(&waitset, &siginfo, &ts); @@ -856,25 +864,12 @@ static void qemu_kvm_eat_signals(CPUState *cpu) exit(1); } =20 - switch (r) { - case SIGBUS: - if (siginfo.si_code !=3D BUS_MCEERR_AO && siginfo.si_code !=3D= BUS_MCEERR_AR) { - sigbus_reraise(); - } - if (kvm_on_sigbus_vcpu(cpu, siginfo.si_code, siginfo.si_addr))= { - sigbus_reraise(); - } - break; - default: - break; - } - r =3D sigpending(&chkset); if (r =3D=3D -1) { perror("sigpending"); exit(1); } - } while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS)= ); + } while (sigismember(&chkset, SIG_IPI)); } #else /* !CONFIG_LINUX */ static void qemu_init_sigbus(void) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 6ecb61c..a1b019d 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -357,7 +357,10 @@ bool kvm_vcpu_id_is_valid(int vcpu_id); /* Returns VCPU ID to be used on KVM_CREATE_VCPU ioctl() */ unsigned long kvm_arch_vcpu_id(CPUState *cpu); =20 -int kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code, void *addr); +#ifdef TARGET_I386 +#define KVM_HAVE_MCE_INJECTION 1 +void kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code, void *addr); +#endif =20 void kvm_arch_init_irq_routing(KVMState *s); =20 diff --git a/kvm-all.c b/kvm-all.c index a433ad3..d3b0487 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1893,6 +1893,10 @@ void kvm_cpu_synchronize_post_init(CPUState *cpu) run_on_cpu(cpu, do_kvm_cpu_synchronize_post_init, RUN_ON_CPU_NULL); } =20 +static __thread void *pending_sigbus_addr; +static __thread int pending_sigbus_code; +static __thread bool have_sigbus_pending; + int kvm_cpu_exec(CPUState *cpu) { struct kvm_run *run =3D cpu->kvm_run; @@ -1930,6 +1934,14 @@ int kvm_cpu_exec(CPUState *cpu) =20 attrs =3D kvm_arch_post_run(cpu, run); =20 + if (unlikely(have_sigbus_pending)) { + qemu_mutex_lock_iothread(); + kvm_arch_on_sigbus_vcpu(cpu, pending_sigbus_code, + pending_sigbus_addr); + have_sigbus_pending =3D false; + qemu_mutex_unlock_iothread(); + } + if (run_ret < 0) { if (run_ret =3D=3D -EINTR || run_ret =3D=3D -EAGAIN) { DPRINTF("io window exit\n"); @@ -2392,13 +2404,27 @@ int kvm_set_signal_mask(CPUState *cpu, const sigset= _t *sigset) return r; } =20 +/* Called asynchronously in VCPU thread. */ int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr) { - return kvm_arch_on_sigbus_vcpu(cpu, code, addr); +#ifdef KVM_HAVE_MCE_INJECTION + if (have_sigbus_pending) { + return 1; + } + have_sigbus_pending =3D true; + pending_sigbus_addr =3D addr; + pending_sigbus_code =3D code; + atomic_set(&cpu->exit_request, 1); + return 0; +#else + return 1; +#endif } =20 +/* Called synchronously (via signalfd) in main thread. */ int kvm_on_sigbus(int code, void *addr) { +#ifdef KVM_HAVE_MCE_INJECTION /* Action required MCE kills the process if SIGBUS is blocked. Because * that's what happens in the I/O thread, where we handle MCE via sign= alfd, * we can only get action optional here. @@ -2406,6 +2432,9 @@ int kvm_on_sigbus(int code, void *addr) assert(code !=3D BUS_MCEERR_AR); kvm_arch_on_sigbus_vcpu(first_cpu, code, addr); return 0; +#else + return 1; +#endif } =20 int kvm_create_device(KVMState *s, uint64_t type, bool test) diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 6f2d590..c6d0b3a 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -559,11 +559,6 @@ int kvm_arch_process_async_events(CPUState *cs) return 0; } =20 -int kvm_arch_on_sigbus_vcpu(CPUState *cs, int code, void *addr) -{ - return 1; -} - /* The #ifdef protections are until 32bit headers are imported and can * be removed once both 32 and 64 bit reach feature parity. */ diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 2adf992..7698421 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -455,7 +455,7 @@ static void hardware_memory_error(void) exit(1); } =20 -int kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr) +void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr) { X86CPU *cpu =3D X86_CPU(c); CPUX86State *env =3D &cpu->env; @@ -475,7 +475,7 @@ int kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void= *addr) kvm_physical_memory_addr_from_host(c->kvm_state, addr, &paddr)= ) { kvm_hwpoison_page_add(ram_addr); kvm_mce_inject(cpu, paddr, code); - return 0; + return; } =20 fprintf(stderr, "Hardware memory error for memory used by " @@ -487,7 +487,6 @@ int kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void= *addr) } =20 /* Hope we are lucky for AO MCE */ - return 0; } =20 static int kvm_inject_mce_oldstyle(X86CPU *cpu) diff --git a/target/mips/kvm.c b/target/mips/kvm.c index 3e686e7..0982e87 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -180,12 +180,6 @@ bool kvm_arch_stop_on_emulation_error(CPUState *cs) return true; } =20 -int kvm_arch_on_sigbus_vcpu(CPUState *cs, int code, void *addr) -{ - DPRINTF("%s\n", __func__); - return 1; -} - void kvm_arch_init_irq_routing(KVMState *s) { } diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 80f2728..3125255 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2558,11 +2558,6 @@ bool kvm_arch_stop_on_emulation_error(CPUState *cpu) return true; } =20 -int kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code, void *addr) -{ - return 1; -} - void kvm_arch_init_irq_routing(KVMState *s) { } diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 92cf6d4..8b9b211 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -2103,11 +2103,6 @@ bool kvm_arch_stop_on_emulation_error(CPUState *cpu) return true; } =20 -int kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code, void *addr) -{ - return 1; -} - void kvm_s390_io_interrupt(uint16_t subchannel_id, uint16_t subchannel_nr, uint32_t io_int_parm, uint32_t io_int_word) --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148795931723835.49375902318616; Fri, 24 Feb 2017 10:01:57 -0800 (PST) Received: from localhost ([::1]:39006 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chKBm-0006D4-44 for importer@patchew.org; Fri, 24 Feb 2017 13:01:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrO-00081G-K4 for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrL-0002IM-Hw for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:50 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:35404) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrL-0002I8-95 for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:47 -0500 Received: by mail-wr0-x244.google.com with SMTP id q39so3112102wrb.2 for ; Fri, 24 Feb 2017 09:40:47 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=bhy3jucLJQggyG0tRXbHslz5crbcZhhH8WNUUNDjUa8=; b=TbpQSpLE8+I8QdUXZyelBodf4mSEZu0HGWEkdBfJHNwqn/ZZw6S+ditrN36JY6WO15 T1zseWnrPJFFeNse2+9+Nqh2DRwpKCEFMBqSUfiMUMJh7JXaz/RTVQ4Uyk3VIQLKgRnd Lbshl/HUZEdzZU07E2DemJsOsGg0U7Gvqg85SGkiPqTmT3DA7e1KfR9pd3GKhZtTG7eI MtdCkyV8zaec9dHT1cd52tiu4yXi0mTztlzykPWxM39suAmndEWsrOgGJz+wXhkguX2k glK3kP52pCaOGg7ASswl+IPHwUuLcGoxR2OLQrUUFfDzp1MPrC1qHcmaYBw8fsTymSbe Xjfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=bhy3jucLJQggyG0tRXbHslz5crbcZhhH8WNUUNDjUa8=; b=avvNPga76jPwscAF4kCJId9KE7AEvixAapVM+a7o6rDUQMrVvFzrLTVtePyBzOPIfc DLArQNGhUL+9gNrj6L72/D1X6I8acKkD7DcT08mJNTW/D7lBiLHE/MOxHjkuJlqbcE8t O6wwWci1yKn9GmUxggkeiQjV8QFOEyLTVyZ2z1nTeR7PA0ndywEDIj0t/0215e+1EMsj /jQ2s3lYtAO5C+nYC5k4m7n6Pt8LlXPBd4TiBRVsvtpGKp83DLcqdcZX9ulFbxZLm/1i ZIDvCGxVklxpJlnlVq21Uj2aPsGpsLH/9FdFZYpAA3nITiVmdvCiryLdU4+aVo/GsJxU oIog== X-Gm-Message-State: AMke39ns2hWDqgluAiO0+wy8tBU5gWBQLI/f2Shf3jWq2ME27UeL/h920Q0oAEe3UBk0NQ== X-Received: by 10.223.128.202 with SMTP id 68mr3976301wrl.92.1487958046009; Fri, 24 Feb 2017 09:40:46 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:24 +0100 Message-Id: <1487958030-51417-12-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 11/17] KVM: move SIG_IPI handling to kvm-all.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This lets us remove a bunch of CONFIG_LINUX defines. Signed-off-by: Paolo Bonzini --- cpus.c | 62 +-----------------------------------------------= ---- include/sysemu/kvm.h | 5 ++--- kvm-all.c | 60 +++++++++++++++++++++++++++++++++++++++++++++---= -- kvm-stub.c | 12 +++++----- 4 files changed, 63 insertions(+), 76 deletions(-) diff --git a/cpus.c b/cpus.c index a2bc916..3d3c592 100644 --- a/cpus.c +++ b/cpus.c @@ -820,69 +820,10 @@ static void qemu_init_sigbus(void) =20 prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0); } - -static void dummy_signal(int sig) -{ -} - -static void qemu_kvm_init_cpu_signals(CPUState *cpu) -{ - int r; - sigset_t set; - struct sigaction sigact; - - memset(&sigact, 0, sizeof(sigact)); - sigact.sa_handler =3D dummy_signal; - sigaction(SIG_IPI, &sigact, NULL); - - pthread_sigmask(SIG_BLOCK, NULL, &set); - sigdelset(&set, SIGBUS); - pthread_sigmask(SIG_SETMASK, &set, NULL); - sigdelset(&set, SIG_IPI); - r =3D kvm_set_signal_mask(cpu, &set); - if (r) { - fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r)); - exit(1); - } -} - -static void qemu_kvm_eat_signals(CPUState *cpu) -{ - struct timespec ts =3D { 0, 0 }; - siginfo_t siginfo; - sigset_t waitset; - sigset_t chkset; - int r; - - sigemptyset(&waitset); - sigaddset(&waitset, SIG_IPI); - - do { - r =3D sigtimedwait(&waitset, &siginfo, &ts); - if (r =3D=3D -1 && !(errno =3D=3D EAGAIN || errno =3D=3D EINTR)) { - perror("sigtimedwait"); - exit(1); - } - - r =3D sigpending(&chkset); - if (r =3D=3D -1) { - perror("sigpending"); - exit(1); - } - } while (sigismember(&chkset, SIG_IPI)); -} #else /* !CONFIG_LINUX */ static void qemu_init_sigbus(void) { } - -static void qemu_kvm_eat_signals(CPUState *cpu) -{ -} - -static void qemu_kvm_init_cpu_signals(CPUState *cpu) -{ -} #endif /* !CONFIG_LINUX */ =20 static QemuMutex qemu_global_mutex; @@ -956,7 +897,6 @@ static void qemu_kvm_wait_io_event(CPUState *cpu) qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); } =20 - qemu_kvm_eat_signals(cpu); qemu_wait_io_event_common(cpu); } =20 @@ -979,7 +919,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) exit(1); } =20 - qemu_kvm_init_cpu_signals(cpu); + kvm_init_cpu_signals(cpu); =20 /* signal CPU creation */ cpu->created =3D true; diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index a1b019d..24281fc 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -238,9 +238,6 @@ int kvm_remove_breakpoint(CPUState *cpu, target_ulong a= ddr, target_ulong len, int type); void kvm_remove_all_breakpoints(CPUState *cpu); int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap); -#ifndef _WIN32 -int kvm_set_signal_mask(CPUState *cpu, const sigset_t *sigset); -#endif =20 int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr); int kvm_on_sigbus(int code, void *addr); @@ -463,6 +460,8 @@ void kvm_cpu_synchronize_state(CPUState *cpu); void kvm_cpu_synchronize_post_reset(CPUState *cpu); void kvm_cpu_synchronize_post_init(CPUState *cpu); =20 +void kvm_init_cpu_signals(CPUState *cpu); + /** * kvm_irqchip_add_msi_route - Add MSI route for specific vector * @s: KVM state diff --git a/kvm-all.c b/kvm-all.c index d3b0487..d7d5a71 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1897,6 +1897,32 @@ static __thread void *pending_sigbus_addr; static __thread int pending_sigbus_code; static __thread bool have_sigbus_pending; =20 +static void kvm_eat_signals(CPUState *cpu) +{ + struct timespec ts =3D { 0, 0 }; + siginfo_t siginfo; + sigset_t waitset; + sigset_t chkset; + int r; + + sigemptyset(&waitset); + sigaddset(&waitset, SIG_IPI); + + do { + r =3D sigtimedwait(&waitset, &siginfo, &ts); + if (r =3D=3D -1 && !(errno =3D=3D EAGAIN || errno =3D=3D EINTR)) { + perror("sigtimedwait"); + exit(1); + } + + r =3D sigpending(&chkset); + if (r =3D=3D -1) { + perror("sigpending"); + exit(1); + } + } while (sigismember(&chkset, SIG_IPI)); +} + int kvm_cpu_exec(CPUState *cpu) { struct kvm_run *run =3D cpu->kvm_run; @@ -1945,6 +1971,7 @@ int kvm_cpu_exec(CPUState *cpu) if (run_ret < 0) { if (run_ret =3D=3D -EINTR || run_ret =3D=3D -EAGAIN) { DPRINTF("io window exit\n"); + kvm_eat_signals(cpu); ret =3D EXCP_INTERRUPT; break; } @@ -2384,16 +2411,12 @@ void kvm_remove_all_breakpoints(CPUState *cpu) } #endif /* !KVM_CAP_SET_GUEST_DEBUG */ =20 -int kvm_set_signal_mask(CPUState *cpu, const sigset_t *sigset) +static int kvm_set_signal_mask(CPUState *cpu, const sigset_t *sigset) { KVMState *s =3D kvm_state; struct kvm_signal_mask *sigmask; int r; =20 - if (!sigset) { - return kvm_vcpu_ioctl(cpu, KVM_SET_SIGNAL_MASK, NULL); - } - sigmask =3D g_malloc(sizeof(*sigmask) + sizeof(*sigset)); =20 sigmask->len =3D s->sigmask_len; @@ -2404,6 +2427,33 @@ int kvm_set_signal_mask(CPUState *cpu, const sigset_= t *sigset) return r; } =20 +static void dummy_signal(int sig) +{ +} + +void kvm_init_cpu_signals(CPUState *cpu) +{ + int r; + sigset_t set; + struct sigaction sigact; + + memset(&sigact, 0, sizeof(sigact)); + sigact.sa_handler =3D dummy_signal; + sigaction(SIG_IPI, &sigact, NULL); + + pthread_sigmask(SIG_BLOCK, NULL, &set); +#if defined KVM_HAVE_MCE_INJECTION + sigdelset(&set, SIGBUS); + pthread_sigmask(SIG_SETMASK, &set, NULL); +#endif + sigdelset(&set, SIG_IPI); + r =3D kvm_set_signal_mask(cpu, &set); + if (r) { + fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r)); + exit(1); + } +} + /* Called asynchronously in VCPU thread. */ int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr) { diff --git a/kvm-stub.c b/kvm-stub.c index b1b6b96..ef0c734 100644 --- a/kvm-stub.c +++ b/kvm-stub.c @@ -95,13 +95,6 @@ void kvm_remove_all_breakpoints(CPUState *cpu) { } =20 -#ifndef _WIN32 -int kvm_set_signal_mask(CPUState *cpu, const sigset_t *sigset) -{ - abort(); -} -#endif - int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr) { return 1; @@ -157,4 +150,9 @@ bool kvm_has_free_slot(MachineState *ms) { return false; } + +void kvm_init_cpu_signals(CPUState *cpu) +{ + abort(); +} #endif --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487959798924818.7287055805182; Fri, 24 Feb 2017 10:09:58 -0800 (PST) Received: from localhost ([::1]:39054 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chKJZ-0006sI-HE for importer@patchew.org; Fri, 24 Feb 2017 13:09:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrO-00081H-KR for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrM-0002Ic-46 for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:50 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:35682) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrL-0002IH-Ui for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:48 -0500 Received: by mail-wm0-x244.google.com with SMTP id u63so4043373wmu.2 for ; Fri, 24 Feb 2017 09:40:47 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=Ok8f59XzE1M26Ythoqajlc2/LljsadFvWC0/8Ybu0RI=; b=QTDqMCTqGjG1CtCzb3L1hbEP9P0x9k511QX/YEM3jD+D0GaF7JEXzNrHblGdEUevSf vZ2O5QWqwq1L4DMipZwyzOpXtJCjQrteqFIbv9ZHglN63XvUD7JogKTwZcaoiAdx31KG exUbBqRMZ72CjUBJiwUeiPlLixKoYIXCNzZwhK+0cDlygpFNf2FMR+6PkQGPZigcKd5X iRLDIMxPRyuBgexLTlhDuUnYGA5SJycsd3UhxdaiMiWPHnQsYL1/VfJ5zNd+I8AZN5XK 69zFSaIjTuRjjU7DzX6htiDdGyl01u2m59esive+85tul+FRWhzDW9zrwbMusHqIrQMZ fATQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=Ok8f59XzE1M26Ythoqajlc2/LljsadFvWC0/8Ybu0RI=; b=Y4Zrdp+qQuTdr2PoEnUWm0IKsQEQWo8dNGxZnk6ecNvSTjHSKx1GWNjjc/wJRZSiCt pNQpqsveeY4BjhBpCmeUcWr1CIBb+1I5TBs3hs1zLsHVwcPDMAIPMlUj6FKj1uMNWr1D ooVBhUol5+vYRs35of528OBsYKTpoVebNJgp6BFGuf6dFmjB1uC3QAIkDkl9ULAeNz9t jLA0L0gkGJqZJ69W25ZRXqEeCSpR0wYUlv25TYfb9IlG69WEw39xjJfUd7GUNv+CZZRF NQ+FudBH978WU5+/hokvkb4vJ2ogSNLxbNWzwvPhYjSG4AHuatRGBltR7c+TXuuD4yj/ 6X9w== X-Gm-Message-State: AMke39mMKyUv7YAIJ0vnAHWVPFALeCTCA3HYNxuq5aYz2QUuZ9oLPhHX+Fg3Ed04dD7ZIQ== X-Received: by 10.28.194.5 with SMTP id s5mr3881511wmf.98.1487958046791; Fri, 24 Feb 2017 09:40:46 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:25 +0100 Message-Id: <1487958030-51417-13-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 12/17] kvm: use atomic_read/atomic_set to access cpu->exit_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- kvm-all.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index d7d5a71..1a96c27 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1931,7 +1931,7 @@ int kvm_cpu_exec(CPUState *cpu) DPRINTF("kvm_cpu_exec()\n"); =20 if (kvm_arch_process_async_events(cpu)) { - cpu->exit_request =3D 0; + atomic_set(&cpu->exit_request, 0); return EXCP_HLT; } =20 @@ -1946,7 +1946,7 @@ int kvm_cpu_exec(CPUState *cpu) } =20 kvm_arch_pre_run(cpu, run); - if (cpu->exit_request) { + if (atomic_read(&cpu->exit_request)) { DPRINTF("interrupt exit requested\n"); /* * KVM requires us to reenter the kernel after IO exits to com= plete @@ -2065,7 +2065,7 @@ int kvm_cpu_exec(CPUState *cpu) vm_stop(RUN_STATE_INTERNAL_ERROR); } =20 - cpu->exit_request =3D 0; + atomic_set(&cpu->exit_request, 0); return ret; } =20 --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487959054423850.9827664126664; Fri, 24 Feb 2017 09:57:34 -0800 (PST) Received: from localhost ([::1]:38974 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chK7Z-0001VS-57 for importer@patchew.org; Fri, 24 Feb 2017 12:57:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrO-00081K-L7 for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrN-0002J8-8W for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:50 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:34530) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrM-0002In-VA for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:49 -0500 Received: by mail-wm0-x244.google.com with SMTP id m70so4059162wma.1 for ; Fri, 24 Feb 2017 09:40:48 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=5u+0zrMM6Fus016lVM/7+ZIDOL1ZN0mH6mBKmeaWKNw=; b=Zr/h2O5rhkSNmnSSNrGoTplZ0b/9viiRFZUtLTVzjqIUYUa1eLw6PpgFqdtMlvnFoJ agvVhHqorXXzwidkSfbT3y+CO1wewVy/LCM/+i6mlGOfc87cW8HW2G9YXeYt0PVPOmE0 SD/9h4abPqFTzfxZv8W4mfW1eoURVEQpIkA8NLJA5bTO2aSZrcMjPK9suExhJBruawfN yQFXTbgskZc9se5N57yqWwwSgFpYKOJ7yeIpjq8VRvurgfA3h/e8NJb5HAwchPYRK8O5 b0pwcGkwuXS1TnNTOkg9blMJN5+VEOJ62qdc5P1qt5joj7A0mVuYFDejPVjBp+Az8KmJ h3yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=5u+0zrMM6Fus016lVM/7+ZIDOL1ZN0mH6mBKmeaWKNw=; b=AM7tNSfs6HAhvbmfn1yXLs2BENXOZmJFnlpLYL4XhE930w3M3ZYYfCbO3llSZ39L5l NZB/nJHom+ZUXSE3Q0/lfpSMz2z8EmwRvWpOJEvjYIfo3B1HK5zC0npUBAPqkgTPLW+G Yuv3d/0RmPmgwdJ0CNly0FeEGfIWaL7qksJ8O23JjfwIFJc/PrD4XtWS3S2bymsI1Xan HQIm1bHQvLS7WrbkocqeI6mh/Fj8YgWS0XYnLXr2lSYx2VTpGx02r9+l4I9aKfYnwtt4 WtrSBrPO9lPB5iMTXYIA9hhpZpXpmnckQZiJsqNLubRx5WT3eAGY+CU58oA2yRYCTyIo m46g== X-Gm-Message-State: AMke39lxFWfVHoVFriw19Awpz+hnr5fzhBvtJ5foC7sydqzVglwe/mTtSWTS7EzwLgx0lg== X-Received: by 10.28.206.131 with SMTP id e125mr3302103wmg.40.1487958047727; Fri, 24 Feb 2017 09:40:47 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:26 +0100 Message-Id: <1487958030-51417-14-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 13/17] KVM: use KVM_CAP_IMMEDIATE_EXIT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The purpose of the KVM_SET_SIGNAL_MASK API is to let userspace "kick" a VCPU out of KVM_RUN through a POSIX signal. A signal is attached to a dummy signal handler; by blocking the signal outside KVM_RUN and unblocking it inside, this possible race is closed: VCPU thread service thread -------------------------------------------------------------- check flag set flag raise signal (signal handler does nothing) KVM_RUN However, one issue with KVM_SET_SIGNAL_MASK is that it has to take tsk->sighand->siglock on every KVM_RUN. This lock is often on a remote NUMA node, because it is on the node of a thread's creator. Taking this lock can be very expensive if there are many userspace exits (as is the case for SMP Windows VMs without Hyper-V reference time counter). KVM_CAP_IMMEDIATE_EXIT provides an alternative, where the flag is placed directly in kvm_run so that KVM can see it: VCPU thread service thread -------------------------------------------------------------- raise signal signal handler set run->immediate_exit KVM_RUN check run->immediate_exit The previous patches changed QEMU so that the only blocked signal is SIG_IPI, so we can now stop using KVM_SET_SIGNAL_MASK and sigtimedwait if KVM_CAP_IMMEDIATE_EXIT is available. On a 14-VCPU guest, an "inl" operation goes down from 30k to 6k on an unlocked (no BQL) MemoryRegion, or from 30k to 15k if the BQL is involved. Signed-off-by: Paolo Bonzini --- kvm-all.c | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 1a96c27..7ad20b7 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -120,6 +120,7 @@ bool kvm_vm_attributes_allowed; bool kvm_direct_msi_allowed; bool kvm_ioeventfd_any_length_allowed; bool kvm_msi_use_devid; +static bool kvm_immediate_exit; =20 static const KVMCapabilityInfo kvm_required_capabilites[] =3D { KVM_CAP_INFO(USER_MEMORY), @@ -1619,6 +1620,7 @@ static int kvm_init(MachineState *ms) goto err; } =20 + kvm_immediate_exit =3D kvm_check_extension(s, KVM_CAP_IMMEDIATE_EXIT); s->nr_slots =3D kvm_check_extension(s, KVM_CAP_NR_MEMSLOTS); =20 /* If unspecified, use the default value */ @@ -1897,6 +1899,20 @@ static __thread void *pending_sigbus_addr; static __thread int pending_sigbus_code; static __thread bool have_sigbus_pending; =20 +static void kvm_cpu_kick(CPUState *cpu) +{ + atomic_set(&cpu->kvm_run->immediate_exit, 1); +} + +static void kvm_cpu_kick_self(void) +{ + if (kvm_immediate_exit) { + kvm_cpu_kick(current_cpu); + } else { + qemu_cpu_kick_self(); + } +} + static void kvm_eat_signals(CPUState *cpu) { struct timespec ts =3D { 0, 0 }; @@ -1905,6 +1921,15 @@ static void kvm_eat_signals(CPUState *cpu) sigset_t chkset; int r; =20 + if (kvm_immediate_exit) { + atomic_set(&cpu->kvm_run->immediate_exit, 0); + /* Write kvm_run->immediate_exit before the cpu->exit_request + * write in kvm_cpu_exec. + */ + smp_wmb(); + return; + } + sigemptyset(&waitset); sigaddset(&waitset, SIG_IPI); =20 @@ -1953,9 +1978,14 @@ int kvm_cpu_exec(CPUState *cpu) * instruction emulation. This self-signal will ensure that we * leave ASAP again. */ - qemu_cpu_kick_self(); + kvm_cpu_kick_self(); } =20 + /* Read cpu->exit_request before KVM_RUN reads run->immediate_exit. + * Matching barrier in kvm_eat_signals. + */ + smp_rmb(); + run_ret =3D kvm_vcpu_ioctl(cpu, KVM_RUN, 0); =20 attrs =3D kvm_arch_post_run(cpu, run); @@ -2427,8 +2457,12 @@ static int kvm_set_signal_mask(CPUState *cpu, const = sigset_t *sigset) return r; } =20 -static void dummy_signal(int sig) +static void kvm_ipi_signal(int sig) { + if (current_cpu) { + assert(kvm_immediate_exit); + kvm_cpu_kick(current_cpu); + } } =20 void kvm_init_cpu_signals(CPUState *cpu) @@ -2438,7 +2472,7 @@ void kvm_init_cpu_signals(CPUState *cpu) struct sigaction sigact; =20 memset(&sigact, 0, sizeof(sigact)); - sigact.sa_handler =3D dummy_signal; + sigact.sa_handler =3D kvm_ipi_signal; sigaction(SIG_IPI, &sigact, NULL); =20 pthread_sigmask(SIG_BLOCK, NULL, &set); @@ -2447,7 +2481,11 @@ void kvm_init_cpu_signals(CPUState *cpu) pthread_sigmask(SIG_SETMASK, &set, NULL); #endif sigdelset(&set, SIG_IPI); - r =3D kvm_set_signal_mask(cpu, &set); + if (kvm_immediate_exit) { + r =3D pthread_sigmask(SIG_SETMASK, &set, NULL); + } else { + r =3D kvm_set_signal_mask(cpu, &set); + } if (r) { fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r)); exit(1); --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148795975033828.337592672678625; Fri, 24 Feb 2017 10:09:10 -0800 (PST) Received: from localhost ([::1]:39049 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chKIl-0006DU-UI for importer@patchew.org; Fri, 24 Feb 2017 13:09:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrP-00081o-0R for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrO-0002JP-0p for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:51 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:32950) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrN-0002J5-QB for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:49 -0500 Received: by mail-wm0-x243.google.com with SMTP id v77so4057608wmv.0 for ; Fri, 24 Feb 2017 09:40:49 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=54qlYiThXSLEg2Hhucl3eTTKOBwMTSTy0Z+FFmuB/hg=; b=dpuYIr5qPoekNm1L45XK6yboTartNl8OiFcqUPtQwtJtLGf2nf9ngbpJXfdltImgNx LDqV0mn6Npr3k7gDodKqxO8XMkUuGCZHrkukGO5Aztb3/oyxjB+L/lPnQuu+jXcPQeL0 OZBBkMm4ArhFi7UfVyr0lRc5s2ZMyH9aRL52NEOPMsfvNlrqibMDMyRhYJOtrJcx5rPk 4roqSMxgEfG5uQwc2Lr+6CUJsKPXyQOZruxBuI2zI7nswdaRxBUsS5whWFhdGW7VCOLJ /aZUtWK+4STuD3k6vcZ6lpLvhu/kJY+SKxRoMTeuS5nYZT20U/M4e9JwafC/rNdMUePc e8aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=54qlYiThXSLEg2Hhucl3eTTKOBwMTSTy0Z+FFmuB/hg=; b=SnEkjw/VWEEO/IcG1hYRtYHk0Mg2wxvqpxM4SmwliHOxb0Z1B5PPsgj7p0kfK+78r0 f/Kxv0ENUVYa9XvMW3WRJbCmULAzhG88Aipny7gdDf7M8GBy+/iUtgqvtzzds1twB/wV URxrbzzHAsakLCzBPzJx59Zae9lZO6HzwXmoHAzfWe8a1bZABG2h/jl4ycm7UNbUF3vo EYDBB8OZBXSuU89M7e9YwtDjyjcjRnhtfCfZxnWvEmug39Hs951sb1wz72tq0TGexIh9 +v1kAEL7sY42L0ymE48Sise2ApwdkqJj555YnE34a/OEEYKv8agGC7lU96xBqH69N7iy T7zw== X-Gm-Message-State: AMke39m+qiM2mjf4w0a2HEOwcMN0/xgir/JTZw4yfiIB4IXmMw9kZz34kJ70KAjj50GD3Q== X-Received: by 10.28.48.7 with SMTP id w7mr3794201wmw.78.1487958048629; Fri, 24 Feb 2017 09:40:48 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:27 +0100 Message-Id: <1487958030-51417-15-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 14/17] vmxcap: port to Python 3 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- scripts/kvm/vmxcap | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap index 2220255..af8de15 100755 --- a/scripts/kvm/vmxcap +++ b/scripts/kvm/vmxcap @@ -27,9 +27,9 @@ MSR_IA32_VMX_VMFUNC =3D 0x491 class msr(object): def __init__(self): try: - self.f =3D open('/dev/cpu/0/msr', 'r', 0) + self.f =3D open('/dev/cpu/0/msr', 'rb', 0) except: - self.f =3D open('/dev/msr0', 'r', 0) + self.f =3D open('/dev/msr0', 'rb', 0) def read(self, index, default =3D None): import struct self.f.seek(index) @@ -49,7 +49,7 @@ class Control(object): val =3D m.read(nr, 0) return (val & 0xffffffff, val >> 32) def show(self): - print self.name + print(self.name) mbz, mb1 =3D self.read2(self.cap_msr) tmbz, tmb1 =3D 0, 0 if self.true_cap_msr: @@ -69,7 +69,7 @@ class Control(object): s =3D 'forced' elif one and zero: s =3D 'yes' - print ' %-40s %s' % (self.bits[bit], s) + print(' %-40s %s' % (self.bits[bit], s)) =20 class Misc(object): def __init__(self, name, bits, msr): @@ -77,9 +77,9 @@ class Misc(object): self.bits =3D bits self.msr =3D msr def show(self): - print self.name + print(self.name) value =3D msr().read(self.msr, 0) - print ' Hex: 0x%x' % (value) + print(' Hex: 0x%x' % (value)) def first_bit(key): if type(key) is tuple: return key[0] @@ -94,7 +94,7 @@ class Misc(object): def fmt(x): return { True: 'yes', False: 'no' }[x] v =3D (value >> lo) & ((1 << (hi - lo + 1)) - 1) - print ' %-40s %s' % (self.bits[bits], fmt(v)) + print(' %-40s %s' % (self.bits[bits], fmt(v))) =20 controls =3D [ Misc( --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487960123038972.9295849276764; Fri, 24 Feb 2017 10:15:23 -0800 (PST) Received: from localhost ([::1]:39104 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chKOn-0003t0-HU for importer@patchew.org; Fri, 24 Feb 2017 13:15:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrP-00082g-Qy for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrP-0002Jr-0D for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:51 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:35845) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrO-0002JU-Qf for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:50 -0500 Received: by mail-wm0-x241.google.com with SMTP id r18so4054676wmd.3 for ; Fri, 24 Feb 2017 09:40:50 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=DOJDjrCMDu0DrhqkFXgm92b8M8SVSmhPfcF/0gZNbrI=; b=oaAKCDhEKHZD9/RoEFDa6Z9GPSezqR+q8z2MD3YjvzjXHmspDNaI8E5L+czqBtvmHh Buz3H797idfT2N7hj6gB6UGuw8eD2urdtqdDsuYU1SPgCE9ZW8pcC8USQMrJlpsuvHfe kUO7wj89ZWY8dvAZ7HdRBHMyYGmqtOSsF/Li9/P1lzfmHyzyuj46ws+jVaA4uk88zYs0 eT8AOU/qkLNrp/X5sCo2XlzHmnCdaVlvlj+9LMFuDJ4yEh+tvHPtD3ME/6o5zqCN14q5 1v+0/Hue8Sgy0wkAqNzvsCIaCTKfOvVfBoWpksEKPaNAoYlZb+6zSqciBgActSO9A9cF fTaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=DOJDjrCMDu0DrhqkFXgm92b8M8SVSmhPfcF/0gZNbrI=; b=s95bdipocZaltJamE4CiTrcAto3G2Wibqz8YGHYNQuzeQF6L6H7svX6tKasD2WL2fx 55zQ0sbEC2OxKNu7sP2LiHQuC6yAyQnhgN9pkabgdyrEhoh8cWonfx36Neslo/ojTPQP HOBwmcGQeNl1qmr8O5/fd3tt3uVWKwaLTHE8HU/YF4IdtxzMZmSdYWgDGxvTYDQhV3YR Lc+/nnF26g/NEcCXs6EhDGlITJ1HqsearV3pWOffrokG453/b8GwaEsK/6hVSYNp+hJ+ MXGDKFSGxK1AiH0wrDI/Q8H7iuaVzjRoscE1uaICkNpzhwFHB1+x8rzYr0n4gzwWPXj/ H+DQ== X-Gm-Message-State: AMke39lHis4aDRpaqw0TnsbLBNyCmqb6FAyoduc4vrLHhPvsM0Qicnsr0czSIw/rfDfaCw== X-Received: by 10.28.87.85 with SMTP id l82mr3640028wmb.135.1487958049643; Fri, 24 Feb 2017 09:40:49 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:28 +0100 Message-Id: <1487958030-51417-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 15/17] vmxcap: update for September 2016 SDM X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- scripts/kvm/vmxcap | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap index af8de15..d9a6db0 100755 --- a/scripts/kvm/vmxcap +++ b/scripts/kvm/vmxcap @@ -170,9 +170,13 @@ controls =3D [ 12: 'Enable INVPCID', 13: 'Enable VM functions', 14: 'VMCS shadowing', + 15: 'Enable ENCLS exiting', 16: 'RDSEED exiting', + 17: 'Enable PML', 18: 'EPT-violation #VE', + 19: 'Conceal non-root operation from PT', 20: 'Enable XSAVES/XRSTORS', + 22: 'Mode-based execute control (XS/XU)', 25: 'TSC scaling', }, cap_msr =3D MSR_IA32_VMX_PROCBASED_CTLS2, @@ -190,6 +194,8 @@ controls =3D [ 20: 'Save IA32_EFER', 21: 'Load IA32_EFER', 22: 'Save VMX-preemption timer value', + 23: 'Clear IA32_BNDCFGS', + 24: 'Conceal VM exits from PT', }, cap_msr =3D MSR_IA32_VMX_EXIT_CTLS, true_cap_msr =3D MSR_IA32_VMX_TRUE_EXIT_CTLS, @@ -205,6 +211,8 @@ controls =3D [ 13: 'Load IA32_PERF_GLOBAL_CTRL', 14: 'Load IA32_PAT', 15: 'Load IA32_EFER', + 16: 'Load IA32_BNDCFGS', + 17: 'Conceal VM entries from PT', }, cap_msr =3D MSR_IA32_VMX_ENTRY_CTLS, true_cap_msr =3D MSR_IA32_VMX_TRUE_ENTRY_CTLS, @@ -223,6 +231,7 @@ controls =3D [ (25,27): 'MSR-load/store count recommendation', 28: 'IA32_SMM_MONITOR_CTL[2] can be set to 1', 29: 'VMWRITE to VM-exit information fields', + 30: 'Inject event with insn length=3D0', (32,63): 'MSEG revision identifier', }, msr =3D MSR_IA32_VMX_MISC_CTLS, --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487959999468937.6631131496098; Fri, 24 Feb 2017 10:13:19 -0800 (PST) Received: from localhost ([::1]:39095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chKMn-00022W-6w for importer@patchew.org; Fri, 24 Feb 2017 13:13:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrR-00084e-AY for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrQ-0002KG-34 for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:53 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:33911) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrP-0002K1-TC for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:52 -0500 Received: by mail-wr0-x242.google.com with SMTP id 89so3129484wrr.1 for ; Fri, 24 Feb 2017 09:40:51 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=KNI7Dlzkt7l8U1askl4WIJSSeP1coZ90IXXrfVIgjW0=; b=XX/qg4Ndjn4xkT6cCaUEw1gN+gofQGmYQfpnL+P/8MpzFru1KOgCPLPPKiZQxuIonw TmoefsMgaflGdH+l/akvJSsDeRjpb5MIdscEnbGgEUbosmgVj/BV6eZ8A2DN7SSfWiWz 15djPIn5zxjk/Hew+v20fy2ph0V+1aJe2Sa43ggE/kwX+UvbRLtYrt6G/NWLFHakj857 lNYB0XxgA4gsETA86cxGTmlIi4/E+/SB+8Cw6n48NCNmupsCIfsdTU3Lsj3B5XfbRTRE QrFLkt5HouBVJo20jn8vxm7VTwA2pUU1/SZHb7AiZFHG8g90tOT7HO/QmFgI8dP/b9y0 3Z5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=KNI7Dlzkt7l8U1askl4WIJSSeP1coZ90IXXrfVIgjW0=; b=WZYOnqg+WU5Wx4ZMqD+Z0xqvmA/4YhgKhY2+tTZJf8ksfymwNcK/OlVEmwTgZfOfMx 4eebEtnlsilkH6Zdjr4oR90+RDWmiZB/vFZoMF/InCiVbIW0t90WNICW/R04DQ3G3q9l UEC+7zF6uWWT12pyPGNs/kOZtZNvdLvqquoUUZe4qjy8C75X414X39msnchWToY2T/sT lrz1nSjPEVYH8UJizEAr/pary3zF+QM0MpyyIhH+E1aSKoDogRThlakLZjJNrVAJDYhI sXvDGz31bRSti4FMSVg22vMM/3+/ewO5m66wvRl+Js8c+xMYjsC8X/X3sQnRuSTPnAQu D+FQ== X-Gm-Message-State: AMke39kkjZnaYZR8gOlcllAcxNwORUZQVWfP+O+Kw6Qb3Zy2krw5NEPndiZ7wYZckmuJqQ== X-Received: by 10.223.167.138 with SMTP id j10mr3616048wrc.178.1487958050734; Fri, 24 Feb 2017 09:40:50 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:29 +0100 Message-Id: <1487958030-51417-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 16/17] qapi: flatten GuestPanicInformation union X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Denis V. Lunev" , Anton Nefedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Anton Nefedov Signed-off-by: Anton Nefedov Signed-off-by: Denis V. Lunev CC: Paolo Bonzini CC: Eric Blake Message-Id: <1487614915-18710-3-git-send-email-den@openvz.org> Signed-off-by: Paolo Bonzini --- qapi-schema.json | 12 ++++++++++++ target/i386/cpu.c | 15 ++++++--------- vl.c | 12 ++++++------ 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/qapi-schema.json b/qapi-schema.json index e9a6364..b142e15 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -5872,6 +5872,16 @@ 'data': [ 'pause', 'poweroff' ] } =20 ## +# @GuestPanicInformationType: +# +# An enumeration of the guest panic information types +# +# Since: 2.9 +## +{ 'enum': 'GuestPanicInformationType', + 'data': [ 'hyper-v'] } + +## # @GuestPanicInformation: # # Information about a guest panic @@ -5879,6 +5889,8 @@ # Since: 2.9 ## {'union': 'GuestPanicInformation', + 'base': {'type': 'GuestPanicInformationType'}, + 'discriminator': 'type', 'data': { 'hyper-v': 'GuestPanicInformationHyperV' } } =20 ## diff --git a/target/i386/cpu.c b/target/i386/cpu.c index fd7add2..63be816 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3502,19 +3502,16 @@ static GuestPanicInformation *x86_cpu_get_crash_inf= o(CPUState *cs) GuestPanicInformation *panic_info =3D NULL; =20 if (env->features[FEAT_HYPERV_EDX] & HV_X64_GUEST_CRASH_MSR_AVAILABLE)= { - GuestPanicInformationHyperV *panic_info_hv =3D - g_malloc0(sizeof(GuestPanicInformationHyperV)); panic_info =3D g_malloc0(sizeof(GuestPanicInformation)); =20 - panic_info->type =3D GUEST_PANIC_INFORMATION_KIND_HYPER_V; - panic_info->u.hyper_v.data =3D panic_info_hv; + panic_info->type =3D GUEST_PANIC_INFORMATION_TYPE_HYPER_V; =20 assert(HV_X64_MSR_CRASH_PARAMS >=3D 5); - panic_info_hv->arg1 =3D env->msr_hv_crash_params[0]; - panic_info_hv->arg2 =3D env->msr_hv_crash_params[1]; - panic_info_hv->arg3 =3D env->msr_hv_crash_params[2]; - panic_info_hv->arg4 =3D env->msr_hv_crash_params[3]; - panic_info_hv->arg5 =3D env->msr_hv_crash_params[4]; + panic_info->u.hyper_v.arg1 =3D env->msr_hv_crash_params[0]; + panic_info->u.hyper_v.arg2 =3D env->msr_hv_crash_params[1]; + panic_info->u.hyper_v.arg3 =3D env->msr_hv_crash_params[2]; + panic_info->u.hyper_v.arg4 =3D env->msr_hv_crash_params[3]; + panic_info->u.hyper_v.arg5 =3D env->msr_hv_crash_params[4]; } =20 return panic_info; diff --git a/vl.c b/vl.c index b5d0a19..e307ae0 100644 --- a/vl.c +++ b/vl.c @@ -1697,14 +1697,14 @@ void qemu_system_guest_panicked(GuestPanicInformati= on *info) } =20 if (info) { - if (info->type =3D=3D GUEST_PANIC_INFORMATION_KIND_HYPER_V) { + if (info->type =3D=3D GUEST_PANIC_INFORMATION_TYPE_HYPER_V) { qemu_log_mask(LOG_GUEST_ERROR, "HV crash parameters: (%#"PRIx64 " %#"PRIx64" %#"PRIx64" %#"PRIx64" %#"PRIx64")\n= ", - info->u.hyper_v.data->arg1, - info->u.hyper_v.data->arg2, - info->u.hyper_v.data->arg3, - info->u.hyper_v.data->arg4, - info->u.hyper_v.data->arg5); + info->u.hyper_v.arg1, + info->u.hyper_v.arg2, + info->u.hyper_v.arg3, + info->u.hyper_v.arg4, + info->u.hyper_v.arg5); } qapi_free_GuestPanicInformation(info); } --=20 1.8.3.1 From nobody Mon May 6 21:37:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487960371280299.7231476780364; Fri, 24 Feb 2017 10:19:31 -0800 (PST) Received: from localhost ([::1]:39128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chKSn-0008EE-SK for importer@patchew.org; Fri, 24 Feb 2017 13:19:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJrS-00085W-3p for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJrR-0002Kc-1X for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:54 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:35849) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJrQ-0002KK-Qu for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:40:52 -0500 Received: by mail-wm0-x241.google.com with SMTP id r18so4054785wmd.3 for ; Fri, 24 Feb 2017 09:40:52 -0800 (PST) Received: from 640k.lan (94-39-187-56.adsl-ull.clienti.tiscali.it. [94.39.187.56]) by smtp.gmail.com with ESMTPSA id s26sm8814533wra.66.2017.02.24.09.40.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 09:40:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=FJGZGgIDZ0x9bz6ljVD0e2eaE8ZQVXyI8/EkmUSEXEY=; b=lcrUneIS0lXI+CiyvR1llYMPGAXRr7Y2IDFvtSwwcA7Je7G5lklRsV0WgsBv+Gwu/M m3eFlGQilDGJxvFZm0oekxmWZChwjf/hcW6v6LCo+Zg9cQML0uIhL96qJ61dewB5um5V xYHgKqYOBcXZF6DmaUocvymBecwGQOSeNXPSGWJKpBfFdXvQik5Ft0hzg6JcISZQ+z7q AOb2iRuPU4UpAcOVHPG9nt6pqhMZWfqiWaWVLVx3xl/4iCHn7ivjwOJZuTroohQHjzaZ Vbd58Hg4LcRXZWlZDGPHfxWLyS70Pm8dVoipNwrdL34i7sFT1vD6H5n0YUoS+1uqv7l5 ZfeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=FJGZGgIDZ0x9bz6ljVD0e2eaE8ZQVXyI8/EkmUSEXEY=; b=Au79EJfRTnw9/B3wGEdeyjzy/a8Yb3fMNayeYI6eVY3TK1X9VcEGipqRzZ2AhqEZZU 1X0lJXmXSyTVHnjXc26QiZyvrswzJlnrhj9qCbh0hSZpAhTHM4r24FRwQgszaE5/zuu0 9YU91UqkfBl7UzPug1D1L8X/FwrbW4X1RFlYHqIWrUst+goujCKw8UXdAxuW2r4rgXJr y23AIg+CAgbG2l+n1DyWv41AWEjvB6V2FVw3weeXsl9SdfdDyypDReWpQHUVTjX6d3D8 NdJx3anWpbrmahBc+8A+iUG4FsSO2xiAEdFL1JRPeROxfn0ARPwPo5qye9bZhYoqj6C9 2kGQ== X-Gm-Message-State: AMke39kYMXhNeWLu4WBxLfyl8Keuh358zlR0Cc3kRCcvLjmOqV2Ttg6E55n4wJXbOfU6WQ== X-Received: by 10.28.216.130 with SMTP id p124mr3671443wmg.58.1487958051691; Fri, 24 Feb 2017 09:40:51 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 18:40:30 +0100 Message-Id: <1487958030-51417-18-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> References: <1487958030-51417-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 17/17] qmp-events: fix GUEST_PANICKED description formatting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Denis V. Lunev" , Anton Nefedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Anton Nefedov Signed-off-by: Anton Nefedov Signed-off-by: Denis V. Lunev CC: Paolo Bonzini CC: Eric Blake Message-Id: <1487614915-18710-4-git-send-email-den@openvz.org> Signed-off-by: Paolo Bonzini --- qapi/event.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qapi/event.json b/qapi/event.json index 970ff02..e02852c 100644 --- a/qapi/event.json +++ b/qapi/event.json @@ -488,9 +488,9 @@ # # @action: action that has been taken, currently always "pause" # -# @info: optional information about a panic +# @info: #optional information about a panic (since 2.9) # -# Since: 1.5 (@info since 2.9) +# Since: 1.5 # # Example: # --=20 1.8.3.1