From patchwork Fri Jun 28 17:28:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954099 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=L7n14Oq3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jFx5P5kz20Xf for ; Sat, 29 Jun 2024 03:33:25 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPU-0005ZP-Ef; Fri, 28 Jun 2024 13:29:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPG-0005Xx-R4 for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPF-00029R-DY for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=INLXKQAnxyLlbt49tJcziQ4qLBnfUf83esez+1sBRI0=; b=L7n14Oq3gXom2EdgM4JHElORPY8gYv7PRuMZbbcV8bnpJ87o6zWw0mCDoRLlRPWVv8B65H qJT/09/WpSHCWhdxG07CgGn9mUtB+i/5PQYhwwB0xhNKNzD1DalvFfD6hT8wAfM0vGrp75 JXCer4q+wwvSOP14ZOs9kNrjtQSyW/8= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-352-v9FYkyJPMmGOAjA7UA7GRg-1; Fri, 28 Jun 2024 13:29:02 -0400 X-MC-Unique: v9FYkyJPMmGOAjA7UA7GRg-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-57c6979daf7so702072a12.1 for ; Fri, 28 Jun 2024 10:29:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595740; x=1720200540; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=INLXKQAnxyLlbt49tJcziQ4qLBnfUf83esez+1sBRI0=; b=f4DzxdS1gLXSgAseQq1ZtNqpgiyDEx/pXk7In8/W0JORFDz5gpt1MmQpV5wAFthJEH WtLdffB9eenc1qYVvjXvu1rllTZcbfB59NTxLFfdJWk6cj/TogP8T6KvDediVMUvOgVZ 0ZCaLXAllUZgfa3UhMIceCcnOprWBue+fqRsfeF9Bzqbt1/U7e3Oea6zSSy4VMsUVstx KYx2F4b78/wDL6JZUnSGApbxoLS3dbRWJ+A4buzNhT0a2wrv573yr+HLAzATqgt/5FQp DbI7y884GF8Y+3W1jiW9GazGReiz5OyuTy2MZ42MYyFfx6y8LZH97no/ekiXFUXv1xk7 z9gQ== X-Gm-Message-State: AOJu0YzQ3cfSR9zL31cKFvHWRl4xXUw9qt0v7x4OvdzBGSws0nx2pjX9 poyCEwrqElCh4pqnoAoNXw1Dg48xvqMm5RYWInUxLggNgBj2xpWhGHyqQlOJWp6HGDXQJsL53Lb 8rjlrt/IvzJoiYySUH6HemR4Ct/6flPIJCB55KFriWTgRPmbr0S7oqfYEiy4NFLhexIj7iTNW30 yjWMKqXpfBbq6Iqx9fayt9kq2QFXmzw0aw47tD X-Received: by 2002:a05:6402:2106:b0:586:1d26:1b4c with SMTP id 4fb4d7f45d1cf-5861d26215fmr2373241a12.37.1719595740386; Fri, 28 Jun 2024 10:29:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF/5gebsMgK2FjR8MWaXrRdFQ5/t7sozq2ESEK2FoeFROhhvggmbuJbBMICn+ca6F8vNCPeDQ== X-Received: by 2002:a05:6402:2106:b0:586:1d26:1b4c with SMTP id 4fb4d7f45d1cf-5861d26215fmr2373226a12.37.1719595739986; Fri, 28 Jun 2024 10:28:59 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-58612c835dfsm1273877a12.20.2024.06.28.10.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:28:58 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth Subject: [PULL 01/23] configure: detect --cpu=mipsisa64r6 Date: Fri, 28 Jun 2024 19:28:33 +0200 Message-ID: <20240628172855.1147598-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org Treat it as a MIPS64 machine. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 5ad1674ca5f..8b6a2f16ceb 100755 --- a/configure +++ b/configure @@ -450,7 +450,7 @@ case "$cpu" in linux_arch=loongarch ;; - mips64*) + mips64*|mipsisa64*) cpu=mips64 host_arch=mips linux_arch=mips From patchwork Fri Jun 28 17:28:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954096 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UIrZvsRW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jFW5bn9z20Xf for ; Sat, 29 Jun 2024 03:33:03 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPY-0005a3-DU; Fri, 28 Jun 2024 13:29:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPM-0005YO-P0 for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPI-00029Z-In for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LuxMfRanQpqIe+rAUiRiqqmIxZ2Dd4XmJCnCNtxApfk=; b=UIrZvsRWY+wmDspw9eyZP3FivYOihlTmPukyZ08djCKAjnmIQJHbvSJ1T0g9f/A//imxtM etHNqp9We2V54H/o0FcvRBV4bECINzkzzNvFmDAfZ+4qyokXYUXZNSHtrSe6qaAG/1e6El UZVAK3q6wmnEuo6wtZrmtuoZRk8pMrc= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-127-PvG9ViSXOXyMdoi4TXDp7A-1; Fri, 28 Jun 2024 13:29:04 -0400 X-MC-Unique: PvG9ViSXOXyMdoi4TXDp7A-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a729da8fbf1so242389366b.1 for ; Fri, 28 Jun 2024 10:29:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595743; x=1720200543; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LuxMfRanQpqIe+rAUiRiqqmIxZ2Dd4XmJCnCNtxApfk=; b=s4olnSMGNNSwfqFytZWmilFAVsjacqCnXnechVreRO5MD0mqyBtNGiF3IGwejVKzOc lXaZy8uRGp2X32jlD9hlWFd9C8hATbTP2rQ8teqT3RWGPD3Hdy8RUtA8jYitU8fLBtWu NGtGwa/J8gHEO0I1DD/ZzHARHpb9U/BPNfqb5x8Y9q/YkTq2Oiw1714MmF0qeSMAK8Mo TGuuyiZTTv7h8H5/9EAOaTnTn5GjbLwEPCAGv+qryi8aIjJeGyBY/CArreG8vYIQr1j3 fq4acHmJyBb4pDDmnHT8M4G+G1GjeOnYKbBJ58qkpJBehRdfOJSmv1R6hPz7d46Zt9rb 51gg== X-Gm-Message-State: AOJu0Yzx7tWf2DCnrARZ327obcFfQVny92TFiTVFlYENOxqL4O6xBzDT BvOlLlaaVJ26Ecf1AOgz62Yk0MVSfouYkfDEdAq0ISqihuBD5ZGJb5JMi9ARojNqyDm6HGM4/Np 7toawcIXLocr8dn14ntANMGvRs64OtBuGzR6Jvn1TTDHWZJ2mhWPw0dVBp8qbQ7QGW3y4BwkaAn MjNBOLP9fACi9MjivMV7Y/mtXJTf+1i2b2X1e5 X-Received: by 2002:a17:906:1dc7:b0:a72:9077:7172 with SMTP id a640c23a62f3a-a72aeeb156amr156617466b.19.1719595743011; Fri, 28 Jun 2024 10:29:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqqpab9z0zqzegpxovk0mznubm8DA4sMAf4arQpkxJ++AIDETRQpl705KbctmZ6U0/i/s5hg== X-Received: by 2002:a17:906:1dc7:b0:a72:9077:7172 with SMTP id a640c23a62f3a-a72aeeb156amr156616566b.19.1719595742617; Fri, 28 Jun 2024 10:29:02 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab0b889dsm96555866b.225.2024.06.28.10.29.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 02/23] Revert "host/i386: assume presence of POPCNT" Date: Fri, 28 Jun 2024 19:28:34 +0200 Message-ID: <20240628172855.1147598-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org This reverts commit 45ccdbcb24baf99667997fac5cf60318e5e7db51. The x86-64 instruction set can now be tuned down to x86-64 v1 or i386 Pentium Pro. Signed-off-by: Paolo Bonzini --- host/include/i386/host/cpuinfo.h | 1 + tcg/i386/tcg-target.h | 5 +++-- util/cpuinfo-i386.c | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/host/include/i386/host/cpuinfo.h b/host/include/i386/host/cpuinfo.h index c1e94d75ce1..72f6fad61e5 100644 --- a/host/include/i386/host/cpuinfo.h +++ b/host/include/i386/host/cpuinfo.h @@ -11,6 +11,7 @@ #define CPUINFO_ALWAYS (1u << 0) /* so cpuinfo is nonzero */ #define CPUINFO_MOVBE (1u << 2) #define CPUINFO_LZCNT (1u << 3) +#define CPUINFO_POPCNT (1u << 4) #define CPUINFO_BMI1 (1u << 5) #define CPUINFO_BMI2 (1u << 6) #define CPUINFO_AVX1 (1u << 9) diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index ecc69827287..2f67a97e059 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -111,6 +111,7 @@ typedef enum { #endif #define have_bmi1 (cpuinfo & CPUINFO_BMI1) +#define have_popcnt (cpuinfo & CPUINFO_POPCNT) #define have_avx1 (cpuinfo & CPUINFO_AVX1) #define have_avx2 (cpuinfo & CPUINFO_AVX2) #define have_movbe (cpuinfo & CPUINFO_MOVBE) @@ -142,7 +143,7 @@ typedef enum { #define TCG_TARGET_HAS_nor_i32 0 #define TCG_TARGET_HAS_clz_i32 1 #define TCG_TARGET_HAS_ctz_i32 1 -#define TCG_TARGET_HAS_ctpop_i32 1 +#define TCG_TARGET_HAS_ctpop_i32 have_popcnt #define TCG_TARGET_HAS_deposit_i32 1 #define TCG_TARGET_HAS_extract_i32 1 #define TCG_TARGET_HAS_sextract_i32 1 @@ -177,7 +178,7 @@ typedef enum { #define TCG_TARGET_HAS_nor_i64 0 #define TCG_TARGET_HAS_clz_i64 1 #define TCG_TARGET_HAS_ctz_i64 1 -#define TCG_TARGET_HAS_ctpop_i64 1 +#define TCG_TARGET_HAS_ctpop_i64 have_popcnt #define TCG_TARGET_HAS_deposit_i64 1 #define TCG_TARGET_HAS_extract_i64 1 #define TCG_TARGET_HAS_sextract_i64 0 diff --git a/util/cpuinfo-i386.c b/util/cpuinfo-i386.c index 8f2694d88f2..6d474a6259a 100644 --- a/util/cpuinfo-i386.c +++ b/util/cpuinfo-i386.c @@ -35,6 +35,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void) __cpuid(1, a, b, c, d); info |= (c & bit_MOVBE ? CPUINFO_MOVBE : 0); + info |= (c & bit_POPCNT ? CPUINFO_POPCNT : 0); info |= (c & bit_PCLMUL ? CPUINFO_PCLMUL : 0); /* NOTE: our AES support requires SSSE3 (PSHUFB) as well. */ From patchwork Fri Jun 28 17:28:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954081 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YFVG9ZZN; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jBd09GSz20Xf for ; Sat, 29 Jun 2024 03:30:32 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPW-0005Zz-QW; Fri, 28 Jun 2024 13:29:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPK-0005YG-2a for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPI-00029l-Hx for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i1Dd/q0yvFV1Rcm+rk+YwoeGVJGUNMen0d4jeqopdXw=; b=YFVG9ZZN9VjLyHSueUCTVetvBTzL/zEIwb2dkN05kQ58NMJhCsZ5WG95734B1R/7fuxEu4 SKmSorlOGKA7ltJve5x71kSUY3nW+spH0ABQqlDZwcSkVG4PesuKSl04YB9QP2SOF1cM6V hpWHFQ2VHrYtLWWyBouFNS1OxG+UvMs= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-631-Hi7_3uahNkemX8807mJb5A-1; Fri, 28 Jun 2024 13:29:06 -0400 X-MC-Unique: Hi7_3uahNkemX8807mJb5A-1 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-57d22ea3e71so606461a12.2 for ; Fri, 28 Jun 2024 10:29:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595744; x=1720200544; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i1Dd/q0yvFV1Rcm+rk+YwoeGVJGUNMen0d4jeqopdXw=; b=NEticempQs83gDNbfsKJ5hh8Vav5BqLk7vaz7DlWQ9itbP5fFSFi9MOK1sxrHARotx 173++f6jWGOvSVmlhXQrsjPftKthUhcKp4HznMPPoeNnLlRRDg2bffP8+Ye2BV7+WLCe ZlNiSo986CSJdhS1CdELYEIc3quPqxECsdzWA35IcoTq59tGSt+4+CgOqfbo54EIRqgf y4Bm9xz9LTHS5W52BGx57EvXWQ4GQLFwTaF2AfjDhYkPjQ5JApplz42HJCNj8ggMnVXC VbfA1YKfLoQ4gQxj6lES5CuNC1k82W5sCzl0H2a7ZJbG4ANcqX1VWJt1NPkIKuO4J04v 4qrw== X-Gm-Message-State: AOJu0YyDuEuutaWQbAgJjQVOGY02a8l7uRcbVivUFQeDxzAQgAlYgl5U eQ/mcHYjGGpS5SmG5LrOqUrKoPEkvBgeCUkdLupA0qJIqABIFN9bn87kIlbWBUx/Ouhgpc4qtON idiVsQbhv1R2dNM9No3w89W9NzR1P35ZEJ/G2xd3LjMMlKvxFxmbIFKPIxwYrBUohNoep478kVn WrwlTx7QnbYekt7dQYzodryfK12RbPTwMbF2GB X-Received: by 2002:a50:8a96:0:b0:57c:947c:52f6 with SMTP id 4fb4d7f45d1cf-57d4a2cd8ebmr13683870a12.26.1719595744623; Fri, 28 Jun 2024 10:29:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCi/LNYsqi0Tp/zQGvOvEStoHRbuR6n00KmjMFzwTnHUixLO2vlbKMm05Jv8MYqEecdcoFWA== X-Received: by 2002:a50:8a96:0:b0:57c:947c:52f6 with SMTP id 4fb4d7f45d1cf-57d4a2cd8ebmr13683860a12.26.1719595744305; Fri, 28 Jun 2024 10:29:04 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-58612c835f7sm1284662a12.8.2024.06.28.10.29.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 03/23] Revert "host/i386: assume presence of SSSE3" Date: Fri, 28 Jun 2024 19:28:35 +0200 Message-ID: <20240628172855.1147598-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org This reverts commit 433cd6d94a8256af70a5200f236dc8047c3c1468. The x86-64 instruction set can now be tuned down to x86-64 v1 or i386 Pentium Pro. Signed-off-by: Paolo Bonzini --- util/cpuinfo-i386.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/cpuinfo-i386.c b/util/cpuinfo-i386.c index 6d474a6259a..ca74ef04f54 100644 --- a/util/cpuinfo-i386.c +++ b/util/cpuinfo-i386.c @@ -38,8 +38,8 @@ unsigned __attribute__((constructor)) cpuinfo_init(void) info |= (c & bit_POPCNT ? CPUINFO_POPCNT : 0); info |= (c & bit_PCLMUL ? CPUINFO_PCLMUL : 0); - /* NOTE: our AES support requires SSSE3 (PSHUFB) as well. */ - info |= (c & bit_AES) ? CPUINFO_AES : 0; + /* Our AES support requires PSHUFB as well. */ + info |= ((c & bit_AES) && (c & bit_SSSE3) ? CPUINFO_AES : 0); /* For AVX features, we must check available and usable. */ if ((c & bit_AVX) && (c & bit_OSXSAVE)) { From patchwork Fri Jun 28 17:28:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954097 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PUXUyxlr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jFt1Czgz20Xf for ; Sat, 29 Jun 2024 03:33:22 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPa-0005bj-BW; Fri, 28 Jun 2024 13:29:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPM-0005YP-PE for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPK-0002AA-1l for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595749; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MD4v48+cGAfMcTScuUpWWBLZnAAnBazGHTddcBuIHp4=; b=PUXUyxlr15vCv4YGHHp+vTbGoJyHTAFOIf/95leXqWjbJ/xhwqvjywngZy2zqERnEM6Hol y+9jToFA+/jrMGU4s/AsrvaRRGElEkOA3TRh/w4MKusMUcCiar/vsH5V9Bif5e1YngH23X PghnYUOkE7Qup5ojoe/d+9hKtHyL/Xs= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-617-W8-THCXMMrefXPZem4Po2w-1; Fri, 28 Jun 2024 13:29:07 -0400 X-MC-Unique: W8-THCXMMrefXPZem4Po2w-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a6fcb1a708dso62233866b.2 for ; Fri, 28 Jun 2024 10:29:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595746; x=1720200546; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MD4v48+cGAfMcTScuUpWWBLZnAAnBazGHTddcBuIHp4=; b=OmBKGc181G+miECDQ8baDyyTsfkDAeTDyDFTzKLcS355PPgsZ0QH7L6A9f68H7O3KX Yp8pno6U3Seqw39S2/kOWyohBebA4eUrobFvziYFWkzz65eE0YIxBMWjK0nT9eNXZKEi A5T5xiuOMLg3m3U2q2DYROjepnOHeR/Jx/76vj/ZC9mIn4L9Qtad+MzHSOvsmMPpjUCs aq8pzXrQ0lBVX5sXsVfqZseFQFmCt8RiC7QExERO9rHaPI8zfe2JkmWLxu1DrYVYSFS6 93abXY9oa/WziUbfqz9GvX6k83p0lFswsk/nU54QG9mgQTsPlD2IPfIIuqQNyFUi9iVF ASMg== X-Gm-Message-State: AOJu0Yxq4lrVflVzhljU/QmSYf2Tpc6CP0jn2K/7Fq+NA6ZT0V84u+bB yVFGg24Fo+o3z35BeGihy7wDKFzoj0VdO9+Clk3vwfl7g3hxt2nF9kCBGrVcd07GTXJdE/S2RUA a87t9jShWqdODKN8T/IhiB3r6UqWrVmuO2x1zTrZuIACDqkCCck7QpD0bt6f4Nh09ff2milU7CM z1Tfa0wioawoF61lpTIf/2bqifSC5IZE+ipHXd X-Received: by 2002:a17:907:7ea7:b0:a72:b26c:7792 with SMTP id a640c23a62f3a-a72b26c7ad7mr164103266b.69.1719595746111; Fri, 28 Jun 2024 10:29:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFfDt3QXBwhhq033fU35UAhfYzNDixvdgyl/YjMCQW3QJzE9iCWoHn5zXkCdqYLDdhB7Xwckg== X-Received: by 2002:a17:907:7ea7:b0:a72:b26c:7792 with SMTP id a640c23a62f3a-a72b26c7ad7mr164101666b.69.1719595745650; Fri, 28 Jun 2024 10:29:05 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab0b56e6sm95311966b.202.2024.06.28.10.29.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:05 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 04/23] Revert "host/i386: assume presence of SSE2" Date: Fri, 28 Jun 2024 19:28:36 +0200 Message-ID: <20240628172855.1147598-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org This reverts commit b18236897ca15c3db1506d8edb9a191dfe51429c. The x86-64 instruction set can now be tuned down to x86-64 v1 or i386 Pentium Pro. Signed-off-by: Paolo Bonzini --- host/include/i386/host/cpuinfo.h | 1 + util/cpuinfo-i386.c | 1 + host/include/i386/host/bufferiszero.c.inc | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/host/include/i386/host/cpuinfo.h b/host/include/i386/host/cpuinfo.h index 72f6fad61e5..81771733eaa 100644 --- a/host/include/i386/host/cpuinfo.h +++ b/host/include/i386/host/cpuinfo.h @@ -14,6 +14,7 @@ #define CPUINFO_POPCNT (1u << 4) #define CPUINFO_BMI1 (1u << 5) #define CPUINFO_BMI2 (1u << 6) +#define CPUINFO_SSE2 (1u << 7) #define CPUINFO_AVX1 (1u << 9) #define CPUINFO_AVX2 (1u << 10) #define CPUINFO_AVX512F (1u << 11) diff --git a/util/cpuinfo-i386.c b/util/cpuinfo-i386.c index ca74ef04f54..90f92a42dc8 100644 --- a/util/cpuinfo-i386.c +++ b/util/cpuinfo-i386.c @@ -34,6 +34,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void) if (max >= 1) { __cpuid(1, a, b, c, d); + info |= (d & bit_SSE2 ? CPUINFO_SSE2 : 0); info |= (c & bit_MOVBE ? CPUINFO_MOVBE : 0); info |= (c & bit_POPCNT ? CPUINFO_POPCNT : 0); info |= (c & bit_PCLMUL ? CPUINFO_PCLMUL : 0); diff --git a/host/include/i386/host/bufferiszero.c.inc b/host/include/i386/host/bufferiszero.c.inc index 3b9605d806f..74ae98580f6 100644 --- a/host/include/i386/host/bufferiszero.c.inc +++ b/host/include/i386/host/bufferiszero.c.inc @@ -110,13 +110,14 @@ static biz_accel_fn const accel_table[] = { static unsigned best_accel(void) { -#ifdef CONFIG_AVX2_OPT unsigned info = cpuinfo_init(); + +#ifdef CONFIG_AVX2_OPT if (info & CPUINFO_AVX2) { return 2; } #endif - return 1; + return info & CPUINFO_SSE2 ? 1 : 0; } #else From patchwork Fri Jun 28 17:28:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954098 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=F4Ki1lG8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jFv21s8z20Xf for ; Sat, 29 Jun 2024 03:33:23 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPY-0005aA-NS; Fri, 28 Jun 2024 13:29:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPO-0005YW-90 for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPM-0002AR-Aq for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595751; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EZr6EpxPTnCtfkI/16JpVzSMCa8vz0QSxvxLLnS2Bk8=; b=F4Ki1lG8YYs2cHnGN5VVIgy+JhQQK1CQassz+MDDvAMxx/+C1epYNOPk3ZjttOq2GH8g4a W1avYlxd1DRZ7vl37f+D560dmclZ926I5S6gJS6yUPv2K9IVh1Y7sh6h4sptQbCWyDpbxv edq5FkbtB/ev1dpSLyScFTjzVyXU+2E= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-526-YxdTIJMnPICnGVWpjTaBkA-1; Fri, 28 Jun 2024 13:29:09 -0400 X-MC-Unique: YxdTIJMnPICnGVWpjTaBkA-1 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-57d22ea3e71so606501a12.2 for ; Fri, 28 Jun 2024 10:29:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595748; x=1720200548; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EZr6EpxPTnCtfkI/16JpVzSMCa8vz0QSxvxLLnS2Bk8=; b=UzYELiGEnkkiekr+e8+TlaUWzV14APNzsUYFN+cifuYBng4+HCSHzGuBJU/x28xwEb 4Vu5usmramx70p5qaUnksHQUowrqOG3RaEo/5Kfoza9RyTgvUovl4rVYlzO7tM/agNyE kKL8x+boOPbFCtB3oCv5QFZWki/MZToSzk2BBjztSGMfxEV6PdQjB4AR8IDVywCDe3IR sckevlOgxA9Y3j0WERrFWxsboMOIM5BekhyWXhZTVjdVbDLBVcFxagViZbKEIwFwL5AI FpUZldRY+hzEVH6blyFssRiQJvAAr7pg4TZSnqSNDM2JiIAWz8JKuwnoXIqBTBLtOwI4 Psmg== X-Gm-Message-State: AOJu0YwhcezQ1CZKw+VniwgVh8ef+KDmfXGFkW3ufxvoTvaBD9ykRC67 vvvz3t8K9iv3I2pqQcLGpIAiNk2JcJFE5bELy/lXdEQ5kRvqESEHzcQD/EcfivJnBiTAU18UG3y zWKdptOJs0iOFO69ositoBDx3kyiWgISDuYLeSE0pRmVNINyKD8QLm2Lz2soPvTdhK+tXI2f3oK tYz7HUFLKj6CStqPea/A8VOptYD5s4HoL7ZX4k X-Received: by 2002:a50:c058:0:b0:572:4fc3:3a28 with SMTP id 4fb4d7f45d1cf-57d4a28e8bcmr13800176a12.23.1719595747827; Fri, 28 Jun 2024 10:29:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrLT2EykPq3z0vUTeobzU3w7rycYdNp4vNjPiZoymiOPwpisEhtIXVa2fHQ+6FULtTF+aDyw== X-Received: by 2002:a50:c058:0:b0:572:4fc3:3a28 with SMTP id 4fb4d7f45d1cf-57d4a28e8bcmr13800160a12.23.1719595747302; Fri, 28 Jun 2024 10:29:07 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-58612c8720dsm1288640a12.7.2024.06.28.10.29.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:06 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 05/23] meson: allow configuring the x86-64 baseline Date: Fri, 28 Jun 2024 19:28:37 +0200 Message-ID: <20240628172855.1147598-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add a Meson option to configure which x86-64 instruction set to use. QEMU will now default to x86-64-v1 + cmpxchg16b for 64-bit builds (that corresponds to a Pentium 4 for 32-bit builds). The baseline can be tuned down to Pentium Pro for 32-bit builds (with -Dx86_version=0), or up as desired. Acked-by: Richard Henderson Signed-off-by: Paolo Bonzini --- meson.build | 41 ++++++++++++++++++++++++++++------- meson_options.txt | 3 +++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index 97e00d6f59b..6e694ecd9fe 100644 --- a/meson.build +++ b/meson.build @@ -336,15 +336,40 @@ if host_arch == 'i386' and not cc.links(''' qemu_common_flags = ['-march=i486'] + qemu_common_flags endif -# Assume x86-64-v2 (minus CMPXCHG16B for 32-bit code) -if host_arch == 'i386' - qemu_common_flags = ['-mfpmath=sse'] + qemu_common_flags -endif +# Pick x86-64 baseline version if host_arch in ['i386', 'x86_64'] - qemu_common_flags = ['-mpopcnt', '-msse4.2'] + qemu_common_flags -endif -if host_arch == 'x86_64' - qemu_common_flags = ['-mcx16'] + qemu_common_flags + if get_option('x86_version') == '0' and host_arch == 'x86_64' + error('x86_64-v1 required for x86-64 hosts') + endif + + # add flags for individual instruction set extensions + if get_option('x86_version') >= '1' + if host_arch == 'i386' + qemu_common_flags = ['-mfpmath=sse'] + qemu_common_flags + else + # present on basically all processors but technically not part of + # x86-64-v1, so only include -mneeded for x86-64 version 2 and above + qemu_common_flags = ['-mcx16'] + qemu_common_flags + endif + endif + if get_option('x86_version') >= '2' + qemu_common_flags = ['-mpopcnt'] + qemu_common_flags + qemu_common_flags = cc.get_supported_arguments('-mneeded') + qemu_common_flags + endif + if get_option('x86_version') >= '3' + qemu_common_flags = ['-mmovbe', '-mabm', '-mbmi1', '-mbmi2', '-mfma', '-mf16c'] + qemu_common_flags + endif + + # add required vector instruction set (each level implies those below) + if get_option('x86_version') == '1' + qemu_common_flags = ['-msse2'] + qemu_common_flags + elif get_option('x86_version') == '2' + qemu_common_flags = ['-msse4.2'] + qemu_common_flags + elif get_option('x86_version') == '3' + qemu_common_flags = ['-mavx2'] + qemu_common_flags + elif get_option('x86_version') == '4' + qemu_common_flags = ['-mavx512f', '-mavx512bw', '-mavx512cd', '-mavx512dq', '-mavx512vl'] + qemu_common_flags + endif endif if get_option('prefer_static') diff --git a/meson_options.txt b/meson_options.txt index 7a79dd89706..6065ed2d352 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -370,3 +370,6 @@ option('qemu_ga_version', type: 'string', value: '', option('hexagon_idef_parser', type : 'boolean', value : true, description: 'use idef-parser to automatically generate TCG code for the Hexagon frontend') + +option('x86_version', type : 'combo', choices : ['0', '1', '2', '3', '4'], value: '1', + description: 'tweak required x86_64 architecture version beyond compiler default') diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 58d49a447d5..62842d47e88 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -82,6 +82,8 @@ meson_options_help() { printf "%s\n" ' --with-suffix=VALUE Suffix for QEMU data/modules/config directories' printf "%s\n" ' (can be empty) [qemu]' printf "%s\n" ' --with-trace-file=VALUE Trace file prefix for simple backend [trace]' + printf "%s\n" ' --x86-version=CHOICE tweak required x86_64 architecture version beyond' + printf "%s\n" ' compiler default [1] (choices: 0/1/2/3)' printf "%s\n" '' printf "%s\n" 'Optional features, enabled with --enable-FEATURE and' printf "%s\n" 'disabled with --disable-FEATURE, default is enabled if available' @@ -552,6 +554,7 @@ _meson_option_parse() { --disable-werror) printf "%s" -Dwerror=false ;; --enable-whpx) printf "%s" -Dwhpx=enabled ;; --disable-whpx) printf "%s" -Dwhpx=disabled ;; + --x86-version=*) quote_sh "-Dx86_version=$2" ;; --enable-xen) printf "%s" -Dxen=enabled ;; --disable-xen) printf "%s" -Dxen=disabled ;; --enable-xen-pci-passthrough) printf "%s" -Dxen_pci_passthrough=enabled ;; From patchwork Fri Jun 28 17:28:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RJ6MTIT9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jBP65s6z20Xf for ; Sat, 29 Jun 2024 03:30:21 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPW-0005a1-WB; Fri, 28 Jun 2024 13:29:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPT-0005ZX-Pv for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPP-0002Au-8F for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2zJrXRaDXBIm9h7tTU28UT9xcD/K/7uFNW/URjbJHRw=; b=RJ6MTIT9v89PeXpFvx0wkwauOaKucxjF8Ndqy715rrsfN1azrSiyowjYIVmHbx5Yx6Oeqk An7dXmNMtj8C0Q3IMsq9ROAnnjcDUxb7v/UcRPg1rXlmRKU4jAOLex3wBo4ENlhrZJWsGM A+r1/FptBwgAgYUHxrKVXWuz8fc3NeY= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-606-C_SVBynnP1WADU07CsuFnw-1; Fri, 28 Jun 2024 13:29:12 -0400 X-MC-Unique: C_SVBynnP1WADU07CsuFnw-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a6f571c3eefso57917266b.2 for ; Fri, 28 Jun 2024 10:29:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595750; x=1720200550; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2zJrXRaDXBIm9h7tTU28UT9xcD/K/7uFNW/URjbJHRw=; b=tDNrAfbJq3zkHlga5Tv/8JVCAPghmuNBuAK/rKsuQNJJxtQNlz1EN0AcoG0WBxyJua HVCCdhP7Pb2a2fVOhRY5Xi9zM1O9xTcrY8SE1ONhOW1WVUJzXJaM21F0IqCok1/QojlT /ARMmejKij7bxPiWa+zq0stZ+l0APYc1Dja55k/5X7UJTzjRoY61BmgLFPzJ6fVaZnET 0O9H6RJY9A+DIdChXX3iyZfaKbo42qxNbmWPl9d1Q/iD8u+/jFaVy+HJhVE5awMPu9hU DihD5ejvWcoQ65IAkTovxvXyu0IwzaPVgJNac/QifFX8y8rMbSThuxMP+H3USbJ1XNFG UO2w== X-Gm-Message-State: AOJu0YyWfM/lU2P+BZ3YiFQqAq2XdHe7/gvy93VcOU0XiX41czqP4f4u V4Rw52dW+VH5R0Ar6i02xChOIukObY+wevbs3oHpp7cs4qefKnCX8BduAn0oshOhHsLd7KOFaXN 3ubiihU8Xfx34mE6JRS4YfiRxIhI5EBwtvvJ6i8OyYj6eB+ZMYX8kvCXy+gl0warfsfyp56onN0 JjKwkO0TEYJSjahm7af9IGZTuEzQ22lr7pXLPi X-Received: by 2002:a17:907:d310:b0:a72:65e5:3e2 with SMTP id a640c23a62f3a-a727f650205mr843279566b.6.1719595750386; Fri, 28 Jun 2024 10:29:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+buScbpv3BPqe4MQkVHuuLXiYuQczrX/JB59NEf+S41DyzRHTqqlmOkfRlxLTab1bjtawDw== X-Received: by 2002:a17:907:d310:b0:a72:65e5:3e2 with SMTP id a640c23a62f3a-a727f650205mr843278266b.6.1719595749999; Fri, 28 Jun 2024 10:29:09 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab08cecfsm97165066b.147.2024.06.28.10.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:08 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 06/23] meson: remove dead optimization option Date: Fri, 28 Jun 2024 19:28:38 +0200 Message-ID: <20240628172855.1147598-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- meson.build | 13 ------------- meson_options.txt | 2 -- scripts/meson-buildoptions.sh | 3 --- 3 files changed, 18 deletions(-) diff --git a/meson.build b/meson.build index 6e694ecd9fe..54e6b09f4fb 100644 --- a/meson.build +++ b/meson.build @@ -2874,18 +2874,6 @@ config_host_data.set('CONFIG_AVX2_OPT', get_option('avx2') \ int main(int argc, char *argv[]) { return bar(argv[argc - 1]); } '''), error_message: 'AVX2 not available').allowed()) -config_host_data.set('CONFIG_AVX512F_OPT', get_option('avx512f') \ - .require(have_cpuid_h, error_message: 'cpuid.h not available, cannot enable AVX512F') \ - .require(cc.links(''' - #include - #include - static int __attribute__((target("avx512f"))) bar(void *a) { - __m512i x = *(__m512i *)a; - return _mm512_test_epi64_mask(x, x); - } - int main(int argc, char *argv[]) { return bar(argv[argc - 1]); } - '''), error_message: 'AVX512F not available').allowed()) - config_host_data.set('CONFIG_AVX512BW_OPT', get_option('avx512bw') \ .require(have_cpuid_h, error_message: 'cpuid.h not available, cannot enable AVX512BW') \ .require(cc.links(''' @@ -4283,7 +4271,6 @@ summary_info += {'mutex debugging': get_option('debug_mutex')} summary_info += {'memory allocator': get_option('malloc')} summary_info += {'avx2 optimization': config_host_data.get('CONFIG_AVX2_OPT')} summary_info += {'avx512bw optimization': config_host_data.get('CONFIG_AVX512BW_OPT')} -summary_info += {'avx512f optimization': config_host_data.get('CONFIG_AVX512F_OPT')} summary_info += {'gcov': get_option('b_coverage')} summary_info += {'thread sanitizer': get_option('tsan')} summary_info += {'CFI support': get_option('cfi')} diff --git a/meson_options.txt b/meson_options.txt index 6065ed2d352..0269fa0f16e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -119,8 +119,6 @@ option('membarrier', type: 'feature', value: 'disabled', option('avx2', type: 'feature', value: 'auto', description: 'AVX2 optimizations') -option('avx512f', type: 'feature', value: 'disabled', - description: 'AVX512F optimizations') option('avx512bw', type: 'feature', value: 'auto', description: 'AVX512BW optimizations') option('keyring', type: 'feature', value: 'auto', diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 62842d47e88..cfadb5ea86a 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -95,7 +95,6 @@ meson_options_help() { printf "%s\n" ' auth-pam PAM access control' printf "%s\n" ' avx2 AVX2 optimizations' printf "%s\n" ' avx512bw AVX512BW optimizations' - printf "%s\n" ' avx512f AVX512F optimizations' printf "%s\n" ' blkio libblkio block device driver' printf "%s\n" ' bochs bochs image format support' printf "%s\n" ' bpf eBPF support' @@ -240,8 +239,6 @@ _meson_option_parse() { --disable-avx2) printf "%s" -Davx2=disabled ;; --enable-avx512bw) printf "%s" -Davx512bw=enabled ;; --disable-avx512bw) printf "%s" -Davx512bw=disabled ;; - --enable-avx512f) printf "%s" -Davx512f=enabled ;; - --disable-avx512f) printf "%s" -Davx512f=disabled ;; --enable-gcov) printf "%s" -Db_coverage=true ;; --disable-gcov) printf "%s" -Db_coverage=false ;; --enable-lto) printf "%s" -Db_lto=true ;; From patchwork Fri Jun 28 17:28:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954093 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=R6bl7Cxk; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jFK1w0fz20b0 for ; Sat, 29 Jun 2024 03:32:53 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPY-0005aP-Sk; Fri, 28 Jun 2024 13:29:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPT-0005ZW-6z for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPR-0002B3-Rs for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595755; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yrycet3jL1WSrURyl4kYUHh4gIffr2JcIs+cSDvgvbc=; b=R6bl7CxkWyeZrCiOWI06SJOs8JvPz3sBDcY/ry36JUKmjg6IjGx6YUGCrp+gCBXqY7rljc ldwFUtkuEMrVzCt4icAlvRA+4PG2/S1SHwQFWZf6HgG7wkGQSJdJnZ1WSYAK5kfmnDnjVl lHtni1MROkC0C1HUFfsA5MLGNvzEki4= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-534-VEGTQrC7Np-G6hkKg-XF1g-1; Fri, 28 Jun 2024 13:29:14 -0400 X-MC-Unique: VEGTQrC7Np-G6hkKg-XF1g-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a7246c24b00so60613266b.0 for ; Fri, 28 Jun 2024 10:29:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595752; x=1720200552; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yrycet3jL1WSrURyl4kYUHh4gIffr2JcIs+cSDvgvbc=; b=kedmopj+mQ+rHv2pKNlTVFDp28mwyx6ZJ4Pd+JDB1dcVwv+cPKWQZMUZdVZrHNCsFO jlnJcMkojNWde2XAZkGFzqaGFMRTp7cakTT4IH/SOSN/ZVcbqe5T7FSz955AX4r7CVXt 4ete8dmImEsIzVmZGxtV+vikCHmUpezzxsbX29cklxu3DAKqny4TLgUJkd++mQQ+RDIQ CVG3vBnqN6v4jZV2HoF+uoTODWZd/AWUJ8ypToOrt8VB/WOdClBgHNXNz9dIeBQl9wmg BBS6ovAhxDvzeKTrjH9ePI+99YPQlYZdVjs2zsgfGTaVZFy2hGmQWV8Q1O/t7vUyrIHL iVxw== X-Gm-Message-State: AOJu0YybXf9NrHHv8n2qWnG9xFeFnEuYiIi3hge+C3hlzl+AaTrxLEi7 L8VIKhQRn5bBnUo8I41yPAEcxROlNz25W/VG647qfg+b/ifWGRneqI+xxppLj7GtRfl8WdOd6e5 ZWpxlKjoHxNC9NclNj3B8IBO5cYzZIYEy2GB+NKFg0AbaX7+pIX5fYdjYR9zKXFiXGn3V+3FSxU n6Hz7Iwzly9HjgOMUSc7XiteV9VIWOoew1odyT X-Received: by 2002:a17:907:a709:b0:a72:8a0b:9ba5 with SMTP id a640c23a62f3a-a728a0ba5f6mr758861066b.54.1719595752713; Fri, 28 Jun 2024 10:29:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDjDkUflzZxcA71Z5WcNR6icVZeEH16WRvJ6Bv0LppHSA4QooULAB0rLE9Ld9YvEHGbLpjBQ== X-Received: by 2002:a17:907:a709:b0:a72:8a0b:9ba5 with SMTP id a640c23a62f3a-a728a0ba5f6mr758859566b.54.1719595752310; Fri, 28 Jun 2024 10:29:12 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aafba2cesm96613466b.93.2024.06.28.10.29.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:11 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 07/23] block: make assertion more generic Date: Fri, 28 Jun 2024 19:28:39 +0200 Message-ID: <20240628172855.1147598-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org .bdrv_needs_filename is only set for drivers that also set bdrv_file_open, i.e. protocol drivers. So we can make the assertion always, it will always pass for those drivers that use bdrv_open. Signed-off-by: Paolo Bonzini --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.c b/block.c index 468cf5e67d7..69a2905178a 100644 --- a/block.c +++ b/block.c @@ -1655,8 +1655,8 @@ bdrv_open_driver(BlockDriverState *bs, BlockDriver *drv, const char *node_name, bs->drv = drv; bs->opaque = g_malloc0(drv->instance_size); + assert(!drv->bdrv_needs_filename || bs->filename[0]); if (drv->bdrv_file_open) { - assert(!drv->bdrv_needs_filename || bs->filename[0]); ret = drv->bdrv_file_open(bs, options, open_flags, &local_err); } else if (drv->bdrv_open) { ret = drv->bdrv_open(bs, options, open_flags, &local_err); From patchwork Fri Jun 28 17:28:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954100 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WPtVen55; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jG665JXz20Xf for ; Sat, 29 Jun 2024 03:33:34 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPa-0005c2-Nb; Fri, 28 Jun 2024 13:29:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPY-0005aC-EM for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPT-0002BA-1K for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595758; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PyxEzNGqoXJbFXc5PayVB6u8Z/13e83iLysZlGsVNCM=; b=WPtVen55qqrwatJ+4xL5pFhAK+A0NakJw74tfiduBDjLwpzi/GGkhApdRouqfD+aoVcLz5 5cLv3fitwsAigPYlsyo++N7aglBy60ZAAnf8aRCoVu2Qqh44f21S3szyaEeapufIsl2Owd J/YqIA1dxyBZOSjFsle7BC2OmXsx1hY= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-682--F-wRyZHMbCgr62368sGDg-1; Fri, 28 Jun 2024 13:29:15 -0400 X-MC-Unique: -F-wRyZHMbCgr62368sGDg-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-584ef6c00c0so2653961a12.1 for ; Fri, 28 Jun 2024 10:29:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595754; x=1720200554; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PyxEzNGqoXJbFXc5PayVB6u8Z/13e83iLysZlGsVNCM=; b=s1r6bm25TzHHF/EYIWsaReLt+s/T3zOSPzPCFpZ+25AZCH4XP5bxqFTUFVl4tTHSen rEnF8khqjUNEGMn7dUcuTPbniUpDbMI/+S+iDrdRzFpmOXp3QGJhgEmX2Owgj+c8VXXI 7W4HCfcHEEl1ZMcgJMPezoMxRIky8f77OrYtlmtWO/ryswJwoTRkFbTmxVnNS4AjUpSW 2bnROAR6ZkYXtdVdOFFHorG4usAneNSbLebdqiBLRdKA+LX0NPB8FLpcS5P0bDU5QoRk 2MtMwz1uQsy3ikuEXsY9GWc5cno6ETt6jcclbpDOFOzy0S3AEKH67LGOg5ngD0yEmbX5 dtZw== X-Gm-Message-State: AOJu0Yz0/OPaoyaN7+ZSxl6bxwWZrZ6qWEJCN6xsVBv9dNx2Ub6Otaet NP7nxRbAICH38KLKng9FnpgX/TTiFctl07IurrVwSyHiad9R30aFwFWyILhE8D1YM3YZlah5Ge8 h6YrX5e1OkKOpka2e7QEIGqBrO87YgrGvodt3NvALQAF61f09sZxvy/0yvECqnpE9y+nju8wrXZ 67PRZHtSxNZYWf3WCgvrG4OqK4rDD14x4OrVVG X-Received: by 2002:aa7:d7c2:0:b0:57d:4396:6085 with SMTP id 4fb4d7f45d1cf-5865da42a99mr1622900a12.19.1719595754131; Fri, 28 Jun 2024 10:29:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJfpDZOPsxn2eXDHKA1scV4PS31pnXZO508MLJNHaZr2sVPtrWV+cG0q4Q+IHSseHG8zHuaA== X-Received: by 2002:aa7:d7c2:0:b0:57d:4396:6085 with SMTP id 4fb4d7f45d1cf-5865da42a99mr1622888a12.19.1719595753842; Fri, 28 Jun 2024 10:29:13 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5861012371esm1294794a12.0.2024.06.28.10.29.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:13 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 08/23] block: do not check bdrv_file_open Date: Fri, 28 Jun 2024 19:28:40 +0200 Message-ID: <20240628172855.1147598-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org The set of BlockDrivers that have .bdrv_file_open coincides with those that have .protocol_name and guess what---checking drv->bdrv_file_open is done to see if the driver is a protocol. So check drv->protocol_name instead. Signed-off-by: Paolo Bonzini --- block.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/block.c b/block.c index 69a2905178a..dd14ba85fc3 100644 --- a/block.c +++ b/block.c @@ -926,7 +926,6 @@ BlockDriver *bdrv_find_protocol(const char *filename, int i; GLOBAL_STATE_CODE(); - /* TODO Drivers without bdrv_file_open must be specified explicitly */ /* * XXX(hch): we really should not let host device detection @@ -1983,7 +1982,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockBackend *file, open_flags = bdrv_open_flags(bs, bs->open_flags); node_name = qemu_opt_get(opts, "node-name"); - assert(!drv->bdrv_file_open || file == NULL); + assert(!drv->protocol_name || file == NULL); ret = bdrv_open_driver(bs, drv, node_name, options, open_flags, errp); if (ret < 0) { goto fail_opts; @@ -2084,7 +2083,7 @@ static int bdrv_fill_options(QDict **options, const char *filename, } /* If the user has explicitly specified the driver, this choice should * override the BDRV_O_PROTOCOL flag */ - protocol = drv->bdrv_file_open; + protocol = drv->protocol_name; } if (protocol) { @@ -4123,7 +4122,7 @@ bdrv_open_inherit(const char *filename, const char *reference, QDict *options, } /* BDRV_O_PROTOCOL must be set iff a protocol BDS is about to be created */ - assert(!!(flags & BDRV_O_PROTOCOL) == !!drv->bdrv_file_open); + assert(!!(flags & BDRV_O_PROTOCOL) == !!drv->protocol_name); /* file must be NULL if a protocol BDS is about to be created * (the inverse results in an error message from bdrv_open_common()) */ assert(!(flags & BDRV_O_PROTOCOL) || !file); @@ -5971,7 +5970,7 @@ int64_t coroutine_fn bdrv_co_get_allocated_file_size(BlockDriverState *bs) return drv->bdrv_co_get_allocated_file_size(bs); } - if (drv->bdrv_file_open) { + if (drv->protocol_name) { /* * Protocol drivers default to -ENOTSUP (most of their data is * not stored in any of their children (if they even have any), @@ -8030,7 +8029,7 @@ void bdrv_refresh_filename(BlockDriverState *bs) * Both of these conditions are represented by generate_json_filename. */ if (primary_child_bs->exact_filename[0] && - primary_child_bs->drv->bdrv_file_open && + primary_child_bs->drv->protocol_name && !drv->is_filter && !generate_json_filename) { strcpy(bs->exact_filename, primary_child_bs->exact_filename); From patchwork Fri Jun 28 17:28:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954084 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=EcYMPpYi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jCm2hCxz20Xf for ; Sat, 29 Jun 2024 03:31:32 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPd-0005dj-5i; Fri, 28 Jun 2024 13:29:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPY-0005aB-Dl for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPV-0002BQ-Db for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=26VrXM0DHOiKV7RbRMquU6833DYubbhko1Fn4Gg+sYw=; b=EcYMPpYiZShXgsxpChUYS/vp7a+CJlmpMJbONyKIzlcfShjRI6mKAP03CYQR6y7f0umnE/ CbfGR8do6V1XhRno8vugbGc0+RRiQwC2aD/KgtxSSE38OZiTFTcxOLCh/1/4jGLySjbP9i olOWmdkVNcxINj4eLKVElOwmIKGRX8M= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-195-uJYyz4ewMPuXd1cZYHxoEQ-1; Fri, 28 Jun 2024 13:29:18 -0400 X-MC-Unique: uJYyz4ewMPuXd1cZYHxoEQ-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a6fe8b2bcc4so59606366b.0 for ; Fri, 28 Jun 2024 10:29:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595757; x=1720200557; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=26VrXM0DHOiKV7RbRMquU6833DYubbhko1Fn4Gg+sYw=; b=v/B90y13EH2YbKG8KoKClaxK7hlz2Odlw7fCBHT/ybSW8Q8v1cM0MMSXd54GOyJdCZ pJN9/txH06jyZIb1pEt1Bk5IXkksRlJiCqdoQsi/oQ/FGER3GcxTI8Z7N4ezLdoWokmO Ry6MW7H6p2nBzMkOrowdUd72gU16Y5n769EMjH50ATlSGPqTXJSzAehQbnhvGtzugnhx h6hwK6ifYbAwPcoYIphI/6Sa9pIbcBS5yJMvzJctqQFvpPjftdzeKM70GuAWiav1JOGi GyNvy7UvFovkHPg0sJAZ/hMRlLisGJ/87AAUFaPOeKtT+lkcuPSthChR2wWmSpmi6Goq 6RAg== X-Gm-Message-State: AOJu0Yxn1BpHwkfuagS+15BPgCBVgNEnVLCe+R6FZHwjnkH6XgEVIhSR LdiJJ7Pap6x65J7vu2/0xlWhyjlSLXVJ3IDt5CRKxeENLqwjSctEUrL92K5gqjkUqNATVCY/p+b k4Gaf8eFR33mgvXw241skZRuiZlWUDcv8pmabvoeuLnLs9FkY3HaNaCkn0yewI9ukCRFzjQBUx/ d5h16iQ9USefmEA8ams5Oc3Z1yjZuyQF5zEk/J X-Received: by 2002:a17:906:f88d:b0:a6f:796d:c747 with SMTP id a640c23a62f3a-a715f978a57mr1199450966b.39.1719595757165; Fri, 28 Jun 2024 10:29:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF/txCMnch30DxVn8Z0qrjpASLX2QedUH2f5CWlh+kY0ok8TFlgdXlrECEcr7kgfXzQqMBl2A== X-Received: by 2002:a17:906:f88d:b0:a6f:796d:c747 with SMTP id a640c23a62f3a-a715f978a57mr1199449766b.39.1719595756538; Fri, 28 Jun 2024 10:29:16 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aaf184fdsm96397466b.3.2024.06.28.10.29.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:15 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 09/23] block: remove separate bdrv_file_open callback Date: Fri, 28 Jun 2024 19:28:41 +0200 Message-ID: <20240628172855.1147598-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org bdrv_file_open and bdrv_open are completely equivalent, they are never checked except to see which one to invoke. So merge them into a single one. Signed-off-by: Paolo Bonzini --- include/block/block_int-common.h | 3 --- block.c | 4 +--- block/blkdebug.c | 2 +- block/blkio.c | 2 +- block/blkverify.c | 2 +- block/curl.c | 8 ++++---- block/file-posix.c | 8 ++++---- block/file-win32.c | 4 ++-- block/gluster.c | 6 +++--- block/iscsi.c | 4 ++-- block/nbd.c | 6 +++--- block/nfs.c | 2 +- block/null.c | 4 ++-- block/nvme.c | 2 +- block/rbd.c | 3 ++- block/ssh.c | 2 +- block/vvfat.c | 2 +- 17 files changed, 30 insertions(+), 34 deletions(-) diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h index 761276127ed..ebb4e56a503 100644 --- a/include/block/block_int-common.h +++ b/include/block/block_int-common.h @@ -248,9 +248,6 @@ struct BlockDriver { int GRAPH_UNLOCKED_PTR (*bdrv_open)( BlockDriverState *bs, QDict *options, int flags, Error **errp); - /* Protocol drivers should implement this instead of bdrv_open */ - int GRAPH_UNLOCKED_PTR (*bdrv_file_open)( - BlockDriverState *bs, QDict *options, int flags, Error **errp); void (*bdrv_close)(BlockDriverState *bs); int coroutine_fn GRAPH_UNLOCKED_PTR (*bdrv_co_create)( diff --git a/block.c b/block.c index dd14ba85fc3..c1cc313d216 100644 --- a/block.c +++ b/block.c @@ -1655,9 +1655,7 @@ bdrv_open_driver(BlockDriverState *bs, BlockDriver *drv, const char *node_name, bs->opaque = g_malloc0(drv->instance_size); assert(!drv->bdrv_needs_filename || bs->filename[0]); - if (drv->bdrv_file_open) { - ret = drv->bdrv_file_open(bs, options, open_flags, &local_err); - } else if (drv->bdrv_open) { + if (drv->bdrv_open) { ret = drv->bdrv_open(bs, options, open_flags, &local_err); } else { ret = 0; diff --git a/block/blkdebug.c b/block/blkdebug.c index 9da8c9eddc2..c95c818c388 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -1073,7 +1073,7 @@ static BlockDriver bdrv_blkdebug = { .is_filter = true, .bdrv_parse_filename = blkdebug_parse_filename, - .bdrv_file_open = blkdebug_open, + .bdrv_open = blkdebug_open, .bdrv_close = blkdebug_close, .bdrv_reopen_prepare = blkdebug_reopen_prepare, .bdrv_child_perm = blkdebug_child_perm, diff --git a/block/blkio.c b/block/blkio.c index 882e1c297b4..1a38064ce76 100644 --- a/block/blkio.c +++ b/block/blkio.c @@ -1088,7 +1088,7 @@ static void blkio_refresh_limits(BlockDriverState *bs, Error **errp) */ #define BLKIO_DRIVER_COMMON \ .instance_size = sizeof(BDRVBlkioState), \ - .bdrv_file_open = blkio_file_open, \ + .bdrv_open = blkio_file_open, \ .bdrv_close = blkio_close, \ .bdrv_co_getlength = blkio_co_getlength, \ .bdrv_co_truncate = blkio_truncate, \ diff --git a/block/blkverify.c b/block/blkverify.c index ec45d8335ed..5a9bf674d9c 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -321,7 +321,7 @@ static BlockDriver bdrv_blkverify = { .instance_size = sizeof(BDRVBlkverifyState), .bdrv_parse_filename = blkverify_parse_filename, - .bdrv_file_open = blkverify_open, + .bdrv_open = blkverify_open, .bdrv_close = blkverify_close, .bdrv_child_perm = bdrv_default_perms, .bdrv_co_getlength = blkverify_co_getlength, diff --git a/block/curl.c b/block/curl.c index 419f7c89ef2..ef5252d00b5 100644 --- a/block/curl.c +++ b/block/curl.c @@ -1034,7 +1034,7 @@ static BlockDriver bdrv_http = { .instance_size = sizeof(BDRVCURLState), .bdrv_parse_filename = curl_parse_filename, - .bdrv_file_open = curl_open, + .bdrv_open = curl_open, .bdrv_close = curl_close, .bdrv_co_getlength = curl_co_getlength, @@ -1053,7 +1053,7 @@ static BlockDriver bdrv_https = { .instance_size = sizeof(BDRVCURLState), .bdrv_parse_filename = curl_parse_filename, - .bdrv_file_open = curl_open, + .bdrv_open = curl_open, .bdrv_close = curl_close, .bdrv_co_getlength = curl_co_getlength, @@ -1072,7 +1072,7 @@ static BlockDriver bdrv_ftp = { .instance_size = sizeof(BDRVCURLState), .bdrv_parse_filename = curl_parse_filename, - .bdrv_file_open = curl_open, + .bdrv_open = curl_open, .bdrv_close = curl_close, .bdrv_co_getlength = curl_co_getlength, @@ -1091,7 +1091,7 @@ static BlockDriver bdrv_ftps = { .instance_size = sizeof(BDRVCURLState), .bdrv_parse_filename = curl_parse_filename, - .bdrv_file_open = curl_open, + .bdrv_open = curl_open, .bdrv_close = curl_close, .bdrv_co_getlength = curl_co_getlength, diff --git a/block/file-posix.c b/block/file-posix.c index be25e35ff6e..f3bd946afac 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -3886,7 +3886,7 @@ BlockDriver bdrv_file = { .bdrv_needs_filename = true, .bdrv_probe = NULL, /* no probe for protocols */ .bdrv_parse_filename = raw_parse_filename, - .bdrv_file_open = raw_open, + .bdrv_open = raw_open, .bdrv_reopen_prepare = raw_reopen_prepare, .bdrv_reopen_commit = raw_reopen_commit, .bdrv_reopen_abort = raw_reopen_abort, @@ -4257,7 +4257,7 @@ static BlockDriver bdrv_host_device = { .bdrv_needs_filename = true, .bdrv_probe_device = hdev_probe_device, .bdrv_parse_filename = hdev_parse_filename, - .bdrv_file_open = hdev_open, + .bdrv_open = hdev_open, .bdrv_close = raw_close, .bdrv_reopen_prepare = raw_reopen_prepare, .bdrv_reopen_commit = raw_reopen_commit, @@ -4396,7 +4396,7 @@ static BlockDriver bdrv_host_cdrom = { .bdrv_needs_filename = true, .bdrv_probe_device = cdrom_probe_device, .bdrv_parse_filename = cdrom_parse_filename, - .bdrv_file_open = cdrom_open, + .bdrv_open = cdrom_open, .bdrv_close = raw_close, .bdrv_reopen_prepare = raw_reopen_prepare, .bdrv_reopen_commit = raw_reopen_commit, @@ -4522,7 +4522,7 @@ static BlockDriver bdrv_host_cdrom = { .bdrv_needs_filename = true, .bdrv_probe_device = cdrom_probe_device, .bdrv_parse_filename = cdrom_parse_filename, - .bdrv_file_open = cdrom_open, + .bdrv_open = cdrom_open, .bdrv_close = raw_close, .bdrv_reopen_prepare = raw_reopen_prepare, .bdrv_reopen_commit = raw_reopen_commit, diff --git a/block/file-win32.c b/block/file-win32.c index 48b790d9173..7e1baa1ece6 100644 --- a/block/file-win32.c +++ b/block/file-win32.c @@ -746,7 +746,7 @@ BlockDriver bdrv_file = { .instance_size = sizeof(BDRVRawState), .bdrv_needs_filename = true, .bdrv_parse_filename = raw_parse_filename, - .bdrv_file_open = raw_open, + .bdrv_open = raw_open, .bdrv_refresh_limits = raw_probe_alignment, .bdrv_close = raw_close, .bdrv_co_create_opts = raw_co_create_opts, @@ -920,7 +920,7 @@ static BlockDriver bdrv_host_device = { .bdrv_needs_filename = true, .bdrv_parse_filename = hdev_parse_filename, .bdrv_probe_device = hdev_probe_device, - .bdrv_file_open = hdev_open, + .bdrv_open = hdev_open, .bdrv_close = raw_close, .bdrv_refresh_limits = hdev_refresh_limits, diff --git a/block/gluster.c b/block/gluster.c index d0999903dfe..f8b415f3812 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -1551,7 +1551,7 @@ static BlockDriver bdrv_gluster = { .format_name = "gluster", .protocol_name = "gluster", .instance_size = sizeof(BDRVGlusterState), - .bdrv_file_open = qemu_gluster_open, + .bdrv_open = qemu_gluster_open, .bdrv_reopen_prepare = qemu_gluster_reopen_prepare, .bdrv_reopen_commit = qemu_gluster_reopen_commit, .bdrv_reopen_abort = qemu_gluster_reopen_abort, @@ -1580,7 +1580,7 @@ static BlockDriver bdrv_gluster_tcp = { .format_name = "gluster", .protocol_name = "gluster+tcp", .instance_size = sizeof(BDRVGlusterState), - .bdrv_file_open = qemu_gluster_open, + .bdrv_open = qemu_gluster_open, .bdrv_reopen_prepare = qemu_gluster_reopen_prepare, .bdrv_reopen_commit = qemu_gluster_reopen_commit, .bdrv_reopen_abort = qemu_gluster_reopen_abort, @@ -1609,7 +1609,7 @@ static BlockDriver bdrv_gluster_unix = { .format_name = "gluster", .protocol_name = "gluster+unix", .instance_size = sizeof(BDRVGlusterState), - .bdrv_file_open = qemu_gluster_open, + .bdrv_open = qemu_gluster_open, .bdrv_reopen_prepare = qemu_gluster_reopen_prepare, .bdrv_reopen_commit = qemu_gluster_reopen_commit, .bdrv_reopen_abort = qemu_gluster_reopen_abort, diff --git a/block/iscsi.c b/block/iscsi.c index 2ff14b74724..979bf90cb79 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -2429,7 +2429,7 @@ static BlockDriver bdrv_iscsi = { .instance_size = sizeof(IscsiLun), .bdrv_parse_filename = iscsi_parse_filename, - .bdrv_file_open = iscsi_open, + .bdrv_open = iscsi_open, .bdrv_close = iscsi_close, .bdrv_co_create_opts = bdrv_co_create_opts_simple, .create_opts = &bdrv_create_opts_simple, @@ -2468,7 +2468,7 @@ static BlockDriver bdrv_iser = { .instance_size = sizeof(IscsiLun), .bdrv_parse_filename = iscsi_parse_filename, - .bdrv_file_open = iscsi_open, + .bdrv_open = iscsi_open, .bdrv_close = iscsi_close, .bdrv_co_create_opts = bdrv_co_create_opts_simple, .create_opts = &bdrv_create_opts_simple, diff --git a/block/nbd.c b/block/nbd.c index 589d28af833..d464315766e 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -2146,7 +2146,7 @@ static BlockDriver bdrv_nbd = { .bdrv_parse_filename = nbd_parse_filename, .bdrv_co_create_opts = bdrv_co_create_opts_simple, .create_opts = &bdrv_create_opts_simple, - .bdrv_file_open = nbd_open, + .bdrv_open = nbd_open, .bdrv_reopen_prepare = nbd_client_reopen_prepare, .bdrv_co_preadv = nbd_client_co_preadv, .bdrv_co_pwritev = nbd_client_co_pwritev, @@ -2174,7 +2174,7 @@ static BlockDriver bdrv_nbd_tcp = { .bdrv_parse_filename = nbd_parse_filename, .bdrv_co_create_opts = bdrv_co_create_opts_simple, .create_opts = &bdrv_create_opts_simple, - .bdrv_file_open = nbd_open, + .bdrv_open = nbd_open, .bdrv_reopen_prepare = nbd_client_reopen_prepare, .bdrv_co_preadv = nbd_client_co_preadv, .bdrv_co_pwritev = nbd_client_co_pwritev, @@ -2202,7 +2202,7 @@ static BlockDriver bdrv_nbd_unix = { .bdrv_parse_filename = nbd_parse_filename, .bdrv_co_create_opts = bdrv_co_create_opts_simple, .create_opts = &bdrv_create_opts_simple, - .bdrv_file_open = nbd_open, + .bdrv_open = nbd_open, .bdrv_reopen_prepare = nbd_client_reopen_prepare, .bdrv_co_preadv = nbd_client_co_preadv, .bdrv_co_pwritev = nbd_client_co_pwritev, diff --git a/block/nfs.c b/block/nfs.c index 60240a8733d..0500f60c08f 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -888,7 +888,7 @@ static BlockDriver bdrv_nfs = { #endif .bdrv_co_truncate = nfs_file_co_truncate, - .bdrv_file_open = nfs_file_open, + .bdrv_open = nfs_file_open, .bdrv_close = nfs_file_close, .bdrv_co_create = nfs_file_co_create, .bdrv_co_create_opts = nfs_file_co_create_opts, diff --git a/block/null.c b/block/null.c index 4808704ffd3..6fa64d20d86 100644 --- a/block/null.c +++ b/block/null.c @@ -283,7 +283,7 @@ static BlockDriver bdrv_null_co = { .protocol_name = "null-co", .instance_size = sizeof(BDRVNullState), - .bdrv_file_open = null_file_open, + .bdrv_open = null_file_open, .bdrv_parse_filename = null_co_parse_filename, .bdrv_co_getlength = null_co_getlength, .bdrv_co_get_allocated_file_size = null_co_get_allocated_file_size, @@ -304,7 +304,7 @@ static BlockDriver bdrv_null_aio = { .protocol_name = "null-aio", .instance_size = sizeof(BDRVNullState), - .bdrv_file_open = null_file_open, + .bdrv_open = null_file_open, .bdrv_parse_filename = null_aio_parse_filename, .bdrv_co_getlength = null_co_getlength, .bdrv_co_get_allocated_file_size = null_co_get_allocated_file_size, diff --git a/block/nvme.c b/block/nvme.c index 3a3c6da73d2..c84914af6dd 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -1630,7 +1630,7 @@ static BlockDriver bdrv_nvme = { .create_opts = &bdrv_create_opts_simple, .bdrv_parse_filename = nvme_parse_filename, - .bdrv_file_open = nvme_file_open, + .bdrv_open = nvme_file_open, .bdrv_close = nvme_close, .bdrv_co_getlength = nvme_co_getlength, .bdrv_probe_blocksizes = nvme_probe_blocksizes, diff --git a/block/rbd.c b/block/rbd.c index 84bb2fa5d71..9c0fd0cb3f7 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -1815,8 +1815,9 @@ static const char *const qemu_rbd_strong_runtime_opts[] = { static BlockDriver bdrv_rbd = { .format_name = "rbd", .instance_size = sizeof(BDRVRBDState), + .bdrv_parse_filename = qemu_rbd_parse_filename, - .bdrv_file_open = qemu_rbd_open, + .bdrv_open = qemu_rbd_open, .bdrv_close = qemu_rbd_close, .bdrv_reopen_prepare = qemu_rbd_reopen_prepare, .bdrv_co_create = qemu_rbd_co_create, diff --git a/block/ssh.c b/block/ssh.c index a88171d4b53..1344822ed85 100644 --- a/block/ssh.c +++ b/block/ssh.c @@ -1362,7 +1362,7 @@ static BlockDriver bdrv_ssh = { .protocol_name = "ssh", .instance_size = sizeof(BDRVSSHState), .bdrv_parse_filename = ssh_parse_filename, - .bdrv_file_open = ssh_file_open, + .bdrv_open = ssh_file_open, .bdrv_co_create = ssh_co_create, .bdrv_co_create_opts = ssh_co_create_opts, .bdrv_close = ssh_close, diff --git a/block/vvfat.c b/block/vvfat.c index 9d050ba3aea..086fedf4745 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -3258,7 +3258,7 @@ static BlockDriver bdrv_vvfat = { .instance_size = sizeof(BDRVVVFATState), .bdrv_parse_filename = vvfat_parse_filename, - .bdrv_file_open = vvfat_open, + .bdrv_open = vvfat_open, .bdrv_refresh_limits = vvfat_refresh_limits, .bdrv_close = vvfat_close, .bdrv_child_perm = vvfat_child_perm, From patchwork Fri Jun 28 17:28:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954092 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=T2DvYMeS; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jFJ50STz20Xf for ; Sat, 29 Jun 2024 03:32:52 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPh-0005fM-9y; Fri, 28 Jun 2024 13:29:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPc-0005cw-Dz for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPa-0002Ba-KZ for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d1Zs3bNs8jOuOgSShaHDoScFAM7FpjL8r/fpmfWVVwk=; b=T2DvYMeSkrHW+pXRHcprHrlc4xhJBPx6gtIXQ3TFHDe49iBDMRPhvWDamIw4l6C1g8z1Sn Nq/l9bCDQq8bMwM7BK2YyGnbQZ4CRngW5FyAlgmJEuCosbKaVo003Cx+p/Wn7GMl+cD1xb ghxweEkBg8Ssh+/BOXGTHx8S13AIofk= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-83-eCMFgWWvNCCEdjaW6Gl44g-1; Fri, 28 Jun 2024 13:29:20 -0400 X-MC-Unique: eCMFgWWvNCCEdjaW6Gl44g-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a7246c24b00so60618166b.0 for ; Fri, 28 Jun 2024 10:29:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595759; x=1720200559; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d1Zs3bNs8jOuOgSShaHDoScFAM7FpjL8r/fpmfWVVwk=; b=U2d9Atwq5GiN0w5SyjkkMoUbPy+od0W3MXs6aknIfEhXRyrmYXHz1iKttIgwI7cyXl 22jvK3pVtt0TRSs298VAsYwhkyGUfk1Aa3tI7hP5xatM/NHXUdpxhjPD8vLNLochIhFM yerAxKZ1QN7gIVhRvmMXOGReR+H/5ddtzT19nrWx6lOH9cnXE6On4SMzD+euZrAdi0yB itwn2R6y1jvCaKNcl4V96YLhVYuxh+xkwLj2LJrjBHdZG+xHjZIoJjH1f4tFSBG5gsmY 4e6hh64Pg4BXkRN/1Phrvj0YIlW+aoo5uqr34M0i2M3cQMsy3lLiMy0nCV65mqF8msBV Bq+A== X-Gm-Message-State: AOJu0YyaTNeCHEiPkSqViYDghYTVFdrLXAGPJQjfAlqPuvlrbU0f0Cel J11TvQJ9/sH9M3wIQq4WRLwa8Qh0xhrFqrzxQtFSS5qgVKidMAa/RgLNh+iYnhnz55qMltvjf+w Ypsaz/x3avyLgubjqSTue/vWofR4uMZucBdShOLXnZwZ34mB8YcGxKknpD+JGRSQKIAZWbOlt7u XL/n+g7fCh6Xezn8whZG0mseHByyBcfywB21IO X-Received: by 2002:a17:906:809:b0:a6f:55e8:b361 with SMTP id a640c23a62f3a-a7242cb7a68mr1020278766b.41.1719595758835; Fri, 28 Jun 2024 10:29:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9oM5KVphqpXNh2OvO743ZmV9F4ZdWQ1mUzkAed/5NKkds+i/hWn0P0i0U3qonPkZKnPNHCA== X-Received: by 2002:a17:906:809:b0:a6f:55e8:b361 with SMTP id a640c23a62f3a-a7242cb7a68mr1020277466b.41.1719595758352; Fri, 28 Jun 2024 10:29:18 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aaf1d201sm95793666b.9.2024.06.28.10.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:17 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Kevin Wolf Subject: [PULL 10/23] block: rename former bdrv_file_open callbacks Date: Fri, 28 Jun 2024 19:28:42 +0200 Message-ID: <20240628172855.1147598-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org Since there is no bdrv_file_open callback anymore, rename the implementations so that they end with "_open" instead of "_file_open". NFS is the exception because all the functions are named nfs_file_*. Suggested-by: Kevin Wolf Signed-off-by: Paolo Bonzini --- block/blkio.c | 8 ++++---- block/null.c | 8 ++++---- block/nvme.c | 8 ++++---- block/ssh.c | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/block/blkio.c b/block/blkio.c index 1a38064ce76..3d9a2e764c3 100644 --- a/block/blkio.c +++ b/block/blkio.c @@ -713,7 +713,7 @@ static int blkio_virtio_blk_connect(BlockDriverState *bs, QDict *options, * for example will fail. * * In order to open the device read-only, we are using the `read-only` - * property of the libblkio driver in blkio_file_open(). + * property of the libblkio driver in blkio_open(). */ fd = qemu_open(path, O_RDWR, NULL); if (fd < 0) { @@ -791,8 +791,8 @@ static int blkio_virtio_blk_connect(BlockDriverState *bs, QDict *options, return 0; } -static int blkio_file_open(BlockDriverState *bs, QDict *options, int flags, - Error **errp) +static int blkio_open(BlockDriverState *bs, QDict *options, int flags, + Error **errp) { const char *blkio_driver = bs->drv->protocol_name; BDRVBlkioState *s = bs->opaque; @@ -1088,7 +1088,7 @@ static void blkio_refresh_limits(BlockDriverState *bs, Error **errp) */ #define BLKIO_DRIVER_COMMON \ .instance_size = sizeof(BDRVBlkioState), \ - .bdrv_open = blkio_file_open, \ + .bdrv_open = blkio_open, \ .bdrv_close = blkio_close, \ .bdrv_co_getlength = blkio_co_getlength, \ .bdrv_co_truncate = blkio_truncate, \ diff --git a/block/null.c b/block/null.c index 6fa64d20d86..4730acc1eb2 100644 --- a/block/null.c +++ b/block/null.c @@ -77,8 +77,8 @@ static void null_aio_parse_filename(const char *filename, QDict *options, } } -static int null_file_open(BlockDriverState *bs, QDict *options, int flags, - Error **errp) +static int null_open(BlockDriverState *bs, QDict *options, int flags, + Error **errp) { QemuOpts *opts; BDRVNullState *s = bs->opaque; @@ -283,7 +283,7 @@ static BlockDriver bdrv_null_co = { .protocol_name = "null-co", .instance_size = sizeof(BDRVNullState), - .bdrv_open = null_file_open, + .bdrv_open = null_open, .bdrv_parse_filename = null_co_parse_filename, .bdrv_co_getlength = null_co_getlength, .bdrv_co_get_allocated_file_size = null_co_get_allocated_file_size, @@ -304,7 +304,7 @@ static BlockDriver bdrv_null_aio = { .protocol_name = "null-aio", .instance_size = sizeof(BDRVNullState), - .bdrv_open = null_file_open, + .bdrv_open = null_open, .bdrv_parse_filename = null_aio_parse_filename, .bdrv_co_getlength = null_co_getlength, .bdrv_co_get_allocated_file_size = null_co_get_allocated_file_size, diff --git a/block/nvme.c b/block/nvme.c index c84914af6dd..3b588b139f6 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -889,7 +889,7 @@ out: qemu_vfio_pci_unmap_bar(s->vfio, 0, (void *)regs, 0, sizeof(NvmeBar)); } - /* Cleaning up is done in nvme_file_open() upon error. */ + /* Cleaning up is done in nvme_open() upon error. */ return ret; } @@ -967,8 +967,8 @@ static void nvme_close(BlockDriverState *bs) g_free(s->device); } -static int nvme_file_open(BlockDriverState *bs, QDict *options, int flags, - Error **errp) +static int nvme_open(BlockDriverState *bs, QDict *options, int flags, + Error **errp) { const char *device; QemuOpts *opts; @@ -1630,7 +1630,7 @@ static BlockDriver bdrv_nvme = { .create_opts = &bdrv_create_opts_simple, .bdrv_parse_filename = nvme_parse_filename, - .bdrv_open = nvme_file_open, + .bdrv_open = nvme_open, .bdrv_close = nvme_close, .bdrv_co_getlength = nvme_co_getlength, .bdrv_probe_blocksizes = nvme_probe_blocksizes, diff --git a/block/ssh.c b/block/ssh.c index 1344822ed85..27d582e0e3d 100644 --- a/block/ssh.c +++ b/block/ssh.c @@ -837,8 +837,8 @@ static int connect_to_ssh(BDRVSSHState *s, BlockdevOptionsSsh *opts, return ret; } -static int ssh_file_open(BlockDriverState *bs, QDict *options, int bdrv_flags, - Error **errp) +static int ssh_open(BlockDriverState *bs, QDict *options, int bdrv_flags, + Error **errp) { BDRVSSHState *s = bs->opaque; BlockdevOptionsSsh *opts; @@ -1362,7 +1362,7 @@ static BlockDriver bdrv_ssh = { .protocol_name = "ssh", .instance_size = sizeof(BDRVSSHState), .bdrv_parse_filename = ssh_parse_filename, - .bdrv_open = ssh_file_open, + .bdrv_open = ssh_open, .bdrv_co_create = ssh_co_create, .bdrv_co_create_opts = ssh_co_create_opts, .bdrv_close = ssh_close, From patchwork Fri Jun 28 17:28:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954078 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WbPUcB/9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jBP67hqz20b0 for ; Sat, 29 Jun 2024 03:30:21 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPi-0005fQ-0X; Fri, 28 Jun 2024 13:29:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPd-0005e3-Qx for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPc-0002CF-6W for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dTQLDy7fzv4IlAQ52PKIL6tgs655OTYs6Ror3JKC4ro=; b=WbPUcB/9DL3ZQ8XZEx6Vfj5Bdu7RkPMkfII2mQ5Mo6UxsWtASF3L7jCj50lZGDaVPsorYt D256zvfRLUEDvYhWODLLyGkDrR+tpf4KoE/F9gGFMCi49Au7Qz135GYiHAeIg1RRFuEFn8 iPe0pHu59MQkhz286HYwYDkFYNUqtg4= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-346-IJ4nIiYdOfWsz3TLFR41hg-1; Fri, 28 Jun 2024 13:29:22 -0400 X-MC-Unique: IJ4nIiYdOfWsz3TLFR41hg-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-57d22ea3e71so606634a12.2 for ; Fri, 28 Jun 2024 10:29:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595761; x=1720200561; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dTQLDy7fzv4IlAQ52PKIL6tgs655OTYs6Ror3JKC4ro=; b=qAyLtziqWHijKb2779bI/Vk1t462vj4HZ1iltkR8ZsxCaK8QJsNHThqa1IUOrJgDnv P37d+IAZ+s5vOQ6aZQdBkXkXA6LczILt2y91I+m2r6F/QWuvBZDog4PXoGJXMd+ClJvB FmB09s6VHQKJbrHIRR6ed8Zzwngzd+3lOSnmpCsdLsXkRDu2JYZ4OnuGP7ux3tes+uOf HImhBUdi6i0BAKpspmUXK1pdbqbIMLP7U6Zmg1u51PV0AgNoPcyIootSNCKalU9i6d+u EYR+FFDqcAj9FoZJTYi8UwaCcmLnXiyViMnXUrhJSev6fei4xj1dG2V4eTBBt4a98Mvs lnHQ== X-Gm-Message-State: AOJu0YxFtIrANgG55110FPM2zJWAorQpKFAp/BZ/yo2umijlXltv+fz8 466XzCPs3xnE1TRywvNhnfLURQ+6yrbywYSpoOV8sx4qVyL3QVgFqfKCL41JAddNvi9vyyk2eK7 JOqlca6rOBCfFPzx5Fl8kA+yAZXtngzugWofPRXGypVbAOgyqOI2dgD0dVsjM1T7nY9CFl/ulJO 4LRMagPr+0SZirm7EIs09pCAUx63zHt4X26/rO X-Received: by 2002:a17:907:a649:b0:a72:8135:2d4f with SMTP id a640c23a62f3a-a7281352e3cmr873131466b.48.1719595761469; Fri, 28 Jun 2024 10:29:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJxjjt9duRZgzcJ9F/23lxvLZauhMr7tyELJiQ742ajIcajjFwLUagkTIWED2gUoTH57P5fg== X-Received: by 2002:a17:907:a649:b0:a72:8135:2d4f with SMTP id a640c23a62f3a-a7281352e3cmr873130266b.48.1719595761141; Fri, 28 Jun 2024 10:29:21 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aaf18486sm96789466b.8.2024.06.28.10.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Roman Kiryanov Subject: [PULL 11/23] exec: avoid using C++ keywords in function parameters Date: Fri, 28 Jun 2024 19:28:43 +0200 Message-ID: <20240628172855.1147598-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Roman Kiryanov to use the QEMU headers with a C++ compiler. Signed-off-by: Roman Kiryanov Link: https://lore.kernel.org/r/20240618224553.878869-1-rkir@google.com Signed-off-by: Paolo Bonzini --- include/exec/memory.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 0903513d132..154626f9ad2 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -925,7 +925,7 @@ struct MemoryListener { * the current transaction. */ void (*log_start)(MemoryListener *listener, MemoryRegionSection *section, - int old, int new); + int old_val, int new_val); /** * @log_stop: @@ -944,7 +944,7 @@ struct MemoryListener { * the current transaction. */ void (*log_stop)(MemoryListener *listener, MemoryRegionSection *section, - int old, int new); + int old_val, int new_val); /** * @log_sync: From patchwork Fri Jun 28 17:28:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954080 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ecvhzTCo; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jBc1Hdcz20Xf for ; Sat, 29 Jun 2024 03:30:32 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPp-0005hD-5X; Fri, 28 Jun 2024 13:29:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPn-0005gX-4S for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPc-0002CP-F1 for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O+eEF/gR13OhRf7dx6NHiP8oPNIeovEULUu0GqyLkjM=; b=ecvhzTCoOBxH5E2O2RcG2eY5Qyrc/zGWCp1DV5U4PYJfKQfw/vxQaeUuGr3hRH8T2ZLrir 1d4b/wkQ43bTqoehnc0E83pF4hdiqTFrrHCHT24UMmro9GZHA3mPeYANQI9nK+VJ1d+JFG /5l06N1HT9cKvglbtKw9xbSnWf9djaY= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-497-dAQldfY3M0KoeFHABF4Tzw-1; Fri, 28 Jun 2024 13:29:26 -0400 X-MC-Unique: dAQldfY3M0KoeFHABF4Tzw-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a72b3066669so98328466b.0 for ; Fri, 28 Jun 2024 10:29:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595764; x=1720200564; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O+eEF/gR13OhRf7dx6NHiP8oPNIeovEULUu0GqyLkjM=; b=b/pqwc7rXE7OR8eZYOIJ8xNkvARV1FGdlJAFVddZVp0mNWA97rbpP6NvbRrJ+TrV3V xgMWdrOTadCpaJSM0O0pxuOkCK5OAwF/QinSZk6+wOy6xHqFxooZan2eyQYsxfz1IG5E 73s/ZUjqHodHG3TCYNvAVnB52iDPEr2I8tKH8F2jYNrszvc8FhXzeFMwl3+Out00MLRw z4+ek5hYeNqt3uuq9Kbkb6Ku1zcjFYRJuseekNNyDIxnjSnBtrNEUK4vqoqZGSKkQmDy FFBZ5qfeSoUQCyW7euvTFTpuRFQcvPl7nyo3dZzV3AL/DbrEPqcRZW07onIGE/cb8D7u pf6A== X-Gm-Message-State: AOJu0YzDTltvyHDkh5yOyxws22xAMTmo4AGepSGltY58rk4cjcPf3Das rjDxBeEa9p7FVs2qc7dXPVECpoJ9OiYw5u0bd8HmsN4Lf3MntNAHm5iGuRplXk0Bs01qBSEYm1Q f/VlbMSJGzyoJlhSO/qN/909XvvYmC3Y/vg2+0Xd8mekVKgfYLj7madWMn19RtCvYJInrbPWTsV KxPUOoKIAf3+ENOnFBVhPaFHwo7hetf2/or8WG X-Received: by 2002:a17:906:161b:b0:a72:6fc3:9941 with SMTP id a640c23a62f3a-a72aee8fc6bmr163147066b.16.1719595763996; Fri, 28 Jun 2024 10:29:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXV2vTR3B9RtzltNabu6JYoz75qfSeGXgwGmYH5XcV1F6lqvtxmPpevnhcHsbAfKlayngd4A== X-Received: by 2002:a17:906:161b:b0:a72:6fc3:9941 with SMTP id a640c23a62f3a-a72aee8fc6bmr163146166b.16.1719595763720; Fri, 28 Jun 2024 10:29:23 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aaf18a14sm95937666b.25.2024.06.28.10.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:22 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Roman Kiryanov Subject: [PULL 12/23] exec: don't use void* in pointer arithmetic in headers Date: Fri, 28 Jun 2024 19:28:44 +0200 Message-ID: <20240628172855.1147598-13-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Roman Kiryanov void* pointer arithmetic is a GCC extentension which could not be available in other build tools (e.g. C++). This changes removes this assumption. Signed-off-by: Roman Kiryanov Suggested-by: Paolo Bonzini Link: https://lore.kernel.org/r/20240620201654.598024-1-rkir@google.com Signed-off-by: Paolo Bonzini --- include/exec/memory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 154626f9ad2..c26ede33d21 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -2764,7 +2764,7 @@ MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr, #include "exec/memory_ldst_phys.h.inc" struct MemoryRegionCache { - void *ptr; + uint8_t *ptr; hwaddr xlat; hwaddr len; FlatView *fv; From patchwork Fri Jun 28 17:28:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954088 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WRQ7+OF3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jFC2WS2z20Xf for ; Sat, 29 Jun 2024 03:32:47 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPk-0005ft-Oh; Fri, 28 Jun 2024 13:29:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPh-0005fP-O0 for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPf-0002EB-6Z for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QfPlkzAs6rsHhlewBnoT9acE//vGyzsRmxi7a5l5ZQw=; b=WRQ7+OF3IMc93RT9dTsvLsjbke7qLippQTU15Hx9IqfH1HPw4q8GxZpSsgwx0m2ICcej/f nTs5QWVxSuIFEVbkySDBekBAXCk697CXjc1wZr2w2mznj1g65+7N3tWOwzuX5FJnDXDSNM 7H9ZdFLmBRfASy1sUVXRjAhvAKd7rgI= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-396-0oyQnOc6Nt28fGWWYEhg5g-1; Fri, 28 Jun 2024 13:29:29 -0400 X-MC-Unique: 0oyQnOc6Nt28fGWWYEhg5g-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-57cad6e94e5so655566a12.3 for ; Fri, 28 Jun 2024 10:29:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595767; x=1720200567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QfPlkzAs6rsHhlewBnoT9acE//vGyzsRmxi7a5l5ZQw=; b=KBAHYJv7q8cKd2rAeU4rwAe2qDJF1kjE3sGIHw4xCDGBBbHyY89jtTyTjiOGCStHlA /OujMTwDunuNs264UzWSaKeHKXRtCW5ze5ZROgsTFC2d/NgYayxw5p8fC9jKebpDjtrz KIFSkMsmdKaUGKKKWCIk0huqOOPaBuMYSY0bMRH/O2rRQsnArUu0z6olsD48VmloKref box8nIbONnWWB2EdN6K3nCXtxmplhTExXBn14Kzkjbsucr8AyU5EPrxFKMT7h1izEY/N 83hDtWlNXbLxptSoHY7RgMMU7GoguwYXuhOSHpzR30rVjq2ViUbtQZ3CPigYqm86exgT TQ9g== X-Gm-Message-State: AOJu0YyK+oPCSLAD84GrMQNQdq/gFBWI+2v7bDfOTFt75reflRmYOG4S A50OS1NALgcA16s3qVEROkZ8kL1l2fX7QUj3uR09rDtu1WvutbciSYIPEbKpnAWbdcJI4fJAWL6 AKYkSMpkEPpoXaaKIFNSDmGESpD87PMElXYRpNyTZgLx0YRNymRLWkUV0yMjEoRtgtJQFtRmCXc dxNbnL9xBQDKdu3W3oOgAvYzGiIlo/ITLJGN85 X-Received: by 2002:a50:a69d:0:b0:57d:3791:e8e1 with SMTP id 4fb4d7f45d1cf-57d4bde09cemr12004351a12.36.1719595766667; Fri, 28 Jun 2024 10:29:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9Af0/BdshL/SI4nNDR3kR4XB/x7OSG/J0PJ0knYTnfBjfPYrujix9tJMcKYdJOKryBt1gGQ== X-Received: by 2002:a50:a69d:0:b0:57d:3791:e8e1 with SMTP id 4fb4d7f45d1cf-57d4bde09cemr12004334a12.36.1719595766274; Fri, 28 Jun 2024 10:29:26 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5861503b4c5sm1253186a12.93.2024.06.28.10.29.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:24 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson , Manos Pitsidianakis Subject: [PULL 13/23] include: move typeof_strip_qual to compiler.h, use it in QAPI_LIST_LENGTH() Date: Fri, 28 Jun 2024 19:28:45 +0200 Message-ID: <20240628172855.1147598-14-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org The typeof_strip_qual() is most useful for the atomic fetch-and-modify operations in atomic.h, but it can be used elsewhere as well. For example, QAPI_LIST_LENGTH() assumes that the argument is not const, which is not a requirement. Move the macro to compiler.h and, while at it, move it under #ifndef __cplusplus to emphasize that it uses C-only constructs. A C++ version of typeof_strip_qual() using type traits is possible[1], but beyond the scope of this patch because the little C++ code that is in QEMU does not use QAPI. The patch was tested by changing the declaration of strv_from_str_list() in qapi/qapi-type-helpers.c to: char **strv_from_str_list(const strList *const list) This is valid C code, and it fails to compile without this change. [1] https://lore.kernel.org/qemu-devel/20240624205647.112034-1-flwu@google.com/ Reviewed-by: Richard Henderson Reviewed-by: Manos Pitsidianakis Tested-by: Manos Pitsidianakis Signed-off-by: Paolo Bonzini --- include/qapi/util.h | 2 +- include/qemu/atomic.h | 42 ------------------------------------- include/qemu/compiler.h | 46 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 43 deletions(-) diff --git a/include/qapi/util.h b/include/qapi/util.h index 20dfea8a545..b8254247b8d 100644 --- a/include/qapi/util.h +++ b/include/qapi/util.h @@ -62,7 +62,7 @@ int parse_qapi_name(const char *name, bool complete); #define QAPI_LIST_LENGTH(list) \ ({ \ size_t _len = 0; \ - typeof(list) _tail; \ + typeof_strip_qual(list) _tail; \ for (_tail = list; _tail != NULL; _tail = _tail->next) { \ _len++; \ } \ diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h index 99110abefb3..dc4118ddd9e 100644 --- a/include/qemu/atomic.h +++ b/include/qemu/atomic.h @@ -20,48 +20,6 @@ /* Compiler barrier */ #define barrier() ({ asm volatile("" ::: "memory"); (void)0; }) -/* The variable that receives the old value of an atomically-accessed - * variable must be non-qualified, because atomic builtins return values - * through a pointer-type argument as in __atomic_load(&var, &old, MODEL). - * - * This macro has to handle types smaller than int manually, because of - * implicit promotion. int and larger types, as well as pointers, can be - * converted to a non-qualified type just by applying a binary operator. - */ -#define typeof_strip_qual(expr) \ - typeof( \ - __builtin_choose_expr( \ - __builtin_types_compatible_p(typeof(expr), bool) || \ - __builtin_types_compatible_p(typeof(expr), const bool) || \ - __builtin_types_compatible_p(typeof(expr), volatile bool) || \ - __builtin_types_compatible_p(typeof(expr), const volatile bool), \ - (bool)1, \ - __builtin_choose_expr( \ - __builtin_types_compatible_p(typeof(expr), signed char) || \ - __builtin_types_compatible_p(typeof(expr), const signed char) || \ - __builtin_types_compatible_p(typeof(expr), volatile signed char) || \ - __builtin_types_compatible_p(typeof(expr), const volatile signed char), \ - (signed char)1, \ - __builtin_choose_expr( \ - __builtin_types_compatible_p(typeof(expr), unsigned char) || \ - __builtin_types_compatible_p(typeof(expr), const unsigned char) || \ - __builtin_types_compatible_p(typeof(expr), volatile unsigned char) || \ - __builtin_types_compatible_p(typeof(expr), const volatile unsigned char), \ - (unsigned char)1, \ - __builtin_choose_expr( \ - __builtin_types_compatible_p(typeof(expr), signed short) || \ - __builtin_types_compatible_p(typeof(expr), const signed short) || \ - __builtin_types_compatible_p(typeof(expr), volatile signed short) || \ - __builtin_types_compatible_p(typeof(expr), const volatile signed short), \ - (signed short)1, \ - __builtin_choose_expr( \ - __builtin_types_compatible_p(typeof(expr), unsigned short) || \ - __builtin_types_compatible_p(typeof(expr), const unsigned short) || \ - __builtin_types_compatible_p(typeof(expr), volatile unsigned short) || \ - __builtin_types_compatible_p(typeof(expr), const volatile unsigned short), \ - (unsigned short)1, \ - (expr)+0)))))) - #ifndef __ATOMIC_RELAXED #error "Expecting C11 atomic ops" #endif diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index c797f0d4572..554c5ce7df7 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -227,4 +227,50 @@ #define SECOND_ARG(first, second, ...) second #define IS_EMPTY_(junk_maybecomma) SECOND_ARG(junk_maybecomma 1, 0) +#ifndef __cplusplus +/* + * Useful in macros that need to declare temporary variables. For example, + * the variable that receives the old value of an atomically-accessed + * variable must be non-qualified, because atomic builtins return values + * through a pointer-type argument as in __atomic_load(&var, &old, MODEL). + * + * This macro has to handle types smaller than int manually, because of + * implicit promotion. int and larger types, as well as pointers, can be + * converted to a non-qualified type just by applying a binary operator. + */ +#define typeof_strip_qual(expr) \ + typeof( \ + __builtin_choose_expr( \ + __builtin_types_compatible_p(typeof(expr), bool) || \ + __builtin_types_compatible_p(typeof(expr), const bool) || \ + __builtin_types_compatible_p(typeof(expr), volatile bool) || \ + __builtin_types_compatible_p(typeof(expr), const volatile bool), \ + (bool)1, \ + __builtin_choose_expr( \ + __builtin_types_compatible_p(typeof(expr), signed char) || \ + __builtin_types_compatible_p(typeof(expr), const signed char) || \ + __builtin_types_compatible_p(typeof(expr), volatile signed char) || \ + __builtin_types_compatible_p(typeof(expr), const volatile signed char), \ + (signed char)1, \ + __builtin_choose_expr( \ + __builtin_types_compatible_p(typeof(expr), unsigned char) || \ + __builtin_types_compatible_p(typeof(expr), const unsigned char) || \ + __builtin_types_compatible_p(typeof(expr), volatile unsigned char) || \ + __builtin_types_compatible_p(typeof(expr), const volatile unsigned char), \ + (unsigned char)1, \ + __builtin_choose_expr( \ + __builtin_types_compatible_p(typeof(expr), signed short) || \ + __builtin_types_compatible_p(typeof(expr), const signed short) || \ + __builtin_types_compatible_p(typeof(expr), volatile signed short) || \ + __builtin_types_compatible_p(typeof(expr), const volatile signed short), \ + (signed short)1, \ + __builtin_choose_expr( \ + __builtin_types_compatible_p(typeof(expr), unsigned short) || \ + __builtin_types_compatible_p(typeof(expr), const unsigned short) || \ + __builtin_types_compatible_p(typeof(expr), volatile unsigned short) || \ + __builtin_types_compatible_p(typeof(expr), const volatile unsigned short), \ + (unsigned short)1, \ + (expr)+0)))))) +#endif + #endif /* COMPILER_H */ From patchwork Fri Jun 28 17:28:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954095 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FTmNe3ld; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jFQ73Cdz20Xf for ; Sat, 29 Jun 2024 03:32:58 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPn-0005gj-Il; Fri, 28 Jun 2024 13:29:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPj-0005fk-S8 for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPh-0002EI-H5 for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595772; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UpEB8RKh0nHTTV4SYs2ZNSxWI14Dka7ndAM1DOHLcLk=; b=FTmNe3ldfizufMmFLJ11LcU8T5I/vsmh7N4YGiCPyIMFUTYcxoZB5GWkKyI+ZPtHzLE7bl /epYgufu0h3LjQ9CUkP4dyDxbfjqBrrOY7fI7xL5oar0cmT+Ppw7Mc9MYzzzKAeeM4yzC8 jR0BjrXCBzTHhguUM8OxPbBqqGtFbTQ= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-212-MpRZnYQRM4-QctaTEvycrg-1; Fri, 28 Jun 2024 13:29:31 -0400 X-MC-Unique: MpRZnYQRM4-QctaTEvycrg-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a71e1625bdbso59775566b.2 for ; Fri, 28 Jun 2024 10:29:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595769; x=1720200569; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UpEB8RKh0nHTTV4SYs2ZNSxWI14Dka7ndAM1DOHLcLk=; b=W6+yhi4Wtfpo5p8lmjcJazelqSPyQsrOE9jZUmAWE5wIj5gMX1fxNEbqy5Qk95rdHV kcNJj05E/PoCUlq0DDTSyZMcbcjtCpyj3CFcfzD8tV7YWS6GwMX7CZqnXzH6qdUGtzkj 9riAiK4jnFX2jTGnc3uqdSi5f+wbMMz87C5f4sPC0IspnOrKg4G8sVUgupTQTtvfwUqr WT3n/ImTa1nKjG/wL95NNbTPqcIx+o8sg+KhvlxiG9NHOPkfxFgrAAd20IYGqmi2tTz1 BMwRZhfBQSA/6KAHBTI/zZYHtpj15HFLwpOYFoO1GbemoKbpep71Ul8iwv/J2qn/SIt+ 2wvA== X-Gm-Message-State: AOJu0YzhpT8u/YQSW4H+V01ugVCucpSxXbALWZBEUfJ75SBTV90pXsK6 kUxUW+zbuUJ0DDQdkQcdJj1MlwPmKvSfFMkmwxsb2hEqpGJwN8tbEfmHmDC+X07SGrdhwFb96Fj wabgSWiYjRKgvzQyJuL/edyx9qi4gZepB3RUrI3igbV/SZG2tcws64bPeVNquRspHDkKo8OCA2a OO1gw4w/mt98KTgZDjFOo2CgSedF3HrlCngmyw X-Received: by 2002:a17:907:198e:b0:a72:61f7:7a0d with SMTP id a640c23a62f3a-a727f8be53emr800809266b.54.1719595769713; Fri, 28 Jun 2024 10:29:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0JhrTZXB5izSnjD0HY+jrEQJ3UHY6VbGMku7iSaWt+7eViISqg2e2qruSIDsTvhGPt0slcw== X-Received: by 2002:a17:907:198e:b0:a72:61f7:7a0d with SMTP id a640c23a62f3a-a727f8be53emr800806766b.54.1719595769203; Fri, 28 Jun 2024 10:29:29 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab0b56e6sm95334766b.202.2024.06.28.10.29.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:27 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 14/23] target/i386: fix CC_OP dump Date: Fri, 28 Jun 2024 19:28:46 +0200 Message-ID: <20240628172855.1147598-15-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UPPERCASE_50_75=0.008 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org POPCNT was missing, and the entries were all out of order after ADCX/ADOX/ADCOX were moved close to EFLAGS. Just use designated initializers. Fixes: 4885c3c4953 ("target-i386: Use ctpop helper", 2017-01-10) Fixes: cc155f19717 ("target/i386: rewrite flags writeback for ADCX/ADOX", 2024-06-11) Signed-off-by: Paolo Bonzini --- target/i386/cpu-dump.c | 101 +++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/target/i386/cpu-dump.c b/target/i386/cpu-dump.c index 40697064d92..3bb8e440916 100644 --- a/target/i386/cpu-dump.c +++ b/target/i386/cpu-dump.c @@ -28,69 +28,70 @@ /* x86 debug */ static const char *cc_op_str[CC_OP_NB] = { - "DYNAMIC", - "EFLAGS", + [CC_OP_DYNAMIC] = "DYNAMIC", - "MULB", - "MULW", - "MULL", - "MULQ", + [CC_OP_EFLAGS] = "EFLAGS", + [CC_OP_ADCX] = "ADCX", + [CC_OP_ADOX] = "ADOX", + [CC_OP_ADCOX] = "ADCOX", - "ADDB", - "ADDW", - "ADDL", - "ADDQ", + [CC_OP_MULB] = "MULB", + [CC_OP_MULW] = "MULW", + [CC_OP_MULL] = "MULL", + [CC_OP_MULQ] = "MULQ", - "ADCB", - "ADCW", - "ADCL", - "ADCQ", + [CC_OP_ADDB] = "ADDB", + [CC_OP_ADDW] = "ADDW", + [CC_OP_ADDL] = "ADDL", + [CC_OP_ADDQ] = "ADDQ", - "SUBB", - "SUBW", - "SUBL", - "SUBQ", + [CC_OP_ADCB] = "ADCB", + [CC_OP_ADCW] = "ADCW", + [CC_OP_ADCL] = "ADCL", + [CC_OP_ADCQ] = "ADCQ", - "SBBB", - "SBBW", - "SBBL", - "SBBQ", + [CC_OP_SUBB] = "SUBB", + [CC_OP_SUBW] = "SUBW", + [CC_OP_SUBL] = "SUBL", + [CC_OP_SUBQ] = "SUBQ", - "LOGICB", - "LOGICW", - "LOGICL", - "LOGICQ", + [CC_OP_SBBB] = "SBBB", + [CC_OP_SBBW] = "SBBW", + [CC_OP_SBBL] = "SBBL", + [CC_OP_SBBQ] = "SBBQ", - "INCB", - "INCW", - "INCL", - "INCQ", + [CC_OP_LOGICB] = "LOGICB", + [CC_OP_LOGICW] = "LOGICW", + [CC_OP_LOGICL] = "LOGICL", + [CC_OP_LOGICQ] = "LOGICQ", - "DECB", - "DECW", - "DECL", - "DECQ", + [CC_OP_INCB] = "INCB", + [CC_OP_INCW] = "INCW", + [CC_OP_INCL] = "INCL", + [CC_OP_INCQ] = "INCQ", - "SHLB", - "SHLW", - "SHLL", - "SHLQ", + [CC_OP_DECB] = "DECB", + [CC_OP_DECW] = "DECW", + [CC_OP_DECL] = "DECL", + [CC_OP_DECQ] = "DECQ", - "SARB", - "SARW", - "SARL", - "SARQ", + [CC_OP_SHLB] = "SHLB", + [CC_OP_SHLW] = "SHLW", + [CC_OP_SHLL] = "SHLL", + [CC_OP_SHLQ] = "SHLQ", - "BMILGB", - "BMILGW", - "BMILGL", - "BMILGQ", + [CC_OP_SARB] = "SARB", + [CC_OP_SARW] = "SARW", + [CC_OP_SARL] = "SARL", + [CC_OP_SARQ] = "SARQ", - "ADCX", - "ADOX", - "ADCOX", + [CC_OP_BMILGB] = "BMILGB", + [CC_OP_BMILGW] = "BMILGW", + [CC_OP_BMILGL] = "BMILGL", + [CC_OP_BMILGQ] = "BMILGQ", - "CLR", + [CC_OP_POPCNT] = "POPCNT", + [CC_OP_CLR] = "CLR", }; static void From patchwork Fri Jun 28 17:28:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954082 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=A+Tn9+Sk; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jCG1YKDz20Xf for ; Sat, 29 Jun 2024 03:31:06 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPo-0005h1-72; Fri, 28 Jun 2024 13:29:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPm-0005g2-4b for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPj-0002Eb-Nj for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595775; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aleBzn+huIt14P3sbcazofrV5NBLqO/zRqX5PoCWTZ8=; b=A+Tn9+SkCjZDzZ9xEAuO3pCz2EQBNCk3LPQLnibJVo+kpDNfsUGFixmwn9omscVSEU8B0c qTn36ayrceDRQLlZ5Mns76eukA4U8Mo2vbTMfLQrYJqEGQ2ko0U57M6yrpED0FrXqYREHP h7bGH+A7oQctuXqsKVdR/hfVoI6Gnic= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-467-e3rXnFBrMRy4c96lu0U_OA-1; Fri, 28 Jun 2024 13:29:33 -0400 X-MC-Unique: e3rXnFBrMRy4c96lu0U_OA-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a724d8c38d3so51002166b.2 for ; Fri, 28 Jun 2024 10:29:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595771; x=1720200571; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aleBzn+huIt14P3sbcazofrV5NBLqO/zRqX5PoCWTZ8=; b=c7iywsSpysPcRcYuLq0V0ilAiQ2dYj353zHYrfNatSfVAL3+IdReg2dykzkG4vi2js pZ5Y08A4rw6VO437VAn+VKp7vrjWsn1MnGQ96UO3J5amwFxFckRsCIkhn2sS/8qoOPVe a/8iC1h/dsQAXRl2oDws2j5n6szNJUE5/g1baN8j2+x3B2+ZAtVpzICktKkEHNPixVTU l6cpdp9XDAQMBfRQSNydW1+XOmzmlHYONiQbEQPfU//U2dHcaoWNP2c7RLetWtDgTVn9 ZHUjhcwNaF9GYFSq9fduaS89c3iTMKSENrl9TPozn07AV5tRVfRy2PELXhPSRbwL1prI qW9w== X-Gm-Message-State: AOJu0YwaC/GZBQQ1DE+V1jXE9IVERulsN12bE3nGNdFnj+292hASJgia OeDrYvatUf1rx3szhlmoLLsfPOentpbbgJWX4xSKN9pxnPy5ev5YjcJqxUg3Tcwr84rX7Z3CBBP 6+1N/D30Ra9OnfA3dcXnz3ilL5BYN6cqJRpQSWc3gWnmZxui8Ww/sJydTqTIAftC8cfTf5XPD2S SFjd+R/T7tt+ag5T1+Ko0qE6/rUq8t8BcSI4uN X-Received: by 2002:a17:906:6a22:b0:a6e:f7bc:dcab with SMTP id a640c23a62f3a-a7245c64dc3mr1401672066b.65.1719595771322; Fri, 28 Jun 2024 10:29:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFT3uQkXrMm+qoQfJ8OELnvGvIpHRhh8yqSMaWbIexkj2midlvn1DO8fIXnPJ5cbOKIFRd1wg== X-Received: by 2002:a17:906:6a22:b0:a6e:f7bc:dcab with SMTP id a640c23a62f3a-a7245c64dc3mr1401670266b.65.1719595770821; Fri, 28 Jun 2024 10:29:30 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aaf1bc08sm95937266b.28.2024.06.28.10.29.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:30 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 15/23] target/i386: use cpu_cc_dst for CC_OP_POPCNT Date: Fri, 28 Jun 2024 19:28:47 +0200 Message-ID: <20240628172855.1147598-16-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org It is the only CCOp, among those that compute ZF from one of the cc_op_* registers, that uses cpu_cc_src. Do not make it the odd one off, instead use cpu_cc_dst like the others. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/cpu.h | 2 +- target/i386/tcg/cc_helper.c | 2 +- target/i386/tcg/translate.c | 4 ++-- target/i386/tcg/emit.c.inc | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 52571ababe2..1b4edbe0580 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1332,7 +1332,7 @@ typedef enum { CC_OP_BMILGQ, CC_OP_CLR, /* Z set, all other flags clear. */ - CC_OP_POPCNT, /* Z via CC_SRC, all other flags clear. */ + CC_OP_POPCNT, /* Z via CC_DST, all other flags clear. */ CC_OP_NB, } CCOp; diff --git a/target/i386/tcg/cc_helper.c b/target/i386/tcg/cc_helper.c index f76e9cb8cfb..301ed954064 100644 --- a/target/i386/tcg/cc_helper.c +++ b/target/i386/tcg/cc_helper.c @@ -107,7 +107,7 @@ target_ulong helper_cc_compute_all(target_ulong dst, target_ulong src1, case CC_OP_CLR: return CC_Z | CC_P; case CC_OP_POPCNT: - return src1 ? 0 : CC_Z; + return dst ? 0 : CC_Z; case CC_OP_MULB: return compute_all_mulb(dst, src1); diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index ad1819815ab..eb353dc3c9f 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -324,7 +324,7 @@ static const uint8_t cc_op_live[CC_OP_NB] = { [CC_OP_ADOX] = USES_CC_SRC | USES_CC_SRC2, [CC_OP_ADCOX] = USES_CC_DST | USES_CC_SRC | USES_CC_SRC2, [CC_OP_CLR] = 0, - [CC_OP_POPCNT] = USES_CC_SRC, + [CC_OP_POPCNT] = USES_CC_DST, }; static void set_cc_op_1(DisasContext *s, CCOp op, bool dirty) @@ -1020,7 +1020,7 @@ static CCPrepare gen_prepare_eflags_z(DisasContext *s, TCGv reg) case CC_OP_CLR: return (CCPrepare) { .cond = TCG_COND_ALWAYS }; case CC_OP_POPCNT: - return (CCPrepare) { .cond = TCG_COND_EQ, .reg = cpu_cc_src }; + return (CCPrepare) { .cond = TCG_COND_EQ, .reg = cpu_cc_dst }; default: { MemOp size = (s->cc_op - CC_OP_ADDB) & 3; diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index 11faa70b5e2..fc7477833bc 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -2804,10 +2804,10 @@ static void gen_POPA(DisasContext *s, X86DecodedInsn *decode) static void gen_POPCNT(DisasContext *s, X86DecodedInsn *decode) { - decode->cc_src = tcg_temp_new(); + decode->cc_dst = tcg_temp_new(); decode->cc_op = CC_OP_POPCNT; - tcg_gen_mov_tl(decode->cc_src, s->T0); + tcg_gen_mov_tl(decode->cc_dst, s->T0); tcg_gen_ctpop_tl(s->T0, s->T0); } From patchwork Fri Jun 28 17:28:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954086 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=GkWhOU8C; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jDP2yvmz20Xf for ; Sat, 29 Jun 2024 03:32:05 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPq-0005hg-Jc; Fri, 28 Jun 2024 13:29:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPp-0005hT-GZ for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPo-0002Ez-3W for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595779; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rb/XNVOr++O08J4/Xv3HqdQx3Qog+zVROp768RnHVi0=; b=GkWhOU8CIaKcvi4G2SK/tkBarO43eOgrF14UkUyoX/i6uahXOFemzksNnxQtWn1qigvoWI ++FkAdoXMqUXy/mkdiGua8Dikq6bYgaqNpf5A0sh2gOl2JELvq9SFmv/zLJK2PP0I7bP1E jmlciOSb+UYujNPoooGEpFCD4oO8SVI= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-ZQzU4NliO1Gi18NUssrMUQ-1; Fri, 28 Jun 2024 13:29:36 -0400 X-MC-Unique: ZQzU4NliO1Gi18NUssrMUQ-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-57d05ce92ecso764589a12.3 for ; Fri, 28 Jun 2024 10:29:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595774; x=1720200574; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Rb/XNVOr++O08J4/Xv3HqdQx3Qog+zVROp768RnHVi0=; b=MKY7coOMNeo3lklsof0K30ENQwgkrVN5Kp2vyUMSJu6f7O81rGXiRerZ7N2LS9AJTr XtK0bK7zxrDmWbu961gn938IkRDGaXTZp9TZRh9Qs+We/NZtvyMVzSagqaRWbsLJeW3k D9uQEHRziUlIDH6SbyT9Q9/gfmP3QlQ9ftNut2ZvOcfUxH0kvkpnOtDEn8lkH7d6H9xW 8+Vz/bjoOBTLhmyAKol/00KGSh/ghPwqPnp48Yi5gqNW1tHj+0RhaUwEMw99d0/CZKuH kgfxjbYWtuAJyyUVKdMQMR5kDgl+YeQCrbK6Lhc+UvHvA+Mo8hvuhwaa4n/n8DfaFnk4 hq2w== X-Gm-Message-State: AOJu0YzU06qh/edkfU6pcMHqIjiX3ixRFfQOvIfDP6laORei7nPBSZf7 gK88tyLktGhbUzbroB9SsrOriUZj4IB9oISFIdrXmvtrSRoFczo0nRGi7kfYY39F8KoLo4MdOxQ RurKV/p8+AT9vDuq1iGGHan+yczYH9ruoQVZ6WNxETc6eZyYz/vc+T7YEa8UOOMli6NwNzcCNjL AXOo0GSxwf1XrgtdrHtjtfZcEQb82sJaWSLosp X-Received: by 2002:a17:907:6d19:b0:a72:b055:3dd7 with SMTP id a640c23a62f3a-a72b055407bmr183088966b.1.1719595774076; Fri, 28 Jun 2024 10:29:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEWVIVtDOEdKG07qeYEEPD155dH3VE4cj7L7xQC5knylZDO4zQyqLzMsa5bkYb/6z7nH02Tqg== X-Received: by 2002:a17:907:6d19:b0:a72:b055:3dd7 with SMTP id a640c23a62f3a-a72b055407bmr183087266b.1.1719595773660; Fri, 28 Jun 2024 10:29:33 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72affddd7bsm70365366b.186.2024.06.28.10.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:32 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 16/23] target/i386: give CC_OP_POPCNT low bits corresponding to MO_TL Date: Fri, 28 Jun 2024 19:28:48 +0200 Message-ID: <20240628172855.1147598-17-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org Handle it like the other arithmetic cc_ops. This simplifies a bit the implementation of bit test instructions. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/cpu.h | 13 +++++++++++-- target/i386/tcg/translate.c | 3 +-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 1b4edbe0580..29daf370485 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1275,6 +1275,7 @@ typedef enum { CC_OP_ADCX, /* CC_DST = C, CC_SRC = rest. */ CC_OP_ADOX, /* CC_SRC2 = O, CC_SRC = rest. */ CC_OP_ADCOX, /* CC_DST = C, CC_SRC2 = O, CC_SRC = rest. */ + CC_OP_CLR, /* Z and P set, all other flags clear. */ CC_OP_MULB, /* modify all flags, C, O = (CC_SRC != 0) */ CC_OP_MULW, @@ -1331,8 +1332,16 @@ typedef enum { CC_OP_BMILGL, CC_OP_BMILGQ, - CC_OP_CLR, /* Z set, all other flags clear. */ - CC_OP_POPCNT, /* Z via CC_DST, all other flags clear. */ + /* + * Note that only CC_OP_POPCNT (i.e. the one with MO_TL size) + * is used or implemented, because the translation needs + * to zero-extend CC_DST anyway. + */ + CC_OP_POPCNTB__, /* Z via CC_DST, all other flags clear. */ + CC_OP_POPCNTW__, + CC_OP_POPCNTL__, + CC_OP_POPCNTQ__, + CC_OP_POPCNT = sizeof(target_ulong) == 8 ? CC_OP_POPCNTQ__ : CC_OP_POPCNTL__, CC_OP_NB, } CCOp; diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index eb353dc3c9f..934c514e64f 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -1019,8 +1019,6 @@ static CCPrepare gen_prepare_eflags_z(DisasContext *s, TCGv reg) .imm = CC_Z }; case CC_OP_CLR: return (CCPrepare) { .cond = TCG_COND_ALWAYS }; - case CC_OP_POPCNT: - return (CCPrepare) { .cond = TCG_COND_EQ, .reg = cpu_cc_dst }; default: { MemOp size = (s->cc_op - CC_OP_ADDB) & 3; @@ -3177,6 +3175,7 @@ static void disas_insn_old(DisasContext *s, CPUState *cpu, int b) case CC_OP_SHLB ... CC_OP_SHLQ: case CC_OP_SARB ... CC_OP_SARQ: case CC_OP_BMILGB ... CC_OP_BMILGQ: + case CC_OP_POPCNT: /* Z was going to be computed from the non-zero status of CC_DST. We can get that same Z value (and the new C value) by leaving CC_DST alone, setting CC_SRC, and using a CC_OP_SAR of the From patchwork Fri Jun 28 17:28:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954087 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fHZ5/Pc5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jFC2pJCz20b0 for ; Sat, 29 Jun 2024 03:32:47 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPs-0005iK-MK; Fri, 28 Jun 2024 13:29:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPq-0005hu-UX for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPp-0002FJ-JI for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595781; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EmKkTMq9nQNBDUfIC/QAa3KWBTUv02XP17TptxQk01s=; b=fHZ5/Pc5XArM3uniPvlj9RuuYB12OflvoIORMzVcDhjKMNezVsyHNdiAUzOrWrK4JwhYMU DYeCQc9gVFaGXxqoXHzB7Q1FgnV0dm70cFMhytn0KLot9vfaqJ2Cj8vb0e4mGJgyleZ0W0 /WhxTGJ19o9r6FzoQfXpqyAw+PskxD8= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-512-NcUpT1-fNDSr5ucwVIvZqg-1; Fri, 28 Jun 2024 13:29:38 -0400 X-MC-Unique: NcUpT1-fNDSr5ucwVIvZqg-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a7293303843so67520866b.3 for ; Fri, 28 Jun 2024 10:29:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595777; x=1720200577; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EmKkTMq9nQNBDUfIC/QAa3KWBTUv02XP17TptxQk01s=; b=NX26+k2gOHfJHHo26rOKV0lvB4sxl4CnE1qSkP9AEzL5OCNEcx0CaDWOHVomsgo8uB qy6GSu745xD8dA8qC2BPzfNO1KH1+5COZprOenxMIhfDPeaPKHQOIeytgO5Qd1yOjqTn in60xArOAKP/P7T3Yt032nwPcR3ISRbAgQCt+ncTCx2JQa5+vnN+V7yTfETg0KiATbA9 RWtDg6MvtR17ApqteHBbdnpjL48sRoD0yBf8xsOZ99HkXR4xHrjZEqB3b6Y+Z3eWy4oT owqj5phkH2hfKyhKhKJ+cwchFNMgIDBdRq9C0lYrEdtpC9wtBdDnDWCCHoDNyE5WnQ0S 0YJw== X-Gm-Message-State: AOJu0YzRDWwpxbNOBTjPB206rA+WW38S9e0rR6xD+2jS2+KEYgPtuQ4X UPvLQe2a+tX906IsBCFrynUKKJZ8eqhb3QtDXRHIjIkr/1+jIY4L00omtR0ewHMAOUkt8Nm48O1 3Wu13A8AwWlvzsx1oa+4LRuvtBYKOJUU6FMIw+gxNeh8dleYG2dz/wKQ9PkOKdRdeTjKKMM1KB4 g2VC/zqfRAog3KwxuzHX0fAPEbJAJNTFnV+CdF X-Received: by 2002:a17:906:4903:b0:a6f:b428:30fa with SMTP id a640c23a62f3a-a7245dc9c41mr1055602366b.59.1719595776871; Fri, 28 Jun 2024 10:29:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEzQ0yqWieYHvSWqlpuM/QB9AzIKXUZfMhYU3928VVmNZi9X68demmKj1u6C1k4JAadmOURQA== X-Received: by 2002:a17:906:4903:b0:a6f:b428:30fa with SMTP id a640c23a62f3a-a7245dc9c41mr1055601466b.59.1719595776541; Fri, 28 Jun 2024 10:29:36 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aaf60458sm96205866b.63.2024.06.28.10.29.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:34 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 17/23] target/i386: remove unused enum Date: Fri, 28 Jun 2024 19:28:49 +0200 Message-ID: <20240628172855.1147598-18-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 934c514e64f..95bad55bf46 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -282,22 +282,6 @@ enum { JCC_LE, }; -enum { - /* I386 int registers */ - OR_EAX, /* MUST be even numbered */ - OR_ECX, - OR_EDX, - OR_EBX, - OR_ESP, - OR_EBP, - OR_ESI, - OR_EDI, - - OR_TMP0 = 16, /* temporary operand register */ - OR_TMP1, - OR_A0, /* temporary register used when doing address evaluation */ -}; - enum { USES_CC_DST = 1, USES_CC_SRC = 2, From patchwork Fri Jun 28 17:28:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954094 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DDNcKjSL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jFK2sqgz214c for ; Sat, 29 Jun 2024 03:32:53 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPt-0005ih-RZ; Fri, 28 Jun 2024 13:29:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPr-0005i6-Ph for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPq-0002FT-En for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595781; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m5NP/UiuFcCb7LOBTRdivsHTgeUYCYVStbvRvpRoDSo=; b=DDNcKjSLLwSG6wusQTJs2rxcls49y/0a71iTFecDiQig+WdKmTiUVbgEa0zG5PrQggux4l POS/LzjDNhPAScNLC3T0+UYimnjAT1PyUSQpROBnGSPnpZxHb5XcDtd+KKh4BXjiUcrqV2 0Emk2Uw7VnavjfcHNnlwRj2BmtJWZ1I= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-550-nElhRcUfMF26zttz-PH9Pw-1; Fri, 28 Jun 2024 13:29:40 -0400 X-MC-Unique: nElhRcUfMF26zttz-PH9Pw-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-57cad6e94e5so655698a12.3 for ; Fri, 28 Jun 2024 10:29:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595778; x=1720200578; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m5NP/UiuFcCb7LOBTRdivsHTgeUYCYVStbvRvpRoDSo=; b=oAA/iu1oxuIB3/Pfj2YliqKVX9g7Y3HGOM6xm3YEdmhqM4AQqvJfQgWm6RGBmoMUvn HPGPK+tpFSpZH67TDL1PwQ532e0jY1M/ohrz86iw4/0hFWB2xcrZ4NJ34O8I9/3YZyvs g6VG5baozDll8uVvhdJgQeqrZ0SfkTLtAX7f7bxsk/0IgyqGYSMDKg9Kwp2ncc5VgxBP /Q8NXvwSdjY4BoUf1cOo4mqtEVZ1dov2muvJjd18BjLwqsEK2lRYqCXjo4YQI8QZ8CvJ icpkbvfnChJiPEsMYR024Izn/UGwO19TXp5WytPzLDDIXrguKJHcLM4YrnY6ICW/MvbV HToQ== X-Gm-Message-State: AOJu0YwVqT0PcTmhuQsj5HIhdlva10+1HxHtDpSskxWXh6ezm+jvA2iY WqEeh3SE48KdlHBp6igUbQfeRCW2Y5Q0X8CVvFuDJhWfMWMuZkp6MEo/j1qgXt2fcft2RJPQx/j 3dDh8kGQ8SuL6dUZpHI2Dj33oowdkmqycIhFvPhblGfh6dKunIG8O31wp8xIzntcwng177F9LUp uqXnQb6bb49Osy5rgnO/28KMciNTDmxbssSrW8 X-Received: by 2002:a50:8e5c:0:b0:57d:3691:baf9 with SMTP id 4fb4d7f45d1cf-57d4bd8151bmr11412028a12.22.1719595778486; Fri, 28 Jun 2024 10:29:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXSWciSE8H6fOJOz1cggR+H11LqbRfftYMYeU5YxbGXexWoMk4OZdXzSIJY2eo52X7+YWQVg== X-Received: by 2002:a50:8e5c:0:b0:57d:3691:baf9 with SMTP id 4fb4d7f45d1cf-57d4bd8151bmr11412017a12.22.1719595778131; Fri, 28 Jun 2024 10:29:38 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-58614f3d74dsm1267067a12.90.2024.06.28.10.29.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 18/23] target/i386: SEV: rename sev_snp_guest->id_block Date: Fri, 28 Jun 2024 19:28:50 +0200 Message-ID: <20240628172855.1147598-19-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org Free the "id_block" name for the binary version of the data. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 30b83f1d77d..6daa8c264cd 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -152,7 +152,7 @@ struct SevSnpGuestState { /* configuration parameters */ char *guest_visible_workarounds; - char *id_block; + char *id_block_base64; char *id_auth; char *host_data; @@ -1296,7 +1296,7 @@ sev_snp_launch_finish(SevCommonState *sev_common) } } - trace_kvm_sev_snp_launch_finish(sev_snp->id_block, sev_snp->id_auth, + trace_kvm_sev_snp_launch_finish(sev_snp->id_block_base64, sev_snp->id_auth, sev_snp->host_data); ret = sev_ioctl(sev_common->sev_fd, KVM_SEV_SNP_LAUNCH_FINISH, finish, &error); @@ -2159,7 +2159,7 @@ sev_snp_guest_get_id_block(Object *obj, Error **errp) { SevSnpGuestState *sev_snp_guest = SEV_SNP_GUEST(obj); - return g_strdup(sev_snp_guest->id_block); + return g_strdup(sev_snp_guest->id_block_base64); } static void @@ -2170,14 +2170,14 @@ sev_snp_guest_set_id_block(Object *obj, const char *value, Error **errp) gsize len; finish->id_block_en = 0; - g_free(sev_snp_guest->id_block); + g_free(sev_snp_guest->id_block_base64); g_free((guchar *)finish->id_block_uaddr); /* store the base64 str so we don't need to re-encode in getter */ - sev_snp_guest->id_block = g_strdup(value); + sev_snp_guest->id_block_base64 = g_strdup(value); finish->id_block_uaddr = - (uint64_t)qbase64_decode(sev_snp_guest->id_block, -1, &len, errp); + (uint64_t)qbase64_decode(sev_snp_guest->id_block_base64, -1, &len, errp); if (!finish->id_block_uaddr) { return; From patchwork Fri Jun 28 17:28:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954085 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZftkVedR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jDL3SNyz20Xf for ; Sat, 29 Jun 2024 03:32:02 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPx-0005jM-76; Fri, 28 Jun 2024 13:29:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPw-0005j1-0q for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPu-0002Fj-Hp for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595786; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ORCk/FXIHVUbFmgn9cgWoHSkGsXOS7zZLuug5lf0HZE=; b=ZftkVedRVzYKQ4rhnTSa4D8sZ6sP519XtoKF57WJVbDKp3QtMwRj6ILfxwTDcB3HuudlCg dk/KwDUkRo9Yt8KZ6sZL84b2gQ0KH+kqUJX5y1X/QEhJMFKcna7Dpn036B0S2vH/V+6MPD 4ue9OuM4pVFuxxjkdYSVYvbVPrBniiw= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-594-pbm_nEQ_M2iayJZ7MZKtLA-1; Fri, 28 Jun 2024 13:29:44 -0400 X-MC-Unique: pbm_nEQ_M2iayJZ7MZKtLA-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-52cdd05fec8so898924e87.0 for ; Fri, 28 Jun 2024 10:29:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595782; x=1720200582; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ORCk/FXIHVUbFmgn9cgWoHSkGsXOS7zZLuug5lf0HZE=; b=wd00XCPEmKbSNrkiWWJaZ9JFmeLQyQZeXqs9oxDa/Wlnax4MGIN50GRJe2WoVNDpCO WbByxOrYkfyD3txE/mYdQJJjonSTQEuuzj17qxPlh4Fgw3ukt/s8CpR5Krwh8nu08Ls+ Lkul6v0xSTDHiHXpHhg4oDVCcZ12PK2FQTaiTzUkjhA3VFzpFa6+uVLESWKDBVTIH+VR owdfVOURBR5TyQlnaWmGLiXvl0EMz+Up7t6okLT3w8dW048ogLD3vPOpgjDczdlLYmgO yWBdLhOyh7An/tMy3q2p2aoaiDzCX0bVn4WhLPRxg9hnoUn7cvu5j5t1uWLO1HwN2CsY PXRQ== X-Gm-Message-State: AOJu0YwUD5SvYlSC6C6zXId9lLsqAh50bRLAa5aAQBhiTBxYqJ1pnawe C2u0X7fn90BnDY0pfxHI/LYBJcgmW1/lChaQKW8IwsueSeDohsS2wWWM0FgC0OM8s5VLapGTi+7 k7v6tQ8mhP+lcfv8XLKF8iHq0CoD6zOsyM4DGqVGlpwPSOlGfXi2e2zFuTwzkGw0ss/lQlVPF7B cCmHanDbB2hiaj5IPticJlZ9hqJhHSduWHh1ZK X-Received: by 2002:a05:6512:20b:b0:52c:d88a:8981 with SMTP id 2adb3069b0e04-52ce183b245mr9936454e87.34.1719595781747; Fri, 28 Jun 2024 10:29:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEetHpCOLmaxg1RSBItWfs+DPeYlvmDTGhYxwJuyz5JLNynj5E9l12tOzyjUXFNzMq0gHtffA== X-Received: by 2002:a05:6512:20b:b0:52c:d88a:8981 with SMTP id 2adb3069b0e04-52ce183b245mr9936439e87.34.1719595781181; Fri, 28 Jun 2024 10:29:41 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab0b809csm95552166b.212.2024.06.28.10.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:39 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 19/23] target/i386: SEV: store pointer to decoded id_block in SevSnpGuest Date: Fri, 28 Jun 2024 19:28:51 +0200 Message-ID: <20240628172855.1147598-20-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org Do not rely on finish->id_block_uaddr, so that there are no casts from pointer to uint64_t. They break on 32-bit hosts. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 6daa8c264cd..2d4cfd41e83 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -153,6 +153,7 @@ struct SevSnpGuestState { /* configuration parameters */ char *guest_visible_workarounds; char *id_block_base64; + uint8_t *id_block; char *id_auth; char *host_data; @@ -2170,16 +2171,15 @@ sev_snp_guest_set_id_block(Object *obj, const char *value, Error **errp) gsize len; finish->id_block_en = 0; + g_free(sev_snp_guest->id_block); g_free(sev_snp_guest->id_block_base64); - g_free((guchar *)finish->id_block_uaddr); /* store the base64 str so we don't need to re-encode in getter */ sev_snp_guest->id_block_base64 = g_strdup(value); + sev_snp_guest->id_block = + qbase64_decode(sev_snp_guest->id_block_base64, -1, &len, errp); - finish->id_block_uaddr = - (uint64_t)qbase64_decode(sev_snp_guest->id_block_base64, -1, &len, errp); - - if (!finish->id_block_uaddr) { + if (!sev_snp_guest->id_block) { return; } @@ -2190,6 +2190,7 @@ sev_snp_guest_set_id_block(Object *obj, const char *value, Error **errp) } finish->id_block_en = 1; + finish->id_block_uaddr = (uintptr_t)sev_snp_guest->id_block; } static char * From patchwork Fri Jun 28 17:28:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LLSGEZsu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jFJ0Kcqz20b0 for ; Sat, 29 Jun 2024 03:32:52 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFPz-0005mm-F2; Fri, 28 Jun 2024 13:29:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPy-0005jg-Mn for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPx-0002Fw-9G for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595787; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6KXi+CTiEtHiD7S+XumvmPGujXhxrwa+TTB3rvpazHw=; b=LLSGEZsu4LYSuhkORrFRfUgW0VJiA9GNDMOJ9D75uvzVCbREKsJIElW39bU8EbsXN3Akx9 HgjmdVAdgqRnnts07xZwR+hHnz2ESUlIBYMmj6Q2EdCwMsbpDU1TPt9Ko4g9vvKWQdGam2 u8GinOt1XV5OhGF8rNm5avWFTbmPUhM= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-286-oVjDujxxPX2t0fffcQbDWw-1; Fri, 28 Jun 2024 13:29:46 -0400 X-MC-Unique: oVjDujxxPX2t0fffcQbDWw-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-57c6979daf7so702569a12.1 for ; Fri, 28 Jun 2024 10:29:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595784; x=1720200584; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6KXi+CTiEtHiD7S+XumvmPGujXhxrwa+TTB3rvpazHw=; b=jU0qAV9vY/3b4stxYQrLq3AUNisAMXB9KRzrbxP78jMsAZHB88w529i/u/hDymI1zP iHshBd9YS0KX6EOTXkrIB65JSSmkN2LcgXr3fizHjE8BSb1LEzAoTvI6Q4kg3LqI9SN3 rtEsH5fxq+400Crd08/1PscKn432aDwpg3WgtOm50IT/tO6Cpa6E32moloCaf6Inhnda XuweyQ/cWnB/kqq3uJ8h/Le3yrtKMtX/iwpy/f8jEFD4T9hwx/TxueY1ZlGHWyxJBQbn RJBjcMbmbF0Tw5vAqWMmY1TfQftVGj5lwIzUMBDXnLwY3olI4vL6DeToYy9y3S+tQtt5 dqeA== X-Gm-Message-State: AOJu0YwrhDbnKvvdU9x8Y7mV5xkTSMJYk9VJn1M+Myy95D0BLy1FPjxf jBEZuic42LQjjfOZ6k86m/1OybdcpxPWxKmJ/ClfsMiKsbbCScYGsB6dCW5LdPQiwz43+//Hdh1 e/i2kSj7+YP5TCTqDOavs4LBKOWXqKmEfuxOd1wvAW12Z7K4plcgOxK4lEub1UE68zQhMuPZuak kpP4pK/zI9kYCCKgoq9rSyfb7Q3d8j8vT4hRe4 X-Received: by 2002:a17:906:68d4:b0:a72:428f:cd66 with SMTP id a640c23a62f3a-a7245b73276mr1057008466b.39.1719595784390; Fri, 28 Jun 2024 10:29:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFXUnixwUXXZWq/MOtYGjhoRBFwY53HwWAS9TemVQBC59bYcfZdOmVlDv9kbAjQlSr94Y3Yw== X-Received: by 2002:a17:906:68d4:b0:a72:428f:cd66 with SMTP id a640c23a62f3a-a7245b73276mr1057007066b.39.1719595783977; Fri, 28 Jun 2024 10:29:43 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aaf63dfbsm96658766b.84.2024.06.28.10.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:42 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 20/23] target/i386: SEV: rename sev_snp_guest->id_auth Date: Fri, 28 Jun 2024 19:28:52 +0200 Message-ID: <20240628172855.1147598-21-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org Free the "id_auth" name for the binary version of the data. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 2d4cfd41e83..a6b063b762c 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -154,7 +154,7 @@ struct SevSnpGuestState { char *guest_visible_workarounds; char *id_block_base64; uint8_t *id_block; - char *id_auth; + char *id_auth_base64; char *host_data; struct kvm_sev_snp_launch_start kvm_start_conf; @@ -1297,7 +1297,7 @@ sev_snp_launch_finish(SevCommonState *sev_common) } } - trace_kvm_sev_snp_launch_finish(sev_snp->id_block_base64, sev_snp->id_auth, + trace_kvm_sev_snp_launch_finish(sev_snp->id_block_base64, sev_snp->id_auth_base64, sev_snp->host_data); ret = sev_ioctl(sev_common->sev_fd, KVM_SEV_SNP_LAUNCH_FINISH, finish, &error); @@ -2198,7 +2198,7 @@ sev_snp_guest_get_id_auth(Object *obj, Error **errp) { SevSnpGuestState *sev_snp_guest = SEV_SNP_GUEST(obj); - return g_strdup(sev_snp_guest->id_auth); + return g_strdup(sev_snp_guest->id_auth_base64); } static void @@ -2208,14 +2208,14 @@ sev_snp_guest_set_id_auth(Object *obj, const char *value, Error **errp) struct kvm_sev_snp_launch_finish *finish = &sev_snp_guest->kvm_finish_conf; gsize len; - g_free(sev_snp_guest->id_auth); + g_free(sev_snp_guest->id_auth_base64); g_free((guchar *)finish->id_auth_uaddr); /* store the base64 str so we don't need to re-encode in getter */ - sev_snp_guest->id_auth = g_strdup(value); + sev_snp_guest->id_auth_base64 = g_strdup(value); finish->id_auth_uaddr = - (uint64_t)qbase64_decode(sev_snp_guest->id_auth, -1, &len, errp); + (uint64_t)qbase64_decode(sev_snp_guest->id_auth_base64, -1, &len, errp); if (!finish->id_auth_uaddr) { return; From patchwork Fri Jun 28 17:28:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954089 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KSnXdcqH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jFF1Y4jz20Xf for ; Sat, 29 Jun 2024 03:32:49 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFQ2-0005xp-At; Fri, 28 Jun 2024 13:29:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPz-0005pe-VL for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFPy-0002GE-Df for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595789; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9uRfBk4pyxsS7EnJAcVfZWqmtL5OlKp+t3MsBw573tc=; b=KSnXdcqHmwu5zsv5Z7ZJpPhZPxtopyiS928MkMO/9oBGP3jmWB7b65bFGasEffWF5n18OW TOyDN9/h+LSmhO5A9rTbFzR2b9IdqZs2w4xAMQnB5TZCj7qRp8APVwbL9vGJXwacpG4e4v 5t6sRcdK7FfGAiI2fwHofP3MyUi6K4M= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-662-rIxJEdwxNXGf1MerpejczA-1; Fri, 28 Jun 2024 13:29:48 -0400 X-MC-Unique: rIxJEdwxNXGf1MerpejczA-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-57d3672cf40so578706a12.2 for ; Fri, 28 Jun 2024 10:29:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595787; x=1720200587; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9uRfBk4pyxsS7EnJAcVfZWqmtL5OlKp+t3MsBw573tc=; b=Eul2yrDI7+COld1ODb/qItwLs3PEAveffJVJwZ+WnyACHu96w7fupWNAtqt4BxWEJw K/AKPIxafaPzAhGY3BOg8UB0Ml4R3RWrHMtzzYXpCcjq2K3rhGSCLaXqm2HW9tGdALt/ Xk0fwSoXpmclyJnry/A+ZR4gUq3qa9Im+qmmDod1YC5nT4d25aD+jZORPluKKjnoZKwI s30pm/5IR4dQ/XYB9TCLAJu8tbH4OifdanwSka8DGASZ9K3vFGZ5K8c0EPQVobNL6oxy S2Wfx6G7lIJ8YNCoRDVJUjzVmoaE5WDLFmRZyW/b0g/rzgbNOJtDb7kC9kAezA7acYFp g8HQ== X-Gm-Message-State: AOJu0YxjE9bdGU+h3MNM2a4D94gfu3v1XNUFevQW2JbVzC1g1mFTSasL wb8rzKwSa9iPy3FcLxm14qD/8HbIC3nZqxSOMNp+apf7eVdR1Y2E4lKSXjbmI2v3axIdrvpMxH7 z0JcbP2JJJkHRzTf1uRIZV/n87H1TsMzmmbBQTQOIxmxgC8EIQBp24nZ5yy25ZYz/XKllDkoYkm IOQXUTtYOOSW1viWhMHnxYyslLi1unk4QpQa1q X-Received: by 2002:a50:aa95:0:b0:57d:261d:f825 with SMTP id 4fb4d7f45d1cf-57d4bd810eamr11807539a12.21.1719595786828; Fri, 28 Jun 2024 10:29:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHU+pO4WRf9yg1zMKBCF6oQKVJZCoHK2oAWSK/fdJutSGwTayxVEMLrUzc+zZYTNtdeu3u/Cw== X-Received: by 2002:a50:aa95:0:b0:57d:261d:f825 with SMTP id 4fb4d7f45d1cf-57d4bd810eamr11807530a12.21.1719595786427; Fri, 28 Jun 2024 10:29:46 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5861324f069sm1305473a12.33.2024.06.28.10.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:45 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 21/23] target/i386: SEV: store pointer to decoded id_auth in SevSnpGuest Date: Fri, 28 Jun 2024 19:28:53 +0200 Message-ID: <20240628172855.1147598-22-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org Do not rely on finish->id_auth_uaddr, so that there are no casts from pointer to uint64_t. They break on 32-bit hosts. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index a6b063b762c..28d6bd3adfa 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -155,6 +155,7 @@ struct SevSnpGuestState { char *id_block_base64; uint8_t *id_block; char *id_auth_base64; + uint8_t *id_auth; char *host_data; struct kvm_sev_snp_launch_start kvm_start_conf; @@ -2208,16 +2209,16 @@ sev_snp_guest_set_id_auth(Object *obj, const char *value, Error **errp) struct kvm_sev_snp_launch_finish *finish = &sev_snp_guest->kvm_finish_conf; gsize len; + finish->id_auth_uaddr = 0; + g_free(sev_snp_guest->id_auth); g_free(sev_snp_guest->id_auth_base64); - g_free((guchar *)finish->id_auth_uaddr); /* store the base64 str so we don't need to re-encode in getter */ sev_snp_guest->id_auth_base64 = g_strdup(value); + sev_snp_guest->id_auth = + qbase64_decode(sev_snp_guest->id_auth_base64, -1, &len, errp); - finish->id_auth_uaddr = - (uint64_t)qbase64_decode(sev_snp_guest->id_auth_base64, -1, &len, errp); - - if (!finish->id_auth_uaddr) { + if (!sev_snp_guest->id_auth) { return; } @@ -2226,6 +2227,8 @@ sev_snp_guest_set_id_auth(Object *obj, const char *value, Error **errp) len, KVM_SEV_SNP_ID_AUTH_SIZE); return; } + + finish->id_auth_uaddr = (uintptr_t)sev_snp_guest->id_auth; } static bool From patchwork Fri Jun 28 17:28:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954090 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=K0hAojPv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jFH2Tp9z20Xf for ; Sat, 29 Jun 2024 03:32:51 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFQ5-0006Av-AP; Fri, 28 Jun 2024 13:29:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFQ3-000629-6S for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFQ1-0002GY-Fh for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:29:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A2XgIgI4I4VJi3eTDPeYIQcPPk61UBK6QowRUBwCEHE=; b=K0hAojPvZ3dgP/ZkKiaRa+QImaw0ARb5IEI2x/y5FOW+3d4R7rbzJQ1d/5ZBYgHghhu6N+ RXWVRuE2BGgW7MW0eiBS/EG1eTiL/88R5SYcc1faEQeD64zQhvfpiCWM7QXcXigixcgvxF OcQBz9PhksUYCkEeHanGAl8htEEpMm0= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-481-gOyNK0_OPLW5HUBDlLNHcQ-1; Fri, 28 Jun 2024 13:29:50 -0400 X-MC-Unique: gOyNK0_OPLW5HUBDlLNHcQ-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a706f30724eso55835966b.1 for ; Fri, 28 Jun 2024 10:29:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595789; x=1720200589; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A2XgIgI4I4VJi3eTDPeYIQcPPk61UBK6QowRUBwCEHE=; b=r6vvOW2YxTj/Iyw+Eoq8r6JyPNbad1axW9GpxK8PTX6FLMKjvIAALKZpQmlUL+rG9W Jp42Tz91vev4I2uMtpLxocvCkHRhR64FWSpL61KYsYb3kj+NRGZL5lszY+tyELnuyZvP bS+8V+DaxNdTiL5YL18xUa6kbRGTT/pb7d77IBFULjDpo8cUNWWwyk3T+YqA218pU00/ stHdsudHFNr42d9UdIuv6Ta4U6rpTzMQ+Li+GMecG+GBduPz0a88gzDirAjeSBimhkNL nUlRMih8pP0BsTAXukfftsHtkV/ecjL4gSynTXlRpl6jsvFei9p/sDrZi3BU4Rhi3j/f DvaA== X-Gm-Message-State: AOJu0YxUbUW+fiBERmE1AO9+cipcUnh8QdFvoqtPHnrA2SvJO/eNdP+q YyAXssRBcTm+XVnG5+h4kHJEuLIOoRRtUfPx9GUcDqUf45EYR3EP4GabWpFMvkvyMCdXMULOLjE XibS6cdOkDg75DFEdfED4MG8/+VLp0qplzhjNQDumgXqXo1st3NtG+fwsTaLya6LMps6fWMPNlJ GfGCaTrqMkDbPspsftnkwt4VY1xMHGUvdXo3tn X-Received: by 2002:a17:907:d047:b0:a72:76c8:ef68 with SMTP id a640c23a62f3a-a7276c8effamr793983566b.69.1719595789331; Fri, 28 Jun 2024 10:29:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF5AvOQ3mB8J9KBEOwST0l511Y0M3LUJ1fZY5khi/OOQgFQn7mIUl7JVK+5z8BmpJQW0Wc7jg== X-Received: by 2002:a17:907:d047:b0:a72:76c8:ef68 with SMTP id a640c23a62f3a-a7276c8effamr793982166b.69.1719595788994; Fri, 28 Jun 2024 10:29:48 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab0651a8sm95235466b.128.2024.06.28.10.29.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:47 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Subject: [PULL 22/23] target/i386/sev: Use size_t for object sizes Date: Fri, 28 Jun 2024 19:28:54 +0200 Message-ID: <20240628172855.1147598-23-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Richard Henderson This code was using both uint32_t and uint64_t for len. Consistently use size_t instead. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Link: https://lore.kernel.org/r/20240626194950.1725800-3-richard.henderson@linaro.org Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 16 ++++++++-------- target/i386/trace-events | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 28d6bd3adfa..0ffdf8952c3 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -121,7 +121,7 @@ struct SevCommonStateClass { Error **errp); int (*launch_start)(SevCommonState *sev_common); void (*launch_finish)(SevCommonState *sev_common); - int (*launch_update_data)(SevCommonState *sev_common, hwaddr gpa, uint8_t *ptr, uint64_t len); + int (*launch_update_data)(SevCommonState *sev_common, hwaddr gpa, uint8_t *ptr, size_t len); int (*kvm_init)(ConfidentialGuestSupport *cgs, Error **errp); }; @@ -173,7 +173,7 @@ typedef struct SevLaunchUpdateData { QTAILQ_ENTRY(SevLaunchUpdateData) next; hwaddr gpa; void *hva; - uint64_t len; + size_t len; int type; } SevLaunchUpdateData; @@ -886,7 +886,7 @@ sev_snp_launch_update(SevSnpGuestState *sev_snp_guest, if (!data->hva || !data->len) { error_report("SNP_LAUNCH_UPDATE called with invalid address" - "/ length: %p / %lx", + "/ length: %p / %zx", data->hva, data->len); return 1; } @@ -945,7 +945,8 @@ out: } static int -sev_launch_update_data(SevCommonState *sev_common, hwaddr gpa, uint8_t *addr, uint64_t len) +sev_launch_update_data(SevCommonState *sev_common, hwaddr gpa, + uint8_t *addr, size_t len) { int ret, fw_error; struct kvm_sev_launch_update_data update; @@ -1090,8 +1091,7 @@ sev_launch_finish(SevCommonState *sev_common) } static int -snp_launch_update_data(uint64_t gpa, void *hva, - uint32_t len, int type) +snp_launch_update_data(uint64_t gpa, void *hva, size_t len, int type) { SevLaunchUpdateData *data; @@ -1108,7 +1108,7 @@ snp_launch_update_data(uint64_t gpa, void *hva, static int sev_snp_launch_update_data(SevCommonState *sev_common, hwaddr gpa, - uint8_t *ptr, uint64_t len) + uint8_t *ptr, size_t len) { int ret = snp_launch_update_data(gpa, ptr, len, KVM_SEV_SNP_PAGE_TYPE_NORMAL); @@ -1165,7 +1165,7 @@ sev_snp_cpuid_info_fill(SnpCpuidInfo *snp_cpuid_info, } static int -snp_launch_update_cpuid(uint32_t cpuid_addr, void *hva, uint32_t cpuid_len) +snp_launch_update_cpuid(uint32_t cpuid_addr, void *hva, size_t cpuid_len) { KvmCpuidInfo kvm_cpuid_info = {0}; SnpCpuidInfo snp_cpuid_info; diff --git a/target/i386/trace-events b/target/i386/trace-events index 06b44ead2e2..51301673f0c 100644 --- a/target/i386/trace-events +++ b/target/i386/trace-events @@ -6,7 +6,7 @@ kvm_memcrypt_register_region(void *addr, size_t len) "addr %p len 0x%zx" kvm_memcrypt_unregister_region(void *addr, size_t len) "addr %p len 0x%zx" kvm_sev_change_state(const char *old, const char *new) "%s -> %s" kvm_sev_launch_start(int policy, void *session, void *pdh) "policy 0x%x session %p pdh %p" -kvm_sev_launch_update_data(void *addr, uint64_t len) "addr %p len 0x%" PRIx64 +kvm_sev_launch_update_data(void *addr, size_t len) "addr %p len 0x%zx" kvm_sev_launch_measurement(const char *value) "data %s" kvm_sev_launch_finish(void) "" kvm_sev_launch_secret(uint64_t hpa, uint64_t hva, uint64_t secret, int len) "hpa 0x%" PRIx64 " hva 0x%" PRIx64 " data 0x%" PRIx64 " len %d" From patchwork Fri Jun 28 17:28:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1954079 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=i2WAKshH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9jBW4wXpz20Xf for ; Sat, 29 Jun 2024 03:30:27 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNFQA-0006OL-Px; Fri, 28 Jun 2024 13:30:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFQ9-0006MD-2l for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:30:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNFQ3-0002Gl-Lq for qemu-devel@nongnu.org; Fri, 28 Jun 2024 13:30:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719595795; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qo4iq+TZlgWKFhoxHuIKDhYlvc+TuqqUn66pvomGcWk=; b=i2WAKshHKQAiNKUkLPdy55mv7LKHQ42XEcZD/yjIRJChCwYt5KZMlhOlU5NNHRNozasiTA qvSYp84fQ7CaYM2rS0dBJGoG/Ns3Oru3T6Xj4sJXWEJ1YuNSAKJKH9ADNpjem7KZL7X1i/ KbZG8+wtanchovDiarx8dneq6q8bILM= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-82-LqKosx9PPFyq0fkDn0gGkw-1; Fri, 28 Jun 2024 13:29:53 -0400 X-MC-Unique: LqKosx9PPFyq0fkDn0gGkw-1 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-57a524f1f7eso587748a12.2 for ; Fri, 28 Jun 2024 10:29:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719595792; x=1720200592; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qo4iq+TZlgWKFhoxHuIKDhYlvc+TuqqUn66pvomGcWk=; b=psCeIX7L67zCo6lqG56x4hSehpDNVLm7BYfjDhUT1rjHCPftK4NZcUMKIeELl9A+ZM af07viAZUGgpBrhlxv1ha4GmHNKHZUoJjBDUSzO8M4Kvo0DYFVaH0oiuoaEhBdsVoeNO DR6ieT7NK+jMSVRcA4sfNZb0ysnm2hidbQisZUFPjz1TeVQq+ZiVefSl5Y79xllpxwLt gGgATVX2roo6iKoy552SgMwAOkQnV7VCt0bbZ4Fj3qNZ6FV80ml3B8wC6/wgoB/p1h4J aFPqJjWhEWy3aSuo9r2OxrUtx5AKJdWKOY700xQV/AXQ+jX9N66AIXEbuV/18BAMDs7J U6lQ== X-Gm-Message-State: AOJu0YzZiZi3YCi5+HAhRwi8sQ15KhyPbMmz2MxSLGBNaQ2uzFYe/Y96 9Sf4pkm/D6D8rlG5xI3gP+4klp6XHdajJ5hrDpyUU8BitVKQCkAi/qWf+p9ut62HlrCTD7cF5XO znY1DIAJ53bgPw6N7h7tNgpomcLf6W8t0K8+/O3xtZqY1+Zmxd67SYVLD/yn6H2QqBKqCrpSTE6 4DPjj24Zj0CQsLsqRhir+OZzf+omBvDKTEnbTE X-Received: by 2002:a05:6402:358c:b0:587:2e28:deb6 with SMTP id 4fb4d7f45d1cf-5872e28e17fmr279896a12.41.1719595791705; Fri, 28 Jun 2024 10:29:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENIIbfMiXwLufWcsM3nBI5wJswICyLXb0ZJtVHbOnv1GDCYh7+e+7ZP/GWB26agnJBCAILAw== X-Received: by 2002:a05:6402:358c:b0:587:2e28:deb6 with SMTP id 4fb4d7f45d1cf-5872e28e17fmr279880a12.41.1719595791302; Fri, 28 Jun 2024 10:29:51 -0700 (PDT) Received: from avogadro.local ([151.62.196.71]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5861324f069sm1305553a12.33.2024.06.28.10.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:29:50 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Subject: [PULL 23/23] target/i386/sev: Fix printf formats Date: Fri, 28 Jun 2024 19:28:55 +0200 Message-ID: <20240628172855.1147598-24-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628172855.1147598-1-pbonzini@redhat.com> References: <20240628172855.1147598-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Richard Henderson hwaddr uses HWADDR_PRIx, sizeof yields size_t so uses %zu, and gsize uses G_GSIZE_FORMAT. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Link: https://lore.kernel.org/r/20240626194950.1725800-4-richard.henderson@linaro.org Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 0ffdf8952c3..3ab8b3c28b7 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -934,8 +934,9 @@ sev_snp_launch_update(SevSnpGuestState *sev_snp_guest, out: if (!ret && update.gfn_start << TARGET_PAGE_BITS != data->gpa + data->len) { - error_report("SEV-SNP: expected update of GPA range %lx-%lx," - "got GPA range %lx-%llx", + error_report("SEV-SNP: expected update of GPA range %" + HWADDR_PRIx "-%" HWADDR_PRIx "," + "got GPA range %" HWADDR_PRIx "-%llx", data->gpa, data->gpa + data->len, data->gpa, update.gfn_start << TARGET_PAGE_BITS); ret = -EIO; @@ -2148,7 +2149,8 @@ sev_snp_guest_set_guest_visible_workarounds(Object *obj, const char *value, } if (len != sizeof(start->gosvw)) { - error_setg(errp, "parameter length of %lu exceeds max of %lu", + error_setg(errp, "parameter length of %" G_GSIZE_FORMAT + " exceeds max of %zu", len, sizeof(start->gosvw)); return; } @@ -2185,7 +2187,8 @@ sev_snp_guest_set_id_block(Object *obj, const char *value, Error **errp) } if (len != KVM_SEV_SNP_ID_BLOCK_SIZE) { - error_setg(errp, "parameter length of %lu not equal to %u", + error_setg(errp, "parameter length of %" G_GSIZE_FORMAT + " not equal to %u", len, KVM_SEV_SNP_ID_BLOCK_SIZE); return; } @@ -2223,7 +2226,8 @@ sev_snp_guest_set_id_auth(Object *obj, const char *value, Error **errp) } if (len > KVM_SEV_SNP_ID_AUTH_SIZE) { - error_setg(errp, "parameter length:ID_AUTH %lu exceeds max of %u", + error_setg(errp, "parameter length:ID_AUTH %" G_GSIZE_FORMAT + " exceeds max of %u", len, KVM_SEV_SNP_ID_AUTH_SIZE); return; } @@ -2291,7 +2295,8 @@ sev_snp_guest_set_host_data(Object *obj, const char *value, Error **errp) } if (len != sizeof(finish->host_data)) { - error_setg(errp, "parameter length of %lu not equal to %lu", + error_setg(errp, "parameter length of %" G_GSIZE_FORMAT + " not equal to %zu", len, sizeof(finish->host_data)); return; }