From patchwork Tue May 8 22:14: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: 910503 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="bsNfInUW"; 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 40gYls5F3Nz9s2t for ; Wed, 9 May 2018 08:18:17 +1000 (AEST) Received: from localhost ([::1]:53519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAw3-0004rr-7e for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:18:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAsp-0002oW-Kw for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAsn-0001GV-Af for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:55 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:39178) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAsn-0001Fk-3b; Tue, 08 May 2018 18:14:53 -0400 Received: by mail-wm0-x243.google.com with SMTP id f8-v6so24191895wmc.4; Tue, 08 May 2018 15:14:53 -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=NnSI62U3z/bWFpzNKPvd2hWJg5yhbsxtx54YVkiPgrc=; b=bsNfInUWt92B3AmjGfGFa6HSSd0FC96/E2CNDwLMzNs44tr9hSKv1P+zmRtf1fRtV7 D9IjLxoXE0hwRaAY0z4vpfWHvOBAlYyKDXAe/fMr1T2NJzdAnjxHAhciy79W//TyP8Ve fXL4SA9Wd4litdnvyJQDOMAAnQ+LQZHlkdE7U0f9FFb2DBaKS3NHDyHwu7f7s/YbeQ7G qpq7iWQ/WhcMvYknAavYth425o7Hfm0OKwnr3PEWO/wmr0nORI0oZDBtAyCmCoU2t30b ekHXWHZlxh6nURtLcpOq9iS+D7IB3nNRuzgUvFrBPf1m8TaqfNWfUKLoLoMMvqsPhpMi aoaQ== 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=NnSI62U3z/bWFpzNKPvd2hWJg5yhbsxtx54YVkiPgrc=; b=fZrM4higvz87FcrpJyDTXXYEehorea85S8nEO/lBiI75C69jWwSUrnOWaCYyW//3Zz xIYg19u94rrdI51+lMWWkXY1IITSlf0VG1LstwZaT+Pc1H0DK3vkhdnU8H8XvleCcz7M Hv1p7466h4o/p8vTVJKio67pbC39qYsl8vdZT+CU3KavfiWuGy/jRE70mb1dQNbDA5sq YS79/EOkil+yhsM98dfQ/E8mwDC2RDF0WlJkGaCtQ6MpAVhHwwqHVEOzYkDy8aSczAGM oO69hYdqITcdtCxoLkAU1X0oPBPo3almWXePRv1J8MLvfx9nt9/LaD5EhHgf8BLSGGSA bZ8g== X-Gm-Message-State: ALQs6tDbEbkgBhKb9FDsAO8sKI4QGv6R1uwgs1cV+pp/EabQFpoQLtUi fMknq0Ki44gIQNKyk4CgwmbM3/P6 X-Google-Smtp-Source: AB8JxZpMFH7r+rqQpb/WWbLx00U2zuilYq4+PhErsUb+w16Bb6QcGfBIIPJ+nYA0de71D0uxK7rJWQ== X-Received: by 2002:a50:c252:: with SMTP id t18-v6mr57200741edf.135.1525817691767; Tue, 08 May 2018 15:14:51 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.14.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:14:50 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:18 +0200 Message-Id: <1525817687-34620-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 01/30] configure: recognize more rpmbuild macros 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: Olaf Hering , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Olaf Hering Extend the list of recognized, but ignored options from rpms %configure macro. This fixes build on hosts running SUSE Linux. Cc: qemu-stable@nongnu.org Signed-off-by: Olaf Hering Message-Id: <20180418075045.27393-1-olaf@aepfle.de> Signed-off-by: Paolo Bonzini --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index 1443422..83a6080 100755 --- a/configure +++ b/configure @@ -964,6 +964,8 @@ for opt do ;; --firmwarepath=*) firmwarepath="$optarg" ;; + --host=*|--build=*|\ + --disable-dependency-tracking|\ --sbindir=*|--sharedstatedir=*|\ --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) From patchwork Tue May 8 22:14: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: 910516 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="S9y4zf9n"; 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 40gYtS3q2xz9s2t for ; Wed, 9 May 2018 08:24:00 +1000 (AEST) Received: from localhost ([::1]:53553 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB1a-0002Rs-5e for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:23:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAsq-0002on-30 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAso-0001H9-WD for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:56 -0400 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:34642) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAso-0001Gy-PI for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:54 -0400 Received: by mail-wm0-x22d.google.com with SMTP id a137-v6so20816824wme.1 for ; Tue, 08 May 2018 15:14:54 -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=GW3SDe8XKvsURWQSo5HbQ2/f9qTUQvmtRUzIaJWJIDg=; b=S9y4zf9nmw7jzl7cB6ghJ158b99En0Rk97qDq1tOvoA+3SY21hXYkPTuzcFMM1ytf6 oywZKUX/hFUDffeTdYW1Db4vSzvk1zZhhRW9kTmgRxJFfOzweLVP0pufcoQCSISMxjG7 gYfYZoLGiaIVBxxl/g1Ozkju2hwq3mwrupspuoYii8z+gsQ4XVTEOFYOi1sPNCKwOpTp GEf4fLaATzKFzaSI3I18d3FH/66gUDgFDQUCcdfb1mbOQ0n5yzVnmIXYoN/2dbM5pmTk uHCfD8BUjjn0R4SPsBGO0bQP1uX1xOH4XFL0n97JIjstbSXKo93fI83KBnZnNtBiUa5R YQ0g== 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=GW3SDe8XKvsURWQSo5HbQ2/f9qTUQvmtRUzIaJWJIDg=; b=hzTf+Y3LnQwv3rpdFJIzP+zqufxCrtOmFwXfzTCYXWQ1HxvMBrUvVz8pfyxkl4vuh/ aI+uv9k8VHnfDk79GsABWZGlm8MQTyvCsYQHpbmiC7abHGmHo5SwM06vv3rONcoMhHFV iwvDn8IVEiU2StAcVWE6X56hNNIzfBgeRc5d9TC1lp4HUC0p22SJ9Td9m095dA+/td7C 9AAYCStW5Gzjv4wjYfDd3MXfk8nKfiwMFO6+njR+PSm60wSih3NOWnhVDXT+iGX5myGc gJWALo9uRLVK2EQ9DKTSAV4VcXvZPHpguX2eXgCWANpe8eUuHsnXhUVsCX9vn1tUnqhx UHHQ== X-Gm-Message-State: ALQs6tD9M6Enjrn2ZBgHYBGiMlXTiSEa3G4HUIxFjwAqR3B2ocBNQEe8 RTNpawKbOpgY2iV3CAhCGffa9wyr X-Google-Smtp-Source: AB8JxZoWmY6tO+F8MnwQTfgdhVHoy/LoqPJhKFolybxumxWlwrMK8ltfLC3Po8BzmAbrDcKAC/TFuQ== X-Received: by 2002:a50:97a3:: with SMTP id e32-v6mr56583208edb.58.1525817693381; Tue, 08 May 2018 15:14:53 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.14.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:14:52 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:19 +0200 Message-Id: <1525817687-34620-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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::22d Subject: [Qemu-devel] [PULL 02/30] cpus: Fix event order on resume of stopped guest 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: Markus Armbruster Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Markus Armbruster When resume of a stopped guest immediately runs into block device errors, the BLOCK_IO_ERROR event is sent before the RESUME event. Reproducer: 1. Create a scratch image $ dd if=/dev/zero of=scratch.img bs=1M count=100 Size doesn't actually matter. 2. Prepare blkdebug configuration: $ cat >blkdebug.conf < ' Issue QMP command 'qmp_capabilities': QMP> { "execute": "qmp_capabilities" } 5. Boot the guest. 6. In the guest, write to the scratch disk, e.g. like this: # dd if=/dev/zero of=/dev/vdb count=1 Do double-check the device specified with of= is actually the scratch device! 7. Issue QMP command 'cont': QMP> { "execute": "cont" } After step 6, I get a BLOCK_IO_ERROR event followed by a STOP event. Good. After step 7, I get BLOCK_IO_ERROR, then RESUME, then STOP. Not so good; I'd expect RESUME, then BLOCK_IO_ERROR, then STOP. The funny event order confuses libvirt: virsh -r domstate DOMAIN --reason reports "paused (unknown)" rather than "paused (I/O error)". The culprit is vm_prepare_start(). /* Ensure that a STOP/RESUME pair of events is emitted if a * vmstop request was pending. The BLOCK_IO_ERROR event, for * example, according to documentation is always followed by * the STOP event. */ if (runstate_is_running()) { qapi_event_send_stop(&error_abort); res = -1; } else { replay_enable_events(); cpu_enable_ticks(); runstate_set(RUN_STATE_RUNNING); vm_state_notify(1, RUN_STATE_RUNNING); } /* We are sending this now, but the CPUs will be resumed shortly later */ qapi_event_send_resume(&error_abort); return res; When resuming a stopped guest, we take the else branch before we get to sending RESUME. vm_state_notify() runs virtio_vmstate_change(), among other things. This restarts I/O, triggering the BLOCK_IO_ERROR event. Reshuffle vm_prepare_start() to send the RESUME event earlier. Fixes RHBZ 1566153. Cc: Paolo Bonzini Signed-off-by: Markus Armbruster Message-Id: <20180423084518.2426-1-armbru@redhat.com> Signed-off-by: Paolo Bonzini --- cpus.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cpus.c b/cpus.c index 5bcd3ec..be3a4eb 100644 --- a/cpus.c +++ b/cpus.c @@ -2043,7 +2043,6 @@ int vm_stop(RunState state) int vm_prepare_start(void) { RunState requested; - int res = 0; qemu_vmstop_requested(&requested); if (runstate_is_running() && requested == RUN_STATE__MAX) { @@ -2057,17 +2056,18 @@ int vm_prepare_start(void) */ if (runstate_is_running()) { qapi_event_send_stop(&error_abort); - res = -1; - } else { - replay_enable_events(); - cpu_enable_ticks(); - runstate_set(RUN_STATE_RUNNING); - vm_state_notify(1, RUN_STATE_RUNNING); + qapi_event_send_resume(&error_abort); + return -1; } /* We are sending this now, but the CPUs will be resumed shortly later */ qapi_event_send_resume(&error_abort); - return res; + + replay_enable_events(); + cpu_enable_ticks(); + runstate_set(RUN_STATE_RUNNING); + vm_state_notify(1, RUN_STATE_RUNNING); + return 0; } void vm_start(void) From patchwork Tue May 8 22:14: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: 910500 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="XpklhMJt"; 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 40gYj22SQBz9s3G for ; Wed, 9 May 2018 08:15:50 +1000 (AEST) Received: from localhost ([::1]:53505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAtg-0002rC-0I for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:15:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAsr-0002pe-Cl for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAsq-0001Hd-0D for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:57 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:53762) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAsp-0001HG-Pz; Tue, 08 May 2018 18:14:55 -0400 Received: by mail-wm0-x241.google.com with SMTP id a67so21142706wmf.3; Tue, 08 May 2018 15:14:55 -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=VLpWAGjlfONt03LN4EEaNlcSVAGHaIeDnHYYQeKu3V0=; b=XpklhMJtryE7Yy0Cctt7VpO3yrZbq68g8BoUzN+CI0lmdtl/eV1TwiHUlJK+8tZ2sZ wUoCt1DeErCc4zqmpVXF33Q6JZVTboqYVkjeML0z6wmtUxq7mz4d8lZoGU2TWo1xgBLV u1dS6MQj3CBZoapysCBs/32FLIaKlsNVycx1tSUuvw+3ypybH279J5CKTzNIPwPls67s ECnvYOJztEcZ6RQMuAeGGuGIEphXGiTZlQolDKhxlRDiIhJpKV1DwhR2BCQCrRqeQNlW ho5vBY4Aje1mxZMkO8jk7IlyaDRcN0l1eGUrA/EV91hg8nknzhwFfxMM/fNChf/cMwWR zFnw== 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=VLpWAGjlfONt03LN4EEaNlcSVAGHaIeDnHYYQeKu3V0=; b=GT+dWHCajHKL6OtQh/nFJw7rWuFkC0dUpRIBRSFcjgg2R3b3+2vLNW9HS5p0q+lwcO H/OqEd0QAWLpK+cVlMiYZ2aXTzhRWLoNM/lyF0y7A/4gaAf+FoB/RE/LWm1z4J+kKwKo NT22cfOUUmkBs40xVtj7I/oyjrYsprBB0kv7tt6NcX4PVwdglAz6o8XCG75kFqnPNW7r LobBapfoihoFZkVC5r3KdnIvzuU+B3lqDx5+bq7CcZgJYQtyFBEzU94MKpNRtVEojEmu xnHVHu+KFFYkx4gvhUxairC8Vo5+WQ8px+Q/4izBP6EJMWhXP7B3Rs0rN3dD+307H+9q F+Fw== X-Gm-Message-State: ALQs6tCgfZQ3O4GKmxx36OpDTG16Qo5ShrACIMR5Tk2h7vXDut8AMtcb Gj709ssxkJa+u/164ovycVtSQoPJ X-Google-Smtp-Source: AB8JxZrjbhmv3i8568yGPUUrB8Xmd0rsG7aXJkjMJClBW4fPtLubEdNDVr13+Z/FH9hyqLELgtxVuQ== X-Received: by 2002:aa7:d5d1:: with SMTP id d17-v6mr55244955eds.312.1525817694468; Tue, 08 May 2018 15:14:54 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.14.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:14:53 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:20 +0200 Message-Id: <1525817687-34620-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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::241 Subject: [Qemu-devel] [PULL 03/30] cpus: tcg: fix never exiting loop on unplug 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?C=C3=A9dric_Le_Goater?= , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Cédric Le Goater Commit 9b0605f9837b ("cpus: tcg: unregister thread with RCU, fix exiting of loop on unplug") changed the exit condition of the loop in the vCPU thread function but forgot to remove the beginning 'while (1)' statement. The resulting code : while (1) { ... } while (!cpu->unplug || cpu_can_run(cpu)); is a sequence of two distinct two while() loops, the first not exiting in case of an unplug event. Remove the first while (1) to fix CPU unplug. Signed-off-by: Cédric Le Goater Message-Id: <20180425131828.15604-1-clg@kaod.org> Cc: qemu-stable@nongnu.org Fixes: 9b0605f9837b68fd56c7fc7c96a3a1a3b983687d Signed-off-by: Paolo Bonzini Signed-off-by: Cédric Le Goater --- cpus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index be3a4eb..d1f1629 100644 --- a/cpus.c +++ b/cpus.c @@ -1648,7 +1648,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) /* process any pending work */ cpu->exit_request = 1; - while (1) { + do { if (cpu_can_run(cpu)) { int r; qemu_mutex_unlock_iothread(); From patchwork Tue May 8 22:14:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910501 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="A/ex9R1y"; 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 40gYjB3sSjz9s2t for ; Wed, 9 May 2018 08:15:58 +1000 (AEST) Received: from localhost ([::1]:53507 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAto-0002sg-29 for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:15:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAss-0002qq-Nh for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAsr-0001Iq-7d for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:58 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35365) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAsr-0001Hu-1u for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:57 -0400 Received: by mail-wm0-x242.google.com with SMTP id o78-v6so24237585wmg.0 for ; Tue, 08 May 2018 15:14:57 -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=2K+OVR+YCz2jrFzwj2Wfw3KFNkexbOUAlHwb7rVWiUA=; b=A/ex9R1yCTe9vtriJrADrRBpXJ7vyyl+1/qNGb7z3iGxWqEMSx3YMUdNvfPcw8SblO 0THhYa8EgHP01dDPTfhGkHyhTkWBVL4zfLEaFbQks6x3wZxxo5iV+WVI0q5o1ZNb8cj2 BbK+0yLR2mt5E1xnRSBShEC6S8vBwwlFYwh1HFrWdi1+mfPSAOIxyhnfxMzXe8oX2H1o lWQRWnRAe4O0ceB4dU6S/Y7KhzdfMotOMJnoduQAYWazBK+A43wH3HbYwVAZqlIU5Zb9 WrECSyB2vwtQpUiLVm9NHFAMSskqG4hBioc1jf1PvNzQHweq9on0qoo5MFG/jl/sUxFi 3gHg== 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=2K+OVR+YCz2jrFzwj2Wfw3KFNkexbOUAlHwb7rVWiUA=; b=koI02Yr6jg7oPNGt0WxY3Bgrhy3IKHTeWd3y6QM+KCax6n5Ba7YjvbQET4QFEgJ88j rKKtoCDC4NAox6Oyu76HcG8xNieeBc26VumGqTkHHFZD8AsjJOIj9nZxKA19Odzso4e+ aPayqc+19Uuxii0lkip96mjhsLXogB/MrWsLAXaBjFbiNnotibDZ639LD5HlZrImi9Sk /9x/UWNc+KxylTwC/okFDOq/oScbfwypp4FwDHHw/2C7aG3a/FgspghMExFq0sDboFwu OjAnnURhg+CTCkNmpGsNarWzVpMk1LiMznX7XuSiU8+KjrBQznh2oeR6yx1UTgLsQgsI 0r2g== X-Gm-Message-State: ALQs6tA7vQqD/YJiXq//S7UEMU1KEkyxBibi+LNHGf36Hzde0jh6a80v IjBRdA4tc8SFGrCVFVPm0H7neNlo X-Google-Smtp-Source: AB8JxZpNcYz+3XmLvchUxkLsX9bN1M6vwZT7m2TFjPSCagC2WyIZ68hclRWvhO13a5hKcV3/01Kq+A== X-Received: by 2002:a50:87ee:: with SMTP id 43-v6mr57185337edz.1.1525817695810; Tue, 08 May 2018 15:14:55 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.14.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:14:55 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:21 +0200 Message-Id: <1525817687-34620-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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/30] checkpatch.pl: add common glib defines to typelist 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 , Vladimir Sementsov-Ogievskiy , Peter Xu Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Peter Xu Otherwise it can warn this: ERROR: space prohibited between function name and open parenthesis '(' When with things like this: typedef gboolean (*it_tree_iterator)(ITValue start, ITValue end); CC: Paolo Bonzini CC: "Daniel P. Berrangé" CC: Vladimir Sementsov-Ogievskiy CC: Fam Zheng Signed-off-by: Peter Xu Message-Id: <20180425070103.23723-1-peterx@redhat.com> Reviewed-by: Stefan Hajnoczi Reviewed-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 5b8735d..e73b4ef 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -265,8 +265,36 @@ our @typeList = ( qr{${Ident}_handler_fn}, qr{target_(?:u)?long}, qr{hwaddr}, + # external libraries qr{xml${Ident}}, qr{xendevicemodel_handle}, + # Glib definitions + qr{gchar}, + qr{gshort}, + qr{glong}, + qr{gint}, + qr{gboolean}, + qr{guchar}, + qr{gushort}, + qr{gulong}, + qr{guint}, + qr{gfloat}, + qr{gdouble}, + qr{gpointer}, + qr{gconstpointer}, + qr{gint8}, + qr{guint8}, + qr{gint16}, + qr{guint16}, + qr{gint32}, + qr{guint32}, + qr{gint64}, + qr{guint64}, + qr{gsize}, + qr{gssize}, + qr{goffset}, + qr{gintptr}, + qr{guintptr}, ); # This can be modified by sub possible. Since it can be empty, be careful From patchwork Tue May 8 22:14:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910509 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="WVhLtmX7"; 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 40gYpL0jrhz9s2t for ; Wed, 9 May 2018 08:20:26 +1000 (AEST) Received: from localhost ([::1]:53531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAy7-0007Oo-FC for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:20:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41138) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAst-0002rB-BX for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAss-0001JZ-B5 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:59 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:40906) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAss-0001JC-42 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:58 -0400 Received: by mail-wm0-x241.google.com with SMTP id j5-v6so24175698wme.5 for ; Tue, 08 May 2018 15:14:58 -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=XdU8P3iE2P0MFK9soiU0i94HvJYFXKxVRe1v7GYUoAM=; b=WVhLtmX7DnDinGl7BJt6njQ0MkDXCgjZ1gaercBTU/fNClhCsTwlliAs1gVaz7rJDw ye/RHNPCO9ef+XTju33SGkEWGQZACCBOLvgnxPBOEpq6Zo8z3SXNOUv0Zq6f/TjCnYaC v+gVUOIVXa3x6aiEdvEwBlSrc6hoYqsPiXtJ0BpbwLsaBwJhvxtIicFk8EpwKA5dGyYD 5UNqTpAWembYbWkbn/fF7idgVlebwEkXO7nPxIev9A8pIG3eWE/9ziZ3LeROK6OobRRX 4TgBCIVSssh39ctrYv6Z2cs+t6sWPGP3bqEBx/aDQNfUxz8zz+wJ45RUrZNzXXD+v0ku hCJw== 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=XdU8P3iE2P0MFK9soiU0i94HvJYFXKxVRe1v7GYUoAM=; b=EkF9o9+PX9eoAX9kNh/rnFvUtNZzMsqQyH0S0mle2zdAVYdlCuW7ERHmMXd//r7OnO yJU1KlqdiCabMT5AOCAmCzK78DrRe6a9rRPiDOtqKjOLhWEvnjwPr1dBZDWnWvAZnLZx 1lkQLO2YO7PAWpqtmrsWTwHMQnrfMJaYdwAoAxkYq1W+dOm5O4pR7hs6J6+DcCfet0ca E9X76BquZZlDULCqDLwfgn5F0oibZAr+IFDOMCV9G955GrMNiij7Z07pRRl6AwAHNQDC 1N2gLTfB97S5bZrN1yZh8rDejnkPknL/9ZdBegm2IUScQpVsgbl47aUpa09Y1JTevfli 59nw== X-Gm-Message-State: ALQs6tDqRtSYjb/RDKfNZaCLXvcvFqsAZMx2bDiC6wbRRAEatbAF+g8e jFpfzYCs09/VpqyKIjP2IMJ80/ak X-Google-Smtp-Source: AB8JxZrh6+n6rpEcCOSyFDjd3yHrGPnDceCS6EmjM7ivDN8vvJ6rSg7mLyWp7zzi6SRA9P4SaPIIcQ== X-Received: by 2002:a50:b6e2:: with SMTP id f31-v6mr57031242ede.23.1525817696853; Tue, 08 May 2018 15:14:56 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.14.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:14:56 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:22 +0200 Message-Id: <1525817687-34620-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 05/30] qom: allow object_get_canonical_path_component without parent 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" Just return NULL; any callers that cause a change in behavior would have caused an assertion failure before, so this is safe. Signed-off-by: Paolo Bonzini --- include/qom/object.h | 1 + qom/object.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 96ce81b..a0c78c7 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1302,6 +1302,7 @@ Object *object_get_internal_root(void); * * Returns: The final component in the object's canonical path. The canonical * path is the path within the composition tree starting from the root. + * %NULL if the object doesn't have a parent (and thus a canonical path). */ gchar *object_get_canonical_path_component(Object *obj); diff --git a/qom/object.c b/qom/object.c index 76a89af..0fc9720 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1644,8 +1644,9 @@ gchar *object_get_canonical_path_component(Object *obj) ObjectProperty *prop = NULL; GHashTableIter iter; - g_assert(obj); - g_assert(obj->parent != NULL); + if (obj->parent == NULL) { + return NULL; + } g_hash_table_iter_init(&iter, obj->parent->properties); while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&prop)) { From patchwork Tue May 8 22:14:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910521 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="G1iSXfKy"; 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 40gYxW3yDDz9s2t for ; Wed, 9 May 2018 08:26:39 +1000 (AEST) Received: from localhost ([::1]:53571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB49-0005ZH-1q for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:26:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAsu-0002sD-Fg for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAst-0001KW-Ew for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:00 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:35367) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAst-0001Ju-8L for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:59 -0400 Received: by mail-wm0-x244.google.com with SMTP id o78-v6so24237693wmg.0 for ; Tue, 08 May 2018 15:14:59 -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=6PSYm+s7FhR4KDDDHrL9owlCcphcfFkTCLZ7kVaomUg=; b=G1iSXfKyd+o6SHVws+e0RaoUUPkk28w0X/QV/CyfedSG6oB9ZaIzYmdNYITAz5pVAu ZHKyceM/0g75kR0UtLYX8qbJ9pcAQOxARY5qSCN659o1qowiqTXNZKcrzYxKDQDg0qHp BKEo+E/XzN304mjsGEtwAflXxhV/STgic512HhDlMaIGcT3UZEikMNEhGlp2cPHXNaIY cN/Hd18x9Tls+lnALw4nDmBkt+mT0OTjMSWWQ8J2GnO3rnpAqLfvH3tMDi9Om3L1V666 8fl6XLkkt9pUqS5WdIGU1767ZhlkCRX5wkaKwFy5uuPg2Ne3Vc6PexLm548V6SHWfK7x 854A== 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=6PSYm+s7FhR4KDDDHrL9owlCcphcfFkTCLZ7kVaomUg=; b=hRzLwr/Ca216a9akEhcfDl3/jTAGfy5jZlwkXTc0tMr7NMqnb556Ko/xbXxnAmxZlc Krju2WwcDLtKTlBC61/Xh7Or1CGWOD/EWsLZXRkzgJc3/Kl+2PTCID5OMWlI1vmOaRpI JXsJfc1PLHd2+/Cod4nCnw3aZSxpNu13BcjRnE+DfigbpM/E5xB89ydg3LcI0okKq6QH HXFR+xW/MxBx424XRcmHJ0X2SNq78IVIU/YkLGD7gKAg9vZEw0nGiFy8q7ZXxcAoj9uS I5NlDsP7AgF9+XsyMPmom1jzWN7/DcfLoM2yK07wkcZUcI4XynG0ZYKi8tzUJ8VG0VqS maJw== X-Gm-Message-State: ALQs6tD5D/8XGK6GBNPkL9TrnOEnvZ3U69Vcf7z0j5TqUQchqGpIfhHQ /lr3ug4UsCM4dek3UI/EMovnCev3 X-Google-Smtp-Source: AB8JxZrlstbz47t+lCIeEkP/6SXghuO3AtJU0xTTzV6uETE3K3Jro5jDsNhc+hYwbgmWaNeMFTFJLw== X-Received: by 2002:a50:bd84:: with SMTP id y4-v6mr44118834edh.18.1525817697941; Tue, 08 May 2018 15:14:57 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.14.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:14:57 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:23 +0200 Message-Id: <1525817687-34620-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 06/30] memdev: remove "id" 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The "id" property is unnecessary and can be replaced simply with object_get_canonical_path_component. This patch mostly undoes commit e1ff3c67e8 ("monitor: fix qmp/hmp query-memdev not reporting IDs of memory backends", 2017-01-12). Signed-off-by: Paolo Bonzini --- backends/hostmem.c | 26 -------------------------- include/sysemu/hostmem.h | 1 - numa.c | 2 +- qom/object_interfaces.c | 6 ------ 4 files changed, 1 insertion(+), 34 deletions(-) diff --git a/backends/hostmem.c b/backends/hostmem.c index 6a0c474..3627e61 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -369,24 +369,6 @@ host_memory_backend_can_be_deleted(UserCreatable *uc) } } -static char *get_id(Object *o, Error **errp) -{ - HostMemoryBackend *backend = MEMORY_BACKEND(o); - - return g_strdup(backend->id); -} - -static void set_id(Object *o, const char *str, Error **errp) -{ - HostMemoryBackend *backend = MEMORY_BACKEND(o); - - if (backend->id) { - error_setg(errp, "cannot change property value"); - return; - } - backend->id = g_strdup(str); -} - static bool host_memory_backend_get_share(Object *o, Error **errp) { HostMemoryBackend *backend = MEMORY_BACKEND(o); @@ -434,18 +416,11 @@ host_memory_backend_class_init(ObjectClass *oc, void *data) &HostMemPolicy_lookup, host_memory_backend_get_policy, host_memory_backend_set_policy, &error_abort); - object_class_property_add_str(oc, "id", get_id, set_id, &error_abort); object_class_property_add_bool(oc, "share", host_memory_backend_get_share, host_memory_backend_set_share, &error_abort); } -static void host_memory_backend_finalize(Object *o) -{ - HostMemoryBackend *backend = MEMORY_BACKEND(o); - g_free(backend->id); -} - static const TypeInfo host_memory_backend_info = { .name = TYPE_MEMORY_BACKEND, .parent = TYPE_OBJECT, @@ -454,7 +429,6 @@ static const TypeInfo host_memory_backend_info = { .class_init = host_memory_backend_class_init, .instance_size = sizeof(HostMemoryBackend), .instance_init = host_memory_backend_init, - .instance_finalize = host_memory_backend_finalize, .interfaces = (InterfaceInfo[]) { { TYPE_USER_CREATABLE }, { } diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index bc36899..5beb0ef 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -52,7 +52,6 @@ struct HostMemoryBackend { Object parent; /* protected */ - char *id; uint64_t size; bool merge, dump; bool prealloc, force_prealloc, is_mapped, share; diff --git a/numa.c b/numa.c index 70b150e..aac22a9 100644 --- a/numa.c +++ b/numa.c @@ -580,7 +580,7 @@ static int query_memdev(Object *obj, void *opaque) m->value = g_malloc0(sizeof(*m->value)); - m->value->id = object_property_get_str(obj, "id", NULL); + m->value->id = object_get_canonical_path_component(obj); m->value->has_id = !!m->value->id; m->value->size = object_property_get_uint(obj, "size", diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 980ffc2..72b97a8 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -65,12 +65,6 @@ Object *user_creatable_add_type(const char *type, const char *id, assert(qdict); obj = object_new(type); - if (object_property_find(obj, "id", NULL)) { - object_property_set_str(obj, id, "id", &local_err); - if (local_err) { - goto out; - } - } visit_start_struct(v, NULL, NULL, 0, &local_err); if (local_err) { goto out; From patchwork Tue May 8 22:14:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910529 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="T4uPxk3J"; 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 40gZ5v6CH7z9s3G for ; Wed, 9 May 2018 08:33:55 +1000 (AEST) Received: from localhost ([::1]:53609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGBBB-0002pW-Dr for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:33:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAt1-000306-UF for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAsv-0001Li-JO for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:07 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:39179) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAsv-0001LG-7d for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:01 -0400 Received: by mail-wm0-x243.google.com with SMTP id f8-v6so24192267wmc.4 for ; Tue, 08 May 2018 15:15:01 -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=W8z6C05L+aU36yjMAQnZYFRDHlgktnMju9Cm2jUlenA=; b=T4uPxk3Jptev9pbZBueOSOmLzaCRJWuTFxXnROhGoUicWB5Xs04UI8bqlWNZKB72EM nWydLmFAbPdLknex+lsXGkQqATTfIJwkbdTc1Ic9YR1h+TWRbqTcgQCslS9pAxe+Ma19 meuq8mpPJOH7yagfgmyIaqss5Q72yRktU9cFc+f9DV1DJ8uvTOr3kc8ettJTGq/ujz+b 9VQ/RtDvTuABP6C+xGm7106MP5r/QRSgbDB9eeXwRhwuTpJaI8aJuscWb9X35Wj14Gii fFdDADn+Pl01UdMhpvObn/Vi3aphclhDZGvbw/7bNFKq0ySNI+1aG1Dbk4fl/5RmgBAa vIMA== 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=W8z6C05L+aU36yjMAQnZYFRDHlgktnMju9Cm2jUlenA=; b=FEdxZ1sOHRKPOMQZ2F6qA9dxexRmUpngVfBXC8bgH70QUnNfayEbFZUSX13T2QktYP vwSuotrIZX6vgQH9v8yEcCYW5Y3wPXtcyeSFsYmAJnsAFeWDoGs7Zc5Pb6WVKMpXNa6b 2yOo/mumFir3D+B6lkyZ1vvK15FcMKvBScg54wnLC8A2I/xli2Og912YyP1drr5GSpZt oaVaH0OLQa+FTBa77pdxhmm3mYQvkwKRs1RAgcGcMuPSmP26g9obMY3nkWMobBP24Sev nrZCP2uSZmfKwdCbVPUe6hQw6v7wSurR9XAgE8f30enbJBsaHfKpQr5Bx1QyRPcdxmrF vfCA== X-Gm-Message-State: ALQs6tB50RFTeNqOjlRVKrtuFWsGlAX4IUWmOKqiAnGQCBmZrHOB9S+m D2pTujVea9L58cZ20wIhcACg3tF9 X-Google-Smtp-Source: AB8JxZrbknESx5CYIUS29D1hl8I/bqLzfbB58WPcQR7LDqggvFzhfWQGtFIHV34EaHLt94ydzAsPeg== X-Received: by 2002:a50:b042:: with SMTP id i60-v6mr56872051edd.68.1525817699439; Tue, 08 May 2018 15:14:59 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.14.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:14:58 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:24 +0200 Message-Id: <1525817687-34620-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 07/30] exec: move memory access declarations to a common header, inline *_phys functions 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" For now, this reduces the text size very slightly due to the newly-added inlining: text size before: 9301965 text size after: 9300645 Later, however, the declarations in include/exec/memory_ldst.inc.h will be reused for the MemoryRegionCache slow path functions. Signed-off-by: Paolo Bonzini --- include/exec/cpu-all.h | 75 +++++++----------- include/exec/memory.h | 153 +++++++++++------------------------- include/exec/memory_ldst.inc.h | 71 +++++++++++++++++ include/exec/memory_ldst_phys.inc.h | 147 ++++++++++++++++++++++++++++++++++ memory_ldst.inc.c | 126 ----------------------------- 5 files changed, 292 insertions(+), 280 deletions(-) create mode 100644 include/exec/memory_ldst.inc.h create mode 100644 include/exec/memory_ldst_phys.inc.h diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index f4fa94e..173edd1 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -168,51 +168,36 @@ extern unsigned long reserved_va; #else #include "exec/hwaddr.h" -uint32_t lduw_phys(AddressSpace *as, hwaddr addr); -uint32_t ldl_phys(AddressSpace *as, hwaddr addr); -uint64_t ldq_phys(AddressSpace *as, hwaddr addr); -void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val); -void stw_phys(AddressSpace *as, hwaddr addr, uint32_t val); -void stl_phys(AddressSpace *as, hwaddr addr, uint32_t val); -void stq_phys(AddressSpace *as, hwaddr addr, uint64_t val); - -uint32_t address_space_lduw(AddressSpace *as, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint32_t address_space_ldl(AddressSpace *as, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint64_t address_space_ldq(AddressSpace *as, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stl_notdirty(AddressSpace *as, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stw(AddressSpace *as, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stl(AddressSpace *as, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stq(AddressSpace *as, hwaddr addr, uint64_t val, - MemTxAttrs attrs, MemTxResult *result); - -uint32_t lduw_phys_cached(MemoryRegionCache *cache, hwaddr addr); -uint32_t ldl_phys_cached(MemoryRegionCache *cache, hwaddr addr); -uint64_t ldq_phys_cached(MemoryRegionCache *cache, hwaddr addr); -void stl_phys_notdirty_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val); -void stw_phys_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val); -void stl_phys_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val); -void stq_phys_cached(MemoryRegionCache *cache, hwaddr addr, uint64_t val); - -uint32_t address_space_lduw_cached(MemoryRegionCache *cache, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint32_t address_space_ldl_cached(MemoryRegionCache *cache, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint64_t address_space_ldq_cached(MemoryRegionCache *cache, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stl_notdirty_cached(MemoryRegionCache *cache, hwaddr addr, - uint32_t val, MemTxAttrs attrs, MemTxResult *result); -void address_space_stw_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stl_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stq_cached(MemoryRegionCache *cache, hwaddr addr, uint64_t val, - MemTxAttrs attrs, MemTxResult *result); + +#define SUFFIX +#define ARG1 as +#define ARG1_DECL AddressSpace *as +#define TARGET_ENDIANNESS +#include "exec/memory_ldst.inc.h" + +#define SUFFIX _cached +#define ARG1 cache +#define ARG1_DECL MemoryRegionCache *cache +#define TARGET_ENDIANNESS +#include "exec/memory_ldst.inc.h" + +static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val) +{ + address_space_stl_notdirty(as, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +#define SUFFIX +#define ARG1 as +#define ARG1_DECL AddressSpace *as +#define TARGET_ENDIANNESS +#include "exec/memory_ldst_phys.inc.h" + +#define SUFFIX _cached +#define ARG1 cache +#define ARG1_DECL MemoryRegionCache *cache +#define TARGET_ENDIANNESS +#include "exec/memory_ldst_phys.inc.h" #endif /* page related stuff */ diff --git a/include/exec/memory.h b/include/exec/memory.h index 31eae0a..ca361bc 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1676,49 +1676,16 @@ MemTxResult address_space_write(AddressSpace *as, hwaddr addr, * @result: location to write the success/failure of the transaction; * if NULL, this information is discarded */ -uint32_t address_space_ldub(AddressSpace *as, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint32_t address_space_lduw_le(AddressSpace *as, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint32_t address_space_lduw_be(AddressSpace *as, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint32_t address_space_ldl_le(AddressSpace *as, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint32_t address_space_ldl_be(AddressSpace *as, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint64_t address_space_ldq_le(AddressSpace *as, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint64_t address_space_ldq_be(AddressSpace *as, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stb(AddressSpace *as, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stw_le(AddressSpace *as, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stw_be(AddressSpace *as, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stl_le(AddressSpace *as, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stl_be(AddressSpace *as, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stq_le(AddressSpace *as, hwaddr addr, uint64_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stq_be(AddressSpace *as, hwaddr addr, uint64_t val, - MemTxAttrs attrs, MemTxResult *result); - -uint32_t ldub_phys(AddressSpace *as, hwaddr addr); -uint32_t lduw_le_phys(AddressSpace *as, hwaddr addr); -uint32_t lduw_be_phys(AddressSpace *as, hwaddr addr); -uint32_t ldl_le_phys(AddressSpace *as, hwaddr addr); -uint32_t ldl_be_phys(AddressSpace *as, hwaddr addr); -uint64_t ldq_le_phys(AddressSpace *as, hwaddr addr); -uint64_t ldq_be_phys(AddressSpace *as, hwaddr addr); -void stb_phys(AddressSpace *as, hwaddr addr, uint32_t val); -void stw_le_phys(AddressSpace *as, hwaddr addr, uint32_t val); -void stw_be_phys(AddressSpace *as, hwaddr addr, uint32_t val); -void stl_le_phys(AddressSpace *as, hwaddr addr, uint32_t val); -void stl_be_phys(AddressSpace *as, hwaddr addr, uint32_t val); -void stq_le_phys(AddressSpace *as, hwaddr addr, uint64_t val); -void stq_be_phys(AddressSpace *as, hwaddr addr, uint64_t val); + +#define SUFFIX +#define ARG1 as +#define ARG1_DECL AddressSpace *as +#include "exec/memory_ldst.inc.h" + +#define SUFFIX +#define ARG1 as +#define ARG1_DECL AddressSpace *as +#include "exec/memory_ldst_phys.inc.h" struct MemoryRegionCache { hwaddr xlat; @@ -1728,6 +1695,40 @@ struct MemoryRegionCache { #define MEMORY_REGION_CACHE_INVALID ((MemoryRegionCache) { .as = NULL }) +/* address_space_ld*_cached: load from a cached #MemoryRegion + * address_space_st*_cached: store into a cached #MemoryRegion + * + * These functions perform a load or store of the byte, word, + * longword or quad to the specified address. The address is + * a physical address in the AddressSpace, but it must lie within + * a #MemoryRegion that was mapped with address_space_cache_init. + * + * The _le suffixed functions treat the data as little endian; + * _be indicates big endian; no suffix indicates "same endianness + * as guest CPU". + * + * The "guest CPU endianness" accessors are deprecated for use outside + * target-* code; devices should be CPU-agnostic and use either the LE + * or the BE accessors. + * + * @cache: previously initialized #MemoryRegionCache to be accessed + * @addr: address within the address space + * @val: data value, for stores + * @attrs: memory transaction attributes + * @result: location to write the success/failure of the transaction; + * if NULL, this information is discarded + */ + +#define SUFFIX _cached +#define ARG1 cache +#define ARG1_DECL MemoryRegionCache *cache +#include "exec/memory_ldst.inc.h" + +#define SUFFIX _cached +#define ARG1 cache +#define ARG1_DECL MemoryRegionCache *cache +#include "exec/memory_ldst_phys.inc.h" + /* address_space_cache_init: prepare for repeated access to a physical * memory region * @@ -1772,72 +1773,6 @@ void address_space_cache_invalidate(MemoryRegionCache *cache, */ void address_space_cache_destroy(MemoryRegionCache *cache); -/* address_space_ld*_cached: load from a cached #MemoryRegion - * address_space_st*_cached: store into a cached #MemoryRegion - * - * These functions perform a load or store of the byte, word, - * longword or quad to the specified address. The address is - * a physical address in the AddressSpace, but it must lie within - * a #MemoryRegion that was mapped with address_space_cache_init. - * - * The _le suffixed functions treat the data as little endian; - * _be indicates big endian; no suffix indicates "same endianness - * as guest CPU". - * - * The "guest CPU endianness" accessors are deprecated for use outside - * target-* code; devices should be CPU-agnostic and use either the LE - * or the BE accessors. - * - * @cache: previously initialized #MemoryRegionCache to be accessed - * @addr: address within the address space - * @val: data value, for stores - * @attrs: memory transaction attributes - * @result: location to write the success/failure of the transaction; - * if NULL, this information is discarded - */ -uint32_t address_space_ldub_cached(MemoryRegionCache *cache, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint32_t address_space_lduw_le_cached(MemoryRegionCache *cache, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint32_t address_space_lduw_be_cached(MemoryRegionCache *cache, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint32_t address_space_ldl_le_cached(MemoryRegionCache *cache, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint32_t address_space_ldl_be_cached(MemoryRegionCache *cache, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint64_t address_space_ldq_le_cached(MemoryRegionCache *cache, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -uint64_t address_space_ldq_be_cached(MemoryRegionCache *cache, hwaddr addr, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stb_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stw_le_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stw_be_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stl_le_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stl_be_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stq_le_cached(MemoryRegionCache *cache, hwaddr addr, uint64_t val, - MemTxAttrs attrs, MemTxResult *result); -void address_space_stq_be_cached(MemoryRegionCache *cache, hwaddr addr, uint64_t val, - MemTxAttrs attrs, MemTxResult *result); - -uint32_t ldub_phys_cached(MemoryRegionCache *cache, hwaddr addr); -uint32_t lduw_le_phys_cached(MemoryRegionCache *cache, hwaddr addr); -uint32_t lduw_be_phys_cached(MemoryRegionCache *cache, hwaddr addr); -uint32_t ldl_le_phys_cached(MemoryRegionCache *cache, hwaddr addr); -uint32_t ldl_be_phys_cached(MemoryRegionCache *cache, hwaddr addr); -uint64_t ldq_le_phys_cached(MemoryRegionCache *cache, hwaddr addr); -uint64_t ldq_be_phys_cached(MemoryRegionCache *cache, hwaddr addr); -void stb_phys_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val); -void stw_le_phys_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val); -void stw_be_phys_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val); -void stl_le_phys_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val); -void stl_be_phys_cached(MemoryRegionCache *cache, hwaddr addr, uint32_t val); -void stq_le_phys_cached(MemoryRegionCache *cache, hwaddr addr, uint64_t val); -void stq_be_phys_cached(MemoryRegionCache *cache, hwaddr addr, uint64_t val); /* address_space_get_iotlb_entry: translate an address into an IOTLB * entry. Should be called from an RCU critical section. */ diff --git a/include/exec/memory_ldst.inc.h b/include/exec/memory_ldst.inc.h new file mode 100644 index 0000000..272c20f --- /dev/null +++ b/include/exec/memory_ldst.inc.h @@ -0,0 +1,71 @@ +/* + * Physical memory access templates + * + * Copyright (c) 2003 Fabrice Bellard + * Copyright (c) 2015 Linaro, Inc. + * Copyright (c) 2016 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifdef TARGET_ENDIANNESS +extern uint32_t glue(address_space_lduw, SUFFIX)(ARG1_DECL, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result); +extern uint32_t glue(address_space_ldl, SUFFIX)(ARG1_DECL, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result); +extern uint64_t glue(address_space_ldq, SUFFIX)(ARG1_DECL, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result); +extern void glue(address_space_stl_notdirty, SUFFIX)(ARG1_DECL, + hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); +extern void glue(address_space_stw, SUFFIX)(ARG1_DECL, + hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); +extern void glue(address_space_stl, SUFFIX)(ARG1_DECL, + hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); +extern void glue(address_space_stq, SUFFIX)(ARG1_DECL, + hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result); +#else +extern uint32_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result); +extern uint32_t glue(address_space_lduw_le, SUFFIX)(ARG1_DECL, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result); +extern uint32_t glue(address_space_lduw_be, SUFFIX)(ARG1_DECL, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result); +extern uint32_t glue(address_space_ldl_le, SUFFIX)(ARG1_DECL, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result); +extern uint32_t glue(address_space_ldl_be, SUFFIX)(ARG1_DECL, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result); +extern uint64_t glue(address_space_ldq_le, SUFFIX)(ARG1_DECL, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result); +extern uint64_t glue(address_space_ldq_be, SUFFIX)(ARG1_DECL, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result); +extern void glue(address_space_stb, SUFFIX)(ARG1_DECL, + hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); +extern void glue(address_space_stw_le, SUFFIX)(ARG1_DECL, + hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); +extern void glue(address_space_stw_be, SUFFIX)(ARG1_DECL, + hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); +extern void glue(address_space_stl_le, SUFFIX)(ARG1_DECL, + hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); +extern void glue(address_space_stl_be, SUFFIX)(ARG1_DECL, + hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); +extern void glue(address_space_stq_le, SUFFIX)(ARG1_DECL, + hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result); +extern void glue(address_space_stq_be, SUFFIX)(ARG1_DECL, + hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result); +#endif + +#undef ARG1_DECL +#undef ARG1 +#undef SUFFIX +#undef TARGET_ENDIANNESS diff --git a/include/exec/memory_ldst_phys.inc.h b/include/exec/memory_ldst_phys.inc.h new file mode 100644 index 0000000..91f7297 --- /dev/null +++ b/include/exec/memory_ldst_phys.inc.h @@ -0,0 +1,147 @@ +/* + * Physical memory access templates + * + * Copyright (c) 2003 Fabrice Bellard + * Copyright (c) 2015 Linaro, Inc. + * Copyright (c) 2016 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifdef TARGET_ENDIANNESS +static inline uint32_t glue(ldl_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +{ + return glue(address_space_ldl, SUFFIX)(ARG1, addr, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline uint64_t glue(ldq_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +{ + return glue(address_space_ldq, SUFFIX)(ARG1, addr, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline uint32_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +{ + return glue(address_space_lduw, SUFFIX)(ARG1, addr, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline void glue(stl_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) +{ + glue(address_space_stl, SUFFIX)(ARG1, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline void glue(stw_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) +{ + glue(address_space_stw, SUFFIX)(ARG1, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline void glue(stq_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) +{ + glue(address_space_stq, SUFFIX)(ARG1, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); +} +#else +static inline uint32_t glue(ldl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +{ + return glue(address_space_ldl_le, SUFFIX)(ARG1, addr, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline uint32_t glue(ldl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +{ + return glue(address_space_ldl_be, SUFFIX)(ARG1, addr, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline uint64_t glue(ldq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +{ + return glue(address_space_ldq_le, SUFFIX)(ARG1, addr, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline uint64_t glue(ldq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +{ + return glue(address_space_ldq_be, SUFFIX)(ARG1, addr, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline uint32_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +{ + return glue(address_space_ldub, SUFFIX)(ARG1, addr, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline uint32_t glue(lduw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +{ + return glue(address_space_lduw_le, SUFFIX)(ARG1, addr, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline uint32_t glue(lduw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr) +{ + return glue(address_space_lduw_be, SUFFIX)(ARG1, addr, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline void glue(stl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) +{ + glue(address_space_stl_le, SUFFIX)(ARG1, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline void glue(stl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) +{ + glue(address_space_stl_be, SUFFIX)(ARG1, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline void glue(stb_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) +{ + glue(address_space_stb, SUFFIX)(ARG1, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline void glue(stw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) +{ + glue(address_space_stw_le, SUFFIX)(ARG1, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline void glue(stw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) +{ + glue(address_space_stw_be, SUFFIX)(ARG1, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline void glue(stq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) +{ + glue(address_space_stq_le, SUFFIX)(ARG1, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline void glue(stq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) +{ + glue(address_space_stq_be, SUFFIX)(ARG1, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); +} +#endif + +#undef ARG1_DECL +#undef ARG1 +#undef SUFFIX +#undef TARGET_ENDIANNESS diff --git a/memory_ldst.inc.c b/memory_ldst.inc.c index 5dbff9c..25d6125 100644 --- a/memory_ldst.inc.c +++ b/memory_ldst.inc.c @@ -95,24 +95,6 @@ uint32_t glue(address_space_ldl_be, SUFFIX)(ARG1_DECL, DEVICE_BIG_ENDIAN); } -uint32_t glue(ldl_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_ldl, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -uint32_t glue(ldl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_ldl_le, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -uint32_t glue(ldl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_ldl_be, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - /* warning: addr must be aligned */ static inline uint64_t glue(address_space_ldq_internal, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result, @@ -189,24 +171,6 @@ uint64_t glue(address_space_ldq_be, SUFFIX)(ARG1_DECL, DEVICE_BIG_ENDIAN); } -uint64_t glue(ldq_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_ldq, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -uint64_t glue(ldq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_ldq_le, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -uint64_t glue(ldq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_ldq_be, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - uint32_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { @@ -241,12 +205,6 @@ uint32_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, return val; } -uint32_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_ldub, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - /* warning: addr must be aligned */ static inline uint32_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result, @@ -323,24 +281,6 @@ uint32_t glue(address_space_lduw_be, SUFFIX)(ARG1_DECL, DEVICE_BIG_ENDIAN); } -uint32_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_lduw, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -uint32_t glue(lduw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_lduw_le, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -uint32_t glue(lduw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_lduw_be, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - /* warning: addr must be aligned. The ram page is not masked as dirty and the code inside is not invalidated. It is useful if the dirty bits are used to track modified PTEs */ @@ -380,12 +320,6 @@ void glue(address_space_stl_notdirty, SUFFIX)(ARG1_DECL, RCU_READ_UNLOCK(); } -void glue(stl_phys_notdirty, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) -{ - glue(address_space_stl_notdirty, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - /* warning: addr must be aligned */ static inline void glue(address_space_stl_internal, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val, MemTxAttrs attrs, @@ -460,24 +394,6 @@ void glue(address_space_stl_be, SUFFIX)(ARG1_DECL, result, DEVICE_BIG_ENDIAN); } -void glue(stl_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) -{ - glue(address_space_stl, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -void glue(stl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) -{ - glue(address_space_stl_le, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -void glue(stl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) -{ - glue(address_space_stl_be, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - void glue(address_space_stb, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) { @@ -509,12 +425,6 @@ void glue(address_space_stb, SUFFIX)(ARG1_DECL, RCU_READ_UNLOCK(); } -void glue(stb_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) -{ - glue(address_space_stb, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - /* warning: addr must be aligned */ static inline void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val, MemTxAttrs attrs, @@ -589,24 +499,6 @@ void glue(address_space_stw_be, SUFFIX)(ARG1_DECL, DEVICE_BIG_ENDIAN); } -void glue(stw_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) -{ - glue(address_space_stw, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -void glue(stw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) -{ - glue(address_space_stw_le, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -void glue(stw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) -{ - glue(address_space_stw_be, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - static void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result, enum device_endian endian) @@ -680,24 +572,6 @@ void glue(address_space_stq_be, SUFFIX)(ARG1_DECL, DEVICE_BIG_ENDIAN); } -void glue(stq_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) -{ - glue(address_space_stq, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -void glue(stq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) -{ - glue(address_space_stq_le, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -void glue(stq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) -{ - glue(address_space_stq_be, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - #undef ARG1_DECL #undef ARG1 #undef SUFFIX From patchwork Tue May 8 22:14:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910504 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="a0efE84N"; 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 40gYmb6g8jz9s3G for ; Wed, 9 May 2018 08:18:55 +1000 (AEST) Received: from localhost ([::1]:53523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAwf-0005Zp-Gl for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:18:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAsy-0002x6-RM for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAsv-0001Lt-Nz for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:04 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:35365) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAsv-0001LO-Ic for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:01 -0400 Received: by mail-wm0-x241.google.com with SMTP id o78-v6so24237797wmg.0 for ; Tue, 08 May 2018 15:15:01 -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=MSp40CTpss7IVoVC6Hne8/lZ2KCLOlSvefVxhHPqTN0=; b=a0efE84Ne47Ux/CnKVGcpbffqklaRcgqFum58LsFylEgo0tCy+sNs5tTnpymr8Yy9S F8m8HkMGhx1R2CotphhCsmcu0U5DL07x9Eg2wx7ewZym6FoLnEjsOEoz9MHUVnbOuWnx C/Z6b7LA+DKb1gLNmZuawYCUI3EviHSBdRFsiZo3nPXOVoLP3ucbMQ8qVIqsy5tYrBfP 08JFknjQtm/niHdgBYgy09rVVqrYYXmIvBNqUTVctpzZ/Qk3KBbsh2mDy9I/fUfsANxh mIZVgS038NbR7d8yppHMzgCWjtxu8Qbbds17Vvz1DNWRRIlvFrJgSGnxqg7bd0xw+FXm e1uA== 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=MSp40CTpss7IVoVC6Hne8/lZ2KCLOlSvefVxhHPqTN0=; b=VNUCEJh69nUTa8No+x6/d3VCPwyUv1XM8LZyqR3xwUmJZB/mD44XpM5PoLS+JWW4t7 fV3OJz38Cc7bL+8Mds1BlXggF9UbXNKAoKF1qJtQ2EwUHLil9QHHNhdKBB+9OfU2dHfF p4p9UXhELkTSdv/SQexXQysKlmJzr7J1sO9SVnDIn7AHh0neZHLOcph9Oy82Kz84LJ1g 8F27FyX2u5ivlfLpb4nsukP5mbMhLjdTlapRB/gKTjkT74CbQ1huh31KhhcLICCiMMXj 6e7DedoYLfcAfARQxqnxDLZbFzvPfIZvaud49EeHUZ5G4r5eUKdO/Jfgr0/jEEx33KZY 0stw== X-Gm-Message-State: ALQs6tCX32bhwf7eEkBcAhHFjfgZPWPx930koLnyu6Rk0CpcHK6X8aX0 XYxioL1GPg4itwUOav85IGfRNYuj X-Google-Smtp-Source: AB8JxZpAWspj6Bw34co6DFHPx9Z6OZadSSKt0dKEOZkeqa9cEFFsaiZqXC3iS0D5kCu+1Dt+sKO+TA== X-Received: by 2002:a50:8ecf:: with SMTP id x15-v6mr56769268edx.128.1525817700336; Tue, 08 May 2018 15:15:00 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.14.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:14:59 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:25 +0200 Message-Id: <1525817687-34620-9-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 08/30] exec: small changes to flatview_do_translate 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" Prepare for extracting the IOMMU part to a separate function. Mostly cosmetic; the only semantic change is that, if there is more than one cascaded IOMMU and the second one fails to translate, *plen_out is now adjusted according to the page mask of the first IOMMU. Reviewed-by: Peter Xu Signed-off-by: Paolo Bonzini --- exec.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/exec.c b/exec.c index c7fcefa..8354cdc 100644 --- a/exec.c +++ b/exec.c @@ -476,6 +476,7 @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x * would tell. It can be @NULL if we don't care about it. * @is_write: whether the translation operation is for write * @is_mmio: whether this can be MMIO, set true if it can + * @target_as: the address space targeted by the IOMMU * * This function is called from RCU critical section */ @@ -495,14 +496,14 @@ static MemoryRegionSection flatview_do_translate(FlatView *fv, hwaddr page_mask = (hwaddr)(-1); hwaddr plen = (hwaddr)(-1); - if (plen_out) { - plen = *plen_out; + if (!plen_out) { + plen_out = &plen; } for (;;) { section = address_space_translate_internal( - flatview_to_dispatch(fv), addr, &addr, - &plen, is_mmio); + flatview_to_dispatch(fv), addr, xlat, + plen_out, is_mmio); iommu_mr = memory_region_get_iommu(section->mr); if (!iommu_mr) { @@ -510,35 +511,29 @@ static MemoryRegionSection flatview_do_translate(FlatView *fv, } imrc = memory_region_get_iommu_class_nocheck(iommu_mr); + addr = *xlat; iotlb = imrc->translate(iommu_mr, addr, is_write ? IOMMU_WO : IOMMU_RO); - addr = ((iotlb.translated_addr & ~iotlb.addr_mask) - | (addr & iotlb.addr_mask)); - page_mask &= iotlb.addr_mask; - plen = MIN(plen, (addr | iotlb.addr_mask) - addr + 1); if (!(iotlb.perm & (1 << is_write))) { goto translate_fail; } + addr = ((iotlb.translated_addr & ~iotlb.addr_mask) + | (addr & iotlb.addr_mask)); + page_mask &= iotlb.addr_mask; + *plen_out = MIN(*plen_out, (addr | iotlb.addr_mask) - addr + 1); fv = address_space_to_flatview(iotlb.target_as); *target_as = iotlb.target_as; } - *xlat = addr; - - if (page_mask == (hwaddr)(-1)) { - /* Not behind an IOMMU, use default page size. */ - page_mask = ~TARGET_PAGE_MASK; - } - if (page_mask_out) { + if (page_mask == (hwaddr)(-1)) { + /* Not behind an IOMMU, use default page size. */ + page_mask = ~TARGET_PAGE_MASK; + } *page_mask_out = page_mask; } - if (plen_out) { - *plen_out = plen; - } - return *section; translate_fail: From patchwork Tue May 8 22:14:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910524 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="oRsMpH+q"; 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 40gZ064dBRz9s3G for ; Wed, 9 May 2018 08:28:54 +1000 (AEST) Received: from localhost ([::1]:53584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB6K-0007Yx-8k for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:28:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAsy-0002x8-Rq for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAsx-0001MH-00 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:04 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:50327) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAsw-0001M0-Le for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:02 -0400 Received: by mail-wm0-x244.google.com with SMTP id t11so21289531wmt.0 for ; Tue, 08 May 2018 15:15:02 -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=iRBCN3J3Aa8HcWYfkMJUgYBltCoZPfTrcIgRFV2P9oU=; b=oRsMpH+qRyfpiK/IDbMa1H73HlaGzhyXyonHKr9FGpfPSNzZoSwS2tZPUVup6VN4jk ufIXmAPzxhWiFDP9SxSq9cPLs/kfCJDFdNxDuS8Gz9xXfRTDEyyE2zx0cOu7haAGRUX9 7IInOhtgxjrdSD6HWLePVD3R/MiU2P0D0102ALrn8sGuHawE1LpLaYaqFc89hcM9/lcd uj6TkyRVs+uTVwjkc9EFoOm7tx1AITeaRBOUiKLjlHEiiwa9uSfmybnt/eUQZ1o9dvxS hRE5Ju0p2yQ5DGT2w5gl9OMUghlz7kYdhE9LbqUpZfBXhxQg/PeOpINI8ZPjA2Q4uAYR lnzg== 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=iRBCN3J3Aa8HcWYfkMJUgYBltCoZPfTrcIgRFV2P9oU=; b=Q2bDS0mvS5uXYk+E1/AUVgMT+xoeKnOEpO6d4GWP2Ee8Hx/u4zUzCA6OmgNmq0DBuN BvJI/uyGecjbMru5yE2pCSxRPWMs/jr75r/rsNEMCwHvHKQt4ptLP3oiCcVaCwEa+NK1 ADgZOon1rjdwFv+QY0wv7tIUC+tRxgcGUtwlDpArxTM0B/saalrmn1rYc0p17Pj2FBHY P/ilgPwo6yxyKPWSZdWbeXUkryT+p0d++4Rm/oZFUBr+QlPDQ6hQSeBvgF5ojONY2rsS Ozl0P58HDwPS5nPQX7UqSWWRlVh5G9k12oUtJEvgZ9CgY7USsUsNd5Cx3J14wOverytU ycHQ== X-Gm-Message-State: ALQs6tCOM/4YYBIkmeRovYi/4uwvhU8rd/eTcvjIo4bZxdmoCdz77gfy dikC17WYjydGExWiOXrbB65o8rr7 X-Google-Smtp-Source: AB8JxZoL2jI0MoI4EscgawDjmgWPv8K0BZM0LdK8tzcQNVFRptI1Us0LJ71LqdPIhTZDWBVjEMnFKQ== X-Received: by 2002:a50:bb6c:: with SMTP id y99-v6mr15568816ede.175.1525817701401; Tue, 08 May 2018 15:15:01 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:00 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:26 +0200 Message-Id: <1525817687-34620-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 09/30] exec: extract address_space_translate_iommu, fix page_mask corner case 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" This will be used to process IOMMUs in a MemoryRegionCache. This includes a small bugfix, in that the returned page_mask is now correctly -1 if the IOMMU memory region maps the entire address space directly. Previously, address_space_get_iotlb_entry would return ~TARGET_PAGE_MASK. Reviewed-by: Peter Xu Signed-off-by: Paolo Bonzini --- exec.c | 110 ++++++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 75 insertions(+), 35 deletions(-) diff --git a/exec.c b/exec.c index 8354cdc..5f98106 100644 --- a/exec.c +++ b/exec.c @@ -462,6 +462,70 @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x } /** + * address_space_translate_iommu - translate an address through an IOMMU + * memory region and then through the target address space. + * + * @iommu_mr: the IOMMU memory region that we start the translation from + * @addr: the address to be translated through the MMU + * @xlat: the translated address offset within the destination memory region. + * It cannot be %NULL. + * @plen_out: valid read/write length of the translated address. It + * cannot be %NULL. + * @page_mask_out: page mask for the translated address. This + * should only be meaningful for IOMMU translated + * addresses, since there may be huge pages that this bit + * would tell. It can be %NULL if we don't care about it. + * @is_write: whether the translation operation is for write + * @is_mmio: whether this can be MMIO, set true if it can + * @target_as: the address space targeted by the IOMMU + * + * This function is called from RCU critical section. It is the common + * part of flatview_do_translate and address_space_translate_cached. + */ +static MemoryRegionSection address_space_translate_iommu(IOMMUMemoryRegion *iommu_mr, + hwaddr *xlat, + hwaddr *plen_out, + hwaddr *page_mask_out, + bool is_write, + bool is_mmio, + AddressSpace **target_as) +{ + MemoryRegionSection *section; + hwaddr page_mask = (hwaddr)-1; + + do { + hwaddr addr = *xlat; + IOMMUMemoryRegionClass *imrc = memory_region_get_iommu_class_nocheck(iommu_mr); + IOMMUTLBEntry iotlb = imrc->translate(iommu_mr, addr, is_write ? + IOMMU_WO : IOMMU_RO); + + if (!(iotlb.perm & (1 << is_write))) { + goto unassigned; + } + + addr = ((iotlb.translated_addr & ~iotlb.addr_mask) + | (addr & iotlb.addr_mask)); + page_mask &= iotlb.addr_mask; + *plen_out = MIN(*plen_out, (addr | iotlb.addr_mask) - addr + 1); + *target_as = iotlb.target_as; + + section = address_space_translate_internal( + address_space_to_dispatch(iotlb.target_as), addr, xlat, + plen_out, is_mmio); + + iommu_mr = memory_region_get_iommu(section->mr); + } while (unlikely(iommu_mr)); + + if (page_mask_out) { + *page_mask_out = page_mask; + } + return *section; + +unassigned: + return (MemoryRegionSection) { .mr = &io_mem_unassigned }; +} + +/** * flatview_do_translate - translate an address in FlatView * * @fv: the flat view that we want to translate on @@ -489,55 +553,31 @@ static MemoryRegionSection flatview_do_translate(FlatView *fv, bool is_mmio, AddressSpace **target_as) { - IOMMUTLBEntry iotlb; MemoryRegionSection *section; IOMMUMemoryRegion *iommu_mr; - IOMMUMemoryRegionClass *imrc; - hwaddr page_mask = (hwaddr)(-1); hwaddr plen = (hwaddr)(-1); if (!plen_out) { plen_out = &plen; } - for (;;) { - section = address_space_translate_internal( - flatview_to_dispatch(fv), addr, xlat, - plen_out, is_mmio); - - iommu_mr = memory_region_get_iommu(section->mr); - if (!iommu_mr) { - break; - } - imrc = memory_region_get_iommu_class_nocheck(iommu_mr); - - addr = *xlat; - iotlb = imrc->translate(iommu_mr, addr, is_write ? - IOMMU_WO : IOMMU_RO); - if (!(iotlb.perm & (1 << is_write))) { - goto translate_fail; - } + section = address_space_translate_internal( + flatview_to_dispatch(fv), addr, xlat, + plen_out, is_mmio); - addr = ((iotlb.translated_addr & ~iotlb.addr_mask) - | (addr & iotlb.addr_mask)); - page_mask &= iotlb.addr_mask; - *plen_out = MIN(*plen_out, (addr | iotlb.addr_mask) - addr + 1); - fv = address_space_to_flatview(iotlb.target_as); - *target_as = iotlb.target_as; + iommu_mr = memory_region_get_iommu(section->mr); + if (unlikely(iommu_mr)) { + return address_space_translate_iommu(iommu_mr, xlat, + plen_out, page_mask_out, + is_write, is_mmio, + target_as); } - if (page_mask_out) { - if (page_mask == (hwaddr)(-1)) { - /* Not behind an IOMMU, use default page size. */ - page_mask = ~TARGET_PAGE_MASK; - } - *page_mask_out = page_mask; + /* Not behind an IOMMU, use default page size. */ + *page_mask_out = ~TARGET_PAGE_MASK; } return *section; - -translate_fail: - return (MemoryRegionSection) { .mr = &io_mem_unassigned }; } /* Called from RCU critical section */ From patchwork Tue May 8 22:14:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910502 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="DjCkNohe"; 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 40gYjY5PrQz9s2t for ; Wed, 9 May 2018 08:16:17 +1000 (AEST) Received: from localhost ([::1]:53513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAu7-0003Nj-9h for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:16:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAt0-0002ym-H9 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAsy-0001N7-7c for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:06 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33816) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAsx-0001MT-TB for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:04 -0400 Received: by mail-wm0-x242.google.com with SMTP id a137-v6so20817189wme.1 for ; Tue, 08 May 2018 15:15:03 -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=LpNXSD8S3Rn5TFLxgUO30t+836FzgJu0APTnSrUKwHo=; b=DjCkNohenr4Ik1t5X2VFTpRaq3K/H7Ui8U1CPVdBFSjHcs0/7Z5E1G7TWVY1nZjkLE 7LIyQvcz5KeQjwvCqIajYHpejLQKWVH2cbhj4JIfVjUbv5wfJ6wHv60xedRVt1xOPKNY Vf1YFUkoiuz4nYDIcnb7TI3gfqVESCI226Gj89Q6NYL62r9Wy3IhGzN7q1D2EWViiDuK zPq2Dw+U7+7zOhAZouLvha2mQ3uWeB3u2xU8UBDDCbf5XiTxrf82hXFPmDvuQGKNfls4 GQXzVq2Hr+UqOQkMvI4O9txx7UqW/c6oh/GzELu78smabxy+EfcqaMXBo/WX5S9xTpOG jjuw== 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=LpNXSD8S3Rn5TFLxgUO30t+836FzgJu0APTnSrUKwHo=; b=dvGzc/cKcVRV2mqF0x8wr/hp138imAmHTYNvaaIn26pUr1dckwEn2WGBak/3ERsXuk r2VjMmyss1j02iMoXIruja682H0TYsjEyZ4BMiF3nntGhXBhw5LCD/LlM70aaDwhjCvR AGJOrvNA71blO/fJ07gIKkKsfOGvwI66Btzcf/MRsd31YgkHrAtmL6Xj9gM/+gy1TcIf Kt8mS+W2wszZkcYLckgdLpRx8x4PFP7Et75c0IV2txP7z20zKRDyVCDEQRctMALVwDUl F304KIc78EhrO/n7nsBKIECS/lcYw99sYs9U5QchdWJi/NHahkTglulY5wlzqACMssDS HwiA== X-Gm-Message-State: ALQs6tCScMExF7ts/mscmzr39zn8ejuUVPtyunPK78xuhz1ttOqAjHcG C26GSlNfrWgX7bfvtdRD1jZ8GPsi X-Google-Smtp-Source: AB8JxZrQF8Nkrpl6QhnE+ZD/rAIJ94Shlx6hoLBOLXOwDI8jrN432KSJwxdHeFjA2Xajm+A8AIPoKw== X-Received: by 2002:a50:aca4:: with SMTP id x33-v6mr57006646edc.270.1525817702572; Tue, 08 May 2018 15:15:02 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:27 +0200 Message-Id: <1525817687-34620-11-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 10/30] exec: reintroduce MemoryRegion caching 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" MemoryRegionCache was reverted to "normal" address_space_* operations for 2.9, due to lack of support for IOMMUs. Reinstate the optimizations, caching only the IOMMU translation at address_cache_init but not the IOMMU lookup and target AddressSpace translation are not cached; now that MemoryRegionCache supports IOMMUs, it becomes more widely applicable too. The inlined fast path is defined in memory_ldst_cached.inc.h, while the slow path uses memory_ldst.inc.c as before. The smaller fast path causes a little code size reduction in MemoryRegionCache users: hw/virtio/virtio.o text size before: 32373 hw/virtio/virtio.o text size after: 31941 Signed-off-by: Paolo Bonzini --- exec.c | 121 ++++++++++++++++++++++++++++++---- include/exec/cpu-all.h | 6 +- include/exec/memory-internal.h | 3 + include/exec/memory.h | 58 ++++++++++++++-- include/exec/memory_ldst_cached.inc.h | 108 ++++++++++++++++++++++++++++++ memory.c | 4 +- 6 files changed, 280 insertions(+), 20 deletions(-) create mode 100644 include/exec/memory_ldst_cached.inc.h diff --git a/exec.c b/exec.c index 5f98106..ffa1099 100644 --- a/exec.c +++ b/exec.c @@ -3641,33 +3641,130 @@ int64_t address_space_cache_init(MemoryRegionCache *cache, hwaddr len, bool is_write) { - cache->len = len; - cache->as = as; - cache->xlat = addr; - return len; + AddressSpaceDispatch *d; + hwaddr l; + MemoryRegion *mr; + + assert(len > 0); + + l = len; + cache->fv = address_space_get_flatview(as); + d = flatview_to_dispatch(cache->fv); + cache->mrs = *address_space_translate_internal(d, addr, &cache->xlat, &l, true); + + mr = cache->mrs.mr; + memory_region_ref(mr); + if (memory_access_is_direct(mr, is_write)) { + l = flatview_extend_translation(cache->fv, addr, len, mr, + cache->xlat, l, is_write); + cache->ptr = qemu_ram_ptr_length(mr->ram_block, cache->xlat, &l, true); + } else { + cache->ptr = NULL; + } + + cache->len = l; + cache->is_write = is_write; + return l; } void address_space_cache_invalidate(MemoryRegionCache *cache, hwaddr addr, hwaddr access_len) { + assert(cache->is_write); + if (likely(cache->ptr)) { + invalidate_and_set_dirty(cache->mrs.mr, addr + cache->xlat, access_len); + } } void address_space_cache_destroy(MemoryRegionCache *cache) { - cache->as = NULL; + if (!cache->mrs.mr) { + return; + } + + if (xen_enabled()) { + xen_invalidate_map_cache_entry(cache->ptr); + } + memory_region_unref(cache->mrs.mr); + flatview_unref(cache->fv); + cache->mrs.mr = NULL; + cache->fv = NULL; +} + +/* Called from RCU critical section. This function has the same + * semantics as address_space_translate, but it only works on a + * predefined range of a MemoryRegion that was mapped with + * address_space_cache_init. + */ +static inline MemoryRegion *address_space_translate_cached( + MemoryRegionCache *cache, hwaddr addr, hwaddr *xlat, + hwaddr *plen, bool is_write) +{ + MemoryRegionSection section; + MemoryRegion *mr; + IOMMUMemoryRegion *iommu_mr; + AddressSpace *target_as; + + assert(!cache->ptr); + *xlat = addr + cache->xlat; + + mr = cache->mrs.mr; + iommu_mr = memory_region_get_iommu(mr); + if (!iommu_mr) { + /* MMIO region. */ + return mr; + } + + section = address_space_translate_iommu(iommu_mr, xlat, plen, + NULL, is_write, true, + &target_as); + return section.mr; +} + +/* Called from RCU critical section. address_space_read_cached uses this + * out of line function when the target is an MMIO or IOMMU region. + */ +void +address_space_read_cached_slow(MemoryRegionCache *cache, hwaddr addr, + void *buf, int len) +{ + hwaddr addr1, l; + MemoryRegion *mr; + + l = len; + mr = address_space_translate_cached(cache, addr, &addr1, &l, false); + flatview_read_continue(cache->fv, + addr, MEMTXATTRS_UNSPECIFIED, buf, len, + addr1, l, mr); +} + +/* Called from RCU critical section. address_space_write_cached uses this + * out of line function when the target is an MMIO or IOMMU region. + */ +void +address_space_write_cached_slow(MemoryRegionCache *cache, hwaddr addr, + const void *buf, int len) +{ + hwaddr addr1, l; + MemoryRegion *mr; + + l = len; + mr = address_space_translate_cached(cache, addr, &addr1, &l, true); + flatview_write_continue(cache->fv, + addr, MEMTXATTRS_UNSPECIFIED, buf, len, + addr1, l, mr); } #define ARG1_DECL MemoryRegionCache *cache #define ARG1 cache -#define SUFFIX _cached -#define TRANSLATE(addr, ...) \ - address_space_translate(cache->as, cache->xlat + (addr), __VA_ARGS__) -#define IS_DIRECT(mr, is_write) true -#define MAP_RAM(mr, ofs) qemu_map_ram_ptr((mr)->ram_block, ofs) +#define SUFFIX _cached_slow +#define TRANSLATE(...) address_space_translate_cached(cache, __VA_ARGS__) +#define IS_DIRECT(mr, is_write) memory_access_is_direct(mr, is_write) +#define MAP_RAM(mr, ofs) (cache->ptr + (ofs - cache->xlat)) #define INVALIDATE(mr, ofs, len) invalidate_and_set_dirty(mr, ofs, len) -#define RCU_READ_LOCK() rcu_read_lock() -#define RCU_READ_UNLOCK() rcu_read_unlock() +#define RCU_READ_LOCK() ((void)0) +#define RCU_READ_UNLOCK() ((void)0) #include "memory_ldst.inc.c" /* virtual memory access for debug (includes writing to ROM) */ diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 173edd1..a635f53 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -175,7 +175,7 @@ extern unsigned long reserved_va; #define TARGET_ENDIANNESS #include "exec/memory_ldst.inc.h" -#define SUFFIX _cached +#define SUFFIX _cached_slow #define ARG1 cache #define ARG1_DECL MemoryRegionCache *cache #define TARGET_ENDIANNESS @@ -193,6 +193,10 @@ static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val #define TARGET_ENDIANNESS #include "exec/memory_ldst_phys.inc.h" +/* Inline fast path for direct RAM access. */ +#define ENDIANNESS +#include "exec/memory_ldst_cached.inc.h" + #define SUFFIX _cached #define ARG1 cache #define ARG1_DECL MemoryRegionCache *cache diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h index 6a5ee42..58399b9 100644 --- a/include/exec/memory-internal.h +++ b/include/exec/memory-internal.h @@ -31,6 +31,9 @@ static inline AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as) return flatview_to_dispatch(address_space_to_flatview(as)); } +FlatView *address_space_get_flatview(AddressSpace *as); +void flatview_unref(FlatView *view); + extern const MemoryRegionOps unassigned_mem_ops; bool memory_region_access_valid(MemoryRegion *mr, hwaddr addr, diff --git a/include/exec/memory.h b/include/exec/memory.h index ca361bc..525619a 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1688,12 +1688,16 @@ MemTxResult address_space_write(AddressSpace *as, hwaddr addr, #include "exec/memory_ldst_phys.inc.h" struct MemoryRegionCache { + void *ptr; hwaddr xlat; hwaddr len; - AddressSpace *as; + FlatView *fv; + MemoryRegionSection mrs; + bool is_write; }; -#define MEMORY_REGION_CACHE_INVALID ((MemoryRegionCache) { .as = NULL }) +#define MEMORY_REGION_CACHE_INVALID ((MemoryRegionCache) { .mrs.mr = NULL }) + /* address_space_ld*_cached: load from a cached #MemoryRegion * address_space_st*_cached: store into a cached #MemoryRegion @@ -1719,11 +1723,40 @@ struct MemoryRegionCache { * if NULL, this information is discarded */ -#define SUFFIX _cached +#define SUFFIX _cached_slow #define ARG1 cache #define ARG1_DECL MemoryRegionCache *cache #include "exec/memory_ldst.inc.h" +/* Inline fast path for direct RAM access. */ +static inline uint8_t address_space_ldub_cached(MemoryRegionCache *cache, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result) +{ + assert(addr < cache->len); + if (likely(cache->ptr)) { + return ldub_p(cache->ptr + addr); + } else { + return address_space_ldub_cached_slow(cache, addr, attrs, result); + } +} + +static inline void address_space_stb_cached(MemoryRegionCache *cache, + hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) +{ + assert(addr < cache->len); + if (likely(cache->ptr)) { + stb_p(cache->ptr + addr, val); + } else { + address_space_stb_cached_slow(cache, addr, val, attrs, result); + } +} + +#define ENDIANNESS _le +#include "exec/memory_ldst_cached.inc.h" + +#define ENDIANNESS _be +#include "exec/memory_ldst_cached.inc.h" + #define SUFFIX _cached #define ARG1 cache #define ARG1_DECL MemoryRegionCache *cache @@ -1860,6 +1893,13 @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr, MemoryRegion *mr); void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr); +/* Internal functions, part of the implementation of address_space_read_cached + * and address_space_write_cached. */ +void address_space_read_cached_slow(MemoryRegionCache *cache, + hwaddr addr, void *buf, int len); +void address_space_write_cached_slow(MemoryRegionCache *cache, + hwaddr addr, const void *buf, int len); + static inline bool memory_access_is_direct(MemoryRegion *mr, bool is_write) { if (is_write) { @@ -1928,7 +1968,11 @@ address_space_read_cached(MemoryRegionCache *cache, hwaddr addr, void *buf, int len) { assert(addr < cache->len && len <= cache->len - addr); - address_space_read(cache->as, cache->xlat + addr, MEMTXATTRS_UNSPECIFIED, buf, len); + if (likely(cache->ptr)) { + memcpy(buf, cache->ptr + addr, len); + } else { + address_space_read_cached_slow(cache, addr, buf, len); + } } /** @@ -1944,7 +1988,11 @@ address_space_write_cached(MemoryRegionCache *cache, hwaddr addr, void *buf, int len) { assert(addr < cache->len && len <= cache->len - addr); - address_space_write(cache->as, cache->xlat + addr, MEMTXATTRS_UNSPECIFIED, buf, len); + if (likely(cache->ptr)) { + memcpy(cache->ptr + addr, buf, len); + } else { + address_space_write_cached_slow(cache, addr, buf, len); + } } #endif diff --git a/include/exec/memory_ldst_cached.inc.h b/include/exec/memory_ldst_cached.inc.h new file mode 100644 index 0000000..fd4bbb4 --- /dev/null +++ b/include/exec/memory_ldst_cached.inc.h @@ -0,0 +1,108 @@ +/* + * Memory access templates for MemoryRegionCache + * + * Copyright (c) 2018 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#define ADDRESS_SPACE_LD_CACHED(size) \ + glue(glue(address_space_ld, size), glue(ENDIANNESS, _cached)) +#define ADDRESS_SPACE_LD_CACHED_SLOW(size) \ + glue(glue(address_space_ld, size), glue(ENDIANNESS, _cached_slow)) +#define LD_P(size) \ + glue(glue(ld, size), glue(ENDIANNESS, _p)) + +static inline uint32_t ADDRESS_SPACE_LD_CACHED(l)(MemoryRegionCache *cache, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result) +{ + assert(addr < cache->len && 4 <= cache->len - addr); + if (likely(cache->ptr)) { + return LD_P(l)(cache->ptr + addr); + } else { + return ADDRESS_SPACE_LD_CACHED_SLOW(l)(cache, addr, attrs, result); + } +} + +static inline uint64_t ADDRESS_SPACE_LD_CACHED(q)(MemoryRegionCache *cache, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result) +{ + assert(addr < cache->len && 8 <= cache->len - addr); + if (likely(cache->ptr)) { + return LD_P(q)(cache->ptr + addr); + } else { + return ADDRESS_SPACE_LD_CACHED_SLOW(q)(cache, addr, attrs, result); + } +} + +static inline uint32_t ADDRESS_SPACE_LD_CACHED(uw)(MemoryRegionCache *cache, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result) +{ + assert(addr < cache->len && 2 <= cache->len - addr); + if (likely(cache->ptr)) { + return LD_P(uw)(cache->ptr + addr); + } else { + return ADDRESS_SPACE_LD_CACHED_SLOW(uw)(cache, addr, attrs, result); + } +} + +#undef ADDRESS_SPACE_LD_CACHED +#undef ADDRESS_SPACE_LD_CACHED_SLOW +#undef LD_P + +#define ADDRESS_SPACE_ST_CACHED(size) \ + glue(glue(address_space_st, size), glue(ENDIANNESS, _cached)) +#define ADDRESS_SPACE_ST_CACHED_SLOW(size) \ + glue(glue(address_space_st, size), glue(ENDIANNESS, _cached_slow)) +#define ST_P(size) \ + glue(glue(st, size), glue(ENDIANNESS, _p)) + +static inline void ADDRESS_SPACE_ST_CACHED(l)(MemoryRegionCache *cache, + hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) +{ + assert(addr < cache->len && 4 <= cache->len - addr); + if (likely(cache->ptr)) { + ST_P(l)(cache->ptr + addr, val); + } else { + ADDRESS_SPACE_ST_CACHED_SLOW(l)(cache, addr, val, attrs, result); + } +} + +static inline void ADDRESS_SPACE_ST_CACHED(w)(MemoryRegionCache *cache, + hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) +{ + assert(addr < cache->len && 2 <= cache->len - addr); + if (likely(cache->ptr)) { + ST_P(w)(cache->ptr + addr, val); + } else { + ADDRESS_SPACE_ST_CACHED_SLOW(w)(cache, addr, val, attrs, result); + } +} + +static inline void ADDRESS_SPACE_ST_CACHED(q)(MemoryRegionCache *cache, + hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result) +{ + assert(addr < cache->len && 8 <= cache->len - addr); + if (likely(cache->ptr)) { + ST_P(q)(cache->ptr + addr, val); + } else { + ADDRESS_SPACE_ST_CACHED_SLOW(q)(cache, addr, val, attrs, result); + } +} + +#undef ADDRESS_SPACE_ST_CACHED +#undef ADDRESS_SPACE_ST_CACHED_SLOW +#undef ST_P + +#undef ENDIANNESS diff --git a/memory.c b/memory.c index e70b64b..fc7f9b7 100644 --- a/memory.c +++ b/memory.c @@ -298,7 +298,7 @@ static bool flatview_ref(FlatView *view) return atomic_fetch_inc_nonzero(&view->ref) > 0; } -static void flatview_unref(FlatView *view) +void flatview_unref(FlatView *view) { if (atomic_fetch_dec(&view->ref) == 1) { trace_flatview_destroy_rcu(view, view->root); @@ -822,7 +822,7 @@ static void address_space_add_del_ioeventfds(AddressSpace *as, } } -static FlatView *address_space_get_flatview(AddressSpace *as) +FlatView *address_space_get_flatview(AddressSpace *as) { FlatView *view; From patchwork Tue May 8 22:14:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910527 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="NCb/OZbz"; 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 40gZ2m56xBz9s37 for ; Wed, 9 May 2018 08:31:12 +1000 (AEST) Received: from localhost ([::1]:53599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB8Y-00015M-84 for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:31:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAt0-0002yW-6Y for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAsz-0001NV-2x for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:06 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:33818) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAsy-0001NB-Ss for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:05 -0400 Received: by mail-wm0-x244.google.com with SMTP id a137-v6so20817234wme.1 for ; Tue, 08 May 2018 15:15:04 -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=N59Qz5fEql8DYRahVBdKDJGltPSXxzdf/HZI/wHBY1g=; b=NCb/OZbz08BcBJNrAxGxVg/ZKhKhOqg9n2YaTzqHPjesnnhIjVL4BUc89hDQ+qGxer QZZyFRRVpAiXwdOGKn+HuxVNa3g+DVdV+LoDMxBYI8PbKeOFctPbk9bKoN6a3FxQPx+k /PK3VdP5HmiLzJu/whylE/NRi2Ye8G9NqhSIGX5OBXCXSqJVJrATxdrW9YXdYJypGthM w7inlTi97Ar1KnDgaDvXJkMaZN6i/mvXGsTsQA+eR5flzoiOOu5zXtJ+wh88AK5DSUap DJojqiJKZfgY+BQZ5ul84E0JVqB+rWjVJ1MJw4Zoj6AvYsgAJmFFcrcSfVw1DYNerlTe S77w== 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=N59Qz5fEql8DYRahVBdKDJGltPSXxzdf/HZI/wHBY1g=; b=lEFI5nBxPwW4ooVCJpYx2pbIFqqLtOh3/f1uShdhc8SttAVP0swIJ8yD9JoekqO9aK b20bzgI6W9zo/xeHdGN1c2QCp3tdLVv8psUA7JkyUyOdqIwhZvVf2ydStKYFSNvKFJPd IuTaKIM1lZfaVVDtG+8QEpqJUje1PWW3diNGPSSKqsecAHZ3IJa9+7T9fvU1VvRFhO/l CvDwl2wo7eErZjSs/2ZQ23An4swVRXEAOni5NWDwFzpVm6BsO1T4YU9lHoOStUNqttWl Vh5DkW+F/W1YzOa/7O1Lh2ALlv4zoxsprs6cS1z33uDQwjdoTEtVEiMNPTHO3LyEsPu5 RP2g== X-Gm-Message-State: ALQs6tDtpmor7SkilcA240VwufSbrjGOp3LaznWosrhwt+iQk13bCuey m/0YXjjfmCkWh+iwkG2enUoIcPVs X-Google-Smtp-Source: AB8JxZoue0xqjIiwkv2POT26leglqhAtigPA8ZyafwkMirBTyjxTZ0sIez/KkxF0HLU+Nv2EHI+jDQ== X-Received: by 2002:a50:951d:: with SMTP id u29-v6mr57592695eda.268.1525817703609; Tue, 08 May 2018 15:15:03 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:02 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:28 +0200 Message-Id: <1525817687-34620-12-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 11/30] qemu-thread: always keep the posix wrapper layer 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: Peter Xu Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Peter Xu We will conditionally have a wrapper layer depending on whether the host has the PTHREAD_SETNAME capability. It complicates stuff. Let's keep the wrapper there; we opt out the pthread_setname_np() call only. Signed-off-by: Peter Xu Message-Id: <20180412053444.17801-1-peterx@redhat.com> Reviewed-by: Fam Zheng Signed-off-by: Paolo Bonzini --- util/qemu-thread-posix.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index b789cf3..a1c34ba 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -482,7 +482,6 @@ static void __attribute__((constructor)) qemu_thread_atexit_init(void) } -#ifdef CONFIG_PTHREAD_SETNAME_NP typedef struct { void *(*start_routine)(void *); void *arg; @@ -495,16 +494,18 @@ static void *qemu_thread_start(void *args) void *(*start_routine)(void *) = qemu_thread_args->start_routine; void *arg = qemu_thread_args->arg; +#ifdef CONFIG_PTHREAD_SETNAME_NP /* Attempt to set the threads name; note that this is for debug, so * we're not going to fail if we can't set it. */ - pthread_setname_np(pthread_self(), qemu_thread_args->name); + if (name_threads && qemu_thread_args->name) { + pthread_setname_np(pthread_self(), qemu_thread_args->name); + } +#endif g_free(qemu_thread_args->name); g_free(qemu_thread_args); return start_routine(arg); } -#endif - void qemu_thread_create(QemuThread *thread, const char *name, void *(*start_routine)(void*), @@ -513,6 +514,7 @@ void qemu_thread_create(QemuThread *thread, const char *name, sigset_t set, oldset; int err; pthread_attr_t attr; + QemuThreadArgs *qemu_thread_args; err = pthread_attr_init(&attr); if (err) { @@ -527,22 +529,13 @@ void qemu_thread_create(QemuThread *thread, const char *name, sigfillset(&set); pthread_sigmask(SIG_SETMASK, &set, &oldset); -#ifdef CONFIG_PTHREAD_SETNAME_NP - if (name_threads) { - QemuThreadArgs *qemu_thread_args; - qemu_thread_args = g_new0(QemuThreadArgs, 1); - qemu_thread_args->name = g_strdup(name); - qemu_thread_args->start_routine = start_routine; - qemu_thread_args->arg = arg; - - err = pthread_create(&thread->thread, &attr, - qemu_thread_start, qemu_thread_args); - } else -#endif - { - err = pthread_create(&thread->thread, &attr, - start_routine, arg); - } + qemu_thread_args = g_new0(QemuThreadArgs, 1); + qemu_thread_args->name = g_strdup(name); + qemu_thread_args->start_routine = start_routine; + qemu_thread_args->arg = arg; + + err = pthread_create(&thread->thread, &attr, + qemu_thread_start, qemu_thread_args); if (err) error_exit(err, __func__); From patchwork Tue May 8 22:14:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910513 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="spTeq8Ep"; 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 40gYqy5qP1z9s3Z for ; Wed, 9 May 2018 08:21:50 +1000 (AEST) Received: from localhost ([::1]:53541 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAzU-0000f2-Ch for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:21:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAt1-0002zF-2w for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAt0-0001Nz-7a for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:07 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:53765) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAt0-0001Nh-0p for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:06 -0400 Received: by mail-wm0-x242.google.com with SMTP id a67so21143224wmf.3 for ; Tue, 08 May 2018 15:15:05 -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=CJBYC3tcYZIV/fObezbvCyTm0aHrLy8dArH+GwTMO2A=; b=spTeq8EphEv4vUE1mckWiApDklly4ktre7hjegUTwUDiQPYkHn2971ULRvsjU6SAjF 7ynixVAHucxKrEuMKtSsUGslj4xzd9Ft8vPhK5K6TObnSrWsNh6ekW7OusuA+mYHMomD lHKJXeWzBuZxgPpiojSpEtd2jZmSOnK0BBEb/rQKKGb8sJnBop4SjnreZMVUydpTLEYy miXlk9uhDL0ECGj7zqc9RnJ/xIXHLg2KNHBJZ9JYphU2XYe88pciyx7TAVbI38iHG8ET 01Xb36hZC3hW55ZVHZMazSdNTdpLo9GWnPPg4RL2MbeteyQU95SPHhrSbzRZZD97VrAX +lIw== 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=CJBYC3tcYZIV/fObezbvCyTm0aHrLy8dArH+GwTMO2A=; b=ihk1aKO21c2taAoEac50ocLxzCRKyPOJY8rwMnp2I8j/AmXEWPukOnKusT5rwO1MjX ubDI6QxtW9phl9jZtQJ+NXBuDtQHQTdddn6qo6+e4Jgq+5trHC+MYw4YGJsd1zly6br4 zltWSG2Fek6+blZNi1NLm3/maxYOIKXgTmJ4fzyhtNJPJ8UpP9OoLC8n8UfY5Q7zuo4X lb4EgOAM5ZZXwKSz/s1MSREEJTirAiGyM8xF6tl7/UENAOQYj6pJafzWKeyFTOQpYSLP HtnSuVNYHz4EowSK3NpDlqmPMmkf6SNYlrj4eajabnbBwe41h0ReGCAuaP8Twoe4pW2F /ysQ== X-Gm-Message-State: ALQs6tAEMwMtkDvuMxvR0PQBdcOLjtTonuEbfNviJF1vpwo3ImSY6zr1 sYEZOovmjsbkOQHDbWKFcRxWfBwj X-Google-Smtp-Source: AB8JxZpeOHthtsihPhRc3iM3YKx11idl/Ht3qYt9ekAppikzFgBlO8RKctAY2oY8/UB6ojF+xArYlg== X-Received: by 2002:a50:85c6:: with SMTP id q6-v6mr56476487edh.86.1525817704798; Tue, 08 May 2018 15:15:04 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:04 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:29 +0200 Message-Id: <1525817687-34620-13-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 12/30] update-linux-headers: drop hyperv.h 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: Vitaly Kuznetsov , Roman Kagan Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Roman Kagan As of mainline linux commit 5a485803221777013944cbd1a7cd5c62efba3ffa "x86/hyper-v: move hyperv.h out of uapi" by Vitaly Kuznetsov, no linux uapi header includes it, so we no longer need to create a stub for it. Cc: Vitaly Kuznetsov Signed-off-by: Roman Kagan Message-Id: <20180413143354.17614-1-rkagan@virtuozzo.com> Signed-off-by: Paolo Bonzini --- scripts/update-linux-headers.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh index 5b1d8dc..b65c03f 100755 --- a/scripts/update-linux-headers.sh +++ b/scripts/update-linux-headers.sh @@ -118,9 +118,6 @@ for arch in $ARCHLIST; do cp "$tmpdir/include/asm/unistd-common.h" "$output/linux-headers/asm-arm/" fi if [ $arch = x86 ]; then - cat <<-EOF >"$output/include/standard-headers/asm-x86/hyperv.h" - /* this is a temporary placeholder until kvm_para.h stops including it */ -EOF cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-x86/" cp "$tmpdir/include/asm/unistd_x32.h" "$output/linux-headers/asm-x86/" cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-x86/" @@ -144,9 +141,6 @@ else cp "$linux/COPYING" "$output/linux-headers" fi -cat <$output/linux-headers/asm-x86/hyperv.h -#include "standard-headers/asm-x86/hyperv.h" -EOF cat <$output/linux-headers/linux/virtio_config.h #include "standard-headers/linux/virtio_config.h" EOF From patchwork Tue May 8 22:14:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910531 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="ki9S3TwO"; 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 40gZ8k6Nvvz9s3D for ; Wed, 9 May 2018 08:36:22 +1000 (AEST) Received: from localhost ([::1]:53623 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGBDY-0005RB-Hy for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:36:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAt2-00030i-73 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAt1-0001Ok-8T for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:08 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:33423) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAt1-0001O5-1W for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:07 -0400 Received: by mail-wm0-x241.google.com with SMTP id x12-v6so20840485wmc.0 for ; Tue, 08 May 2018 15:15:06 -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=EejOk23zrkp7/lgJjltwByXxyXFDx0ATFvJU3WycGls=; b=ki9S3TwOkTsrGOveEeUPbxkqXno4kZ1PLKDB7RHa3SWSOJTnuWseKX9CoUU0Tk7mmb Wlo/Ootv/onFydh/LoAiOodNsnzwu68AhG11mXN1wnyHMop9Vp8KDStBZaQkppvza+lE lvrj2bBi/3CgPa+VJSx9O3IK6YfYwsOlg1Jw3eFrvvuRE3fQLPhMSiVctApHZJWdCedK LWBNEwVCOuEw+uJPD/bstdJrkMae08L9WIUhuywLp7Jrt02VNGgO7fNV98/ak4JKs6sW GelH/p5P6BZ5vla+jtuYIvvmmTVMvTj13TM0SGIC0FQpz49kpmg1e8kVmBgYlGM5TlLd Uf5w== 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=EejOk23zrkp7/lgJjltwByXxyXFDx0ATFvJU3WycGls=; b=q+k86thMbaTq7Qh4GkFnC3d2XzZNVA4D+xewKhuipO77hEE8ODz/9EPOQC4LOh7ONo 5VYND4D5kH5UVjNLhm7FAjdUB4MNNHtewv/k+tVKXbLHB8dBmPfO4qdxxQ0NGdE2mTzH 00sFsU8L52kV2c1Cm03u5hKfXLZwgPZ3FB+0O047GtK6htJMUb3kuCSnplgDwPX3XgQp r0hGq1wszXbrIudJA23AaQMVRa7I/tNjkzXUuDLNg0gqU/n01HbraxRPKUtJTxPoboHM 8//kysUkpiVWAvGN73mrQtQomZIDAxRLWqvAdfTnMNNGvEZmSsZy1xazOGp4pexgOLgi xvJQ== X-Gm-Message-State: ALQs6tDegiEX3RKhiQp5AY3uXnKF80CYZkYY6ZID8JCjUqThqpatEdpI dNK34DIcqGPQxLCR/Q4eBZBIQsVx X-Google-Smtp-Source: AB8JxZpQKCPo+6+jbL06NUB7oFKC033x9xtM6udilsCi8CB4oW5BNk4Vo2oEQ30p+698Paq6KvCxqw== X-Received: by 2002:a50:b62c:: with SMTP id b41-v6mr57345806ede.255.1525817705769; Tue, 08 May 2018 15:15:05 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:05 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:30 +0200 Message-Id: <1525817687-34620-14-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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::241 Subject: [Qemu-devel] [PULL 13/30] accel: use g_strsplit for parsing accelerator names 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: Daniel P. Berrangé Instead of re-using the get_opt_name() method from QemuOpts to split a string on ':', just use g_strsplit(). Signed-off-by: Daniel P. Berrangé Message-Id: <20180416111743.8473-2-berrange@redhat.com> Signed-off-by: Paolo Bonzini Signed-off-by: Daniel P. Berrangé --- accel/accel.c | 16 +++++++--------- include/qemu/option.h | 1 - util/qemu-option.c | 3 ++- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/accel/accel.c b/accel/accel.c index 9cfab11..966b2d8 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -70,8 +70,8 @@ static int accel_init_machine(AccelClass *acc, MachineState *ms) void configure_accelerator(MachineState *ms) { - const char *accel, *p; - char buf[10]; + const char *accel; + char **accel_list, **tmp; int ret; bool accel_initialised = false; bool init_failed = false; @@ -83,13 +83,10 @@ void configure_accelerator(MachineState *ms) accel = "tcg"; } - p = accel; - while (!accel_initialised && *p != '\0') { - if (*p == ':') { - p++; - } - p = get_opt_name(buf, sizeof(buf), p, ':'); - acc = accel_find(buf); + accel_list = g_strsplit(accel, ":", 0); + + for (tmp = accel_list; !accel_initialised && tmp && *tmp; tmp++) { + acc = accel_find(*tmp); if (!acc) { continue; } @@ -107,6 +104,7 @@ void configure_accelerator(MachineState *ms) accel_initialised = true; } } + g_strfreev(accel_list); if (!accel_initialised) { if (!init_failed) { diff --git a/include/qemu/option.h b/include/qemu/option.h index 306fdb5..1cfe5cb 100644 --- a/include/qemu/option.h +++ b/include/qemu/option.h @@ -28,7 +28,6 @@ #include "qemu/queue.h" -const char *get_opt_name(char *buf, int buf_size, const char *p, char delim); const char *get_opt_value(char *buf, int buf_size, const char *p); void parse_option_size(const char *name, const char *value, diff --git a/util/qemu-option.c b/util/qemu-option.c index d0756fd..baca40f 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -49,7 +49,8 @@ * The return value is the position of the delimiter/zero byte after the option * name in p. */ -const char *get_opt_name(char *buf, int buf_size, const char *p, char delim) +static const char *get_opt_name(char *buf, int buf_size, const char *p, + char delim) { char *q; From patchwork Tue May 8 22:14:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910532 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="okwfziGd"; 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 40gZC94sZrz9s3D for ; Wed, 9 May 2018 08:38:28 +1000 (AEST) Received: from localhost ([::1]:53637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGBFY-0006qT-Ic for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:38:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAt3-000331-U2 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAt2-0001Pf-I2 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:09 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:37213) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAt2-0001Op-7f for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:08 -0400 Received: by mail-wm0-x243.google.com with SMTP id l1-v6so24209581wmb.2 for ; Tue, 08 May 2018 15:15:08 -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=ZcUbzRkmqIqlOegwKYPCk6KEdKVzvrj32YeNN6ROJzo=; b=okwfziGdlUVLeGRDUa8Aqiaoy3sBpQZwYh41gmcG0q6I1UzqR8tcnwrmB0h8k9+0F8 tv1lE8KBMcyww3SWQAqAZ1IwsLUThTapQC0M1IszqyTPwDBbmUnqDOUvRy+0ClsCcH/M /j3qpGIzNmxTXvpfAABPciOR6ljE8TeGZVXsQdEg2yh8aHpsGoXCBJO6ibvcZcA2LLFI eQct0Mh5CP1gTOfjVPtSeet9OuYDGWm8QnXNU0GInyn4P3VcHxAXZejybKoyTKXsZQND RulSqe7SlMlSMhmCGr6OoH2QSO+s1L7GIxAUDfsLXkEvBcr3FjRrg62nKY+rgJhaT2TS UYGg== 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=ZcUbzRkmqIqlOegwKYPCk6KEdKVzvrj32YeNN6ROJzo=; b=q6o1lLnAkTV2TTlR2UITDzVyqaD14hIlzDjkCSHWRyosW2hci+HgHQJDFS51QfMXP1 3Phrlt3u1gzR9nndrCmx8/OUcIVrG0QBIio07Rw75g5Um/SLYjCiVWto7zL4ukRUuaNc 6pQPG10emGx8L36Jo4mFvfCpyzWbDfk2xSZR6qNXtbuDPHSjNREtuaY3OuqqvQXs3V25 SAVVwG9hOF9iSDyAjgFQoFdpOvsldnu7msZO3Q2ExUc75sM7jSdPy0kttx06Wa9AgHmW pNGgh5P2zqK/sym/89TSqgrhFvh5Pi2373HUQSKCzP6iZLl8jRe79DW3pp4c5FhpunQc jHLg== X-Gm-Message-State: ALQs6tA2TuD4hHw45MXzzHKqc0xIYgSd3zfTihQe4M4mQtBgsKZVgi2X 2UHQ1+lfdCeyP/vU42l/rAM3OzOS X-Google-Smtp-Source: AB8JxZp6ishB0/KYjZuch6Fu1MczOlvSZQAmpXl/mcLJmapQnBK/bnws7YCn6NHXcCwFHSOGAiYUuA== X-Received: by 2002:a50:8307:: with SMTP id 7-v6mr56881812edh.263.1525817706935; Tue, 08 May 2018 15:15:06 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:06 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:31 +0200 Message-Id: <1525817687-34620-15-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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::243 Subject: [Qemu-devel] [PULL 14/30] opts: don't silently truncate long parameter keys 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: Daniel P. Berrangé The existing QemuOpts parsing code uses a fixed size 128 byte buffer for storing the parameter keys. If a key exceeded this size it was silently truncate and no error reported to the user. This behaviour was reasonable & harmless because traditionally the key names are all statically declared, and it was known that no code was declaring a key longer than 127 bytes. This assumption, however, ceased to be valid once the block layer added support for dot-separate compound keys. This syntax allows for keys that can be arbitrarily long, limited only by the number of block drivers you can stack up. With this usage, silently truncating the key name can never lead to correct behaviour. Hopefully such truncation would turn into an error, when the block code then tried to extract options later, but there's no guarantee that will happen. It is conceivable that an option specified by the user may be truncated and then ignored. This could have serious consequences, possibly even leading to security problems if the ignored option set a security relevant parameter. If the operating system didn't limit the user's argv when spawning QEMU, the code should honour whatever length arguments were given without imposing its own length restrictions. This patch thus changes the code to use a heap allocated buffer for storing the keys during parsing, lifting the arbitrary length restriction. Signed-off-by: Daniel P. Berrangé Message-Id: <20180416111743.8473-3-berrange@redhat.com> Signed-off-by: Paolo Bonzini Signed-off-by: Daniel P. Berrangé --- tests/test-qemu-opts.c | 18 ------------------ util/qemu-option.c | 44 ++++++++++++++++++++++---------------------- 2 files changed, 22 insertions(+), 40 deletions(-) diff --git a/tests/test-qemu-opts.c b/tests/test-qemu-opts.c index 77dd72b..7092e21 100644 --- a/tests/test-qemu-opts.c +++ b/tests/test-qemu-opts.c @@ -459,8 +459,6 @@ static void test_opts_parse(void) { Error *err = NULL; QemuOpts *opts; - char long_key[129]; - char *params; /* Nothing */ opts = qemu_opts_parse(&opts_list_03, "", false, &error_abort); @@ -471,22 +469,6 @@ static void test_opts_parse(void) g_assert_cmpuint(opts_count(opts), ==, 1); g_assert_cmpstr(qemu_opt_get(opts, ""), ==, "val"); - /* Long key */ - memset(long_key, 'a', 127); - long_key[127] = 'z'; - long_key[128] = 0; - params = g_strdup_printf("%s=v", long_key); - opts = qemu_opts_parse(&opts_list_03, params + 1, NULL, &error_abort); - g_assert_cmpuint(opts_count(opts), ==, 1); - g_assert_cmpstr(qemu_opt_get(opts, long_key + 1), ==, "v"); - - /* Overlong key gets truncated */ - opts = qemu_opts_parse(&opts_list_03, params, NULL, &error_abort); - g_assert(opts_count(opts) == 1); - long_key[127] = 0; - g_assert_cmpstr(qemu_opt_get(opts, long_key), ==, "v"); - g_free(params); - /* Multiple keys, last one wins */ opts = qemu_opts_parse(&opts_list_03, "a=1,b=2,,x,a=3", false, &error_abort); diff --git a/util/qemu-option.c b/util/qemu-option.c index baca40f..fa1a9f1 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -43,27 +43,23 @@ * first byte of the option name) * * The option name is delimited by delim (usually , or =) or the string end - * and is copied into buf. If the option name is longer than buf_size, it is - * truncated. buf is always zero terminated. + * and is copied into option. The caller is responsible for free'ing option + * when no longer required. * * The return value is the position of the delimiter/zero byte after the option * name in p. */ -static const char *get_opt_name(char *buf, int buf_size, const char *p, - char delim) +static const char *get_opt_name(const char *p, char **option, char delim) { - char *q; + char *offset = strchr(p, delim); - q = buf; - while (*p != '\0' && *p != delim) { - if (q && (q - buf) < buf_size - 1) - *q++ = *p; - p++; + if (offset) { + *option = g_strndup(p, offset - p); + return offset; + } else { + *option = g_strdup(p); + return p + strlen(p); } - if (q) - *q = '\0'; - - return p; } /* @@ -758,7 +754,8 @@ void qemu_opts_print(QemuOpts *opts, const char *separator) static void opts_do_parse(QemuOpts *opts, const char *params, const char *firstname, bool prepend, Error **errp) { - char option[128], value[1024]; + char *option = NULL; + char value[1024]; const char *p,*pe,*pc; Error *local_err = NULL; @@ -769,11 +766,11 @@ static void opts_do_parse(QemuOpts *opts, const char *params, /* found "foo,more" */ if (p == params && firstname) { /* implicitly named first option */ - pstrcpy(option, sizeof(option), firstname); + option = g_strdup(firstname); p = get_opt_value(value, sizeof(value), p); } else { /* option without value, probably a flag */ - p = get_opt_name(option, sizeof(option), p, ','); + p = get_opt_name(p, &option, ','); if (strncmp(option, "no", 2) == 0) { memmove(option, option+2, strlen(option+2)+1); pstrcpy(value, sizeof(value), "off"); @@ -783,10 +780,8 @@ static void opts_do_parse(QemuOpts *opts, const char *params, } } else { /* found "foo=bar,more" */ - p = get_opt_name(option, sizeof(option), p, '='); - if (*p != '=') { - break; - } + p = get_opt_name(p, &option, '='); + assert(*p == '='); p++; p = get_opt_value(value, sizeof(value), p); } @@ -795,13 +790,18 @@ static void opts_do_parse(QemuOpts *opts, const char *params, opt_set(opts, option, value, prepend, &local_err); if (local_err) { error_propagate(errp, local_err); - return; + goto cleanup; } } if (*p != ',') { break; } + g_free(option); + option = NULL; } + + cleanup: + g_free(option); } /** From patchwork Tue May 8 22:14:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910523 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="UlVEiWHN"; 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 40gYzY6bK9z9s2t for ; Wed, 9 May 2018 08:28:25 +1000 (AEST) Received: from localhost ([::1]:53582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB5r-0007AY-Ig for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:28:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAt7-00036o-4z for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAt3-0001Ry-Su for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:13 -0400 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:56240) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAt3-0001Qt-IM for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:09 -0400 Received: by mail-wm0-x229.google.com with SMTP id a8so21229655wmg.5 for ; Tue, 08 May 2018 15:15:09 -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=9R2MPoIIv2e28QzJ0ZP2kesyCPah6gyyJ8mImJ4G2lE=; b=UlVEiWHNxAaaBFFmuYECir9rG6v0NW0pgpfx4+5OGStKuOD4z6Qn7ViI1eyrMOY37M +qp+9q1Gu6qCHq10zaale/cRQxtcdiTSdqVrpERrtSyXEgVumPwm7xztDVf+QQB3GqaB +hSmq4gmweWASSxk9Cmbb7moZ5i2zSr4LRkOw6NktbcKnk5Lf/MebJlfLEB2XMkVDmDc CKFfEeRJeYCQ6C7L5Xpq7ECjy2haYE5ORFgIOCLYDhTzG5oQMA2D9R7u2MFLX3RCVy42 7kEkqXy5RmdEe5qKFXAkoo10ryRrK1MR8zCmZ6m6UuHIT3WbwWvGXgFgC4o60qamp/Nu XWTQ== 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=9R2MPoIIv2e28QzJ0ZP2kesyCPah6gyyJ8mImJ4G2lE=; b=sp56vnvq9Fsb6wLDO9J80eftsGJ+EqubXUMwxm9GyIV2cSCc0l8OvZihRLnx4qPwT9 YBN8yQGFYcDUiKrpPO1ipghVCswtBwqEVNDUN4zMLy+sa1RHDYhCW97aM/a7eUENbfKV oMUzMJh3VzllWq3jjf2L2f0llM8X3vzAuMqMh5nGW15fzF63gQ+C/AMEIuPW8IHgbL52 6qXAxHWDW3K4kKqTHya6id4ADnqPtu/nsCbpfcJrjk1sLhim/7upQS1g0mYVVjBpXDeI h3+nqG/XyaQdDBp+aGoQDMZ+Kx8NneRUmFKvbf+scBQKB88xqxP9Eziwus3MSw0ttP/m xX/g== X-Gm-Message-State: ALQs6tCemeWCdhG+3C4NQoBgnsM+/JnkYwdgR3o/Nq0mEXDSIllGOxrD 5A9DFiEY/l+EOY7gJGERUpfb/rj1 X-Google-Smtp-Source: AB8JxZrZBSfqDX4nwl9uHj92kgEmsq79hawyRybQqV0mMOFcSV7OHXkZOdViKkVAIOGan4efCbGhwg== X-Received: by 2002:a50:b763:: with SMTP id g90-v6mr14187612ede.129.1525817708065; Tue, 08 May 2018 15:15:08 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:07 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:32 +0200 Message-Id: <1525817687-34620-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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::229 Subject: [Qemu-devel] [PULL 15/30] opts: don't silently truncate long option values 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: Daniel P. Berrangé The existing QemuOpts parsing code uses a fixed size 1024 byte buffer for storing the option values. If a value exceeded this size it was silently truncated and no error reported to the user. Long option values is not a common scenario, but it is conceivable that they will happen. eg if the user has a very deeply nested filesystem it would be possible to come up with a disk path that was > 1024 bytes. Most of the time if such data was silently truncated, the user would get an error about opening a non-existant disk. If they're unlucky though, QEMU might use a completely different disk image from another VM, which could be considered a security issue. Another example program was in using the -smbios command line arg with very large data blobs. In this case the silent truncation will be providing semantically incorrect data to the guest OS for SMBIOS tables. If the operating system didn't limit the user's argv when spawning QEMU, the code should honour whatever length arguments were given without imposing its own length restrictions. This patch thus changes the code to use a heap allocated buffer for storing the values during parsing, lifting the arbitrary length restriction. Signed-off-by: Daniel P. Berrangé Message-Id: <20180416111743.8473-4-berrange@redhat.com> Signed-off-by: Paolo Bonzini Signed-off-by: Daniel P. Berrangé --- hw/i386/multiboot.c | 33 +++++++++------ include/qemu/option.h | 2 +- util/qemu-option.c | 111 +++++++++++++++++++++++++++----------------------- 3 files changed, 81 insertions(+), 65 deletions(-) diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c index 5bc0a2c..7a2953e 100644 --- a/hw/i386/multiboot.c +++ b/hw/i386/multiboot.c @@ -291,12 +291,16 @@ int load_multiboot(FWCfgState *fw_cfg, cmdline_len = strlen(kernel_filename) + 1; cmdline_len += strlen(kernel_cmdline) + 1; if (initrd_filename) { - const char *r = initrd_filename; + const char *r = get_opt_value(initrd_filename, NULL); cmdline_len += strlen(r) + 1; mbs.mb_mods_avail = 1; - while (*(r = get_opt_value(NULL, 0, r))) { - mbs.mb_mods_avail++; - r++; + while (1) { + mbs.mb_mods_avail++; + r = get_opt_value(r, NULL); + if (!*r) { + break; + } + r++; } } @@ -313,7 +317,8 @@ int load_multiboot(FWCfgState *fw_cfg, if (initrd_filename) { const char *next_initrd; - char not_last, tmpbuf[strlen(initrd_filename) + 1]; + char not_last; + char *one_file = NULL; mbs.offset_mods = mbs.mb_buf_size; @@ -322,24 +327,26 @@ int load_multiboot(FWCfgState *fw_cfg, int mb_mod_length; uint32_t offs = mbs.mb_buf_size; - next_initrd = get_opt_value(tmpbuf, sizeof(tmpbuf), initrd_filename); + next_initrd = get_opt_value(initrd_filename, &one_file); not_last = *next_initrd; /* if a space comes after the module filename, treat everything after that as parameters */ - hwaddr c = mb_add_cmdline(&mbs, tmpbuf); - if ((next_space = strchr(tmpbuf, ' '))) + hwaddr c = mb_add_cmdline(&mbs, one_file); + next_space = strchr(one_file, ' '); + if (next_space) { *next_space = '\0'; - mb_debug("multiboot loading module: %s", tmpbuf); - mb_mod_length = get_image_size(tmpbuf); + } + mb_debug("multiboot loading module: %s", one_file); + mb_mod_length = get_image_size(one_file); if (mb_mod_length < 0) { - error_report("Failed to open file '%s'", tmpbuf); + error_report("Failed to open file '%s'", one_file); exit(1); } mbs.mb_buf_size = TARGET_PAGE_ALIGN(mb_mod_length + mbs.mb_buf_size); mbs.mb_buf = g_realloc(mbs.mb_buf, mbs.mb_buf_size); - load_image(tmpbuf, (unsigned char *)mbs.mb_buf + offs); + load_image(one_file, (unsigned char *)mbs.mb_buf + offs); mb_add_mod(&mbs, mbs.mb_buf_phys + offs, mbs.mb_buf_phys + offs + mb_mod_length, c); @@ -347,6 +354,8 @@ int load_multiboot(FWCfgState *fw_cfg, (char *)mbs.mb_buf + offs, (char *)mbs.mb_buf + offs + mb_mod_length, c); initrd_filename = next_initrd+1; + g_free(one_file); + one_file = NULL; } while (not_last); } diff --git a/include/qemu/option.h b/include/qemu/option.h index 1cfe5cb..3dfb449 100644 --- a/include/qemu/option.h +++ b/include/qemu/option.h @@ -28,7 +28,7 @@ #include "qemu/queue.h" -const char *get_opt_value(char *buf, int buf_size, const char *p); +const char *get_opt_value(const char *p, char **value); void parse_option_size(const char *name, const char *value, uint64_t *ret, Error **errp); diff --git a/util/qemu-option.c b/util/qemu-option.c index fa1a9f1..58d1c23 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -70,25 +70,37 @@ static const char *get_opt_name(const char *p, char **option, char delim) * delimiter is fixed to be comma which starts a new option. To specify an * option value that contains commas, double each comma. */ -const char *get_opt_value(char *buf, int buf_size, const char *p) +const char *get_opt_value(const char *p, char **value) { - char *q; + size_t capacity = 0, length; + const char *offset; + + *value = NULL; + while (1) { + offset = strchr(p, ','); + if (!offset) { + offset = p + strlen(p); + } - q = buf; - while (*p != '\0') { - if (*p == ',') { - if (*(p + 1) != ',') - break; - p++; + length = offset - p; + if (*offset != '\0' && *(offset + 1) == ',') { + length++; + } + if (value) { + *value = g_renew(char, *value, capacity + length + 1); + strncpy(*value + capacity, p, length); + (*value)[capacity + length] = '\0'; + } + capacity += length; + if (*offset == '\0' || + *(offset + 1) != ',') { + break; } - if (q && (q - buf) < buf_size - 1) - *q++ = *p; - p++; + + p += (offset - p) + 2; } - if (q) - *q = '\0'; - return p; + return offset; } static void parse_option_bool(const char *name, const char *value, bool *ret, @@ -162,50 +174,43 @@ void parse_option_size(const char *name, const char *value, bool has_help_option(const char *param) { - size_t buflen = strlen(param) + 1; - char *buf = g_malloc(buflen); const char *p = param; bool result = false; - while (*p) { - p = get_opt_value(buf, buflen, p); + while (*p && !result) { + char *value; + + p = get_opt_value(p, &value); if (*p) { p++; } - if (is_help_option(buf)) { - result = true; - goto out; - } + result = is_help_option(value); + g_free(value); } -out: - g_free(buf); return result; } -bool is_valid_option_list(const char *param) +bool is_valid_option_list(const char *p) { - size_t buflen = strlen(param) + 1; - char *buf = g_malloc(buflen); - const char *p = param; - bool result = true; + char *value = NULL; + bool result = false; while (*p) { - p = get_opt_value(buf, buflen, p); - if (*p && !*++p) { - result = false; + p = get_opt_value(p, &value); + if ((*p && !*++p) || + (!*value || *value == ',')) { goto out; } - if (!*buf || *buf == ',') { - result = false; - goto out; - } + g_free(value); + value = NULL; } + result = true; out: - g_free(buf); + g_free(value); return result; } @@ -487,7 +492,7 @@ int qemu_opt_unset(QemuOpts *opts, const char *name) } } -static void opt_set(QemuOpts *opts, const char *name, const char *value, +static void opt_set(QemuOpts *opts, const char *name, char *value, bool prepend, Error **errp) { QemuOpt *opt; @@ -496,6 +501,7 @@ static void opt_set(QemuOpts *opts, const char *name, const char *value, desc = find_desc_by_name(opts->list->desc, name); if (!desc && !opts_accepts_any(opts)) { + g_free(value); error_setg(errp, QERR_INVALID_PARAMETER, name); return; } @@ -509,8 +515,7 @@ static void opt_set(QemuOpts *opts, const char *name, const char *value, QTAILQ_INSERT_TAIL(&opts->head, opt, next); } opt->desc = desc; - opt->str = g_strdup(value); - assert(opt->str); + opt->str = value; qemu_opt_parse(opt, &local_err); if (local_err) { error_propagate(errp, local_err); @@ -521,7 +526,7 @@ static void opt_set(QemuOpts *opts, const char *name, const char *value, void qemu_opt_set(QemuOpts *opts, const char *name, const char *value, Error **errp) { - opt_set(opts, name, value, false, errp); + opt_set(opts, name, g_strdup(value), false, errp); } void qemu_opt_set_bool(QemuOpts *opts, const char *name, bool val, @@ -755,7 +760,7 @@ static void opts_do_parse(QemuOpts *opts, const char *params, const char *firstname, bool prepend, Error **errp) { char *option = NULL; - char value[1024]; + char *value = NULL; const char *p,*pe,*pc; Error *local_err = NULL; @@ -767,15 +772,15 @@ static void opts_do_parse(QemuOpts *opts, const char *params, if (p == params && firstname) { /* implicitly named first option */ option = g_strdup(firstname); - p = get_opt_value(value, sizeof(value), p); + p = get_opt_value(p, &value); } else { /* option without value, probably a flag */ p = get_opt_name(p, &option, ','); if (strncmp(option, "no", 2) == 0) { memmove(option, option+2, strlen(option+2)+1); - pstrcpy(value, sizeof(value), "off"); + value = g_strdup("off"); } else { - pstrcpy(value, sizeof(value), "on"); + value = g_strdup("on"); } } } else { @@ -783,11 +788,12 @@ static void opts_do_parse(QemuOpts *opts, const char *params, p = get_opt_name(p, &option, '='); assert(*p == '='); p++; - p = get_opt_value(value, sizeof(value), p); + p = get_opt_value(p, &value); } if (strcmp(option, "id") != 0) { /* store and parse */ opt_set(opts, option, value, prepend, &local_err); + value = NULL; if (local_err) { error_propagate(errp, local_err); goto cleanup; @@ -797,11 +803,13 @@ static void opts_do_parse(QemuOpts *opts, const char *params, break; } g_free(option); - option = NULL; + g_free(value); + option = value = NULL; } cleanup: g_free(option); + g_free(value); } /** @@ -820,7 +828,7 @@ static QemuOpts *opts_parse(QemuOptsList *list, const char *params, bool permit_abbrev, bool defaults, Error **errp) { const char *firstname; - char value[1024], *id = NULL; + char *id = NULL; const char *p; QemuOpts *opts; Error *local_err = NULL; @@ -829,11 +837,9 @@ static QemuOpts *opts_parse(QemuOptsList *list, const char *params, firstname = permit_abbrev ? list->implied_opt_name : NULL; if (strncmp(params, "id=", 3) == 0) { - get_opt_value(value, sizeof(value), params+3); - id = value; + get_opt_value(params + 3, &id); } else if ((p = strstr(params, ",id=")) != NULL) { - get_opt_value(value, sizeof(value), p+4); - id = value; + get_opt_value(p + 4, &id); } /* @@ -845,6 +851,7 @@ static QemuOpts *opts_parse(QemuOptsList *list, const char *params, */ assert(!defaults || list->merge_lists); opts = qemu_opts_create(list, id, !defaults, &local_err); + g_free(id); if (opts == NULL) { error_propagate(errp, local_err); return NULL; From patchwork Tue May 8 22:14:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910520 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="Y9fLi6O8"; 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 40gYwn75m4z9s2t for ; Wed, 9 May 2018 08:26:01 +1000 (AEST) Received: from localhost ([::1]:53567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB3X-00050b-Jm for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:25:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAt7-00036l-3x for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAt4-0001Ti-Kx for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:13 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:40910) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAt4-0001Rv-E7 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:10 -0400 Received: by mail-wm0-x244.google.com with SMTP id j5-v6so24176346wme.5 for ; Tue, 08 May 2018 15:15:10 -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=hvbVAVRPjBufMJFk06D/8yVlhs36OdUKBAHAMCESr0Q=; b=Y9fLi6O8LRd3gU2SNO9vFbNBBPvAKTOoB1i4zFJ1eYpvZXKbNYmkUflGeqLA1yl6eX VArnUCNQunDjNa9B/mKtQss72FE5jdfUh86QAJqf8aPZsv8BKcElj+EL3Z2bijte4Kws /V2iZW3X8zWrObdd6t9O+fLyiCim8pUlo/ys0IaUvVIPcr2YivosvRtjmIYgJ1qi+lsQ gKWuR5QCacF+JtBl1ruU0q05Djs7sC8MCSFB2V9uVlAgz+4Q51kunBRAQJABPROxEBbL GpiM5fvQyBvTYpWitTe3xUa6/tn7YyLJ9YjgJz3Csddlmww/oAr7OYybdNQ0Ee09xpx4 q43A== 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=hvbVAVRPjBufMJFk06D/8yVlhs36OdUKBAHAMCESr0Q=; b=ZL7V+jifxiWpvL0wiI4NC+RrzamBGw2XTm55R+3+6tN9hIwhKqUXVyioTkL/VwBrf3 wZQQcNPcSDUp1ZO1wbVQiLgn5XUIhjkaIo4dIN6w12d3dZQABqaEyM7zJk3O2k3+sVKw XCkOYJshPc3T9e2KokvbL375jNb2rke6fwgaidZEbGL7cidmB8FSJ9mho0CkyfGsw1s2 Yuzc8MiWh9+NPMO3Vo2x6X4CwCcb10f4zWB3qKaenegktI/hzW42veQnfPgnc84d2o3d or1TzodoG9bK4gSZYT23KOTPfzGLPZgdBfwk/RyKecK+tt5MXro4z5S4GrgGtuLGg1wD Bjag== X-Gm-Message-State: ALQs6tBg8PT2lb2aIhHNFoy7j04V/FOhmTo7iIsOsYb0vmzoYxA94lOD XYSnFleOgrdU3pLxcr1D7IGoEl0l X-Google-Smtp-Source: AB8JxZqinmRNTgYj4cJrF0AXpbGUOaEqD85s3ppqKXJaHB1rZzFeffny+yD2zDqdv7iNdoXQFm88HQ== X-Received: by 2002:aa7:d3d7:: with SMTP id o23-v6mr40954323edr.104.1525817709198; Tue, 08 May 2018 15:15:09 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:08 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:33 +0200 Message-Id: <1525817687-34620-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 16/30] target/i386: sev: fix memory leaks 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" Reported by Coverity. Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index c011671..2395171 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -430,7 +430,8 @@ static int sev_get_pdh_info(int fd, guchar **pdh, size_t *pdh_len, guchar **cert_chain, size_t *cert_chain_len) { - guchar *pdh_data, *cert_chain_data; + guchar *pdh_data = NULL; + guchar *cert_chain_data = NULL; struct sev_user_data_pdh_cert_export export = {}; int err, r; @@ -471,8 +472,9 @@ e_free: SevCapability * sev_get_capabilities(void) { - SevCapability *cap; - guchar *pdh_data, *cert_chain_data; + SevCapability *cap = NULL; + guchar *pdh_data = NULL; + guchar *cert_chain_data = NULL; size_t pdh_len = 0, cert_chain_len = 0; uint32_t ebx; int fd; @@ -486,7 +488,7 @@ sev_get_capabilities(void) if (sev_get_pdh_info(fd, &pdh_data, &pdh_len, &cert_chain_data, &cert_chain_len)) { - return NULL; + goto out; } cap = g_new0(SevCapability, 1); @@ -502,9 +504,9 @@ sev_get_capabilities(void) */ cap->reduced_phys_bits = 1; +out: g_free(pdh_data); g_free(cert_chain_data); - close(fd); return cap; } @@ -530,7 +532,7 @@ sev_launch_start(SEVState *s) { gsize sz; int ret = 1; - int fw_error; + int fw_error, rc; QSevGuestInfo *sev = s->sev_info; struct kvm_sev_launch_start *start; guchar *session = NULL, *dh_cert = NULL; @@ -543,7 +545,7 @@ sev_launch_start(SEVState *s) &error_abort); if (sev->session_file) { if (sev_read_file_base64(sev->session_file, &session, &sz) < 0) { - return 1; + goto out; } start->session_uaddr = (unsigned long)session; start->session_len = sz; @@ -551,18 +553,18 @@ sev_launch_start(SEVState *s) if (sev->dh_cert_file) { if (sev_read_file_base64(sev->dh_cert_file, &dh_cert, &sz) < 0) { - return 1; + goto out; } start->dh_uaddr = (unsigned long)dh_cert; start->dh_len = sz; } trace_kvm_sev_launch_start(start->policy, session, dh_cert); - ret = sev_ioctl(s->sev_fd, KVM_SEV_LAUNCH_START, start, &fw_error); - if (ret < 0) { + rc = sev_ioctl(s->sev_fd, KVM_SEV_LAUNCH_START, start, &fw_error); + if (rc < 0) { error_report("%s: LAUNCH_START ret=%d fw_error=%d '%s'", __func__, ret, fw_error, fw_error_to_str(fw_error)); - return 1; + goto out; } object_property_set_int(OBJECT(sev), start->handle, "handle", @@ -570,12 +572,13 @@ sev_launch_start(SEVState *s) sev_set_guest_state(SEV_STATE_LAUNCH_UPDATE); s->handle = start->handle; s->policy = start->policy; + ret = 0; +out: g_free(start); g_free(session); g_free(dh_cert); - - return 0; + return ret; } static int @@ -712,7 +715,7 @@ sev_guest_init(const char *id) uint32_t host_cbitpos; struct sev_user_data_status status = {}; - s = g_new0(SEVState, 1); + sev_state = s = g_new0(SEVState, 1); s->sev_info = lookup_sev_guest_info(id); if (!s->sev_info) { error_report("%s: '%s' is not a valid '%s' object", @@ -720,7 +723,6 @@ sev_guest_init(const char *id) goto err; } - sev_state = s; s->state = SEV_STATE_UNINIT; host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL); From patchwork Tue May 8 22:14:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910515 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="t4EgsLBq"; 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 40gYsj0tsDz9s2t for ; Wed, 9 May 2018 08:23:21 +1000 (AEST) Received: from localhost ([::1]:53549 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB0w-0001sN-Pn for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:23:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAt7-00036n-4k for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAt5-0001UY-R8 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:13 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:37214) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAt5-0001UB-LJ for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:11 -0400 Received: by mail-wm0-x244.google.com with SMTP id l1-v6so24209771wmb.2 for ; Tue, 08 May 2018 15:15:11 -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=HhjEg8ThjKJnNo0uMmaALut7EhWr2QebHPzOe7XcYNQ=; b=t4EgsLBqJRrh+26z+b0CN3LGSjZDD0B4sPi+3VZJhzWPZN072iVlPXlbntnvXjZVRF aP4Q239K4dNlveOAWqHSJDD6D06I/QM5QsP5m8HFcDkXwSLM0tXl2cQ/e+BotiCPxEr7 XlZ0XISfP5vMv1boIskR2N3pYTkskN+s0J0P0N4hf3lYdSnAG0U//rfxx0QmqrdOfr9h IEwCqTIQFmq4FOQcr1/FTxQcoPVTY2iMICgv2d4ZzrVc/DtP3iinfkzIYmXkf/H5xQ44 jvytes4l0giPY3GLO512jeI6IKnIsXOhgp4OYSXqegSmN6ju66aiNrYQ5CdBIhJx7SHp J5AQ== 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=HhjEg8ThjKJnNo0uMmaALut7EhWr2QebHPzOe7XcYNQ=; b=JZKM2ah787LrM3uervoP+rMFEqYavHty6z4ezf2/JDMuSvSLSNvQtJ9s5kFO3YnzG5 AUk9mKSXtY2+KB1c7EjkoMtJL1zZfmLNM3ZUuRAtGkEFcf2PPxUIq3NcbjncFTOitbTJ gZn9yBVf88fkKzUwBGNZew68FdjIrRKr/CLGf2psZwMreJDwMwX5jA9xDzffcSstsRjP ASsi4uCidjv7nLo+nXCIVBt7sH54pfYdGlvXS0EJJO7mk7wCKN4eO5ixdU6ns/ws7Cp2 c5pLiab6Q6VnytmxLvWJi2HvFNEqxLSnXz0jfBVtxnChSCiR8oXed6+CuJaVHOOD5C+U s+tQ== X-Gm-Message-State: ALQs6tDzChIkg0xEn64l3SYOsY7t9DQwSpglFs3sOPCC6DS9YJ25FBIB rs/7H9xHUTopYEJu29fzOdJ0K/1d X-Google-Smtp-Source: AB8JxZqvKwTGh/PUeGHDzGTskGAl4njYrWilCKeE1+XV2vW2o0DIv1MAg3WTkfyAtF1FLnjfPqUueA== X-Received: by 2002:a50:c289:: with SMTP id o9-v6mr56322095edf.156.1525817710400; Tue, 08 May 2018 15:15:10 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:09 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:34 +0200 Message-Id: <1525817687-34620-18-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 17/30] qemu-options: Mark -virtioconsole as deprecated 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 The qemu-doc already states that this option is only maintained for backward compatibility and "-device virtconsole" should be used instead. So let's take the next step and mark this option officially as deprecated. Reviewed-by: Markus Armbruster Signed-off-by: Thomas Huth Message-Id: <1525446790-16139-1-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- qemu-doc.texi | 5 +++++ qemu-options.hx | 5 +---- vl.c | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/qemu-doc.texi b/qemu-doc.texi index 0ed0f19..4add403 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2931,6 +2931,11 @@ The @code{-localtime} option has been replaced by @code{-rtc base=localtime}. The @code{-startdate} option has been replaced by @code{-rtc base=@var{date}}. +@subsection -virtioconsole (since 2.13.0) + +Option @option{-virtioconsole} has been replaced by +@option{-device virtconsole}. + @section qemu-img command line arguments @subsection convert -s (since 2.0.0) diff --git a/qemu-options.hx b/qemu-options.hx index c611766..091ded6 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3675,10 +3675,7 @@ STEXI @item -virtioconsole @var{c} @findex -virtioconsole Set virtio console. - -This option is maintained for backward compatibility. - -Please use @code{-device virtconsole} for the new way of invocation. +This option is deprecated, please use @option{-device virtconsole} instead. ETEXI DEF("show-cursor", 0, QEMU_OPTION_show_cursor, \ diff --git a/vl.c b/vl.c index 12e31d1..b928e3e 100644 --- a/vl.c +++ b/vl.c @@ -3587,6 +3587,8 @@ int main(int argc, char **argv, char **envp) } break; case QEMU_OPTION_virtiocon: + warn_report("This option is deprecated, " + "use '-device virtconsole' instead"); add_device_config(DEV_VIRTCON, optarg); default_virtcon = 0; if (strncmp(optarg, "mon:", 4) == 0) { From patchwork Tue May 8 22:14:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910507 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="CDZqkhx/"; 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 40gYnB0RFfz9s3Z for ; Wed, 9 May 2018 08:19:26 +1000 (AEST) Received: from localhost ([::1]:53526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAx9-0005zr-7S for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:19:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAt7-00037W-KO for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAt6-0001VV-S0 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:13 -0400 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:35808) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAt6-0001Uu-LU for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:12 -0400 Received: by mail-wm0-x236.google.com with SMTP id o78-v6so24238410wmg.0 for ; Tue, 08 May 2018 15:15:12 -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=J8u7aCohW/+DlmKhQ+eaan8Q1/+WSQkB2giejpP8JC0=; b=CDZqkhx/463t0UNWJx0mgnBKTMWdDg3COSFdxhpcSuaWiE0LlGcBTVSalOuN1lTb+2 b7Q2yVYzOmm5uUpLzsp0wJBqN8NzHqgK0jf6D/e8c2Un0rq8y6qDhdhgpH9lRmAlD//H n9IKfiB6JPZEDMhEkEkRMnLuL7iAl11kI/imskTS5sPmMvXJWc2yB8QMkTRF2Wo8AxQG SwNNjwKYJ8IgeUHX3A93lR/aNtiHN2J/TAtIqRCaPcJJ0PuoTK87leyUDUQGeQNR2+nI u/DDBNk9yGNgyuBwtErzRHG3CKNYWVq016+keU06LXCAtE4vZFcBfSWKP7LfICcn58/n c4lA== 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=J8u7aCohW/+DlmKhQ+eaan8Q1/+WSQkB2giejpP8JC0=; b=JJpYsfiPkO1S1dGMgd8hQecQ+ipmPy3dS1SRyVVCSVHfQqArZFUa4jxxUf+kmX9SEI TvnJIR8sLvytcMShA6qe6f/NUIVy1zOnFbGfkPF7y+Gc8hDnagQu1DIY5zrHJjAt403/ grOqLeNY/wC28AZ6bFAvZWJ0PrFcDyKKoaXkFtLnO5cL1Hc54q26AePtXEJWrver0jZU F/DAQgDDfnnKxR8KBlfR8M+zG42lZGknPi2dhaq0AgilyCk6MApyxVbGRyJ4q42/zU4M I10OxgsIIk72HRzVNSXk48RJRiQLvSpWz+UIHF35vl7BGrtrnqLvMKKpsYx3ox8vX7Hl Y5RA== X-Gm-Message-State: ALQs6tDAujrP7V+WV0KF4umQw2Rgixo7anJgTXEg+FM+xScgaG861ogD 3wr57trNDc5wGGz55m/644O2+alL X-Google-Smtp-Source: AB8JxZpK0eiVfgFa0PslZ99g8qRomC8i8wl7npg01gW2q4n+CfAak718DH8y0bcaHzblVQltFLo06A== X-Received: by 2002:a50:a662:: with SMTP id d89-v6mr57714886edc.296.1525817711350; Tue, 08 May 2018 15:15:11 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:10 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:35 +0200 Message-Id: <1525817687-34620-19-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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::236 Subject: [Qemu-devel] [PULL 18/30] qemu-options: Remove remainders of the -tdf option 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 The -tdf options has been removed with d07aa197c5a1556449361a0cbb5108e2, but apparently I forgot to remove the corresponding two lines from qemu-options.hx, so this option is still "available" and just silently ignored. Kill it now for good. Reviewed-by: Markus Armbruster Signed-off-by: Thomas Huth Message-Id: <1525453270-23074-2-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- qemu-options.hx | 3 --- 1 file changed, 3 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 091ded6..50c906c 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3921,9 +3921,6 @@ DEF("no-kvm-pit-reinjection", 0, QEMU_OPTION_no_kvm_pit_reinjection, HXCOMM Deprecated by -machine kernel_irqchip=on|off property DEF("no-kvm-irqchip", 0, QEMU_OPTION_no_kvm_irqchip, "", QEMU_ARCH_I386) -HXCOMM Deprecated (ignored) -DEF("tdf", 0, QEMU_OPTION_tdf,"", QEMU_ARCH_ALL) - DEF("msg", HAS_ARG, QEMU_OPTION_msg, "-msg timestamp[=on|off]\n" " change the format of messages\n" From patchwork Tue May 8 22:14:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910517 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="Ghy6HRnK"; 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 40gYv81tYJz9s2t for ; Wed, 9 May 2018 08:24:36 +1000 (AEST) Received: from localhost ([::1]:53555 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB29-0002vh-OX for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:24:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAt9-00039J-11 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAt7-0001WD-TZ for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:15 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36517) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAt7-0001Vf-Mz for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:13 -0400 Received: by mail-wm0-x242.google.com with SMTP id n10-v6so24095195wmc.1 for ; Tue, 08 May 2018 15:15:13 -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=zw0f3+4A41BgfMch57TnPr+s+lkv3JYJ3I32D9uuh5Q=; b=Ghy6HRnKp1cdWkFm9g5t3wtJvet/tvwtDv2CoWmKXY22QDr0tCEHcI9djwqjjzsATk rfwXEzDfAqdgBe1x5Y61wVzWMF7zBzYNqxNO1mSrzgSDd+5nE7Spx4yUgb9WarK1j7xk NEC8WHc3d+4dEfdzaUlbI1vZOjK+OGTOy/8NKlPflpTGFsOgPd5lrFSS5wl07W4cgXtZ UvN6Yx41zl+K/xBv1fHQXDRjKG52bATeRELDgs7bkYCnhfPPU2Tm95E+Wdrx0hXk1mfJ BT7yAirzY7/zzf7TRWb/o3ZV4raFFngVsg5aMvkb8ceRiXHwBiOYN/GVb8DVsPRastO8 b/+A== 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=zw0f3+4A41BgfMch57TnPr+s+lkv3JYJ3I32D9uuh5Q=; b=mgdQk8OHcj8+4dB1Z3hop9VN3TTDTBZGZ9Bv9XEAzuey4S3aoYrI0/hvKolxpAh6Th b3wmw+TlHt5w2CCcyv5LGVz3vAUHIgpZ2hz+AENzLc6mc2LNpPmLMDFK7CFR9BqEZnIZ Zwi0y0n2Z6Z6/p+3Cmz166HjFEIzgeGg2I78W4I1q/7qQoxlvVKKrwgqjQ1seDqy0B2U mXs77XUzd4OQZmP4p8q1VdgxLvrYLj6UtA+GtZFZcR5rwsyX748CkaA+pt+ueQhapiA+ LfMSOcnWz4L6e0Hz54RS0QpsYxwtNzdUTaNjBAzGzVmbwxUhTlXqVAb8/kNmCIpp/Ucr qieg== X-Gm-Message-State: ALQs6tD1UFnRWhPhv05oZdwud9pxCkicIjep02XQ4dBO5mSEDcM7NbCf njFLYHNhL2247BluO1YU6/0Wz4UY X-Google-Smtp-Source: AB8JxZoSV1EyR2RBjng9o2G+lAu00iP/uj2iHu8hHzp2wW0vWLm87GEZT2YM3GlBY4AvxImfEX3K6w== X-Received: by 2002:a50:9b14:: with SMTP id o20-v6mr39857264edi.60.1525817712433; Tue, 08 May 2018 15:15:12 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:11 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:36 +0200 Message-Id: <1525817687-34620-20-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 19/30] qemu-options: Bail out on unsupported options instead of silently ignoring them 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 The dangling remainder of the -tdf option revealed a deficiency in our option parsing: Options that have been declared, but are not supported in the switch-case statement in vl.c and not handled in the OS-specifc os_parse_cmd_args() functions are currently silently ignored. We should rather tell the users that they specified something that we can not handle, so let's print an error message and exit instead. Reported-by: Markus Armbruster Signed-off-by: Thomas Huth Message-Id: <1525453270-23074-3-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu-common.h | 2 +- os-posix.c | 6 +++++- os-win32.c | 4 ++-- vl.c | 5 ++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/qemu-common.h b/include/qemu-common.h index 8a4f63c..85f4749 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -137,7 +137,7 @@ char *qemu_find_file(int type, const char *name); /* OS specific functions */ void os_setup_early_signal_handling(void); char *os_find_datadir(void); -void os_parse_cmd_args(int index, const char *optarg); +int os_parse_cmd_args(int index, const char *optarg); #include "qemu/module.h" diff --git a/os-posix.c b/os-posix.c index 24eb700..9ce6f74 100644 --- a/os-posix.c +++ b/os-posix.c @@ -165,7 +165,7 @@ static bool os_parse_runas_uid_gid(const char *optarg) * Parse OS specific command line options. * return 0 if option handled, -1 otherwise */ -void os_parse_cmd_args(int index, const char *optarg) +int os_parse_cmd_args(int index, const char *optarg) { switch (index) { #ifdef CONFIG_SLIRP @@ -199,7 +199,11 @@ void os_parse_cmd_args(int index, const char *optarg) fips_set_state(true); break; #endif + default: + return -1; } + + return 0; } static void change_process_uid(void) diff --git a/os-win32.c b/os-win32.c index 586a7c7..0674f94 100644 --- a/os-win32.c +++ b/os-win32.c @@ -93,9 +93,9 @@ void os_set_line_buffering(void) * Parse OS specific command line options. * return 0 if option handled, -1 otherwise */ -void os_parse_cmd_args(int index, const char *optarg) +int os_parse_cmd_args(int index, const char *optarg) { - return; + return -1; } int qemu_create_pidfile(const char *filename) diff --git a/vl.c b/vl.c index b928e3e..a23acb2 100644 --- a/vl.c +++ b/vl.c @@ -4033,7 +4033,10 @@ int main(int argc, char **argv, char **envp) } break; default: - os_parse_cmd_args(popt->index, optarg); + if (os_parse_cmd_args(popt->index, optarg)) { + error_report("Option not supported in this build"); + exit(1); + } } } } From patchwork Tue May 8 22:14:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910533 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="lm4HDlQx"; 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 40gZGD1WQHz9s3D for ; Wed, 9 May 2018 08:41:08 +1000 (AEST) Received: from localhost ([::1]:53652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGBI9-0000zV-Tw for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:41:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAt9-0003A8-Uz for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAt8-0001WV-UQ for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:15 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:35366) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAt8-0001WK-Mf for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:14 -0400 Received: by mail-wm0-x241.google.com with SMTP id o78-v6so24238531wmg.0 for ; Tue, 08 May 2018 15:15:14 -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=Xu9dPqTLdAWKFTCiIdVynRFmjydXN63U9Ez4YGC8CIg=; b=lm4HDlQx4u0h3A45Ubg7mneI1ojvIPsDxXFxruGER9hz+KE7hlGb0QsqsyoSKFH5JQ 2YgeRpi+O9dEAjgu6rqsEUyJ6KdbPhYz5BP6IQaf1vMTqY38yH04kD0Ek92fii+xpH/6 w3oxA0O3MB4+0wjUsFhV35RW0GhqKVns7FaIKctyhefzqaAuIkGkv+ZRApjJU63miqrY LHa5IhQVcV/09bDlShpCi4lOiAords0RB6ZeuKXqsWOpYI/JXPtVMBXu4u981q9t0mKW ny8MbjQrzpvvXc2SEO0O+uwXqrteLfC0E5PHFuwRTYlq65+pphtPY6wesDqpmRc45Xwx UhNA== 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=Xu9dPqTLdAWKFTCiIdVynRFmjydXN63U9Ez4YGC8CIg=; b=fvVOEpoHiiEr1VDOAw4xG/gtUCuxeD0YUoGf2YvMHLWpmsaGZcCLCF8CM3RR5UqV8o AvM1X3Fhi96xrhT7R8I9a1N28d/fCOrHDPJKzsFhZKRF4v8vMAvcAFcXvTXtk2B0TkRn DIizd8frjTJVo8Cv5qRG7PkqS00iNRqCyKDIvwTwZWC5O15KyiZJRpWfjeslArxj64v6 V65HqYkD2Z2R8dCenCegq9dIr4aiMd76WTZt8bryxKsV6rcGn1sAM1UPnzm/cKDkxoXF a/PuMW2ISxvXgj/inlb+mLsptcl0qvtaaHqAc3mfmNi+XXZOf2+22bxNDa6CqMCwuH2r 6U5Q== X-Gm-Message-State: ALQs6tCj/72m0ZCqT+Mw9B35nn0mf5ExX5+yjxp/QsjLIbY/J95GI+Mb oWxlkQoTVH7GN/yLGzJcyDepFK3C X-Google-Smtp-Source: AB8JxZpL48YRHxGUuOn6wbP6p0zpJZGSgY//z86VsIrkHUCdYoZ3zfI7WRRPnJdB2aWbnUQxjzsk9g== X-Received: by 2002:a50:9581:: with SMTP id w1-v6mr56449248eda.33.1525817713468; Tue, 08 May 2018 15:15:13 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:12 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:37 +0200 Message-Id: <1525817687-34620-21-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 20/30] qemu-options: Remove deprecated -no-kvm-pit-reinjection 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 Deprecated since the beginning when it was added for compatibility with the ancient qemu-kvm fork of QEMU, and it even printed out the deprecation warning since right from the start (i.e. QEMU v1.3.0), so it's really time to remove this now. Reviewed-by: Markus Armbruster Signed-off-by: Thomas Huth Message-Id: <1525453270-23074-4-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- qemu-doc.texi | 5 ----- qemu-options.hx | 4 ---- vl.c | 12 ------------ 3 files changed, 21 deletions(-) diff --git a/qemu-doc.texi b/qemu-doc.texi index 4add403..85a7a39 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2786,11 +2786,6 @@ which is the default. @section System emulator command line arguments -@subsection -no-kvm-pit-reinjection (since 1.3.0) - -The ``-no-kvm-pit-reinjection'' argument is now a -synonym for setting ``-global kvm-pit.lost_tick_policy=discard''. - @subsection -no-kvm-irqchip (since 1.3.0) The ``-no-kvm-irqchip'' argument is now a synonym for diff --git a/qemu-options.hx b/qemu-options.hx index 50c906c..dfff698 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3914,10 +3914,6 @@ ETEXI HXCOMM Deprecated by -machine accel=tcg property DEF("no-kvm", 0, QEMU_OPTION_no_kvm, "", QEMU_ARCH_I386) -HXCOMM Deprecated by kvm-pit driver properties -DEF("no-kvm-pit-reinjection", 0, QEMU_OPTION_no_kvm_pit_reinjection, - "", QEMU_ARCH_I386) - HXCOMM Deprecated by -machine kernel_irqchip=on|off property DEF("no-kvm-irqchip", 0, QEMU_OPTION_no_kvm_irqchip, "", QEMU_ARCH_I386) diff --git a/vl.c b/vl.c index a23acb2..23d55a4 100644 --- a/vl.c +++ b/vl.c @@ -3696,18 +3696,6 @@ int main(int argc, char **argv, char **envp) olist = qemu_find_opts("machine"); qemu_opts_parse_noisily(olist, "accel=tcg", false); break; - case QEMU_OPTION_no_kvm_pit_reinjection: { - static GlobalProperty kvm_pit_lost_tick_policy = { - .driver = "kvm-pit", - .property = "lost_tick_policy", - .value = "discard", - }; - - warn_report("deprecated, replaced by " - "-global kvm-pit.lost_tick_policy=discard"); - qdev_prop_register_global(&kvm_pit_lost_tick_policy); - break; - } case QEMU_OPTION_accel: accel_opts = qemu_opts_parse_noisily(qemu_find_opts("accel"), optarg, true); From patchwork Tue May 8 22:14:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910534 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="dFS9J7lc"; 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 40gZJd5vPDz9s3D for ; Wed, 9 May 2018 08:43:13 +1000 (AEST) Received: from localhost ([::1]:53661 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGBKB-0002js-H5 for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:43:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAtB-0003Bk-2W for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAtA-0001XG-4J for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:17 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:33425) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAt9-0001Wo-U9 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:16 -0400 Received: by mail-wm0-x243.google.com with SMTP id x12-v6so20840838wmc.0 for ; Tue, 08 May 2018 15:15:15 -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=atjpT6qC5q4vmc4h3dM+t8fRdLhsGURUSSgQ31/PDT0=; b=dFS9J7lcro+39ujuAth9cw3q5RQtFhf8y38+s7BfWMSK7WaiTQgvnGyBFAc9YjBcrj kVWNNkYVImKR7BC1gi86rXeMTOZ3aI0O4I92iJQPSWezWOQWj5Y1SXSSkF79ecHlwlQB agzEGQMor50u+M6t4xosZ5nMChGv8AqtgCjS5XLa7X1X5zwjCu9Ef+Q/R7cQ5UYJzG3G xxhVS3GaDGkdCfWEDBd6bdNnH1Q8hoK9ARmtOJ/CDAzNesM/VVX8DjR23F0dM0ICGxgQ MhYdMZ8BnmGjxJsebwAIyh8iF16H0B2ZOx/lLqJPuhsR6rZf+KDshyJN3rmwZ7CG0uFQ gmLw== 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=atjpT6qC5q4vmc4h3dM+t8fRdLhsGURUSSgQ31/PDT0=; b=HisjxRdG4eKcq49y9GSzx94iJHRHZVMYweW+O07GqZhYVpEbEpiwfcVT0Z/LA6Rv/3 vM+4w0skplUME6vJFktoWPEPx9kyiPS3XxB5h9O3enTOXr/4oskL39Qr0wOlRxscRWD6 LLPQFkTeqqtA7bYGgsKMQaNMGrA9G3HmGvEDISCYsa6p+Y3fdbFZeS/Ss0DUOpA/y9Cx /l8HX/k4fr8EjJvJ9OF9r/CzF85jwa3KXiXS/Q66SiAktSwokcG9FX2tbIurwF55y1N8 3wP5/DumjGFI/ka5CEuG3oeDrZm5hGN2sGxaH2yzX79cI31aLssTSULVuPBVbGx/tp8D 6HDg== X-Gm-Message-State: ALQs6tBMGDiaORoxJN8dzSwoduUAblgzZ6KhJiW9mqLIEcm6cA/bEqJT OkbHUPn4zIi54UGn6cR629g9H+27 X-Google-Smtp-Source: AB8JxZqtT2rGEfZViprMx5oWIr8TVY5KCOmkFg02WXezbh7bLTGhgmnIh+Lq3LFBzFzTfCgttqQtKg== X-Received: by 2002:a50:9ea3:: with SMTP id a32-v6mr53737042edf.78.1525817714553; Tue, 08 May 2018 15:15:14 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:13 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:38 +0200 Message-Id: <1525817687-34620-22-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 21/30] qemu-options: Remove deprecated -no-kvm-irqchip 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've never documented this option in our qemu-doc, so apart from the users that already used the old qemu-kvm fork before, most users should not be aware of this option at all. It's been marked as deprecated in the source code for a long time already, and officially marked as deprecated in the documentation since QEMU v2.10, so it should be fine to remove this now. Reviewed-by: Markus Armbruster Signed-off-by: Thomas Huth Message-Id: <1525453270-23074-5-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- qemu-doc.texi | 5 ----- qemu-options.hx | 3 --- vl.c | 5 ----- 3 files changed, 13 deletions(-) diff --git a/qemu-doc.texi b/qemu-doc.texi index 85a7a39..bde542b 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2786,11 +2786,6 @@ which is the default. @section System emulator command line arguments -@subsection -no-kvm-irqchip (since 1.3.0) - -The ``-no-kvm-irqchip'' argument is now a synonym for -setting ``-machine kernel_irqchip=off''. - @subsection -no-kvm (since 1.3.0) The ``-no-kvm'' argument is now a synonym for setting diff --git a/qemu-options.hx b/qemu-options.hx index dfff698..b2fefd1 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3914,9 +3914,6 @@ ETEXI HXCOMM Deprecated by -machine accel=tcg property DEF("no-kvm", 0, QEMU_OPTION_no_kvm, "", QEMU_ARCH_I386) -HXCOMM Deprecated by -machine kernel_irqchip=on|off property -DEF("no-kvm-irqchip", 0, QEMU_OPTION_no_kvm_irqchip, "", QEMU_ARCH_I386) - DEF("msg", HAS_ARG, QEMU_OPTION_msg, "-msg timestamp[=on|off]\n" " change the format of messages\n" diff --git a/vl.c b/vl.c index 23d55a4..b9f6b42 100644 --- a/vl.c +++ b/vl.c @@ -3138,11 +3138,6 @@ int main(int argc, char **argv, char **envp) exit(1); } switch(popt->index) { - case QEMU_OPTION_no_kvm_irqchip: { - olist = qemu_find_opts("machine"); - qemu_opts_parse_noisily(olist, "kernel_irqchip=off", false); - break; - } case QEMU_OPTION_cpu: /* hw initialization will check this */ cpu_model = optarg; From patchwork Tue May 8 22:14:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910514 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="AAGr8qPK"; 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 40gYrM3yTXz9s3Z for ; Wed, 9 May 2018 08:22:11 +1000 (AEST) Received: from localhost ([::1]:53545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAzp-0000xY-5A for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:22:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAtC-0003DX-SQ for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAtB-0001YH-CD for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:18 -0400 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:53376) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAtB-0001XV-1k for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:17 -0400 Received: by mail-wm0-x22b.google.com with SMTP id a67so21143770wmf.3 for ; Tue, 08 May 2018 15:15:16 -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=iH1qbApmvTwD2NoiklUgdSMSFEkbkvAzvqDzsOq/LtA=; b=AAGr8qPKoV+YxMrdShb+hxe4IrWQ1ojF8Af9wzefFVzdQeY2PwSX9P/SsyAtP/VoFT LkATE/7D3Ef9Qdx4QA3hbfiwAecDGP7vDRY69BiZNKFXSA4KXXnfW0HTGmjcmMbIBPsh 8nZZrDfG6O+9GaDIkDfVFlTV2d2MACaCuEU73RqLboA661hMLQOwPyfT8D/YFG3oF8v/ WnS3494oQLVixfEq6EVxx4oZ9R48ta0vN6c8xF0CfeHE5aljM913q0N1+VborB9wa3wB nrTCt0O/NHZwV8KN0OZnt6WLXlQIDwMVQocokD5eO4hZIzE0pjOqyn9pSegm7Bz8w35B QM8Q== 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=iH1qbApmvTwD2NoiklUgdSMSFEkbkvAzvqDzsOq/LtA=; b=ff6JNPIW/e3ciYx/EQ92UYgnO4ourHpeqAD4U0dozyYnTk2FDyr7k44bMWtyrpSJf3 REyUnoB3tk1axP80iiiWQ0Sp8ZvSWrHZB07HCdCf7tzf55DmOE+xmrcewEopmPD5AAm4 a5oeeCShEHSAJHdGYODayZ6OrFKtRPl9dxGrqrhU+Z/vc3OkY4dFkRVOUIbCZIzu4hi4 wcHIij+DJU1MPQSua+hNCWZ/KO1/PNoZp0zyZBUZxwLlEuz/gVLjaZ2llmbc/7D3vzJI c3udHKxarCJ4ohtDmcOo6InK3EujkixiW8NmjW0RAuflrZOJYdT2ibqglNdIbm/z6e/6 SAtw== X-Gm-Message-State: ALQs6tDFGw/GaFZL6V14IJJtCRdBiDc7qOwTKk1rA7oByqYcsZY79ZzI 65mGtBcx+3OIit0M39UbJqEKFP0F X-Google-Smtp-Source: AB8JxZrGXsjvK4cHH11q/WoVyKoQm7GKzQwHM+4/egLrdfeu2sJ/o03drG7X+59JLDKP+dD8jmFQUA== X-Received: by 2002:a50:f559:: with SMTP id w25-v6mr57792201edm.230.1525817715687; Tue, 08 May 2018 15:15:15 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:15 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:39 +0200 Message-Id: <1525817687-34620-23-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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::22b Subject: [Qemu-devel] [PULL 22/30] qemu-doc: provide details of supported build platforms 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: Daniel P. Berrangé Describe the policy the project uses to decide which OS are supported as build platforms. This will: - Allow maintainers to determine when the minimum version of a 3rd party piece of software can be increased without negatively impacting supported platforms. - Allow tailoring of CI environments to match the intended supported build platforms. Signed-off-by: Daniel P. Berrangé Message-Id: <20180504160026.14017-2-berrange@redhat.com> Signed-off-by: Paolo Bonzini Signed-off-by: Daniel P. Berrangé --- qemu-doc.texi | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/qemu-doc.texi b/qemu-doc.texi index bde542b..715bd33 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -39,6 +39,7 @@ * QEMU User space emulator:: * Implementation notes:: * Deprecated features:: +* Supported build platforms:: * License:: * Index:: @end menu @@ -2976,6 +2977,73 @@ The ``xlnx-zcu102'' machine has the same features and capabilites in QEMU. In order to prevent QEMU from automatically opening an image's backing chain, use ``"backing": null'' instead. +@node Supported build platforms +@appendix Supported build platforms + +QEMU aims to support building and executing on multiple host OS platforms. +This appendix outlines which platforms are the major build targets. These +platforms are used as the basis for deciding upon the minimum required +versions of 3rd party software QEMU depends on. The supported platforms +are the targets for automated testing performed by the project when patches +are submitted for review, and tested before and after merge. + +If a platform is not listed here, it does not imply that QEMU won't work. +If an unlisted platform has comparable software versions to a listed platform, +there is every expectation that it will work. Bug reports are welcome for +problems encountered on unlisted platforms unless they are clearly older +vintage than what is described here. + +Note that when considering software versions shipped in distros as support +targets, QEMU considers only the version number, and assumes the features in +that distro match the upstream release with the same version. In other words, +if a distro backports extra features to the software in their distro, QEMU +upstream code will not add explicit support for those backports, unless the +feature is auto-detectable in a manner that works for the upstream releases +too. + +The Repology site @url{https://repology.org} is a useful resource to identify +currently shipped versions of software in various operating systems, though +it does not cover all distros listed below. + +@section Linux OS + +For distributions with frequent, short-lifetime releases, the project will +aim to support all versions that are not end of life by their respective +vendors. For the purposes of identifying supported software versions, the +project will look at Fedora, Ubuntu, and openSUSE distros. Other short- +lifetime distros will be assumed to ship similar software versions. + +For distributions with long-lifetime releases, the project will aim to support +the most recent major version at all times. Support for the previous major +version will be dropped 2 years after the new major version is released. For +the purposes of identifying supported software versions, the project will look +at RHEL, Debian, Ubuntu LTS, and SLES distros. Other long-lifetime distros will +be assumed to ship similar software versions. + +@section Windows + +The project supports building with current versions of the MinGW toolchain, +hosted on Linux. + +@section macOS + +The project supports building with the two most recent versions of macOS, with +the current homebrew package set available. + +@section FreeBSD + +The project aims to support the all the versions which are not end of life. + +@section NetBSD + +The project aims to support the most recent major version at all times. Support +for the previous major version will be dropped 2 years after the new major +version is released. + +@section OpenBSD + +The project aims to support the all the versions which are not end of life. + @node License @appendix License From patchwork Tue May 8 22:14:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910522 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="dghUwPVH"; 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 40gYy75hmqz9s2t for ; Wed, 9 May 2018 08:27:11 +1000 (AEST) Received: from localhost ([::1]:53573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB4f-00062f-An for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:27:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAtF-0003Fv-3B for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAtC-0001Z7-NA for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:21 -0400 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:52628) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAtC-0001YV-BM for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:18 -0400 Received: by mail-wm0-x235.google.com with SMTP id w194so21163870wmf.2 for ; Tue, 08 May 2018 15:15:18 -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=OEbyxaYkY08ebP7I3i4jlet+JgJtA1uzyV2bm9GLHkE=; b=dghUwPVHFTba82IgPEUMv3YCdkxeZuLs3hoUnxLilLQH7PtexPU7qf1IfODeW17I8a ZpWaYphIROX7t4o/IzjpuzoSyHYpMPDgDlEKIR9UQwBu8NiZXSJVeuTyqAJOdKHN/MUQ LRy5/Wk8VTRe0QW0IvXAN1mg+OVQh9SQ1hIFXdcy7ifrcVtKmmEqjOCMFJBAzFqQGFZP x0NBUK3YrPP+AiqaD2qvlr1bUNm+AoTqdTulVj5gzUAxUj8RQYf/GSuySe+3HruZO/2y aXqhtFsHuBMLGCe9fMafA/yxdsOnS2rof6Kdsq4fwJL5JWJioa9cloUpf1UnygG7CM9N XJuw== 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=OEbyxaYkY08ebP7I3i4jlet+JgJtA1uzyV2bm9GLHkE=; b=THuUvq7GDsYiVIn3x7T6Zx1UpErw316XMYozgw3pO7HAHlppxnTuShf7lHAtGQlhwe CYIlSqcSOt1Y981okBjWkC00BXvnt4oJSm2a/93LGrbj7cNKDhAOu1KVOCEclODzYi/u NfHvF+WnSMzv3pcDf0h5q29i709AGfLWWGX0iROLQ9eeqKm7BMXRGIkWONPDyYIAuJ41 Do7QC31cor1Ml65xCkhSL8dHPJzApHfaFsfbXugsJ6Y734H/ovKPaspVVRufosnMGT29 recxdtlkBeXoaxNRJgw0lyw/WdZSrARxtaCVEUHlKEGCTWHBsxBg5hoQIh8qx2NetGJD nCYg== X-Gm-Message-State: ALQs6tBuH3lIcrdiAZXG1qDwd8GgY2xA9gAWKoHr+vPEd950iki2OoNe K/VaJK92ry+P5uScug6i9CynOI7T X-Google-Smtp-Source: AB8JxZqhC//aHlRu3eL5Esb/VV2QW63deOCNN8ZeQSX3dnuKWwz0fjkRo7BLYlOvHOe6t+GNdDGXxA== X-Received: by 2002:a50:fa06:: with SMTP id b6-v6mr41619032edq.26.1525817716961; Tue, 08 May 2018 15:15:16 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:16 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:40 +0200 Message-Id: <1525817687-34620-24-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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::235 Subject: [Qemu-devel] [PULL 23/30] glib: bump min required glib library version to 2.42 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: Daniel P. Berrangé Per supported platforms doc, the various min glib on relevant distros is: RHEL-7: 2.50.3 Debian (Stretch): 2.50.3 Debian (Jessie): 2.42.1 OpenBSD (Ports): 2.54.3 FreeBSD (Ports): 2.50.3 OpenSUSE Leap 15: 2.54.3 Ubuntu (Xenial): 2.48.0 macOS (Homebrew): 2.56.0 This suggests that a minimum glib of 2.42 is a reasonable target Signed-off-by: Daniel P. Berrangé Message-Id: <20180504160026.14017-3-berrange@redhat.com> Signed-off-by: Paolo Bonzini Signed-off-by: Daniel P. Berrangé --- configure | 6 +- docs/devel/testing.rst | 4 +- include/glib-compat.h | 319 ------------------------------- tests/docker/dockerfiles/centos6.docker | 30 --- tests/docker/dockerfiles/min-glib.docker | 8 - tests/test-qmp-event.c | 2 +- tests/tpm-emu.h | 4 +- tests/vhost-user-test.c | 4 +- trace/simple.c | 6 +- 9 files changed, 11 insertions(+), 372 deletions(-) delete mode 100644 tests/docker/dockerfiles/centos6.docker delete mode 100644 tests/docker/dockerfiles/min-glib.docker diff --git a/configure b/configure index 83a6080..3ff4d77 100755 --- a/configure +++ b/configure @@ -3394,11 +3394,7 @@ fi ########################################## # glib support probe -if test "$mingw32" = yes; then - glib_req_ver=2.30 -else - glib_req_ver=2.22 -fi +glib_req_ver=2.42 glib_modules=gthread-2.0 if test "$modules" = yes; then glib_modules="$glib_modules gmodule-export-2.0" diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 0ca1a2d..f7b7552 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -297,9 +297,9 @@ the container, with parameters defined by the make target): .. code:: - make docker-test-build@min-glib + make docker-test-build@centos7 -This will create a container instance using the ``min-glib`` image (the image +This will create a container instance using the ``centos7`` image (the image is downloaded and initialized automatically), in which the ``test-build`` job is executed. diff --git a/include/glib-compat.h b/include/glib-compat.h index c49cf87..3b340ab 100644 --- a/include/glib-compat.h +++ b/include/glib-compat.h @@ -18,27 +18,6 @@ #include -/* GLIB version compatibility flags */ -#if !GLIB_CHECK_VERSION(2, 26, 0) -#define G_TIME_SPAN_SECOND (G_GINT64_CONSTANT(1000000)) -#endif - -#if !GLIB_CHECK_VERSION(2, 28, 0) -static inline gint64 qemu_g_get_monotonic_time(void) -{ - /* g_get_monotonic_time() is best-effort so we can use the wall clock as a - * fallback. - */ - - GTimeVal time; - g_get_current_time(&time); - - return time.tv_sec * G_TIME_SPAN_SECOND + time.tv_usec; -} -/* work around distro backports of this interface */ -#define g_get_monotonic_time() qemu_g_get_monotonic_time() -#endif - #if defined(_WIN32) && !GLIB_CHECK_VERSION(2, 50, 0) /* * g_poll has a problem on Windows when using @@ -48,228 +27,6 @@ static inline gint64 qemu_g_get_monotonic_time(void) gint g_poll_fixed(GPollFD *fds, guint nfds, gint timeout); #endif -#if !GLIB_CHECK_VERSION(2, 30, 0) -/* Not a 100% compatible implementation, but good enough for most - * cases. Placeholders are only supported at the end of the - * template. */ -static inline gchar *qemu_g_dir_make_tmp(gchar const *tmpl, GError **error) -{ - gchar *path = g_build_filename(g_get_tmp_dir(), tmpl ?: ".XXXXXX", NULL); - - if (mkdtemp(path) != NULL) { - return path; - } - /* Error occurred, clean up. */ - g_set_error(error, G_FILE_ERROR, g_file_error_from_errno(errno), - "mkdtemp() failed"); - g_free(path); - return NULL; -} -#define g_dir_make_tmp(tmpl, error) qemu_g_dir_make_tmp(tmpl, error) -#endif /* glib 2.30 */ - -#if !GLIB_CHECK_VERSION(2, 31, 0) -/* before glib-2.31, GMutex and GCond was dynamic-only (there was a separate - * GStaticMutex, but it didn't work with condition variables). - * - * Our implementation uses GOnce to fake a static implementation that does - * not require separate initialization. - * We need to rename the types to avoid passing our CompatGMutex/CompatGCond - * by mistake to a function that expects GMutex/GCond. However, for ease - * of use we keep the GLib function names. GLib uses macros for the - * implementation, we use inline functions instead and undefine the macros. - */ - -typedef struct CompatGMutex { - GOnce once; -} CompatGMutex; - -typedef struct CompatGCond { - GOnce once; -} CompatGCond; - -static inline gpointer do_g_mutex_new(gpointer unused) -{ - return (gpointer) g_mutex_new(); -} - -static inline void g_mutex_init(CompatGMutex *mutex) -{ - mutex->once = (GOnce) G_ONCE_INIT; -} - -static inline void g_mutex_clear(CompatGMutex *mutex) -{ - g_assert(mutex->once.status != G_ONCE_STATUS_PROGRESS); - if (mutex->once.retval) { - g_mutex_free((GMutex *) mutex->once.retval); - } - mutex->once = (GOnce) G_ONCE_INIT; -} - -static inline void (g_mutex_lock)(CompatGMutex *mutex) -{ - g_once(&mutex->once, do_g_mutex_new, NULL); - g_mutex_lock((GMutex *) mutex->once.retval); -} -#undef g_mutex_lock - -static inline gboolean (g_mutex_trylock)(CompatGMutex *mutex) -{ - g_once(&mutex->once, do_g_mutex_new, NULL); - return g_mutex_trylock((GMutex *) mutex->once.retval); -} -#undef g_mutex_trylock - - -static inline void (g_mutex_unlock)(CompatGMutex *mutex) -{ - g_mutex_unlock((GMutex *) mutex->once.retval); -} -#undef g_mutex_unlock - -static inline gpointer do_g_cond_new(gpointer unused) -{ - return (gpointer) g_cond_new(); -} - -static inline void g_cond_init(CompatGCond *cond) -{ - cond->once = (GOnce) G_ONCE_INIT; -} - -static inline void g_cond_clear(CompatGCond *cond) -{ - g_assert(cond->once.status != G_ONCE_STATUS_PROGRESS); - if (cond->once.retval) { - g_cond_free((GCond *) cond->once.retval); - } - cond->once = (GOnce) G_ONCE_INIT; -} - -static inline void (g_cond_wait)(CompatGCond *cond, CompatGMutex *mutex) -{ - g_assert(mutex->once.status != G_ONCE_STATUS_PROGRESS); - g_once(&cond->once, do_g_cond_new, NULL); - g_cond_wait((GCond *) cond->once.retval, (GMutex *) mutex->once.retval); -} -#undef g_cond_wait - -static inline void (g_cond_broadcast)(CompatGCond *cond) -{ - g_once(&cond->once, do_g_cond_new, NULL); - g_cond_broadcast((GCond *) cond->once.retval); -} -#undef g_cond_broadcast - -static inline void (g_cond_signal)(CompatGCond *cond) -{ - g_once(&cond->once, do_g_cond_new, NULL); - g_cond_signal((GCond *) cond->once.retval); -} -#undef g_cond_signal - -static inline gboolean (g_cond_timed_wait)(CompatGCond *cond, - CompatGMutex *mutex, - GTimeVal *time) -{ - g_assert(mutex->once.status != G_ONCE_STATUS_PROGRESS); - g_once(&cond->once, do_g_cond_new, NULL); - return g_cond_timed_wait((GCond *) cond->once.retval, - (GMutex *) mutex->once.retval, time); -} -#undef g_cond_timed_wait - -/* This is not a macro, because it didn't exist until 2.32. */ -static inline gboolean g_cond_wait_until(CompatGCond *cond, CompatGMutex *mutex, - gint64 end_time) -{ - GTimeVal time; - - /* Convert from monotonic to CLOCK_REALTIME. */ - end_time -= g_get_monotonic_time(); - g_get_current_time(&time); - end_time += time.tv_sec * G_TIME_SPAN_SECOND + time.tv_usec; - - time.tv_sec = end_time / G_TIME_SPAN_SECOND; - time.tv_usec = end_time % G_TIME_SPAN_SECOND; - return g_cond_timed_wait(cond, mutex, &time); -} - -/* before 2.31 there was no g_thread_new() */ -static inline GThread *g_thread_new(const char *name, - GThreadFunc func, gpointer data) -{ - GThread *thread = g_thread_create(func, data, TRUE, NULL); - if (!thread) { - g_error("creating thread"); - } - return thread; -} -#else -#define CompatGMutex GMutex -#define CompatGCond GCond -#endif /* glib 2.31 */ - -#if !GLIB_CHECK_VERSION(2, 32, 0) -/* Beware, function returns gboolean since 2.39.2, see GLib commit 9101915 */ -static inline void g_hash_table_add(GHashTable *hash_table, gpointer key) -{ - g_hash_table_replace(hash_table, key, key); -} - -static inline gboolean g_hash_table_contains(GHashTable *hash_table, - gpointer key) -{ - return g_hash_table_lookup_extended(hash_table, key, NULL, NULL); -} -#define G_SOURCE_CONTINUE TRUE -#define G_SOURCE_REMOVE FALSE -#endif - -#ifndef g_assert_true -#define g_assert_true(expr) \ - do { \ - if (G_LIKELY(expr)) { \ - } else { \ - g_assertion_message(G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "'" #expr "' should be TRUE"); \ - } \ - } while (0) -#endif - -#ifndef g_assert_false -#define g_assert_false(expr) \ - do { \ - if (G_LIKELY(!(expr))) { \ - } else { \ - g_assertion_message(G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "'" #expr "' should be FALSE"); \ - } \ - } while (0) -#endif - -#ifndef g_assert_null -#define g_assert_null(expr) \ - do { \ - if (G_LIKELY((expr) == NULL)) { \ - } else { \ - g_assertion_message(G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "'" #expr "' should be NULL"); \ - } \ - } while (0) -#endif - -#ifndef g_assert_nonnull -#define g_assert_nonnull(expr) \ - do { \ - if (G_LIKELY((expr) != NULL)) { \ - } else { \ - g_assertion_message(G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "'" #expr "' should not be NULL"); \ - } \ - } while (0) -#endif #ifndef g_assert_cmpmem #define g_assert_cmpmem(m1, l1, m2, l2) \ @@ -288,80 +45,4 @@ static inline gboolean g_hash_table_contains(GHashTable *hash_table, } while (0) #endif -#if !GLIB_CHECK_VERSION(2, 28, 0) -static inline void g_list_free_full(GList *list, GDestroyNotify free_func) -{ - GList *l; - - for (l = list; l; l = l->next) { - free_func(l->data); - } - - g_list_free(list); -} - -static inline void g_slist_free_full(GSList *list, GDestroyNotify free_func) -{ - GSList *l; - - for (l = list; l; l = l->next) { - free_func(l->data); - } - - g_slist_free(list); -} -#endif - -#if !GLIB_CHECK_VERSION(2, 26, 0) -static inline void g_source_set_name(GSource *source, const char *name) -{ - /* This is just a debugging aid, so leaving it a no-op */ -} -static inline void g_source_set_name_by_id(guint tag, const char *name) -{ - /* This is just a debugging aid, so leaving it a no-op */ -} -#endif - -#if !GLIB_CHECK_VERSION(2, 36, 0) -/* Always fail. This will not include error_report output in the test log, - * sending it instead to stderr. - */ -#define g_test_initialized() (0) -#endif -#if !GLIB_CHECK_VERSION(2, 38, 0) -#ifdef CONFIG_HAS_GLIB_SUBPROCESS_TESTS -#error schizophrenic detection of glib subprocess testing -#endif -#define g_test_subprocess() (0) -#endif - - -#if !GLIB_CHECK_VERSION(2, 34, 0) -static inline void -g_test_add_data_func_full(const char *path, - gpointer data, - gpointer fn, - gpointer data_free_func) -{ -#if GLIB_CHECK_VERSION(2, 26, 0) - /* back-compat casts, remove this once we can require new-enough glib */ - g_test_add_vtable(path, 0, data, NULL, - (GTestFixtureFunc)fn, (GTestFixtureFunc) data_free_func); -#else - /* back-compat casts, remove this once we can require new-enough glib */ - g_test_add_vtable(path, 0, data, NULL, - (void (*)(void)) fn, (void (*)(void)) data_free_func); -#endif -} -#endif - -/* Small compat shim from glib 2.32 */ -#ifndef G_SOURCE_CONTINUE -#define G_SOURCE_CONTINUE TRUE -#endif -#ifndef G_SOURCE_REMOVE -#define G_SOURCE_REMOVE FALSE -#endif - #endif diff --git a/tests/docker/dockerfiles/centos6.docker b/tests/docker/dockerfiles/centos6.docker deleted file mode 100644 index ad24319..0000000 --- a/tests/docker/dockerfiles/centos6.docker +++ /dev/null @@ -1,30 +0,0 @@ -FROM centos:6 -RUN yum install -y epel-release centos-release-xen -ENV PACKAGES \ - bison \ - bzip2-devel \ - ccache \ - csnappy-devel \ - flex \ - g++ \ - gcc \ - gettext \ - git \ - glib2-devel \ - libepoxy-devel \ - libfdt-devel \ - librdmacm-devel \ - lzo-devel \ - make \ - mesa-libEGL-devel \ - mesa-libgbm-devel \ - pixman-devel \ - SDL-devel \ - spice-glib-devel \ - spice-server-devel \ - tar \ - vte-devel \ - xen-devel \ - zlib-devel -RUN yum install -y $PACKAGES -RUN rpm -q $PACKAGES | sort > /packages.txt diff --git a/tests/docker/dockerfiles/min-glib.docker b/tests/docker/dockerfiles/min-glib.docker deleted file mode 100644 index f2eed97..0000000 --- a/tests/docker/dockerfiles/min-glib.docker +++ /dev/null @@ -1,8 +0,0 @@ -FROM centos:6 -RUN yum install -y \ - tar gettext git make gcc g++ \ - zlib-devel SDL-devel pixman-devel \ - epel-release -RUN yum install -y libfdt-devel ccache -RUN yum downgrade -y http://vault.centos.org/6.0/os/x86_64/Packages/glib2-2.22.5-5.el6.x86_64.rpm -RUN yum install -y http://vault.centos.org/6.0/os/x86_64/Packages/glib2-devel-2.22.5-5.el6.x86_64.rpm diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c index 3a7c227..78a2942 100644 --- a/tests/test-qmp-event.c +++ b/tests/test-qmp-event.c @@ -32,7 +32,7 @@ typedef struct QDictCmpData { } QDictCmpData; TestEventData *test_event_data; -static CompatGMutex test_event_lock; +static GMutex test_event_lock; /* Only compares bool, int, string */ static diff --git a/tests/tpm-emu.h b/tests/tpm-emu.h index ef4bfa8..08f9024 100644 --- a/tests/tpm-emu.h +++ b/tests/tpm-emu.h @@ -24,8 +24,8 @@ struct tpm_hdr { } QEMU_PACKED; typedef struct TestState { - CompatGMutex data_mutex; - CompatGCond data_cond; + GMutex data_mutex; + GCond data_cond; SocketAddress *addr; QIOChannel *tpm_ioc; GThread *emu_tpm_thread; diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index bbc8091..9f680f5 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -150,8 +150,8 @@ typedef struct TestServer { int fds_num; int fds[VHOST_MEMORY_MAX_NREGIONS]; VhostUserMemory memory; - CompatGMutex data_mutex; - CompatGCond data_cond; + GMutex data_mutex; + GCond data_cond; int log_fd; uint64_t rings; bool test_fail; diff --git a/trace/simple.c b/trace/simple.c index e82018d..701dec6 100644 --- a/trace/simple.c +++ b/trace/simple.c @@ -36,9 +36,9 @@ * Trace records are written out by a dedicated thread. The thread waits for * records to become available, writes them out, and then waits again. */ -static CompatGMutex trace_lock; -static CompatGCond trace_available_cond; -static CompatGCond trace_empty_cond; +static GMutex trace_lock; +static GCond trace_available_cond; +static GCond trace_empty_cond; static bool trace_available; static bool trace_writeout_enabled; From patchwork Tue May 8 22:14:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910519 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="Rcnb4iyA"; 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 40gYvZ1JPsz9s2t for ; Wed, 9 May 2018 08:24:58 +1000 (AEST) Received: from localhost ([::1]:53558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB2V-0003Hi-Rg for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:24:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAtG-0003H5-6A for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAtD-0001aE-JM for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:22 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:38491) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAtD-0001ZG-9Z for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:19 -0400 Received: by mail-wm0-x241.google.com with SMTP id y189-v6so5982855wmc.3 for ; Tue, 08 May 2018 15:15:19 -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=GR1MduvCNJrWgfxZnOxp4LCRJmonTqZXbjOyPj2px3c=; b=Rcnb4iyAtrmZVUH5B4DozlYBAWDOvGI0wSJDr6tvePqDxbUsy8Ap5rWIhyjmKW1r7L ZXeVHGWuY/lZ/LIJGyZeM9CuvAaZfS4PhpIhSvnMuUO1xKGY2Pd7oXrMGpvG6oyAk1Bw nNHTOUQ8ApJSmZoLs8dS3RF5jZyJV6fpHFaWdgB9Jh1BXfXVYueZtFPXyVFBoQko+XFR 6r4zFaYo3QtRNBLtTJp27hMGmCQ6YD/4X1+XMTqg25GB1fToPaehp4joGyP4VQ75Td2u uXb8//abuaPBVTN1PHKJwzW8djqqf0db2NkqVaTp3WzzH4UqIm8I5ADZ4b78tBESzXsH yTEg== 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=GR1MduvCNJrWgfxZnOxp4LCRJmonTqZXbjOyPj2px3c=; b=qAKHteukEHqkzVWVypVqgLQHxpBVozFljJi3ylkvisiIFX3G2ne6AyZ80wtOlYEGRp iDXoJ9uwipnJCOgu5sa52H/XXIVLTsZGrf1iff5k4qrK+GIAGUY7muUoKYjIxrNHJ1do MrAVHdKJSWP/J70k9DDqXKTqiLvj5FIQU3C8+m8KXfXhqZeZE/TkuyBBJUXWuXrroK/m wTHMogpY93byHwRNZYHkUEzmWYhxm0hJdmAc1XGzcFi54t4g92Kj2drkPi8ALrDChTc7 ZirnDze8oOfcol9xaEY2WTV5T9vlbRy33MXQNmZ9tMH40RTGR/57nFgoTp3YVWi1KOIo uqOQ== X-Gm-Message-State: ALQs6tBkv9Hse4dM5VssoII+8MCxheUi5jEVyBzUFfleCa3zfmesJFBx skyuJX2IICCM1oE+j7/B7GHUJp1+ X-Google-Smtp-Source: AB8JxZpmXP1RmF2cckF5xZm7D6WdXXJWc+4E+36mp9iFnxpxTPIrsoJt+IR3AyR+/qW2ZTY4pLBEXQ== X-Received: by 2002:aa7:d84a:: with SMTP id f10-v6mr56497468eds.204.1525817718017; Tue, 08 May 2018 15:15:18 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:17 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:41 +0200 Message-Id: <1525817687-34620-25-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 24/30] i386/kvm: add support for Hyper-V reenlightenment MSRs 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: Vitaly Kuznetsov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Vitaly Kuznetsov KVM recently gained support for Hyper-V Reenlightenment MSRs which are required to make KVM-on-Hyper-V enable TSC page clocksource to its guests when INVTSC is not passed to it (and it is not passed by default in Qemu as it effectively blocks migration). Signed-off-by: Vitaly Kuznetsov Message-Id: <20180411115036.31832-2-vkuznets@redhat.com> Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 4 +++- target/i386/cpu.h | 4 ++++ target/i386/hyperv-proto.h | 9 ++++++++- target/i386/kvm.c | 39 ++++++++++++++++++++++++++++++++++++++- target/i386/machine.c | 24 ++++++++++++++++++++++++ 5 files changed, 77 insertions(+), 3 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index a20fe26..b0a1c62 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -416,7 +416,8 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL /* hv_vpindex_access */, NULL /* hv_msr_reset_access */, NULL /* hv_msr_stats_access */, NULL /* hv_reftsc_access */, NULL /* hv_msr_idle_access */, NULL /* hv_msr_frequency_access */, - NULL, NULL, NULL, NULL, + NULL /* hv_msr_debug_access */, NULL /* hv_msr_reenlightenment_access */, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -4770,6 +4771,7 @@ static Property x86_cpu_properties[] = { 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("hv-reenlightenment", X86CPU, hyperv_reenlightenment, 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 1b219fa..b58b779 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1174,6 +1174,9 @@ typedef struct CPUX86State { uint64_t msr_hv_synic_sint[HV_SINT_COUNT]; uint64_t msr_hv_stimer_config[HV_STIMER_COUNT]; uint64_t msr_hv_stimer_count[HV_STIMER_COUNT]; + uint64_t msr_hv_reenlightenment_control; + uint64_t msr_hv_tsc_emulation_control; + uint64_t msr_hv_tsc_emulation_status; uint64_t msr_rtit_ctrl; uint64_t msr_rtit_status; @@ -1297,6 +1300,7 @@ struct X86CPU { bool hyperv_synic; bool hyperv_stimer; bool hyperv_frequencies; + bool hyperv_reenlightenment; bool check_cpuid; bool enforce_cpuid; bool expose_kvm; diff --git a/target/i386/hyperv-proto.h b/target/i386/hyperv-proto.h index cb4d7f2..93352eb 100644 --- a/target/i386/hyperv-proto.h +++ b/target/i386/hyperv-proto.h @@ -35,7 +35,7 @@ #define HV_RESET_AVAILABLE (1u << 7) #define HV_REFERENCE_TSC_AVAILABLE (1u << 9) #define HV_ACCESS_FREQUENCY_MSRS (1u << 11) - +#define HV_ACCESS_REENLIGHTENMENTS_CONTROL (1u << 13) /* * HV_CPUID_FEATURES.EDX bits @@ -130,6 +130,13 @@ #define HV_CRASH_CTL_NOTIFY (1ull << 63) /* + * Reenlightenment notification MSRs + */ +#define HV_X64_MSR_REENLIGHTENMENT_CONTROL 0x40000106 +#define HV_X64_MSR_TSC_EMULATION_CONTROL 0x40000107 +#define HV_X64_MSR_TSC_EMULATION_STATUS 0x40000108 + +/* * Hypercall status code */ #define HV_STATUS_SUCCESS 0 diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 6c49954..d6666a4 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -90,6 +90,7 @@ static bool has_msr_hv_runtime; static bool has_msr_hv_synic; static bool has_msr_hv_stimer; static bool has_msr_hv_frequencies; +static bool has_msr_hv_reenlightenment; static bool has_msr_xss; static bool has_msr_spec_ctrl; static bool has_msr_smi_count; @@ -583,7 +584,8 @@ static bool hyperv_enabled(X86CPU *cpu) cpu->hyperv_vpindex || cpu->hyperv_runtime || cpu->hyperv_synic || - cpu->hyperv_stimer); + cpu->hyperv_stimer || + cpu->hyperv_reenlightenment); } static int kvm_arch_set_tsc_khz(CPUState *cs) @@ -669,6 +671,16 @@ static int hyperv_handle_properties(CPUState *cs) } env->features[FEAT_HYPERV_EDX] |= HV_GUEST_CRASH_MSR_AVAILABLE; } + if (cpu->hyperv_reenlightenment) { + if (!has_msr_hv_reenlightenment) { + fprintf(stderr, + "Hyper-V Reenlightenment MSRs " + "(requested by 'hv-reenlightenment' cpu flag) " + "are not supported by kernel\n"); + return -ENOSYS; + } + env->features[FEAT_HYPERV_EAX] |= HV_ACCESS_REENLIGHTENMENTS_CONTROL; + } env->features[FEAT_HYPERV_EDX] |= HV_CPU_DYNAMIC_PARTITIONING_AVAILABLE; if (cpu->hyperv_reset) { if (!has_msr_hv_reset) { @@ -1215,6 +1227,9 @@ static int kvm_get_supported_msrs(KVMState *s) case HV_X64_MSR_TSC_FREQUENCY: has_msr_hv_frequencies = true; break; + case HV_X64_MSR_REENLIGHTENMENT_CONTROL: + has_msr_hv_reenlightenment = true; + break; case MSR_IA32_SPEC_CTRL: has_msr_spec_ctrl = true; break; @@ -1778,6 +1793,14 @@ static int kvm_put_msrs(X86CPU *cpu, int level) kvm_msr_entry_add(cpu, HV_X64_MSR_REFERENCE_TSC, env->msr_hv_tsc); } + if (cpu->hyperv_reenlightenment) { + kvm_msr_entry_add(cpu, HV_X64_MSR_REENLIGHTENMENT_CONTROL, + env->msr_hv_reenlightenment_control); + kvm_msr_entry_add(cpu, HV_X64_MSR_TSC_EMULATION_CONTROL, + env->msr_hv_tsc_emulation_control); + kvm_msr_entry_add(cpu, HV_X64_MSR_TSC_EMULATION_STATUS, + env->msr_hv_tsc_emulation_status); + } } if (cpu->hyperv_vapic) { kvm_msr_entry_add(cpu, HV_X64_MSR_APIC_ASSIST_PAGE, @@ -2140,6 +2163,11 @@ static int kvm_get_msrs(X86CPU *cpu) if (cpu->hyperv_time) { kvm_msr_entry_add(cpu, HV_X64_MSR_REFERENCE_TSC, 0); } + if (cpu->hyperv_reenlightenment) { + kvm_msr_entry_add(cpu, HV_X64_MSR_REENLIGHTENMENT_CONTROL, 0); + kvm_msr_entry_add(cpu, HV_X64_MSR_TSC_EMULATION_CONTROL, 0); + kvm_msr_entry_add(cpu, HV_X64_MSR_TSC_EMULATION_STATUS, 0); + } if (has_msr_hv_crash) { int j; @@ -2397,6 +2425,15 @@ static int kvm_get_msrs(X86CPU *cpu) env->msr_hv_stimer_count[(index - HV_X64_MSR_STIMER0_COUNT)/2] = msrs[i].data; break; + case HV_X64_MSR_REENLIGHTENMENT_CONTROL: + env->msr_hv_reenlightenment_control = msrs[i].data; + break; + case HV_X64_MSR_TSC_EMULATION_CONTROL: + env->msr_hv_tsc_emulation_control = msrs[i].data; + break; + case HV_X64_MSR_TSC_EMULATION_STATUS: + env->msr_hv_tsc_emulation_status = msrs[i].data; + break; case MSR_MTRRdefType: env->mtrr_deftype = msrs[i].data; break; diff --git a/target/i386/machine.c b/target/i386/machine.c index bd2d82e..fd99c0b 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -713,6 +713,29 @@ static const VMStateDescription vmstate_msr_hyperv_stimer = { } }; +static bool hyperv_reenlightenment_enable_needed(void *opaque) +{ + X86CPU *cpu = opaque; + CPUX86State *env = &cpu->env; + + return env->msr_hv_reenlightenment_control != 0 || + env->msr_hv_tsc_emulation_control != 0 || + env->msr_hv_tsc_emulation_status != 0; +} + +static const VMStateDescription vmstate_msr_hyperv_reenlightenment = { + .name = "cpu/msr_hyperv_reenlightenment", + .version_id = 1, + .minimum_version_id = 1, + .needed = hyperv_reenlightenment_enable_needed, + .fields = (VMStateField[]) { + VMSTATE_UINT64(env.msr_hv_reenlightenment_control, X86CPU), + VMSTATE_UINT64(env.msr_hv_tsc_emulation_control, X86CPU), + VMSTATE_UINT64(env.msr_hv_tsc_emulation_status, X86CPU), + VMSTATE_END_OF_LIST() + } +}; + static bool avx512_needed(void *opaque) { X86CPU *cpu = opaque; @@ -1005,6 +1028,7 @@ VMStateDescription vmstate_x86_cpu = { &vmstate_msr_hyperv_runtime, &vmstate_msr_hyperv_synic, &vmstate_msr_hyperv_stimer, + &vmstate_msr_hyperv_reenlightenment, &vmstate_avx512, &vmstate_xss, &vmstate_tsc_khz, From patchwork Tue May 8 22:14:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910537 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="C/lT/bwz"; 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 40gZL30dqSz9s3D for ; Wed, 9 May 2018 08:44:27 +1000 (AEST) Received: from localhost ([::1]:53668 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGBLM-0003sF-SO for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:44:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAtG-0003H4-5c for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAtE-0001bM-LT for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:22 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:53768) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAtE-0001ad-Fh for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:20 -0400 Received: by mail-wm0-x244.google.com with SMTP id a67so21143935wmf.3 for ; Tue, 08 May 2018 15:15:20 -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=htQUR9b3kdjx3UODSzNRmd2xyHubaSPg8c7E/j7ZS+4=; b=C/lT/bwzL3Myt/0xALodunvZFijY5WKu1RaUOA7AESBvBBzoUqvksRuO4hvTrmozR3 XQ6lEIvlW6CGGmqV9Wo+nIsu9zYV6znzK+CohOL+DBWe+kTaKVfxqqVanWktuAA+vOQc Z9rWnYpWA0Fie4sL02Evj/5B9e6xvF9HBpvEIKOfLzvyhODzCPmNgP5FqGssZawsR8Va ueFyL/LQqiyV7vY/7F4VDkVKkth9YfPLpsCRDhUlxlQYNXByUhCisfKQXTX5fBc3Crp0 KAQTPUlMcpGTkRTFGd6m3zJimqUUxg0dkHLJo24egVjLMJPBaOd+zWN3d361xiIC3w6R bj0Q== 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=htQUR9b3kdjx3UODSzNRmd2xyHubaSPg8c7E/j7ZS+4=; b=fJEP5RRF5VL2Y1+m+lvGpqkOnDzgoMWTfNHw5vaxONBlXQuLjsLpHcpp/kW53gOj6G q143NVeD401s+AwsDNPERpJCWHHlUCIJSOUG5xF437KEFHci2UvS1kZ+j6WF/SroCf/3 7ocS/tildX9/+lOTrR4cJTblJQERovYaPKXdp3Ydh3jnShiu3cAv+0ZsF+yMWzudYeI3 fcQnAgTjfgSY1veqieZa5HBae1ACu+7H9HcjBXL0v94sZmzzB1J5wmOSqgYGDSnlhULv Ahrif0dH6U02l4V9BAh4jctdsvAkNvZrWcDiuvy30LuhepsmXmHUGWzInozWAq53zShM c+6A== X-Gm-Message-State: ALQs6tD3Fmb7nhBVdAez+rpIoDul8KTrOLyEo4RNS9zye6ljGQLk2AYL BuyGj4GKWht+32r2wb3DsbGe1/Iz X-Google-Smtp-Source: AB8JxZob6hPt0wS5z8+uKrk9Jp4g5P+DPAike0T4CXXTjVDF72U5lmJgCHPmnWt/XEtKDItADeVX4Q== X-Received: by 2002:a50:a5f6:: with SMTP id b51-v6mr56734003edc.147.1525817719157; Tue, 08 May 2018 15:15:19 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:18 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:42 +0200 Message-Id: <1525817687-34620-26-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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::244 Subject: [Qemu-devel] [PULL 25/30] configure: Really use local libfdt if the system one is too old 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 requires libfdt version >= 1.4.2. If the host has an older libfdt installed, the configure script will use a (git cloned) local version. Example with Debian 8: $ dpkg-query --showformat='${Version}\n' --show libfdt-dev 1.4.0+dfsg-1 $ ./configure [...] fdt support yes # from git submodule 'dtc' If this case occurs, the linker will have 2 different libfdt available in the library search path. The default behavior is to search the system path first, then the local path. Even if the configure script noticed the libfdt is too old and clone a more recent locally, when linking the system library is selected first, and the link process eventually fails: LINK mips64el-softmmu/qemu-system-mips64el ../hw/core/loader-fit.o: In function `load_fit': /root/src/github.com/philmd/qemu/hw/core/loader-fit.c:278: undefined reference to `fdt_first_subnode' /root/src/github.com/philmd/qemu/hw/core/loader-fit.c:286: undefined reference to `fdt_next_subnode' /root/src/github.com/philmd/qemu/hw/core/loader-fit.c:277: undefined reference to `fdt_first_subnode' collect2: error: ld returned 1 exit status Makefile:201: recipe for target 'qemu-system-mips64el' failed make[1]: *** [qemu-system-mips64el] Error 1 QEMU already uses a kludge to enforce local CFLAGS before system ones for libpixman and libfdt, add a similar kludge for the LDFLAGS to enforce using the local libfdt. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20180415230522.24404-2-f4bug@amsat.org> Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth --- configure | 6 +++++- rules.mak | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 3ff4d77..43756dc 100755 --- a/configure +++ b/configure @@ -3800,7 +3800,8 @@ EOF symlink "$source_path/dtc/scripts" "dtc/scripts" fi fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt" - fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs" + fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt" + fdt_libs="$fdt_libs" elif test "$fdt" = "yes" ; then # Not a git build & no libfdt found, prompt for system install error_exit "DTC (libfdt) version >= 1.4.2 not present." \ @@ -5742,6 +5743,7 @@ echo_version() { # prepend pixman and ftd flags after all config tests are done QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS" +QEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS" libs_softmmu="$pixman_libs $libs_softmmu" echo "Install prefix $prefix" @@ -5772,6 +5774,7 @@ echo "ARFLAGS $ARFLAGS" echo "CFLAGS $CFLAGS" echo "QEMU_CFLAGS $QEMU_CFLAGS" echo "LDFLAGS $LDFLAGS" +echo "QEMU_LDFLAGS $QEMU_LDFLAGS" echo "make $make" echo "install $install" echo "python $python" @@ -6706,6 +6709,7 @@ else fi echo "LDFLAGS=$LDFLAGS" >> $config_host_mak echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak +echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak echo "LIBS+=$LIBS" >> $config_host_mak diff --git a/rules.mak b/rules.mak index 93a0702..04c7f74 100644 --- a/rules.mak +++ b/rules.mak @@ -73,7 +73,7 @@ expand-objs = $(strip $(sort $(filter %.o,$1)) \ # must link with the C++ compiler, not the plain C compiler. LINKPROG = $(or $(CXX),$(CC)) -LINK = $(call quiet-command, $(LINKPROG) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \ +LINK = $(call quiet-command, $(LINKPROG) $(QEMU_LDFLAGS) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \ $(call process-archive-undefs, $1) \ $(version-obj-y) $(call extract-libs,$1) $(LIBS),"LINK","$(TARGET_DIR)$@") From patchwork Tue May 8 22:14:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910525 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="U4HgVZQ9"; 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 40gZ0g30lNz9s37 for ; Wed, 9 May 2018 08:29:23 +1000 (AEST) Received: from localhost ([::1]:53586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB6n-0007xp-34 for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:29:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAtG-0003Hi-LJ for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAtF-0001c2-K6 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:22 -0400 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:55004) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAtF-0001bV-DH for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:21 -0400 Received: by mail-wm0-x236.google.com with SMTP id f6so21244003wmc.4 for ; Tue, 08 May 2018 15:15:21 -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=WMrbAR/Bg06RWuNKjX5hROcigpxuEq1sK5IOKbeQQhQ=; b=U4HgVZQ9ObnMt9UCs59l54M7EXF8YQK60t38Ilw9AoL+8KIewYWypyJUarlLgfm/KG jNOu0jAZAnisF7McoguPsx4HQdNG9SxtYHH+G8LwrPzF+XTcVIDDLmlE+hkmjdzBZbQ6 MR2GbzMzBjA2BUDXixS0HTJrHha8vY/0Lr/DC6rvTNGROofb8MOct1hnFIXz9638jE8K GvqVpTbiD6v9v+7OwscRz1HDS9dh+Se/pTGTGkZQNkrkhbqO7ndbcz28ReNfxWBKW35x Bhz60ozPWl32YCaxwBdPr0ulChDtfrLwLU4yMGfdZDJBLVDbhF7rMqx+/rfoMkPIbTDx oItA== 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=WMrbAR/Bg06RWuNKjX5hROcigpxuEq1sK5IOKbeQQhQ=; b=gojk1kmCrMx5RkrYY86IcnUrlTLSb7wcXM0fy0nzVRsNfFFV33iYQEG7e53aRZiFge wRZtLHuMjn17FhNwUPkp8ly5Zz13mFxt1Ui6cMbEKH++nV49aZfoR+8BzQxbdSdYnhDb y4uH5evH1SnDcuVtENH7mXiLNp51vWuTv0tU4w5kqVdM5IqHm4wdhWNb9x48U19uEvki TrGBGat/zoU0Xe0Ugo2Zn+tsxjhGymyzAMoOgBJHCaKVcdLYFrskD83FdQa3+kpMda18 vtoTY+yuuO+lUlqJU3ukKU/d40cHtkWKRxKuq1GSNMroqgECT/+3celeMOGsoASQxx4s j3Rg== X-Gm-Message-State: ALQs6tAWqXdt55OlA4j2kwoWxkpk4oE+M6FKUAUuigRKTLtbNQ4/CHMc gvkI8/7eETnS++N5nQfx8qRjqyRK X-Google-Smtp-Source: AB8JxZqtNIJmoC+zYZCaplAI6lrKnOmNRu3S4cVDu39ybgjYDkzENvQGTKjwo6nFU0DHiIvnEh1NfA== X-Received: by 2002:a50:c252:: with SMTP id t18-v6mr57202356edf.135.1525817720201; Tue, 08 May 2018 15:15:20 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:43 +0200 Message-Id: <1525817687-34620-27-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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::236 Subject: [Qemu-devel] [PULL 26/30] configure: Display if libfdt is from system or git 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é The configure script outputs "yes" regardless which libfdt is used: ./configure [...] fdt support yes Sometimes you can have both system and local git version available, change the configure script to display which library got selected: debian8$ dpkg-query --showformat='${Version}\n' --show libfdt-dev 1.4.0+dfsg-1 debian8$ ./configure [...] fdt support git Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20180415230522.24404-3-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- configure | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 43756dc..407bf84 100755 --- a/configure +++ b/configure @@ -3785,15 +3785,14 @@ int main(void) { fdt_first_subnode(0, 0); return 0; } EOF if compile_prog "" "$fdt_libs" ; then # system DTC is good - use it - fdt=yes + fdt=system else # have GIT checkout, so activate dtc submodule if test -e "${source_path}/.git" ; then git_submodules="${git_submodules} dtc" fi if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then - fdt=yes - dtc_internal="yes" + fdt=git mkdir -p dtc if [ "$pwd_is_source_path" != "y" ] ; then symlink "$source_path/dtc/Makefile" "dtc/Makefile" @@ -6334,7 +6333,7 @@ fi if test "$preadv" = "yes" ; then echo "CONFIG_PREADV=y" >> $config_host_mak fi -if test "$fdt" = "yes" ; then +if test "$fdt" != "no" ; then echo "CONFIG_FDT=y" >> $config_host_mak fi if test "$membarrier" = "yes" ; then @@ -7136,7 +7135,7 @@ echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak done # for target in $targets -if [ "$dtc_internal" = "yes" ]; then +if [ "$fdt" = "git" ]; then echo "config-host.h: subdir-dtc" >> $config_host_mak fi if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then From patchwork Tue May 8 22:14:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910538 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="Xjl8wSzz"; 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 40gZMM6WpNz9s3D for ; Wed, 9 May 2018 08:45:35 +1000 (AEST) Received: from localhost ([::1]:53677 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGBMT-0005bI-Lg for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:45:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAtH-0003Hx-JQ for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAtG-0001cW-LO for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:23 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36518) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAtG-0001c8-Dp for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:22 -0400 Received: by mail-wm0-x242.google.com with SMTP id n10-v6so24095714wmc.1 for ; Tue, 08 May 2018 15:15:22 -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=yfg7e4WfWUkDxTkxxQRNJDD7oCSX+KdjsuQZwHcvx48=; b=Xjl8wSzzJHftiM0QdGkA+LVMXjX2KTwhmWopSEidT8+WcljcTY5Gma4IP3IHeaIWQz 5FIhxjBf95LAqOGIlsYN+1F+OezcfUthWJUtlJM3zdxA8YlUom/VY9YyB7gEGowg0xHB Lbo0c+mWUgZpfj0vzu4HdN39yajHLuo0/fn6ai6OYkZ0IXahtNdWj+Z0NjSFbPEj7Use U8UA4/HPBEc5YxnM62oZdsmWxiD5dDNAliKgznf6UYKPq3XyN1xZX1BLeQu7K1/mApqH 0BNG+VXzuuIuGQVqH3REdRWCT5+1Zcxoxz3fm5ce+sPe3CLVmn85/Wu4DULBc/bvzr1k vC7A== 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=yfg7e4WfWUkDxTkxxQRNJDD7oCSX+KdjsuQZwHcvx48=; b=YkMIMMQdQWWZl5MDjBUPKGnUGJqWfq3ZWqpiNAQmi87krByVzSiN64P5qIIq1B+UY8 /pkchdshf/SORQXVeAIbiRzFr9zUaqOC4ey+lZ0O+h3f4tAgIexxOXHSGdF2g93IgroP re4//rfLlBiOdsfD5KlIQ01ZtdP64HcArCkgX0yuR3XpP0K09UbCxaiae2l3J0485Ci/ mI1Mi7/InNxcZf6riBi73jWSsUb+spjIgh3cZjjO5aOQcMxN7VZOhT9pePu9JDNAYEpL C7ywjRbMKyLqYWWzNSqRmWzPmE9Ci0oRBjaVgxn60N9kaaZ7sbHAbyv8tYQaKk8iVEyp IYBg== X-Gm-Message-State: ALQs6tBwEWa4HRmW9nxdzMJ+DmLfo4rndpxS1Ji3oPQ18uW60Y7VVgUw GVoC7yLc7qdMV9zXYYI08G2Z2Pe/ X-Google-Smtp-Source: AB8JxZomeIi+1zuvUSJg9HTmcMDSuzxsjWuPIMpJyIjNO8Ji8npfHvhxvKbF99I8JcJPhl8wRjO9PA== X-Received: by 2002:a50:97a3:: with SMTP id e32-v6mr56584812edb.58.1525817721223; Tue, 08 May 2018 15:15:21 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:20 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:44 +0200 Message-Id: <1525817687-34620-28-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 27/30] shippable: Remove Debian 8 libfdt kludge 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é This kludge was added in a825ca06137, but a cleaner and more generic fix is now available (see ##COMMIT_CONFIGURE_LIBFDT_LDFLAGS_SHA##). Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20180415230522.24404-4-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- .shippable.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.shippable.yml b/.shippable.yml index 60f2ce9..f74a3de 100644 --- a/.shippable.yml +++ b/.shippable.yml @@ -35,13 +35,5 @@ build: options: "-e HOME=/root" ci: - unset CC - # some targets require newer up to date packages, for example TARGET_LIST matching - # aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu) - # see the configure script: - # error_exit "DTC (libfdt) version >= 1.4.2 not present. Your options:" - # " (1) Preferred: Install the DTC (libfdt) devel package" - # " (2) Fetch the DTC submodule, using:" - # " git submodule update --init dtc" - - dpkg --compare-versions `dpkg-query --showformat='${Version}' --show libfdt-dev` ge 1.4.2 || git submodule update --init dtc - ./configure ${QEMU_CONFIGURE_OPTS} --target-list=${TARGET_LIST} - make -j$(($(getconf _NPROCESSORS_ONLN) + 1)) From patchwork Tue May 8 22:14:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910528 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="QytinTgB"; 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 40gZ3Y5fP5z9s37 for ; Wed, 9 May 2018 08:31:53 +1000 (AEST) Received: from localhost ([::1]:53602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB9D-0001V6-HR for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:31:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAtJ-0003JZ-5P for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAtH-0001dJ-RQ for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:25 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:35370) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAtH-0001cf-Fr for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:23 -0400 Received: by mail-wm0-x243.google.com with SMTP id o78-v6so24239048wmg.0 for ; Tue, 08 May 2018 15:15:23 -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=9vVAuTPpF5WQYFf7oh4SCXKGHu1/f2tZjDLN9V1gUeY=; b=QytinTgByY/z1wrJkdCZRh1N/s31K65eFa2f+NO9yIUdyO5sl2mYLOp37/FOrJYC2x MUKtPSqFIb1C4RIN5ZDbTv3ANM9vO4EvbMo7Ah3kIOETP2hsnsqO9+Mcm4WBE+z6WPSx odXAMd9Z57D3DhmQd31hMDkqXiqXMf02LDy3wzw+OWS8uzmIp+9vY7B+AdCOmeJVHWlY duu0QV3AOpkdE6nlnX+wxwIvsPHUwrSARC5gAzCK97eailU1YvUqG6QrTI2fAZIbBJgl iXSesYzmhvMyopJRHUscj/3XKHuroYxIZREJtWSMAdlO4633kdidmjoPsiKUKo/EYjQd ZKfA== 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=9vVAuTPpF5WQYFf7oh4SCXKGHu1/f2tZjDLN9V1gUeY=; b=Ag3pIj0pX33oCm9aCnR1TveJY2FmnQwNBRwlEmKi5XyD0y369bUdZbMqt7ymGKRzxJ 9qERjHTYBh38aGHe/r405RznRyRL8BTnX5I0mqe+VXXVNpHEep/tgbgE7q6QNBCb6Nam codV9IXVtpQGyx83EMCkn5mjD9WftJ/ktEl0nI9Vd5E5kEDzNJDX2uzzem4mQxBBfQ+M pnOHeP/UWoZD3olT6RJ40gOVxbp64hduHQqsvdVhd4a9COIsG6gzi+h9YCqiR8u0k0SX x/AUBGkzTbF6rCqqlgvRxGzveSJfEnyIrmvmr85Ma/VnWmWo6/qCndQVROiI3Ni/TXtn NgAA== X-Gm-Message-State: ALQs6tAvcVbqS6HiQwVwTETZOb3CinZVBRb7m5bYtSN78qZKQUDQ/518 J8kFyLZ+fUZdbhgvv5hMtkgrjqGU X-Google-Smtp-Source: AB8JxZoTAYJSe9PipT0UJr20iKwleNYuJd4VZ64V/0TVw7jDAPHHPXOjbxlNxxs10QyIjq0a+kWbhA== X-Received: by 2002:a50:87ee:: with SMTP id 43-v6mr57186834edz.1.1525817722202; Tue, 08 May 2018 15:15:22 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:21 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:45 +0200 Message-Id: <1525817687-34620-29-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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::243 Subject: [Qemu-devel] [PULL 28/30] build: Silence dtc directory creation 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: Jan Kiszka Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Jan Kiszka Align with other mkdir calls. Signed-off-by: Jan Kiszka Reviewed-by: Philippe Mathieu-Daudé Message-Id: <0dd4c8f5-d60e-e564-652f-cd0101f6ee68@web.de> Message-Id: <20180415230522.24404-5-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d71dd5b..35554b5 100644 --- a/Makefile +++ b/Makefile @@ -485,7 +485,7 @@ subdir-dtc: .git-submodule-status dtc/libfdt dtc/tests $(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt.a,) dtc/%: .git-submodule-status - mkdir -p $@ + @mkdir -p $@ # Overriding CFLAGS causes us to lose defines added in the sub-makefile. # Not overriding CFLAGS leads to mis-matches between compilation modes. From patchwork Tue May 8 22:14:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910530 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="bN5cmdAl"; 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 40gZ6X59lsz9s37 for ; Wed, 9 May 2018 08:34:28 +1000 (AEST) Received: from localhost ([::1]:53611 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGBBi-0003Dt-BE for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:34:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAtK-0003MV-Ap for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAtJ-0001eg-38 for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:26 -0400 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:53387) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAtI-0001dF-Bo for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:24 -0400 Received: by mail-wm0-x236.google.com with SMTP id a67so21144136wmf.3 for ; Tue, 08 May 2018 15:15:24 -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=3euoiip8n+vjFBxrUp+AGab3S5EZ2w2eRpI15NWnmqs=; b=bN5cmdAl5Mz72OopsJJ0EhrWulRYNSovX8+FZX8ZNUePx/GC10T7dnnK2/AV94ejjH biPEYj53NQUl9Hvkxo2+W7jaDT1I/VoAPrfoyJQplWjczGY6/eXCg6qrR8cDRpXw13nE gzbbP1E8xaopsUR43ZP6cahu3wlq5gPvdzf21zADSNfHH8vuO5w94frQwwDPWFxmemcu yDZd5oFqC8DKesOY9GJKkJmJC5KbVm3VobLIrOGzhDa2EtzNoJfPxR+xs1/9dhMBTnyu 8DpKD1GQ+ZzNbdeDZL6ZuBSG6drgt3XjMUwDV+ofHcfm3hiyGhvqGn3/eAEPtj/q7NFH vmUA== 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=3euoiip8n+vjFBxrUp+AGab3S5EZ2w2eRpI15NWnmqs=; b=ioODe/EsQO8Ox3q2fI1eU9ybHshM3WwwIoV7JSxBq9BQgCIAu90YerGYJJzb8Qc2xE Mg1KOXxpQW5BcGHJmB5SFvVwe3XLay0+4YTtV5ld+KI1QFIkr/aBeUQcvLctPTDND+t7 8buShpQTiHV8IIyzJ9qdLM3Wv6p28QVDAioo5t8JISlXVxqviUZEGJNyPkWjTm3xEmr2 N3rcd+Vptr1QwQMFY8lcYrrdserJZzG4GyF6YakspuLOh3Ic7xxNM86VN66fBTtV1YgO QWOnRHXiLhW1lvyhAtHaNRzcnaRx9oGmkCPZRyNyRY+IYzQe/ZKf28qD1jN4iCt15K7Y ulGQ== X-Gm-Message-State: ALQs6tA3W8JfMKuEHC9zaQPuz8WFu9jVjJcRNxySkFRXmaQMmf1HLqxY 05TAhT+HqGqiz5CrC5qF0i8bYOYn X-Google-Smtp-Source: AB8JxZrJR0yafdfd4nIC2yz7yru3wMpWYRFGMwEXE54PWp6k8Q5YNI9j5Qb3LjC6rnKOuPLGEN+NSg== X-Received: by 2002:a50:e389:: with SMTP id b9-v6mr57314823edm.4.1525817723106; Tue, 08 May 2018 15:15:23 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:22 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:46 +0200 Message-Id: <1525817687-34620-30-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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::236 Subject: [Qemu-devel] [PULL 29/30] pc-dimm: fix error messages if no slots were defined 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: David Hildenbrand Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: David Hildenbrand If no slots were defined we try to allocate an empty bitmap, which fails. Signed-off-by: David Hildenbrand Reviewed-by: Marcel Apfelbaum Reviewed-by: Thomas Huth Message-Id: <20180427120515.24067-1-david@redhat.com> Signed-off-by: Paolo Bonzini --- hw/mem/pc-dimm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 0119c68..12da89d 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -118,9 +118,16 @@ static int pc_dimm_slot2bitmap(Object *obj, void *opaque) int pc_dimm_get_free_slot(const int *hint, int max_slots, Error **errp) { - unsigned long *bitmap = bitmap_new(max_slots); + unsigned long *bitmap; int slot = 0; + if (max_slots <= 0) { + error_setg(errp, "no slots where allocated, please specify " + "the 'slots' option"); + return slot; + } + + bitmap = bitmap_new(max_slots); object_child_foreach(qdev_get_machine(), pc_dimm_slot2bitmap, bitmap); /* check if requested slot is not occupied */ From patchwork Tue May 8 22:14:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 910526 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="K3bwdmrB"; 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 40gZ2716WLz9s37 for ; Wed, 9 May 2018 08:30:39 +1000 (AEST) Received: from localhost ([::1]:53592 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB80-0000e6-SA for incoming@patchwork.ozlabs.org; Tue, 08 May 2018 18:30:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAtL-0003NW-IH for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAtJ-0001fX-Sj for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:27 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:37216) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAtJ-0001eW-IR for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:25 -0400 Received: by mail-wm0-x243.google.com with SMTP id l1-v6so24210533wmb.2 for ; Tue, 08 May 2018 15:15:25 -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=2dMVxNMzY9BdGmRINb6pbOmx+eqvtfeaG0his1BnFPo=; b=K3bwdmrBfQV+ofAeMlpp2Kx3XhygCeqHJ5oTQEk/DvkFiM/dkQ9qBXawDnMAJNqT1b u1amHVveWxx4/r7AtJS8r1HEO/FyGyLQG8gqeV9jUl9tgOY41cjfHzrDLf5S2OET+J+6 M15CvhAspuCn418rtTWYCgGv7MJrv9vWBsmrw+7IKuRFRfU4LEFtk7FysDq+5UbWSrad c+so8tzQ6G84kAPfAIvqhCR4HFGkzLbIGClDg9Z4X3Dz+zm1eG9wkSIwjOyVKMvc865Q rznflMQaL95AMYhiLg51KhxUKu1OBOCu4YLsC+Cg42KXgs3lzpKfO4aMP3ra0b+9Smf1 HHIA== 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=2dMVxNMzY9BdGmRINb6pbOmx+eqvtfeaG0his1BnFPo=; b=IwlVG0AC1fKMBsmsITFXDHmAWs+Al4K4dTbxLtJaqnh/g8kl4lGMnNZxFJMxYEz7ry nV3U0wfetamK+9mOY6bHtjOyF8q2TOpDZXlNmW6b7a2VPdc0NaC+rTVijk1PzJGJedEv tg6Ui9wK0bZqbTPTKL45tDG+Ps20sY8fM9hUNak5+89jpvBqWf/bqkfKHMSdy1100P9g RKq5idO8gRBz60BvGRj3XgVfZMq0dHTZwPUgKIAPGWsJ7lrxz41PmBPvlZVpvXahq4u5 fgy8pP88cza5fgWbKVm5v53l2Fk4DfFY+uvJni6welNtHRbrHT9uh9pn8/Tdfzy7pu7g d01g== X-Gm-Message-State: ALQs6tAOqgCofKE12gFIVw6GOP4Dn9tQS8SWDSa2eYO88L5n2b68WAvE q6puH8a8V6lo4yMLOodpKrBUxbmZ X-Google-Smtp-Source: AB8JxZqgKnIeJZKmB0QBIXgdDAfeBJ7YD1WO3scSIy62Du/OKmz97ioCPk6RfKpAbNi2j5slLUA+AQ== X-Received: by 2002:a50:b042:: with SMTP id i60-v6mr56873427edd.68.1525817724276; Tue, 08 May 2018 15:15:24 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.15.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:15:23 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:47 +0200 Message-Id: <1525817687-34620-31-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-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 30/30] rename included C files to foo.inc.c, remove osdep.h 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 S. Tsirkin" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" osdep.h is only needed for files that are compiled directly. Remove it from included C source files, and rename them to *.inc.c so that scripts/clean-includes knows to skip them. Cc: Eric Blake Cc: Michael S. Tsirkin Reviewed-by: Stefan Hajnoczi Signed-off-by: Paolo Bonzini --- target/cris/translate.c | 2 +- .../cris/{translate_v10.c => translate_v10.inc.c} | 0 target/mips/translate.c | 2 +- .../{translate_init.c => translate_init.inc.c} | 0 target/ppc/int_helper.c | 2 +- target/ppc/{mfrom_table.c => mfrom_table.inc.c} | 0 target/ppc/translate.c | 2 +- .../ppc/{translate_init.c => translate_init.inc.c} | 1 - ui/vnc-enc-zrle.c | 22 +++++++++++----------- ui/{vnc-enc-zrle-template.c => vnc-enc-zrle.inc.c} | 0 10 files changed, 15 insertions(+), 16 deletions(-) rename target/cris/{translate_v10.c => translate_v10.inc.c} (100%) rename target/mips/{translate_init.c => translate_init.inc.c} (100%) rename target/ppc/{mfrom_table.c => mfrom_table.inc.c} (100%) rename target/ppc/{translate_init.c => translate_init.inc.c} (99%) rename ui/{vnc-enc-zrle-template.c => vnc-enc-zrle.inc.c} (100%) diff --git a/target/cris/translate.c b/target/cris/translate.c index f51a731..ce1ee7a 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -3047,7 +3047,7 @@ static unsigned int crisv32_decoder(CPUCRISState *env, DisasContext *dc) return insn_len; } -#include "translate_v10.c" +#include "translate_v10.inc.c" /* * Delay slots on QEMU/CRIS. diff --git a/target/cris/translate_v10.c b/target/cris/translate_v10.inc.c similarity index 100% rename from target/cris/translate_v10.c rename to target/cris/translate_v10.inc.c diff --git a/target/mips/translate.c b/target/mips/translate.c index d05ee67..26f5404 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -20499,7 +20499,7 @@ void mips_tcg_init(void) "fcr31"); } -#include "translate_init.c" +#include "translate_init.inc.c" void cpu_mips_realize_env(CPUMIPSState *env) { diff --git a/target/mips/translate_init.c b/target/mips/translate_init.inc.c similarity index 100% rename from target/mips/translate_init.c rename to target/mips/translate_init.inc.c diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 35bdf09..1607a7a 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -379,7 +379,7 @@ target_ulong helper_divso(CPUPPCState *env, target_ulong arg1, target_ulong helper_602_mfrom(target_ulong arg) { if (likely(arg < 602)) { -#include "mfrom_table.c" +#include "mfrom_table.inc.c" return mfrom_ROM_table[arg]; } else { return 0; diff --git a/target/ppc/mfrom_table.c b/target/ppc/mfrom_table.inc.c similarity index 100% rename from target/ppc/mfrom_table.c rename to target/ppc/mfrom_table.inc.c diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 2a4140f..257badf 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -6991,7 +6991,7 @@ GEN_HANDLER2_E(trechkpt, "trechkpt", 0x1F, 0x0E, 0x1F, 0x03FFF800, \ }; #include "helper_regs.h" -#include "translate_init.c" +#include "translate_init.inc.c" /*****************************************************************************/ /* Misc PowerPC helpers */ diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.inc.c similarity index 99% rename from target/ppc/translate_init.c rename to target/ppc/translate_init.inc.c index a72be6d..a0b3f18 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.inc.c @@ -18,7 +18,6 @@ * License along with this library; if not, see . */ -#include "qemu/osdep.h" #include "disas/bfd.h" #include "exec/gdbstub.h" #include "kvm_ppc.h" diff --git a/ui/vnc-enc-zrle.c b/ui/vnc-enc-zrle.c index fd63d4f..7493a84 100644 --- a/ui/vnc-enc-zrle.c +++ b/ui/vnc-enc-zrle.c @@ -199,56 +199,56 @@ static void zrle_write_u8(VncState *vs, uint8_t value) #define ZRLE_BPP 8 #define ZYWRLE_ENDIAN ENDIAN_NO -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZRLE_BPP #define ZRLE_BPP 15 #undef ZYWRLE_ENDIAN #define ZYWRLE_ENDIAN ENDIAN_LITTLE -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZYWRLE_ENDIAN #define ZYWRLE_ENDIAN ENDIAN_BIG -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZRLE_BPP #define ZRLE_BPP 16 #undef ZYWRLE_ENDIAN #define ZYWRLE_ENDIAN ENDIAN_LITTLE -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZYWRLE_ENDIAN #define ZYWRLE_ENDIAN ENDIAN_BIG -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZRLE_BPP #define ZRLE_BPP 32 #undef ZYWRLE_ENDIAN #define ZYWRLE_ENDIAN ENDIAN_LITTLE -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZYWRLE_ENDIAN #define ZYWRLE_ENDIAN ENDIAN_BIG -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #define ZRLE_COMPACT_PIXEL 24a #undef ZYWRLE_ENDIAN #define ZYWRLE_ENDIAN ENDIAN_LITTLE -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZYWRLE_ENDIAN #define ZYWRLE_ENDIAN ENDIAN_BIG -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZRLE_COMPACT_PIXEL #define ZRLE_COMPACT_PIXEL 24b #undef ZYWRLE_ENDIAN #define ZYWRLE_ENDIAN ENDIAN_LITTLE -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZYWRLE_ENDIAN #define ZYWRLE_ENDIAN ENDIAN_BIG -#include "vnc-enc-zrle-template.c" +#include "vnc-enc-zrle.inc.c" #undef ZRLE_COMPACT_PIXEL #undef ZRLE_BPP diff --git a/ui/vnc-enc-zrle-template.c b/ui/vnc-enc-zrle.inc.c similarity index 100% rename from ui/vnc-enc-zrle-template.c rename to ui/vnc-enc-zrle.inc.c