From patchwork Fri Apr 6 17:11:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895771 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="EJxpyaDx"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40HmTd1Yw8z9s21 for ; Sat, 7 Apr 2018 03:12:21 +1000 (AEST) Received: from localhost ([::1]:40630 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4UuR-0007nQ-8e for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:12:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Utg-0007l7-Lz for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Utc-00075p-Bb for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:32 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34935) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utc-00071G-4Z for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:28 -0400 Received: by mail-wm0-x242.google.com with SMTP id r82so4636653wme.0 for ; Fri, 06 Apr 2018 10:11:28 -0700 (PDT) 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=nUWaRQ2yo6AqE9R1LyMvm5O3EnGMawqbyV4WveuFEAM=; b=EJxpyaDxeCBC/2aNPvJJ50nmXyj/ULTsKM70aGY4JI4cpMHrhcUP1j5Eyp3F8MNepy 4EedHloatzNcELN/Bw6q5Lj3Gn9USMwMvz7tn/U7GprtYaVYJMhxcHt376h3xR11+dB3 sarMN2XalLmu0hrb6wF0PlCI6Gv+UXI8yIWU3dwZ1fq5U3YFiB5mMqSVQllfUAwHlAeQ 624ujoPmNnNHfBAIyvlUwTEIcDklJbUqTZ+VejJz5GoWuVDkcnlWlxzu6cJ+aiOstgr7 JJ6F8ctSLogh488HzWsB2Wwc9Th3+xm5Xe+Z2i9x2J4YDd8S0JDw0Qw3yoxMnCfmZzmS dInw== 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=nUWaRQ2yo6AqE9R1LyMvm5O3EnGMawqbyV4WveuFEAM=; b=p5D1tk1hMwJvoTsXUN/9mhiTxRSo7CjlXKZdrKTeQwRO7OOzB8EukBDErmNtur6ZQc BamcPpOPNThyj1GvTkgfhMKg0hEgzcR+5Pe1uv8BdvmV3C4Ve9mD8hqeMKmrgrQ6GZMC 5rS7Va1Ta3ryC3F66mYDrJcW7BM6cvTwzXAnSdzsrJk2QlZ1+3RwpNOjmjjRXnbr81rC LBsx1wvXsEaD+/h7TjT793rkkyvBoPbNYrxEGUGhEl2daG2nC994G4uAAl0zl0SB/x2Q CGNvwPL+V9Ecl+Mnqw9k3syn5okxk7uEcM6Wni5X6PYO8O9CloXcRkcrSlpuntfq1i75 T21Q== X-Gm-Message-State: AElRT7HXh67C2chnIQmhKQpykMF4ttWRNIwY5ATKTHLBwLdoTzEESbyG kA2QJE8xcqdAxmnl6xjq+UBKh7O7 X-Google-Smtp-Source: AIpwx4/cuuqq1Jgk0wJOJLzxNz3FzO55kXX9JtfdK9XIGNj6Ahp9pbLs0DcTyZ70by/y8HrH0cQSzA== X-Received: by 10.28.63.212 with SMTP id m203mr14185685wma.124.1523034686804; Fri, 06 Apr 2018 10:11:26 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:25 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:02 +0200 Message-Id: <1523034681-33787-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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:c09::242 Subject: [Qemu-devel] [PULL 01/20] sys_membarrier: fix up include directives 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: Bruce Rogers Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bruce Rogers Our rule right now is to use <> for external headers only. util/sys_membarrier.c violates that. Fix it up. Signed-off-by: Bruce Rogers Message-Id: <20180329151018.15319-1-brogers@suse.com> Signed-off-by: Paolo Bonzini --- util/sys_membarrier.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/sys_membarrier.c b/util/sys_membarrier.c index 8dcb53e..1362c0c 100644 --- a/util/sys_membarrier.c +++ b/util/sys_membarrier.c @@ -6,9 +6,9 @@ * Author: Paolo Bonzini */ -#include -#include -#include +#include "qemu/osdep.h" +#include "qemu/sys_membarrier.h" +#include "qemu/error-report.h" #ifdef CONFIG_LINUX #include From patchwork Fri Apr 6 17:11:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895781 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Z6zywS37"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40HmXq4Yzfz9s1R for ; Sat, 7 Apr 2018 03:15:07 +1000 (AEST) Received: from localhost ([::1]:40643 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Ux7-0001zl-JH for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:15:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Utg-0007l6-Lx for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Utd-0007DL-KV for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:32 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:35804) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utd-00077q-D7; Fri, 06 Apr 2018 13:11:29 -0400 Received: by mail-wr0-x244.google.com with SMTP id 80so2413367wrb.2; Fri, 06 Apr 2018 10:11:29 -0700 (PDT) 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=XrC6ffs2NSTNido4cQz5jqUpP4qAQeF0u2UPOS9ipNE=; b=Z6zywS37h+zZf9k++0HFm+qYgesR8GHyBxNbwGPmXVCcAlG7PT6PjIG/Y7iMhPMwkE LFC58vohbD82GE0Krxa9DIdN7U+SIIJkSGfeWAz74s27iSFRIneOXeXvH2dEtf5S1IdB Arlt+0HTGNDLsW5flE4A54iQiftnVWgfluY4yaSJ/Y39DttCGb0nbiTFHReyRtmHVsvB XA/6nnwWJXjYc+Mx2vha+P6y7HBQ1qPwBqjlhjyxlOoLdTkQwdqw09GP1EMA49QwGO+L 2UuzjgxJfjbD9TyRCl/MQvcaTRd1xVBzN2ZytUjQumaJqfF7c7beL/3k5kTbB9Qozy8i vMhQ== 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=XrC6ffs2NSTNido4cQz5jqUpP4qAQeF0u2UPOS9ipNE=; b=ARy7TGxXUfR38h9r5gwq1QDZX6wTIYLLf9ZGFk6UiwHA6X3yQu/NLv8u1vNE2+0Ias u2Zp2UY5STbj+KJnv9si18Bnfc19ZFxaPylmnBJQ2d8zGxX41g/QQCUZyli9ebxC7h2n 2Y84BvKRfUVQtPMos0O50B94hEGrI9pCuIvv28XihUey5p0B9C1pIrotPa/rC2jRS9sc Mb+Ay3NMypZHufoGDCCdoydgjxaZly4oHBm4Pg+7ajPyaAQ3aZ97y/BeMSL38Y4s3L5o a2ApI0QDjjj7SZs31Z7k0Q2qbMbNFFoCaR4RAmQs00tYm7obNF4UjiAL4HieQ8CpD805 WqFA== X-Gm-Message-State: AElRT7EfN1ITXVLcUj8nMVqjHUeREUTUkN+kokkzQUilImVQUy3O+PRZ vuAh67wtKYlBVf26oYzWo8tkrtNx X-Google-Smtp-Source: AIpwx48CyL4p04S8pX0PFt4K9OejjT615UClxwPj1L4247r3uM7L9OkdTawDrMj61pNTHiQJCnRtrg== X-Received: by 10.223.189.11 with SMTP id j11mr21386134wrh.49.1523034688020; Fri, 06 Apr 2018 10:11:28 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:27 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:03 +0200 Message-Id: <1523034681-33787-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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::244 Subject: [Qemu-devel] [PULL 02/20] target/i386: Fix andn instruction 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: qemu-stable@nongnu.org, Alexandro Sanchez Bach Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Alexandro Sanchez Bach In commit 7073fbada733c8d10992f00772c9b9299d740e9b, the `andn` instruction was implemented via `tcg_gen_andc` but passes the operands in the wrong order: - X86 defines `andn dest,src1,src2` as: dest = ~src1 & src2 - TCG defines `andc dest,src1,src2` as: dest = src1 & ~src2 The following simple test shows the issue: #include #include int main(void) { uint32_t ret = 0; __asm ( "mov $0xFF00, %%ecx\n" "mov $0x0F0F, %%eax\n" "andn %%ecx, %%eax, %%ecx\n" "mov %%ecx, %0\n" : "=r" (ret)); printf("%08X\n", ret); return 0; } This patch fixes the problem by simply swapping the order of the two last arguments in `tcg_gen_andc_tl`. Reported-by: Alexandro Sanchez Bach Signed-off-by: Alexandro Sanchez Bach Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini --- target/i386/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index 0135415..3b7ce92 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -3802,7 +3802,7 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); - tcg_gen_andc_tl(cpu_T0, cpu_regs[s->vex_v], cpu_T0); + tcg_gen_andc_tl(cpu_T0, cpu_T0, cpu_regs[s->vex_v]); gen_op_mov_reg_v(ot, reg, cpu_T0); gen_op_update1_cc(); set_cc_op(s, CC_OP_LOGICB + ot); From patchwork Fri Apr 6 17:11:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895772 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="QwbT/DKb"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40HmTf15x8z9s1R for ; Sat, 7 Apr 2018 03:12:22 +1000 (AEST) Received: from localhost ([::1]:40629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4UuS-0007nA-5F for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:12:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Utg-0007lQ-WD for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Ute-0007IM-ML for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:32 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:38704) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Ute-0007Ee-G5 for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:30 -0400 Received: by mail-wm0-x242.google.com with SMTP id i3so4561703wmf.3 for ; Fri, 06 Apr 2018 10:11:30 -0700 (PDT) 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=hAZrFesfoTYZbRpkTZYkcHU3dTpFI4b8I1riWWfqmJU=; b=QwbT/DKb/TZnXL8MmPyZTh80K08hKi/AhPq1eD3rnxmuTPSipxp+B5TBlrsk96s/WV Vl8lgL+D1G/wHgrf3ShyTBBTnOXJYwIoYr12lVimMwwB505EpRghksoSKUcyWHNO7dHi zKPMTIJ81aIXBiCwMoOjCH329ImeLTniRv5sublSi1XhuH9ld2kRE4BRiYvK2hzlJAwq 7zYky8Wkv81SEdQPhS4UUO4Qo/SVFflRocFRcsH4k6p1dXO1XObj+OQPsswR6j6edx8N /5We9MKHEQdZNzIWzCSuc/a57KZA7aC/krLpzUUsHzHRdK8MNx3QrnEbozTi1/frirS9 lHgQ== 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=hAZrFesfoTYZbRpkTZYkcHU3dTpFI4b8I1riWWfqmJU=; b=bBmPyXTWqABgrBPr4ADnw9zk3Z31IS13gE+9toYGjLECujUcMH0Aws6aYXr+8PpNWh w9IilaMPLn9yHssFCBYofJ/7MiZt5pm5yz5q6JB7EpJuonvqbCXgrdiir2FDqAyj3yOz 7Xk4vztTG6gT+89WxzDjGnt5MNx75L33qgg24EPlyqWmZrYCyBgr9VHb2E6yAVL6Jisl HwZplFkC6Zq44yNMzQYDXF/nAX+y0Gd20Y8TamjTpcK4ZEJ175OrljW1kERbzjZe38aK 7AOnedGnLHx2O8kpjyQFiI0qDfZx8ysBT/m77yV0CVVyGbAVcABeXowGsMilBADhYdEW 2+Og== X-Gm-Message-State: ALQs6tCOzO/LeVuuGExdU3/eMlowMCCk8zb9kfO6JxfXbKrzZv5B4imQ f43Z9eTvIvre5khltsnEog7pZq2n X-Google-Smtp-Source: AIpwx4+3Cm3u8wuZSqo1fnPWfxZiScpsuEdZZlVqhlBNONq8vfmtlEEjoiCXkxHHkoEnMOs7iex4hg== X-Received: by 10.28.174.79 with SMTP id x76mr15783637wme.41.1523034689177; Fri, 06 Apr 2018 10:11:29 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:28 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:04 +0200 Message-Id: <1523034681-33787-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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:c09::242 Subject: [Qemu-devel] [PULL 03/20] scripts/checkpatch.pl: Bug fix 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: Su Hang Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Su Hang Commit 2b9aef6fcd96ba7ed8c1ee723e391901852d344c introduced a regression: checkpatch.pl started complaining about the following valid pattern: do { /* something */ } while (condition); Fix the script to once again permit this pattern. Signed-off-by: Su Hang Message-Id: <1522029982-4650-1-git-send-email-suhang16@mails.ucas.ac.cn> Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 57daae0..d52207a 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2356,6 +2356,18 @@ sub process { # check for missing bracing around if etc if ($line =~ /(^.*)\b(?:if|while|for)\b/ && $line !~ /\#\s*if/) { + my $allowed = 0; + + # Check the pre-context. + if ($line =~ /(\}.*?)$/) { + my $pre = $1; + + if ($line !~ /else/) { + print "APW: ALLOWED: pre<$pre> line<$line>\n" + if $dbg_adv_apw; + $allowed = 1; + } + } my ($level, $endln, @chunks) = ctx_statement_full($linenr, $realcnt, 1); if ($dbg_adv_apw) { @@ -2364,7 +2376,6 @@ sub process { if $#chunks >= 1; } if ($#chunks >= 0 && $level == 0) { - my $allowed = 0; my $seen = 0; my $herectx = $here . "\n"; my $ln = $linenr - 1; @@ -2408,7 +2419,7 @@ sub process { $allowed = 1; } } - if ($seen != ($#chunks + 1)) { + if ($seen != ($#chunks + 1) && !$allowed) { ERROR("braces {} are necessary for all arms of this statement\n" . $herectx); } } From patchwork Fri Apr 6 17:11:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895787 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uLC7hvEG"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40HmcV5zdZz9s0y for ; Sat, 7 Apr 2018 03:18:18 +1000 (AEST) Received: from localhost ([::1]:40671 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4V0C-0004bi-RD for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:18:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Uth-0007lv-Ct for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Utg-0007Qk-5A for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:33 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:55477) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utf-0007Lq-UL for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:32 -0400 Received: by mail-wm0-x242.google.com with SMTP id b127so4877138wmf.5 for ; Fri, 06 Apr 2018 10:11:31 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=lgEUDDUZTHbO8hysL5/KMJ9qijWOduU6OUk2Q9A6L0Q=; b=uLC7hvEG8K8nYoUDucOzrbBHMJV0nk45/yf1anAa2KaNfNkvf7LYpcbA9CzHiH/3X5 cqbE0VmVqSsj5N5cC0aVlG240gtkbp/qUx6JyglH4M9/B5LBfoD770lpUQ9rMEmBrQYH MXje/OQZ6tthy9uJzL8mhd6ATzr4OjZ0TxotGeix/EvR5YQlMyGLNplpOE3COqS0jA5t VBljsxIhwTBMhp/e/XTZ1I4i5s9T+KZg4wy2hO+F0nOcVG5qvglize9ybd9+BYBXIqdR nwnWrgSf0VhFu/up3/P9VwifGGYVGjNQzi42O5ZF9H4JF4EsZSEgApPNhNH3g/RFiMIZ 5Fjg== 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:mime-version:content-transfer-encoding; bh=lgEUDDUZTHbO8hysL5/KMJ9qijWOduU6OUk2Q9A6L0Q=; b=eKUvGk7n4AMk8wD5fdHGgnzfuv3kCN1uLHUQDn/MzuWLtM05KExFu6jaatIdK4J+Hp Lz5JjIMr56ZamiFp2rQucLH4YHU5NOgc4ja4evUEvrUA2kAxK+e629YKM/ZNU7cEKVp0 42crSUAV6EP2Fv++8mXll1mo6SBmSMdMJfQ8JC6ojdD9SmS/fuH2STxtAluArMQVNZoP rKLc+W2RM0+dNzP3vGuIOuv2GOoXM/ZBTjN6HbbJzhcSVEewovTIsmpyFiDyG4Kl6sqM J2Sv1StlE7+Wti2FYzQMA5VZsKrK5dOXccsxiMv54lIA4c62IGUcJLKu+5wTkuKo7BxB diqA== X-Gm-Message-State: AElRT7H5t5zP1o4g5O/4+X0RM9VbGFhsSqc5tuDARX3/2AyYXxWEIzW2 GwX0Ve9fcUjMEC00Wlf8801lNkQH X-Google-Smtp-Source: AIpwx4/qIS6Gn0Ejb2g02Aiv6sG0W22WDQ5tUfDL7TVDKRxSqS6w138SrszEkkZXJr/soZ6xXPJEdw== X-Received: by 10.28.15.83 with SMTP id 80mr13765087wmp.151.1523034690587; Fri, 06 Apr 2018 10:11:30 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:29 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:05 +0200 Message-Id: <1523034681-33787-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 04/20] memfd: fix vhost-user-test on non-memfd capable host 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau On RHEL7, memfd is not supported, and vhost-user-test fails: TEST: tests/vhost-user-test... (pid=10248) /x86_64/vhost-user/migrate: qemu-system-x86_64: -object memory-backend-memfd,id=mem,size=2M,: failed to create memfd FAIL There is a qemu_memfd_check() to prevent running memfd path, but it also checks for fallback implementation. Let's specialize qemu_memfd_check() to check memfd only, while qemu_memfd_alloc_check() checks for the qemu_memfd_alloc() API. Reported-by: Miroslav Rezanina Tested-by: Miroslav Rezanina Signed-off-by: Marc-André Lureau Message-Id: <20180328121804.16203-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- hw/virtio/vhost.c | 2 +- include/qemu/memfd.h | 1 + util/memfd.c | 30 +++++++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 250f886..27c1ec5 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1223,7 +1223,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, if (!(hdev->features & (0x1ULL << VHOST_F_LOG_ALL))) { error_setg(&hdev->migration_blocker, "Migration disabled: vhost lacks VHOST_F_LOG_ALL feature."); - } else if (vhost_dev_log_is_shared(hdev) && !qemu_memfd_check()) { + } else if (vhost_dev_log_is_shared(hdev) && !qemu_memfd_alloc_check()) { error_setg(&hdev->migration_blocker, "Migration disabled: failed to allocate shared memory"); } diff --git a/include/qemu/memfd.h b/include/qemu/memfd.h index de10198..49e7963 100644 --- a/include/qemu/memfd.h +++ b/include/qemu/memfd.h @@ -18,6 +18,7 @@ int qemu_memfd_create(const char *name, size_t size, bool hugetlb, uint64_t hugetlbsize, unsigned int seals, Error **errp); +bool qemu_memfd_alloc_check(void); void *qemu_memfd_alloc(const char *name, size_t size, unsigned int seals, int *fd, Error **errp); void qemu_memfd_free(void *ptr, size_t size, int fd); diff --git a/util/memfd.c b/util/memfd.c index 07d579e..277f721 100644 --- a/util/memfd.c +++ b/util/memfd.c @@ -173,7 +173,13 @@ enum { MEMFD_TODO }; -bool qemu_memfd_check(void) +/** + * qemu_memfd_alloc_check(): + * + * Check if qemu_memfd_alloc() can allocate, including using a + * fallback implementation when host doesn't support memfd. + */ +bool qemu_memfd_alloc_check(void) { static int memfd_check = MEMFD_TODO; @@ -188,3 +194,25 @@ bool qemu_memfd_check(void) return memfd_check == MEMFD_OK; } + +/** + * qemu_memfd_check(): + * + * Check if host supports memfd. + */ +bool qemu_memfd_check(void) +{ + static int memfd_check = MEMFD_TODO; + + if (memfd_check == MEMFD_TODO) { + int mfd = memfd_create("test", 0); + if (mfd >= 0) { + memfd_check = MEMFD_OK; + close(mfd); + } else { + memfd_check = MEMFD_KO; + } + } + + return memfd_check == MEMFD_OK; +} From patchwork Fri Apr 6 17:11:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895773 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NaKo0F0c"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40HmTg15scz9s21 for ; Sat, 7 Apr 2018 03:12:23 +1000 (AEST) Received: from localhost ([::1]:40631 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4UuT-0007q2-5I for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:12:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Uti-0007mx-Pn for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Uth-0007Vl-GE for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:34 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:33905) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Uth-0007SI-5i for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:33 -0400 Received: by mail-wm0-x243.google.com with SMTP id w2so8774618wmw.1 for ; Fri, 06 Apr 2018 10:11:33 -0700 (PDT) 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=pqwJEaoZNfHMjVjWQIPSH/8Y37c0mCokD81g3gr9R+w=; b=NaKo0F0cWkvHqH5xUGbqCRrOPuUILwEqr6npzk/opCrbiISA0/4hM1MI62bgU4EBFu dOxXVFrIIJ7/r4uAXykpmsXsLgEY4YyLuclu/ZRd2BAnWmcqBfJX/s7tjp4PVnFJ7YoN p8KPuGanlmziWLAxZPdh9Wy/0paubZiDiRjqSxDF64mjzb7DRIQrC7w/UgBnP5HFixKn LncFOkrT4JKyEE8tCDy33Wk32RKvdAm5KrlvG1fIggpzbvv2QVsaRMtXY0cacWp8OAmd EP8T8yS1RhOgnKLDGbF4X877Cz5L20pb3ClhJu0aL2Qs4yiIyr7tCIIKimUHpC3OiutA hksg== 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=pqwJEaoZNfHMjVjWQIPSH/8Y37c0mCokD81g3gr9R+w=; b=apoE/rEguC2XDWCh0flX+0PDn064nc9BqHzCd5IKB51xofYHEvYOefD7UacE6e0e13 0f8S8ssxYBd9rSG9gNySdC6dYOXcuxBPOocHIKFP8XRKA6X4EcdYHUDJ1JJNnDvSQyzh umO5QPe0hR2QKHHEz6fQBGYbcpd2HyR04+MLYH/gCeVtEcG74HRnvfoWJrluU6uGPifF cJc8ETFDUbBRvjcqpOBJ28TuFFlj8pyHpDGPGXuawFQ0yyUyQNS4hWB8qYmEVRBOi5av CqknXNf7k1TjwqH9mHyD8q/wBISbdZ4LaQXH1Tia4oN2H15bLOXmp/mATv4Gzc0iyjtV Tq7g== X-Gm-Message-State: AElRT7EQ8tPP9CRMB341mE4fYJ9baFzYQPY/9/sNy5Upl7XKwtVDA633 pR0azMRbiT9GFjlFJ8Piey3En3Tc X-Google-Smtp-Source: AIpwx4/PWWeogT7uXsX6+PjPjTYt2DnrTZfTF4glfJcQezpxMhunXUGfsI0bO0eZWIZ15j0MwWiEmw== X-Received: by 10.28.175.140 with SMTP id y134mr14027464wme.139.1523034691752; Fri, 06 Apr 2018 10:11:31 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:31 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:06 +0200 Message-Id: <1523034681-33787-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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:c09::243 Subject: [Qemu-devel] [PULL 05/20] target/i386: WHPX: set CPUID_EXT_HYPERVISOR bit 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: "Justin Terry \(VM\)" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Justin Terry (VM)" Implements the CPUID trap for CPUID 1 to include the CPUID_EXT_HYPERVISOR flag in the ECX results. This was preventing some older linux kernels from booting when trying to access MSR's that dont make sense when virtualized. Signed-off-by: Justin Terry (VM) Message-Id: <20180326170658.606-1-juterry@microsoft.com> Signed-off-by: Paolo Bonzini --- target/i386/whpx-all.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index bf33d32..5843517 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -911,12 +911,62 @@ static int whpx_vcpu_run(CPUState *cpu) ret = 1; break; + case WHvRunVpExitReasonX64Cpuid: { + WHV_REGISTER_VALUE reg_values[5] = {0}; + WHV_REGISTER_NAME reg_names[5]; + UINT32 reg_count = 5; + UINT64 rip, rax, rcx, rdx, rbx; + + rip = vcpu->exit_ctx.VpContext.Rip + + vcpu->exit_ctx.VpContext.InstructionLength; + switch (vcpu->exit_ctx.CpuidAccess.Rax) { + case 1: + rax = vcpu->exit_ctx.CpuidAccess.DefaultResultRax; + /* Advertise that we are running on a hypervisor */ + rcx = + vcpu->exit_ctx.CpuidAccess.DefaultResultRcx | + CPUID_EXT_HYPERVISOR; + + rdx = vcpu->exit_ctx.CpuidAccess.DefaultResultRdx; + rbx = vcpu->exit_ctx.CpuidAccess.DefaultResultRbx; + break; + default: + rax = vcpu->exit_ctx.CpuidAccess.DefaultResultRax; + rcx = vcpu->exit_ctx.CpuidAccess.DefaultResultRcx; + rdx = vcpu->exit_ctx.CpuidAccess.DefaultResultRdx; + rbx = vcpu->exit_ctx.CpuidAccess.DefaultResultRbx; + } + + reg_names[0] = WHvX64RegisterRip; + reg_names[1] = WHvX64RegisterRax; + reg_names[2] = WHvX64RegisterRcx; + reg_names[3] = WHvX64RegisterRdx; + reg_names[4] = WHvX64RegisterRbx; + + reg_values[0].Reg64 = rip; + reg_values[1].Reg64 = rax; + reg_values[2].Reg64 = rcx; + reg_values[3].Reg64 = rdx; + reg_values[4].Reg64 = rbx; + + hr = WHvSetVirtualProcessorRegisters(whpx->partition, + cpu->cpu_index, + reg_names, + reg_count, + reg_values); + + if (FAILED(hr)) { + error_report("WHPX: Failed to set CpuidAccess state registers," + " hr=%08lx", hr); + } + ret = 0; + break; + } case WHvRunVpExitReasonNone: case WHvRunVpExitReasonUnrecoverableException: case WHvRunVpExitReasonInvalidVpRegisterValue: case WHvRunVpExitReasonUnsupportedFeature: case WHvRunVpExitReasonX64MsrAccess: - case WHvRunVpExitReasonX64Cpuid: case WHvRunVpExitReasonException: default: error_report("WHPX: Unexpected VP exit code %d", @@ -1272,6 +1322,33 @@ static int whpx_accel_init(MachineState *ms) goto error; } + memset(&prop, 0, sizeof(WHV_PARTITION_PROPERTY)); + prop.ExtendedVmExits.X64CpuidExit = 1; + hr = WHvSetPartitionProperty(whpx->partition, + WHvPartitionPropertyCodeExtendedVmExits, + &prop, + sizeof(WHV_PARTITION_PROPERTY)); + + if (FAILED(hr)) { + error_report("WHPX: Failed to enable partition extended X64CpuidExit" + " hr=%08lx", hr); + ret = -EINVAL; + goto error; + } + + UINT32 cpuidExitList[] = {1}; + hr = WHvSetPartitionProperty(whpx->partition, + WHvPartitionPropertyCodeCpuidExitList, + cpuidExitList, + RTL_NUMBER_OF(cpuidExitList) * sizeof(UINT32)); + + if (FAILED(hr)) { + error_report("WHPX: Failed to set partition CpuidExitList hr=%08lx", + hr); + ret = -EINVAL; + goto error; + } + hr = WHvSetupPartition(whpx->partition); if (FAILED(hr)) { error_report("WHPX: Failed to setup partition, hr=%08lx", hr); From patchwork Fri Apr 6 17:11:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895778 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="CXCbkyCX"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40HmXn3zpHz9s1R for ; Sat, 7 Apr 2018 03:15:05 +1000 (AEST) Received: from localhost ([::1]:40642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Ux5-0001yA-3g for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:15:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Utk-0007o6-2x for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Uti-0007YN-L7 for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:36 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:39536) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Uti-0007WZ-Dg for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:34 -0400 Received: by mail-wm0-x242.google.com with SMTP id f125so4560482wme.4 for ; Fri, 06 Apr 2018 10:11:34 -0700 (PDT) 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=f/FMKhmxilwp+JJNyndgVDw62i4TJg/N+xAFhM9y97E=; b=CXCbkyCXgrPlG6yCVO8QduW4hPr25xFoDJkJovmejNXpLOhBUTpHpGiP08915SSIF9 nVaySn+70gATp0Rp7dUrmxuN9q0llzQaEM+dFEqisloGtaz+MaXA5exOMzB/meAkpI8A YuWcP7hLsjYSyJMjXRtdXcM9niYqM4Jelxx+pet2t8Fd+4SBfAkRprSEHe2AxA73M8id yo0fazHJJ/2qK3G//pZ4TheYXHfI3m0fuPUUnKdzp97o6JTLGefaae8gCEy9M0fIj32J 7/U4tZy/FvdRBPCx6za5z1WqwjanZBEMkWVfn5Be3chpcJrJJyRrgaC9AxIR366es6wx tE1A== 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=f/FMKhmxilwp+JJNyndgVDw62i4TJg/N+xAFhM9y97E=; b=kmjyl3pV4RA6JpHvJqRYHTumHnBvA7PDeYZZ1cjfb0bTIRSr/rmkBi99+EekBEVRNu Qs8ypg5qPhhOJOGtDTQ4Geg94tReEuVrGXdXwqpwko1WIaA0il9+VMes90Ar9bgEORFG b/5w7eJMg0QjLBhBu9JCnOIoWRaM7IKFo0Zcbvtg+lajPpRwuuYyWcQahmwvOlb6/ZQ/ /1J7AxtIpXJHE5EdbdpUZxRHbRHZQ15mrLNW5OsZ2gRWaDIOzl8EPZrkqZz6pqlT/Wti Wba9QXt+pblXYlD0+BnrWN0jtAW9XIsOeMaJMZ8H3TB/AG7SleCgyAlRZHDYB7KpNTnJ LA0g== X-Gm-Message-State: ALQs6tA4ipEZWX3v/FSMJlJZ3J/wmneAL8MCGgTVmrngWznvhJHkwuih h+t2eeLdpfiiN2wWF8LoHszc7fWd X-Google-Smtp-Source: AIpwx4/dZECmo8ZKV8Nq7giaaD+szIrUIH9xlwpouYfYFh8pO7vZdiXXtDHsWj0A+lrHhb/BelvNgg== X-Received: by 10.28.224.194 with SMTP id x185mr15268501wmg.130.1523034693066; Fri, 06 Apr 2018 10:11:33 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:32 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:07 +0200 Message-Id: <1523034681-33787-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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:c09::242 Subject: [Qemu-devel] [PULL 06/20] i386/hyperv: add hv-frequencies cpu property 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: Roman Kagan Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Roman Kagan In order to guarantee compatibility on migration, QEMU should have complete control over the features it announces to the guest via CPUID. However, the availability of Hyper-V frequency MSRs (HV_X64_MSR_TSC_FREQUENCY and HV_X64_MSR_APIC_FREQUENCY) depends solely on the support for them in the underlying KVM. Introduce "hv-frequencies" cpu property (off by default) which gives QEMU full control over whether these MSRs are announced. While at this, drop the redundant check of the cpu tsc frequency, and decouple this feature from hv-time. Signed-off-by: Roman Kagan Reviewed-by: Eduardo Habkost Message-Id: <20180330170209.20627-2-rkagan@virtuozzo.com> Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 1 + target/i386/cpu.h | 1 + target/i386/kvm.c | 13 +++++++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 555ae79..1a6b082 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4761,6 +4761,7 @@ static Property x86_cpu_properties[] = { DEFINE_PROP_BOOL("hv-runtime", X86CPU, hyperv_runtime, false), DEFINE_PROP_BOOL("hv-synic", X86CPU, hyperv_synic, false), DEFINE_PROP_BOOL("hv-stimer", X86CPU, hyperv_stimer, false), + DEFINE_PROP_BOOL("hv-frequencies", X86CPU, hyperv_frequencies, false), DEFINE_PROP_BOOL("check", X86CPU, check_cpuid, true), DEFINE_PROP_BOOL("enforce", X86CPU, enforce_cpuid, false), DEFINE_PROP_BOOL("kvm", X86CPU, expose_kvm, true), diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 78db1b8..1b219fa 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1296,6 +1296,7 @@ struct X86CPU { bool hyperv_runtime; bool hyperv_synic; bool hyperv_stimer; + bool hyperv_frequencies; bool check_cpuid; bool enforce_cpuid; bool expose_kvm; diff --git a/target/i386/kvm.c b/target/i386/kvm.c index d23fff1..b35623a 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -648,11 +648,16 @@ static int hyperv_handle_properties(CPUState *cs) env->features[FEAT_HYPERV_EAX] |= HV_HYPERCALL_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= HV_TIME_REF_COUNT_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= HV_REFERENCE_TSC_AVAILABLE; - - if (has_msr_hv_frequencies && tsc_is_stable_and_known(env)) { - env->features[FEAT_HYPERV_EAX] |= HV_ACCESS_FREQUENCY_MSRS; - env->features[FEAT_HYPERV_EDX] |= HV_FREQUENCY_MSRS_AVAILABLE; + } + if (cpu->hyperv_frequencies) { + if (!has_msr_hv_frequencies) { + fprintf(stderr, "Hyper-V frequency MSRs " + "(requested by 'hv-frequencies' cpu flag) " + "are not supported by kernel\n"); + return -ENOSYS; } + env->features[FEAT_HYPERV_EAX] |= HV_ACCESS_FREQUENCY_MSRS; + env->features[FEAT_HYPERV_EDX] |= HV_FREQUENCY_MSRS_AVAILABLE; } if (cpu->hyperv_crash && has_msr_hv_crash) { env->features[FEAT_HYPERV_EDX] |= HV_GUEST_CRASH_MSR_AVAILABLE; From patchwork Fri Apr 6 17:11:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895792 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="U/h4/R38"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40HmjR74csz9s1R for ; Sat, 7 Apr 2018 03:22:35 +1000 (AEST) Received: from localhost ([::1]:40858 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4V4L-0008Mg-Vt for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:22:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Utl-0007pY-48 for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Utj-0007ag-Sj for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:37 -0400 Received: from mail-wr0-x22f.google.com ([2a00:1450:400c:c0c::22f]:43589) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utj-0007ZG-KK for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:35 -0400 Received: by mail-wr0-x22f.google.com with SMTP id p53so2401062wrc.10 for ; Fri, 06 Apr 2018 10:11:35 -0700 (PDT) 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=gGr907im/acGW92O/x6FNPnX5+XlTCX1iHeSq9oPnXo=; b=U/h4/R38XtfFIOR91Nf/wO5qBuimviiVxLGEg4IQraIHTyeHahC431hxuZ31NkBETG v279RJ8cnujLvqNARFAC/ou0O07PD1kvo4u1MwDBStGRgl63OC+NumRWK3ivOe/2fMPJ CtBZ0ujuSW8j7aMhCk4p9HdqimBDfEmpQ3ufsmD8dv1Yf2MU2/8U5Cbx8XKGUyCZwoAG 1GLjMjTP4Kihv8EGhQkXmXkRIJ6PCbG3zfgBdIStw1IvvUyVjUYLun5qbrfYf0iZr6EB IbIam3aYYWao6WdAgy0QGjcUQG+rVHInEZflpdwxflkwVggtPWuDsofn0LA9voA5CErt XKVg== 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=gGr907im/acGW92O/x6FNPnX5+XlTCX1iHeSq9oPnXo=; b=HBVIgYKXy44IrxZ014cdL9wF2nsEqU+QLL9rgUq9JJt2azdDvHnNLEhbWdV0Vxvifk h2oCAPBCg6WikrA1dRSbYpuw8Vdq0acJuwgQE7qZCxnbjVsGHIxbgcUHaVPdAXBtY+NR SZm8mA2Yn027dmIkBjIT+0PClTn6L5inkUo7YsBVdarGILLOOnAy8JuXysUm5RKGNZit Yh2oYuUMs5bd8vG9PZP2wbjF34vfeOaRQDO3SCa7bqBMGvxxC38w7swEg7eu6tZWQnXS NN8V68U8Xr1XAenzfljaS24AMLuDjslbGPVZFFzunGguD1HRnd5+15Zy4gMWDJqdaLFe dZVw== X-Gm-Message-State: AElRT7EBm5L8pWXDxq3Mkia3vHj4BHFUHUsOUOY+HrWWA6+VOIAA/RKJ gNBWiRwiFvLqgHSU7a3Q9is1LceH X-Google-Smtp-Source: AIpwx48fN8lNqP1RVscCYQ4os1tB8FvCHbUeqd9bki5/UngRfpd2JNodgfjlqfnFIIHaD/Mf+oqFoQ== X-Received: by 10.223.227.82 with SMTP id n18mr21490591wrj.82.1523034694189; Fri, 06 Apr 2018 10:11:34 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:33 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:08 +0200 Message-Id: <1523034681-33787-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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::22f Subject: [Qemu-devel] [PULL 07/20] i386/hyperv: error out if features requested but unsupported 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: Roman Kagan Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Roman Kagan In order to guarantee compatibility on migration, QEMU should have complete control over the features it announces to the guest via CPUID. However, for a number of Hyper-V-related cpu properties, if the corresponding feature is not supported by the underlying KVM, the propery is silently ignored and the feature is not announced to the guest. Refuse to start with an error instead. Signed-off-by: Roman Kagan Message-Id: <20180330170209.20627-3-rkagan@virtuozzo.com> Reviewed-by: Eduardo Habkost Signed-off-by: Paolo Bonzini --- target/i386/kvm.c | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index b35623a..6c49954 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -632,11 +632,6 @@ static int hyperv_handle_properties(CPUState *cs) X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; - if (cpu->hyperv_time && - kvm_check_extension(cs->kvm_state, KVM_CAP_HYPERV_TIME) <= 0) { - cpu->hyperv_time = false; - } - if (cpu->hyperv_relaxed_timing) { env->features[FEAT_HYPERV_EAX] |= HV_HYPERCALL_AVAILABLE; } @@ -645,6 +640,12 @@ static int hyperv_handle_properties(CPUState *cs) env->features[FEAT_HYPERV_EAX] |= HV_APIC_ACCESS_AVAILABLE; } if (cpu->hyperv_time) { + if (kvm_check_extension(cs->kvm_state, KVM_CAP_HYPERV_TIME) <= 0) { + fprintf(stderr, "Hyper-V clocksources " + "(requested by 'hv-time' cpu flag) " + "are not supported by kernel\n"); + return -ENOSYS; + } env->features[FEAT_HYPERV_EAX] |= HV_HYPERCALL_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= HV_TIME_REF_COUNT_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= HV_REFERENCE_TSC_AVAILABLE; @@ -659,17 +660,41 @@ static int hyperv_handle_properties(CPUState *cs) env->features[FEAT_HYPERV_EAX] |= HV_ACCESS_FREQUENCY_MSRS; env->features[FEAT_HYPERV_EDX] |= HV_FREQUENCY_MSRS_AVAILABLE; } - if (cpu->hyperv_crash && has_msr_hv_crash) { + if (cpu->hyperv_crash) { + if (!has_msr_hv_crash) { + fprintf(stderr, "Hyper-V crash MSRs " + "(requested by 'hv-crash' cpu flag) " + "are not supported by kernel\n"); + return -ENOSYS; + } env->features[FEAT_HYPERV_EDX] |= HV_GUEST_CRASH_MSR_AVAILABLE; } env->features[FEAT_HYPERV_EDX] |= HV_CPU_DYNAMIC_PARTITIONING_AVAILABLE; - if (cpu->hyperv_reset && has_msr_hv_reset) { + if (cpu->hyperv_reset) { + if (!has_msr_hv_reset) { + fprintf(stderr, "Hyper-V reset MSR " + "(requested by 'hv-reset' cpu flag) " + "is not supported by kernel\n"); + return -ENOSYS; + } env->features[FEAT_HYPERV_EAX] |= HV_RESET_AVAILABLE; } - if (cpu->hyperv_vpindex && has_msr_hv_vpindex) { + if (cpu->hyperv_vpindex) { + if (!has_msr_hv_vpindex) { + fprintf(stderr, "Hyper-V VP_INDEX MSR " + "(requested by 'hv-vpindex' cpu flag) " + "is not supported by kernel\n"); + return -ENOSYS; + } env->features[FEAT_HYPERV_EAX] |= HV_VP_INDEX_AVAILABLE; } - if (cpu->hyperv_runtime && has_msr_hv_runtime) { + if (cpu->hyperv_runtime) { + if (!has_msr_hv_runtime) { + fprintf(stderr, "Hyper-V VP_RUNTIME MSR " + "(requested by 'hv-runtime' cpu flag) " + "is not supported by kernel\n"); + return -ENOSYS; + } env->features[FEAT_HYPERV_EAX] |= HV_VP_RUNTIME_AVAILABLE; } if (cpu->hyperv_synic) { From patchwork Fri Apr 6 17:11:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895779 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="h5c+0d05"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40HmXn3zl7z9s0y for ; Sat, 7 Apr 2018 03:15:05 +1000 (AEST) Received: from localhost ([::1]:40649 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Ux5-00020j-GQ for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:15:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Utm-0007r8-4j for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Utl-0007ca-8I for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:38 -0400 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:51236) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utl-0007bZ-16 for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:37 -0400 Received: by mail-wm0-x22b.google.com with SMTP id u189so4843101wmd.1 for ; Fri, 06 Apr 2018 10:11:36 -0700 (PDT) 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=7yXFe9s3aQpkpVBiX7QKedx087pj4CbQwETvBnDNE58=; b=h5c+0d05yS/bGkRCi+IMRWduLlSFODt/to0oZycdqfUzQrTi0mUnuaT/AZF6xE9HxZ uFTUJ9yeENGka1NpGF22U2C4zZgiMvNCyu5HNXnfYKm3Gsd5UYx+LOpWNt/YpXdSTM5u sw50HZKqz6MuSTGkyi3SQW9gV7Quuy6NLCNosCS15BPSQKIdheSBDbei/n6Y8NwAWR9Z ZY1WofjiAPBTCMfnv23BUwjKM4q08xGIgcPGK3GfmhbVpu3rK0SlkjouCbQhbf6JSoGm CkC2b1OVAIa0sqmLne86NIIijuImkndcEHPpmXz4LrNMuf2vI03uAGadg9wLlxpuYNAu 29jw== 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=7yXFe9s3aQpkpVBiX7QKedx087pj4CbQwETvBnDNE58=; b=JWBCZumqtaCdj7fU/sWIj5lwnI3Qjz6la8GMbsMYmmIHMEeEGB4eIx4EKu49pO+EYC VFhRDc4WI5Sl3dhj2Jslpgxj6L5PnifNu571FQPtVYs8Y4M/6tYXFNbxdEkt25b8K7Nn 4ejgINkO6AjCRI+LBh4EhoMHcdhYFriv5cks/4wHZYfTTMNuCanQpNqJK/xRKXin6Y9k KkKRw6wlZqJ+VXS9EvuFPk0yhMyEPRRvcFVYZQUncB+T52975PIF3+ETkmDiQUWFW+o1 2UlrGnGSiayLu9OzXFYqiLPYk5kF0VMq7BBqve4KEtZhQHQYOPXS4Z4ZYWbNPeGvyXLF DaSg== X-Gm-Message-State: ALQs6tDpX4PMNj0kyo3qX5VotCIt9O7Em9Bp8Z+NoUgGUXR3FDIFTmQT ZO5tfFpSPYm9IjbOoVnybA4fNNiE X-Google-Smtp-Source: AIpwx48PDw3quhzxvSbd1KF9glTzHUfot1E8T47mdgYU41sthHvfzUAC74QqHotNgCTwLNaHWo5Nnw== X-Received: by 10.28.135.9 with SMTP id j9mr13963219wmd.68.1523034695625; Fri, 06 Apr 2018 10:11:35 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:34 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:09 +0200 Message-Id: <1523034681-33787-9-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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:c09::22b Subject: [Qemu-devel] [PULL 08/20] configure: Add missing configure options to help text 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: Thomas Huth Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Thomas Huth We forgot to mention --with-git, --libexecdir and --with-pkgversion so far. Signed-off-by: Thomas Huth Message-Id: <1522163370-18544-1-git-send-email-thuth@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- configure | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure b/configure index a2301dd..752dd9e 100755 --- a/configure +++ b/configure @@ -1497,16 +1497,19 @@ Advanced options (experts only): --install=INSTALL use specified install [$install] --python=PYTHON use specified python [$python] --smbd=SMBD use specified smbd [$smbd] + --with-git=GIT use specified git [$git] --static enable static build [$static] --mandir=PATH install man pages in PATH --datadir=PATH install firmware in PATH$confsuffix --docdir=PATH install documentation in PATH$confsuffix --bindir=PATH install binaries in PATH --libdir=PATH install libraries in PATH + --libexecdir=PATH install helper binaries in PATH --sysconfdir=PATH install config in PATH$confsuffix --localstatedir=PATH install local state in PATH (set at runtime on win32) --firmwarepath=PATH search PATH for firmware files --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix] + --with-pkgversion=VERS use specified string as sub-version of the package --enable-debug enable common debug build options --enable-sanitizers enable default sanitizers --disable-strip disable stripping binaries From patchwork Fri Apr 6 17:11:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895786 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="KQAA2RBo"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40HmcN0V09z9s0y for ; Sat, 7 Apr 2018 03:18:12 +1000 (AEST) Received: from localhost ([::1]:40668 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4V06-0004as-3I for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:18:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Utr-0007wU-8S for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Utm-0007dy-Hb for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:43 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34937) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utm-0007cs-AY for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:38 -0400 Received: by mail-wm0-x242.google.com with SMTP id r82so4637440wme.0 for ; Fri, 06 Apr 2018 10:11:38 -0700 (PDT) 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=iZrJc8serSpUMER0hmSQ6+5Zxe8zbKqY9IV4LcYmpi0=; b=KQAA2RBo9PYK7PNAPBBYLK4itqHwuqm8uPajh5/6XTxySF/UWyOl6HP/XjLt8ge49l 6K64WmaGWVXe986fKiNBF9xEgUx+BUGuVRDdcjS44GkMxXswvQjCcmP5L7Hanbyit2+G ObC9E27UmLUr9VwqLZO26YtL6iTHc9u4j7v9WPbSPNNYQI957SYDiZPx0qpvto7Yr0GW S91SIx0Bn5BJeX/d4PRm6ez399B1qT0x/yelzjcJgimR/NcSsXZUeo3aePoLAOvHg2aC ETTL4jCEeho3WpU47CXc3KoYuibfgrEoFaTvnvxldAS+A3hj4sO9APwygBnJXZFN8i+f DwNQ== 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=iZrJc8serSpUMER0hmSQ6+5Zxe8zbKqY9IV4LcYmpi0=; b=A8S3fThZvjDlFfuz5GaNOJhPeC4MB1Qd3dWuCBw7l08qkNUNfGJJ2pBf6jByyV1N8f hH4u7qXRQadvdV4e+lBcF56Qg3KjsngX9kFjcnoCXmp2V5EyLAnzLz81Qkp6CcvlRN1O nwoQqmoY2L+rConSNDk72T6fJhHNJvBF8jEOFCaKAX17l+0wqSEcqFJev2Lspv73fvMc N9sr/YbG0JVChl6vP5cerqQh1UgXpJ0RvVQqhD+IUnvl3rSb3RTLMQEdE306gjCS+mHO 6SDFld+C0ozG6waE6t2MLbwizQ5yFcMrzg+s37/l50pFkwtJo5PlWbsk3eldZDye/FL1 Zl1Q== X-Gm-Message-State: AElRT7FhxYwV8+kKHEzJvH32vlTqHu4/9j2IIRd9HHRo6X2/Q0+FO8VU AbVqgP7qbOpRgDmwsZ8fI1bjVHyB X-Google-Smtp-Source: AIpwx486yF81K5CbTfLEq593t4JQVusCTOulImXYDtHtBpDjNv3x4XT+ebULc5bnEQ3YvpdnbH49ig== X-Received: by 10.28.69.68 with SMTP id s65mr12683727wma.25.1523034696988; Fri, 06 Apr 2018 10:11:36 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:35 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:10 +0200 Message-Id: <1523034681-33787-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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:c09::242 Subject: [Qemu-devel] [PULL 09/20] scsi-disk: Don't enlarge min_io_size to max_io_size 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: Fam Zheng Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Fam Zheng Some backends report big max_io_sectors. Making min_io_size the same value in this case will make it impossible for guest to align memory, therefore the disk may not be usable at all. Do not enlarge them when they are zero. Reported-by: David Gibson Signed-off-by: Fam Zheng Message-Id: <20180327164141.19075-1-famz@redhat.com> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index f5ab767..f8ed8cf 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -714,10 +714,12 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) /* min_io_size and opt_io_size can't be greater than * max_io_sectors */ - min_io_size = - MIN_NON_ZERO(min_io_size, max_io_sectors); - opt_io_size = - MIN_NON_ZERO(opt_io_size, max_io_sectors); + if (min_io_size) { + min_io_size = MIN(min_io_size, max_io_sectors); + } + if (opt_io_size) { + opt_io_size = MIN(opt_io_size, max_io_sectors); + } } /* required VPD size with unmap support */ buflen = 0x40; From patchwork Fri Apr 6 17:11:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895788 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jFcGOWMC"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40HmcV70ZJz9s1R for ; Sat, 7 Apr 2018 03:18:18 +1000 (AEST) Received: from localhost ([::1]:40670 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4V0D-0004bT-0M for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:18:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Utr-0007wT-8P for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Uto-0007h1-6g for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:43 -0400 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:36699) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utn-0007fy-T3 for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:40 -0400 Received: by mail-wm0-x235.google.com with SMTP id x82so4588113wmg.1 for ; Fri, 06 Apr 2018 10:11:39 -0700 (PDT) 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=/g0HurORo12Xi3YOdaelBQScP9J0MkOaESNqrCsZw68=; b=jFcGOWMCrPZz9SDqUvo7lJFowBDFvuIg3SQOxQ6KDgBXnaurychJ+WOhwOxZJSP5qz mmSsr9a4mAS3Y7JQ0NjEiXq2Up13BLaTcayvN98CfIuWnZcTh3KbsAHZvrnStmzQTmw4 AWcMzLzBcGSs58u0spMgxjbfj8vURH1mhuv+gOdwsrtMOHTLrGv4QERekRNSNRhoV4dB QA1HJ6Vq0CxFS/R5Cek4RKIZHh2cHEJS7DGiQsP64QvnYyN3AgsdiKHtLodQAr15xj18 zzY6pkqpoG0FB0k9TFSJpEHX9X6Wp39374QgiKvL0WzILy/lJNm/VJ0rfdFefWVE/HgS 4RbQ== 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=/g0HurORo12Xi3YOdaelBQScP9J0MkOaESNqrCsZw68=; b=Z2FA84RXww4dqN4dNzABWglx+oIj/09qB9EkJ7kwZqoVRy+vZ2XVfKJxDRQROSfIgt dKTjeZEiHTZcf2EBuGx0+m1umetiKjY2UWJy/kNO29xBrg3V1rKsGk81YDWrkaGQeoix V8/4D17obNeVSS3VSeT0ItobIhafTrsJ6bRau2np1nYu+hWEVIuo0MocddyLk8HS/oTQ a7uVBVthw3fWSCskczFAMNGGKQwvvknRZsmECwKc9WZZeGQuSQ+91q3TFnN9LhBe4J1G VqFMyR5jYgKRA5F1jZ4y/EfWszuBVHxv12T+ZlilSC04ThdL5hPIOyce1o5vHTTlUtRC CJEQ== X-Gm-Message-State: AElRT7HUAZTuk6vNLHPKG/IGjLZcTbXv7efX//KWyDeLQ/jWfKfHEok8 hEE39lujHxpNNXJkZhltTZuT4Sag X-Google-Smtp-Source: AIpwx4/5heMWwpJBjZ49Q17aC9+vVLJWlLV9/9Gc9gpMFOdCAJwsRwUrYQK+S4A84uZgnqZzelf+fw== X-Received: by 10.28.143.199 with SMTP id r190mr12876583wmd.132.1523034698424; Fri, 06 Apr 2018 10:11:38 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:11 +0200 Message-Id: <1523034681-33787-11-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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:c09::235 Subject: [Qemu-devel] [PULL 10/20] scsi-disk: allow customizing the SCSI version 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We would like to have different behavior for passthrough devices depending on the SCSI version they expose. To prepare for that, allow the user of emulated devices to specify the desired SCSI level, and adjust the emulation according to the property value. The next patch will set the level for scsi-block and scsi-generic devices. Based on a patch by Daniel Henrique Barboza . Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 29 ++++++++++++++++++++++++----- hw/scsi/scsi-generic.c | 1 + include/hw/scsi/scsi.h | 2 ++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index f8ed8cf..9400b97 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -825,7 +825,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) * block characteristics VPD page by default. Not all of SPC-3 * is actually implemented, but we're good enough. */ - outbuf[2] = 5; + outbuf[2] = s->qdev.default_scsi_version; outbuf[3] = 2 | 0x10; /* Format 2, HiSup */ if (buflen > 36) { @@ -2193,7 +2193,11 @@ static int32_t scsi_disk_dma_command(SCSIRequest *req, uint8_t *buf) case READ_12: case READ_16: DPRINTF("Read (sector %" PRId64 ", count %u)\n", r->req.cmd.lba, len); - if (r->req.cmd.buf[1] & 0xe0) { + /* Protection information is not supported. For SCSI versions 2 and + * older (as determined by snooping the guest's INQUIRY commands), + * there is no RD/WR/VRPROTECT, so skip this check in these versions. + */ + if (s->qdev.scsi_version > 2 && (r->req.cmd.buf[1] & 0xe0)) { goto illegal_request; } if (!check_lba_range(s, r->req.cmd.lba, len)) { @@ -2224,7 +2228,7 @@ static int32_t scsi_disk_dma_command(SCSIRequest *req, uint8_t *buf) * As far as DMA is concerned, we can treat it the same as a write; * scsi_block_do_sgio will send VERIFY commands. */ - if (r->req.cmd.buf[1] & 0xe0) { + if (s->qdev.scsi_version > 2 && (r->req.cmd.buf[1] & 0xe0)) { goto illegal_request; } if (!check_lba_range(s, r->req.cmd.lba, len)) { @@ -2270,6 +2274,8 @@ static void scsi_disk_reset(DeviceState *dev) /* reset tray statuses */ s->tray_locked = 0; s->tray_open = 0; + + s->qdev.scsi_version = s->qdev.default_scsi_version; } static void scsi_disk_resize_cb(void *opaque) @@ -2814,6 +2820,8 @@ static bool scsi_block_is_passthrough(SCSIDiskState *s, uint8_t *buf) static int32_t scsi_block_dma_command(SCSIRequest *req, uint8_t *buf) { SCSIBlockReq *r = (SCSIBlockReq *)req; + SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev); + r->cmd = req->cmd.buf[0]; switch (r->cmd >> 5) { case 0: @@ -2839,8 +2847,11 @@ static int32_t scsi_block_dma_command(SCSIRequest *req, uint8_t *buf) abort(); } - if (r->cdb1 & 0xe0) { - /* Protection information is not supported. */ + /* Protection information is not supported. For SCSI versions 2 and + * older (as determined by snooping the guest's INQUIRY commands), + * there is no RD/WR/VRPROTECT, so skip this check in these versions. + */ + if (s->qdev.scsi_version > 2 && (req->cmd.buf[1] & 0xe0)) { scsi_check_condition(&r->req, SENSE_CODE(INVALID_FIELD)); return 0; } @@ -2952,6 +2963,8 @@ static Property scsi_hd_properties[] = { DEFINE_PROP_UINT64("max_io_size", SCSIDiskState, max_io_size, DEFAULT_MAX_IO_SIZE), DEFINE_PROP_UINT16("rotation_rate", SCSIDiskState, rotation_rate, 0), + DEFINE_PROP_INT32("scsi_version", SCSIDiskState, qdev.default_scsi_version, + 5), DEFINE_BLOCK_CHS_PROPERTIES(SCSIDiskState, qdev.conf), DEFINE_PROP_END_OF_LIST(), }; @@ -2997,6 +3010,8 @@ static Property scsi_cd_properties[] = { DEFINE_PROP_UINT16("port_index", SCSIDiskState, port_index, 0), DEFINE_PROP_UINT64("max_io_size", SCSIDiskState, max_io_size, DEFAULT_MAX_IO_SIZE), + DEFINE_PROP_INT32("scsi_version", SCSIDiskState, qdev.default_scsi_version, + 5), DEFINE_PROP_END_OF_LIST(), }; @@ -3025,6 +3040,8 @@ static Property scsi_block_properties[] = { DEFINE_PROP_DRIVE("drive", SCSIDiskState, qdev.conf.blk), DEFINE_PROP_BOOL("share-rw", SCSIDiskState, qdev.conf.share_rw, false), DEFINE_PROP_UINT16("rotation_rate", SCSIDiskState, rotation_rate, 0), + DEFINE_PROP_INT32("scsi_version", SCSIDiskState, qdev.default_scsi_version, + 5), DEFINE_PROP_END_OF_LIST(), }; @@ -3065,6 +3082,8 @@ static Property scsi_disk_properties[] = { DEFAULT_MAX_UNMAP_SIZE), DEFINE_PROP_UINT64("max_io_size", SCSIDiskState, max_io_size, DEFAULT_MAX_IO_SIZE), + DEFINE_PROP_INT32("scsi_version", SCSIDiskState, qdev.default_scsi_version, + 5), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 4753f87..1870085 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -474,6 +474,7 @@ static void scsi_generic_reset(DeviceState *dev) { SCSIDevice *s = SCSI_DEVICE(dev); + s->scsi_version = s->default_scsi_version; scsi_device_purge_requests(s, SENSE_CODE(RESET)); } diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 7ecadda..e35137e 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -85,6 +85,8 @@ struct SCSIDevice uint64_t max_lba; uint64_t wwn; uint64_t port_wwn; + int scsi_version; + int default_scsi_version; }; extern const VMStateDescription vmstate_scsi_device; From patchwork Fri Apr 6 17:11:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895790 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HyvachHi"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Hmgn4dPSz9s0y for ; Sat, 7 Apr 2018 03:21:09 +1000 (AEST) Received: from localhost ([::1]:40837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4V2x-0007DY-CK for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:21:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Utr-0007wV-8h for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Utp-0007jJ-G3 for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:43 -0400 Received: from mail-wr0-x235.google.com ([2a00:1450:400c:c0c::235]:39562) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utp-0007hZ-5q for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:41 -0400 Received: by mail-wr0-x235.google.com with SMTP id c24so2415266wrc.6 for ; Fri, 06 Apr 2018 10:11:41 -0700 (PDT) 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=oeegdLmQ/PIm2BYXrmpuKTzjBLlphGig40DpkNscQDc=; b=HyvachHim8/7QMGMI/GWD1O44ACz1tnoULEuIW0hACUd2aTMdv6HgYb/IAaLP63OoD X29xYxR12mC+79opdYK4/HNEkpkcNCvVYsULo1qFaU+htmogfA0by/trPnEDrbvJ6h3T YS4UNmXhekvmFnYfstn4hVOuLjsV3rgCyPOX7/mUgCcAf5hKqjGWdcvGpxSSr9kFw1XU LNn8N8xwHLRPPlGCIOS4IquFdG9fPcGZF/gir1ecrycdS+nzZU4KtqMjXU7A4yj6H6je LJJC0Jg82LKCO8QXncb7zAml4cm00NxDowbFMdSUq/zO3TMakcUCHwI3g0aY1JiVwAsm Q/EA== 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=oeegdLmQ/PIm2BYXrmpuKTzjBLlphGig40DpkNscQDc=; b=U85zfmvaNqC4WzRYsAcmVZHcjPV77n/A50CF3MPk4VBaSUKEDKJcZV+zEpVkZ0K60v /bmGusX6Ga+QN1Xmu8ik+p7SrJXCx5CfXBcL1UTGDIGqQFU1re/MJMVT0rMuGsXZSwY9 mT8WpnCNbP9ri8CjyBPohrVKg+g1DlaZB/SyyMeT06u7MQ2AqRZTv5DzPHLGYFo8/NPi Ph8UCKZYywBAgf2IsiRGZd3FgCtwy0gQHC539CxfVQsDoCdxsvWKSXmVmi0KnE4AxZ5J b+w5d9r/FfDcr9fIrZ4JxJEgjVWFGaeV/Unv9yi8RF5TcOKHPqGFJtCrdrKE1f7TioS0 LtdQ== X-Gm-Message-State: AElRT7HDCF0zlRnFo9Jfq9JZyqsM2HQSE5HAYxeW5W7lA6a1Aj/VozBL uO/uZwKs/WfXs5OTOd4MQUFe0WYt X-Google-Smtp-Source: AIpwx4+f+yvfP6ssiRpYR4KMbrlb+GB71G6B0Z0vTcHXWqzJOxMyVFpS2N4SKAxAH+6wpWNSysxJZg== X-Received: by 10.223.182.18 with SMTP id f18mr18066355wre.211.1523034699717; Fri, 06 Apr 2018 10:11:39 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:38 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:12 +0200 Message-Id: <1523034681-33787-12-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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::235 Subject: [Qemu-devel] [PULL 11/20] hw/scsi: support SCSI-2 passthrough without PI 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: Daniel Henrique Barboza Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Daniel Henrique Barboza QEMU SCSI code makes assumptions about how the PROTECT and BYTCHK works in the protocol, denying support for PI (Protection Information) in case the guest OS requests it. However, in SCSI versions 2 and older, there is no PI concept in the protocol. This means that when dealing with such devices: - there is no PROTECT bit in byte 5 of the standard INQUIRY response. The whole byte is marked as "Reserved"; - there is no RDPROTECT in byte 2 of READ. We have 'Logical Unit Number' in this field instead; - there is no VRPROTECT in byte 2 of VERIFY. We have 'Logical Unit Number' in this field instead. This also means that the BYTCHK bit in this case is not related to PI. Since QEMU does not consider these changes, a SCSI passthrough using a SCSI-2 device will not work. It will mistake these fields with PI information and return Illegal Request SCSI SENSE thinking that the driver is asking for PI support. This patch fixes it by adding a new attribute called 'scsi_version' that is read from the standard INQUIRY response of passthrough devices. This allows for a version verification before applying conditions related to PI that doesn't apply for older versions. Reported-by: Dac Nguyen Signed-off-by: Daniel Henrique Barboza Message-Id: <20180327211451.14647-1-danielhb@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 2 +- hw/scsi/scsi-generic.c | 47 ++++++++++++++++++++++++++++++++++++----------- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 9400b97..ded23d3 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -3041,7 +3041,7 @@ static Property scsi_block_properties[] = { DEFINE_PROP_BOOL("share-rw", SCSIDiskState, qdev.conf.share_rw, false), DEFINE_PROP_UINT16("rotation_rate", SCSIDiskState, rotation_rate, 0), DEFINE_PROP_INT32("scsi_version", SCSIDiskState, qdev.default_scsi_version, - 5), + -1), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 1870085..381f04e 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -194,17 +194,40 @@ static void scsi_read_complete(void * opaque, int ret) r->buf[3] |= 0x80; } } - if (s->type == TYPE_DISK && - r->req.cmd.buf[0] == INQUIRY && - r->req.cmd.buf[2] == 0xb0) { - uint32_t max_transfer = - blk_get_max_transfer(s->conf.blk) / s->blocksize; - - assert(max_transfer); - stl_be_p(&r->buf[8], max_transfer); - /* Also take care of the opt xfer len. */ - stl_be_p(&r->buf[12], - MIN_NON_ZERO(max_transfer, ldl_be_p(&r->buf[12]))); + if (r->req.cmd.buf[0] == INQUIRY) { + /* + * EVPD set to zero returns the standard INQUIRY data. + * + * Check if scsi_version is unset (-1) to avoid re-defining it + * each time an INQUIRY with standard data is received. + * scsi_version is initialized with -1 in scsi_generic_reset + * and scsi_disk_reset, making sure that we'll set the + * scsi_version after a reset. If the version field of the + * INQUIRY response somehow changes after a guest reboot, + * we'll be able to keep track of it. + * + * On SCSI-2 and older, first 3 bits of byte 2 is the + * ANSI-approved version, while on later versions the + * whole byte 2 contains the version. Check if we're dealing + * with a newer version and, in that case, assign the + * whole byte. + */ + if (s->scsi_version == -1 && !(r->req.cmd.buf[1] & 0x01)) { + s->scsi_version = r->buf[2] & 0x07; + if (s->scsi_version > 2) { + s->scsi_version = r->buf[2]; + } + } + if (s->type == TYPE_DISK && r->req.cmd.buf[2] == 0xb0) { + uint32_t max_transfer = + blk_get_max_transfer(s->conf.blk) / s->blocksize; + + assert(max_transfer); + stl_be_p(&r->buf[8], max_transfer); + /* Also take care of the opt xfer len. */ + stl_be_p(&r->buf[12], + MIN_NON_ZERO(max_transfer, ldl_be_p(&r->buf[12]))); + } } scsi_req_data(&r->req, len); scsi_req_unref(&r->req); @@ -550,6 +573,8 @@ static void scsi_generic_realize(SCSIDevice *s, Error **errp) DPRINTF("block size %d\n", s->blocksize); + /* Only used by scsi-block, but initialize it nevertheless to be clean. */ + s->default_scsi_version = -1; scsi_generic_read_device_identification(s); } From patchwork Fri Apr 6 17:11:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895789 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UUQZ2Dza"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Hmgl3g0sz9s0y for ; Sat, 7 Apr 2018 03:21:06 +1000 (AEST) Received: from localhost ([::1]:40831 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4V2t-00075q-FL for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:21:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Utr-0007x0-Q4 for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Utq-0007lS-Jc for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:43 -0400 Received: from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]:38626) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utq-0007jr-CF for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:42 -0400 Received: by mail-wr0-x234.google.com with SMTP id m13so2405575wrj.5 for ; Fri, 06 Apr 2018 10:11:42 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=KLa0ZAmangj2M4w1QRVh5q6pNApjz9y3u1u7Gts3trg=; b=UUQZ2DzayvfWFLXtkTZah9e0+Mk+YNuB1L3+gKn1kFJG+QAYZAe5MYE2FCmqmJXdjZ 1iiGpx9MubBumt5Xm7tJVMQzDkcUgIJA1/oIZveXGDCp2pa6Xi6cB/q51p0mtfdj6zVi oci+4OevmeKMoDpJxKJ24BiGnF80IIaPQm9g70mB5nACCw3dDB5iy9Rp23qJbQNGE/lL jvZLVGb/jXd8NvCVc0PVoJ625KzM4DwIkfnlx765ceiH2jjjHe+wfjKResLtdoEWSSwi cfI7ftNhGcJmD9ADlAakJtJl4cm6jbn9QG1ebVancG4wa5ptH/HFHuPTCYBG73KeErha eHdw== 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:mime-version:content-transfer-encoding; bh=KLa0ZAmangj2M4w1QRVh5q6pNApjz9y3u1u7Gts3trg=; b=snRxzO/+GF3zxV9CvhO4Z/B6VzQij+U2wZbJZgFtyRWa4QmaJmiAtkurOkSZkniyJ2 AaSGPhdJ16n5C4RCcbb+c8lx+2MpUf52ozkVXzGDT7IryxLPuirz8FasshoXJwkFeAlE Vh0gVBcvOe5yVm7y4i34vrPm0y9dHfYJ+C+cQ9HIKNR3xY13MWrdtT3wYPfKZe6haR2f sXW4LOQBRjM/B0tLPnBWdLPV34BHLOmvJZlUxfKVlbJYtIxaMRYsNpAPbCWVMKvLkPob mFgXrSw/X7R3tnsTKQZPn2GIMuXAuz+e1euRBLaJBmsBTG7mAqmZutY7m3wWB0UVl19R DGgw== X-Gm-Message-State: AElRT7EQX/j6v0530ekjKNFHgnOcCQAmiy4yH1pQ51M3zLGXYJj/bYQj r4r3CWqYjRA8zhaK2ytR/9T+i/cE X-Google-Smtp-Source: AIpwx48EDJ+2nVrh78hRJJawV4HOS0G4+iUfV+v95rjFZtMYsa5KC3VfEKB0vag+krtaRZhtEKJwHQ== X-Received: by 10.223.157.129 with SMTP id p1mr13416746wre.281.1523034701043; Fri, 06 Apr 2018 10:11:41 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:40 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:13 +0200 Message-Id: <1523034681-33787-13-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::234 Subject: [Qemu-devel] [PULL 12/20] hw/dma/i82374: Avoid double creation of the 82374 controller 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé QEMU fails when used with the following command line: ./ppc64-softmmu/qemu-system-ppc64 -S -machine 40p -device i82374 qemu-system-ppc64: hw/isa/isa-bus.c:110: isa_bus_dma: Assertion `!bus->dma[0] && !bus->dma[1]' failed. The 40p machine type already creates the device i82374. If specified in the command line, it will try to create it again, hence generating the error. The function isa_bus_dma() isn't supposed to be called twice for the same bus. Check the bus doesn't already have a DMA controller registered before creating the device. Fixes: https://bugs.launchpad.net/qemu/+bug/1721224 Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20180326153441.32641-2-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/dma/i82374.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c index 83c87d9..892f655 100644 --- a/hw/dma/i82374.c +++ b/hw/dma/i82374.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/isa/isa.h" #include "hw/dma/i8257.h" @@ -118,13 +119,19 @@ static const MemoryRegionPortio i82374_portio_list[] = { static void i82374_realize(DeviceState *dev, Error **errp) { I82374State *s = I82374(dev); + ISABus *isa_bus = isa_bus_from_device(ISA_DEVICE(dev)); + + if (isa_get_dma(isa_bus, 0)) { + error_setg(errp, "DMA already initialized on ISA bus"); + return; + } + i8257_dma_init(isa_bus, true); portio_list_init(&s->port_list, OBJECT(s), i82374_portio_list, s, "i82374"); portio_list_add(&s->port_list, isa_address_space_io(&s->parent_obj), s->iobase); - i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), true); memset(s->commands, 0, sizeof(s->commands)); } From patchwork Fri Apr 6 17:11:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895780 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="pPOLfLsy"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40HmXp619tz9s0y for ; Sat, 7 Apr 2018 03:15:06 +1000 (AEST) Received: from localhost ([::1]:40652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Ux6-00021A-RO for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:15:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Uts-0007xm-KI for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Utr-0007ne-LB for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:44 -0400 Received: from mail-wr0-x235.google.com ([2a00:1450:400c:c0c::235]:35301) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utr-0007lr-CV for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:43 -0400 Received: by mail-wr0-x235.google.com with SMTP id 80so2413856wrb.2 for ; Fri, 06 Apr 2018 10:11:43 -0700 (PDT) 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=X3usq5wxuXxZEl1xo4nXHUEEX0X157f3d2lhCVoNRP0=; b=pPOLfLsyTbPvAPcTMdbSrittjiEw5NH3DrNqjCVvlC8q8VFwmNfCLxA2W5j0haYE/T 9QrtYupqM9HVjRqDxZpZ7znGVX3bNU9RGDrimRrPtFcC0rMiC4LFgOw03Nz8UWCXIkEh 5yj6gI4g+1MQAr7JCp0oPS9UbuFPTIzfYNx/Z2w7rzz0EbDQHZK8vDlrTENu1Mz2S2mM Icc1v+itIoZ3rxC8QbJkrEXve4MVzSG5hH62zH2Gc+Oel7sPMsLp5fsbTQ3zKWL1dC8J 9/0r/PZ7eEhUMbf4/V6DT9ICeXBtvIKKAOVPPD2fzM9fSmM9VSXbLX5s9t7GfSYzID6M wZmw== 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=X3usq5wxuXxZEl1xo4nXHUEEX0X157f3d2lhCVoNRP0=; b=Vx+MSx9jg4DHLoZ2JwGXfYvbFvaopT6wtDa43qyDs6FDkMty7xfTuIHDfkFiVKcQiv Pmstr3D0/rjy7x1tx21mPABD/AIdChQ7he6T9VrX2QltFJy3J0GMjj5yZeZkEJCe7d6y Yw6kvHTxBwrP/F7ngfi2uSGmi75v/9b5dCDJUV8VqpzzC3JJ76k3F5IKVtdBfcYuebi7 zm1Wmg0u/1LXS3e6h01ed+YJhMwC0DbXej51VXoVQJNqdUN7/0zVoDXwCF7fZ4g+Fw7c JVxxkTy1EgGREiAhew575rIhfRtHTElKVW1Ez/D5QIfvZe3qmkmGZzXVKdkwGKTOLs1r cBhw== X-Gm-Message-State: AElRT7ELh8sZ74qtumTXxFXT/L+6j03HU4M2j75Nm1Gul4YXAe5oOHcC vEFUc8J4/nRaDqM1+VMHeg1my/CC X-Google-Smtp-Source: AIpwx4/bAC6TMTwMZ580683MmHODWbIPwBW9p+7xb2CmbK7pTZFEXpvdzkJHzdRC/ij8QBlwyxJDog== X-Received: by 10.223.195.58 with SMTP id n55mr18291571wrf.132.1523034702115; Fri, 06 Apr 2018 10:11:42 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:41 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:14 +0200 Message-Id: <1523034681-33787-14-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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::235 Subject: [Qemu-devel] [PULL 13/20] kvmclock: fix clock_is_reliable on migration from QEMU < 2.9 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: Michael Chapman Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Michael Chapman When migrating from a pre-2.9 QEMU, no clock_is_reliable flag is transferred. We should assume that the source host has an unreliable KVM_GET_CLOCK, rather than using whatever was determined locally, to ensure that any drift from the TSC-based value calculated by the guest is corrected. Signed-off-by: Michael Chapman Message-Id: <20180406053406.774-1-mike@very.puzzling.org> Signed-off-by: Paolo Bonzini --- hw/i386/kvm/clock.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c index 1707434..7dac319 100644 --- a/hw/i386/kvm/clock.c +++ b/hw/i386/kvm/clock.c @@ -242,6 +242,19 @@ static const VMStateDescription kvmclock_reliable_get_clock = { }; /* + * When migrating, assume the source has an unreliable + * KVM_GET_CLOCK unless told otherwise. + */ +static int kvmclock_pre_load(void *opaque) +{ + KVMClockState *s = opaque; + + s->clock_is_reliable = false; + + return 0; +} + +/* * When migrating, read the clock just before migration, * so that the guest clock counts during the events * between: @@ -268,6 +281,7 @@ static const VMStateDescription kvmclock_vmsd = { .name = "kvmclock", .version_id = 1, .minimum_version_id = 1, + .pre_load = kvmclock_pre_load, .pre_save = kvmclock_pre_save, .fields = (VMStateField[]) { VMSTATE_UINT64(clock, KVMClockState), From patchwork Fri Apr 6 17:11:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895795 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="olYfGEAB"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Hmn32VCRz9s0y for ; Sat, 7 Apr 2018 03:25:43 +1000 (AEST) Received: from localhost ([::1]:40879 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4V7N-0003Tn-E3 for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:25:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Utu-0007zI-1e for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Uts-0007qI-Pt for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:46 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:51744) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Uts-0007oQ-IJ for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:44 -0400 Received: by mail-wm0-x241.google.com with SMTP id u189so4843790wmd.1 for ; Fri, 06 Apr 2018 10:11:44 -0700 (PDT) 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=NqvyzdK184r8HlaItgvyWhs4f5nx86qq/nsdaWSpsxo=; b=olYfGEABC1hxEw77tuvp1K+6UIQUPx3fslpyvTRtJs961Ocm0LJUinPdNI/wEVcYKW LXOf6ORzbauU0TrirHQz0AJ7X2/4vZ9c508Aj+Ur34K3jR3acrjQcokhMmwzGcRzkARa tckKBHrMXDNmZAy0FsaQOShOsIJSLpoewTAujGSF79QLWVfNKZnCj2SPptkRbRGSLSBN IB0WfICdrf8QAHYhvoQHomPAMGFQYefj811iC80otR/DQdi41sbD7mo52B6+Qfvd9UfW IggOfZcabEpo1strr4iqhmsdVmZLqfkALbO8OXzoaMXB7bQHVPuH21pdH7Zr0xvkMd7D TvlA== 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=NqvyzdK184r8HlaItgvyWhs4f5nx86qq/nsdaWSpsxo=; b=pb609BOXJptoYWhzb2i+YBxuhSOq0kMWQ3ylpILnk3CFtvwUGjPJPixVEmBnfmomwj s5EU8Zf//65ELFtr6ocHWSEjQRS68GLE/TTGssl43cZ4DHpvDMCHdh8VHVBHawEnG5Qc djqpgEpst5jprTlkdtYK/hpn+HyVtEt/fGVVcNer+5gK6aUVbwrSrUof57ACzOZwZNu8 T6r74Jn+5/iKPxkB87PKDX5TmkiBGSEESiP7SOdbJ31aldPeuy3XbGNEv67uXVNVORJa lZNJosi6zcVjB0e1mTBbQd0m67bWQRRpd54qexLzMhZEXR6DYSVnfferyepceiEBmmHL Vv0g== X-Gm-Message-State: ALQs6tBvxsEm/O+/lu75ZLwcf2yx9qX6r25UgfgodtheIMpDwQ04bLJE SfZxzkI1SAyVboUgy0jbgWBV5Opr X-Google-Smtp-Source: AIpwx4+Ajc7l9Vu+N6iAR5AN4nTnT5qx7OHks1faaOUDCPgjgGUSXuGHyJ9r9zlv8HKeZN798W3l2Q== X-Received: by 10.28.178.136 with SMTP id b130mr15647283wmf.68.1523034703201; Fri, 06 Apr 2018 10:11:43 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:42 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:15 +0200 Message-Id: <1523034681-33787-15-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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:c09::241 Subject: [Qemu-devel] [PULL 14/20] virtio-serial: fix heapover-flow 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: linzhecheng Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: linzhecheng Check device having the feature of VIRTIO_CONSOLE_F_EMERG_WRITE before get config->emerg_wr. It is neccessary because sizeof(virtio_console_config) is 8 byte if VirtIOSerial doesn't have the feature of VIRTIO_CONSOLE_F_EMERG_WRITE(see virtio_serial_device_realize), read/write emerg_wr will lead to heap-over-flow. Signed-off-by: linzhecheng Message-Id: <20180328133435.20112-1-linzhecheng@huawei.com> Signed-off-by: Paolo Bonzini --- hw/char/virtio-serial-bus.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 9470bd7..d2dd8ab 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -580,13 +580,16 @@ static void set_config(VirtIODevice *vdev, const uint8_t *config_data) VirtIOSerial *vser = VIRTIO_SERIAL(vdev); struct virtio_console_config *config = (struct virtio_console_config *)config_data; - uint8_t emerg_wr_lo = le32_to_cpu(config->emerg_wr); VirtIOSerialPort *port = find_first_connected_console(vser); VirtIOSerialPortClass *vsc; + uint8_t emerg_wr_lo; - if (!config->emerg_wr) { + if (!virtio_has_feature(vser->host_features, + VIRTIO_CONSOLE_F_EMERG_WRITE) || !config->emerg_wr) { return; } + + emerg_wr_lo = le32_to_cpu(config->emerg_wr); /* Make sure we don't misdetect an emergency write when the guest * does a short config write after an emergency write. */ config->emerg_wr = 0; From patchwork Fri Apr 6 17:11:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895797 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HYTxnBYb"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40HmrM3ZJRz9s0y for ; Sat, 7 Apr 2018 03:28:35 +1000 (AEST) Received: from localhost ([::1]:41094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4VA9-0005zc-E5 for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:28:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Utu-0007zv-L5 for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Utt-0007s8-RK for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:46 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:33909) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utt-0007qi-KC for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:45 -0400 Received: by mail-wm0-x244.google.com with SMTP id w2so8775092wmw.1 for ; Fri, 06 Apr 2018 10:11:45 -0700 (PDT) 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=JXIABkhXddAYxmZwUnlKOvkmXwJdVrIGloDkgSG0iWg=; b=HYTxnBYbuei1rSB3HFtUr/MXBxQ65L1eEoTg5ucKd2VaX+Vs6pZb48qgiqWIWv1VtJ oGNssn+/kSwG3xm76mUr+NjJcCp/Dy6c4lfp91/Shi58VMf9fnlM4mIncgevw4q2NUnG WD+0VkT6NLN9O3ytacN9REX6r6EqRDSjFRw7mQDEsx6dC0sZC+Li7q/S4GmbJzwJX2RH X6r3cyj2e+xcRGG0aOuDCEpb0rbfPrXNMyKpsyPDiAkLlfI3SBz/2L1Hr1LsKKPlQs0a 2tWgZ+Tp2y/X27qUUctgWaV9n2fHAkBfsCMmDyySOYQN/Rrhb1qUIm5yh89vTLUtKRr5 f7YA== 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=JXIABkhXddAYxmZwUnlKOvkmXwJdVrIGloDkgSG0iWg=; b=l4KyD6uJiL6vx4b81xdm98ADCNMsO0Y3smdMt1og6QQHKHDfPkwi4/oxEjuxvWr0U9 4V8GC4e33WeBADkNQrBDSVAL+eGLaS7BQRL7LvcUpg2WpMFiB+Mgo5rOOIRX+Go1UC2l ScPvKinaMpvqZIvNyspDjoP9A2X7u+agAtGqWBQJzbJP8xYVMWVo9HN8XTNfbgfUXDaf CATSQxeXahRCujtGAkOZ1oa2yxOFjEvarbup3QaYImGZkd9+X3dVBaPyEPi5oX52u7p6 1mstwBo2JPc8jikY0CBWF2miOY73Lxdo0KKu0nH+w/lJrwtd+xJNwtIIMfOs1C1l4yBP 5kCw== X-Gm-Message-State: AElRT7HGEWh0q0mpvE9wne8+nLeZhSsVdlmkWAOq8QBjlW11I45TEF1G g8bJCT95+fBbqiX19OoAOudRbwhK X-Google-Smtp-Source: AIpwx48gH4Iyest4lrtxd3XBKFpW4PLL4TzN0UPC0sPr2E60a3qGDM/tyaVhMLEhQy1nM2L9e+KsjA== X-Received: by 10.28.15.83 with SMTP id 80mr13765527wmp.151.1523034704285; Fri, 06 Apr 2018 10:11:44 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:43 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:16 +0200 Message-Id: <1523034681-33787-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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:c09::244 Subject: [Qemu-devel] [PULL 15/20] qemu-pr-helper: Daemonize before dropping privileges 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: Michal Privoznik Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Michal Privoznik After we've dropped privileges it might be not possible to write pidfile. For instance, if this binary is run as root (because user wants it to write pidfile to some privileged location) writing pidfile fails because privileges are dropped before we even get to that. Signed-off-by: Michal Privoznik Signed-off-by: Paolo Bonzini --- scsi/qemu-pr-helper.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index 21e1b8e..eeff80a 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -1081,13 +1081,6 @@ int main(int argc, char **argv) accept_client, NULL, NULL); -#ifdef CONFIG_LIBCAP - if (drop_privileges() < 0) { - error_report("Failed to drop privileges: %s", strerror(errno)); - exit(EXIT_FAILURE); - } -#endif - if (daemonize) { if (daemon(0, 0) < 0) { error_report("Failed to daemonize: %s", strerror(errno)); @@ -1096,6 +1089,13 @@ int main(int argc, char **argv) write_pidfile(); } +#ifdef CONFIG_LIBCAP + if (drop_privileges() < 0) { + error_report("Failed to drop privileges: %s", strerror(errno)); + exit(EXIT_FAILURE); + } +#endif + state = RUNNING; do { main_loop_wait(false); From patchwork Fri Apr 6 17:11:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895793 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fCSl3sAK"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Hml55zpHz9s1R for ; Sat, 7 Apr 2018 03:24:01 +1000 (AEST) Received: from localhost ([::1]:40867 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4V5j-0001CD-Pm for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:23:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Utv-00083b-Vz for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Utu-0007uN-Vo for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:47 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:37794) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utu-0007sh-Or for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:46 -0400 Received: by mail-wr0-x241.google.com with SMTP id l49so2417703wrl.4 for ; Fri, 06 Apr 2018 10:11:46 -0700 (PDT) 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=ZqBjaGDR4+tChyyyY4iIvEFhTRDIJ8vC+2cORf1wmvg=; b=fCSl3sAKccRsMwtZHX7YmUivpydc6FMUtNsiKnQQtD4MI+uIvBDHd/lFiMbvJTMHmr 2fdcffu9J5Dht5smLnm1hPo+eWKG61L4MlBiC0dPPfbzScUO91pVm/DL7/H3nhaYYtRN mBKZ4AMf6Bbhlq11EGPUFNJVGIXZyBe82u+C1alprMCMgsLg04jcfpZT/350AHUXeA5H QbI5wjKI87chzMEvRNLgqj0sAQ3wXTlrN+SUChDuX+JOQvpYwQKT2XtvQcLSgGtr7BwB NTj20VF5N+duyCNwJ4IhPWami2L2NbuoDoxj5cOFpoV06+0SHbyLWarRt6fCeNVyzMzp YlAw== 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=ZqBjaGDR4+tChyyyY4iIvEFhTRDIJ8vC+2cORf1wmvg=; b=GrsaUlc4uy+HF+b0/mn8MTg8vcqxEJBD359y/7OyZCraqKjCClIIM7p2DkNxGUr3uc vmANDd6Xmt4/VDKOicQojykuRMMMZBUTEayL2Kb7nORC0F1wFTro3pc0pLFTEifMdwxE 3xQ+dkzOi58e0uXEqg2MgdFnPJUuLtJtjyBguriESHZV5dpcxmdjmWjlBGFhnkhXvfp6 T1WWitQQBJT84FT8plqnpzyJObWHtQk8l9LyGJuN0HHV+GuyZBGXYvWuA/R84VYnV5wr v/CfUIOinJucJ7JM9SZk+ll4RuURAlGNhLCmBi5CPFO5Ub0FTMmoPBmJTh/l2Xrpmb7+ YzIQ== X-Gm-Message-State: AElRT7FHKdnv5Lxqbt6z/YSwIW9J5BRyZqqQEmrQxTmvgcvo/6hG7G6s Zm+QAt7rCO1rCX61AXjUKM8yVHYC X-Google-Smtp-Source: AIpwx490HSAkkBPbBH6vpSVRdD3v8OOQpiuijTyIt17IIZvxiFoPAnS8JrqYKzx2n2BajY8ZPPeIsg== X-Received: by 10.223.174.214 with SMTP id y80mr19624243wrc.68.1523034705424; Fri, 06 Apr 2018 10:11:45 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:44 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:17 +0200 Message-Id: <1523034681-33787-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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::241 Subject: [Qemu-devel] [PULL 16/20] qemu-pr-helper: Write pidfile more often 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: Michal Privoznik Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Michal Privoznik Let's write pidfile even if user did not request --daemon but they requested just --pidfile. Libvirt will use exactly this. Signed-off-by: Michal Privoznik Signed-off-by: Paolo Bonzini --- scsi/qemu-pr-helper.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index eeff80a..d0f8317 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -924,6 +924,7 @@ int main(int argc, char **argv) Error *local_err = NULL; char *trace_file = NULL; bool daemonize = false; + bool pidfile_specified = false; unsigned socket_activation; struct sigaction sa_sigterm; @@ -954,6 +955,7 @@ int main(int argc, char **argv) case 'f': g_free(pidfile); pidfile = g_strdup(optarg); + pidfile_specified = true; break; #ifdef CONFIG_LIBCAP case 'u': { @@ -1086,9 +1088,11 @@ int main(int argc, char **argv) error_report("Failed to daemonize: %s", strerror(errno)); exit(EXIT_FAILURE); } - write_pidfile(); } + if (daemonize || pidfile_specified) + write_pidfile(); + #ifdef CONFIG_LIBCAP if (drop_privileges() < 0) { error_report("Failed to drop privileges: %s", strerror(errno)); From patchwork Fri Apr 6 17:11:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895796 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HY+IOYyq"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40HmpQ6qQlz9s0y for ; Sat, 7 Apr 2018 03:26:54 +1000 (AEST) Received: from localhost ([::1]:40955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4V8X-0004bA-18 for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:26:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Utw-00084R-UB for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Utw-0007wO-1t for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:48 -0400 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:52478) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utv-0007ue-QO for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:47 -0400 Received: by mail-wm0-x231.google.com with SMTP id g8so4834567wmd.2 for ; Fri, 06 Apr 2018 10:11:47 -0700 (PDT) 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=FzcAq9jbg8c+jWFTxDUN8yi1tDuSsLjvo0U+fEITPmg=; b=HY+IOYyqBSCbeRfIxGYwXpin69/YT1yYfqaihluXPslQ70naXAH0F19kwfBUZlKfRP VBxqga+kjVntHw2YsSq4z8tLo3YE2V5dRKuIt0PI1eU17FB42Kl34iru8J07ZT+sv059 COBADmZ7c8reRnMF3mmEKYdynU9+6OnB1tnKsRiHFPQkKl1HD364CZ47DQIEptPQTmeh /b/tTb+mgw8b84tnraSCCCLBkm/P7YcPAzJTZYz9vOncqINlEuemgwOmW0vUjzNKoGQp d6G5T7R5BPtSdNuoOQ8F8FHTcxMTKbNYhokmkAQ6GTki3/xCaaZXmnRTPoPW8gQdbN2T KsbA== 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=FzcAq9jbg8c+jWFTxDUN8yi1tDuSsLjvo0U+fEITPmg=; b=R7v9vEfk9Q3Omldi0smxJCVhuE7t+Qj11lYM4vpFDWghI0UWeYVPvfjPiGvrRwWo4A 5GYBlQTGSONmRxcSoM4gbX8lGPumBTP8KuoEpDfcHvpN/oabT6XfVPdMivAwU9xHuq8o uAt/fJdsT6kRd3zg+aFdO/Y6h8JeNE4iHrIocqB88yFbFWEw+zcHCgqecyUTaFBqla0K TZKWiT4d5dLcKQzALvWdGJw+VwmbRKx2dd6dNmig6is0czIrESe8qtmvdCvoSK4ZMhKi pYF2HR5/j7GfXxYpZTBhFtGonqb846TL8JtXEnvcxrMBkAL9ch3wdyHRXTGZhUQHrk7L FF6g== X-Gm-Message-State: AElRT7EtJOWLQxYYKjVRw9QFUrp18GaOehdXESXaOOj1MmxlHxcnDNVe 8ZSE5/iTTyOmeAvbd6dgAKWiXMC7 X-Google-Smtp-Source: AIpwx4+U+xpTzSF0itR2BY+/k9NLsitVpPmGLc1bzoXhpd0e9I7VMCesc7uQi+zYnwl6Oh72tJA28A== X-Received: by 10.28.114.9 with SMTP id n9mr12674195wmc.147.1523034706469; Fri, 06 Apr 2018 10:11:46 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:45 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:18 +0200 Message-Id: <1523034681-33787-18-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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:c09::231 Subject: [Qemu-devel] [PULL 17/20] device-crash-test: Remove fixed isa-fdc entry 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: Thomas Huth Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Thomas Huth Fixed by commit b3da551 ("fdc: Exit if ISA controller does not support DMA", 2018-03-16). Signed-off-by: Thomas Huth Signed-off-by: Paolo Bonzini --- scripts/device-crash-test | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/device-crash-test b/scripts/device-crash-test index 24c7bf5..5d17dc6 100755 --- a/scripts/device-crash-test +++ b/scripts/device-crash-test @@ -217,7 +217,6 @@ ERROR_WHITELIST = [ {'exitcode':-6, 'log':r"Object .* is not an instance of type generic-pc-machine", 'loglevel':logging.ERROR}, {'exitcode':-6, 'log':r"Object .* is not an instance of type e500-ccsr", 'loglevel':logging.ERROR}, {'exitcode':-6, 'log':r"vmstate_register_with_alias_id: Assertion `!se->compat \|\| se->instance_id == 0' failed", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'device':'isa-fdc', 'loglevel':logging.ERROR, 'expected':True}, {'exitcode':-11, 'device':'isa-serial', 'loglevel':logging.ERROR, 'expected':True}, {'exitcode':-11, 'device':'mioe3680_pci', 'loglevel':logging.ERROR, 'expected':True}, {'exitcode':-11, 'device':'pcm3680_pci', 'loglevel':logging.ERROR, 'expected':True}, From patchwork Fri Apr 6 17:11:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895798 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="qCwJ21yg"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Hmsv2dYKz9s0y for ; Sat, 7 Apr 2018 03:29:55 +1000 (AEST) Received: from localhost ([::1]:41135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4VBR-0007Ho-CN for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:29:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Uu2-00089j-21 for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Utx-0007yg-5V for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:53 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:52276) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utw-0007wt-VP for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:49 -0400 Received: by mail-wm0-x241.google.com with SMTP id g8so4834676wmd.2 for ; Fri, 06 Apr 2018 10:11:48 -0700 (PDT) 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=Y5vzB5cQl6cOLPHoUz6OLvaKt6tgnr34tm+qrydpYIY=; b=qCwJ21ygifKPjuyrXYHFrbnS+kH84unC70J0A5XlrJc0m1sR/3pOWXpRStmIVrxxGh OGc/VcJ2hFPD+BhoCf5SiI1wOGOOvYadedyu7y6gI4q3CM5HyJsbky3NC7oyUIBcUpXI KHV+BG3p0q72pwfXRrRfZCds2qTCULS4XY9c/jEhEabWS6K5WWXsLbJ6EJ/7xZjDVO1k bwOYWVPHrHTq4vP+6uKHaydGjAkh1NhCEypABfqc5Qc/MAr8yokAW7OHIYIPCBCanXkL 80Lt0I7qrVKootqlI4M2xAy042wi3lIYUCUqW5KGS7OoqCWWBS7/PMXOnUvPsL8EiFhj oPGA== 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=Y5vzB5cQl6cOLPHoUz6OLvaKt6tgnr34tm+qrydpYIY=; b=LX55P+/YSdIaW/cr/LiaWpVb0WTsQH6qA3F00yAPnJasQLwAKk1luOkvx/Xz5BMPJp JbNGpYRjg55P+XFbwRl9zgO+hPEpPRf4fGJ3BaNNbvmL1s5bYl9CjsPxXXabGUXSzyhL Bdg0SRpU//PAiQwcv6BDUdsNcxgsnYxrxqS0Ng5+Kl9hI7QJjuvys2F8vsMyePe8+9Ce olsNPe23ZYrCkkQKjV/SOLeyBJDczh82/9gtrFDpNPS5+JsIR229R3/vVYWnnljHydbl KtXS4dKlecIygqaFiLXWnIY0Gq+EEeP+WF/k2hmi7HiODVpQeWC0O74gtLm5n8M5uix7 Mccw== X-Gm-Message-State: ALQs6tBSMM6pm8aiby0N4jG+indYZa4emK6GZMJkAl2+VLNX6xnEd0FW 5s3nU38p5aMpDJZfEaILaQaE8FRv X-Google-Smtp-Source: AIpwx49R70wPlM2e8wb+oIRt3E46lryWOkMPo3wbF890gsyv8Z+7yK2Q3ypqwW24d+3wE0XaHgEHGg== X-Received: by 10.28.112.11 with SMTP id l11mr3132636wmc.31.1523034707570; Fri, 06 Apr 2018 10:11:47 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:46 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:19 +0200 Message-Id: <1523034681-33787-19-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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:c09::241 Subject: [Qemu-devel] [PULL 18/20] dump: Fix build with newer gcc 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Eric Blake gcc 8 on rawhide is picky enough to complain: /home/dummy/qemu/dump.c: In function 'create_header32': /home/dummy/qemu/dump.c:817:5: error: 'strncpy' output truncated before terminating nul copying 8 bytes from a string of the same length [-Werror=stringop-truncation] strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ But we already have SIG_LEN defined as the right length without needing to do a strlen(), and memcpy() is better than strncpy() when we know we do not want a trailing NUL byte. Signed-off-by: Eric Blake Signed-off-by: Paolo Bonzini --- dump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dump.c b/dump.c index 669f715..b54cd42 100644 --- a/dump.c +++ b/dump.c @@ -814,7 +814,7 @@ static void create_header32(DumpState *s, Error **errp) size = sizeof(DiskDumpHeader32); dh = g_malloc0(size); - strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); + memcpy(dh->signature, KDUMP_SIGNATURE, SIG_LEN); dh->header_version = cpu_to_dump32(s, 6); block_size = s->dump_info.page_size; dh->block_size = cpu_to_dump32(s, block_size); @@ -926,7 +926,7 @@ static void create_header64(DumpState *s, Error **errp) size = sizeof(DiskDumpHeader64); dh = g_malloc0(size); - strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); + memcpy(dh->signature, KDUMP_SIGNATURE, SIG_LEN); dh->header_version = cpu_to_dump32(s, 6); block_size = s->dump_info.page_size; dh->block_size = cpu_to_dump32(s, block_size); From patchwork Fri Apr 6 17:11:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895794 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="IbxeuQh6"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40HmlC3sv0z9s21 for ; Sat, 7 Apr 2018 03:24:07 +1000 (AEST) Received: from localhost ([::1]:40872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4V5o-0001JA-H2 for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:24:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Uu2-00089g-1Q for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Uty-00081O-AS for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:53 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:38948) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Uty-0007zK-3Z for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:50 -0400 Received: by mail-wr0-x242.google.com with SMTP id c24so2415704wrc.6 for ; Fri, 06 Apr 2018 10:11:50 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=Pqa6ljofxGtpWFldeBtki40nVsoBWCVvbhueSBANdg0=; b=IbxeuQh6btLFSizySBt4xiZdP/2coj8q7X28GDjlm+2XcqFNwYBjaLp2rn5JAmPj9h 0nBqLiMTrqEEVq0aeY2ioxS87b3X2sZi3YTnW4FQHtp/mA6Ij0AGEHqC3Ny52yCzNdvf VN3ef2g7lGQKYRybz5ejOuPykgoFykb0IlXDZjUZJxYU76yQ1sDnhe+bwx+rAQYQFd1G I28Q5nkUeYWgyAArycOA+3544l/v4wUGNOWH/oFv1QDZpzmsDqQGNoI+TTC8wVt+UZtk A78aPSmQXBrU4hdCM85mnK3pDXEXBju+No33LGqPMj/t4VhfaFH0eKp9i7llt8o7Dr6Q mwSQ== 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:mime-version:content-transfer-encoding; bh=Pqa6ljofxGtpWFldeBtki40nVsoBWCVvbhueSBANdg0=; b=C8FtHhd5A54QLbflFDqCnITy5/tVvfWaJYIlupGJfELHkek3sIYCJfGcwK+b+LTBSX n3hDwQuue2wmS/+xVfxOS44+BF9vG2HJeF/v+/G+mw79pcoQnxLADALcIfJLF+WGnSjQ PhrXe0zogCM/WOPt5N903/JR3yo4xCd1Vz43b5Cg0oknaWlhz8vXG5mvNgUUN+Pkx6qX RPqTs71kxFDYCem7M/9ICWjmSUfR0JMhGG0hGaLewVfrV9w4ebPOT9v2iuNfH6LILDSy HdsNpe62nb+8vrkdOtgtaR80s8xCLaxG5qkqwKshAItE4/3iYAmtDc/fulF2ILlJSxpr qO0g== X-Gm-Message-State: AElRT7F6xQAEMkRX55XM48BsGAZ3R8e+WgMFz1GGXAMBK9Wh6qV7iyr6 XAJcDGUy7v8T0/OCW+0snmp/QvPo X-Google-Smtp-Source: AIpwx4/iXnJbITgm9DleoeaobKN88jsoaO0DEGfcdG7R5eQ017kpRiUbO3gAA+K70CzB3p421GNzkw== X-Received: by 10.223.129.67 with SMTP id 61mr22007807wrm.240.1523034708734; Fri, 06 Apr 2018 10:11:48 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:47 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:20 +0200 Message-Id: <1523034681-33787-20-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 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 19/20] maint: Add .mailmap entries for patches claiming list authorship 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Eric Blake The list did not author any patches, but it does rewrite the 'From:' header of messages sent from any domain with restrictive SPF policies that would otherwise prevent the message from reaching all list recipients. If a maintainer is not careful to undo the list header rewrite, and the author did not include a manual 'From:' line in the body to fix the munged header, then 'git am' happily attributes the patch to the list. Add some mailmap entries to correct the few that have escaped our attention; while we also work on improving the tooling to catch the problem in the future before a merge is even made. Also improve the comments occurring in the file, including line length improvements. Signed-off-by: Eric Blake Signed-off-by: Paolo Bonzini --- .mailmap | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.mailmap b/.mailmap index cf689b9..778a4d4 100644 --- a/.mailmap +++ b/.mailmap @@ -1,6 +1,7 @@ -# This mailmap just translates the weird addresses from the original import into git -# into proper addresses so that they are counted properly in git shortlog output. -# +# This mailmap fixes up author names/addresses. + +# The first section translates weird addresses from the original git import +# into proper addresses so that they are counted properly by git shortlog. Andrzej Zaborowski balrog Anthony Liguori aliguori Anthony Liguori Anthony Liguori @@ -15,10 +16,19 @@ Paul Burton Paul Burton Thiemo Seufer ths malc malc + # There is also a: # (no author) <(no author)@c046a42c-6fe2-441c-8c8c-71466251a162> # for the cvs2svn initialization commit e63c3dc74bf. -# + +# Next, translate a few commits where mailman rewrote the From: line due +# to strict SPF, although we prefer to avoid adding more entries like that. +Ed Swierk Ed Swierk via Qemu-devel +Ian McKellar Ian McKellar via Qemu-devel +Julia Suvorova Julia Suvorova via Qemu-devel +Justin Terry (VM) Justin Terry (VM) via Qemu-devel + + # Also list preferred name forms where people have changed their # git author config Daniel P. Berrangé From patchwork Fri Apr 6 17:11:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 895799 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="acU6QY83"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Hmxy42WTz9s1R for ; Sat, 7 Apr 2018 03:33:26 +1000 (AEST) Received: from localhost ([::1]:41333 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4VEq-0001wS-Ja for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2018 13:33:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Uu2-00089h-1f for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Utz-00083V-B2 for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:53 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:41200) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Utz-00081n-3D for qemu-devel@nongnu.org; Fri, 06 Apr 2018 13:11:51 -0400 Received: by mail-wr0-x244.google.com with SMTP id s12so2403476wrc.8 for ; Fri, 06 Apr 2018 10:11:51 -0700 (PDT) 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=cdFZZEHfIXMz8y7iK6mu1nFOYqw1VjP91AJuHjs8zv0=; b=acU6QY8314Q9Ic7f2vSyz5c2TGGEL1cOC94KHte5RRHKZ525SW3HCGip8wLi8RFgNt Wezl7iAlbTU4RQ7+m6FnG4A3LUQQF1xaX3JrZComy2FHrfIAAfNMV5f7DURxe95jaw06 wqNDj3w08LG6IigjTEz7tR/l/gtB4rzQy+3owf1U80o/oAA/ISXwva7H3s7nxqNyCT77 BlvM0wXC2GjnvrjzfleCQbfqH8hKZfE0vH5bPM4B16SeO67UpXysz2RdzEbBCz1SilhX eW+Ho/Ge8s6wjG4CoevVRecuknjJ/bUH5w8TB46QldADnXFrnogbxMc700Ss7TtUAMoo qAoA== 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=cdFZZEHfIXMz8y7iK6mu1nFOYqw1VjP91AJuHjs8zv0=; b=mhdJ2FwmhQukrbrxYRn1McdUEmPmbmk4MImneRHKASB9iaIrjINj9jHnBW8LYRhAsB mx7XTvwfgdufVhwnoagkJIE0m/V5x6YyeXOS2wTfUha5khmy6jL733FjxYWKbd8tZZph 3VZdxwY4Pz+vYhJ6FlK277NevSaMIqzds/Raz7/oNmzjPwdND1741ohTu8tf8G9nZS14 JllOitQ5xxddled1NKj9rGHS8BoVUKnPiQerxsPsF5IYp71cc78gDqua816tDuOTBi5Z /GdxmioDEvlf1GiOJaYnNbk8fIVHb9aXz46FA3Si8Pi+X+ZvepYZ1sdHvyD3yK4gr1jX RkmA== X-Gm-Message-State: AElRT7Fh90tcE1I0pZvmDv3jWuk99P3SmQTDKYonZAUQ2srZ4ZAChEeT LOr/RGUVqUMYSJCpUmaXGCK20FfX X-Google-Smtp-Source: AIpwx49P+Av62SNqZpYnPBE8tIrWtg+7KzZu3vDSs5nERC3m4/ytZtRj1dsKEJfD7H2fHk/Ik5PDMQ== X-Received: by 10.223.153.49 with SMTP id x46mr21081970wrb.224.1523034709856; Fri, 06 Apr 2018 10:11:49 -0700 (PDT) Received: from 640k.lan (94-36-194-48.adsl-ull.clienti.tiscali.it. [94.36.194.48]) by smtp.gmail.com with ESMTPSA id 24sm16286180wrt.60.2018.04.06.10.11.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 10:11:49 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 6 Apr 2018 19:11:21 +0200 Message-Id: <1523034681-33787-21-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523034681-33787-1-git-send-email-pbonzini@redhat.com> References: <1523034681-33787-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::244 Subject: [Qemu-devel] [PULL 20/20] Add missing bit for SSE instr in VEX decoding 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: Eugene Minibaev Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Eugene Minibaev The 2-byte VEX prefix imples a leading 0Fh opcode byte. Signed-off-by: Eugene Minibaev Signed-off-by: Paolo Bonzini --- target/i386/translate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index 3b7ce92..c9ed8dc 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -4563,9 +4563,11 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) #endif rex_r = (~vex2 >> 4) & 8; if (b == 0xc5) { + /* 2-byte VEX prefix: RVVVVlpp, implied 0f leading opcode byte */ vex3 = vex2; - b = x86_ldub_code(env, s); + b = x86_ldub_code(env, s) | 0x100; } else { + /* 3-byte VEX prefix: RXBmmmmm wVVVVlpp */ #ifdef TARGET_X86_64 s->rex_x = (~vex2 >> 3) & 8; s->rex_b = (~vex2 >> 2) & 8;