From nobody Sat Jan 31 19:05:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1769506945; cv=none; d=zohomail.com; s=zohoarc; b=d/dVXybApnFzQnodqZ08Qyute2KgPp//Z2duNhNwzYAQ5PVjAEzpJcTK0deKW9V9N0zRAompCanDDoT26St22kYbVU3o1kTPLfNZWk+BUb94vGQ3oKY5r1HoYbQuO/sv7cUZPcugZV25ubB3QF10uNe1J704h8+huQCD5fobBdM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769506945; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SMUlDVYnp9svL9cIfpMxQ3sjwT9bmDWj45k7ba5H9xU=; b=ZlarDRock1VV1PvDj3UfhAXUcgxNK/P4QMaWtdtU06ZyDhbUcqeJnhtA1fjwqZqIqzgGjAaPWTn2zBemThlgfu5WUws2s+6GNH90Yi+7Fk6oPSx3LRIi/2BQlMXc3RKAU1J9Mit08c+1DBlYdfLKssAU0MtPuw89nWbsSb8Shqc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769506945637863.7860206420585; Tue, 27 Jan 2026 01:42:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkfXv-0000ld-Dk; Tue, 27 Jan 2026 04:39:39 -0500 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 1vkfXb-0000dA-Af for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:21 -0500 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 1vkfXX-0008T8-7e for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:17 -0500 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-658-SsCw4JVgOqWa82DqY8wsDQ-1; Tue, 27 Jan 2026 04:39:12 -0500 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4802bb29400so95603775e9.0 for ; Tue, 27 Jan 2026 01:39:12 -0800 (PST) Received: from [192.168.10.48] ([151.61.26.160]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435b1c24a8asm36538404f8f.12.2026.01.27.01.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 01:39:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769506754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SMUlDVYnp9svL9cIfpMxQ3sjwT9bmDWj45k7ba5H9xU=; b=ApapxwDW/d77qDdS0OrzKg2kQFCPV5+nO/mKMkBNYObTJiHJhQPm6vYgFmByMZkOq0dBI0 TeAXZIYJKbnchAQNUesKps/g1De3KAf86zddhg3qtMjbn3inFvRnKaKF4oTCwBpsCwPl1A k0qTksvcemliybZGTnhT9GdrsY1TdPY= X-MC-Unique: SsCw4JVgOqWa82DqY8wsDQ-1 X-Mimecast-MFC-AGG-ID: SsCw4JVgOqWa82DqY8wsDQ_1769506751 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769506750; x=1770111550; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SMUlDVYnp9svL9cIfpMxQ3sjwT9bmDWj45k7ba5H9xU=; b=onddjT2WAFMc/PSZaLi73rvbyAYC4mea4IHtt0L0ScfRDF33JddfWXvC2G5ybn3QtW DkAbfkt6Z2ZFsjY6Ym7aBxVD/QaiqVF5+Ipo3uZ9/XYUXiarRanWIgMm0R41suzB8s+g UOb6Btw0phFhhphwiCXipMbVuGl9Omt1GQqV2OucokJyNBX6wMFTCs1LHttuevjMu8Ep J980XVIYiibZ/Q8P/Cm06FFS6EQnXZ62wrDhq+ZqXfii2aG/beLDL9ppVuMgbY/eVZm0 5LkD8GDRXp7S1s33eS4H7RwYfLxYTSqjGyDcXZNJ3Lc5ic/KYDgT1crr5o31jAIg9rOB htYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769506750; x=1770111550; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=SMUlDVYnp9svL9cIfpMxQ3sjwT9bmDWj45k7ba5H9xU=; b=YdZGMK2Gjb0Ta+56+NSpOc1tu8NT69g+LEwKKGwOYBE0GgJC0ERbss4LKtvuS2kkPM UyGTpjSWPuxPTGA2qoVEhoqadNpqOI9t6a+HgWWLjfu9Duo53H9VY+dlLwqR0JNcVdtM 2Xs5xPC73m/s4FpYisNSwaFRmEMeud9zwGZC4fL4QoDk90vEMb/MVMe90ALc+sV2gVZZ +nmEW881E4ryopGQ6ZgJw0mNEKIoagyHkJKOrfF3TrFKaZukJVTCBoxiZrP0rkJmqD7o B/7mZXEkyN6uuTQ9xQro+NykUNPEGzNr3GJT5VvtwDkwhyRahAlcNWr1i0odF9WvN40l K5ig== X-Gm-Message-State: AOJu0YycvBS7hEDa0ToLf0txmcMp0DUp4TW4QsYFn32zyrN316pPNQjP BHVqrz5A5BXmIj25aEGEDABHtgdMoNnE2XHiu86BwZuvtJK5povM0A2sQuETVaVb0l0ixX+ZQqK co2QJYKlaKrxvGJKwpDh0JPYPV/ZG5jr6aBJLNWVtQyDQFF4LW2D8953XxoMbqF97ct1FQGff9y CqvDrpI7FyqLvxXlyIHvyQ/R/iDbUZGmw2y/VkP3gR X-Gm-Gg: AZuq6aJ94yslwkIuMb7z9QadmNhkW5f72lPEbnmM0/HCIz9Ul0fqtK9Lr1aFSZdTqql 9yA+6X7ZUQYaqT9LUpGGuBdqdXvSXHkLuJ6RITEvOZ+0yQSvFfD4liBolrpY9U6+FosPrknmRna bwlfBwT0wOXC9XdjuFxiNvdv3KcUPdTiH94WaAhUEw9pgHd5gceFxJU0tkvrqTQVAmjwZpWHg2c gE8ujfxfP8zsfMlkRs5pcM0UUmFy8zUF3y95ZZ2062gv3FkeNNdYo3hf2KV2KKgkIBQ8+DU9lYe ckkniw+bf93G5YM2uI10GAk3iLlWPWcwy4a1EckCa13KKL1LDnCXwkd44bU8wEwjkRb7TvZkdAK ymWLQQqmsgkFiKdcSnWtMFnTMJFA1JpeWoYORTozP4IWadrrzC1vWQzR7/9V3FfutRW4BTXIk57 paSN1N7lK95cOM0g== X-Received: by 2002:a05:6000:428a:b0:435:91b6:f53 with SMTP id ffacd0b85a97d-435dd02450fmr1411006f8f.8.1769506750268; Tue, 27 Jan 2026 01:39:10 -0800 (PST) X-Received: by 2002:a05:6000:428a:b0:435:91b6:f53 with SMTP id ffacd0b85a97d-435dd02450fmr1410966f8f.8.1769506749828; Tue, 27 Jan 2026 01:39:09 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Thomas Huth Subject: [PULL 01/13] rust: trace: libc does not have syslog on windows Date: Tue, 27 Jan 2026 10:38:54 +0100 Message-ID: <20260127093906.353741-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127093906.353741-1-pbonzini@redhat.com> References: <20260127093906.353741-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1769506947127158500 Content-Type: text/plain; charset="utf-8" Reported-by: Thomas Huth Signed-off-by: Paolo Bonzini --- rust/trace/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/trace/src/lib.rs b/rust/trace/src/lib.rs index c2abe430a52..859d8d1b94f 100644 --- a/rust/trace/src/lib.rs +++ b/rust/trace/src/lib.rs @@ -3,6 +3,7 @@ //! This crate provides macros that aid in using QEMU's tracepoint //! functionality. =20 +#[cfg(not(windows))] #[doc(hidden)] /// Re-exported item to avoid adding libc as a dependency everywhere. pub use libc::{syslog, LOG_INFO}; --=20 2.52.0 From nobody Sat Jan 31 19:05:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1769506787; cv=none; d=zohomail.com; s=zohoarc; b=a1vl06873gbCTvH3wHbP1LqCUjejyiR+yNLrwg0i6m2sHdAxk/sd8BnpT8k1mzhsx6JJWZRiuO6IddleEMoz8/ApbARoiqucvOtiJ0svKE/Ts3w/mXL+QXx2Zfaeu1MVu2gIjqlfULjmVYsmehee0upTwawDZBibsJZPwbnUSd8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769506787; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=2dW/5Ry7VsalF+kGUVbKtXXaiT0xUof2cogeafgTzgI=; b=FULUHft1Puiwo+wSbAnah5OBbZxeLQgv2cmnyNpXEsf00aLcSJ+nzON/ODgM6Fd+bq3d9+x6mnPJctlHaL/iDEzM+eNWcpry6P9Q86gayLtrR+CqIgFZA64DOmWSrQaqDzSCsfSGugkSNGEDzuVFh9LM+5xn2n85fG9/5PAG95E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769506787463461.57363113854046; Tue, 27 Jan 2026 01:39:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkfXo-0000gZ-80; Tue, 27 Jan 2026 04:39:37 -0500 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 1vkfXe-0000da-Nn for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:24 -0500 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 1vkfXZ-0008TK-7c for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:19 -0500 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-610-BofAUUZANP-ozhUmoRJYCg-1; Tue, 27 Jan 2026 04:39:14 -0500 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-435a6c0c794so4207378f8f.2 for ; Tue, 27 Jan 2026 01:39:14 -0800 (PST) Received: from [192.168.10.48] ([151.61.26.160]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435b1f745c5sm37882735f8f.32.2026.01.27.01.39.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 01:39:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769506756; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2dW/5Ry7VsalF+kGUVbKtXXaiT0xUof2cogeafgTzgI=; b=EfRpem0mhp14LDXuOJq3Ryvr47EJAFwC3OQewHf2XFhF/72eiVR7P7gARRZQdDPdB/Bx5b vbDbWfZOarp4Cvd25e6ShFaM2JJXPhFyOypNl+7FQzrqoAiPOxR+6jPMKnBPyyIWDBuChp 75t4PzoUkBptqKyIKUMFa0Gk2ec9UlA= X-MC-Unique: BofAUUZANP-ozhUmoRJYCg-1 X-Mimecast-MFC-AGG-ID: BofAUUZANP-ozhUmoRJYCg_1769506753 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769506752; x=1770111552; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=2dW/5Ry7VsalF+kGUVbKtXXaiT0xUof2cogeafgTzgI=; b=eD25XXbg6ktGIUKZsYfjvvSv2RAiK60dPR9HotytetkTHkhMDFfxFzR2u6skBLrWTv +CLLBKGzzCkniDPwe4KH5Wdm8KlgbC11CDg+tYj/JaM0rjOdtnqhBdzQ44aAaRu8+6tn 2jFCxMcmVMXud8guKShVYwefxcZDVY21wfmScqhMdNCqB6mjKcPyeXXtNWcGHtQbRiw1 QzsX4SXTJSwByMHncBI8xpI+Q7XD4RkPnHYZRsqjJFsvNtc5En0uddLCmqymUZsv5Emr 8qZFHZT+A3w0Rqozzln1WBpwDZIiawOmHWQwDd5DkgXGfRgj5fWogELbimkEcFA2BL+N Nv3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769506752; x=1770111552; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=2dW/5Ry7VsalF+kGUVbKtXXaiT0xUof2cogeafgTzgI=; b=orXL2thWnZunZLIGlZlytiStsTMGcYO/3pF1gJA2a6PTOeXJLz6v1oDjeLtB8Q7uzQ AujPdZ+1uQO5cqfe/DDL4twqgI42cMqWc1qeMA7rsP/howB1tLzUBHaZRIwFnyV2myjV He+xLZDGua6H7BFQPV4pRM/n0TcUIDqlVNo/x6Nvw89ahD+53hZm+rLrtmxdGlEw0Mp6 RVwPTlOTCBWWjd0JHzxbXbQoCT5CTejvsl+6wO9wmWlNzN6j2r39aS2qaklSuYW/wQMK gL6e7TfBH9nLAMdvAU6K4Jpk47WCdDIzh4vNl1lga6bK3Fa4I0nkzS+bxW2VJ9a5vBzS IabQ== X-Gm-Message-State: AOJu0YzRLUjoNb5No6zL0LcarEBUVoZ4cefM630gFmiSHBp/TDJM3Xsx vgCVqSPPYnODTmHWeggsS2XgWr39TYajZQ022fTbknWrgJNpvXAspu8sY88HZ06xFbI9ae5KG1o JmaorE3UyGkrhEQzn3xGggENXq4vo7cAAlcfk5PgnRakD6dCww02MH380mrJztbI6BMGqMizvIy zfo/BFEKR2WhpEwz9C3aI7a6PZFmuKwWo+bkIScbDV X-Gm-Gg: AZuq6aKkVG3C0MrwdkQ76gu+X+2mfaJzpeUUqtQQ5AiGST9Ryj5sJbw/l/bcrL2iXOe XRVbeKBB5n7W2jAFaQoXGVCceR3WJmtLUvcgcFlAXJIHDLqYbw0F655Hna0rVxZVwkuFL4TdpVn 9pJk6M4F8Fmb4LxyUm8KHbZSQQX1QgyAHzlNjzpHh7J03J3bO2SrWOIQyrtL1ogS3pOTNifNfH9 0LFgi9aXmQ4Arpl8DC15cmtTaz7dTCPHyUeGY6bBryD4KNNkViDamPBjavGr2k7e4SbMYp+Jko4 KNzrJAwNwp30TIH+/kIbcYlntLHOASvvAf5WUc3tQ5P8U2nj0Gaghi90wn2QnUFKdhtqadyGzy3 +xEWYRBYqN3+qxP/fwEUA3fU2cmiD8syOToi+jaXhwO0S5NCGnFb4kiTtPf5Q8gBB/3RaoIQlij 9cYA40Sr+pQwuQUg== X-Received: by 2002:a05:600c:458a:b0:477:5b0a:e616 with SMTP id 5b1f17b1804b1-48069c16459mr12488015e9.5.1769506752550; Tue, 27 Jan 2026 01:39:12 -0800 (PST) X-Received: by 2002:a05:600c:458a:b0:477:5b0a:e616 with SMTP id 5b1f17b1804b1-48069c16459mr12487795e9.5.1769506752079; Tue, 27 Jan 2026 01:39:12 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 02/13] rust: hwcore: add chardev symbols to integration tests Date: Tue, 27 Jan 2026 10:38:55 +0100 Message-ID: <20260127093906.353741-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127093906.353741-1-pbonzini@redhat.com> References: <20260127093906.353741-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1769506788753154100 Content-Type: text/plain; charset="utf-8" Even though they are not used, rustc does not elide its symbols on msys2. This causes a linker error. Signed-off-by: Paolo Bonzini --- rust/hw/core/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/hw/core/meson.build b/rust/hw/core/meson.build index fa1765a2302..942ee9cdacf 100644 --- a/rust/hw/core/meson.build +++ b/rust/hw/core/meson.build @@ -73,7 +73,7 @@ test('rust-hwcore-rs-integration', override_options: ['rust_std=3D2021', 'build.rust_std=3D2021'], rust_args: ['--test'], install: false, - dependencies: [common_rs, hwcore_rs, bql_rs, migration_rs, util_rs= ]), + dependencies: [chardev_rs, common_rs, hwcore_rs, bql_rs, migration= _rs, util_rs]), args: [ '--test', '--test-threads', '1', '--format', 'pretty', --=20 2.52.0 From nobody Sat Jan 31 19:05:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1769506806; cv=none; d=zohomail.com; s=zohoarc; b=FhjgYHmAZuIFl2msb2YIOoPTTWSKn93kVz9LpAsMFL1dHSRaN/Yf7kC4H0+6B1mbKFobSHEFsGEd5exnuTd3hVLu8B0Df3eryA48mh3roBAyEZiqtk0kP9FT/WaD9/Og2tL29agjwmRXhAksSp7HJ+EDVxt7IwXExkEgB1+dfO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769506806; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=rrMf5KEy7l8I9I0C7YHruq+Mnzy9WjT6abXoIiW6jCg=; b=LHKcrgjmMhgwhgOrgmo1PrUJsDFBmgdWwda0601fLyyR7ptPx5ibwUWADniOdgU5yY/qWSLQXPUMBhfn0H1oKZlVaLl5q2px7Mbg2GUV/0vkSb0vCSO4ZAa8qfslmkn0p164iGyUGypFwIcy7lp/QDd84deLq9qhS0i8GIjnHe0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769506806834223.2680910698922; Tue, 27 Jan 2026 01:40:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkfXt-0000hE-HN; Tue, 27 Jan 2026 04:39:38 -0500 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 1vkfXg-0000e6-T2 for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:26 -0500 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 1vkfXd-0008Tf-Cd for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:24 -0500 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-316-uFOKjRx2OVCwwyJMnTB1Ig-1; Tue, 27 Jan 2026 04:39:16 -0500 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-43591aacca2so4204224f8f.1 for ; Tue, 27 Jan 2026 01:39:16 -0800 (PST) Received: from [192.168.10.48] ([151.61.26.160]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435b1c24f15sm37780880f8f.18.2026.01.27.01.39.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 01:39:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769506759; 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=rrMf5KEy7l8I9I0C7YHruq+Mnzy9WjT6abXoIiW6jCg=; b=Y97OAiHHY4ReZQJV735dNwVt4i6MRg8CULUEpGwdkQC6xrtjjA+0g39CVftVYAEZ1VBtoA ymJIB4Pf3kAH453hpB/vBIt2h+tLidhlWvi3mhyX2hzNfI0HLovybLPnA4ltBuhGPWId1u LHBRDySTpCOPY2pvSqh5WPYcH1qalgo= X-MC-Unique: uFOKjRx2OVCwwyJMnTB1Ig-1 X-Mimecast-MFC-AGG-ID: uFOKjRx2OVCwwyJMnTB1Ig_1769506755 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769506755; x=1770111555; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=rrMf5KEy7l8I9I0C7YHruq+Mnzy9WjT6abXoIiW6jCg=; b=eYZ8ImyvUUMZn952pdn5CnKlmBifaSx1/4EV7dm0baVZ478XsIwOO6Qsdysd0X8Lyv atqPGGbyV7hu0jm3bJ7PhH2edc4nw1U5KaV/HQyO8Sd61E81ApS4kdirUTkqYmxWQc3c 2KRKEhq76To5OCJjO+pt8HV2VCRIJI9xgjm6p9HG3m1QEajlamcre9EoYVrxTqpTsgvx U5Nflt6U0+zpf7l+45N8hrihnXnGLDPgCHrAprTULbHTkEMp6RbIQJjbi5+i09FNLll4 7rEjH6Pi+BPqD9MnhKLPwMnbPk6Ramy/uHZ+nt/x8y/KM6aRBdw9rRHjZ5qd/xeM6kuo /oLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769506755; x=1770111555; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=rrMf5KEy7l8I9I0C7YHruq+Mnzy9WjT6abXoIiW6jCg=; b=TgRN4euFY7dkATlZJRQxcRBJbpDJ5903Eq8jlVz+DTaQ9dOSXi1BFzOh9jJyHVBmOX 1lN1pvDPIGP3NeYo20lB8DuaJJLAkAc2cqvoRcPap4CGehNTFs8kqU115pKjuDR73Hp8 UlvNVVOvwpWGjE/nw9rKWf99gbXYnt5VBfRi5b4ZDzIizFIu7yl4/mGJKIrVtrE5yHWz Wnb24jz1+D1Ytt0eVHQbzTkpZQyKiY+isZXcZX6MTy2YpOSUgjn3VCSeMPzDlHvngTax qUozyUuEzvTsk5wI9bGwL12Lx1D43cVb2Oswrw43hKE/gUQNSMQ874ocKfyM+S7rIaf+ 3CdQ== X-Gm-Message-State: AOJu0YzyIwHSj9XL4VudUo9Qq4E0k/M7+kHCvX69mNqJzNriUmJpGmnI cYv3YrxesrCaAc7tNEu9FQluxxO7bW348OlS0wChVv2nCaHxQrtPuq/I6kT8X6QX/UzmsclW4rE NFNx8tZyLK86MKhsprjxKEo2XJLkKl4/ii83E9QliXlmmTnD9z4jqMMpJ4bPUdrw4VarfM2N6/L ySXk2xGlFTemfD8ffYbeKdgPOezoNg9hcNHfmPCkKH X-Gm-Gg: AZuq6aLUzNVYPeXMWPkWcOGazcgSbB1GKtVxU2j57X23P5Cop3xRAmO4V44V9hTAara l2Lyk34TkhQS5lsOoJ+KKSXC+wmE7pPYsihyXGQq5ScwRShUkjmyyChtIJfC0A150hsyDcOMncK qZAIqPVTMY+2v6joe6EggnxGKieNyVo+SXOtfzTlyw9FEpJun7XSm47cxcNTcWEYC6wT4NgNRYN axL7Xq7U3fyKwUo6T+kgOChuAKH6KKsKcoStA/yeaCI+jj4FFDdL2Q/lzwkQflg7CCl06cKdmzt OkUCeQS/RJaRJsjFI2GvcXcYy9lOg5QYIecBCbkL7TBTZxpiKOn2BxTAEiKN/FqKBwhnIeZbIYw dCZJnEMot10z1UK1eQAsagl1zokhAR9lP4s0cnk+Z39Kiwcq2lve9I4yxiW63d9Dym/8C9UbYjg yysc+pKtjHEcILBw== X-Received: by 2002:a05:6000:1786:b0:430:f68f:ee97 with SMTP id ffacd0b85a97d-435dd1c1d82mr1700959f8f.40.1769506754581; Tue, 27 Jan 2026 01:39:14 -0800 (PST) X-Received: by 2002:a05:6000:1786:b0:430:f68f:ee97 with SMTP id ffacd0b85a97d-435dd1c1d82mr1700900f8f.40.1769506753973; Tue, 27 Jan 2026 01:39:13 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 03/13] rust: move class_init to an extension trait Date: Tue, 27 Jan 2026 10:38:56 +0100 Message-ID: <20260127093906.353741-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127093906.353741-1-pbonzini@redhat.com> References: <20260127093906.353741-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1769506808658158500 Prepare for having ObjectClass, DeviceClass and SysbusDeviceClass defined outside the hwcore and qom crates. It then becomes impossible to add a method to them. Extracted from a patch by Marc-Andr=C3=A9 Lureau. Signed-off-by: Paolo Bonzini --- rust/hw/core/src/prelude.rs | 3 +++ rust/hw/core/src/qdev.rs | 25 +++++++++++++++---------- rust/hw/core/src/sysbus.rs | 10 +++++++--- rust/qom/src/prelude.rs | 1 + rust/qom/src/qom.rs | 8 ++++++-- 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/rust/hw/core/src/prelude.rs b/rust/hw/core/src/prelude.rs index c544c317b39..13f7dfc6809 100644 --- a/rust/hw/core/src/prelude.rs +++ b/rust/hw/core/src/prelude.rs @@ -1,6 +1,8 @@ //! Essential types and traits intended for blanket imports. =20 pub use crate::qdev::Clock; + +pub use crate::qdev::DeviceClassExt; pub use crate::qdev::DeviceState; pub use crate::qdev::DeviceImpl; pub use crate::qdev::DeviceMethods; @@ -8,6 +10,7 @@ pub use crate::qdev::ResetType; =20 pub use crate::sysbus::SysBusDevice; +pub use crate::sysbus::SysBusDeviceClassExt; pub use crate::sysbus::SysBusDeviceImpl; pub use crate::sysbus::SysBusDeviceMethods; =20 diff --git a/rust/hw/core/src/qdev.rs b/rust/hw/core/src/qdev.rs index 87232becbad..f6037fbdcae 100644 --- a/rust/hw/core/src/qdev.rs +++ b/rust/hw/core/src/qdev.rs @@ -15,9 +15,9 @@ use qom::{prelude::*, ObjectClass}; use util::{Error, Result}; =20 -pub use crate::bindings::{ClockEvent, DeviceClass, Property, ResetType}; +pub use crate::bindings::{ClockEvent, ResetType}; use crate::{ - bindings::{self, qdev_init_gpio_in, qdev_init_gpio_out, ResettableClas= s}, + bindings::{self, qdev_init_gpio_in, qdev_init_gpio_out, DeviceClass, P= roperty}, irq::InterruptSource, }; =20 @@ -206,6 +206,9 @@ pub trait DeviceImpl: } } =20 +#[repr(transparent)] +pub struct ResettableClass(bindings::ResettableClass); + unsafe impl InterfaceType for ResettableClass { const TYPE_NAME: &'static CStr =3D unsafe { CStr::from_bytes_with_nul_unchecked(bindings::TYPE_RESETT= ABLE_INTERFACE) }; @@ -214,23 +217,25 @@ unsafe impl InterfaceType for ResettableClass { impl ResettableClass { /// Fill in the virtual methods of `ResettableClass` based on the /// definitions in the `ResettablePhasesImpl` trait. - pub fn class_init(&mut self) { + fn class_init(&mut self) { if ::ENTER.is_some() { - self.phases.enter =3D Some(rust_resettable_enter_fn::); + self.0.phases.enter =3D Some(rust_resettable_enter_fn::); } if ::HOLD.is_some() { - self.phases.hold =3D Some(rust_resettable_hold_fn::); + self.0.phases.hold =3D Some(rust_resettable_hold_fn::); } if ::EXIT.is_some() { - self.phases.exit =3D Some(rust_resettable_exit_fn::); + self.0.phases.exit =3D Some(rust_resettable_exit_fn::); } } } =20 -impl DeviceClass { - /// Fill in the virtual methods of `DeviceClass` based on the definiti= ons in - /// the `DeviceImpl` trait. - pub fn class_init(&mut self) { +pub trait DeviceClassExt { + fn class_init(&mut self); +} + +impl DeviceClassExt for DeviceClass { + fn class_init(&mut self) { if ::REALIZE.is_some() { self.realize =3D Some(rust_realize_fn::); } diff --git a/rust/hw/core/src/sysbus.rs b/rust/hw/core/src/sysbus.rs index 071fccff1e6..81fab3f1910 100644 --- a/rust/hw/core/src/sysbus.rs +++ b/rust/hw/core/src/sysbus.rs @@ -15,7 +15,7 @@ use crate::{ bindings, irq::{IRQState, InterruptSource}, - qdev::{DeviceImpl, DeviceState}, + qdev::{DeviceClassExt, DeviceImpl, DeviceState}, }; =20 /// A safe wrapper around [`bindings::SysBusDevice`]. @@ -37,10 +37,14 @@ unsafe impl ObjectType for SysBusDevice { // TODO: add virtual methods pub trait SysBusDeviceImpl: DeviceImpl + IsA {} =20 -impl SysBusDeviceClass { +pub trait SysBusDeviceClassExt { + fn class_init(&mut self); +} + +impl SysBusDeviceClassExt for SysBusDeviceClass { /// Fill in the virtual methods of `SysBusDeviceClass` based on the /// definitions in the `SysBusDeviceImpl` trait. - pub fn class_init(self: &mut SysBusDeviceClass) { + fn class_init(&mut self) { self.parent_class.class_init::(); } } diff --git a/rust/qom/src/prelude.rs b/rust/qom/src/prelude.rs index 6a1ecaef2a7..1d1177f1e0d 100644 --- a/rust/qom/src/prelude.rs +++ b/rust/qom/src/prelude.rs @@ -4,6 +4,7 @@ pub use crate::qom::IsA; pub use crate::qom::Object; pub use crate::qom::ObjectCast; +pub use crate::qom::ObjectClassExt; pub use crate::qom::ObjectClassMethods; pub use crate::qom::ObjectDeref; pub use crate::qom::ObjectImpl; diff --git a/rust/qom/src/qom.rs b/rust/qom/src/qom.rs index 84455cea79b..cc00ddcfc98 100644 --- a/rust/qom/src/qom.rs +++ b/rust/qom/src/qom.rs @@ -729,10 +729,14 @@ pub trait ObjectImpl: ObjectType + IsA { T::UNPARENT.unwrap()(unsafe { state.as_ref() }); } =20 -impl ObjectClass { +pub trait ObjectClassExt { + fn class_init(&mut self); +} + +impl ObjectClassExt for ObjectClass { /// Fill in the virtual methods of `ObjectClass` based on the definiti= ons in /// the `ObjectImpl` trait. - pub fn class_init(&mut self) { + fn class_init(&mut self) { if ::UNPARENT.is_some() { self.unparent =3D Some(rust_unparent_fn::); } --=20 2.52.0 From nobody Sat Jan 31 19:05:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1769506797; cv=none; d=zohomail.com; s=zohoarc; b=NBpxxVCIVoPJ0gwH8Mpjg2y/oJ/aKRwlmKfFy/OzGSJvdtSKge3gSDL4PwziH4ZtT1GcvL/0ixRGEGhP5J/CqiGh62IBlpxVB/25PXhlqgs4h0M/2KWCZfk0Wp2Phfw65NByr9FpkR4Q6qUDjJiIvCxrK5v77pUpHL5pjCDiLBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769506797; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OyKogWQZt0s5Ye3yyGJg/QOai+VXDdJjUCM8cxEKuEE=; b=oCcQxFPt5qMrnPh392aGFYllYI+1sw9wnX+s7z+imFIa+Jnid/8xXLWLSAqzuFcx534vh7WIznUe15ReBS+eQwdj+kGYz8mfPfGG0Q6duKqGSdRnUZqS9v9e8kyFxWQ+zj7ILZyQa5PB/v6wcAdGFBUUmJhtV8yBPdP2VftQvHo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769506797171177.8384181997875; Tue, 27 Jan 2026 01:39:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkfYA-0001Eb-UP; Tue, 27 Jan 2026 04:39:55 -0500 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 1vkfXo-0000hL-8a for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:37 -0500 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 1vkfXi-0008UI-Iw for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:31 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-358-Y4GjjPvPOA6ZwiqC--nCrQ-1; Tue, 27 Jan 2026 04:39:22 -0500 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-47ee3dd7fc8so56190995e9.3 for ; Tue, 27 Jan 2026 01:39:21 -0800 (PST) Received: from [192.168.10.48] ([151.61.26.160]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4804dbd8696sm127898555e9.8.2026.01.27.01.39.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 01:39:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769506764; 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=OyKogWQZt0s5Ye3yyGJg/QOai+VXDdJjUCM8cxEKuEE=; b=Ty5Spk9pXsf+7Qmj+m7Fgtm/68gIyx/uQuvPmcNfdy2bwPrnS4PRvxDX8O+DllpzbMi5Hq JBGnWc+Md62wkVqntKh6wPZYWC8NnDlNG732fzbzn8TkujkgVuIqqOiDFvyRP34PfpcoHE tKBodBB8DWFHn/4k6QSXHu/ruQ8Zm7M= X-MC-Unique: Y4GjjPvPOA6ZwiqC--nCrQ-1 X-Mimecast-MFC-AGG-ID: Y4GjjPvPOA6ZwiqC--nCrQ_1769506761 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769506760; x=1770111560; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OyKogWQZt0s5Ye3yyGJg/QOai+VXDdJjUCM8cxEKuEE=; b=kQ8mNpcRjU3J9kphLPfd91yIjNBsZaLuifuK+SisC/fX+dfQblGxxrxmXAc0eHrkWk EFvheZ3yQw/PTAojc5NZKfL2s9bgRS/OKI8oZxgzPJ9ZFvd4uEimKXcswcaY6M+GOdLi 1rx3Mz/JtkGP/frvCVXfk5taLvzDxGMgkTfwnUlOIuDsAszS7pp6IcNpCfEK1lFmPak5 T8GkJPSfNdGYSnre9mUUnfm6Aq4/EUKWRX1gXa7PsEEk2qTQIy8yk/57FTbdEU65kqp8 s//Td1zVqGzgH7DyGs66SccytUPN9jQpzY1jgXWbcjOOFyQwVKVZYRQMtdXDjncBZ8DB y5Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769506760; x=1770111560; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=OyKogWQZt0s5Ye3yyGJg/QOai+VXDdJjUCM8cxEKuEE=; b=c9IbBZ4K/9rkZbB3bNjOAHELKuKzbpjxuZzMHW8jbcmOHDXaLEzvTtB1d47biEHwbj qIYjMLE2EnSAQUfkHpvE7R7zBeacw2XHJigooBz5VWFp36gGxJybfeQ2MCDa+fnYDEgW FB66Z7dTvmHDwgEuaQ7shxHLP+LzUX2AbRFP0ueTmirPKBf1k6iIKUzLxIjYvsTU1uOI rM6IH4mheJkE9gw07crDbYmb+pD7SMd1GImAsObHTIDCMyJwrrXk5akcOAwlxMoEMY1u N/L1mzbuQ843WdqMeCUi3YSjBYeNS1UsRwnnVTDgATiQqa4bGlRqTZX2SgMkMBzsFcQ+ ygQg== X-Gm-Message-State: AOJu0YzFxOC25uzQMnvOevZX4Og394fA8gv1ruRXXTwZ8Gklm99APcq1 805X2TLJ5+nPFVcX0eN+RVJH0Iw1aFMGmem8X7gWUejPPe7cFBcdxVv2LV75WCM0du4ZNbe90qB K22+euTq+F7Ni028I1trsMeZBgBl6MeqaevThj3ZibgbP9ow9PLtYsYYYxvPvCinuncT5w7nYMc 15wB3XJMFxmG2ZpsMYB0EE61oaUdZTrEC7pMJ7eXZj X-Gm-Gg: AZuq6aIId2SDwzHq0rQR7+FWqOu6/wy21ysmbnkhxtwFj/PH7olAZExasqT8U5sUExS jQdAuTMvVxIBafNSri/ksJggHVw864/CZGteOghvKY6M4CkN/pzuOwAG3naTQcNxjZis7iR/vMU aRv508er5QoxOOnQn1SxZ04g4N+OHUsXAzldt9Ls6uIZvJ363wjweGlVpyK9wcFR3gFjbA48Crh IDVlYBDPqCgkX3/t+nbgYH4Rz06IEgh9sJdhuHiu/xqSR0Me2g0MeH4Jkju5f/cWvEDcd1hqojQ LOA1TlNNQmbeY8WzmWTXCjVlJ9Qx6FTfkVF4cXXsHOtZ/7nn4fT3EXVSCwdKHCW3iBFcvRml8xA TyEZer6amDRvbk+EPUq8onHYHaE1qdVeQ0JDWSY7qU4zuqrzpM7v4oTgKeiaB3RxZn4RiibMcOz RtWafnNDbYUXGQfQ== X-Received: by 2002:a05:600c:a08c:b0:47d:885d:d2ff with SMTP id 5b1f17b1804b1-48069c89152mr12285255e9.29.1769506758304; Tue, 27 Jan 2026 01:39:18 -0800 (PST) X-Received: by 2002:a05:600c:a08c:b0:47d:885d:d2ff with SMTP id 5b1f17b1804b1-48069c89152mr12284165e9.29.1769506756122; Tue, 27 Jan 2026 01:39:16 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 04/13] rust: move binding generation to bindings/ Date: Tue, 27 Jan 2026 10:38:57 +0100 Message-ID: <20260127093906.353741-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127093906.353741-1-pbonzini@redhat.com> References: <20260127093906.353741-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1769506799040158500 From: Marc-Andr=C3=A9 Lureau Move raw FFI bindings generation to separate crates. This makes it possible to reuse bindgen declarations for a header file in its dependencies (this was not the case before this change), while keeping multiple -sys crates to avoid rebuilding all the code whenever something changes. Because the -sys crates are generated in dependency order, this also enforces that the crates are organized in something that resembles the dependencies between C headers. The meson.build for rust-safe crates becomes simpler, and it should be possible in the future to let Meson's cargo support handle most of it. Signed-off-by: Marc-Andr=C3=A9 Lureau [General cleanup and Python script. - Paolo] Signed-off-by: Paolo Bonzini --- docs/devel/rust.rst | 57 ++++++ meson.build | 3 +- rust/bindings/chardev-sys/wrapper.h | 12 ++ rust/bindings/hwcore-sys/wrapper.h | 30 ++++ rust/bindings/migration-sys/wrapper.h | 10 ++ rust/bindings/qom-sys/wrapper.h | 17 ++ rust/bindings/system-sys/wrapper.h | 21 +++ rust/bindings/util-sys/wrapper.h | 39 +++++ rust/bql/wrapper.h | 27 --- rust/chardev/wrapper.h | 28 --- rust/hw/core/wrapper.h | 32 ---- rust/migration/wrapper.h | 51 ------ rust/qom/wrapper.h | 27 --- rust/system/wrapper.h | 29 ---- rust/util/wrapper.h | 32 ---- rust/Cargo.lock | 68 ++++++++ rust/{util =3D> bindings}/build.rs | 30 ++-- rust/bindings/chardev-sys/Cargo.toml | 28 +++ rust/bindings/chardev-sys/build.rs | 1 + .../chardev-sys/lib.rs} | 7 +- rust/bindings/chardev-sys/meson.build | 12 ++ rust/bindings/generate_bindgen_args.py | 164 ++++++++++++++++++ rust/bindings/hwcore-sys/Cargo.toml | 32 ++++ rust/bindings/hwcore-sys/build.rs | 1 + .../hwcore-sys/lib.rs} | 17 +- rust/bindings/hwcore-sys/meson.build | 12 ++ rust/bindings/meson.build | 37 ++++ rust/bindings/migration-sys/Cargo.toml | 28 +++ rust/bindings/migration-sys/build.rs | 1 + rust/bindings/migration-sys/lib.rs | 125 +++++++++++++ rust/bindings/migration-sys/meson.build | 12 ++ rust/bindings/qom-sys/Cargo.toml | 25 +++ rust/bindings/qom-sys/build.rs | 1 + .../bindings.rs =3D> bindings/qom-sys/lib.rs} | 4 + rust/bindings/qom-sys/meson.build | 12 ++ rust/bindings/system-sys/Cargo.toml | 30 ++++ rust/bindings/system-sys/build.rs | 1 + .../system-sys/lib.rs} | 4 +- rust/bindings/system-sys/meson.build | 12 ++ rust/bindings/util-sys/Cargo.toml | 25 +++ rust/bindings/util-sys/build.rs | 1 + .../bindings.rs =3D> bindings/util-sys/lib.rs} | 2 +- rust/bindings/util-sys/meson.build | 12 ++ rust/bql/Cargo.toml | 1 + rust/bql/build.rs | 1 - rust/bql/meson.build | 30 +--- rust/bql/src/bindings.rs | 27 --- rust/bql/src/lib.rs | 3 +- rust/chardev/Cargo.toml | 1 + rust/chardev/build.rs | 1 - rust/chardev/meson.build | 37 +--- rust/chardev/src/lib.rs | 2 +- rust/hw/char/pl011/build.rs | 2 +- rust/hw/char/pl011/meson.build | 21 +-- rust/hw/char/pl011/src/bindings.rs | 7 +- rust/hw/core/Cargo.toml | 1 + rust/hw/core/build.rs | 1 - rust/hw/core/meson.build | 60 +------ rust/hw/core/src/lib.rs | 3 +- rust/hw/core/src/qdev.rs | 6 +- rust/hw/core/src/sysbus.rs | 21 ++- rust/meson.build | 1 + rust/migration/Cargo.toml | 1 + rust/migration/build.rs | 1 - rust/migration/meson.build | 40 +---- rust/migration/src/bindings.rs | 49 ------ rust/migration/src/lib.rs | 3 +- rust/migration/src/vmstate.rs | 73 -------- rust/qom/Cargo.toml | 1 + rust/qom/build.rs | 1 - rust/qom/meson.build | 29 +--- rust/qom/src/lib.rs | 3 +- rust/system/Cargo.toml | 3 + rust/system/build.rs | 1 - rust/system/meson.build | 37 +--- rust/system/src/lib.rs | 2 +- rust/system/src/memory.rs | 2 +- rust/util/Cargo.toml | 1 + rust/util/meson.build | 42 +---- rust/util/src/lib.rs | 3 +- 80 files changed, 918 insertions(+), 719 deletions(-) create mode 100644 rust/bindings/chardev-sys/wrapper.h create mode 100644 rust/bindings/hwcore-sys/wrapper.h create mode 100644 rust/bindings/migration-sys/wrapper.h create mode 100644 rust/bindings/qom-sys/wrapper.h create mode 100644 rust/bindings/system-sys/wrapper.h create mode 100644 rust/bindings/util-sys/wrapper.h delete mode 100644 rust/bql/wrapper.h delete mode 100644 rust/chardev/wrapper.h delete mode 100644 rust/hw/core/wrapper.h delete mode 100644 rust/migration/wrapper.h delete mode 100644 rust/qom/wrapper.h delete mode 100644 rust/system/wrapper.h delete mode 100644 rust/util/wrapper.h rename rust/{util =3D> bindings}/build.rs (55%) create mode 100644 rust/bindings/chardev-sys/Cargo.toml create mode 120000 rust/bindings/chardev-sys/build.rs rename rust/{chardev/src/bindings.rs =3D> bindings/chardev-sys/lib.rs} (84= %) create mode 100644 rust/bindings/chardev-sys/meson.build create mode 100644 rust/bindings/generate_bindgen_args.py create mode 100644 rust/bindings/hwcore-sys/Cargo.toml create mode 120000 rust/bindings/hwcore-sys/build.rs rename rust/{hw/core/src/bindings.rs =3D> bindings/hwcore-sys/lib.rs} (71%) create mode 100644 rust/bindings/hwcore-sys/meson.build create mode 100644 rust/bindings/meson.build create mode 100644 rust/bindings/migration-sys/Cargo.toml create mode 120000 rust/bindings/migration-sys/build.rs create mode 100644 rust/bindings/migration-sys/lib.rs create mode 100644 rust/bindings/migration-sys/meson.build create mode 100644 rust/bindings/qom-sys/Cargo.toml create mode 120000 rust/bindings/qom-sys/build.rs rename rust/{qom/src/bindings.rs =3D> bindings/qom-sys/lib.rs} (85%) create mode 100644 rust/bindings/qom-sys/meson.build create mode 100644 rust/bindings/system-sys/Cargo.toml create mode 120000 rust/bindings/system-sys/build.rs rename rust/{system/src/bindings.rs =3D> bindings/system-sys/lib.rs} (88%) create mode 100644 rust/bindings/system-sys/meson.build create mode 100644 rust/bindings/util-sys/Cargo.toml create mode 120000 rust/bindings/util-sys/build.rs rename rust/{util/src/bindings.rs =3D> bindings/util-sys/lib.rs} (88%) create mode 100644 rust/bindings/util-sys/meson.build delete mode 120000 rust/bql/build.rs delete mode 100644 rust/bql/src/bindings.rs delete mode 120000 rust/chardev/build.rs delete mode 120000 rust/hw/core/build.rs delete mode 120000 rust/migration/build.rs delete mode 100644 rust/migration/src/bindings.rs delete mode 120000 rust/qom/build.rs delete mode 120000 rust/system/build.rs diff --git a/docs/devel/rust.rst b/docs/devel/rust.rst index 79c26d9d165..67ea84539a2 100644 --- a/docs/devel/rust.rst +++ b/docs/devel/rust.rst @@ -339,6 +339,63 @@ Here are some things to keep in mind when working on t= he QEMU Rust crate. or a macro) where it can be documented and tested. If needed, include toy versions of the code in the documentation. =20 +FFI Binding Generation +'''''''''''''''''''''' + +QEMU's Rust integration uses multiple ``*-sys`` crates that contain raw FFI +bindings to different QEMU subsystems. These crates mirror the dependency +structure that meson.build uses for C code, and which is reflected in +``static_library()`` declarations. For example: + +* util-sys: Basic utilities (no dependencies) +* qom-sys: QEMU Object Model (depends on util-sys) +* chardev-sys: Character devices (depends on qom-sys, util-sys) +* hwcore-sys: Hardware core (depends on qom-sys, util-sys) +* migration-sys: Migration (depends on util-sys) +* system-sys: System-level APIs (depends on all others) + +Having multiple crates avoids massive rebuilds of all Rust code when C hea= ders +are changed. On the other hand, bindgen is not aware of how headers are sp= lit +across crates, and therefore it would generate declarations for dependenci= es +again. These duplicate declarations are not only large, they create distin= ct +types and therefore they are incompatible with each other. + +Bindgen Configuration +~~~~~~~~~~~~~~~~~~~~~ + +Bindgen options such as symbol blocklists or how to configure enums can be +defined in each crate's ``Cargo.toml`` via a ``[package.metadata.bindgen]`= ` section. +For example:: + + [package.metadata.bindgen] + header =3D "wrapper.h" # Main header file for this = crate + rustified-enum =3D ["QEMUClockType"] # Enums to generate as Rust = enums + bitfield-enum =3D ["VMStateFlags"] # Enums to treat as bitfields + blocklist-function =3D [ # Functions to exclude + "vmstate_register_ram", + "vmstate_unregister_ram" + ] + additional-files =3D [ # Extra files to allowlist + "include/system/memory_ldst.*" + ] + +All bindgen options are supported in the metadata section. The complete li= st +can be found in ``rust/bindings/generate_bindgen_args.py``. + +Dependency Management +~~~~~~~~~~~~~~~~~~~~~ + +By examining the dependency chain before bindgen creates the code for +the ``*-sys`` crates, the build system ensures that header files included = in +one crate are blocked from appearing in dependent crates, thus avoiding +duplicate definitions. Dependent crates can import the definition via +"use" statements. + +This dependency-aware binding generation is handled automatically by +``rust/bindings/generate_bindgen_args.py``, which processes the Cargo.toml +files in dependency order and generates appropriate ``--allowlist-file`` a= nd +``--blocklist-file`` arguments for bindgen. + Writing procedural macros ''''''''''''''''''''''''' =20 diff --git a/meson.build b/meson.build index a84f14258b0..668f1aa919c 100644 --- a/meson.build +++ b/meson.build @@ -4169,9 +4169,8 @@ if have_rust '--with-derive-default', '--no-layout-tests', '--no-prepend-enum-name', - '--allowlist-file', meson.project_source_root() + '/include/.*', - '--allowlist-file', meson.project_build_root() + '/.*', '--blocklist-file', glib_pc.get_variable('includedir') + '/glib-2.0/.*= ', + '--blocklist-file', meson.project_source_root() + '/include/qemu/typed= efs.h', '--blocklist-type', '.*_([a-z]*autoptr)$', ] if not rustfmt.found() diff --git a/rust/bindings/chardev-sys/wrapper.h b/rust/bindings/chardev-sy= s/wrapper.h new file mode 100644 index 00000000000..b8ddc361f76 --- /dev/null +++ b/rust/bindings/chardev-sys/wrapper.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* + * This header file is meant to be used as input to the `bindgen` applicat= ion + * in order to generate C FFI compatible Rust bindings. + */ + +#include "qemu/osdep.h" + +#include "chardev/char.h" +#include "chardev/char-fe.h" +#include "chardev/char-serial.h" diff --git a/rust/bindings/hwcore-sys/wrapper.h b/rust/bindings/hwcore-sys/= wrapper.h new file mode 100644 index 00000000000..7c7c3c35f6d --- /dev/null +++ b/rust/bindings/hwcore-sys/wrapper.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* + * This header file is meant to be used as input to the `bindgen` applicat= ion + * in order to generate C FFI compatible Rust bindings. + */ + +/* + * We block include/qemu/typedefs.h from bindgen, add here symbols + * that are needed as opaque types by other functions. + */ +typedef struct Clock Clock; +typedef struct DeviceState DeviceState; +typedef struct IRQState *qemu_irq; +typedef void (*qemu_irq_handler)(void *opaque, int n, int level); + +/* Once bindings exist, these could move to a different *-sys crate. */ +typedef struct BlockBackend BlockBackend; +typedef struct Monitor Monitor; +typedef struct NetClientState NetClientState; + +#include "qemu/osdep.h" + +#include "hw/core/clock.h" +#include "hw/core/irq.h" +#include "hw/core/qdev-clock.h" +#include "hw/core/qdev.h" +#include "hw/core/qdev-properties-system.h" +#include "hw/core/qdev-properties.h" +#include "hw/core/resettable.h" diff --git a/rust/bindings/migration-sys/wrapper.h b/rust/bindings/migratio= n-sys/wrapper.h new file mode 100644 index 00000000000..076ad79a21f --- /dev/null +++ b/rust/bindings/migration-sys/wrapper.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* + * This header file is meant to be used as input to the `bindgen` applicat= ion + * in order to generate C FFI compatible Rust bindings. + */ + +#include "qemu/osdep.h" + +#include "migration/vmstate.h" diff --git a/rust/bindings/qom-sys/wrapper.h b/rust/bindings/qom-sys/wrappe= r.h new file mode 100644 index 00000000000..18a5ea6d25f --- /dev/null +++ b/rust/bindings/qom-sys/wrapper.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* + * This header file is meant to be used as input to the `bindgen` applicat= ion + * in order to generate C FFI compatible Rust bindings. + */ + +/* + * We block include/qemu/typedefs.h from bindgen, add here symbols + * that are needed as opaque types by other functions. + */ +typedef struct Object Object; +typedef struct ObjectClass ObjectClass; + +#include "qemu/osdep.h" + +#include "qom/object.h" diff --git a/rust/bindings/system-sys/wrapper.h b/rust/bindings/system-sys/= wrapper.h new file mode 100644 index 00000000000..0a8bf06a1f3 --- /dev/null +++ b/rust/bindings/system-sys/wrapper.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* + * This header file is meant to be used as input to the `bindgen` applicat= ion + * in order to generate C FFI compatible Rust bindings. + */ + +/* + * We block include/qemu/typedefs.h from bindgen, add here symbols + * that are needed as opaque types by other functions. + */ +typedef struct DirtyBitmapSnapshot DirtyBitmapSnapshot; +typedef struct MemoryRegion MemoryRegion; +typedef struct RAMBlock RAMBlock; + +#include "qemu/osdep.h" + +#include "exec/hwaddr.h" +#include "system/address-spaces.h" +#include "system/memory.h" +#include "hw/core/sysbus.h" diff --git a/rust/bindings/util-sys/wrapper.h b/rust/bindings/util-sys/wrap= per.h new file mode 100644 index 00000000000..e9c433e7dc1 --- /dev/null +++ b/rust/bindings/util-sys/wrapper.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* + * This header file is meant to be used as input to the `bindgen` applicat= ion + * in order to generate C FFI compatible Rust bindings. + */ + +/* + * We block include/qemu/typedefs.h from bindgen, add here symbols + * that are needed as opaque types by other functions. + */ +typedef struct QEMUBH QEMUBH; +typedef struct QEMUFile QEMUFile; +typedef struct QemuOpts QemuOpts; +typedef struct JSONWriter JSONWriter; +typedef struct Visitor Visitor; + +#include "qemu/osdep.h" + +#include "qapi/error.h" +#include "qapi/error-internal.h" +#include "qemu/event_notifier.h" +#include "qemu/main-loop.h" +#include "qemu/aio.h" +#include "qemu/log-for-trace.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "qemu/option.h" +#include "qemu/timer.h" +#include "qapi/visitor.h" +#include "qobject/qbool.h" +#include "qobject/qdict.h" +#include "qobject/qjson.h" +#include "qobject/qlist.h" +#include "qobject/qnull.h" +#include "qobject/qnum.h" +#include "qobject/qobject.h" +#include "qobject/qstring.h" +#include "qobject/json-writer.h" diff --git a/rust/bql/wrapper.h b/rust/bql/wrapper.h deleted file mode 100644 index 2ef9a96e1d3..00000000000 --- a/rust/bql/wrapper.h +++ /dev/null @@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ - -/* - * This header file is meant to be used as input to the `bindgen` applicat= ion - * in order to generate C FFI compatible Rust bindings. - */ - -#ifndef __CLANG_STDATOMIC_H -#define __CLANG_STDATOMIC_H -/* - * Fix potential missing stdatomic.h error in case bindgen does not insert= the - * correct libclang header paths on its own. We do not use stdatomic.h sym= bols - * in QEMU code, so it's fine to declare dummy types instead. - */ -typedef enum memory_order { - memory_order_relaxed, - memory_order_consume, - memory_order_acquire, - memory_order_release, - memory_order_acq_rel, - memory_order_seq_cst, -} memory_order; -#endif /* __CLANG_STDATOMIC_H */ - -#include "qemu/osdep.h" - -#include "qemu/main-loop.h" diff --git a/rust/chardev/wrapper.h b/rust/chardev/wrapper.h deleted file mode 100644 index 65ede6ea6d7..00000000000 --- a/rust/chardev/wrapper.h +++ /dev/null @@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ - -/* - * This header file is meant to be used as input to the `bindgen` applicat= ion - * in order to generate C FFI compatible Rust bindings. - */ - -#ifndef __CLANG_STDATOMIC_H -#define __CLANG_STDATOMIC_H -/* - * Fix potential missing stdatomic.h error in case bindgen does not insert= the - * correct libclang header paths on its own. We do not use stdatomic.h sym= bols - * in QEMU code, so it's fine to declare dummy types instead. - */ -typedef enum memory_order { - memory_order_relaxed, - memory_order_consume, - memory_order_acquire, - memory_order_release, - memory_order_acq_rel, - memory_order_seq_cst, -} memory_order; -#endif /* __CLANG_STDATOMIC_H */ - -#include "qemu/osdep.h" - -#include "chardev/char-fe.h" -#include "chardev/char-serial.h" diff --git a/rust/hw/core/wrapper.h b/rust/hw/core/wrapper.h deleted file mode 100644 index 8278738f3d8..00000000000 --- a/rust/hw/core/wrapper.h +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ - -/* - * This header file is meant to be used as input to the `bindgen` applicat= ion - * in order to generate C FFI compatible Rust bindings. - */ - -#ifndef __CLANG_STDATOMIC_H -#define __CLANG_STDATOMIC_H -/* - * Fix potential missing stdatomic.h error in case bindgen does not insert= the - * correct libclang header paths on its own. We do not use stdatomic.h sym= bols - * in QEMU code, so it's fine to declare dummy types instead. - */ -typedef enum memory_order { - memory_order_relaxed, - memory_order_consume, - memory_order_acquire, - memory_order_release, - memory_order_acq_rel, - memory_order_seq_cst, -} memory_order; -#endif /* __CLANG_STDATOMIC_H */ - -#include "qemu/osdep.h" - -#include "hw/core/sysbus.h" -#include "hw/core/clock.h" -#include "hw/core/qdev-clock.h" -#include "hw/core/qdev-properties.h" -#include "hw/core/qdev-properties-system.h" -#include "hw/core/irq.h" diff --git a/rust/migration/wrapper.h b/rust/migration/wrapper.h deleted file mode 100644 index daf316aed41..00000000000 --- a/rust/migration/wrapper.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * QEMU System Emulator - * - * Copyright (c) 2024 Linaro Ltd. - * - * Authors: Manos Pitsidianakis - * - * Permission is hereby granted, free of charge, to any person obtaining a= copy - * of this software and associated documentation files (the "Software"), t= o deal - * in the Software without restriction, including without limitation the r= ights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included= in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN - * THE SOFTWARE. - */ - - -/* - * This header file is meant to be used as input to the `bindgen` applicat= ion - * in order to generate C FFI compatible Rust bindings. - */ - -#ifndef __CLANG_STDATOMIC_H -#define __CLANG_STDATOMIC_H -/* - * Fix potential missing stdatomic.h error in case bindgen does not insert= the - * correct libclang header paths on its own. We do not use stdatomic.h sym= bols - * in QEMU code, so it's fine to declare dummy types instead. - */ -typedef enum memory_order { - memory_order_relaxed, - memory_order_consume, - memory_order_acquire, - memory_order_release, - memory_order_acq_rel, - memory_order_seq_cst, -} memory_order; -#endif /* __CLANG_STDATOMIC_H */ - -#include "qemu/osdep.h" -#include "migration/vmstate.h" diff --git a/rust/qom/wrapper.h b/rust/qom/wrapper.h deleted file mode 100644 index 3b71bcd3f5b..00000000000 --- a/rust/qom/wrapper.h +++ /dev/null @@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ - -/* - * This header file is meant to be used as input to the `bindgen` applicat= ion - * in order to generate C FFI compatible Rust bindings. - */ - -#ifndef __CLANG_STDATOMIC_H -#define __CLANG_STDATOMIC_H -/* - * Fix potential missing stdatomic.h error in case bindgen does not insert= the - * correct libclang header paths on its own. We do not use stdatomic.h sym= bols - * in QEMU code, so it's fine to declare dummy types instead. - */ -typedef enum memory_order { - memory_order_relaxed, - memory_order_consume, - memory_order_acquire, - memory_order_release, - memory_order_acq_rel, - memory_order_seq_cst, -} memory_order; -#endif /* __CLANG_STDATOMIC_H */ - -#include "qemu/osdep.h" - -#include "qom/object.h" diff --git a/rust/system/wrapper.h b/rust/system/wrapper.h deleted file mode 100644 index 48abde85052..00000000000 --- a/rust/system/wrapper.h +++ /dev/null @@ -1,29 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ - -/* - * This header file is meant to be used as input to the `bindgen` applicat= ion - * in order to generate C FFI compatible Rust bindings. - */ - -#ifndef __CLANG_STDATOMIC_H -#define __CLANG_STDATOMIC_H -/* - * Fix potential missing stdatomic.h error in case bindgen does not insert= the - * correct libclang header paths on its own. We do not use stdatomic.h sym= bols - * in QEMU code, so it's fine to declare dummy types instead. - */ -typedef enum memory_order { - memory_order_relaxed, - memory_order_consume, - memory_order_acquire, - memory_order_release, - memory_order_acq_rel, - memory_order_seq_cst, -} memory_order; -#endif /* __CLANG_STDATOMIC_H */ - -#include "qemu/osdep.h" - -#include "system/system.h" -#include "system/memory.h" -#include "system/address-spaces.h" diff --git a/rust/util/wrapper.h b/rust/util/wrapper.h deleted file mode 100644 index b9ed68a01d8..00000000000 --- a/rust/util/wrapper.h +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ - -/* - * This header file is meant to be used as input to the `bindgen` applicat= ion - * in order to generate C FFI compatible Rust bindings. - */ - -#ifndef __CLANG_STDATOMIC_H -#define __CLANG_STDATOMIC_H -/* - * Fix potential missing stdatomic.h error in case bindgen does not insert= the - * correct libclang header paths on its own. We do not use stdatomic.h sym= bols - * in QEMU code, so it's fine to declare dummy types instead. - */ -typedef enum memory_order { - memory_order_relaxed, - memory_order_consume, - memory_order_acquire, - memory_order_release, - memory_order_acq_rel, - memory_order_seq_cst, -} memory_order; -#endif /* __CLANG_STDATOMIC_H */ - -#include "qemu/osdep.h" - -#include "qapi/error.h" -#include "qapi/error-internal.h" -#include "qemu/log-for-trace.h" -#include "qemu/log.h" -#include "qemu/module.h" -#include "qemu/timer.h" diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 78452c3db9b..801ac5f4f51 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -59,6 +59,7 @@ name =3D "bql" version =3D "0.1.0" dependencies =3D [ "glib-sys", + "util-sys", ] =20 [[package]] @@ -76,6 +77,7 @@ name =3D "chardev" version =3D "0.1.0" dependencies =3D [ "bql", + "chardev-sys", "common", "glib-sys", "migration", @@ -83,6 +85,16 @@ dependencies =3D [ "util", ] =20 +[[package]] +name =3D "chardev-sys" +version =3D "0.1.0" +dependencies =3D [ + "common", + "glib-sys", + "qom-sys", + "util-sys", +] + [[package]] name =3D "common" version =3D "0.1.0" @@ -156,6 +168,7 @@ dependencies =3D [ "chardev", "common", "glib-sys", + "hwcore-sys", "migration", "qemu_macros", "qom", @@ -163,6 +176,19 @@ dependencies =3D [ "util", ] =20 +[[package]] +name =3D "hwcore-sys" +version =3D "0.1.0" +dependencies =3D [ + "chardev-sys", + "common", + "glib-sys", + "migration-sys", + "qom-sys", + "system-sys", + "util-sys", +] + [[package]] name =3D "indexmap" version =3D "2.11.4" @@ -201,10 +227,20 @@ dependencies =3D [ "bql", "common", "glib-sys", + "migration-sys", "qemu_macros", "util", ] =20 +[[package]] +name =3D "migration-sys" +version =3D "0.1.0" +dependencies =3D [ + "common", + "glib-sys", + "util-sys", +] + [[package]] name =3D "pkg-config" version =3D "0.3.32" @@ -287,9 +323,18 @@ dependencies =3D [ "glib-sys", "migration", "qemu_macros", + "qom-sys", "util", ] =20 +[[package]] +name =3D "qom-sys" +version =3D "0.1.0" +dependencies =3D [ + "glib-sys", + "util-sys", +] + [[package]] name =3D "quote" version =3D "1.0.36" @@ -306,6 +351,7 @@ source =3D "registry+https://github.com/rust-lang/crate= s.io-index" checksum =3D "0dca6411025b24b60bfa7ec1fe1f8e710ac09782dca409ee8237ba74b512= 95fd" dependencies =3D [ "serde_core", + "serde_derive", ] =20 [[package]] @@ -358,9 +404,12 @@ dependencies =3D [ name =3D "system" version =3D "0.1.0" dependencies =3D [ + "bql", "common", "glib-sys", + "migration", "qom", + "system-sys", "util", ] =20 @@ -377,6 +426,17 @@ dependencies =3D [ "version-compare", ] =20 +[[package]] +name =3D "system-sys" +version =3D "0.1.0" +dependencies =3D [ + "common", + "glib-sys", + "migration-sys", + "qom-sys", + "util-sys", +] + [[package]] name =3D "target-lexicon" version =3D "0.13.2" @@ -454,6 +514,14 @@ dependencies =3D [ "foreign", "glib-sys", "libc", + "util-sys", +] + +[[package]] +name =3D "util-sys" +version =3D "0.1.0" +dependencies =3D [ + "glib-sys", ] =20 [[package]] diff --git a/rust/util/build.rs b/rust/bindings/build.rs similarity index 55% rename from rust/util/build.rs rename to rust/bindings/build.rs index 5654d1d5624..a466958d713 100644 --- a/rust/util/build.rs +++ b/rust/bindings/build.rs @@ -10,25 +10,25 @@ =20 fn main() -> Result<()> { let manifest_dir =3D env!("CARGO_MANIFEST_DIR"); - let file =3D if let Ok(root) =3D env::var("MESON_BUILD_ROOT") { - let sub =3D get_rust_subdir(manifest_dir).unwrap(); - format!("{root}/{sub}/bindings.inc.rs") - } else { - // Placing bindings.inc.rs in the source directory is supported - // but not documented or encouraged. - format!("{manifest_dir}/src/bindings.inc.rs") - }; + let root =3D env::var("MESON_BUILD_ROOT").expect(concat!( + "\n", + " MESON_BUILD_ROOT not found. Maybe you wanted one of\n", + " `make clippy`, `make rustfmt`, `make rustdoc`?\n", + "\n", + " For other uses of `cargo`, start a subshell with\n", + " `pyvenv/bin/meson devenv`, or point MESON_BUILD_ROOT to\n", + " the top of the build tree." + )); =20 + let sub =3D get_rust_subdir(manifest_dir).unwrap(); + let file =3D format!("{root}/{sub}/bindings.inc.rs"); let file =3D Path::new(&file); - if !Path::new(&file).exists() { + + if !file.exists() { panic!(concat!( "\n", - " No generated C bindings found! Maybe you wanted one of\n", - " `make clippy`, `make rustfmt`, `make rustdoc`?\n", - "\n", - " For other uses of `cargo`, start a subshell with\n", - " `pyvenv/bin/meson devenv`, or point MESON_BUILD_ROOT to\n= ", - " the top of the build tree." + " No generated C bindings found! Run `make` first; or maybe= you\n", + " wanted one of `make clippy`, `make rustfmt`, `make rustdo= c`?\n", )); } =20 diff --git a/rust/bindings/chardev-sys/Cargo.toml b/rust/bindings/chardev-s= ys/Cargo.toml new file mode 100644 index 00000000000..6aa0025ca6f --- /dev/null +++ b/rust/bindings/chardev-sys/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name =3D "chardev-sys" +version =3D "0.1.0" +description =3D "Rust sys bindings for QEMU/chardev" +publish =3D false + +authors.workspace =3D true +edition.workspace =3D true +homepage.workspace =3D true +license.workspace =3D true +repository.workspace =3D true +rust-version.workspace =3D true + +[lib] +path =3D "lib.rs" + +[dependencies] +glib-sys =3D { workspace =3D true } +common =3D { path =3D "../../common" } +qom-sys =3D { path =3D "../qom-sys" } +util-sys =3D { path =3D "../util-sys" } + +[lints] +workspace =3D true + +[package.metadata.bindgen] +header =3D "wrapper.h" +rustified-enum =3D ["QEMUChrEvent"] diff --git a/rust/bindings/chardev-sys/build.rs b/rust/bindings/chardev-sys= /build.rs new file mode 120000 index 00000000000..10238032f5f --- /dev/null +++ b/rust/bindings/chardev-sys/build.rs @@ -0,0 +1 @@ +../build.rs \ No newline at end of file diff --git a/rust/chardev/src/bindings.rs b/rust/bindings/chardev-sys/lib.rs similarity index 84% rename from rust/chardev/src/bindings.rs rename to rust/bindings/chardev-sys/lib.rs index 360b30d6a34..903f6fc492a 100644 --- a/rust/chardev/src/bindings.rs +++ b/rust/bindings/chardev-sys/lib.rs @@ -19,10 +19,9 @@ )] =20 use common::Zeroable; -use glib_sys::{ - gboolean, guint, GArray, GHashTable, GHashTableIter, GIOCondition, GMa= inContext, GPollFD, - GPtrArray, GSList, GSource, GSourceFunc, -}; +use glib_sys::{gboolean, guint, GIOCondition, GMainContext, GSource, GSour= ceFunc}; +use qom_sys::{Object, ObjectClass}; +use util_sys::{Error, IOCanReadHandler, IOReadHandler, QemuOpts}; =20 #[cfg(MESON)] include!("bindings.inc.rs"); diff --git a/rust/bindings/chardev-sys/meson.build b/rust/bindings/chardev-= sys/meson.build new file mode 100644 index 00000000000..458075b8060 --- /dev/null +++ b/rust/bindings/chardev-sys/meson.build @@ -0,0 +1,12 @@ +_bindgen_chardev_rs =3D rust.bindgen( + args: bindgen_args_common + bindgen_args_data['chardev-sys'].split(), + kwargs: bindgen_kwargs) +_chardev_sys_rs =3D static_library( + 'chardev_sys', + structured_sources(['lib.rs', _bindgen_chardev_rs]), + override_options: ['rust_std=3D2021', 'build.rust_std=3D2021'], + rust_abi: 'rust', + dependencies: [glib_sys_rs, common_rs, qom_sys_rs, util_sys_rs], +) + +chardev_sys_rs =3D declare_dependency(link_with: [_chardev_sys_rs]) diff --git a/rust/bindings/generate_bindgen_args.py b/rust/bindings/generat= e_bindgen_args.py new file mode 100644 index 00000000000..8e526d7e819 --- /dev/null +++ b/rust/bindings/generate_bindgen_args.py @@ -0,0 +1,164 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-or-later + +""" +Generate bindgen arguments from Cargo.toml metadata for QEMU's Rust FFI bi= ndings. + +Author: Paolo Bonzini + +Copyright (C) 2025 Red Hat, Inc. + +This script processes Cargo.toml file for QEMU's bindings crates (util-sys, +chardev-sys, qom-sys, etc.); it generates bindgen command lines that allow +easy customization and that export the right headers in each bindings crat= e. + +For detailed information, see docs/devel/rust.rst. +""" + +import os +import re +import sys +import argparse +from pathlib import Path +from dataclasses import dataclass +from typing import Iterable, List, Dict, Any + +try: + import tomllib +except ImportError: + import tomli as tomllib # type: ignore + +INCLUDE_RE =3D re.compile(r'^#include\s+"([^"]+)"') +OPTIONS =3D [ + "bitfield-enum", + "newtype-enum", + "newtype-global-enum", + "rustified-enum", + "rustified-non-exhaustive-enum", + "constified-enum", + "constified-enum-module", + "normal-alias", + "new-type-alias", + "new-type-alias-deref", + "bindgen-wrapper-union", + "manually-drop-union", + "blocklist-type", + "blocklist-function", + "blocklist-item", + "blocklist-file", + "blocklist-var", + "opaque-type", + "no-partialeq", + "no-copy", + "no-debug", + "no-default", + "no-hash", + "must-use-type", + "with-derive-custom", + "with-derive-custom-struct", + "with-derive-custom-enum", + "with-derive-custom-union", + "with-attribute-custom", + "with-attribute-custom-struct", + "with-attribute-custom-enum", + "with-attribute-custom-union", +] + + +@dataclass +class BindgenInfo: + cmd_args: List[str] + inputs: List[str] + + +def extract_includes(lines: Iterable[str]) -> List[str]: + """Extract #include directives from a file.""" + includes: List[str] =3D [] + for line in lines: + match =3D INCLUDE_RE.match(line.strip()) + if match: + includes.append(match.group(1)) + return includes + + +def build_bindgen_args(metadata: Dict[str, Any]) -> List[str]: + """Build command line arguments from [package.metadata.bindgen].""" + args: List[str] =3D [] + for key, values in metadata.items(): + if key in OPTIONS: + flag =3D f"--{key}" + assert isinstance(values, list) + for value in values: + args.append(flag) + args.append(value) + + return args + + +def main() -> int: + parser =3D argparse.ArgumentParser( + description=3D"Generate bindgen arguments from Cargo.toml metadata" + ) + parser.add_argument( + "directories", nargs=3D"+", help=3D"Directories containing Cargo.t= oml files" + ) + parser.add_argument( + "-I", + "--include-root", + default=3DNone, + help=3D"Base path for --allowlist-file/--blocklist-file", + ) + parser.add_argument("--source-dir", default=3Dos.getcwd(), help=3D"Sou= rce directory") + parser.add_argument("-o", "--output", required=3DTrue, help=3D"Output = file") + parser.add_argument("--dep-file", help=3D"Dependency file to write") + args =3D parser.parse_args() + + prev_allowlist_files: Dict[str, object] =3D {} + bindgen_infos: Dict[str, BindgenInfo] =3D {} + + os.chdir(args.source_dir) + include_root =3D args.include_root or args.source_dir + for directory in args.directories: + cargo_path =3D Path(directory) / "Cargo.toml" + inputs =3D [str(Path(args.source_dir) / cargo_path)] + + with open(cargo_path, "rb") as f: + cargo_toml =3D tomllib.load(f) + + metadata =3D cargo_toml.get("package", {}).get("metadata", {}).get= ("bindgen", {}) + input_file =3D Path(directory) / metadata["header"] + inputs.append(str(Path(args.source_dir) / input_file)) + + cmd_args =3D build_bindgen_args(metadata) + + # Each include file is allowed for this file and blocked in the + # next ones + for blocklist_path in prev_allowlist_files: + cmd_args.extend(["--blocklist-file", blocklist_path]) + with open(input_file, "r", encoding=3D"utf-8", errors=3D"ignore") = as f: + includes =3D extract_includes(f) + for allowlist_file in includes + metadata.get("additional-files", = []): + allowlist_path =3D Path(include_root) / allowlist_file + cmd_args.extend(["--allowlist-file", str(allowlist_path)]) + prev_allowlist_files.setdefault(str(allowlist_path), True) + + bindgen_infos[directory] =3D BindgenInfo(cmd_args=3Dcmd_args, inpu= ts=3Dinputs) + + # now write the output + with open(args.output, "w") as f: + for directory, info in bindgen_infos.items(): + args_sh =3D " ".join(info.cmd_args) + f.write(f"{directory}=3D{args_sh}\n") + + if args.dep_file: + with open(args.dep_file, "w") as f: + deps: List[str] =3D [] + for info in bindgen_infos.values(): + deps +=3D info.inputs + f.write(f"{os.path.basename(args.output)}: {' '.join(deps)}\n") + + return 0 + + +if __name__ =3D=3D "__main__": + sys.exit(main()) diff --git a/rust/bindings/hwcore-sys/Cargo.toml b/rust/bindings/hwcore-sys= /Cargo.toml new file mode 100644 index 00000000000..c20024e921a --- /dev/null +++ b/rust/bindings/hwcore-sys/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name =3D "hwcore-sys" +version =3D "0.1.0" +description =3D "Rust sys bindings for QEMU/hwcore" +publish =3D false + +authors.workspace =3D true +edition.workspace =3D true +homepage.workspace =3D true +license.workspace =3D true +repository.workspace =3D true +rust-version.workspace =3D true + +[lib] +path =3D "lib.rs" + +[dependencies] +glib-sys =3D { workspace =3D true } +common =3D { path =3D "../../common" } +chardev-sys =3D { path =3D "../chardev-sys" } +qom-sys =3D { path =3D "../qom-sys" } +migration-sys =3D { path =3D "../migration-sys" } +util-sys =3D { path =3D "../util-sys" } +system-sys =3D { path =3D "../system-sys" } + +[lints] +workspace =3D true + +[package.metadata.bindgen] +header =3D "wrapper.h" +rustified-enum =3D ["DeviceCategory", "GpioPolarity", "MachineInitPhase", = "ResetType"] +bitfield-enum =3D ["ClockEvent"] diff --git a/rust/bindings/hwcore-sys/build.rs b/rust/bindings/hwcore-sys/b= uild.rs new file mode 120000 index 00000000000..10238032f5f --- /dev/null +++ b/rust/bindings/hwcore-sys/build.rs @@ -0,0 +1 @@ +../build.rs \ No newline at end of file diff --git a/rust/hw/core/src/bindings.rs b/rust/bindings/hwcore-sys/lib.rs similarity index 71% rename from rust/hw/core/src/bindings.rs rename to rust/bindings/hwcore-sys/lib.rs index db872d38bc7..8cef4a79619 100644 --- a/rust/hw/core/src/bindings.rs +++ b/rust/bindings/hwcore-sys/lib.rs @@ -18,13 +18,15 @@ clippy::too_many_arguments )] =20 -use chardev::bindings::Chardev; +use chardev_sys::Chardev; use common::Zeroable; -use glib_sys::{GHashTable, GHashTableIter, GList, GPtrArray, GSList}; -use migration::bindings::VMStateDescription; -use qom::bindings::ObjectClass; -use system::bindings::MemoryRegion; -use util::bindings::Error; +use glib_sys::GSList; +use migration_sys::VMStateDescription; +use qom_sys::{ + InterfaceClass, Object, ObjectClass, ObjectProperty, ObjectPropertyAcc= essor, + ObjectPropertyRelease, +}; +use util_sys::{Error, QDict, QList}; =20 #[cfg(MESON)] include!("bindings.inc.rs"); @@ -35,8 +37,5 @@ unsafe impl Send for Property {} unsafe impl Sync for Property {} =20 -unsafe impl Send for TypeInfo {} -unsafe impl Sync for TypeInfo {} - unsafe impl Zeroable for Property__bindgen_ty_1 {} unsafe impl Zeroable for Property {} diff --git a/rust/bindings/hwcore-sys/meson.build b/rust/bindings/hwcore-sy= s/meson.build new file mode 100644 index 00000000000..3d51947b4a4 --- /dev/null +++ b/rust/bindings/hwcore-sys/meson.build @@ -0,0 +1,12 @@ +_bindgen_hwcore_rs =3D rust.bindgen( + args: bindgen_args_common + bindgen_args_data['hwcore-sys'].split(), + kwargs: bindgen_kwargs) +_hwcore_sys_rs =3D static_library( + 'hwcore_sys', + structured_sources(['lib.rs', _bindgen_hwcore_rs]), + override_options: ['rust_std=3D2021', 'build.rust_std=3D2021'], + rust_abi: 'rust', + dependencies: [common_rs, glib_sys_rs, qom_sys_rs, util_sys_rs, migratio= n_sys_rs, chardev_sys_rs], +) + +hwcore_sys_rs =3D declare_dependency(link_with: [_hwcore_sys_rs]) diff --git a/rust/bindings/meson.build b/rust/bindings/meson.build new file mode 100644 index 00000000000..c2798731a14 --- /dev/null +++ b/rust/bindings/meson.build @@ -0,0 +1,37 @@ +# Generate bindgen arguments from Cargo.toml metadata +# Sort these in dependency order, same as the subdir() +# invocations below. +bindgen_dirs =3D [ + 'util-sys', + 'migration-sys', + 'qom-sys', + 'chardev-sys', + 'hwcore-sys', + 'system-sys', +] +bindgen_args_file =3D configure_file( + command: [files('generate_bindgen_args.py'), + '-I', meson.project_source_root() / 'include', + '--source-dir', meson.current_source_dir(), + '-o', '@OUTPUT@', '--dep-file', '@DEPFILE@'] + bindgen_dirs, + output: 'bindgen_args.mak', + depfile: 'bindgen_args.d' +) + +# now generate all bindgen files +bindgen_args_data =3D keyval.load(bindgen_args_file) +bindgen_kwargs =3D { + 'input': 'wrapper.h', + 'dependencies': common_ss.all_dependencies(), + 'output': 'bindings.inc.rs', + 'include_directories': bindings_incdir, + 'bindgen_version': ['>=3D0.60.0'], + 'c_args': bindgen_c_args, +} + +subdir('util-sys') +subdir('migration-sys') +subdir('qom-sys') +subdir('chardev-sys') +subdir('hwcore-sys') +subdir('system-sys') diff --git a/rust/bindings/migration-sys/Cargo.toml b/rust/bindings/migrati= on-sys/Cargo.toml new file mode 100644 index 00000000000..88d7742e6ac --- /dev/null +++ b/rust/bindings/migration-sys/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name =3D "migration-sys" +version =3D "0.1.0" +description =3D "Rust sys bindings for QEMU/migration" +publish =3D false + +authors.workspace =3D true +edition.workspace =3D true +homepage.workspace =3D true +license.workspace =3D true +repository.workspace =3D true +rust-version.workspace =3D true + +[lib] +path =3D "lib.rs" + +[dependencies] +glib-sys =3D { workspace =3D true } +common =3D { path =3D "../../common" } +util-sys =3D { path =3D "../util-sys" } + +[lints] +workspace =3D true + +[package.metadata.bindgen] +header =3D "wrapper.h" +bitfield-enum =3D ["MigrationPolicy", "MigrationPriority", "VMStateFlags"] +blocklist-function =3D ["vmstate_register_ram", "vmstate_register_ram_glob= al", "vmstate_unregister_ram"] diff --git a/rust/bindings/migration-sys/build.rs b/rust/bindings/migration= -sys/build.rs new file mode 120000 index 00000000000..10238032f5f --- /dev/null +++ b/rust/bindings/migration-sys/build.rs @@ -0,0 +1 @@ +../build.rs \ No newline at end of file diff --git a/rust/bindings/migration-sys/lib.rs b/rust/bindings/migration-s= ys/lib.rs new file mode 100644 index 00000000000..7ee30a3f7d5 --- /dev/null +++ b/rust/bindings/migration-sys/lib.rs @@ -0,0 +1,125 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#![allow( + dead_code, + improper_ctypes_definitions, + improper_ctypes, + non_camel_case_types, + non_snake_case, + non_upper_case_globals, + unnecessary_transmutes, + unsafe_op_in_unsafe_fn, + clippy::pedantic, + clippy::restriction, + clippy::style, + clippy::missing_const_for_fn, + clippy::ptr_offset_with_cast, + clippy::useless_transmute, + clippy::missing_safety_doc, + clippy::too_many_arguments +)] + +use common::Zeroable; +use util_sys::{Error, JSONWriter, QEMUFile}; + +#[cfg(MESON)] +include!("bindings.inc.rs"); + +#[cfg(not(MESON))] +include!(concat!(env!("OUT_DIR"), "/bindings.inc.rs")); + +unsafe impl Send for VMStateDescription {} +unsafe impl Sync for VMStateDescription {} + +unsafe impl Send for VMStateField {} +unsafe impl Sync for VMStateField {} + +unsafe impl Send for VMStateInfo {} +unsafe impl Sync for VMStateInfo {} + +// bindgen does not derive Default here +#[allow(clippy::derivable_impls)] +impl Default for VMStateFlags { + fn default() -> Self { + Self(0) + } +} + +unsafe impl Zeroable for VMStateFlags {} +unsafe impl Zeroable for VMStateField {} +unsafe impl Zeroable for VMStateDescription {} + +// The following higher-level helpers could be in "migration" +// crate when Rust has const trait impl. + +pub trait VMStateFlagsExt { + const VMS_VARRAY_FLAGS: VMStateFlags; +} + +impl VMStateFlagsExt for VMStateFlags { + const VMS_VARRAY_FLAGS: VMStateFlags =3D VMStateFlags( + VMStateFlags::VMS_VARRAY_INT32.0 + | VMStateFlags::VMS_VARRAY_UINT8.0 + | VMStateFlags::VMS_VARRAY_UINT16.0 + | VMStateFlags::VMS_VARRAY_UINT32.0, + ); +} + +// Add a couple builder-style methods to VMStateField, allowing +// easy derivation of VMStateField constants from other types. +impl VMStateField { + #[must_use] + pub const fn with_version_id(mut self, version_id: i32) -> Self { + assert!(version_id >=3D 0); + self.version_id =3D version_id; + self + } + + #[must_use] + pub const fn with_array_flag(mut self, num: usize) -> Self { + assert!(num <=3D 0x7FFF_FFFFusize); + assert!((self.flags.0 & VMStateFlags::VMS_ARRAY.0) =3D=3D 0); + assert!((self.flags.0 & VMStateFlags::VMS_VARRAY_FLAGS.0) =3D=3D 0= ); + if (self.flags.0 & VMStateFlags::VMS_POINTER.0) !=3D 0 { + self.flags =3D VMStateFlags(self.flags.0 & !VMStateFlags::VMS_= POINTER.0); + self.flags =3D VMStateFlags(self.flags.0 | VMStateFlags::VMS_A= RRAY_OF_POINTER.0); + // VMS_ARRAY_OF_POINTER flag stores the size of pointer. + // FIXME: *const, *mut, NonNull and Box<> have the same size a= s usize. + // Resize if more smart pointers are supported. + self.size =3D std::mem::size_of::(); + } + self.flags =3D VMStateFlags(self.flags.0 & !VMStateFlags::VMS_SING= LE.0); + self.flags =3D VMStateFlags(self.flags.0 | VMStateFlags::VMS_ARRAY= .0); + self.num =3D num as i32; + self + } + + #[must_use] + pub const fn with_pointer_flag(mut self) -> Self { + assert!((self.flags.0 & VMStateFlags::VMS_POINTER.0) =3D=3D 0); + self.flags =3D VMStateFlags(self.flags.0 | VMStateFlags::VMS_POINT= ER.0); + self + } + + #[must_use] + pub const fn with_varray_flag_unchecked(mut self, flag: VMStateFlags) = -> Self { + self.flags =3D VMStateFlags(self.flags.0 & !VMStateFlags::VMS_ARRA= Y.0); + self.flags =3D VMStateFlags(self.flags.0 | flag.0); + self.num =3D 0; // varray uses num_offset instead of num. + self + } + + #[must_use] + #[allow(unused_mut)] + pub const fn with_varray_flag(mut self, flag: VMStateFlags) -> Self { + assert!((self.flags.0 & VMStateFlags::VMS_ARRAY.0) !=3D 0); + self.with_varray_flag_unchecked(flag) + } + + #[must_use] + pub const fn with_varray_multiply(mut self, num: u32) -> Self { + assert!(num <=3D 0x7FFF_FFFFu32); + self.flags =3D VMStateFlags(self.flags.0 | VMStateFlags::VMS_MULTI= PLY_ELEMENTS.0); + self.num =3D num as i32; + self + } +} diff --git a/rust/bindings/migration-sys/meson.build b/rust/bindings/migrat= ion-sys/meson.build new file mode 100644 index 00000000000..9243acba300 --- /dev/null +++ b/rust/bindings/migration-sys/meson.build @@ -0,0 +1,12 @@ +_bindgen_migration_rs =3D rust.bindgen( + args: bindgen_args_common + bindgen_args_data['migration-sys'].split(), + kwargs: bindgen_kwargs) +_migration_sys_rs =3D static_library( + 'migration_sys', + structured_sources(['lib.rs', _bindgen_migration_rs]), + override_options: ['rust_std=3D2021', 'build.rust_std=3D2021'], + rust_abi: 'rust', + dependencies: [glib_sys_rs, common_rs, util_sys_rs], +) + +migration_sys_rs =3D declare_dependency(link_with: [_migration_sys_rs]) diff --git a/rust/bindings/qom-sys/Cargo.toml b/rust/bindings/qom-sys/Cargo= .toml new file mode 100644 index 00000000000..621bd468e69 --- /dev/null +++ b/rust/bindings/qom-sys/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name =3D "qom-sys" +version =3D "0.1.0" +description =3D "Rust sys bindings for QEMU/qom" +publish =3D false + +authors.workspace =3D true +edition.workspace =3D true +homepage.workspace =3D true +license.workspace =3D true +repository.workspace =3D true +rust-version.workspace =3D true + +[lib] +path =3D "lib.rs" + +[dependencies] +glib-sys =3D { workspace =3D true } +util-sys =3D { path =3D "../util-sys" } + +[lints] +workspace =3D true + +[package.metadata.bindgen] +header =3D "wrapper.h" diff --git a/rust/bindings/qom-sys/build.rs b/rust/bindings/qom-sys/build.rs new file mode 120000 index 00000000000..10238032f5f --- /dev/null +++ b/rust/bindings/qom-sys/build.rs @@ -0,0 +1 @@ +../build.rs \ No newline at end of file diff --git a/rust/qom/src/bindings.rs b/rust/bindings/qom-sys/lib.rs similarity index 85% rename from rust/qom/src/bindings.rs rename to rust/bindings/qom-sys/lib.rs index e61259ec2ef..464b9290344 100644 --- a/rust/qom/src/bindings.rs +++ b/rust/bindings/qom-sys/lib.rs @@ -19,9 +19,13 @@ )] =20 use glib_sys::{GHashTable, GHashTableIter, GPtrArray, GSList}; +use util_sys::{Error, QDict, QObject, Visitor}; =20 #[cfg(MESON)] include!("bindings.inc.rs"); =20 #[cfg(not(MESON))] include!(concat!(env!("OUT_DIR"), "/bindings.inc.rs")); + +unsafe impl Send for TypeInfo {} +unsafe impl Sync for TypeInfo {} diff --git a/rust/bindings/qom-sys/meson.build b/rust/bindings/qom-sys/meso= n.build new file mode 100644 index 00000000000..8f8ae7d1bc8 --- /dev/null +++ b/rust/bindings/qom-sys/meson.build @@ -0,0 +1,12 @@ +_bindgen_qom_rs =3D rust.bindgen( + args: bindgen_args_common + bindgen_args_data['qom-sys'].split(), + kwargs: bindgen_kwargs) +_qom_sys_rs =3D static_library( + 'qom_sys', + structured_sources(['lib.rs', _bindgen_qom_rs]), + override_options: ['rust_std=3D2021', 'build.rust_std=3D2021'], + rust_abi: 'rust', + dependencies: [glib_sys_rs, util_sys_rs], +) + +qom_sys_rs =3D declare_dependency(link_with: [_qom_sys_rs]) diff --git a/rust/bindings/system-sys/Cargo.toml b/rust/bindings/system-sys= /Cargo.toml new file mode 100644 index 00000000000..7e527130ff5 --- /dev/null +++ b/rust/bindings/system-sys/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name =3D "system-sys" +version =3D "0.1.0" +description =3D "Rust sys bindings for QEMU/system" +publish =3D false + +authors.workspace =3D true +edition.workspace =3D true +homepage.workspace =3D true +license.workspace =3D true +repository.workspace =3D true +rust-version.workspace =3D true + +[lib] +path =3D "lib.rs" + +[dependencies] +glib-sys =3D { workspace =3D true } +common =3D { path =3D "../../common" } +migration-sys =3D { path =3D "../migration-sys" } +util-sys =3D { path =3D "../util-sys" } +qom-sys =3D { path =3D "../qom-sys" } + +[lints] +workspace =3D true + +[package.metadata.bindgen] +header =3D "wrapper.h" +rustified-enum =3D ["device_endian"] +additional-files =3D ["system/memory.*"] diff --git a/rust/bindings/system-sys/build.rs b/rust/bindings/system-sys/b= uild.rs new file mode 120000 index 00000000000..10238032f5f --- /dev/null +++ b/rust/bindings/system-sys/build.rs @@ -0,0 +1 @@ +../build.rs \ No newline at end of file diff --git a/rust/system/src/bindings.rs b/rust/bindings/system-sys/lib.rs similarity index 88% rename from rust/system/src/bindings.rs rename to rust/bindings/system-sys/lib.rs index 7164c5219a5..022fe65dd83 100644 --- a/rust/system/src/bindings.rs +++ b/rust/bindings/system-sys/lib.rs @@ -19,7 +19,9 @@ )] =20 use common::Zeroable; -use glib_sys::{guint, GHashTable, GHashTableIter, GList, GPollFD, GPtrArra= y, GSList}; +use hwcore_sys::{qemu_irq, DeviceClass, DeviceState}; +use qom_sys::{InterfaceClass, Object, ObjectClass}; +use util_sys::{Error, EventNotifier, QEMUBH}; =20 #[cfg(MESON)] include!("bindings.inc.rs"); diff --git a/rust/bindings/system-sys/meson.build b/rust/bindings/system-sy= s/meson.build new file mode 100644 index 00000000000..aa5e8801149 --- /dev/null +++ b/rust/bindings/system-sys/meson.build @@ -0,0 +1,12 @@ +_bindgen_system_rs =3D rust.bindgen( + args: bindgen_args_common + bindgen_args_data['system-sys'].split(), + kwargs: bindgen_kwargs) +_system_sys_rs =3D static_library( + 'system_sys', + structured_sources(['lib.rs', _bindgen_system_rs]), + override_options: ['rust_std=3D2021', 'build.rust_std=3D2021'], + rust_abi: 'rust', + dependencies: [common_rs, glib_sys_rs, hwcore_sys_rs, migration_sys_rs, = qom_sys_rs, util_sys_rs], +) + +system_sys_rs =3D declare_dependency(link_with: [_system_sys_rs]) diff --git a/rust/bindings/util-sys/Cargo.toml b/rust/bindings/util-sys/Car= go.toml new file mode 100644 index 00000000000..929a08ac4ea --- /dev/null +++ b/rust/bindings/util-sys/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name =3D "util-sys" +version =3D "0.1.0" +description =3D "Rust sys bindings for QEMU/util" +publish =3D false + +authors.workspace =3D true +edition.workspace =3D true +homepage.workspace =3D true +license.workspace =3D true +repository.workspace =3D true +rust-version.workspace =3D true + +[lib] +path =3D "lib.rs" + +[dependencies] +glib-sys =3D { workspace =3D true } + +[lints] +workspace =3D true + +[package.metadata.bindgen] +header =3D "wrapper.h" +rustified-enum =3D ["module_init_type", "QEMUClockType"] diff --git a/rust/bindings/util-sys/build.rs b/rust/bindings/util-sys/build= .rs new file mode 120000 index 00000000000..10238032f5f --- /dev/null +++ b/rust/bindings/util-sys/build.rs @@ -0,0 +1 @@ +../build.rs \ No newline at end of file diff --git a/rust/util/src/bindings.rs b/rust/bindings/util-sys/lib.rs similarity index 88% rename from rust/util/src/bindings.rs rename to rust/bindings/util-sys/lib.rs index 3514a66f5fa..0212e941843 100644 --- a/rust/util/src/bindings.rs +++ b/rust/bindings/util-sys/lib.rs @@ -18,7 +18,7 @@ clippy::too_many_arguments )] =20 -use glib_sys::{guint, GPollFD, GString}; +use glib_sys::{guint, GArray, GHashTable, GPollFD, GSList, GSource, GStrin= g}; =20 #[cfg(MESON)] include!("bindings.inc.rs"); diff --git a/rust/bindings/util-sys/meson.build b/rust/bindings/util-sys/me= son.build new file mode 100644 index 00000000000..c37f50a94bd --- /dev/null +++ b/rust/bindings/util-sys/meson.build @@ -0,0 +1,12 @@ +_bindgen_util_rs =3D rust.bindgen( + args: bindgen_args_common + bindgen_args_data['util-sys'].split(), + kwargs: bindgen_kwargs) +_util_sys_rs =3D static_library( + 'util_sys', + structured_sources(['lib.rs', _bindgen_util_rs]), + override_options: ['rust_std=3D2021', 'build.rust_std=3D2021'], + rust_abi: 'rust', + dependencies: [glib_sys_rs], +) + +util_sys_rs =3D declare_dependency(link_with: [_util_sys_rs]) diff --git a/rust/bql/Cargo.toml b/rust/bql/Cargo.toml index 8fd81311028..a27099e0587 100644 --- a/rust/bql/Cargo.toml +++ b/rust/bql/Cargo.toml @@ -14,6 +14,7 @@ rust-version.workspace =3D true =20 [dependencies] glib-sys.workspace =3D true +util-sys =3D { path =3D "../bindings/util-sys" } =20 [features] default =3D ["debug_cell"] diff --git a/rust/bql/build.rs b/rust/bql/build.rs deleted file mode 120000 index 71a3167885c..00000000000 --- a/rust/bql/build.rs +++ /dev/null @@ -1 +0,0 @@ -../util/build.rs \ No newline at end of file diff --git a/rust/bql/meson.build b/rust/bql/meson.build index 728c9e4dacf..de295d2983e 100644 --- a/rust/bql/meson.build +++ b/rust/bql/meson.build @@ -6,37 +6,11 @@ if get_option('debug_mutex') _bql_cfg +=3D ['--cfg', 'feature=3D"debug_cell"'] endif =20 -# -# TODO: Remove this comment when the clang/libclang mismatch issue is solv= ed. -# -# Rust bindings generation with `bindgen` might fail in some cases where t= he -# detected `libclang` does not match the expected `clang` version/target. = In -# this case you must pass the path to `clang` and `libclang` to your build -# command invocation using the environment variables CLANG_PATH and -# LIBCLANG_PATH -_bql_bindings_inc_rs =3D rust.bindgen( - input: 'wrapper.h', - dependencies: common_ss.all_dependencies(), - output: 'bindings.inc.rs', - include_directories: bindings_incdir, - bindgen_version: ['>=3D0.60.0'], - args: bindgen_args_common, - c_args: bindgen_c_args, -) - _bql_rs =3D static_library( 'bql', - structured_sources( - [ - 'src/lib.rs', - 'src/bindings.rs', - 'src/cell.rs', - 'src/prelude.rs', - ], - {'.': _bql_bindings_inc_rs} - ), + 'src/lib.rs', rust_args: _bql_cfg, - dependencies: [glib_sys_rs], + dependencies: [glib_sys_rs, util_sys_rs], ) =20 bql_rs =3D declare_dependency(link_with: [_bql_rs], diff --git a/rust/bql/src/bindings.rs b/rust/bql/src/bindings.rs deleted file mode 100644 index c656cf18845..00000000000 --- a/rust/bql/src/bindings.rs +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -#![allow( - dead_code, - improper_ctypes_definitions, - improper_ctypes, - non_camel_case_types, - non_snake_case, - non_upper_case_globals, - unnecessary_transmutes, - unsafe_op_in_unsafe_fn, - clippy::pedantic, - clippy::restriction, - clippy::style, - clippy::missing_const_for_fn, - clippy::ptr_offset_with_cast, - clippy::useless_transmute, - clippy::missing_safety_doc, - clippy::too_many_arguments -)] - -use glib_sys::{guint, GArray, GHashTable, GHashTableIter, GPollFD, GPtrArr= ay, GSList, GSource}; - -#[cfg(MESON)] -include!("bindings.inc.rs"); - -#[cfg(not(MESON))] -include!(concat!(env!("OUT_DIR"), "/bindings.inc.rs")); diff --git a/rust/bql/src/lib.rs b/rust/bql/src/lib.rs index d2fea5db1ac..3aa3d46d76c 100644 --- a/rust/bql/src/lib.rs +++ b/rust/bql/src/lib.rs @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later =20 -mod bindings; -use bindings::{bql_block_unlock, bql_locked, rust_bql_mock_lock}; +use util_sys::{bql_block_unlock, bql_locked, rust_bql_mock_lock}; =20 mod cell; pub use cell::*; diff --git a/rust/chardev/Cargo.toml b/rust/chardev/Cargo.toml index f105189dccb..208d44d0cdf 100644 --- a/rust/chardev/Cargo.toml +++ b/rust/chardev/Cargo.toml @@ -14,6 +14,7 @@ rust-version.workspace =3D true =20 [dependencies] glib-sys =3D { workspace =3D true } +chardev-sys =3D { path =3D "../bindings/chardev-sys" } common =3D { path =3D "../common" } bql =3D { path =3D "../bql" } migration =3D { path =3D "../migration" } diff --git a/rust/chardev/build.rs b/rust/chardev/build.rs deleted file mode 120000 index 71a3167885c..00000000000 --- a/rust/chardev/build.rs +++ /dev/null @@ -1 +0,0 @@ -../util/build.rs \ No newline at end of file diff --git a/rust/chardev/meson.build b/rust/chardev/meson.build index 2e4f4670bd8..7b267fd23ae 100644 --- a/rust/chardev/meson.build +++ b/rust/chardev/meson.build @@ -1,41 +1,8 @@ -c_enums =3D [ - 'QEMUChrEvent', -] -_chardev_bindgen_args =3D [] -foreach enum : c_enums - _chardev_bindgen_args +=3D ['--rustified-enum', enum] -endforeach - -# TODO: Remove this comment when the clang/libclang mismatch issue is solv= ed. -# -# Rust bindings generation with `bindgen` might fail in some cases where t= he -# detected `libclang` does not match the expected `clang` version/target. = In -# this case you must pass the path to `clang` and `libclang` to your build -# command invocation using the environment variables CLANG_PATH and -# LIBCLANG_PATH -_chardev_bindings_inc_rs =3D rust.bindgen( - input: 'wrapper.h', - dependencies: common_ss.all_dependencies(), - output: 'bindings.inc.rs', - include_directories: bindings_incdir, - bindgen_version: ['>=3D0.60.0'], - args: bindgen_args_common + _chardev_bindgen_args, - c_args: bindgen_c_args, -) - _chardev_rs =3D static_library( 'chardev', - structured_sources( - [ - 'src/lib.rs', - 'src/bindings.rs', - 'src/chardev.rs', - 'src/prelude.rs', - ], - {'.': _chardev_bindings_inc_rs} - ), + 'src/lib.rs', link_with: [_bql_rs, _migration_rs, _qom_rs, _util_rs], - dependencies: [glib_sys_rs, common_rs, qemu_macros], + dependencies: [glib_sys_rs, common_rs, qemu_macros, chardev_sys_rs], ) =20 chardev_rs =3D declare_dependency(link_with: [_chardev_rs], dependencies: = [chardev, qemuutil]) diff --git a/rust/chardev/src/lib.rs b/rust/chardev/src/lib.rs index 93a28725932..9f1a3a9c1c5 100644 --- a/rust/chardev/src/lib.rs +++ b/rust/chardev/src/lib.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later =20 -pub mod bindings; +pub use chardev_sys as bindings; =20 mod chardev; pub use chardev::*; diff --git a/rust/hw/char/pl011/build.rs b/rust/hw/char/pl011/build.rs index 5f5060db356..e3262426852 120000 --- a/rust/hw/char/pl011/build.rs +++ b/rust/hw/char/pl011/build.rs @@ -1 +1 @@ -../../../util/build.rs \ No newline at end of file +../../../bindings/build.rs \ No newline at end of file diff --git a/rust/hw/char/pl011/meson.build b/rust/hw/char/pl011/meson.build index 9c0e8290e9a..1a1a09e5083 100644 --- a/rust/hw/char/pl011/meson.build +++ b/rust/hw/char/pl011/meson.build @@ -1,18 +1,11 @@ -# TODO: Remove this comment when the clang/libclang mismatch issue is solv= ed. -# -# Rust bindings generation with `bindgen` might fail in some cases where t= he -# detected `libclang` does not match the expected `clang` version/target. = In -# this case you must pass the path to `clang` and `libclang` to your build -# command invocation using the environment variables CLANG_PATH and -# LIBCLANG_PATH _libpl011_bindings_inc_rs =3D rust.bindgen( - input: 'wrapper.h', - dependencies: common_ss.all_dependencies(), - output: 'bindings.inc.rs', - include_directories: bindings_incdir, - bindgen_version: ['>=3D0.60.0'], - args: bindgen_args_common, - c_args: bindgen_c_args, + args: bindgen_args_common + [ + '--allowlist-file', meson.project_source_root() / 'include/hw/char/pl0= 11.h', + '--blocklist-file', + meson.project_source_root() / + 'include/(block\|chardev/|exec/|hw/core/|qemu/|qom/|system/).*', + ], + kwargs: bindgen_kwargs, ) =20 _libpl011_rs =3D static_library( diff --git a/rust/hw/char/pl011/src/bindings.rs b/rust/hw/char/pl011/src/bi= ndings.rs index 68b9b22bbc3..8e2f8863b18 100644 --- a/rust/hw/char/pl011/src/bindings.rs +++ b/rust/hw/char/pl011/src/bindings.rs @@ -20,10 +20,9 @@ =20 //! `bindgen`-generated declarations. =20 -use glib_sys::{ - gboolean, guint, GArray, GHashTable, GHashTableIter, GIOCondition, GLi= st, GMainContext, - GPollFD, GPtrArray, GSList, GSource, GSourceFunc, -}; +use chardev::bindings::{CharFrontend, Chardev}; +use hwcore::bindings::{qemu_irq, Clock, DeviceState}; +use system::bindings::{hwaddr, MemoryRegion, SysBusDevice}; =20 #[cfg(MESON)] include!("bindings.inc.rs"); diff --git a/rust/hw/core/Cargo.toml b/rust/hw/core/Cargo.toml index ecfb5647184..8cc514da202 100644 --- a/rust/hw/core/Cargo.toml +++ b/rust/hw/core/Cargo.toml @@ -14,6 +14,7 @@ rust-version.workspace =3D true =20 [dependencies] glib-sys.workspace =3D true +hwcore-sys =3D { path =3D "../../bindings/hwcore-sys" } qemu_macros =3D { path =3D "../../qemu-macros" } common =3D { path =3D "../../common" } bql =3D { path =3D "../../bql" } diff --git a/rust/hw/core/build.rs b/rust/hw/core/build.rs deleted file mode 120000 index 2a79ee31b8c..00000000000 --- a/rust/hw/core/build.rs +++ /dev/null @@ -1 +0,0 @@ -../../util/build.rs \ No newline at end of file diff --git a/rust/hw/core/meson.build b/rust/hw/core/meson.build index 942ee9cdacf..28ea00cdb4f 100644 --- a/rust/hw/core/meson.build +++ b/rust/hw/core/meson.build @@ -1,66 +1,10 @@ -_hwcore_bindgen_args =3D [] -c_enums =3D [ - 'DeviceCategory', - 'GpioPolarity', - 'MachineInitPhase', - 'ResetType', -] -foreach enum : c_enums - _hwcore_bindgen_args +=3D ['--rustified-enum', enum] -endforeach - -blocked_type =3D [ - 'Chardev', - 'Error', - 'ObjectClass', - 'MemoryRegion', - 'VMStateDescription', -] -foreach type: blocked_type - _hwcore_bindgen_args +=3D ['--blocklist-type', type] -endforeach - -c_bitfields =3D [ - 'ClockEvent', -] -foreach enum : c_bitfields - _hwcore_bindgen_args +=3D ['--bitfield-enum', enum] -endforeach - -# TODO: Remove this comment when the clang/libclang mismatch issue is solv= ed. -# -# Rust bindings generation with `bindgen` might fail in some cases where t= he -# detected `libclang` does not match the expected `clang` version/target. = In -# this case you must pass the path to `clang` and `libclang` to your build -# command invocation using the environment variables CLANG_PATH and -# LIBCLANG_PATH -_hwcore_bindings_inc_rs =3D rust.bindgen( - input: 'wrapper.h', - dependencies: common_ss.all_dependencies(), - output: 'bindings.inc.rs', - include_directories: bindings_incdir, - bindgen_version: ['>=3D0.60.0'], - args: bindgen_args_common + _hwcore_bindgen_args, - c_args: bindgen_c_args, -) - _hwcore_rs =3D static_library( 'hwcore', - structured_sources( - [ - 'src/lib.rs', - 'src/bindings.rs', - 'src/irq.rs', - 'src/prelude.rs', - 'src/qdev.rs', - 'src/sysbus.rs', - ], - {'.': _hwcore_bindings_inc_rs} - ), + 'src/lib.rs', override_options: ['rust_std=3D2021', 'build.rust_std=3D2021'], rust_abi: 'rust', link_with: [_bql_rs, _chardev_rs, _migration_rs, _qom_rs, _system_rs, _u= til_rs], - dependencies: [glib_sys_rs, qemu_macros, common_rs], + dependencies: [glib_sys_rs, qemu_macros, common_rs, hwcore_sys_rs], ) =20 hwcore_rs =3D declare_dependency(link_with: [_hwcore_rs], diff --git a/rust/hw/core/src/lib.rs b/rust/hw/core/src/lib.rs index 491743d2b9d..76689fe7db1 100644 --- a/rust/hw/core/src/lib.rs +++ b/rust/hw/core/src/lib.rs @@ -1,10 +1,9 @@ // SPDX-License-Identifier: GPL-2.0-or-later =20 +pub use hwcore_sys as bindings; pub use qemu_macros::Device; pub use qom; =20 -pub mod bindings; - mod irq; pub use irq::*; =20 diff --git a/rust/hw/core/src/qdev.rs b/rust/hw/core/src/qdev.rs index f6037fbdcae..145e20a984f 100644 --- a/rust/hw/core/src/qdev.rs +++ b/rust/hw/core/src/qdev.rs @@ -66,7 +66,7 @@ pub trait ResettablePhasesImpl { /// can be downcasted to type `T`. We also expect the device is /// readable/writeable from one thread at any time. unsafe extern "C" fn rust_resettable_enter_fn( - obj: *mut bindings::Object, + obj: *mut qom::bindings::Object, typ: ResetType, ) { let state =3D NonNull::new(obj).unwrap().cast::(); @@ -79,7 +79,7 @@ pub trait ResettablePhasesImpl { /// can be downcasted to type `T`. We also expect the device is /// readable/writeable from one thread at any time. unsafe extern "C" fn rust_resettable_hold_fn( - obj: *mut bindings::Object, + obj: *mut qom::bindings::Object, typ: ResetType, ) { let state =3D NonNull::new(obj).unwrap().cast::(); @@ -92,7 +92,7 @@ pub trait ResettablePhasesImpl { /// can be downcasted to type `T`. We also expect the device is /// readable/writeable from one thread at any time. unsafe extern "C" fn rust_resettable_exit_fn( - obj: *mut bindings::Object, + obj: *mut qom::bindings::Object, typ: ResetType, ) { let state =3D NonNull::new(obj).unwrap().cast::(); diff --git a/rust/hw/core/src/sysbus.rs b/rust/hw/core/src/sysbus.rs index 81fab3f1910..7db09a82c63 100644 --- a/rust/hw/core/src/sysbus.rs +++ b/rust/hw/core/src/sysbus.rs @@ -6,22 +6,21 @@ =20 use std::ffi::CStr; =20 -pub use bindings::SysBusDeviceClass; use common::Opaque; use qom::prelude::*; use system::MemoryRegion; +pub use system_sys::SysBusDeviceClass; use util::{Error, Result}; =20 use crate::{ - bindings, irq::{IRQState, InterruptSource}, qdev::{DeviceClassExt, DeviceImpl, DeviceState}, }; =20 -/// A safe wrapper around [`bindings::SysBusDevice`]. +/// A safe wrapper around [`system_sys::SysBusDevice`]. #[repr(transparent)] #[derive(Debug, common::Wrapper)] -pub struct SysBusDevice(Opaque); +pub struct SysBusDevice(Opaque); =20 unsafe impl Send for SysBusDevice {} unsafe impl Sync for SysBusDevice {} @@ -29,7 +28,7 @@ unsafe impl Sync for SysBusDevice {} unsafe impl ObjectType for SysBusDevice { type Class =3D SysBusDeviceClass; const TYPE_NAME: &'static CStr =3D - unsafe { CStr::from_bytes_with_nul_unchecked(bindings::TYPE_SYS_BU= S_DEVICE) }; + unsafe { CStr::from_bytes_with_nul_unchecked(system_sys::TYPE_SYS_= BUS_DEVICE) }; } =20 qom_isa!(SysBusDevice: DeviceState, Object); @@ -62,7 +61,7 @@ pub trait SysBusDeviceMethods: ObjectDeref fn init_mmio(&self, iomem: &MemoryRegion) { assert!(bql::is_locked()); unsafe { - bindings::sysbus_init_mmio(self.upcast().as_mut_ptr(), iomem.a= s_mut_ptr()); + system_sys::sysbus_init_mmio(self.upcast().as_mut_ptr(), iomem= .as_mut_ptr()); } } =20 @@ -73,7 +72,7 @@ fn init_mmio(&self, iomem: &MemoryRegion) { fn init_irq(&self, irq: &InterruptSource) { assert!(bql::is_locked()); unsafe { - bindings::sysbus_init_irq(self.upcast().as_mut_ptr(), irq.as_p= tr()); + system_sys::sysbus_init_irq(self.upcast().as_mut_ptr(), irq.as= _ptr()); } } =20 @@ -82,7 +81,7 @@ fn mmio_addr(&self, id: u32) -> Option { assert!(bql::is_locked()); // SAFETY: the BQL ensures that no one else writes to sbd.mmio[], = and // the SysBusDevice must be initialized to get an IsA. - let sbd =3D unsafe { &*self.upcast().as_ptr() }; + let sbd =3D unsafe { &*self.upcast().as_mut_ptr() }; let id: usize =3D id.try_into().unwrap(); if sbd.mmio[id].memory.is_null() { None @@ -96,7 +95,7 @@ fn mmio_map(&self, id: u32, addr: u64) { assert!(bql::is_locked()); let id: i32 =3D id.try_into().unwrap(); unsafe { - bindings::sysbus_mmio_map(self.upcast().as_mut_ptr(), id, addr= ); + system_sys::sysbus_mmio_map(self.upcast().as_mut_ptr(), id, ad= dr); } } =20 @@ -108,7 +107,7 @@ fn connect_irq(&self, id: u32, irq: &Owned) { let id: i32 =3D id.try_into().unwrap(); let irq: &IRQState =3D irq; unsafe { - bindings::sysbus_connect_irq(self.upcast().as_mut_ptr(), id, i= rq.as_mut_ptr()); + system_sys::sysbus_connect_irq(self.upcast().as_mut_ptr(), id,= irq.as_mut_ptr()); } } =20 @@ -116,7 +115,7 @@ fn sysbus_realize(&self) -> Result<()> { assert!(bql::is_locked()); unsafe { Error::with_errp(|errp| { - bindings::sysbus_realize(self.upcast().as_mut_ptr(), errp); + system_sys::sysbus_realize(self.upcast().as_mut_ptr(), err= p); }) } } diff --git a/rust/meson.build b/rust/meson.build index bacb7879102..3a3e10d7b97 100644 --- a/rust/meson.build +++ b/rust/meson.build @@ -35,6 +35,7 @@ genrs =3D [] subdir('qemu-macros') =20 subdir('common') +subdir('bindings') subdir('bits') =20 subdir('util') diff --git a/rust/migration/Cargo.toml b/rust/migration/Cargo.toml index 415457496d6..cf10601b44a 100644 --- a/rust/migration/Cargo.toml +++ b/rust/migration/Cargo.toml @@ -17,6 +17,7 @@ bql =3D { path =3D "../bql" } common =3D { path =3D "../common" } qemu_macros =3D { path =3D "../qemu-macros" } util =3D { path =3D "../util" } +migration-sys =3D { path =3D "../bindings/migration-sys" } glib-sys.workspace =3D true =20 [lints] diff --git a/rust/migration/build.rs b/rust/migration/build.rs deleted file mode 120000 index 71a3167885c..00000000000 --- a/rust/migration/build.rs +++ /dev/null @@ -1 +0,0 @@ -../util/build.rs \ No newline at end of file diff --git a/rust/migration/meson.build b/rust/migration/meson.build index 76d86b0ac0f..96266897770 100644 --- a/rust/migration/meson.build +++ b/rust/migration/meson.build @@ -1,44 +1,8 @@ -_migration_bindgen_args =3D [] -c_bitfields =3D [ - 'MigrationPolicy', - 'MigrationPriority', - 'VMStateFlags', -] -foreach enum : c_bitfields - _migration_bindgen_args +=3D ['--bitfield-enum', enum] -endforeach -# -# TODO: Remove this comment when the clang/libclang mismatch issue is solv= ed. -# -# Rust bindings generation with `bindgen` might fail in some cases where t= he -# detected `libclang` does not match the expected `clang` version/target. = In -# this case you must pass the path to `clang` and `libclang` to your build -# command invocation using the environment variables CLANG_PATH and -# LIBCLANG_PATH -_migration_bindings_inc_rs =3D rust.bindgen( - input: 'wrapper.h', - dependencies: common_ss.all_dependencies(), - output: 'bindings.inc.rs', - include_directories: bindings_incdir, - bindgen_version: ['>=3D0.60.0'], - args: bindgen_args_common + _migration_bindgen_args, - c_args: bindgen_c_args, -) - _migration_rs =3D static_library( 'migration', - structured_sources( - [ - 'src/lib.rs', - 'src/bindings.rs', - 'src/migratable.rs', - 'src/prelude.rs', - 'src/vmstate.rs', - ], - {'.' : _migration_bindings_inc_rs}, - ), + 'src/lib.rs', link_with: [_util_rs, _bql_rs], - dependencies: [common_rs, glib_sys_rs, qemu_macros], + dependencies: [common_rs, glib_sys_rs, qemu_macros, migration_sys_rs], ) =20 migration_rs =3D declare_dependency(link_with: [_migration_rs], diff --git a/rust/migration/src/bindings.rs b/rust/migration/src/bindings.rs deleted file mode 100644 index e9c058386c2..00000000000 --- a/rust/migration/src/bindings.rs +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -#![allow( - dead_code, - improper_ctypes_definitions, - improper_ctypes, - non_camel_case_types, - non_snake_case, - non_upper_case_globals, - unnecessary_transmutes, - unsafe_op_in_unsafe_fn, - clippy::pedantic, - clippy::restriction, - clippy::style, - clippy::missing_const_for_fn, - clippy::ptr_offset_with_cast, - clippy::useless_transmute, - clippy::missing_safety_doc, - clippy::too_many_arguments -)] - -use common::Zeroable; -use glib_sys::{GHashTable, GHashTableIter, GPtrArray, GSList}; - -#[cfg(MESON)] -include!("bindings.inc.rs"); - -#[cfg(not(MESON))] -include!(concat!(env!("OUT_DIR"), "/bindings.inc.rs")); - -unsafe impl Send for VMStateDescription {} -unsafe impl Sync for VMStateDescription {} - -unsafe impl Send for VMStateField {} -unsafe impl Sync for VMStateField {} - -unsafe impl Send for VMStateInfo {} -unsafe impl Sync for VMStateInfo {} - -// bindgen does not derive Default here -#[allow(clippy::derivable_impls)] -impl Default for VMStateFlags { - fn default() -> Self { - Self(0) - } -} - -unsafe impl Zeroable for VMStateFlags {} -unsafe impl Zeroable for VMStateField {} -unsafe impl Zeroable for VMStateDescription {} diff --git a/rust/migration/src/lib.rs b/rust/migration/src/lib.rs index 32e182e716a..6d819cc1554 100644 --- a/rust/migration/src/lib.rs +++ b/rust/migration/src/lib.rs @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later =20 -pub mod bindings; - +pub use migration_sys as bindings; pub use qemu_macros::ToMigrationState; =20 pub mod migratable; diff --git a/rust/migration/src/vmstate.rs b/rust/migration/src/vmstate.rs index 595e7e9cd75..edc7c702656 100644 --- a/rust/migration/src/vmstate.rs +++ b/rust/migration/src/vmstate.rs @@ -165,79 +165,6 @@ macro_rules! vmstate_of { }; } =20 -pub trait VMStateFlagsExt { - const VMS_VARRAY_FLAGS: VMStateFlags; -} - -impl VMStateFlagsExt for VMStateFlags { - const VMS_VARRAY_FLAGS: VMStateFlags =3D VMStateFlags( - VMStateFlags::VMS_VARRAY_INT32.0 - | VMStateFlags::VMS_VARRAY_UINT8.0 - | VMStateFlags::VMS_VARRAY_UINT16.0 - | VMStateFlags::VMS_VARRAY_UINT32.0, - ); -} - -// Add a couple builder-style methods to VMStateField, allowing -// easy derivation of VMStateField constants from other types. -impl VMStateField { - #[must_use] - pub const fn with_version_id(mut self, version_id: i32) -> Self { - assert!(version_id >=3D 0); - self.version_id =3D version_id; - self - } - - #[must_use] - pub const fn with_array_flag(mut self, num: usize) -> Self { - assert!(num <=3D 0x7FFF_FFFFusize); - assert!((self.flags.0 & VMStateFlags::VMS_ARRAY.0) =3D=3D 0); - assert!((self.flags.0 & VMStateFlags::VMS_VARRAY_FLAGS.0) =3D=3D 0= ); - if (self.flags.0 & VMStateFlags::VMS_POINTER.0) !=3D 0 { - self.flags =3D VMStateFlags(self.flags.0 & !VMStateFlags::VMS_= POINTER.0); - self.flags =3D VMStateFlags(self.flags.0 | VMStateFlags::VMS_A= RRAY_OF_POINTER.0); - // VMS_ARRAY_OF_POINTER flag stores the size of pointer. - // FIXME: *const, *mut, NonNull and Box<> have the same size a= s usize. - // Resize if more smart pointers are supported. - self.size =3D std::mem::size_of::(); - } - self.flags =3D VMStateFlags(self.flags.0 & !VMStateFlags::VMS_SING= LE.0); - self.flags =3D VMStateFlags(self.flags.0 | VMStateFlags::VMS_ARRAY= .0); - self.num =3D num as i32; - self - } - - #[must_use] - pub const fn with_pointer_flag(mut self) -> Self { - assert!((self.flags.0 & VMStateFlags::VMS_POINTER.0) =3D=3D 0); - self.flags =3D VMStateFlags(self.flags.0 | VMStateFlags::VMS_POINT= ER.0); - self - } - - #[must_use] - pub const fn with_varray_flag_unchecked(mut self, flag: VMStateFlags) = -> Self { - self.flags =3D VMStateFlags(self.flags.0 & !VMStateFlags::VMS_ARRA= Y.0); - self.flags =3D VMStateFlags(self.flags.0 | flag.0); - self.num =3D 0; // varray uses num_offset instead of num. - self - } - - #[must_use] - #[allow(unused_mut)] - pub const fn with_varray_flag(mut self, flag: VMStateFlags) -> Self { - assert!((self.flags.0 & VMStateFlags::VMS_ARRAY.0) !=3D 0); - self.with_varray_flag_unchecked(flag) - } - - #[must_use] - pub const fn with_varray_multiply(mut self, num: u32) -> Self { - assert!(num <=3D 0x7FFF_FFFFu32); - self.flags =3D VMStateFlags(self.flags.0 | VMStateFlags::VMS_MULTI= PLY_ELEMENTS.0); - self.num =3D num as i32; - self - } -} - /// This macro can be used (by just passing it a type) to forward the `VMS= tate` /// trait to the first field of a tuple. This is a workaround for lack of /// support of nested [`offset_of`](core::mem::offset_of) until Rust 1.82.= 0. diff --git a/rust/qom/Cargo.toml b/rust/qom/Cargo.toml index 4be3c2541b6..aed8af5474a 100644 --- a/rust/qom/Cargo.toml +++ b/rust/qom/Cargo.toml @@ -18,6 +18,7 @@ bql =3D { path =3D "../bql" } migration =3D { path =3D "../migration" } qemu_macros =3D { path =3D "../qemu-macros" } util =3D { path =3D "../util" } +qom-sys =3D { path =3D "../bindings/qom-sys" } glib-sys.workspace =3D true =20 [lints] diff --git a/rust/qom/build.rs b/rust/qom/build.rs deleted file mode 120000 index 71a3167885c..00000000000 --- a/rust/qom/build.rs +++ /dev/null @@ -1 +0,0 @@ -../util/build.rs \ No newline at end of file diff --git a/rust/qom/meson.build b/rust/qom/meson.build index dda26c3f981..9865da280cf 100644 --- a/rust/qom/meson.build +++ b/rust/qom/meson.build @@ -1,33 +1,8 @@ -# TODO: Remove this comment when the clang/libclang mismatch issue is solv= ed. -# -# Rust bindings generation with `bindgen` might fail in some cases where t= he -# detected `libclang` does not match the expected `clang` version/target. = In -# this case you must pass the path to `clang` and `libclang` to your build -# command invocation using the environment variables CLANG_PATH and -# LIBCLANG_PATH -_qom_bindings_inc_rs =3D rust.bindgen( - input: 'wrapper.h', - dependencies: common_ss.all_dependencies(), - output: 'bindings.inc.rs', - include_directories: bindings_incdir, - bindgen_version: ['>=3D0.60.0'], - args: bindgen_args_common, - c_args: bindgen_c_args, -) - _qom_rs =3D static_library( 'qom', - structured_sources( - [ - 'src/lib.rs', - 'src/bindings.rs', - 'src/prelude.rs', - 'src/qom.rs', - ], - {'.': _qom_bindings_inc_rs} - ), + 'src/lib.rs', link_with: [_bql_rs, _migration_rs], - dependencies: [common_rs, glib_sys_rs, qemu_macros], + dependencies: [common_rs, glib_sys_rs, qemu_macros, qom_sys_rs], ) =20 qom_rs =3D declare_dependency(link_with: [_qom_rs], dependencies: [qemu_ma= cros, qom, qemuutil]) diff --git a/rust/qom/src/lib.rs b/rust/qom/src/lib.rs index 24c44fc2afb..1bed1cfe233 100644 --- a/rust/qom/src/lib.rs +++ b/rust/qom/src/lib.rs @@ -1,8 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later =20 pub use qemu_macros::Object; - -pub mod bindings; +pub use qom_sys as bindings; =20 // preserve one-item-per-"use" syntax, it is clearer // for prelude-like modules diff --git a/rust/system/Cargo.toml b/rust/system/Cargo.toml index 186ea00bfff..f7fde9782ea 100644 --- a/rust/system/Cargo.toml +++ b/rust/system/Cargo.toml @@ -14,6 +14,9 @@ rust-version.workspace =3D true =20 [dependencies] common =3D { path =3D "../common" } +system-sys =3D { path =3D "../bindings/system-sys" } +bql =3D { path =3D "../bql" } +migration =3D { path =3D "../migration" } qom =3D { path =3D "../qom" } util =3D { path =3D "../util" } glib-sys.workspace =3D true diff --git a/rust/system/build.rs b/rust/system/build.rs deleted file mode 120000 index 71a3167885c..00000000000 --- a/rust/system/build.rs +++ /dev/null @@ -1 +0,0 @@ -../util/build.rs \ No newline at end of file diff --git a/rust/system/meson.build b/rust/system/meson.build index e9f36ed8554..4cbd63cbbd7 100644 --- a/rust/system/meson.build +++ b/rust/system/meson.build @@ -1,41 +1,8 @@ -c_enums =3D [ - 'device_endian', -] -_system_bindgen_args =3D [] -foreach enum : c_enums - _system_bindgen_args +=3D ['--rustified-enum', enum] -endforeach - -# TODO: Remove this comment when the clang/libclang mismatch issue is solv= ed. -# -# Rust bindings generation with `bindgen` might fail in some cases where t= he -# detected `libclang` does not match the expected `clang` version/target. = In -# this case you must pass the path to `clang` and `libclang` to your build -# command invocation using the environment variables CLANG_PATH and -# LIBCLANG_PATH -_system_bindings_inc_rs =3D rust.bindgen( - input: 'wrapper.h', - dependencies: common_ss.all_dependencies(), - output: 'bindings.inc.rs', - include_directories: bindings_incdir, - bindgen_version: ['>=3D0.60.0'], - args: bindgen_args_common + _system_bindgen_args, - c_args: bindgen_c_args, -) - _system_rs =3D static_library( 'system', - structured_sources( - [ - 'src/lib.rs', - 'src/bindings.rs', - 'src/memory.rs', - 'src/prelude.rs', - ], - {'.': _system_bindings_inc_rs} - ), + 'src/lib.rs', link_with: [_bql_rs, _migration_rs, _qom_rs, _util_rs], - dependencies: [glib_sys_rs, common_rs, qemu_macros], + dependencies: [glib_sys_rs, common_rs, qemu_macros, system_sys_rs], ) =20 system_rs =3D declare_dependency(link_with: [_system_rs], diff --git a/rust/system/src/lib.rs b/rust/system/src/lib.rs index 5fb83b65d8d..10741e0ee0a 100644 --- a/rust/system/src/lib.rs +++ b/rust/system/src/lib.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later =20 -pub mod bindings; +pub use system_sys as bindings; =20 mod memory; pub use memory::*; diff --git a/rust/system/src/memory.rs b/rust/system/src/memory.rs index 4e06c16a0b5..4c258201bad 100644 --- a/rust/system/src/memory.rs +++ b/rust/system/src/memory.rs @@ -132,7 +132,7 @@ unsafe impl Sync for MemoryRegion {} impl MemoryRegion { unsafe fn do_init_io( slot: *mut bindings::MemoryRegion, - owner: *mut bindings::Object, + owner: *mut qom::bindings::Object, ops: &'static bindings::MemoryRegionOps, name: &'static str, size: u64, diff --git a/rust/util/Cargo.toml b/rust/util/Cargo.toml index 85f91436545..2ad5940daca 100644 --- a/rust/util/Cargo.toml +++ b/rust/util/Cargo.toml @@ -18,6 +18,7 @@ foreign =3D { workspace =3D true } glib-sys =3D { workspace =3D true } libc =3D { workspace =3D true } common =3D { path =3D "../common" } +util-sys =3D { path =3D "../bindings/util-sys" } =20 [lints] workspace =3D true diff --git a/rust/util/meson.build b/rust/util/meson.build index 98629394afb..6d175ae0b0f 100644 --- a/rust/util/meson.build +++ b/rust/util/meson.build @@ -1,45 +1,7 @@ -_util_bindgen_args =3D [] -c_enums =3D [ - 'module_init_type', - 'QEMUClockType', -] -foreach enum : c_enums - _util_bindgen_args +=3D ['--rustified-enum', enum] -endforeach - -# -# TODO: Remove this comment when the clang/libclang mismatch issue is solv= ed. -# -# Rust bindings generation with `bindgen` might fail in some cases where t= he -# detected `libclang` does not match the expected `clang` version/target. = In -# this case you must pass the path to `clang` and `libclang` to your build -# command invocation using the environment variables CLANG_PATH and -# LIBCLANG_PATH -_util_bindings_inc_rs =3D rust.bindgen( - input: 'wrapper.h', - dependencies: common_ss.all_dependencies(), - output: 'bindings.inc.rs', - include_directories: bindings_incdir, - bindgen_version: ['>=3D0.60.0'], - args: bindgen_args_common + _util_bindgen_args, - c_args: bindgen_c_args, -) - _util_rs =3D static_library( 'util', - structured_sources( - [ - 'src/lib.rs', - 'src/bindings.rs', - 'src/error.rs', - 'src/log.rs', - 'src/module.rs', - 'src/prelude.rs', - 'src/timer.rs', - ], - {'.': _util_bindings_inc_rs} - ), - dependencies: [anyhow_rs, libc_rs, foreign_rs, glib_sys_rs, common_rs], + 'src/lib.rs', + dependencies: [anyhow_rs, libc_rs, foreign_rs, glib_sys_rs, common_rs, u= til_sys_rs], ) =20 util_rs =3D declare_dependency(link_with: [_util_rs], dependencies: [qemuu= til, qom]) diff --git a/rust/util/src/lib.rs b/rust/util/src/lib.rs index 7d2de3ed811..436c67e139e 100644 --- a/rust/util/src/lib.rs +++ b/rust/util/src/lib.rs @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later =20 -pub mod bindings; +pub use util_sys as bindings; + pub mod error; pub mod log; pub mod module; --=20 2.52.0 From nobody Sat Jan 31 19:05:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1769506846; cv=none; d=zohomail.com; s=zohoarc; b=MnH+laM+Czui/BsQ17MKqjGR6iFMu9YRietjWHcYyabt0zSxuhGCZIbREZ6iDviih8ODrec5WFWFeiONhBfafSfgIJcaKpP3eNoM5GGCQpLA4ROe0nKUNobUIeBy+PMv48N5ephrvqdlGj85IpIg0uBirN5hN7a+JW3F1hsdCC0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769506846; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=wZHV5QfGAz1nuWmCIkw+CUNK4q/aU6e4q2VMG7wzU9M=; b=Y+1le2TXyMG9kgskV5535N+LKTcdVCbl5+hV6pL0xwMyxH3C3SiEpSemOKfdoarYQm8hOvn94QNG3PITccdEIHjH7VEHojXqxWNBqG8rpStMlcgYMEagzAsFiCdwkqrTC69WF/C4Sr+2oEjN0fBgWTwntG1BEs53vKdOl7644hc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769506846644945.7555002748255; Tue, 27 Jan 2026 01:40:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkfXw-0000mi-6o; Tue, 27 Jan 2026 04:39:40 -0500 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 1vkfXh-0000eL-6W for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:26 -0500 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 1vkfXf-0008Tt-3Y for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:24 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-691-KMiOfQv8PHqJMOr63jUsNw-1; Tue, 27 Jan 2026 04:39:20 -0500 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4806865a01bso4039985e9.0 for ; Tue, 27 Jan 2026 01:39:20 -0800 (PST) Received: from [192.168.10.48] ([151.61.26.160]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48066c428basm51363155e9.12.2026.01.27.01.39.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 01:39:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769506762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wZHV5QfGAz1nuWmCIkw+CUNK4q/aU6e4q2VMG7wzU9M=; b=I/uH/zeHf++3ZpiiefTiBj9E0ZZuEq6grNotas5IcK6+hb1fxfjxG8gCXBjuSCc+dAKLE2 h6vZKIvpsGOmgBYPQn5UQlv3fFEdBJKxA5lMQlcuz0uNtEMK5rbwMYTMEpomHfhJpjCUFt b9RAc2Wf5fxCT+GltPTI5bhKgC3R8mo= X-MC-Unique: KMiOfQv8PHqJMOr63jUsNw-1 X-Mimecast-MFC-AGG-ID: KMiOfQv8PHqJMOr63jUsNw_1769506759 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769506758; x=1770111558; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=wZHV5QfGAz1nuWmCIkw+CUNK4q/aU6e4q2VMG7wzU9M=; b=hG0EVyd8SEf2CFgeeaoGWOLADZJMKJWYoU1CTO1JJO+U1HxZ9x+UbpjJDPg3BSMX25 QzPBjPeybH9qBR7QqVUhUxvXCrH5qfZpfY8UsKJu7yPBjeqrdjvB+NI+SOXK+I+0mNhy 4dEWf1bc78Ezr2n9FsId3Km1znuywBdjHGejq/yXI3B1zJ5Ddmn4BGvLn0n5dMsBfDmG dF3M59hN2Pn8GDMAj8yzk0iivAqryE1RkvK6X0pn9MFy6pE0icTKQhPuIp1zaJRkil1y ozdcG8zBAAn/P93VrOfWXoQ74M7NMebeGADGUHRR/VEDLZNOYe2FcUnQGf2GeMxj3Ogr usHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769506758; x=1770111558; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=wZHV5QfGAz1nuWmCIkw+CUNK4q/aU6e4q2VMG7wzU9M=; b=TO2Rv4PaN/lGF2zdh8sxLPbDud9kYpvBIhhggh8D/bu+nmuOAImJE35OFB4M4R5AyD lBY57QsR/Rf3fUCJT5PVYr0GWtRDlh7gWu0D0v93DxxKrgv6x2uU22D6ODoUBni7ZzgM hUStNJ3uomXsVEVURWVseHskKBbRCbEZ3T5oCbvKFKqn7AJEZEvG0QDkTujeEhPtl4gz oMRPKlI/WV08oRV6ieMBPJMMfw3Ee55UnkoYwMy2SCRb/gCa/1F/j9qH+C5EmYud+eLE ZWrxpUiT1MtdfqpV5pgkfy0mocFGJ6ga7bj1uLMpiTaz5Uj4y7tkBVizC8P89o67GFOb FWHw== X-Gm-Message-State: AOJu0Yw7DJ+QRG7dcVGRjJ3HHJaV1UEiNYDJjteW3plcgU4xqH7b8L0L UzIZzXr8kK1BXSpqvH08uir0FqGJ3q7kGq0dZDmmlx6zQGRkVWpJxFssy2jJeZLQ6wvLdrt6lvR hjmJ8NLui9slmaWiZ73qQtmLDg7bdD4eKQPYU8gVJxBicECyY4LwJIQ6YELecmfmP5Sdy+Y1oyi ZXsdgFgvU8AZzUZ80/zX2i35oxzYG2FM5K4Xy2jGv7 X-Gm-Gg: AZuq6aI/Foe2FYGzYGKwJppd/ZtCk7TQcr6xtCIFobNCy3wER1NIL8phjQPEzuzR0Ck 57N4IIu4pudGn2ymH+xMrSH4t4p8nH+U1UkuLu3lrpH4QrPVp8dDBPuXZV4YEwCRVlSANsdDLzD EOkPedx4RZLj7eWHdzjPPTz//AkPsL5x2R/hDecFX0Qhenn0FQSN3rgQbEYofJN4ivijWsrfc6L sHWNDQNG1MYktWly5/FnS2PSdKs6avIEqUd9mRF7I3/0MPnYHXAEcNmsOFPiWprGX2IjJBWmlBV Qab3+A4W7WsTwpFf+oa3CpaU49YMeJauDaGLIWaq3TAaUO3f4EP+xiDlJS4kt0UlISz9B4TWbV2 aOpWe0pueRHmdLoqPsohFmNB+bzJ3DYkvocsJiOBYPN+/Je2DKFs5HG7my1Aga2TcYVM1f6VD5I dkJ+Q4tWj1F9xcWQ== X-Received: by 2002:a05:600c:8681:b0:480:3ad0:93bf with SMTP id 5b1f17b1804b1-48069c487admr9667035e9.24.1769506758272; Tue, 27 Jan 2026 01:39:18 -0800 (PST) X-Received: by 2002:a05:600c:8681:b0:480:3ad0:93bf with SMTP id 5b1f17b1804b1-48069c487admr9666685e9.24.1769506757682; Tue, 27 Jan 2026 01:39:17 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 05/13] rust: move hwcore::sysbus to system crate Date: Tue, 27 Jan 2026 10:38:58 +0100 Message-ID: <20260127093906.353741-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127093906.353741-1-pbonzini@redhat.com> References: <20260127093906.353741-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1769506847745154100 Content-Type: text/plain; charset="utf-8" This inverts the dependency from hwcore to system, replacing it with a dependency from system to hwcore. It also matches how hw/core/sysbus.h is part of the system-sys crate, and hw/core/sysbus.c is part of system_ss on the C side. This fixes a linker error in hwcore integration tests on msys2. Signed-off-by: Paolo Bonzini --- rust/hw/core/Cargo.toml | 1 - rust/hw/core/meson.build | 2 +- rust/hw/core/src/irq.rs | 8 ++++---- rust/hw/core/src/lib.rs | 3 --- rust/hw/core/src/prelude.rs | 5 ----- rust/hw/core/tests/tests.rs | 4 ++-- rust/meson.build | 2 +- rust/system/Cargo.toml | 1 + rust/system/meson.build | 2 +- rust/system/src/lib.rs | 3 +++ rust/system/src/prelude.rs | 5 +++++ rust/{hw/core =3D> system}/src/sysbus.rs | 7 ++----- 12 files changed, 20 insertions(+), 23 deletions(-) rename rust/{hw/core =3D> system}/src/sysbus.rs (96%) diff --git a/rust/hw/core/Cargo.toml b/rust/hw/core/Cargo.toml index 8cc514da202..d1ff71d5c37 100644 --- a/rust/hw/core/Cargo.toml +++ b/rust/hw/core/Cargo.toml @@ -21,7 +21,6 @@ bql =3D { path =3D "../../bql" } qom =3D { path =3D "../../qom" } chardev =3D { path =3D "../../chardev" } migration =3D { path =3D "../../migration" } -system =3D { path =3D "../../system" } util =3D { path =3D "../../util" } =20 [lints] diff --git a/rust/hw/core/meson.build b/rust/hw/core/meson.build index 28ea00cdb4f..6d1bfd4d204 100644 --- a/rust/hw/core/meson.build +++ b/rust/hw/core/meson.build @@ -3,7 +3,7 @@ _hwcore_rs =3D static_library( 'src/lib.rs', override_options: ['rust_std=3D2021', 'build.rust_std=3D2021'], rust_abi: 'rust', - link_with: [_bql_rs, _chardev_rs, _migration_rs, _qom_rs, _system_rs, _u= til_rs], + link_with: [_bql_rs, _chardev_rs, _migration_rs, _qom_rs, _util_rs], dependencies: [glib_sys_rs, qemu_macros, common_rs, hwcore_sys_rs], ) =20 diff --git a/rust/hw/core/src/irq.rs b/rust/hw/core/src/irq.rs index e0d7784d97b..13ace921824 100644 --- a/rust/hw/core/src/irq.rs +++ b/rust/hw/core/src/irq.rs @@ -33,10 +33,10 @@ /// /// Interrupts are implemented as a pointer to the interrupt "sink", which= has /// type [`IRQState`]. A device exposes its source as a QOM link property= using -/// a function such as [`crate::sysbus::SysBusDeviceMethods::init_irq`], a= nd +/// a function such as [`crate::DeviceMethods::init_gpio_out`], and /// initially leaves the pointer to a NULL value, representing an unconnec= ted /// interrupt. To connect it, whoever creates the device fills the pointer= with -/// the sink's `IRQState *`, for example using `sysbus_connect_irq`. Beca= use +/// the sink's `IRQState *`, for example using `qdev_connect_gpio_out`. B= ecause /// devices are generally shared objects, interrupt sources are an example= of /// the interior mutability pattern. /// @@ -87,11 +87,11 @@ pub fn set(&self, level: T) { } } =20 - pub(crate) const fn as_ptr(&self) -> *mut *mut bindings::IRQState { + pub const fn as_ptr(&self) -> *mut *mut bindings::IRQState { self.cell.as_ptr() } =20 - pub(crate) const fn slice_as_ptr(slice: &[Self]) -> *mut *mut bindings= ::IRQState { + pub const fn slice_as_ptr(slice: &[Self]) -> *mut *mut bindings::IRQSt= ate { assert!(!slice.is_empty()); slice[0].as_ptr() } diff --git a/rust/hw/core/src/lib.rs b/rust/hw/core/src/lib.rs index 76689fe7db1..6701dc52b65 100644 --- a/rust/hw/core/src/lib.rs +++ b/rust/hw/core/src/lib.rs @@ -14,6 +14,3 @@ =20 mod qdev; pub use qdev::*; - -mod sysbus; -pub use sysbus::*; diff --git a/rust/hw/core/src/prelude.rs b/rust/hw/core/src/prelude.rs index 13f7dfc6809..45e86e178b1 100644 --- a/rust/hw/core/src/prelude.rs +++ b/rust/hw/core/src/prelude.rs @@ -9,9 +9,4 @@ pub use crate::qdev::ResettablePhasesImpl; pub use crate::qdev::ResetType; =20 -pub use crate::sysbus::SysBusDevice; -pub use crate::sysbus::SysBusDeviceClassExt; -pub use crate::sysbus::SysBusDeviceImpl; -pub use crate::sysbus::SysBusDeviceMethods; - pub use crate::irq::InterruptSource; diff --git a/rust/hw/core/tests/tests.rs b/rust/hw/core/tests/tests.rs index 115dd7a860d..05aa5d4a377 100644 --- a/rust/hw/core/tests/tests.rs +++ b/rust/hw/core/tests/tests.rs @@ -142,7 +142,7 @@ fn test_cast() { let obj_ref: &Object =3D p_ref.upcast(); assert_eq!(addr_of!(*obj_ref), p_ptr.cast()); =20 - let sbd_ref: Option<&SysBusDevice> =3D obj_ref.dynamic_cast(); + let sbd_ref: Option<&DummyChildState> =3D obj_ref.dynamic_cast(); assert!(sbd_ref.is_none()); =20 let dev_ref: Option<&DeviceState> =3D obj_ref.downcast(); @@ -150,7 +150,7 @@ fn test_cast() { =20 // SAFETY: the cast is wrong, but the value is only used for comparison unsafe { - let sbd_ref: &SysBusDevice =3D obj_ref.unsafe_cast(); + let sbd_ref: &DummyChildState =3D obj_ref.unsafe_cast(); assert_eq!(addr_of!(*sbd_ref), p_ptr.cast()); } } diff --git a/rust/meson.build b/rust/meson.build index 3a3e10d7b97..b6711fe77dd 100644 --- a/rust/meson.build +++ b/rust/meson.build @@ -42,9 +42,9 @@ subdir('util') subdir('bql') subdir('migration') subdir('qom') -subdir('system') subdir('chardev') subdir('hw/core') +subdir('system') subdir('tests') subdir('trace') subdir('hw') diff --git a/rust/system/Cargo.toml b/rust/system/Cargo.toml index f7fde9782ea..d6217370317 100644 --- a/rust/system/Cargo.toml +++ b/rust/system/Cargo.toml @@ -16,6 +16,7 @@ rust-version.workspace =3D true common =3D { path =3D "../common" } system-sys =3D { path =3D "../bindings/system-sys" } bql =3D { path =3D "../bql" } +hwcore =3D { path =3D "../hw/core" } migration =3D { path =3D "../migration" } qom =3D { path =3D "../qom" } util =3D { path =3D "../util" } diff --git a/rust/system/meson.build b/rust/system/meson.build index 4cbd63cbbd7..89c1f2b84d1 100644 --- a/rust/system/meson.build +++ b/rust/system/meson.build @@ -1,7 +1,7 @@ _system_rs =3D static_library( 'system', 'src/lib.rs', - link_with: [_bql_rs, _migration_rs, _qom_rs, _util_rs], + link_with: [_bql_rs, _hwcore_rs, _migration_rs, _qom_rs, _util_rs], dependencies: [glib_sys_rs, common_rs, qemu_macros, system_sys_rs], ) =20 diff --git a/rust/system/src/lib.rs b/rust/system/src/lib.rs index 10741e0ee0a..3b1666e62ce 100644 --- a/rust/system/src/lib.rs +++ b/rust/system/src/lib.rs @@ -9,3 +9,6 @@ // for prelude-like modules #[rustfmt::skip] pub mod prelude; + +mod sysbus; +pub use sysbus::*; diff --git a/rust/system/src/prelude.rs b/rust/system/src/prelude.rs index 2d98524c36e..5a8688ca343 100644 --- a/rust/system/src/prelude.rs +++ b/rust/system/src/prelude.rs @@ -6,3 +6,8 @@ pub use crate::memory::MemoryRegionOps; pub use crate::memory::MemoryRegionOpsBuilder; pub use crate::memory::MemTxAttrs; + +pub use crate::sysbus::SysBusDevice; +pub use crate::sysbus::SysBusDeviceClassExt; +pub use crate::sysbus::SysBusDeviceImpl; +pub use crate::sysbus::SysBusDeviceMethods; diff --git a/rust/hw/core/src/sysbus.rs b/rust/system/src/sysbus.rs similarity index 96% rename from rust/hw/core/src/sysbus.rs rename to rust/system/src/sysbus.rs index 7db09a82c63..3c9aff51be0 100644 --- a/rust/hw/core/src/sysbus.rs +++ b/rust/system/src/sysbus.rs @@ -7,15 +7,12 @@ use std::ffi::CStr; =20 use common::Opaque; +use hwcore::{prelude::*, IRQState}; use qom::prelude::*; -use system::MemoryRegion; pub use system_sys::SysBusDeviceClass; use util::{Error, Result}; =20 -use crate::{ - irq::{IRQState, InterruptSource}, - qdev::{DeviceClassExt, DeviceImpl, DeviceState}, -}; +use crate::MemoryRegion; =20 /// A safe wrapper around [`system_sys::SysBusDevice`]. #[repr(transparent)] --=20 2.52.0 From nobody Sat Jan 31 19:05:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1769506926; cv=none; d=zohomail.com; s=zohoarc; b=nIyLj+hXIRr668EKXuXAbA4eBwwUY/qIkRaR9QHwYuVPTMR77ZVIuzwBSF/p1d6fxJp3N28V1WN1LKJyW5cZG6GbRcU9MzGvguJzRMfSVdlCWwu3TEpgnlCR2wvfxZteHmWR8AJSS5MO6FRrYYZkSjZF3I6SVyQ8+syLnwQpLi0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769506926; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=G12U7HD1qt2fPICoBOKA56jEyJjkaqdG/Ug1Zr9+Wvc=; b=h6Lin0JcKguBDt5DlIassaKOe9W11g24temuAuAR3x1d89HBy6TuXbjMMlX3vFHdKiExMco6M3Qgy+JSGEFXpdDBsZDErnrDC/xI8VqT2thfLYblh2kgcftU1vOIplYQ8yMTWdWJfUoO4OnYZvJ3wbIbvWUol99bN8NBosHlt2c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769506926453264.2042086922255; Tue, 27 Jan 2026 01:42:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkfXx-0000oc-1S; Tue, 27 Jan 2026 04:39:41 -0500 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 1vkfXj-0000g4-Na for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:28 -0500 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 1vkfXg-0008U6-Lu for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:25 -0500 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-462-2wZ6bHpqMMWcvJmnCaGrBg-1; Tue, 27 Jan 2026 04:39:21 -0500 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-43065ad16a8so3247612f8f.1 for ; Tue, 27 Jan 2026 01:39:21 -0800 (PST) Received: from [192.168.10.48] ([151.61.26.160]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435b1c246ecsm37784916f8f.10.2026.01.27.01.39.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 01:39:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769506763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G12U7HD1qt2fPICoBOKA56jEyJjkaqdG/Ug1Zr9+Wvc=; b=Jvnz9LiG2iP1CmvIna3A99IR7wZvzcuIbdojEcslXImSx9NXRXS05hawO4lAK1PHT6tRhV my/FvEmy6G7m6QA3cr1i2C32cv7yyxhKZspBztQhs94/bju5GOgtbhaDwmhtrEnxDVI1ed 6rkfgz21yNmh3hJS4zGAQyLy4oCLiMA= X-MC-Unique: 2wZ6bHpqMMWcvJmnCaGrBg-1 X-Mimecast-MFC-AGG-ID: 2wZ6bHpqMMWcvJmnCaGrBg_1769506760 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769506760; x=1770111560; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=G12U7HD1qt2fPICoBOKA56jEyJjkaqdG/Ug1Zr9+Wvc=; b=pLvS0oWfKm+DqYuQkTQ5miqebbiItjvw9fMftNj5TUixdT+CiPXDS6AB8KktHwWpfb qzZu0rSUtgNMNPyWrb5L1UN6l605ghvyAs2eR3+JUj5LEz7X/S0u8iO1Zgoc7Tsk/VpL hNWbhxNHtLlGaiuwepEpAeFiru4SlXUhJ4QXJtvTnVAVsmaNVK5Zz6M4LnNDORrkPdyS sVumHV9F51dNRJ1Oc6S3P5sX0aQuAhBYwsDAm3gYd6jTAEsP4kbLa7r8ytVjGHhVHdfX y07p98dm6egosK00YuDa84+Yb5uU680wB6aYmqkBnFHa4RGRBkQlyJMt18sNirO+8Ndo 3juQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769506760; x=1770111560; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=G12U7HD1qt2fPICoBOKA56jEyJjkaqdG/Ug1Zr9+Wvc=; b=dhaIoiyvtbf1KIq0xjFCMRcwFSBSPkCqH/9FDMAxpUh+nWnXk0P4OarHJGk50Qnsxl 3TjIaOQLHP8g1MYWYQAWnl72Rj9ws8w2quwcvBw2vw7N5lEvKzkGC7a1H3Yy9hTPCH57 J0De7ZOuVbaxBRs11c2yM1qL25+KxqnCssXg1VfW8K0m6//2zPpFYR7sUrha2IyXmRDo 5zOPILx129ejt1g/1mwAlzYF84TT425/Uizqr7JuVYnwOYsGnIuBFRHT884Bt66k7d6u buizqxYDeX3Tdl6t6Ov0Iq8QgASf+VuTpxoizSFxJAK2Sq9OLPt3z6mPRYkNefqitUdr FELA== X-Gm-Message-State: AOJu0YxaFcASvQUOac0zKWWV0Faewy4XsXbhuiWcGz+FAoT5dhdpcnLi 9IDCCys+fkQ8S6z3QOqPeOSnECrc9w8F5kJks5QoPBayCOHpWh3zS2JObqBn5RqtaHheSHMGTAB ZYOgxa456nQskPB4KuJ/VqelS8orL+poXng+28NRpDwFAO32j6RCG8rlAK/M6DGIvl6r8n/ZenV Qv3aCtYDkgw6GtXW67v9x/qipdP3FjqIuAaolG9ERk X-Gm-Gg: AZuq6aIc3uat0fb5yKpniLIvYA/Gc5nbenD3iMlJM1nbQFiu4fDrrQxjY0HDpP+gNQ2 +b4Pe8w+xVGxX2BnoJ+93o41WjactU0Zym62i0PS25FbE+RcxJhuMJuhxLb8mNgm4YeKSnhjnV/ LcsUDgS4c8pOv/Jvt9SyEOpTmrrgbJ+L9qyAjEJyCRBCRrakGuqMDCeaf8jlkzOrfYDoZY5xA0X 13T/AQ2I5BWkhO6FphVQnqbjuqxs/r9E6Y/B7ve/SDRsAwL5BKckYYiMC8V3A8pCfczIdNxvH3C YTv6K0QIEWCnF1a5r03i8OtKGY52AhR2HLkzS80GK8I8h47SKReXPJHqLsPs7YFYKY8hDMrfu/d AljSTUxwDk/iV+AcJ1y/GSoJOfowWN1+V/4nsGBc3QSV15EhZqJ0FP5cDIEvca6QJS5cYp/T5o8 xF4tcq1IRjC3SoGg== X-Received: by 2002:a05:6000:4282:b0:431:752:672b with SMTP id ffacd0b85a97d-435dd05a81amr1414322f8f.14.1769506759598; Tue, 27 Jan 2026 01:39:19 -0800 (PST) X-Received: by 2002:a05:6000:4282:b0:431:752:672b with SMTP id ffacd0b85a97d-435dd05a81amr1414264f8f.14.1769506758982; Tue, 27 Jan 2026 01:39:18 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 06/13] qdev: add hw/core/gpio.c to libhwcore Date: Tue, 27 Jan 2026 10:38:59 +0100 Message-ID: <20260127093906.353741-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127093906.353741-1-pbonzini@redhat.com> References: <20260127093906.353741-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1769506927060158500 Content-Type: text/plain; charset="utf-8" While GPIO functionality is not used by user-mode emulation, it is conceptually part of qdev - GPIO pins are included in DeviceState independent of whether this is system or user-mode emulation. For the Rust bindings, having GPIO functionality in system_ss causes a problem because, for simplicity, all methods of DeviceState are included in the Rust hwcore crate. On Windows, rustc is not able to do dead code elimination as well as on other OSes and this causes an undefined symbol error, because gpio.c is not linked into the rust/hw/core/rust-hwcore-rs-integration test binary. To fix it, move gpio.c out of system_ss and into libhwcore. Alternatively, it would be possible to define some DeviceState methods also in the system crate, using for example a separate trace SystemDeviceMethods. For now, keep all the methods in one crate and link 200 unused lines of code into user-mode emulators. Signed-off-by: Paolo Bonzini --- hw/core/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/meson.build b/hw/core/meson.build index b5a545a0edd..8a96567de8f 100644 --- a/hw/core/meson.build +++ b/hw/core/meson.build @@ -1,6 +1,7 @@ # core qdev-related obj files, also used by *-user and unit tests hwcore_ss.add(files( 'bus.c', + 'gpio.c', 'qdev-properties.c', 'qdev.c', 'resetcontainer.c', @@ -29,7 +30,6 @@ system_ss.add(when: 'CONFIG_EIF', if_true: [files('eif.c'= ), zlib, libcbor, gnutl system_ss.add(files( 'cpu-system.c', 'fw-path-provider.c', - 'gpio.c', 'hotplug.c', 'loader.c', 'machine-hmp-cmds.c', --=20 2.52.0 From nobody Sat Jan 31 19:05:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1769506809; cv=none; d=zohomail.com; s=zohoarc; b=nUb3OHCl+y0GlV+zy3H+TfOvEQ1FV97cezDqj6UnEfvzqdpBLesRknh1j1KIbCJ28xRuqKLF0EgJgGnjSMMLwr/lSq93+pCixOO/3RfrEazpMLOm6l6pQL/gsADnBeaSp0mdB1I8kGETNeoc9XnskWdsqiN1WowdOUiHIr8F7Gc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769506809; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TLcvh1Gbzq7JQhWWprLKhfjY3EqWo/Phz+itTE6VFOs=; b=f7xR1WmuIFwyUjeT3zjUbI2g7WdUt/uSOhTBfQ/KSxIgCmn18CvXLYM4fX3X2yDMpL6mUgvH89YslwoRSQlzGwLZe0ECr2UTRhnrcfNsKGjMFCcY4WdiQvBZL6OKJktmx75O4BARhnDhpmdNnzH/dEoPDQ5t8SOvdyOACK1K/dk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769506809085283.38758696708044; Tue, 27 Jan 2026 01:40:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkfXw-0000me-59; Tue, 27 Jan 2026 04:39:40 -0500 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 1vkfXm-0000gm-JS for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:31 -0500 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 1vkfXk-0008Ud-0q for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:30 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-311-Y8M9jT0IN-W3T1s3kHUsDg-1; Tue, 27 Jan 2026 04:39:25 -0500 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-48069a43217so4202255e9.1 for ; Tue, 27 Jan 2026 01:39:25 -0800 (PST) Received: from [192.168.10.48] ([151.61.26.160]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435b1c01783sm37555852f8f.3.2026.01.27.01.39.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 01:39:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769506766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TLcvh1Gbzq7JQhWWprLKhfjY3EqWo/Phz+itTE6VFOs=; b=UoQxUPlM8SZn+fGzmmGfQKfAdksfLjyVahlDHlOGjEoa116Dcr+mj1V2iLOJ8jjzI+tihc /K4Z2lgZPatEgW/n5jtnpY0djXi5U8sh8Li/0wXx1C9GMivEKToPKE782ScCJwIcoKSbqM AIOkHpEqg2f9Xy7uTIi40Qmmnnz2sRc= X-MC-Unique: Y8M9jT0IN-W3T1s3kHUsDg-1 X-Mimecast-MFC-AGG-ID: Y8M9jT0IN-W3T1s3kHUsDg_1769506764 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769506763; x=1770111563; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TLcvh1Gbzq7JQhWWprLKhfjY3EqWo/Phz+itTE6VFOs=; b=CR6yya5xoazZTl0/76SXhk78BKizXU/SSH+NlT+T/Tp+ES1UQUgDIqAo6fgYD8UCCY wn0nf47+Iyc4DONifwGE90WMq/JauWARt43B7vgEQn7hRbhbc2YhRH/qXmb1ngntIDv/ yadfXoGM3B3HR5QWH+cMdQ8vsz5GSMbdcFcdPHNl+eSDrNpEmA3NoJaqEdaSSfJJ7pkA cLoP3RhJN48cKOhVO613RIcR0Q8H5VU3YrvLa2MgtlwwMHkFga3eLjDPzVYsh15Kup0u 5mq51M6/vG/UJBqxqwbYa34f2g/+8m3JfKtGQtBGebELapwvPfqMbmZVrnJhq7/FGCJJ 2ffw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769506763; x=1770111563; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=TLcvh1Gbzq7JQhWWprLKhfjY3EqWo/Phz+itTE6VFOs=; b=CYU1NUg5GWX69l/KwPkvB2RPWepZRE4YdSkMNjj6vQa2WLyESTC6y2w42L9/8HnYc8 t1/iqqsJ+Y2SRvK3TJMahSEdTDUboNx5XaVKYkSzZatWAJlaqbPbWftilLen65pW/yJX 0Qqt4pFZTVsbbeb0zGEK3w8CuG8pTVM3lVoxqWWJ3QUmAK7s/fckE0otGor4KMXYhs3S joe8eNxY+JoNTm9JosxcOzWP5jrpCzvtmWNeoj3DuT8Bek8ltZ3yePlK0723G53Jvdub Ix4WpDpsaz/gG09BRa+q9k8yt1MiTpWevoTbc+2wNTNgI5z4//T7AznPNvGI1+1xlAIS nVUg== X-Gm-Message-State: AOJu0YxbxW6svSlkqa6OypDwrY7haKvQH+Ms/9XUrH81YnFY+w6Q0ssW c8JuUcTcAZsAfjK/WI1qCyWb9PylklKjx1fAlNfIvv3APDhQqaf9x/Go3nhVgCGzV6ytslwa09y 8WyBfR45lQ5YJM22823uiQBcJuEOLAZw6p71C+bFsK9Xfq9DYgD907PVRlLgbec+P3QH17zSZ8F 6DJXVBOG7FaNNNWKWEwniALfSc7BVTRCLt8jjD1fml X-Gm-Gg: AZuq6aKHgF2VH2u4uRAUnGpHHwQipi220lL1GzSkg91RbuJ0IrrWE5oqdRwihI7BE3S 2D69E+asQUwtONSR1M2bgDbeEkU/jWGak3FiuWh5XsyWztcVNjHCKuOtr42C1VDOYTitquuDdES D/3NLsJSdoSQMRb4xlPKIL5yOvaHiMz9BRCxsSkkxUpk5QcdX7uONUrCkTqwwEI0hU3mILhbPH4 2FrugCoc9l+R5w7FDlnvXlzVnWeGptzXbEjpkfgCefoFVsEnXEJXSHOfp89nwJBW5MImd+C0w4+ /9qyFWtHrZBybbSnjj+Shlo6BXKPVPXfz1l8PsiA5Vj5eFUpOAoiujwMtX2RO2lQFpjCmEVHu14 NF7/2gY0wu1n4jE496kgguFf9RfnrV4SIzN3wgntWLU4LunNkV4R0SQGezzLNrlHNvjsQqFxkd5 waCaGZNqcc07bb9g== X-Received: by 2002:a05:600c:820d:b0:477:7b16:5f77 with SMTP id 5b1f17b1804b1-48069c3fa76mr13643245e9.3.1769506762994; Tue, 27 Jan 2026 01:39:22 -0800 (PST) X-Received: by 2002:a05:600c:820d:b0:477:7b16:5f77 with SMTP id 5b1f17b1804b1-48069c3fa76mr13642915e9.3.1769506762386; Tue, 27 Jan 2026 01:39:22 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 07/13] target/i386/tcg: fix a few instructions that do not support VEX.L=1 Date: Tue, 27 Jan 2026 10:39:00 +0100 Message-ID: <20260127093906.353741-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127093906.353741-1-pbonzini@redhat.com> References: <20260127093906.353741-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1769506811322154101 Content-Type: text/plain; charset="utf-8" Match the contents of table 2-17 ("#UD Exception and VEX.L Field Encoding") in the SDM, for instruction in exception class 5. They were incorrectly accepting 256-bit versions that do not exist. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.c.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.= c.inc index 09e3d8884cf..e44b92710cf 100644 --- a/target/i386/tcg/decode-new.c.inc +++ b/target/i386/tcg/decode-new.c.inc @@ -628,7 +628,7 @@ static void decode_0F7E(DisasContext *s, CPUX86State *e= nv, X86OpEntry *entry, ui static const X86OpEntry opcodes_0F7E[4] =3D { X86_OP_ENTRY3(MOVD_from, E,y, None,None, P,y, vex5 mmx), X86_OP_ENTRY3(MOVD_from, E,y, None,None, V,y, vex5), - X86_OP_ENTRY3(MOVQ, V,x, None,None, W,q, vex5), /* wrong de= st Vy on SDM! */ + X86_OP_ENTRY3(MOVQ, V,dq,None,None, W,q, vex5), /* wrong de= st Vq on SDM! */ {}, }; *entry =3D *decode_by_prefix(s, opcodes_0F7E); @@ -693,7 +693,7 @@ static void decode_0FD6(DisasContext *s, CPUX86State *e= nv, X86OpEntry *entry, ui { static const X86OpEntry movq[4] =3D { {}, - X86_OP_ENTRY3(MOVQ, W,x, None, None, V,q, vex5), + X86_OP_ENTRY3(MOVQ, W,dq, None, None, V,q, vex5), X86_OP_ENTRY3(MOVq_dq, V,dq, None, None, N,q), X86_OP_ENTRY3(MOVq_dq, P,q, None, None, U,q), }; @@ -1102,7 +1102,7 @@ static void decode_0F12(DisasContext *s, CPUX86State = *env, X86OpEntry *entry, ui }; static const X86OpEntry opcodes_0F12_reg[4] =3D { X86_OP_ENTRY3(VMOVHLPS, V,dq, H,dq, U,dq, vex7), - X86_OP_ENTRY3(VMOVLPx, W,x, H,x, U,q, vex5), /* MOVLPD = */ + X86_OP_ENTRY3(VMOVLPx, W,dq, H,dq, U,q, vex5), /* MOVLPD = */ X86_OP_ENTRY3(VMOVSLDUP, V,x, None,None, U,x, vex4 cpuid(SSE3)), X86_OP_ENTRY3(VMOVDDUP, V,x, None,None, U,x, vex5 cpuid(SSE3)), }; @@ -1465,7 +1465,7 @@ static const X86OpEntry opcodes_0F[256] =3D { [0x6b] =3D X86_OP_ENTRY3(PACKSSDW, V,x, H,x, W,x, vex4 mmx avx2_256= p_00_66), [0x6c] =3D X86_OP_ENTRY3(PUNPCKLQDQ, V,x, H,x, W,x, vex4 p_66 avx2_25= 6), [0x6d] =3D X86_OP_ENTRY3(PUNPCKHQDQ, V,x, H,x, W,x, vex4 p_66 avx2_25= 6), - [0x6e] =3D X86_OP_ENTRY3(MOVD_to, V,x, None,None, E,y, vex5 mmx p_0= 0_66), /* wrong dest Vy on SDM! */ + [0x6e] =3D X86_OP_ENTRY3(MOVD_to, V,dq,None,None, E,y, vex5 mmx p_0= 0_66), /* wrong dest Vy on SDM! */ [0x6f] =3D X86_OP_GROUP0(0F6F), =20 [0x78] =3D X86_OP_GROUP0(0F78), --=20 2.52.0 From nobody Sat Jan 31 19:05:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1769506825; cv=none; d=zohomail.com; s=zohoarc; b=fLVE0l5H5BdL7U2P65KdmR/2Ef06Sv1oh/5W30qwcYacahAqRe7Lx1xmz6MbV65nten4A4T+yK9hks9nGyjAxHqH8TQgQqEE+mrNljj7hVdrWgjbPKyGT1tqj3GiaQvYMU8U4YoNs0wS1LktfkaZ9KSumyNDDWffC23rZsjldZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769506825; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Pi4LcsT4yM3F07gqORld+zxtNy2ZgUvhd+Za1U39so8=; b=YHh4YZdi8GK1mSYK/9hRLivki4DEDZdlSePOEs59r9XUDBl4gGoL7yxPDMYYcIUfi+nf33dYjITuva+Zh8MCTjChhhHFXZ1CdxJDXSZhReqyMD03OBqywjS0+A1zzRpMVUmqNhmpr+1eUQFPs53vwIuF/C8287lPWjYaeyQITsc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769506825354572.0660657479982; Tue, 27 Jan 2026 01:40:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkfXy-0000qQ-97; Tue, 27 Jan 2026 04:39:42 -0500 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 1vkfXp-0000i1-G7 for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:37 -0500 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 1vkfXo-0008VC-0l for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:33 -0500 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-88-XzN1yorkNN2D__TD74Kxew-1; Tue, 27 Jan 2026 04:39:28 -0500 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-432db1a9589so4066976f8f.0 for ; Tue, 27 Jan 2026 01:39:28 -0800 (PST) Received: from [192.168.10.48] ([151.61.26.160]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435b1c0179bsm36549337f8f.1.2026.01.27.01.39.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 01:39:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769506771; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pi4LcsT4yM3F07gqORld+zxtNy2ZgUvhd+Za1U39so8=; b=VKvIBvDCYzAbLiz/gX13436Akoju27wLm6MN1snEDdztmGChDPy4eY3jYw/zKLShU/um5l qukJym/AJclJOsE40BkGHH2fPuIHynJDLIlpoO3N0vFHkE0gXj5JCpR7xogOPGb1ZMkYeR glcUpXHDMYLntkltm3YLDwJdmEVZ888= X-MC-Unique: XzN1yorkNN2D__TD74Kxew-1 X-Mimecast-MFC-AGG-ID: XzN1yorkNN2D__TD74Kxew_1769506768 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769506767; x=1770111567; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Pi4LcsT4yM3F07gqORld+zxtNy2ZgUvhd+Za1U39so8=; b=PdYzVPBq8logTJ57ibXoDkJpXIalM6y3Ls8cy2FnjQaeRvLfKhvVVg89MWQXS4Daq/ FJXaxn0lEzf9Mfu0StiZaXhR/x7AdI5oriyWuhnAkDCpYua7wc+fq61w0v5Mvb0eH6pX u6KoWYpm95ried+oTB0EXIhotSPZJ9QfUcWIEAOwCF6WfRESAwwzNehIuHGQyoW/WmZM AaMm0ScUIoCYWOXhv780zKvumzx+3/vjgD2w9V6zDID3LuR+02YRZk4e36cf7WRwiQIb 76K5HwEE+EcaIZDt8jZwVS7jbao/25MpY+octorAPj6siPbVz/3zBjDsrPrRtwwEOp7o nROw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769506767; x=1770111567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Pi4LcsT4yM3F07gqORld+zxtNy2ZgUvhd+Za1U39so8=; b=PvveWTOvIMRVYyrAlksrfm7T+uiWHtuAWagyCrEUyPIfB8NeMwjywQ2XLqHEnTCuvn V9OqTZE1VZ9PglKBfCgUVeNujdiVrC70lx5Mqqr974C5PcfBDkdVXpTgjYzLWfcCC0/5 S7XdT9kchvFAb56742ED35eLFC9XRpwb+GA2IFOpKXUb2os5RIU+acEaMxJMO1hhoxc/ qLTJyEpI+fmWp+vp6Nwp74IkqklE1xNL+tz1C8VUbFl1WJuEQlyV1Fm9yv3qNGOyDSup nJ34roQKTn/0nCGB5nzr/MatZjXdDiXjWYPAvCiiRnsWZkyKNSP4b/fFJxtzpsXi+0fj i/AA== X-Gm-Message-State: AOJu0YwdaOlptz3fdPd+wS/KBJc1En/PO2irCJiOr8zoyhhOI3e04VmV E3vucBQk4oYahv3asCS0cIni8WBAJaVVMWJOcDO8L05JZGwtIzhLjZVXw2M5pQ8r/YmBHWzX0uT nwixQ9F2mJxsrXO7GsnXLZXVAWA4dELsdcO+1hw4RXDWWgxJVSetTYC+m6IOxNzIdTWstIOn4s+ vJMoPMRmmYQUJgoCJPMvR/YVNVBJfKWEDNcYxFS7aP X-Gm-Gg: AZuq6aL2b5L1tKmZF58wq/LcMNtlIbcQbvxfxiR8hwYyz168W+hYgNkAlmCWzaxTowg O4R8249aXFvNTziCP7flyiTqMnxe0oIulOj8TqwhXbG23GwLwCyBvx3gcEymp2rTQf0XyyQj/Io rwll920AjTr3rfBdt8Kvl6sStnKrTxVEWcvnPoEY1Og2JClotu/fmvo6sFNrmhsdS6ZXbiXVZdw kgzJ5oqdQRPB9eiW2ZyGOYd/+AI8ZL3m2qmDf53vblYrAtx7L7AsOCye9wSX3PxTjGDzL9rqLBQ dp69Jzdhm30J4F1CxEN6N4VPftaRA5g0o8U2J99ClMOjFJdyvAbiX1wyYcrqguDpO2eDFmMw7nE hOJfhlS+3zZ5WjF/Iv71cLo4nO/ylNS2afmyZBfj6rNwnMYOOHfv2/g6UHEtJ3FuUAaID7LGBIx qHCpshHNHd4uCleg== X-Received: by 2002:a05:6000:2388:b0:435:94dc:8c78 with SMTP id ffacd0b85a97d-435dd0bb30bmr1513921f8f.40.1769506766599; Tue, 27 Jan 2026 01:39:26 -0800 (PST) X-Received: by 2002:a05:6000:2388:b0:435:94dc:8c78 with SMTP id ffacd0b85a97d-435dd0bb30bmr1513874f8f.40.1769506765901; Tue, 27 Jan 2026 01:39:25 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 08/13] target/i386/tcg: fix typo in dpps/dppd instructions Date: Tue, 27 Jan 2026 10:39:01 +0100 Message-ID: <20260127093906.353741-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127093906.353741-1-pbonzini@redhat.com> References: <20260127093906.353741-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1769506827360154100 Content-Type: text/plain; charset="utf-8" Their gen_* functions were incorrectly named gen_VDDPS and gen_VDDPD. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.c.inc | 4 ++-- target/i386/tcg/emit.c.inc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.= c.inc index e44b92710cf..b00ea3e86e8 100644 --- a/target/i386/tcg/decode-new.c.inc +++ b/target/i386/tcg/decode-new.c.inc @@ -977,8 +977,8 @@ static const X86OpEntry opcodes_0F3A[256] =3D { [0x21] =3D X86_OP_GROUP0(VINSERTPS), [0x22] =3D X86_OP_ENTRY4(PINSR, V,dq, H,dq, E,y, vex5 cpuid(SSE4= 1) p_66), =20 - [0x40] =3D X86_OP_ENTRY4(VDDPS, V,x, H,x, W,x, vex2 cpuid(SSE4= 1) p_66), - [0x41] =3D X86_OP_ENTRY4(VDDPD, V,dq, H,dq, W,dq, vex2 cpuid(SSE4= 1) p_66), + [0x40] =3D X86_OP_ENTRY4(VDPPS, V,x, H,x, W,x, vex2 cpuid(SSE4= 1) p_66), + [0x41] =3D X86_OP_ENTRY4(VDPPD, V,dq, H,dq, W,dq, vex2 cpuid(SSE4= 1) p_66), [0x42] =3D X86_OP_ENTRY4(VMPSADBW, V,x, H,x, W,x, vex2 cpuid(SSE4= 1) avx2_256 p_66), [0x44] =3D X86_OP_ENTRY4(PCLMULQDQ, V,dq, H,dq, W,dq, vex4 cpuid(PCLM= ULQDQ) p_66), [0x46] =3D X86_OP_ENTRY4(VPERM2x128, V,qq, H,qq, W,qq, vex6 chk(W0) cp= uid(AVX2) p_66), diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index 639a1eb638f..f23c401189b 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -788,9 +788,9 @@ static void gen_##uname(DisasContext *s, X86DecodedInsn= *decode) BINARY_IMM_SSE(VBLENDPD, blendpd) BINARY_IMM_SSE(VBLENDPS, blendps) BINARY_IMM_SSE(VPBLENDW, pblendw) -BINARY_IMM_SSE(VDDPS, dpps) +BINARY_IMM_SSE(VDPPS, dpps) #define gen_helper_dppd_ymm NULL -BINARY_IMM_SSE(VDDPD, dppd) +BINARY_IMM_SSE(VDPPD, dppd) BINARY_IMM_SSE(VMPSADBW, mpsadbw) BINARY_IMM_SSE(PCLMULQDQ, pclmulqdq) =20 --=20 2.52.0 From nobody Sat Jan 31 19:05:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1769506933; cv=none; d=zohomail.com; s=zohoarc; b=UC4SI8wNl1BKGmMk7jIsikl1sIE20CC7oVU3VaF6YBoM6zgBtWPF89gZIHqUpnPOYzxjxV2F5vOLa/8QlmWMK8ncUuzRzGXwsKYpLtu7zyvmpHfFWBzNj6WolAOrgwjlGsLeq2Yo4mWyAUROK7H4TV9qje+QyIJPdMPJMwu6Drw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769506933; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UmJHKE5I0YRv95DN3YUVgWqrtxbewl3V2/cW1lBk0+U=; b=MqtQTKgsXn4HWZdSRmk4ws55EKd8U89WZDKkSo83QmJkPc8GeM05QG60KmPOu6SHrWXnNhAJBliuATx0Kp/qbigVct02mctTyBIAld5JaBB7EjjfG5y6HSQq7e+EBv9c6xjrzOsvz4PpnTz4KB4IH0nZ2O18G57yHHbIBILJrHg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769506932980929.7838919367018; Tue, 27 Jan 2026 01:42:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkfXy-0000ph-4A; Tue, 27 Jan 2026 04:39:42 -0500 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 1vkfXq-0000i2-Hu for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:38 -0500 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 1vkfXp-0008VI-1s for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:34 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-140-GsaY4VVlOsu4_5itx33LPQ-1; Tue, 27 Jan 2026 04:39:30 -0500 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-47edc79ff28so34167585e9.2 for ; Tue, 27 Jan 2026 01:39:30 -0800 (PST) Received: from [192.168.10.48] ([151.61.26.160]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48066beeaf9sm52796025e9.6.2026.01.27.01.39.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 01:39:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769506771; 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=UmJHKE5I0YRv95DN3YUVgWqrtxbewl3V2/cW1lBk0+U=; b=eqB+Cev38o83kW136afzq2gxjQjNRugjYdx0DjQnZKD6SRnQezz19ATNfHz1YjzTcqriU/ gSt7awTSeIb1SRWoknlg/MRHn25WDdQC/oFVxutwBxRP7Js/KVQTwuVGfE53whdSCnQuFJ kMMeQQ1PM2M266gob4WRrSY8MMQZ44Y= X-MC-Unique: GsaY4VVlOsu4_5itx33LPQ-1 X-Mimecast-MFC-AGG-ID: GsaY4VVlOsu4_5itx33LPQ_1769506769 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769506769; x=1770111569; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UmJHKE5I0YRv95DN3YUVgWqrtxbewl3V2/cW1lBk0+U=; b=fz7IjngYOynoMY6o5X6iyn0R2XD5uTnzyZC+tT/i7+ftF0197/trd2AYcf8ce3wtlY +wunysTR6by4a6wxPQQJxNntCNgWZScYV88jD3unKP1f+eYxnCuNNzwlkW3ec3/AsvjM dABvG8QI/Lp+Fk3CkxxD8fZO4gUCP7hQTS2+F7OJe13PyoMijZBufZwFAzGPbxiI4S79 21M8/d8w2xdRiLhWLH0GCspkqirQ2N6lwb7dNUF/gignMzG+TQrgAzyBiQ/amysBVWNR D+Zka2A+spKt2dRzYbzPg+I5nH1F08TldP/1YgxMBx/9Vx8kfmDuGy4gc8DRN9TCccpj 75Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769506769; x=1770111569; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UmJHKE5I0YRv95DN3YUVgWqrtxbewl3V2/cW1lBk0+U=; b=EIJeyicgWjuKU5mjZdLxGvYMe3r1JlPWkam6nuMVlRYgbdBbf5LLsJVsvFlG4fyiq4 U0bt+IaJScwphORkEaBZk/GLvvp+nnRhcvvQieb2k5RrqPZRhXUNgAoV4R/TNjWJvLvg OwPzqgiZPY2AsMDAjnOpE9b1W07eM6JZe3SF+XMgtz+KJFya1zkELnPl1YJTrDl2ca4a JY9Zlc4ORz1s47mYDpWTC5gF9PTo1h6xFzoWclK2hOQYZeP/jVXdH0Z8oWU7VdX6Ioqc k4HNQq2cFBggUoeZoWBs0pyS8g3cn8hnC/pqUgi4Bv62c2jMjGPfEiuIngrGrncGfLhN txjQ== X-Gm-Message-State: AOJu0YzfUt1RFElup0s2yWQ2p1jWkIR5scTnc7YVgP6pUAdT4/CHt8NN WoPcbYosq/P3Kjwtr2/STp44eGqwTKLUyiqqjJuovpknCaHPF73ojdwEMbK0MhTFJXJ1WNctPrm tReKBidm/kJR9xzhYhTSFQyyni5ybx8KJCujAg/Se5vuJ7m+OGtLEzZ7rZX60YoFJ0RofZGMKDX 2SXRHahDOMl/f0FwiqZBdhbgngV7ayJ6eZK1epvwWg X-Gm-Gg: AZuq6aLk8aWmWc5E7DmH35rRp/ehl5kKy0k8AtbvaJDa55+EF91WHht6+a4LSmOhBzb hik83GOEPqrxhgSO85MlCYp9cMYwiKDPqlgNpRH1mHualBshq4y3YuJXRODDL6Cau8eILR3pilm Wxwzl9mnCp9+XG2KmIjl5wClnZibqXHfIZHA0Kril8o2WLtYT/84ISCBl2SsxSrkaY9s086ny6B Lq6r1wThdbrjBLkyCSf2R3cuCjV2tTVuuAykX5E0lQIEDgglUzTA8RemGxT6qsEmP3mlOijJq+9 18iON9XSw4lRh4btrkACld/NhGD00N1kzp5i+ZBooQ/xiWamkLeqmWRWB6qGnLKmEhHe3yNlfsL iLGnsm54Mb9RHutTYlnHoeUMgwvniKk4p7sZLYrHoGghanfzfdnPSTtj/Htbf6BqGXA70kI+els O6OkHUU0tZUkDSWg== X-Received: by 2002:a05:600c:1992:b0:47f:f952:d207 with SMTP id 5b1f17b1804b1-48069c487a1mr13709595e9.19.1769506768829; Tue, 27 Jan 2026 01:39:28 -0800 (PST) X-Received: by 2002:a05:600c:1992:b0:47f:f952:d207 with SMTP id 5b1f17b1804b1-48069c487a1mr13709335e9.19.1769506768360; Tue, 27 Jan 2026 01:39:28 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 09/13] target/i386/tcg: remove dead constants Date: Tue, 27 Jan 2026 10:39:02 +0100 Message-ID: <20260127093906.353741-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127093906.353741-1-pbonzini@redhat.com> References: <20260127093906.353741-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1769506935067158500 NB_OP_SIZES has been dead since the conversion to TCG, REG_L_OFFSET since 2015, the others somewhere in the middle. Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 460848e4223..20aa94347b0 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -374,30 +374,6 @@ static void gen_update_cc_op(DisasContext *s) } } =20 -#ifdef TARGET_X86_64 - -#define NB_OP_SIZES 4 - -#else /* !TARGET_X86_64 */ - -#define NB_OP_SIZES 3 - -#endif /* !TARGET_X86_64 */ - -#if HOST_BIG_ENDIAN -#define REG_B_OFFSET (sizeof(target_ulong) - 1) -#define REG_H_OFFSET (sizeof(target_ulong) - 2) -#define REG_W_OFFSET (sizeof(target_ulong) - 2) -#define REG_L_OFFSET (sizeof(target_ulong) - 4) -#define REG_LH_OFFSET (sizeof(target_ulong) - 8) -#else -#define REG_B_OFFSET 0 -#define REG_H_OFFSET 1 -#define REG_W_OFFSET 0 -#define REG_L_OFFSET 0 -#define REG_LH_OFFSET 4 -#endif - /* In instruction encodings for byte register accesses the * register number usually indicates "low 8 bits of register N"; * however there are some special cases where N 4..7 indicates --=20 2.52.0 From nobody Sat Jan 31 19:05:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1769506916; cv=none; d=zohomail.com; s=zohoarc; b=S7i9mwi82Tf9/xmIUVb0tOXcek1etMduiOIiX1JmSQQiypcJdMNU/pWue/kUci4kXgVIv/smLxkS9EvCNmFU66wVRN5zFKtktLuTJYbQnEc3tmyynxc1oQL7Jca6msaHFmaf7TZdcAfhax02kXrssVJuqdQy84yTg1AgaXs0fwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769506916; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ri0PpFxdGtvnr5kIAuaORUQH3My73OqYc8urlNvvvtw=; b=lIMh3zAjsZ+C1Br6Ju+kVHEIAM6OkQkR+JPW6j7NXFnaSKeFknYYPiIPcUuzceJqbiZG6dgkbehJSc/2Km+rWc15PQmqcIBeO0W43xQVRJQYi0eXp/+wtHoARkCy0FqBhqISAdbO9vjfwkS3+XahFNl/vpg2BTqILdqJ1T/DXp8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769506916563602.6980165009404; Tue, 27 Jan 2026 01:41:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkfXx-0000oo-3M; Tue, 27 Jan 2026 04:39:41 -0500 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 1vkfXs-0000iv-Vp for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:38 -0500 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 1vkfXr-0008Vj-1E for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:36 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-441-OLTc_dB1PEaR7qcozXtwwQ-1; Tue, 27 Jan 2026 04:39:32 -0500 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-47edfdc6c1aso39622685e9.3 for ; Tue, 27 Jan 2026 01:39:32 -0800 (PST) Received: from [192.168.10.48] ([151.61.26.160]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48066bee7d0sm49719565e9.4.2026.01.27.01.39.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 01:39:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769506774; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ri0PpFxdGtvnr5kIAuaORUQH3My73OqYc8urlNvvvtw=; b=HjlR6X0wtg8cknHbxQRwdPpREgqgXzLlxF7poN0woAlm3ifS4dQrLREjkw4s9BFk397+P7 kHrjF4TGFc+BXYktdYcHoPzenR2hZfHN/W7GtCeop3AaG0W84bdk31EOBTuBNA0gfIDyUn Mn0kgQpLW/fylL4fytXQPuPtZeQo/DY= X-MC-Unique: OLTc_dB1PEaR7qcozXtwwQ-1 X-Mimecast-MFC-AGG-ID: OLTc_dB1PEaR7qcozXtwwQ_1769506772 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769506771; x=1770111571; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ri0PpFxdGtvnr5kIAuaORUQH3My73OqYc8urlNvvvtw=; b=crnCvOPtGEtVz/SOtvWBmbfoVA70lCBrgUKwsdB45M7a8jx5pdsLyE2BKrfLql1gFk 7yGIezh4T3c/FQxDohHpv86TkukKRCR3apnMtn95w/wo/IRi1FVjexGvzuk1Oq/VdcYv 0UTC5CqeIWeA2aC8ztJbvW27/5eVJXDBJEBmjR4kSfsVcgYerx1svsVMVrvM/13s/20A SuIZ6cK3pXEdV/jPMPIKJNYLkRD5IsWfh+eIeSWCUuD9xGeSH1OqZkSDUY5im5dDOsOY u6/FkEnAtoo07aePC+k7eyyDjZsNxGZnX7Lj8sADU5XIZ06CgW0cTjMX8feY1hHEEPWp RRlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769506771; x=1770111571; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ri0PpFxdGtvnr5kIAuaORUQH3My73OqYc8urlNvvvtw=; b=hvJ0FsqbitzYv0aGqU9/8OE80wmOhtoX0TO4DoG1L+SEWyanTXIAg9sV9X/TQyCnhP aIAP6TSCu3YShpegL+lbl40xyXEiYDv7Vpthvk/sqeDXiC5D4qtac1vCfP1hceY3+cB6 aAzFPBH9Hq0eE/VXXBhee+uPHFx9NuirxH16D3AxyEhE2CuNfAUL4Qjtet3m/1pzNBIe w0m2oBGONNctktrxMJy78lv4joNb0+zasibwOVIc57fJxvdr+uH5O2NR56KYPQ77eFUI VcaAWEi9l/E3s+Zb4a6MQnfrfp194mEv9RGWkyhSEUtfA+W7xPpcfvDprDdnDin2mlxU dnKg== X-Gm-Message-State: AOJu0YzyYC9HNuG7EZ0GLkjZeEm8AnYc4n/vwfuA8MnH1+3rJM6rhjXi hgD/wuB8UKZ82Y9mP1ZUJ6g9W2t2TGjHz5ZPBVQtqY6CdAVf2D2lZst83VOsLu3LeRcsPveeHnH odGjcWvzbWOd69gMByYE8k/aRQKhkx+KhNWWSNBoU28OfLo09zBlt+UPtxAQjQxrUuyVd0LmFVM MeWqBBrpv8oOvi4Zvr+GmzoYUsYRq5cOrd5uAH1iAV X-Gm-Gg: AZuq6aIpvXH1b1opAc6vu9Jp0EAKJoP+XG0+Rk6KdzGSX2S0LBcvGkofHrMV9t6B78o B3zdtzAiq8RUApvyEN8GLw4aoec8Mdf6aJIzqjWbeLwO0Mt+0g8Q/ZWk70RPgFVGMqCQH5Iv6xj TovK+GMbEZKPKauYEfRMBC1YPz76+Y4dJdcBbqurqsXm/kMXODKKSJAGPjtDrZ4J7zSVW0pUfz1 ySy9VoSy3pKxN6Mv2c0cgv06UkhPaXxT4VaVkGMKWULu4baoH+yBgPnKQilT2yDVJWA796PxybX SRu5nIM5BvHRtj6gEdA0yB2aUDdfKMmqzD+K698ls4tMcXCBdqTEx2tnbS8wICuh/bDAQmrBYBA C8bEU0aUsbjoMAx8WKDw1itBQ6HnN9KYshl6idxg9QwflUD1QFIBKH7CA775omcylDB2OGzruJ8 dviCLHFluCSwoSDw== X-Received: by 2002:a05:600c:1c17:b0:480:462e:d640 with SMTP id 5b1f17b1804b1-48069c7f78cmr15505465e9.36.1769506771176; Tue, 27 Jan 2026 01:39:31 -0800 (PST) X-Received: by 2002:a05:600c:1c17:b0:480:462e:d640 with SMTP id 5b1f17b1804b1-48069c7f78cmr15505175e9.36.1769506770660; Tue, 27 Jan 2026 01:39:30 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 10/13] target/i386/tcg: merge decode_modrm and decode_modrm_address split Date: Tue, 27 Jan 2026 10:39:03 +0100 Message-ID: <20260127093906.353741-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127093906.353741-1-pbonzini@redhat.com> References: <20260127093906.353741-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1769506919074158500 Content-Type: text/plain; charset="utf-8" Unlike the older code in translate.c, mod=3D11b *is* filtered out earlier by decode_modrm, and it would have returned bogus code. Since the register case is so simple, just inline decode_modrm_address into its caller instead of removing the "if". Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.c.inc | 64 ++++++++++++-------------------- 1 file changed, 24 insertions(+), 40 deletions(-) diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.= c.inc index b00ea3e86e8..662d1d707d0 100644 --- a/target/i386/tcg/decode-new.c.inc +++ b/target/i386/tcg/decode-new.c.inc @@ -2007,33 +2007,34 @@ static void decode_root(DisasContext *s, CPUX86Stat= e *env, X86OpEntry *entry, ui *entry =3D opcodes_root[*b]; } =20 -/* Decompose an address. */ -static AddressParts decode_modrm_address(CPUX86State *env, DisasContext *s, - int modrm, bool is_vsib) +/* Decode the MODRM and SIB bytes into a register or memory operand. */ +static void decode_modrm(DisasContext *s, CPUX86State *env, + X86DecodedInsn *decode, X86DecodedOp *op) { - int def_seg, base, index, scale, mod, rm; - target_long disp; - bool havesib; - - def_seg =3D R_DS; - index =3D -1; - scale =3D 0; - disp =3D 0; - - mod =3D (modrm >> 6) & 3; - rm =3D modrm & 7; - base =3D rm | REX_B(s); + int modrm =3D get_modrm(s, env); + int mod =3D (modrm >> 6) & 3; + int rm =3D modrm & 7; + bool is_vsib =3D decode->e.vex_class =3D=3D 12; + bool havesib =3D false; =20 if (mod =3D=3D 3) { - /* Normally filtered out earlier, but including this path - simplifies multi-byte nop, as well as bndcl, bndcu, bndcn. */ - goto done; + op->n =3D rm; + if (op->unit !=3D X86_OP_MMX) { + op->n |=3D REX_B(s); + } + return; } =20 + /* Decompose an address. */ + int def_seg =3D R_DS; + int base =3D rm | REX_B(s); + int index =3D -1; + int scale =3D 0; + target_ulong disp =3D 0; + switch (s->aflag) { case MO_64: case MO_32: - havesib =3D 0; if (rm =3D=3D 4) { int code =3D x86_ldub_code(env, s); scale =3D (code >> 6) & 3; @@ -2042,7 +2043,7 @@ static AddressParts decode_modrm_address(CPUX86State = *env, DisasContext *s, index =3D -1; /* no index */ } base =3D (code & 7) | REX_B(s); - havesib =3D 1; + havesib =3D true; } =20 switch (mod) { @@ -2127,26 +2128,9 @@ static AddressParts decode_modrm_address(CPUX86State= *env, DisasContext *s, g_assert_not_reached(); } =20 - done: - return (AddressParts){ def_seg, base, index, scale, disp }; -} - -static int decode_modrm(DisasContext *s, CPUX86State *env, - X86DecodedInsn *decode, X86DecodedOp *op) -{ - int modrm =3D get_modrm(s, env); - if ((modrm >> 6) =3D=3D 3) { - op->n =3D (modrm & 7); - if (op->unit !=3D X86_OP_MMX) { - op->n |=3D REX_B(s); - } - } else { - op->has_ea =3D true; - op->n =3D -1; - decode->mem =3D decode_modrm_address(env, s, get_modrm(s, env), - decode->e.vex_class =3D=3D 12); - } - return modrm; + op->has_ea =3D true; + op->n =3D -1; + decode->mem =3D (AddressParts){ def_seg, base, index, scale, disp }; } =20 static bool decode_op_size(DisasContext *s, X86OpEntry *e, X86OpSize size,= MemOp *ot) --=20 2.52.0 From nobody Sat Jan 31 19:05:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1769506790; cv=none; d=zohomail.com; s=zohoarc; b=BjP5JWH6gJjZcxlU6SGODZHXGh+DhwqsLFwxHx4gws7tN5bW63glZm9QlEmfn4hoDj0qzGF6KqjQnDFt1Nqw/3A5gMzMnrAekRTCCuE6IwRwOqT1C4mdnCjPiBj71OoSsfmKYoVa2ZHEqs9iLCFOOf5HuK1BH+VOOVL5FPnDh/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769506790; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jrVgQW/kqSWhVYiXeyV6SFlSSylxz1IDdjlWD4x2rHo=; b=W8IpKb0T0H0yAAifyhV2izJVTfsVtrCV3y0lR+XGCerolmUnK/XnuFDFFCamtNyMlghJbLSk6+ZzD+5qr950CtNxFXowj6V09N154FQZCLLNs2MV0QKg3KZMPSAZQife65Gd5n29Jxt4k4P8ulA804HmZcyK5PCHFffprKptTjU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769506790673909.7171045910428; Tue, 27 Jan 2026 01:39:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkfY1-00011i-Vd; Tue, 27 Jan 2026 04:39:45 -0500 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 1vkfXx-0000ox-Al for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:41 -0500 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 1vkfXv-00004s-Sn for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:41 -0500 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-306-Ps8EGjdmM8OWqfGpPktH-Q-1; Tue, 27 Jan 2026 04:39:35 -0500 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-434302283dcso4796391f8f.0 for ; Tue, 27 Jan 2026 01:39:35 -0800 (PST) Received: from [192.168.10.48] ([151.61.26.160]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435b1e71503sm40880291f8f.25.2026.01.27.01.39.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 01:39:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769506779; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jrVgQW/kqSWhVYiXeyV6SFlSSylxz1IDdjlWD4x2rHo=; b=HlHn+Aojk/5yd1R8Ly4VkvJelUehbASbC0w4P3TwG11kygFl5P2PcGoKlYG/+/rD/1pfdD 9P/BcwdWfTY1vvAVYm7GSomIdcL7sBPlK8U76MweW024VvP3PlMe7XZp7/bMfiIbZpz7Y6 tmp23pK2nU/cwBCK5JmH/sOrwpTQhnw= X-MC-Unique: Ps8EGjdmM8OWqfGpPktH-Q-1 X-Mimecast-MFC-AGG-ID: Ps8EGjdmM8OWqfGpPktH-Q_1769506774 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769506773; x=1770111573; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jrVgQW/kqSWhVYiXeyV6SFlSSylxz1IDdjlWD4x2rHo=; b=fMqov84T8ycUhHB+H4dXR3d37ajSQKsgRd9Qz3SQsA7KJF1gdo4FUWM2daDnF048U6 SRttckLhStx6wwjyumTH+Zrq9wNuEXqkCx+alQf7ym8kSAw/FFtsdL5e7LszhHl9tpld wX7uyDsTgQhqWpniBG7MN9IvCQk6hWwZiRnLrUEKu04c+FYxPqql4pNkwcy9SxDl/1md pwP2UBbEZS4Df74UvltSBr44Iv+Pdf2+EzB5L8buf24Ki/1kZeEm1h9UMqceq9L6Q7iI LWu+dDRSez5lAaI95MOcfCnX/kFIIYMHL0k1RdAAyZWOhkmyn+FR1659NxV+nrdcSEO2 qlNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769506773; x=1770111573; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=jrVgQW/kqSWhVYiXeyV6SFlSSylxz1IDdjlWD4x2rHo=; b=gG09x2N7qdUs9xrDFXuyYg3jmb+JTkny5F/XG5ZY4mTKNp8McYmg/DOAI1kis6LTSs LIao+vuESYMUyD0zRmqgAHpJyi64s+7WEvcDnLVT6A1mUdU2jWvO+Gaqb6h1GKx2qOoD 5JpPhQL1W5FVnMkQDhsQBWJfI0VJTOgaU5kq8uTadeMZDRoZpguaELckM2bmPjY46ttE W5AWkcReUGG2rCcdsSuuANQdt9SnOgBF/q7YihJy3Jy6LGTE6Mj0BIKwbdXBBSAT7noZ A/6ThNHnBVJVpUvmNIQGAQnBp+0oATxbHprvb0Khi9v1FDgpLwZGrRKXAUtUP5xVBY1B Tweg== X-Gm-Message-State: AOJu0YzYsN4O+f51LpVPh4xXzt5wJtP7JLuxll7KYo4rhGrpi2hOfTdr TN6dG3hZyCh3k2jaRknUSrtbowPUIwhXwaDh2Ce98SWpzxCCQXwfCLqJNP2DheV9NqibonSgUrG MmAYoenL8ysM53yy/4eiDneYcQ2EB68sCh/rh2SqSs2rFUsxSBgkVck66FG97tmHx1EWJI5V1CH ALTSx+XngYLe10ZxtwFXP5lgPiHqMLIzXRrlo3iG/4 X-Gm-Gg: AZuq6aJGubR2PDf1ErwzsKrwl/8c4RXrIx+q0B1E6AImaf9LXkqOu9ToWpmYiDvz87u tpyn0LUJl+nKPDEa4za3ttXXbUKglHeMxL8UY4rr7perhdzcjsRRFLhRNIqifZSBm2aSWjO9uuL MVWpF4/xZa3Oyv0k51uDVMG8ucxrVRdSYiQ1VZvN8W553x75nQLNkrsFiUA01dq/6zZLvtkDPcN Z8xTaBsIsZUVEfmV1WRvAHJFwkWvhzxZO+orn/QU/dRWBz+X8JnzFuKur5GuLPo6T0UKLGRa/9F 0yAnP3YqRVftm/ZZM9h7bi8oPY0F6MeuNQUmoLbOYQWsa60il5bIgFoDHARoiWEwX9yAglfYdvi rCeg9NQ0swH8EM86HRx/6u4FwRuEE4f7vs1ZxtafCjwmJvKE52elu4C57HOo6VGHih+vXXo5PvK 7hO4CTy78iGvbNwA== X-Received: by 2002:a05:6000:2508:b0:435:ae10:cf92 with SMTP id ffacd0b85a97d-435dd02bca1mr1428804f8f.8.1769506773173; Tue, 27 Jan 2026 01:39:33 -0800 (PST) X-Received: by 2002:a05:6000:2508:b0:435:ae10:cf92 with SMTP id ffacd0b85a97d-435dd02bca1mr1428762f8f.8.1769506772628; Tue, 27 Jan 2026 01:39:32 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 11/13] target/i386/tcg: replace havesib variable with the SIB byte itself Date: Tue, 27 Jan 2026 10:39:04 +0100 Message-ID: <20260127093906.353741-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127093906.353741-1-pbonzini@redhat.com> References: <20260127093906.353741-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1769506792842154100 Content-Type: text/plain; charset="utf-8" Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.c.inc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.= c.inc index 662d1d707d0..086a3bcec18 100644 --- a/target/i386/tcg/decode-new.c.inc +++ b/target/i386/tcg/decode-new.c.inc @@ -2015,7 +2015,7 @@ static void decode_modrm(DisasContext *s, CPUX86State= *env, int mod =3D (modrm >> 6) & 3; int rm =3D modrm & 7; bool is_vsib =3D decode->e.vex_class =3D=3D 12; - bool havesib =3D false; + int sib =3D -1; =20 if (mod =3D=3D 3) { op->n =3D rm; @@ -2036,14 +2036,13 @@ static void decode_modrm(DisasContext *s, CPUX86Sta= te *env, case MO_64: case MO_32: if (rm =3D=3D 4) { - int code =3D x86_ldub_code(env, s); - scale =3D (code >> 6) & 3; - index =3D ((code >> 3) & 7) | REX_X(s); + sib =3D x86_ldub_code(env, s); + scale =3D (sib >> 6) & 3; + index =3D ((sib >> 3) & 7) | REX_X(s); if (index =3D=3D 4 && !is_vsib) { index =3D -1; /* no index */ } - base =3D (code & 7) | REX_B(s); - havesib =3D true; + base =3D (sib & 7) | REX_B(s); } =20 switch (mod) { @@ -2051,7 +2050,7 @@ static void decode_modrm(DisasContext *s, CPUX86State= *env, if ((base & 7) =3D=3D 5) { base =3D -1; disp =3D (int32_t)x86_ldl_code(env, s); - if (CODE64(s) && !havesib) { + if (CODE64(s) && sib =3D=3D -1) { base =3D -2; disp +=3D s->pc + s->rip_offset; } --=20 2.52.0 From nobody Sat Jan 31 19:05:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1769506817; cv=none; d=zohomail.com; s=zohoarc; b=K4E8sblC5WUyhrsMTeggcFKzVuty/4C3WTiPaYuLNXyRCTrBrYMKansYNK8gEM5Vm7I8yN+MJBkGLa/ea0Y4RKiudGpwGtD35ZL8piArnW5Ayjc0s0Ixlvki0xxDun/3jsL4hzJ31W/eBlAyj91vsH0lhetu6DXuHh4+6ADtNCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769506817; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lmfFVbcWrJT9uS49KjY7zFbZY9+4XrAi7p8S+g1LodY=; b=dbvZ136Cntmge8NsuXP+fULW65BDyVwluuLi9dfQJtZpW4wO1QFueQGuszSuqUqRIuopiREfm82aux3kU8INeYPDn+vY1N/m/QpQNkUomWxYl3TM16+Xl4hpDEsbBGKjHbu/eHMCKR1hcDMiT0K8Pm0R6VQA8W57/6v09LkwGhQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176950681747113.409406782797873; Tue, 27 Jan 2026 01:40:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkfYA-0001Cb-6F; Tue, 27 Jan 2026 04:39:54 -0500 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 1vkfXy-0000qY-7W for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:42 -0500 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 1vkfXw-000055-LA for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:41 -0500 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-438-OorYdARFM7KWmbBDEWDqtA-1; Tue, 27 Jan 2026 04:39:38 -0500 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-435add03f12so2500902f8f.3 for ; Tue, 27 Jan 2026 01:39:38 -0800 (PST) Received: from [192.168.10.48] ([151.61.26.160]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435b1f74b15sm36627493f8f.35.2026.01.27.01.39.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 01:39:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769506780; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lmfFVbcWrJT9uS49KjY7zFbZY9+4XrAi7p8S+g1LodY=; b=cyb8JmdWLp6Xh57TQIhr3bWqaE7Ljnn6jSxkBdeqS+mqNYmg8XDHEOTKoXm3Fw0HzhxSNS in6g4pmcsmkDFl0IUQdijlnh3+zOBoPhs0NDOxjtxfCzglNsxpySyDU4VxYAwtnyx22naE phVH2SvOorpE2ti2EubQUvQl1vs7v58= X-MC-Unique: OorYdARFM7KWmbBDEWDqtA-1 X-Mimecast-MFC-AGG-ID: OorYdARFM7KWmbBDEWDqtA_1769506777 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769506776; x=1770111576; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lmfFVbcWrJT9uS49KjY7zFbZY9+4XrAi7p8S+g1LodY=; b=DKhhvvBew9i/fFgmyWyj+anh2x1C06shVykWsQdn5L4j1DWUT8a+zNgXNNux92Tu/+ naAItv9f4An6E0darHRL4qWiL0JqqxwCEHde0OTfyhwZBoDS/XrLgFnCkW1KAbr+GkzP ivUe+C+WwxsB0jtPWAozieLnz2a4iw9Z+h00pqqdm3OrfYAI1e4elQ25N/CzjLG6ZAth KDrpPiRcARvZ5yiIb4wSqe1r8b+/TIE64ttCA2f55FRaVCxhTQLUCRzTGBSsW2MlYau0 JsP83R6a3zyOMgC6AiXs2lG0X+O5hjcVAIMo/aSQyRaE7DFUmrvjSmgnPThBQuL/7izK f2dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769506776; x=1770111576; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=lmfFVbcWrJT9uS49KjY7zFbZY9+4XrAi7p8S+g1LodY=; b=WvJXR0NrbEqMOgN3kLAYBfCuWzjb20WjOEf0RYst9q4ikzok9oiIBaHfEgicIhUjBG IblhWmF5eeY/qINGgnb+Ug977C+tlmisFKP7mtqfXXnpCJPp7m5DqMTh8JDwvID3bYXB HvANFhGL6aYJnYDfoSvke9lVSnfJ7O9tfeFwWsNV6yjwtXyHFXf362vBQvYF3Uyms8Su poWFFspvAhPs3o6Mz+PPSs9RNVOnpYnPm3pzi7BZ/10caSh1ldt7+xqxsFtEPc84svmb qTPdTVXvj0+ueyc8NK6ZoGKGrmKRt7YI/t7tIQ5k6U5qp/k6IgublcCeIBNh0PRDpdon 7nIg== X-Gm-Message-State: AOJu0YzkFGtNVaTe62bo2M2wwrt7jy886KbEOBA3G095YyBYjM1trnWN lUqD5OtCcXLwViTooOR0pGE2je2Y7PPVWerYBm1eESqa795mk/pFhvkDUYmwMaerHh6axB1Lsuy QPPua6REz1LrnoQdZRFEe5zisHcs9qEHlxzi2CmLR/HzSL/n+a6uy/uwv/ecQfgtq/iY52cM+I7 hN9qRcDYJQTKPW1tNUQEHHQ4DWf53H4sxGCaplJ/pj X-Gm-Gg: AZuq6aJP5Mz44vfGvm+tDeFOu4gLenjScM1Zjl5p+ulTV1dTzDmH8tvWfziIV7jhMg4 ZYhC1bkk4h76MRzN0t/aPgw8bb+RWQisU6BontuBTMTDFwokdBQ0bJZ1qZeXtc9G92CLqsW++Ql YkvLjDY5kva5Gh+AvfvYS79aPy32Ro0Yq1G2Vs77jTQ0CAV3pAYpqH22XQy7sa4UeoZlUF6u2Xv XklQVGiMqUNW2uDHWEX+ieeEucuE41qAxDjG0kEEMUteJFEjbOvVJhyAWzFYULbKH5pLgdd7TfB QcarpRV0QaWflATj/Up1SjWanlZ9bEwV1kpe0anjeoNUOVMVfIdMbRpQysJh1iOgWY1GqeL6XFi mLD0SFDZW1J6ThHcJeEuuA/BsaBiYxmFALEX+R5kt0za7ioidi4moYX3Qw0PGnTEc/W7FWvbfTy TmA3cbaahfqchUyQ== X-Received: by 2002:a05:6000:40ce:b0:435:a59c:c33e with SMTP id ffacd0b85a97d-435dd1d85bdmr1458893f8f.60.1769506775902; Tue, 27 Jan 2026 01:39:35 -0800 (PST) X-Received: by 2002:a05:6000:40ce:b0:435:a59c:c33e with SMTP id ffacd0b85a97d-435dd1d85bdmr1458841f8f.60.1769506775317; Tue, 27 Jan 2026 01:39:35 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 12/13] target/i386/tcg: cleanup #ifdef TARGET_X86_64 Date: Tue, 27 Jan 2026 10:39:05 +0100 Message-ID: <20260127093906.353741-13-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127093906.353741-1-pbonzini@redhat.com> References: <20260127093906.353741-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1769506819225154100 Content-Type: text/plain; charset="utf-8" 32-bit TCG opcodes produced for the i386 target usually looks the same as 64-bit TCG opcodes produced for the x86_64. The special one that needs extensions is 32-bit TCG opcodes produced for the x86_64 target. Make all #ifdefs look the same, like this: case MO_32: #ifdef TARGET_X86_64 /* code using 32-bit opcodes */ case MO_64: #endif /* code using target_long opcodes */ default: g_assert_not_reached(); Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 11 ++++++----- target/i386/tcg/emit.c.inc | 18 ++++++++++++------ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 20aa94347b0..7186517239c 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -430,17 +430,15 @@ static TCGv gen_op_deposit_reg_v(DisasContext *s, Mem= Op ot, int reg, TCGv dest, tcg_gen_deposit_tl(dest, cpu_regs[reg], t0, 0, 16); break; case MO_32: - /* For x86_64, this sets the higher half of register to zero. - For i386, this is equivalent to a mov. */ +#ifdef TARGET_X86_64 dest =3D dest ? dest : cpu_regs[reg]; tcg_gen_ext32u_tl(dest, t0); break; -#ifdef TARGET_X86_64 case MO_64: +#endif dest =3D dest ? dest : cpu_regs[reg]; tcg_gen_mov_tl(dest, t0); break; -#endif default: g_assert_not_reached(); } @@ -1585,8 +1583,8 @@ static TCGv gen_shiftd_rm_T1(DisasContext *s, MemOp o= t, tcg_gen_shri_i64(s->T0, s->T0, 32); } break; + case MO_64: #endif - default: hishift =3D tcg_temp_new(); tcg_gen_subi_tl(tmp, count, 1); if (is_right) { @@ -1615,6 +1613,9 @@ static TCGv gen_shiftd_rm_T1(DisasContext *s, MemOp o= t, tcg_constant_tl(0), s->T1); tcg_gen_or_tl(s->T0, s->T0, s->T1); break; + + default: + g_assert_not_reached(); } =20 return cc_src; diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index f23c401189b..ce636b6c56c 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -1236,8 +1236,8 @@ static void gen_ADCOX(DisasContext *s, X86DecodedInsn= *decode, int cc_op) } =20 switch (ot) { -#ifdef TARGET_X86_64 case MO_32: +#ifdef TARGET_X86_64 /* If TL is 64-bit just do everything in 64-bit arithmetic. */ tcg_gen_ext32u_tl(s->T0, s->T0); tcg_gen_ext32u_tl(s->T1, s->T1); @@ -1245,12 +1245,16 @@ static void gen_ADCOX(DisasContext *s, X86DecodedIn= sn *decode, int cc_op) tcg_gen_add_i64(s->T0, s->T0, carry_in); tcg_gen_shri_i64(*carry_out, s->T0, 32); break; + + case MO_64: #endif - default: zero =3D tcg_constant_tl(0); tcg_gen_add2_tl(s->T0, *carry_out, s->T0, zero, carry_in, zero); tcg_gen_add2_tl(s->T0, *carry_out, s->T0, *carry_out, s->T1, zero); break; + + default: + g_assert_not_reached(); } } =20 @@ -1991,7 +1995,6 @@ static void gen_DIV(DisasContext *s, X86DecodedInsn *= decode) case MO_16: gen_helper_divw_AX(tcg_env, s->T0); break; - default: case MO_32: gen_helper_divl_EAX(tcg_env, s->T0); break; @@ -2000,6 +2003,8 @@ static void gen_DIV(DisasContext *s, X86DecodedInsn *= decode) gen_helper_divq_EAX(tcg_env, s->T0); break; #endif + default: + g_assert_not_reached(); } } =20 @@ -2065,7 +2070,6 @@ static void gen_IDIV(DisasContext *s, X86DecodedInsn = *decode) case MO_16: gen_helper_idivw_AX(tcg_env, s->T0); break; - default: case MO_32: gen_helper_idivl_EAX(tcg_env, s->T0); break; @@ -2074,6 +2078,8 @@ static void gen_IDIV(DisasContext *s, X86DecodedInsn = *decode) gen_helper_idivq_EAX(tcg_env, s->T0); break; #endif + default: + g_assert_not_reached(); } } =20 @@ -2876,7 +2882,7 @@ static inline void gen_pextr(DisasContext *s, X86Deco= dedInsn *decode, MemOp ot) tcg_gen_ld_tl(s->T0, tcg_env, vector_elem_offset(&decode->op[1], o= t, val)); break; default: - abort(); + g_assert_not_reached(); } } =20 @@ -2923,7 +2929,7 @@ static inline void gen_pinsr(DisasContext *s, X86Deco= dedInsn *decode, MemOp ot) tcg_gen_st_tl(s->T1, tcg_env, vector_elem_offset(&decode->op[0], o= t, val)); break; default: - abort(); + g_assert_not_reached(); } } =20 --=20 2.52.0 From nobody Sat Jan 31 19:05:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1769506806; cv=none; d=zohomail.com; s=zohoarc; b=nKYJXI1njSrRs1YTOQz7VlaKUr9StiWjTIf8schRpLyKGaJgsVy+zvdr11PyJuMEVISSCpNP3pjYR+yP4iHswyXMYNovLMEhUbaLqlzSDrgLigGqs1HcBt8uE8FbOiFQf67dUBPcX5Yq1/eBVnaTawxsKwiOx5VH2/KsvuO/dVo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769506806; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5cYofKArb7TT3IJb8VWVnq10rniZyiKo5QV+1i+5V00=; b=ZvVdRdGhIgXgnajYOE+dyUWcZOo0hAV2J2yVdQdbEzt8QMwkMwftLxrjldnFfeZGoq+mvxOxYnPhOCnhCIoFiDMmZPafsnE5oRnPOGxVs1lr2jxPS1ydZQHQpAA4xvUtwdKtQaIt6wrNpG5dOVAeUlwswpJGll/is+PUf6kufXQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769506806563985.8632142932596; Tue, 27 Jan 2026 01:40:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkfY3-00013I-Ve; Tue, 27 Jan 2026 04:39:49 -0500 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 1vkfXz-0000uL-EZ for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:43 -0500 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 1vkfXx-00005G-TR for qemu-devel@nongnu.org; Tue, 27 Jan 2026 04:39:43 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-422-ltl8jazHPQ-jFJgCnKU1ng-1; Tue, 27 Jan 2026 04:39:39 -0500 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-47d4029340aso71007995e9.3 for ; Tue, 27 Jan 2026 01:39:39 -0800 (PST) Received: from [192.168.10.48] ([151.61.26.160]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4804d3ab9a7sm136288845e9.0.2026.01.27.01.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 01:39:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769506781; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5cYofKArb7TT3IJb8VWVnq10rniZyiKo5QV+1i+5V00=; b=DQsUfQgYveGT58KRHbSB9t7rA5kwAqOhAMyJAM2aEn0NGZb2/RupbfxdusFkh162abkRux RGmHO4NShIhetbInalQbhbBY/t0OSgZIvKkQBgdwbGE2dWzHxzYgFCdsgEl11tmir3rwwz AA6l0iquH8fXpYTuBKI6aa9/UkcT7jc= X-MC-Unique: ltl8jazHPQ-jFJgCnKU1ng-1 X-Mimecast-MFC-AGG-ID: ltl8jazHPQ-jFJgCnKU1ng_1769506779 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769506777; x=1770111577; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5cYofKArb7TT3IJb8VWVnq10rniZyiKo5QV+1i+5V00=; b=j/lPRscSe5vV1a3DWTfC7AguyJwRe6oor3xKXeh3PsSa0iufOsR2iUOheA4gyaZ5e6 4CaWn6UNy4Fv7fBd+y2Lw1ngaQczuGHyKYANw6ta2SmBpXH+f1CohmZ/sTfxnNvp7zGj Uo+9VnbdSNaTgovn8ZNLCz5alp2pzlaMVp2b1XjT2ldOU1JbijVxgkAgFaSk++MhEopO M1fdP2gB4dq7DmFs3t3Txmqmot4erPPsnsyZlMEAF634sjGtzrgNbQlUUDyWWODo6AmM LI4OKCZCBpef2IvXwPMBJHqaD0HgPZrUkuU2Ze98POvTPZlu2dBxLF+lYZsGMHrpbp+5 c2fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769506777; x=1770111577; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=5cYofKArb7TT3IJb8VWVnq10rniZyiKo5QV+1i+5V00=; b=qheUD4k7zZ49ttkBx1Tc4v80bszXz75vM+B3sG+0p96Se4moJc2r7BwYCHA0IZbo4E lOWEOV6tq5HU/sAag53G07/D6F7BeJ3+vPmwIHXGlzdT0CjTR9Uc/S+ovVKEiUL0CMXL +bK1BDE4JfZuDBuA8jkYxLxajMK1vdMFzwu8+vIJyeguSI3JDFy4yDjwrAI0KEIO/6Mo owp9rEH4GpjRAER5AT4taEpPnGrxa8QifZByE80endXQiOYqr/vAMm6MQ2u3WYzeOmgz dcuQjxFtu2XIbqm9ez1LXpv5HnXOaYdMwf6KrZxs9QgcA36JpqR4yHCBMyJqplbnG7+L o/gQ== X-Gm-Message-State: AOJu0YzmHJb3KF5T/obZWZpcHU4WxZZo8qPG1rias9Tia7DRsAB+Bo4J gm50hXZ5iKo25JxZM7ViZwt01hV7GMWz2MvY67ffiRRXpDFwNSLk9OYoySZK2e0ibP1YjJ+ofMY sBoCo1CzGTS60qLtLfg6WSXVlBTOe8u1JooUTkHMXcuLuyBvOHFQSgR1jU3FxtmsnrHoQdGuw5d lGw7ovbmY6LsMZx6BnLVjFCOKCpevXNvuc8Gp94prP X-Gm-Gg: AZuq6aI84SK/lSSks/1LMKapIEnHmUGUuHGx3wh8EiBB3Q3iyPSqS8LvuRyakgqhYKm eKah5aq7TomvqcpqtRnXrTANDw5jnl23wUpibfC19ewnEnmpewcvXC418mD4L2M8QswgkMH4Ied Ez/dehBnjvLuqRtxd2nm2IiNaLEVfzVFBj1SnTDVy3jQh9xlIj48XM3OJk/QzIr3XSiNuxGInCD fiLqf0NMKH4fGK8OOc4HL4BBgs2s/k0RE9WFSHZ8oid8KE8GhmrIuXfZtk7i8NY4Vk9TUuRm/3b gVCRLphL7PvOgcuDjTsE1zh+8as7iKCwqZzE8B7jzqEoVTJX/HesvlOJ0QBcDoT9GY3sMBh8oRS psbzIKRftT+zUOci42FUtHPO8D+yV9omwC13+uRSX+rbiB5aatmil9N4iOkrahwReSP5K/0YWdv TZYUhYye1286ePiA== X-Received: by 2002:a05:600c:4fd4:b0:480:4a90:1b06 with SMTP id 5b1f17b1804b1-48069c98e19mr11036695e9.34.1769506777103; Tue, 27 Jan 2026 01:39:37 -0800 (PST) X-Received: by 2002:a05:600c:4fd4:b0:480:4a90:1b06 with SMTP id 5b1f17b1804b1-48069c98e19mr11036355e9.34.1769506776584; Tue, 27 Jan 2026 01:39:36 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mohd Kashif Khan , Zhao Liu Subject: [PULL 13/13] rust/hpet: remove stale TODO comment Date: Tue, 27 Jan 2026 10:39:06 +0100 Message-ID: <20260127093906.353741-14-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260127093906.353741-1-pbonzini@redhat.com> References: <20260127093906.353741-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1769506808580158500 Content-Type: text/plain; charset="utf-8" From: Mohd Kashif Khan The irq binding is already implemented in the following line, so the TODO c= omment is obsolete. Signed-off-by: Mohd Kashif Khan Reviewed-by: Zhao Liu Link: https://lore.kernel.org/r/20260126210910.28889-1-kashif04x@gmail.com Signed-off-by: Paolo Bonzini --- rust/hw/timer/hpet/src/device.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/rust/hw/timer/hpet/src/device.rs b/rust/hw/timer/hpet/src/devi= ce.rs index 4757bf5fd55..ebf715d3995 100644 --- a/rust/hw/timer/hpet/src/device.rs +++ b/rust/hw/timer/hpet/src/device.rs @@ -725,7 +725,6 @@ fn set_cfg_reg(&self, regs: &mut HPETRegisters, shift: = u32, len: u32, val: u64) self.irqs[0].lower(); self.irqs[RTC_ISA_IRQ].lower(); } else if deactivating_bit(old_val, new_val, HPET_CFG_LEG_RT_SHIFT= ) { - // TODO: Add irq binding: qemu_irq_lower(s->irqs[0]) self.irqs[0].lower(); self.pit_enabled.set(true); self.irqs[RTC_ISA_IRQ].set(self.rtc_irq_level.get() !=3D 0); --=20 2.52.0