From nobody Fri Nov 14 18:20:09 2025 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=1761672963; cv=none; d=zohomail.com; s=zohoarc; b=cXYKxygBt5VW+xYJWfz66jdGpy30dox/61SwATOZYYRYc8mqKZa6I6EetS64zJ6K2bmErhfOhdVjGTE7uPfz8nXayjoG23A15rs1dL+7pyoO0lq+MRZbIMJbe5y7r+SAluuWN5LaekXhOT6RDvxIHB3CfBWeAKJxCA9NNvFbIoc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761672963; 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=8kN94O/gSwiS6ZhzPvyUBL4OCox4bKst3ai6S8h1NEE=; b=efhdgpLT9fxpnCkWlvGyXBz9XXBi+9ltRv0E7Y3mEnKKSsmh3RooOXQlvyFu1BbTOCYEbqaYCdFN9EwGjmTOn9oBwrZ82f6HvmpK7Pu/L9rESVYo3GYqp3Zv55vFntAhf2yElYFRJ9GaFv6meMn7EJiVyEst4Vw2s+7+dbL4Y7o= 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 1761672963453884.0473394669837; Tue, 28 Oct 2025 10:36:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnaq-0005to-Nv; Tue, 28 Oct 2025 13:34:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnap-0005rd-EX for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:34:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnal-0004PK-Ns for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:34:47 -0400 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-392-p7c5qCrKOUS1WmAD_4djnA-1; Tue, 28 Oct 2025 13:34:37 -0400 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-477113a50fcso23806435e9.1 for ; Tue, 28 Oct 2025 10:34:36 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4771e196a9asm3881965e9.7.2025.10.28.10.34.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672878; 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=8kN94O/gSwiS6ZhzPvyUBL4OCox4bKst3ai6S8h1NEE=; b=cC+1A+r2XvdoZhISWrToIW+akum49+SarTls5hBgHUJLTp8jBJAHl7nNNyN4Pelf4hU/TY qredpxcAQdRaqmyv/iaubxc435xQ4abf2W5RpVNzSfk4/RhbMO95b2ca1fNa3kT5yGPKCG dulGINnCNZ8OeeztHkim8U4LAZvHito= X-MC-Unique: p7c5qCrKOUS1WmAD_4djnA-1 X-Mimecast-MFC-AGG-ID: p7c5qCrKOUS1WmAD_4djnA_1761672876 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672875; x=1762277675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8kN94O/gSwiS6ZhzPvyUBL4OCox4bKst3ai6S8h1NEE=; b=uUa0ZDSUJOJ+FyjxQjx+vJDi0vYNY2lR0cMkqKBn47eu+Ohp2KfyahaYY+4AvH6rGs OUujZfjzkVJ6V3jsN/OogqcvlytdZ9NTh5acayHcttx/DjLpRzgA9F8JUvSa826QALLu QATHou/jzWlYZCkIzxOnlbjeRwfJbwLXZXdY7qPu8HEdxK9a6RCK1CgzUYj5DQZmI9V9 paF5mEHAyHIGBVDjUL8HITwBkhz3IeOm7qriasa3s/P68bn0zWN9UTOAZDdk6esRZ3rH 6kFnR8dddAy86qyBzS1E7nh+khVXDz9RCa2nzB03umMTxtZNjqk3XfkOIBTBLeCTJshd 62iQ== X-Gm-Message-State: AOJu0Yy0Tfmomb4OaJrI575rOuZBgISFQ0LTSyuxF37qFvMwj+p7IimI 7ZPKYZDdvVYQN8b2+CogVH3h5XYYMSsNBWey4C+lHwzPjwRhYDj8KekNq/FN3GVQL7KFSsS/MQ7 cglzuAve7PFJR+ktgAjcx7RRxYmVl6rF+GEmdXDVi7XjT5Ey4Y2y4b/NXQwiY7cEuhaWOEx5Fl9 +UEl86Xfna/1PELW3yFMxupHXlczx7R3eHtXc+CjFh X-Gm-Gg: ASbGncuyaRmfTNyqgO1Hby+byJFTDG6QrcpeLZhmealQOJBOOl5Xtt00xUI9Z1gOwgE zBNblspwKCyblH1iE3tsQNZBgCIbgx5U6sBa+11/gfae+6/KvVcN8ObutQInaoCv6axUPDV6n+N lcW1kztmMi6nUQ5hfD1XhYYx2EyDruvS0KayjPF+AMRc9wOK2qHjXoZbcBFZQmgqbyM+emK2j+q ZZJkkwsoy/m16LMvi/xcUyNIKzDSebFtuyznzuTCQ06NbTtJShzc4gkIHPxqQE5nCn9VB+oIB9z hl0JwFcjRBnMfrg4SpAxXdnVGB/SebuNyCxZO9x1l1a6pW0vSb+vQNiE0As93k8ydlGsF3ffMk0 OUPj6AngNYIOPBABn6AM/QzwTlMcluNyh2JbCII6Zut6Vs60isaV6LrmbUrNsd3n69Xj+KA+gIh UN4Kw= X-Received: by 2002:a05:600c:37cd:b0:46e:1fb9:5497 with SMTP id 5b1f17b1804b1-4771e360859mr1992745e9.18.1761672875166; Tue, 28 Oct 2025 10:34:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYw2wyUpgpgeo+kHYXrhRC3I5eOhcsTa8EWFoIYCygvPXkHMH07Ylt9zz0KWw+YAXHaoU88A== X-Received: by 2002:a05:600c:37cd:b0:46e:1fb9:5497 with SMTP id 5b1f17b1804b1-4771e360859mr1992495e9.18.1761672874636; Tue, 28 Oct 2025 10:34:34 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 01/18] scripts: clean up meson-buildoptions.py Date: Tue, 28 Oct 2025 18:34:13 +0100 Message-ID: <20251028173430.2180057-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761672965704154100 Content-Type: text/plain; charset="utf-8" Fix a few issues reported by flake8 and pylint, mostly parameter names that shadow globals. Signed-off-by: Paolo Bonzini --- scripts/meson-buildoptions.py | 51 +++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py index a3e22471b2f..e636d258e8a 100644 --- a/scripts/meson-buildoptions.py +++ b/scripts/meson-buildoptions.py @@ -111,13 +111,13 @@ def help_line(left, opt, indent, long): right =3D f'{opt["description"]}' if long: value =3D get_help(opt) - if value !=3D "auto" and value !=3D "": + if value not in {"", "auto"}: right +=3D f" [{value}]" if "choices" in opt and long: choices =3D "/".join(sorted(opt["choices"])) right +=3D f" (choices: {choices})" - for x in wrap(" " + left, right, indent): - sh_print(x) + for line in wrap(" " + left, right, indent): + sh_print(line) =20 =20 # Return whether the option (a dictionary) can be used with @@ -144,18 +144,18 @@ def require_arg(opt): return not ({"enabled", "disabled"}.intersection(opt["choices"])) =20 =20 -def filter_options(json): - if ":" in json["name"]: +def filter_options(opt): + if ":" in opt["name"]: return False - if json["section"] =3D=3D "user": - return json["name"] not in SKIP_OPTIONS + if opt["section"] =3D=3D "user": + return opt["name"] not in SKIP_OPTIONS else: - return json["name"] in BUILTIN_OPTIONS + return opt["name"] in BUILTIN_OPTIONS =20 =20 -def load_options(json): - json =3D [x for x in json if filter_options(x)] - return sorted(json, key=3Dlambda x: x["name"]) +def load_options(opts): + opts =3D [opt for opt in opts if filter_options(opt)] + return sorted(opts, key=3Dlambda opt: opt["name"]) =20 =20 def cli_option(opt): @@ -223,7 +223,7 @@ def print_parse(options): key =3D cli_option(opt) name =3D opt["name"] if require_arg(opt): - if opt["type"] =3D=3D "array" and not "choices" in opt: + if opt["type"] =3D=3D "array" and "choices" not in opt: print(f' --{key}=3D*) quote_sh "-D{name}=3D$(meson_opti= on_build_array $2)" ;;') else: print(f' --{key}=3D*) quote_sh "-D{name}=3D$2" ;;') @@ -241,14 +241,19 @@ def print_parse(options): print(" esac") print("}") =20 -json_data =3D sys.stdin.read() -try: - options =3D load_options(json.loads(json_data)) -except: - print("Failure in scripts/meson-buildoptions.py parsing stdin as json", - file=3Dsys.stderr) - print(json_data, file=3Dsys.stderr) - sys.exit(1) -print("# This file is generated by meson-buildoptions.py, do not edit!") -print_help(options) -print_parse(options) + +def main(): + json_data =3D sys.stdin.read() + try: + options =3D load_options(json.loads(json_data)) + except: + print("Failure in scripts/meson-buildoptions.py parsing stdin as j= son", + file=3Dsys.stderr) + print(json_data, file=3Dsys.stderr) + sys.exit(1) + print("# This file is generated by meson-buildoptions.py, do not edit!= ") + print_help(options) + print_parse(options) + + +sys.exit(main()) --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761672962; cv=none; d=zohomail.com; s=zohoarc; b=Cby9lA3wohMB6gBkIkTXhAS078ci6zvCnAnRsb5GURREDAeEYnrzoORkbxpghbEPoMfmGDN+13YR9MouFST/6tpIKvsjawHOYIK1uceELfR6pmdCdlBGxrmxsuDibO0UPzqkDfalMva2n9uMt2XEvSefOGXIQa/9lUbgJyC4tAI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761672962; 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=3onFURp8gSnJA1IzSb1OXc8cgixtZr60o4/zT5ecEXc=; b=hMXtTz2HmdedFJTp3gn2+FKhD901nizEnsJ7dziTjzakx+3Woj+U9hqcsUHc/NNBZcKmueLhjc1XVkiwv1v2LYkmvndVizZ3HLq4U/lxyBnBaa1Yxi/YA+UXsSG6wHQRP+aRFm7Df6ETSN33+cH8Ym+1KrotNbxA14R4Jz+HHGg= 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 1761672962471759.6368988574401; Tue, 28 Oct 2025 10:36:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnas-0005vg-VP; Tue, 28 Oct 2025 13:34:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnar-0005ur-HH for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:34:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnan-0004Pb-2X for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:34:49 -0400 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-410-s-cUmNSQPNSyBCGvNZkJVg-1; Tue, 28 Oct 2025 13:34:40 -0400 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3ee888281c3so4445447f8f.3 for ; Tue, 28 Oct 2025 10:34:39 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429952e2e06sm21606936f8f.46.2025.10.28.10.34.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:34:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672881; 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=3onFURp8gSnJA1IzSb1OXc8cgixtZr60o4/zT5ecEXc=; b=RGs9r4zBTh8UHrcWQBk1Ns2k5z/A4wPXa2Q4KiW+/nIC3Q0BqR2XAQe362yYV5vhjkIiQM KTOdoupgttvQP70nsY0C2VEXk7hNvo6rJtnp/8V8/GBL2YHwQ4kD02OXknd1Jl0Ge5qlSh pOiF3ATX5FTIH2tt4MH+vKvYg1riGjE= X-MC-Unique: s-cUmNSQPNSyBCGvNZkJVg-1 X-Mimecast-MFC-AGG-ID: s-cUmNSQPNSyBCGvNZkJVg_1761672879 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672878; x=1762277678; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3onFURp8gSnJA1IzSb1OXc8cgixtZr60o4/zT5ecEXc=; b=jjnzrXNwNRk1IQsgye9U8QgAqAQeuExKTlvnePUnDP57NG6N+jO7zDqHihh9M8UoRc 8tRCPwSxIFTygbcioRWuNDIYKLnD4npwPtssu2Tfs3vHYnrZhXExRdjTiGWNE+X1wkbI m3/9kgp7+jj7YHlFoKGOSPxYTqDaoEfRdbDm26Zdxk4+o8bJvsnsbjOgv+0mQwZpifRt UZ450+TlZMkiNVFIoW+n61XJg1HVJ+QmmBu9RO/Hs63/KzZ5LemCzYbEdT+FRkCpgndC aQsg5MZof+Xv5/XC1N5GLlKTe4G+WubsP35Oqe27Utk5FqKM2q+wmPC1HKuDT/4d7W4f HRTw== X-Gm-Message-State: AOJu0Yz8QsqHzotOiiG4VnVXlLG86sNr0Rx4fgLQaJeZLun0UUIabAFy p69NinrPuJKKPYnCevz9XPfSsS3fiZtPz26OIhG6AUfSWjWUKYPE2S9f/UXOGA57PJBAiiuwKFU 7zBaxjBSr2gFoRAkvCoCFFz7q6X9A7cC83HH3P6qC2T560JOT9HP+gkfkaI56Qp59q+7JKveikP 58GwChwYUxW6HB5iKAQt7nx6YMIXorg+wWpywTX8xe X-Gm-Gg: ASbGncuv2+bhcn38H8D1rhFEsANTDlXCIaqqwwCQNt84mFK+95cJFG2d5Qz+Dflu5cr /vmGZYRQwv+9OQEDyHL7/WEnAreUnD+hu4Sib5N0ZK7GIrnxtY/Peow8PaHurgsT4UhnvKGbAyM 1Fw3wJcnZlfezqlaUtUoRBEPGUgAxW4tWC63AZusWpDH9eSwv8kDMRJMtOaY/aqX1A6ap37ayLP 6YTXJPp9JAjUd3n56ntrRj5wfn5gtsFxtreoMhCInIyVJ/YxNBIQtKZDSBi1hBAdFAEkza3O3IF Byxrz8GuScsnM40N6pwVzBBwffSV9/1QuXjh1gdWuzhyz2hF9Sz4kKXdPjGW6mrNNIjtiADIxXD a3LHjSBixSjLdxn7GbRHd+vweK6DtFphdBj/e2jRrJjhcL8VU189ALdm7qTEnm2cDUo/jHjuuhe I49Xw= X-Received: by 2002:a05:6000:1ac9:b0:3ee:1461:1654 with SMTP id ffacd0b85a97d-429a7e7af17mr3756169f8f.50.1761672877961; Tue, 28 Oct 2025 10:34:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHMaUu3w0pqlA8IPbJqpVfoEM3VJluCkJl+PzEZnkD8Re1Dj5vXOhYbmU8XmF5XoKZaVudURw== X-Received: by 2002:a05:6000:1ac9:b0:3ee:1461:1654 with SMTP id ffacd0b85a97d-429a7e7af17mr3756145f8f.50.1761672877508; Tue, 28 Oct 2025 10:34:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Xiaoyao Li , Peter Maydell Subject: [PULL 02/18] i386/kvm/cpu: Init SMM cpu address space for hotplugged CPUs Date: Tue, 28 Oct 2025 18:34:14 +0100 Message-ID: <20251028173430.2180057-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761672964027154100 Content-Type: text/plain; charset="utf-8" From: Xiaoyao Li The SMM cpu address space is initialized in a machine_init_done notifier. It only runs once when QEMU starts up, which leads to the issue that for any hotplugged CPU after the machine is ready, SMM cpu address space doesn't get initialized. Fix the issue by initializing the SMM cpu address space in x86_cpu_plug() when the cpu is hotplugged. Fixes: 591f817d819f ("target/i386: Define enum X86ASIdx for x86's address s= paces") Reported-by: Peter Maydell Closes: https://lore.kernel.org/qemu-devel/CAFEAcA_3kkZ+a5rTZGmK8W5K6J7qpYD= 31HkvjBnxWr-fGT2h_A@mail.gmail.com/ Signed-off-by: Xiaoyao Li Link: https://lore.kernel.org/r/20251014094216.164306-2-xiaoyao.li@intel.com Signed-off-by: Paolo Bonzini --- target/i386/kvm/kvm_i386.h | 1 + hw/i386/x86-common.c | 11 +++++++++++ target/i386/kvm/kvm.c | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h index 5c908fdd6a5..2b653442f4d 100644 --- a/target/i386/kvm/kvm_i386.h +++ b/target/i386/kvm/kvm_i386.h @@ -74,6 +74,7 @@ uint32_t kvm_x86_build_cpuid(CPUX86State *env, struct kvm= _cpuid_entry2 *entries, uint32_t cpuid_i); #endif /* CONFIG_KVM */ =20 +void kvm_smm_cpu_address_space_init(X86CPU *cpu); void kvm_pc_setup_irq_routing(bool pci_enabled); =20 #endif diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c index 7512be64d67..5716191fff1 100644 --- a/hw/i386/x86-common.c +++ b/hw/i386/x86-common.c @@ -183,6 +183,17 @@ void x86_cpu_plug(HotplugHandler *hotplug_dev, fw_cfg_modify_i16(x86ms->fw_cfg, FW_CFG_NB_CPUS, x86ms->boot_cpus); } =20 + /* + * Non-hotplugged CPUs get their SMM cpu address space initialized in + * machine init done notifier: register_smram_listener(). + * + * We need initialize the SMM cpu address space for the hotplugged CPU + * specifically. + */ + if (kvm_enabled() && dev->hotplugged && x86_machine_is_smm_enabled(x86= ms)) { + kvm_smm_cpu_address_space_init(cpu); + } + found_cpu =3D x86_find_cpu_slot(MACHINE(x86ms), cpu->apic_id, NULL); found_cpu->cpu =3D CPU(dev); out: diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index f7a6ef650af..4dea1ed8f0f 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -2748,6 +2748,12 @@ static void register_smram_listener(Notifier *n, voi= d *unused) } } =20 +/* It should only be called in cpu's hotplug callback */ +void kvm_smm_cpu_address_space_init(X86CPU *cpu) +{ + cpu_address_space_init(CPU(cpu), X86ASIdx_SMM, "cpu-smm", &smram_as_ro= ot); +} + static void *kvm_msr_energy_thread(void *data) { KVMState *s =3D data; --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761673125; cv=none; d=zohomail.com; s=zohoarc; b=jewqMKWvu03SPL5dx0+XWEZ1keXkh25ZowygT1CmCu+5bllAaoFXUMPCHG06Rh4aL8Ve8iVIjxbXE45lTk2UHm2Ps2ZPzM7yoiw36qNEJy5CpiQBm8Fut4mcnVaydJgFRcrMPly3sHLE5rgCRh9zcT1/RmdGTfSKA7mvVNaAfmc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761673125; 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=/7osdAW5bSf9qjwAd56pP8o2B29iR255+zUoc4/NUqo=; b=i2gsb1VOaj2UZEqPJIpo4PzhX5sBgKQ1WxHCuuE5avbEvgyJOH0ocLe2EJS7A5u212NfyLMB7dHtSYCXJM3TgJUX5oCGa4iUrha/MifdeLP0fk2mrcRTh75HD8ZH3FdFy0l5oQEkiUMbGctX1H13DYboWFq1M8b9J9gOTSnYBgg= 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 1761673125958367.82797625300407; Tue, 28 Oct 2025 10:38:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnau-0005vx-1o; Tue, 28 Oct 2025 13:34:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnas-0005vJ-CU for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:34:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnap-0004Pu-Bp for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:34:50 -0400 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-130-oeMyffwgMouU5wrcZdUbTw-1; Tue, 28 Oct 2025 13:34:43 -0400 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-475c422fd70so50643925e9.2 for ; Tue, 28 Oct 2025 10:34:43 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4771e196a9asm3885085e9.7.2025.10.28.10.34.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:34:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672885; 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=/7osdAW5bSf9qjwAd56pP8o2B29iR255+zUoc4/NUqo=; b=cDpd9MLd7Z22bF9iH9N5YoSb+X9lbZdws24l2sp8IMyPLiJgI4IfP6yjmG0gauzv2JM80I wjwOcMIaS5A5pSqCQN8uVPL+z2fTGjZMvWQToaLunqU9jvU3ghdss0Z/LxSudmgNePCJCt Dzm3oz894dkxuTGvJ9EbV4S+Ao+aiCE= X-MC-Unique: oeMyffwgMouU5wrcZdUbTw-1 X-Mimecast-MFC-AGG-ID: oeMyffwgMouU5wrcZdUbTw_1761672883 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672882; x=1762277682; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/7osdAW5bSf9qjwAd56pP8o2B29iR255+zUoc4/NUqo=; b=YYXj8KauXTsJuAfG29xLaTFhEK7m/eLCRAILvaBrb6f3zGkM+2KJ6OZofSkVlSunhR oIyFbs2pcBM8W2XNK2zu30rVa1FsXN3WCnyRPKc2xwYfSxWJyGZnDubOQim+QxI/WjsB 3at0nV81/BycHns8TY+EYr/MMzWr9nrywEJyIsITwSL73mwWz6SPq2rC3FnMF2/0n8zN uzB7P9IkVr906fEGri36soEHyMI321+Td84T4yE9CWs9f42/k5KVEL6r4gLmhTG3l52X uAkJl/ftBI+r2zDC4/UGdXFP3ywD9XhvLlAqNqhGjiLGHfLel/gbSTw+UftaSGljLtAY g1Jw== X-Gm-Message-State: AOJu0YzYSO2azGqvYX9FM8922OQTO/mrQT4ERVND7VBk1GBnmXn4zJOe tcxxgaHAm/5O/AZ7r/czCYcaVGgkNMv+6nbgZigde7MQhMPLa0MsrA4FS+omwAalRnzxi+ZNpMR 3nJGq8EQP/L3KBxSLUCBgITsvsfQjyEBm0DjRKHSYUngp5IG0HEFEuf7gbzdhSA8Sqgs1a2+DAD uabHAyDkjSDcvLqQHrNRvmN4LuT9PxUMTj2PF0rJJb X-Gm-Gg: ASbGncvkZlJRWEadPxzWTZd5dVfoUQLyrx07Km1dSWGUb+urgkYRfP0MCe1htUiTIBy 7u+p4w5zR1bG8LOf3WmukoJ0hR04hzVxWMVYxR/qV4GGUkvNGSgE5mpb/5enIxuLZASUrHOpO2A 5QCmpUecaONxTH4Jc0nBhYT9Ldi7ZHGiTQ2zmkrXcBA1mU5g7AxZFr02EAXPQI+M8sel4bepFXA hnTWdN3e4Us2iQHFwOnrCu9vGcCIn7o/qtWGOkFfW4V64Ow8RMR7LyK84RqNcF0PpSSFp9YlZzI hn5n3VwpbladmD+/ID5ktbUfVjVJ2JmSTMrQ0ayllIxxz82Ctwm1FgWZHP8LrbTr02dXEMMnCXB uE1fZixhdT4LpTbiLJRr6LST+ztYvvMHaU9wk63Q7fCCHSZ2zIynor+4CexVCDh2VanNg5JkD4b r/mFY= X-Received: by 2002:a05:600c:8b8b:b0:471:1717:40f with SMTP id 5b1f17b1804b1-4771e1ca084mr2207565e9.22.1761672882014; Tue, 28 Oct 2025 10:34:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHD8diAi5KAatEerGVhRBxHrqUc0knotgUiMBAJlIi0rSqnnoX86wT4L4Hj12X/uA1YfK/gWg== X-Received: by 2002:a05:600c:8b8b:b0:471:1717:40f with SMTP id 5b1f17b1804b1-4771e1ca084mr2207315e9.22.1761672881428; Tue, 28 Oct 2025 10:34:41 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Dmitry Osipenko Subject: [PULL 03/18] rcu: Unify force quiescent state Date: Tue, 28 Oct 2025 18:34:15 +0100 Message-ID: <20251028173430.2180057-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761673127847154100 Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki Borrow the concept of force quiescent state from Linux to ensure readers remain fast during normal operation and to avoid stalls. Background =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The previous implementation had four steps to begin reclamation. 1. call_rcu_thread() would wait for the first callback. 2. call_rcu_thread() would periodically poll until a decent number of callbacks piled up or it timed out. 3. synchronize_rcu() would statr a grace period (GP). 4. wait_for_readers() would wait for the GP to end. It would also trigger the force_rcu notifier to break busy loops in a read-side critical section if drain_call_rcu() had been called. Problem =3D=3D=3D=3D=3D=3D=3D The separation of waiting logic across these steps led to suboptimal behavior: The GP was delayed until call_rcu_thread() stops polling. force_rcu was not consistently triggered when call_rcu_thread() detected a high number of pending callbacks or a timeout. This inconsistency sometimes led to stalls, as reported in a virtio-gpu issue where memory unmapping was blocked[1]. wait_for_readers() imposed unnecessary overhead in non-urgent cases by unconditionally executing qatomic_set(&index->waiting, true) and qemu_event_reset(&rcu_gp_event), which are necessary only for expedited synchronization. Solution =3D=3D=3D=3D=3D=3D=3D=3D Move the polling in call_rcu_thread() to wait_for_readers() to prevent the delay of the GP. Additionally, reorganize wait_for_readers() to distinguish between two states: Normal State: it relies exclusively on periodic polling to detect the end of the GP and maintains the read-side fast path. Force Quiescent State: Whenever expediting synchronization, it always triggers force_rcu and executes both qatomic_set(&index->waiting, true) and qemu_event_reset(&rcu_gp_event). This avoids stalls while confining the read-side overhead to this state. This unified approach, inspired by the Linux RCU, ensures consistent and efficient RCU grace period handling and confirms resolution of the virtio-gpu issue. [1] https://lore.kernel.org/qemu-devel/20251014111234.3190346-9-alex.bennee= @linaro.org/ Signed-off-by: Akihiko Odaki Link: https://lore.kernel.org/r/20251016-force-v1-1-919a82112498@rsg.ci.i.u= -tokyo.ac.jp Tested-by: Dmitry Osipenko Signed-off-by: Paolo Bonzini --- util/rcu.c | 81 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 29 deletions(-) diff --git a/util/rcu.c b/util/rcu.c index b703c86f15a..acac9446ea9 100644 --- a/util/rcu.c +++ b/util/rcu.c @@ -43,10 +43,14 @@ #define RCU_GP_LOCKED (1UL << 0) #define RCU_GP_CTR (1UL << 1) =20 + +#define RCU_CALL_MIN_SIZE 30 + unsigned long rcu_gp_ctr =3D RCU_GP_LOCKED; =20 QemuEvent rcu_gp_event; static int in_drain_call_rcu; +static int rcu_call_count; static QemuMutex rcu_registry_lock; static QemuMutex rcu_sync_lock; =20 @@ -76,15 +80,29 @@ static void wait_for_readers(void) { ThreadList qsreaders =3D QLIST_HEAD_INITIALIZER(qsreaders); struct rcu_reader_data *index, *tmp; + int sleeps =3D 0; + bool forced =3D false; =20 for (;;) { - /* We want to be notified of changes made to rcu_gp_ongoing - * while we walk the list. + /* + * Force the grace period to end and wait for it if any of the + * following heuristical conditions are satisfied: + * - A decent number of callbacks piled up. + * - It timed out. + * - It is in a drain_call_rcu() call. + * + * Otherwise, periodically poll the grace period, hoping it ends + * promptly. */ - qemu_event_reset(&rcu_gp_event); + if (!forced && + (qatomic_read(&rcu_call_count) >=3D RCU_CALL_MIN_SIZE || + sleeps >=3D 5 || qatomic_read(&in_drain_call_rcu))) { + forced =3D true; =20 - QLIST_FOREACH(index, ®istry, node) { - qatomic_set(&index->waiting, true); + QLIST_FOREACH(index, ®istry, node) { + notifier_list_notify(&index->force_rcu, NULL); + qatomic_set(&index->waiting, true); + } } =20 /* Here, order the stores to index->waiting before the loads of @@ -106,8 +124,6 @@ static void wait_for_readers(void) * get some extra futex wakeups. */ qatomic_set(&index->waiting, false); - } else if (qatomic_read(&in_drain_call_rcu)) { - notifier_list_notify(&index->force_rcu, NULL); } } =20 @@ -115,7 +131,8 @@ static void wait_for_readers(void) break; } =20 - /* Wait for one thread to report a quiescent state and try again. + /* + * Sleep for a while and try again. * Release rcu_registry_lock, so rcu_(un)register_thread() doesn't * wait too much time. * @@ -133,7 +150,20 @@ static void wait_for_readers(void) * rcu_registry_lock is released. */ qemu_mutex_unlock(&rcu_registry_lock); - qemu_event_wait(&rcu_gp_event); + + if (forced) { + qemu_event_wait(&rcu_gp_event); + + /* + * We want to be notified of changes made to rcu_gp_ongoing + * while we walk the list. + */ + qemu_event_reset(&rcu_gp_event); + } else { + g_usleep(10000); + sleeps++; + } + qemu_mutex_lock(&rcu_registry_lock); } =20 @@ -173,15 +203,11 @@ void synchronize_rcu(void) } } =20 - -#define RCU_CALL_MIN_SIZE 30 - /* Multi-producer, single-consumer queue based on urcu/static/wfqueue.h * from liburcu. Note that head is only used by the consumer. */ static struct rcu_head dummy; static struct rcu_head *head =3D &dummy, **tail =3D &dummy.next; -static int rcu_call_count; static QemuEvent rcu_call_ready_event; =20 static void enqueue(struct rcu_head *node) @@ -259,30 +285,27 @@ static void *call_rcu_thread(void *opaque) rcu_register_thread(); =20 for (;;) { - int tries =3D 0; - int n =3D qatomic_read(&rcu_call_count); + int n; =20 - /* Heuristically wait for a decent number of callbacks to pile up. + /* * Fetch rcu_call_count now, we only must process elements that we= re * added before synchronize_rcu() starts. */ - while (n =3D=3D 0 || (n < RCU_CALL_MIN_SIZE && ++tries <=3D 5)) { - g_usleep(10000); - if (n =3D=3D 0) { - qemu_event_reset(&rcu_call_ready_event); - n =3D qatomic_read(&rcu_call_count); - if (n =3D=3D 0) { -#if defined(CONFIG_MALLOC_TRIM) - malloc_trim(4 * 1024 * 1024); -#endif - qemu_event_wait(&rcu_call_ready_event); - } - } + for (;;) { + qemu_event_reset(&rcu_call_ready_event); n =3D qatomic_read(&rcu_call_count); + if (n) { + break; + } + +#if defined(CONFIG_MALLOC_TRIM) + malloc_trim(4 * 1024 * 1024); +#endif + qemu_event_wait(&rcu_call_ready_event); } =20 - qatomic_sub(&rcu_call_count, n); synchronize_rcu(); + qatomic_sub(&rcu_call_count, n); bql_lock(); while (n > 0) { node =3D try_dequeue(); --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761673029; cv=none; d=zohomail.com; s=zohoarc; b=D6MXSMszgkV4vlDr5soE1qHutaxFAkouhuMWrUi+hMlVqdlGkmxqHXXhjPPFKyUFu6nB10ON8C+eG/XpLmOatkvQIO6xwAfqY13h9ZL4wEqJy1i4ACHsuERV2GeporcUqG0dMXx9LuFZ6QAJhHnUtcAaj0tH0zv2sNO/Eotevcs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761673029; 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=KWhg4MaiEkP19owK+TL8EIAXAKrNBH/O36emy6V+FXk=; b=Jn5t+Tx2+IZY0bxAsLXHZIt5OsRWxIaESbvE3AeY0cXmQRuCCe2lEk//CVwQaqLeRVMZCKw9ryzGTpM1YEawvHDP5aJ0N7QkfMkkSLOi1XiSrm5Vi3XdYGkaWo8i+3j4mL/fGJygsSfvgNqhlXU8qz7+CGaCJvpyzOxBI43Xbhg= 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 1761673028850337.5154109206985; Tue, 28 Oct 2025 10:37:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnb4-000628-Vl; Tue, 28 Oct 2025 13:35:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnb1-00060F-Hs for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:34:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnau-0004QF-29 for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:34:58 -0400 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-635-bXLm-HM4OL2LddTCeTizGA-1; Tue, 28 Oct 2025 13:34:46 -0400 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-427013eb71dso5750646f8f.2 for ; Tue, 28 Oct 2025 10:34:46 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429952d9e80sm21379479f8f.28.2025.10.28.10.34.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672888; 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=KWhg4MaiEkP19owK+TL8EIAXAKrNBH/O36emy6V+FXk=; b=JwuX43pliSs9td+mOD7oFpFfMNe/A0AdPnuhmarawnenEszfyPuOCZGYr1+0ZR6OJqiotz gN7pS2+4s+EolkaoStmq11F1iwxi8PefMWua/QNzpo35b3+d16Rwdosopi3XsxFw99v026 xT0ys2+uenQZOtvBwdll5h6Fcdh2JN4= X-MC-Unique: bXLm-HM4OL2LddTCeTizGA-1 X-Mimecast-MFC-AGG-ID: bXLm-HM4OL2LddTCeTizGA_1761672886 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672884; x=1762277684; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KWhg4MaiEkP19owK+TL8EIAXAKrNBH/O36emy6V+FXk=; b=jBILrFQTxynFP0Abn8id2qu5QZppudelIHOTUyyR+gIgUlWtrp3tmjlyqXC6PSxDcp 7Fhy1sFfHqIEyU8cbc6nlSqB00WsoS4yWxooDtoTbOXyOd+m+feYRSExgboodqnja6RB NFEC4Xxe7OTMyF0Qb8MgdbQxoZa4BtZNYyj5/JIbeHtIHCc28ID8AOTqgOUvbDFLU3fQ J8lyKF8DWy+9/MXr8tGSPn4PLf+Hj4GxLEuvN+FlVFD2WGT/XGO5yhEBO3R0ahOjG98J 5sinxH9gjjRjTt4vJNWvVJzf85cebqcFsZrvCA7LW5+hCMIfRrrptAeF9dlL6XhBIKDQ 1Qmg== X-Gm-Message-State: AOJu0Yx7/VWXuUC9EeWlPVZTbGoyZyusm3h+m7qVyCggKvIWJmgowP2m OLh2zL7uL5HIY7tM2650v5AQ0TazcPV3exP+XAfjTS1i5iVfY0kU/vaXZ7N6QqYrpxGkKVVjqp2 45T8PopdVGjkPUtHpo762HVvF1CnKKcczcxXEM35ZUCNG88tZwybp319lknvnFMhSUuSN5n/6CF GtSvuk1ZlJ0lWEpl2t8YD7s+jtWucm/Us9jkO73Zj6 X-Gm-Gg: ASbGncsDzOfqblBt9DPUlxJ2EX0KeXVGVMlcbAffmVukPV12ysL343Pb0npy41WrIHS jgBROctIF4xd1kXMw2DleAqGv6Fl1u14ecPXNdSdBXH6KIHBQFcvmDitkysco4H1XgdEYd+lBK6 0eeKGN/nASqLyZk7TnSCh3Fej0HIN+quPoGYudfgk2OQM1jTOsaVnK8qix48RqxHg4/zyF6rX7h Fo4rheGVEyj1UAmfpNBM2lQRm7B8nw4q1fAEVptw+G6TkEZ2XL4wLbw67YAF2OrlnT3KcrJeo+n k1sNp1FcPu0pM1dKVkQHVlmXr4BUQDWzFyUFXWnfUgRzDME83B75x9MdF6hMKbqkdOn0Id5Qwoi qAmpTM8oOuytaQOgqsKMKXGSSvD0C5nnimRlbCEaHmk1uK/IiG2gEgZGix3TlHIUzEXmjI+LcHw oClKQ= X-Received: by 2002:a05:6000:2406:b0:428:55c3:cea7 with SMTP id ffacd0b85a97d-429a7e79ffbmr4019170f8f.36.1761672884560; Tue, 28 Oct 2025 10:34:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtbOdFGCYuJvgqEV0Ta/yLKwHU4SUwRUPD3XBDT5MZ6nyB2sYUL//tatzc4zfdY97r09lP3A== X-Received: by 2002:a05:6000:2406:b0:428:55c3:cea7 with SMTP id ffacd0b85a97d-429a7e79ffbmr4019144f8f.36.1761672884082; Tue, 28 Oct 2025 10:34:44 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Martin Kletzander , Zhao Liu Subject: [PULL 04/18] rust: remove useless glib_sys bindings Date: Tue, 28 Oct 2025 18:34:16 +0100 Message-ID: <20251028173430.2180057-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761673032053154100 Content-Type: text/plain; charset="utf-8" From: Martin Kletzander The definition of types needed for g_autolist(), g_autoslist(), g_autoqueue() need the imports for GList, GSList and GQueue to appear everything. Rust code is never going to see those, since they are not used in structs. Block the types from appearing in the bindings. Co-authored-by: Martin Kletzander Signed-off-by: Martin Kletzander Reviewed-by: Zhao Liu Signed-off-by: Paolo Bonzini --- meson.build | 1 + rust/bql/src/bindings.rs | 4 +--- rust/chardev/src/bindings.rs | 4 ++-- rust/hw/char/pl011/src/bindings.rs | 2 +- rust/hw/core/src/bindings.rs | 4 +--- rust/migration/src/bindings.rs | 2 +- rust/qom/src/bindings.rs | 2 +- rust/system/src/bindings.rs | 4 ++-- rust/util/src/bindings.rs | 2 +- 9 files changed, 11 insertions(+), 14 deletions(-) diff --git a/meson.build b/meson.build index c5710a6a47c..8ad37c992b1 100644 --- a/meson.build +++ b/meson.build @@ -4251,6 +4251,7 @@ if have_rust '--allowlist-file', meson.project_source_root() + '/include/.*', '--allowlist-file', meson.project_build_root() + '/.*', '--blocklist-file', glib_pc.get_variable('includedir') + '/glib-2.0/.*= ', + '--blocklist-type', '.*_([a-z]*autoptr)$', ] if not rustfmt.found() if bindgen.version().version_compare('<0.65.0') diff --git a/rust/bql/src/bindings.rs b/rust/bql/src/bindings.rs index 8c70f3a87ce..c656cf18845 100644 --- a/rust/bql/src/bindings.rs +++ b/rust/bql/src/bindings.rs @@ -18,9 +18,7 @@ clippy::too_many_arguments )] =20 -use glib_sys::{ - guint, GArray, GHashTable, GHashTableIter, GList, GPollFD, GPtrArray, = GQueue, GSList, GSource, -}; +use glib_sys::{guint, GArray, GHashTable, GHashTableIter, GPollFD, GPtrArr= ay, GSList, GSource}; =20 #[cfg(MESON)] include!("bindings.inc.rs"); diff --git a/rust/chardev/src/bindings.rs b/rust/chardev/src/bindings.rs index c95dc89c56d..63bfbb8ce66 100644 --- a/rust/chardev/src/bindings.rs +++ b/rust/chardev/src/bindings.rs @@ -20,8 +20,8 @@ =20 use common::Zeroable; use glib_sys::{ - gboolean, guint, GArray, GHashTable, GHashTableIter, GIOCondition, GLi= st, GMainContext, - GPollFD, GPtrArray, GQueue, GSList, GSource, GSourceFunc, + gboolean, guint, GArray, GHashTable, GHashTableIter, GIOCondition, GMa= inContext, GPollFD, + GPtrArray, GSList, GSource, GSourceFunc, }; =20 #[cfg(MESON)] diff --git a/rust/hw/char/pl011/src/bindings.rs b/rust/hw/char/pl011/src/bi= ndings.rs index 52a76d0de5c..654be9185b1 100644 --- a/rust/hw/char/pl011/src/bindings.rs +++ b/rust/hw/char/pl011/src/bindings.rs @@ -22,7 +22,7 @@ =20 use glib_sys::{ gboolean, guint, GArray, GByteArray, GHashTable, GHashTableIter, GIOCo= ndition, GList, - GMainContext, GPollFD, GPtrArray, GQueue, GSList, GSource, GSourceFunc= , GString, + GMainContext, GPollFD, GPtrArray, GSList, GSource, GSourceFunc, GStrin= g, }; =20 #[cfg(MESON)] diff --git a/rust/hw/core/src/bindings.rs b/rust/hw/core/src/bindings.rs index 65b9aae7536..730d5b28a3c 100644 --- a/rust/hw/core/src/bindings.rs +++ b/rust/hw/core/src/bindings.rs @@ -20,9 +20,7 @@ =20 use chardev::bindings::Chardev; use common::Zeroable; -use glib_sys::{ - GArray, GByteArray, GHashTable, GHashTableIter, GList, GPtrArray, GQue= ue, GSList, GString, -}; +use glib_sys::{GArray, GByteArray, GHashTable, GHashTableIter, GList, GPtr= Array, GSList, GString}; use migration::bindings::VMStateDescription; use qom::bindings::ObjectClass; use system::bindings::MemoryRegion; diff --git a/rust/migration/src/bindings.rs b/rust/migration/src/bindings.rs index 24503eb69bd..e9c058386c2 100644 --- a/rust/migration/src/bindings.rs +++ b/rust/migration/src/bindings.rs @@ -19,7 +19,7 @@ )] =20 use common::Zeroable; -use glib_sys::{GHashTable, GHashTableIter, GList, GPtrArray, GQueue, GSLis= t}; +use glib_sys::{GHashTable, GHashTableIter, GPtrArray, GSList}; =20 #[cfg(MESON)] include!("bindings.inc.rs"); diff --git a/rust/qom/src/bindings.rs b/rust/qom/src/bindings.rs index 91de42f2426..e61259ec2ef 100644 --- a/rust/qom/src/bindings.rs +++ b/rust/qom/src/bindings.rs @@ -18,7 +18,7 @@ clippy::too_many_arguments )] =20 -use glib_sys::{GHashTable, GHashTableIter, GList, GPtrArray, GQueue, GSLis= t}; +use glib_sys::{GHashTable, GHashTableIter, GPtrArray, GSList}; =20 #[cfg(MESON)] include!("bindings.inc.rs"); diff --git a/rust/system/src/bindings.rs b/rust/system/src/bindings.rs index 6cbb588de3d..ddccfe0436f 100644 --- a/rust/system/src/bindings.rs +++ b/rust/system/src/bindings.rs @@ -20,8 +20,8 @@ =20 use common::Zeroable; use glib_sys::{ - guint, GArray, GByteArray, GHashTable, GHashTableIter, GList, GPollFD,= GPtrArray, GQueue, - GSList, GString, + guint, GArray, GByteArray, GHashTable, GHashTableIter, GList, GPollFD,= GPtrArray, GSList, + GString, }; =20 #[cfg(MESON)] diff --git a/rust/util/src/bindings.rs b/rust/util/src/bindings.rs index c277a295add..3514a66f5fa 100644 --- a/rust/util/src/bindings.rs +++ b/rust/util/src/bindings.rs @@ -18,7 +18,7 @@ clippy::too_many_arguments )] =20 -use glib_sys::{guint, GList, GPollFD, GQueue, GSList, GString}; +use glib_sys::{guint, GPollFD, GString}; =20 #[cfg(MESON)] include!("bindings.inc.rs"); --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761672967; cv=none; d=zohomail.com; s=zohoarc; b=Vs1t3rNTMbShwxwHUycHLKi0I0uPE9V/7H1RTheS3AU/6VEVBz4nd+G3zYZQlrg16DMVHmx2bk1IUnr/U3CjGxc5/vFZt7f2Bkfvwantj7QU3TlPbpk1Wj6gxj8sncyLJfPxbd38BEDxcMsiP9VL36JY+8WoQMv0FDRRvW8l3ws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761672967; 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=sw91OJuYj1JrwFfKm7ne2KgP4Ysk3Lo0/gaXKLESQRo=; b=ZTNY5KrkI+RlQJTeuOMKY7qjfB4CzFpl2wc7HVHGuEl6rDs/U08mBviCgfhYZtTDZIL1SrRXCf1EfwEOVAN7Dz6vcDEMynxp2FaI5OjTCVLEUN1kevAjGzKXjVxVZb1eiiA937GluDBUD9v8HkICMuf0PChrJL7XhIhtYctVxVA= 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 1761672967375196.6285209927629; Tue, 28 Oct 2025 10:36:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnaz-0005y0-U7; Tue, 28 Oct 2025 13:34:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnaz-0005wq-0I for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:34:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnaw-0004Qk-8q for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:34:56 -0400 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-660-eG4zLAfTPoyWdmn_evKn-Q-1; Tue, 28 Oct 2025 13:34:49 -0400 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-4298da9effcso4126048f8f.2 for ; Tue, 28 Oct 2025 10:34:49 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429952d5985sm21497448f8f.25.2025.10.28.10.34.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:34:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672891; 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=sw91OJuYj1JrwFfKm7ne2KgP4Ysk3Lo0/gaXKLESQRo=; b=h5pVtTk9kPqENEWZ1oXTLp6VYEj0P+0m4inrWChGEsAlbJuYsOMs0+Fpm0BE1pyOMWBpIs N9oF1L25VFgRPpI2XX4O0LD3o8ZPNd/1Ty01YZv/JZt/8WmvqusOkW3dylWKK4SCjjOgep WcnS2W4NmaEo2spE6zj5fwDisxK7jx8= X-MC-Unique: eG4zLAfTPoyWdmn_evKn-Q-1 X-Mimecast-MFC-AGG-ID: eG4zLAfTPoyWdmn_evKn-Q_1761672888 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672887; x=1762277687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sw91OJuYj1JrwFfKm7ne2KgP4Ysk3Lo0/gaXKLESQRo=; b=mkr+wzZMUgwxVEpz8YBTlrJ3yH6qvUG3zCRWYoe3UKVbGnYEWc0z5edK8ufeP0ISqW 1AIamvC7zlkiGLJjGI/+4EYbrZzm+KP1DlVC+93/CvZrzpWlfvsZcmT7s3A5oS7GRzrM isRJUmHPudRZAuWaalpFQIAsrBjr3laku0raCeB6cLIL9HTv2POgnNdNjp5Lhca8kK8L gM7q25V5gINdxbkqCLE/GbRHqZe3mk5MKTJE1xaa3mrqB1GsZ99P8sR8pSQfHIyQgSn1 fwnHxree17ItfHMP0rqj79Y4JHN006gD4y9UDk48mY8jvNPIzBeI5rGB2hW+HjgFgQFr PJeQ== X-Gm-Message-State: AOJu0YzUfVrYAGo5IWSogjVL+tU4eb4FM8Dx+l0cfB7eZvpGhlac78+i ++y2vNjQmafd3BJW9Dav7pB8CumjEPB7+np0l1D06VwYdogIsowSVHB+oagefiDKDGQfCCC2nAR Z3o0hmMDa85kPGykpGm4m7ENsAYD7q+5xMg773ug5TGddXj5WKXLhWZqhwsv3rrc3XNAX+L2Ii4 b6XzKvXLOEh59ugYlDtcfyxSSrCPRC9I6Tdnp+lCaq X-Gm-Gg: ASbGncsKDve1F40CE0hVYS7Otdb8K5idZfps/76Qz6yI0nfWNXZNwP70N0OUdSo+gpu us3TWnKSMHlTz5QvtPD6pQysIVFcWPtHzPVUPRmIsIV9Z0aXfH6zkopuK+oEjtybWOTEoxCulTR ADyZT/+q2L5Kmzvxcnh62wg3TP1uS4+QefECSKox9edFLNyyc+l05Gdhqu0Eo8ZlS4grjvCQRjg 5RE/bO8d7aZtUh6Iv4kV0utMs9YWIOeaM9sPH5ar0AmBfjFVW56aBQlUIHpzT3WsoImNvDRg6vD F74hLmDLga6SQzQ/0W+bdI0P6N9y3M08Q6KOioubd2UnPAZivYGpIu7WuzRYtEnLktVrhCKdMxq pa6eecpItTuQ5NLB+r9fMLb44VVrhwPToZT+AqcDXHuI2mnIx9XxV9oF3pVtYwdYedanLopCsrV r5f0I= X-Received: by 2002:a05:600c:64c7:b0:471:672:3486 with SMTP id 5b1f17b1804b1-4771e18157dmr2954195e9.15.1761672887381; Tue, 28 Oct 2025 10:34:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDcdKtLkNrl+YX/vvzTstmhdnZaPxZ2RDYdZwg98VYaaHXSh6uvh4cYUw1EM4hqFDEc3aiag== X-Received: by 2002:a05:600c:64c7:b0:471:672:3486 with SMTP id 5b1f17b1804b1-4771e18157dmr2953955e9.15.1761672886918; Tue, 28 Oct 2025 10:34:46 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 05/18] rust: only leave leaf crates as workspace members Date: Tue, 28 Oct 2025 18:34:17 +0100 Message-ID: <20251028173430.2180057-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761672975888158500 Content-Type: text/plain; charset="utf-8" Everything else can be obtained as a dependency. Signed-off-by: Paolo Bonzini --- rust/Cargo.toml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 783e626802c..ace0baf9bd7 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,18 +1,8 @@ [workspace] resolver =3D "2" members =3D [ - "bits", - "bql", - "common", - "migration", - "qemu-macros", - "qom", - "system", - "hw/core", "hw/char/pl011", "hw/timer/hpet", - "trace", - "util", "tests", ] =20 --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761673135; cv=none; d=zohomail.com; s=zohoarc; b=dbZJVJRwtfBgY62UpQHab/wY2znkX1XRKfh6sY07heCw9BR5UEFGo4oJCkLUxjqGmWMNb9sPvETO1oHyb91Sa4tZ6TjBDU6wfEbeCNm0lFZtaZtnBxvwSP6UQXMXfVt/R+wf0YacOVhav0rbleZPQj2oBWb1yKX6aM2B+EeUtSY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761673135; 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=NElcIQeJ5eQxKaGBT+BiWqWbXgYojExHiTsQPrKnKAQ=; b=IbbD8AC+OTs8fctzxfIGZeJa4Pz8pOH59USGtM1Wdk0Z8dXN+JycxjgX085GJ+U/2QBpPdJVlTe+D6o++H2Yvz6lH2Hy3M9p4prRzSg+evQehLSd+rXVkXaa2v5wzgbl2s+Jj/wcH6I8vdq+Yzc7RUtKxin4LV4yo2FZROEFOp0= 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 1761673135738551.537917294972; Tue, 28 Oct 2025 10:38:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnbA-00068V-Ja; Tue, 28 Oct 2025 13:35:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnb7-00064L-9n for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnaz-0004Qs-E9 for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:04 -0400 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-477-hRHUGZNsPE2L96eX0v9elg-1; Tue, 28 Oct 2025 13:34:52 -0400 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-40cfb98eddbso65478f8f.0 for ; Tue, 28 Oct 2025 10:34:51 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429952df473sm21503944f8f.42.2025.10.28.10.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:34:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672893; 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=NElcIQeJ5eQxKaGBT+BiWqWbXgYojExHiTsQPrKnKAQ=; b=Cyy1xc4ULGopxmnnP/AyS+MLAjWfUz1ND+ZNF7PkeFyclZMHlOQq/a+LB48vLeYfqh88rS +hpUgv9/Wc4Ji0tMoD7fx0JpXwjPUSVWWS4UIbGD1ab74wO3lAPqOG2T8iECY+eAyeY+em NRBJNsIQuk1E2kdg0nkHYfLYRjAS1js= X-MC-Unique: hRHUGZNsPE2L96eX0v9elg-1 X-Mimecast-MFC-AGG-ID: hRHUGZNsPE2L96eX0v9elg_1761672891 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672890; x=1762277690; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NElcIQeJ5eQxKaGBT+BiWqWbXgYojExHiTsQPrKnKAQ=; b=rBp/PjXL9QzuYI5ptM4ccWBH0XRMb6XFf9FwkLq4J/NSiEDrw7cZDDZNPn0vXaqFqb qHA3DUrVbOmLrllgM0H1SFmupvvHZjxPy2R5a8ebpJicHi7nSAjktUw5KQH8ameABSmp p49+0qdaGDprguPpssP1+41z5NTsW6ZfM0/QuzyMC2Md3xB0xHrK0eVu2BLEGMJ5UgkH yRgDU4ZKdRaCmn2Y4KapoF15Qksph/ZhK65yh4XFTuuMKkTCXPcPSQwn7nHS6GQJzU15 PMop+GE03znM22dBbyRnGJJPfwJx7OLHt1vYXAZQYS3YRljgoF6polDTkJU2of0iEZAa 5VtQ== X-Gm-Message-State: AOJu0YwyFTQ7Skgrfc++WravrcUiyP3mNIVDHSR9zmwGsCYaXDPYBED2 bHYf+20Rf6afR4WrvnAJZAwSsi26TfwD1tAOM2LcTI0KDqri87pRFSf+GTUCDR2i1s0xsZKI8Cv iiKI8ZVmn867EMwELRtqF8/5pW4/n1UMU7ojp2S0hTwypnOcK0NlA+1CNOxTgkMSIgXnSG4fH5s zIQn8nnhzjt8QhXsxNw5wgOUZZ5kG8MXOVuYM2LDjt X-Gm-Gg: ASbGncu71JtP4VRwQxveY+1Ujtaidp4tpPJXRc/2sCSGTjXDkpFo1+qQ01LGc5AthLg QGwPwMVJ6tMbUwRa6Pox0YrsfFiTB1rP/cNy2O6IE0hokullL9apjQttOExq+FXNZ+kMTiWHrOe zJ1dhOJ12bB9V0ojIZNAOWVyZ3F1knQRPumGk4nZ8vDk+lZOmepXNlDhThN8UH6DRlBrtP4Pb8p YgvJjuLGvsnk1Ul06BSHQq4wsRp9CnAzpfK/XHnjVIsnYAFJ1+3t1elCqmAVs5wNezKdcD9Q8eJ FEyFBhaMUvSLSzdWdKJfq4Zh6CfFgYlxtsYR4N1TJR3f2ZnZ31zL3lTZuWcQp3+Bu8B49JdmBIj UJ/7K5JCdI8IdHAo6pZwSq8fgNuzLYZTMKA7ckYcVp7Dj/9nVfOGFqWr6H4vXr583xb7D900G8u tKEvE= X-Received: by 2002:a05:6000:2406:b0:426:fff3:5d04 with SMTP id ffacd0b85a97d-429aeb096c7mr57137f8f.25.1761672889706; Tue, 28 Oct 2025 10:34:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDvxyN2FmjtaH4wxf7vQe8VuIresEoGbVTD1Jii10kP9uLdyOf5v4gsKzvC2aZnyfHCY6m/A== X-Received: by 2002:a05:6000:2406:b0:426:fff3:5d04 with SMTP id ffacd0b85a97d-429aeb096c7mr57104f8f.25.1761672889244; Tue, 28 Oct 2025 10:34:49 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Zhao Liu Subject: [PULL 06/18] qobject: make refcount atomic Date: Tue, 28 Oct 2025 18:34:18 +0100 Message-ID: <20251028173430.2180057-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761673137826154100 Content-Type: text/plain; charset="utf-8" The Rust bindings for QObject will only operate on complete objects, treating them as immutable as long as the Rust QObject is live. With that constraint, it is trivial for Rust code to treat QObjects as thread-safe; all that's needed is to make reference count operations atomic. Do the same when the C code adds or removes references, since we don't really know what the Rust code is up to; of course C code will have to agree with not making changes to the QObjects after they've been passed to Rust code. Reviewed-by: Zhao Liu Signed-off-by: Paolo Bonzini --- include/qobject/qobject.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/qobject/qobject.h b/include/qobject/qobject.h index a6244d0ce00..02f4c6a6eb2 100644 --- a/include/qobject/qobject.h +++ b/include/qobject/qobject.h @@ -32,6 +32,7 @@ #ifndef QOBJECT_H #define QOBJECT_H =20 +#include "qemu/atomic.h" #include "qapi/qapi-builtin-types.h" =20 /* Not for use outside include/qobject/ */ @@ -73,7 +74,7 @@ QEMU_BUILD_BUG_MSG(QTYPE__MAX !=3D 7, static inline void qobject_ref_impl(QObject *obj) { if (obj) { - obj->base.refcnt++; + qatomic_inc(&obj->base.refcnt); } } =20 @@ -95,7 +96,7 @@ void qobject_destroy(QObject *obj); static inline void qobject_unref_impl(QObject *obj) { assert(!obj || obj->base.refcnt); - if (obj && --obj->base.refcnt =3D=3D 0) { + if (obj && qatomic_fetch_dec(&obj->base.refcnt) =3D=3D 1) { qobject_destroy(obj); } } --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761672970; cv=none; d=zohomail.com; s=zohoarc; b=mm3WfmN5nEobA3nMm9xy7NlZiA1j4Tepi/12ACbcH+Jk+Vadoc29ZaNtX1AF/TeGsnG4VvNL4WF/JnkFZiQMPPcNxYHBKzwnZDVGFC0n7gKK2azdl+S5ErNeXrmwNWLpbkdFFfJimgC87Wb14dcgx9m56FC6Ll3+yxNmI5DqnIs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761672970; 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=gfN0lYjTlYTB2xRS8LaOrbA2wAIyKHJaQeRzUL0J6RU=; b=ewiMs3I3e1/Fv2hJM7dbQ9xdya0TG2kdOkYUvPUPaWFqnSAw+iGGauUEJ+f+se8zo2HEXPdLSWtpmZfmQ1XgIpZgR8c1Zei4fA9yQZ+yfjgyZ2o5fwKz0lvqMbevngJhnX+I8M6aBpOZJ3ew1rreXQrMprmm2nkZTWc1IzgdeXI= 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 176167297033439.07423850485668; Tue, 28 Oct 2025 10:36:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnbJ-0006Dq-EV; Tue, 28 Oct 2025 13:35:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbF-0006Bu-Rk for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnb5-0004SF-BL for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:13 -0400 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-300-d3_FKJCfO9GV1grA60s8Xw-1; Tue, 28 Oct 2025 13:34:58 -0400 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4770c37331fso17765735e9.3 for ; Tue, 28 Oct 2025 10:34:58 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429952db839sm22388277f8f.34.2025.10.28.10.34.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:34:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672901; 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=gfN0lYjTlYTB2xRS8LaOrbA2wAIyKHJaQeRzUL0J6RU=; b=LJZG8lklimUz9+eKtmjx07/VkPZLpaot98+SAKGMmDjRjZOd7LlHwsoisd/sTSQFBH8Gat 25aw4U4gJC/274MmnNT5Z+RL+Uygnp93PYQma59zuRCpZG0igy9htAzjv//A6HPEOo+hgl exFl/o9kGJcTR6HxT+WjQ/OAHmReY7M= X-MC-Unique: d3_FKJCfO9GV1grA60s8Xw-1 X-Mimecast-MFC-AGG-ID: d3_FKJCfO9GV1grA60s8Xw_1761672897 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672897; x=1762277697; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gfN0lYjTlYTB2xRS8LaOrbA2wAIyKHJaQeRzUL0J6RU=; b=q5hrpxVM/reAgIr6hHYVbjisi8B1usI1ijVi7lnJwdUPuYLltpZWh0SxfFsaFJd4xp 1lH+dy48wmORi5O17GJmHguqsq8s+n2tIPsAH5Bn5frjRtzQ4t+0c6LKF7C4nSMiJhzb vQMTvqFZ4y+WCbpJsoMyMde489pHN+wOXhTHaOUQeGjCaft6KFS1qMCG+O+yUqUNoO+M /HvawVnW2SsbT4EikwA84axbBp+EJNFaWPWW4zEaWbSrjQtl4q4T9Gwo8AfQFKNNIEMg kcQ+536CqyGcEcOgMQfU9UgM8xgSXzYd3WxUei9xEU7ZozA/pS233eaotxdYs9us+0Bb IPeg== X-Gm-Message-State: AOJu0YyKKEyeftgh6GtXmXSXRNpSJ0343GHjbwzV/bS/HA4WSKrTPzdC 7Je4ykvJ2W6BDgTKE8FfpSwUFBDh/LirASpWkdlmXGRvVntMp+WSRYiAdHj9W4eb6IdCxbKW2rV EgtB/ci9b8rnQGUznp8VTgRENMSExmd0pRpFIxChr/xsLvSe3GWYI3aoJCrNhjjKB4PszQ2/Jo7 Bbw0rCcTftVYf+gXYC4u9zZLtDbkaQHSa/3zQI7k7Q X-Gm-Gg: ASbGncv8ZHHKFjeshzUVOrg/miD1RQxZmMu/4r2tUA9FmfnvUXw58E7mKzd1iXU4RYM /FdcwD1pb1TcSG17Ggs8YWTzRn53x0gvk+3hgwmVJgIJozrehm7PGyqv0jBQ1QB3Nbrm9byl8HD FemP2mMm5Ho/ZA7TUDjC529uUtHkFJ/UgjEGm3mWxeFhC6LgL+cxMDotu93IhNv813riNO3lGHq JRx0odSDIXQoXoNt7rDhuKLsEP7kL9LlddaxxoQyqgyi+hKg2+kF9UVT0pDIoKhkk4K2NQhZPxl ktzM6DUPzUE67TbXYCoG9YTJc34eu71k8/UAdUd3c7LI0/vptkm4WqQe7iPOOwqsCPwjX3tJANq 3vduEnPAMYPBmp+2iQIbXCak1ndbyWsRs3PyzZi6jNQsz0/VMe1yitlNOedALVidi+ESycYBiTC AShx8= X-Received: by 2002:a05:6000:2886:b0:426:d5bf:aa1 with SMTP id ffacd0b85a97d-429a7e99fbcmr3823530f8f.62.1761672895487; Tue, 28 Oct 2025 10:34:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdeKqsU8X/y7wsWtpa6aapKTltHHYAWeuWQDHL4mPC8v6s3FYHSMpyB8k3WLIbjysGeDF+Sg== X-Received: by 2002:a05:6000:2886:b0:426:d5bf:aa1 with SMTP id ffacd0b85a97d-429a7e99fbcmr3823411f8f.62.1761672893031; Tue, 28 Oct 2025 10:34:53 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 07/18] char: rename CharBackend->CharFrontend Date: Tue, 28 Oct 2025 18:34:19 +0100 Message-ID: <20251028173430.2180057-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761672976068158500 From: Marc-Andr=C3=A9 Lureau The actual backend is "Chardev", CharBackend is the frontend side of it (whatever talks to the backend), let's rename it for readability. Signed-off-by: Marc-Andr=C3=A9 Lureau Link: https://lore.kernel.org/r/20251022074612.1258413-1-marcandre.lureau@r= edhat.com Signed-off-by: Paolo Bonzini --- chardev/chardev-internal.h | 12 +- include/chardev/char-fe.h | 67 +++++---- include/chardev/char.h | 4 +- include/hw/char/avr_usart.h | 2 +- include/hw/char/bcm2835_aux.h | 2 +- include/hw/char/cadence_uart.h | 2 +- include/hw/char/cmsdk-apb-uart.h | 2 +- include/hw/char/digic-uart.h | 2 +- include/hw/char/escc.h | 2 +- include/hw/char/goldfish_tty.h | 2 +- include/hw/char/ibex_uart.h | 2 +- include/hw/char/imx_serial.h | 2 +- include/hw/char/max78000_uart.h | 2 +- include/hw/char/nrf51_uart.h | 2 +- include/hw/char/parallel.h | 2 +- include/hw/char/pl011.h | 2 +- include/hw/char/renesas_sci.h | 2 +- include/hw/char/riscv_htif.h | 2 +- include/hw/char/serial.h | 2 +- include/hw/char/shakti_uart.h | 2 +- include/hw/char/sifive_uart.h | 2 +- include/hw/char/stm32f2xx_usart.h | 2 +- include/hw/char/stm32l4x5_usart.h | 2 +- include/hw/misc/ivshmem-flat.h | 2 +- include/hw/qdev-properties-system.h | 2 +- include/hw/virtio/vhost-user-base.h | 2 +- include/hw/virtio/vhost-user-blk.h | 2 +- include/hw/virtio/vhost-user-fs.h | 2 +- include/hw/virtio/vhost-user-scmi.h | 2 +- include/hw/virtio/vhost-user-vsock.h | 2 +- include/hw/virtio/vhost-user.h | 8 +- include/hw/virtio/virtio-gpu.h | 2 +- include/hw/virtio/virtio-scsi.h | 2 +- include/system/qtest.h | 4 +- include/system/vhost-user-backend.h | 2 +- monitor/monitor-internal.h | 2 +- backends/cryptodev-vhost-user.c | 2 +- backends/rng-egd.c | 2 +- backends/tpm/tpm_emulator.c | 4 +- chardev/char-fe.c | 144 +++++++++---------- chardev/char-hub.c | 18 +-- chardev/char-mux.c | 40 +++--- chardev/char.c | 44 +++--- gdbstub/system.c | 2 +- hw/arm/strongarm.c | 2 +- hw/char/debugcon.c | 2 +- hw/char/exynos4210_uart.c | 2 +- hw/char/grlib_apbuart.c | 2 +- hw/char/ipoctal232.c | 2 +- hw/char/mcf_uart.c | 2 +- hw/char/sclpconsole-lm.c | 2 +- hw/char/sclpconsole.c | 2 +- hw/char/sh_serial.c | 2 +- hw/char/spapr_vty.c | 2 +- hw/char/terminal3270.c | 2 +- hw/char/virtio-console.c | 2 +- hw/char/xen_console.c | 2 +- hw/char/xilinx_uartlite.c | 2 +- hw/core/qdev-properties-system.c | 16 +-- hw/hppa/machine.c | 2 +- hw/ipmi/ipmi_bmc_extern.c | 2 +- hw/mips/boston.c | 2 +- hw/mips/malta.c | 2 +- hw/misc/ivshmem-pci.c | 2 +- hw/ppc/spapr_rtas.c | 2 +- hw/riscv/riscv_hart.c | 2 +- hw/usb/ccid-card-passthru.c | 2 +- hw/usb/dev-serial.c | 2 +- hw/usb/redirect.c | 2 +- hw/virtio/vhost-stub.c | 2 +- hw/virtio/vhost-user.c | 20 +-- net/colo-compare.c | 10 +- net/filter-mirror.c | 4 +- net/passt.c | 2 +- net/slirp.c | 2 +- net/vhost-user.c | 2 +- semihosting/console.c | 6 +- system/qtest.c | 20 +-- target/hppa/sys_helper.c | 12 +- target/riscv/kvm/kvm-cpu.c | 10 +- target/xtensa/xtensa-semi.c | 10 +- tests/qtest/vhost-user-test.c | 16 +-- tests/unit/test-char.c | 202 +++++++++++++-------------- tests/unit/test-yank.c | 12 +- rust/bindings/src/lib.rs | 4 +- rust/chardev/src/bindings.rs | 6 +- rust/chardev/src/chardev.rs | 26 ++-- rust/hw/char/pl011/src/device.rs | 12 +- rust/hw/core/src/qdev.rs | 2 +- 89 files changed, 428 insertions(+), 429 deletions(-) diff --git a/chardev/chardev-internal.h b/chardev/chardev-internal.h index 9752dd75f71..8ea10414aba 100644 --- a/chardev/chardev-internal.h +++ b/chardev/chardev-internal.h @@ -37,9 +37,9 @@ struct MuxChardev { Chardev parent; /* Linked frontends */ - CharBackend *backends[MAX_MUX]; - /* Linked backend */ - CharBackend chr; + CharFrontend *frontends[MAX_MUX]; + /* frontend of the underlying muxed chardev */ + CharFrontend chr; unsigned long mux_bitset; int focus; bool term_got_escape; @@ -64,8 +64,8 @@ typedef struct HubCharBackend HubCharBackend; * `hub->backends` array */ struct HubCharBackend { - HubChardev *hub; - CharBackend be; + HubChardev *hub; + CharFrontend fe; unsigned int be_ind; }; =20 @@ -108,7 +108,7 @@ DECLARE_INSTANCE_CHECKER(HubChardev, HUB_CHARDEV, #define CHARDEV_IS_HUB(chr) \ object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_HUB) =20 -bool mux_chr_attach_frontend(MuxChardev *d, CharBackend *b, +bool mux_chr_attach_frontend(MuxChardev *d, CharFrontend *c, unsigned int *tag, Error **errp); bool mux_chr_detach_frontend(MuxChardev *d, unsigned int tag); void mux_set_focus(Chardev *chr, unsigned int focus); diff --git a/include/chardev/char-fe.h b/include/chardev/char-fe.h index 8ef05b3dd09..5f8a6df17dc 100644 --- a/include/chardev/char-fe.h +++ b/include/chardev/char-fe.h @@ -8,12 +8,12 @@ typedef void IOEventHandler(void *opaque, QEMUChrEvent ev= ent); typedef int BackendChangeHandler(void *opaque); =20 /** - * struct CharBackend - back end as seen by front end + * struct CharFrontend - Chardev as seen by front end * @fe_is_open: the front end is ready for IO * * The actual backend is Chardev */ -struct CharBackend { +struct CharFrontend { Chardev *chr; IOEventHandler *chr_event; IOCanReadHandler *chr_can_read; @@ -27,53 +27,52 @@ struct CharBackend { /** * qemu_chr_fe_init: * - * Initializes a front end for the given CharBackend and - * Chardev. Call qemu_chr_fe_deinit() to remove the association and - * release the driver. + * Initializes the frontend @c for the given Chardev backend @s. Call + * qemu_chr_fe_deinit() to remove the association and release the backend. * * Returns: false on error. */ -bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Error **errp); +bool qemu_chr_fe_init(CharFrontend *c, Chardev *be, Error **errp); =20 /** * qemu_chr_fe_deinit: - * @b: a CharBackend + * @c: a CharFrontend * @del: if true, delete the chardev backend * - * Dissociate the CharBackend from the Chardev. + * Dissociate the CharFrontend from the Chardev. * * Safe to call without associated Chardev. */ -void qemu_chr_fe_deinit(CharBackend *b, bool del); +void qemu_chr_fe_deinit(CharFrontend *c, bool del); =20 /** * qemu_chr_fe_get_driver: * - * Returns: the driver associated with a CharBackend or NULL if no + * Returns: the driver associated with a CharFrontend or NULL if no * associated Chardev. * Note: avoid this function as the driver should never be accessed direct= ly, * especially by the frontends that support chardevice hotswap. * Consider qemu_chr_fe_backend_connected() to check for driver exis= tence */ -Chardev *qemu_chr_fe_get_driver(CharBackend *be); +Chardev *qemu_chr_fe_get_driver(CharFrontend *c); =20 /** * qemu_chr_fe_backend_connected: * - * Returns: true if there is a chardevice associated with @be. + * Returns: true if there is a backend associated with @c. */ -bool qemu_chr_fe_backend_connected(CharBackend *be); +bool qemu_chr_fe_backend_connected(CharFrontend *c); =20 /** * qemu_chr_fe_backend_open: * - * Returns: true if chardevice associated with @be is open. + * Returns: true if the backend associated with @c is open. */ -bool qemu_chr_fe_backend_open(CharBackend *be); +bool qemu_chr_fe_backend_open(CharFrontend *c); =20 /** * qemu_chr_fe_set_handlers_full: - * @b: a CharBackend + * @c: a CharFrontend * @fd_can_read: callback to get the amount of data the frontend may * receive * @fd_read: callback to receive data from char @@ -91,7 +90,7 @@ bool qemu_chr_fe_backend_open(CharBackend *be); * * Without associated Chardev, nothing is changed. */ -void qemu_chr_fe_set_handlers_full(CharBackend *b, +void qemu_chr_fe_set_handlers_full(CharFrontend *c, IOCanReadHandler *fd_can_read, IOReadHandler *fd_read, IOEventHandler *fd_event, @@ -106,7 +105,7 @@ void qemu_chr_fe_set_handlers_full(CharBackend *b, * * Version of qemu_chr_fe_set_handlers_full() with sync_state =3D true. */ -void qemu_chr_fe_set_handlers(CharBackend *b, +void qemu_chr_fe_set_handlers(CharFrontend *c, IOCanReadHandler *fd_can_read, IOReadHandler *fd_read, IOEventHandler *fd_event, @@ -122,14 +121,14 @@ void qemu_chr_fe_set_handlers(CharBackend *b, * * Without associated Chardev, nothing is changed. */ -void qemu_chr_fe_take_focus(CharBackend *b); +void qemu_chr_fe_take_focus(CharFrontend *c); =20 /** * qemu_chr_fe_accept_input: * * Notify that the frontend is ready to receive data */ -void qemu_chr_fe_accept_input(CharBackend *be); +void qemu_chr_fe_accept_input(CharFrontend *c); =20 /** * qemu_chr_fe_disconnect: @@ -137,7 +136,7 @@ void qemu_chr_fe_accept_input(CharBackend *be); * Close a fd accepted by character backend. * Without associated Chardev, do nothing. */ -void qemu_chr_fe_disconnect(CharBackend *be); +void qemu_chr_fe_disconnect(CharFrontend *c); =20 /** * qemu_chr_fe_wait_connected: @@ -145,7 +144,7 @@ void qemu_chr_fe_disconnect(CharBackend *be); * Wait for character backend to be connected, return < 0 on error or * if no associated Chardev. */ -int qemu_chr_fe_wait_connected(CharBackend *be, Error **errp); +int qemu_chr_fe_wait_connected(CharFrontend *c, Error **errp); =20 /** * qemu_chr_fe_set_echo: @@ -156,17 +155,17 @@ int qemu_chr_fe_wait_connected(CharBackend *be, Error= **errp); * can see what you type if you try to type QMP commands. * Without associated Chardev, do nothing. */ -void qemu_chr_fe_set_echo(CharBackend *be, bool echo); +void qemu_chr_fe_set_echo(CharFrontend *c, bool echo); =20 /** * qemu_chr_fe_set_open: - * @be: a CharBackend + * @c: a CharFrontend * @is_open: the front end open status * * This is an indication that the front end is ready (or not) to begin * doing I/O. Without associated Chardev, do nothing. */ -void qemu_chr_fe_set_open(CharBackend *be, bool is_open); +void qemu_chr_fe_set_open(CharFrontend *c, bool is_open); =20 /** * qemu_chr_fe_printf: @@ -176,7 +175,7 @@ void qemu_chr_fe_set_open(CharBackend *be, bool is_open= ); * function is thread-safe. It does nothing without associated * Chardev. */ -void qemu_chr_fe_printf(CharBackend *be, const char *fmt, ...) +void qemu_chr_fe_printf(CharFrontend *c, const char *fmt, ...) G_GNUC_PRINTF(2, 3); =20 =20 @@ -215,7 +214,7 @@ typedef gboolean (*FEWatchFunc)(void *do_not_use, GIOCo= ndition condition, void * * * Returns: the source tag */ -guint qemu_chr_fe_add_watch(CharBackend *be, GIOCondition cond, +guint qemu_chr_fe_add_watch(CharFrontend *c, GIOCondition cond, FEWatchFunc func, void *user_data); =20 /** @@ -230,7 +229,7 @@ guint qemu_chr_fe_add_watch(CharBackend *be, GIOConditi= on cond, * Returns: the number of bytes consumed (0 if no associated Chardev) * or -1 on error. */ -int qemu_chr_fe_write(CharBackend *be, const uint8_t *buf, int len); +int qemu_chr_fe_write(CharFrontend *c, const uint8_t *buf, int len); =20 /** * qemu_chr_fe_write_all: @@ -245,7 +244,7 @@ int qemu_chr_fe_write(CharBackend *be, const uint8_t *b= uf, int len); * Returns: the number of bytes consumed (0 if no associated Chardev) * or -1 on error. */ -int qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, int len); +int qemu_chr_fe_write_all(CharFrontend *c, const uint8_t *buf, int len); =20 /** * qemu_chr_fe_read_all: @@ -257,7 +256,7 @@ int qemu_chr_fe_write_all(CharBackend *be, const uint8_= t *buf, int len); * Returns: the number of bytes read (0 if no associated Chardev) * or -1 on error. */ -int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, int len); +int qemu_chr_fe_read_all(CharFrontend *c, uint8_t *buf, int len); =20 /** * qemu_chr_fe_ioctl: @@ -270,7 +269,7 @@ int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf,= int len); * associated Chardev, -ENOTSUP, otherwise the return * value depends on the semantics of @cmd */ -int qemu_chr_fe_ioctl(CharBackend *be, int cmd, void *arg); +int qemu_chr_fe_ioctl(CharFrontend *c, int cmd, void *arg); =20 /** * qemu_chr_fe_get_msgfd: @@ -283,7 +282,7 @@ int qemu_chr_fe_ioctl(CharBackend *be, int cmd, void *a= rg); * this function will return -1 until a client sends a new file * descriptor. */ -int qemu_chr_fe_get_msgfd(CharBackend *be); +int qemu_chr_fe_get_msgfd(CharFrontend *c); =20 /** * qemu_chr_fe_get_msgfds: @@ -296,7 +295,7 @@ int qemu_chr_fe_get_msgfd(CharBackend *be); * this function will return -1 until a client sends a new set of= file * descriptors. */ -int qemu_chr_fe_get_msgfds(CharBackend *be, int *fds, int num); +int qemu_chr_fe_get_msgfds(CharFrontend *c, int *fds, int num); =20 /** * qemu_chr_fe_set_msgfds: @@ -309,6 +308,6 @@ int qemu_chr_fe_get_msgfds(CharBackend *be, int *fds, i= nt num); * * Returns: -1 if fd passing isn't supported or no associated Chardev. */ -int qemu_chr_fe_set_msgfds(CharBackend *be, int *fds, int num); +int qemu_chr_fe_set_msgfds(CharFrontend *c, int *fds, int num); =20 #endif /* QEMU_CHAR_FE_H */ diff --git a/include/chardev/char.h b/include/chardev/char.h index 429852f8d9d..b65e9981c14 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -15,7 +15,7 @@ #define IAC 255 =20 /* character device */ -typedef struct CharBackend CharBackend; +typedef struct CharFrontend CharFrontend; =20 typedef enum { CHR_EVENT_BREAK, /* serial break char */ @@ -60,7 +60,7 @@ struct Chardev { Object parent_obj; =20 QemuMutex chr_write_lock; - CharBackend *be; + CharFrontend *fe; char *label; char *filename; int logfd; diff --git a/include/hw/char/avr_usart.h b/include/hw/char/avr_usart.h index 0cc599e9b15..bd2d488f9a1 100644 --- a/include/hw/char/avr_usart.h +++ b/include/hw/char/avr_usart.h @@ -66,7 +66,7 @@ struct AVRUsartState { /* */ MemoryRegion mmio; =20 - CharBackend chr; + CharFrontend chr; =20 bool enabled; =20 diff --git a/include/hw/char/bcm2835_aux.h b/include/hw/char/bcm2835_aux.h index 9e081793a08..a11134f216f 100644 --- a/include/hw/char/bcm2835_aux.h +++ b/include/hw/char/bcm2835_aux.h @@ -24,7 +24,7 @@ struct BCM2835AuxState { /*< public >*/ =20 MemoryRegion iomem; - CharBackend chr; + CharFrontend chr; qemu_irq irq; =20 uint8_t read_fifo[BCM2835_AUX_RX_FIFO_LEN]; diff --git a/include/hw/char/cadence_uart.h b/include/hw/char/cadence_uart.h index e7f7cd84683..c87c327357f 100644 --- a/include/hw/char/cadence_uart.h +++ b/include/hw/char/cadence_uart.h @@ -47,7 +47,7 @@ struct CadenceUARTState { uint32_t rx_count; uint32_t tx_count; uint64_t char_tx_time; - CharBackend chr; + CharFrontend chr; qemu_irq irq; QEMUTimer *fifo_trigger_handle; Clock *refclk; diff --git a/include/hw/char/cmsdk-apb-uart.h b/include/hw/char/cmsdk-apb-u= art.h index 7de8f8d1b94..3d0af26cebc 100644 --- a/include/hw/char/cmsdk-apb-uart.h +++ b/include/hw/char/cmsdk-apb-uart.h @@ -25,7 +25,7 @@ struct CMSDKAPBUART { =20 /*< public >*/ MemoryRegion iomem; - CharBackend chr; + CharFrontend chr; qemu_irq txint; qemu_irq rxint; qemu_irq txovrint; diff --git a/include/hw/char/digic-uart.h b/include/hw/char/digic-uart.h index f710a1a099e..3eebdab8a01 100644 --- a/include/hw/char/digic-uart.h +++ b/include/hw/char/digic-uart.h @@ -38,7 +38,7 @@ struct DigicUartState { /*< public >*/ =20 MemoryRegion regs_region; - CharBackend chr; + CharFrontend chr; =20 uint32_t reg_rx; uint32_t reg_st; diff --git a/include/hw/char/escc.h b/include/hw/char/escc.h index 8c4c6a7730c..857f64699e3 100644 --- a/include/hw/char/escc.h +++ b/include/hw/char/escc.h @@ -36,7 +36,7 @@ typedef struct ESCCChannelState { uint32_t reg; uint8_t wregs[ESCC_SERIAL_REGS], rregs[ESCC_SERIAL_REGS]; ESCCSERIOQueue queue; - CharBackend chr; + CharFrontend chr; int e0_mode, led_mode, caps_lock_mode, num_lock_mode; int disabled; int clock; diff --git a/include/hw/char/goldfish_tty.h b/include/hw/char/goldfish_tty.h index d59733e5ae4..70fdedd1d0f 100644 --- a/include/hw/char/goldfish_tty.h +++ b/include/hw/char/goldfish_tty.h @@ -24,7 +24,7 @@ struct GoldfishTTYState { =20 MemoryRegion iomem; qemu_irq irq; - CharBackend chr; + CharFrontend chr; =20 uint32_t data_len; uint64_t data_ptr; diff --git a/include/hw/char/ibex_uart.h b/include/hw/char/ibex_uart.h index 9deadf223bf..1ccbb602e61 100644 --- a/include/hw/char/ibex_uart.h +++ b/include/hw/char/ibex_uart.h @@ -64,7 +64,7 @@ struct IbexUartState { =20 Clock *f_clk; =20 - CharBackend chr; + CharFrontend chr; qemu_irq tx_watermark; qemu_irq rx_watermark; qemu_irq tx_empty; diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h index 90ba3ff18c2..2dcd2e6bcdd 100644 --- a/include/hw/char/imx_serial.h +++ b/include/hw/char/imx_serial.h @@ -122,7 +122,7 @@ struct IMXSerialState { uint32_t ucr4; =20 qemu_irq irq; - CharBackend chr; + CharFrontend chr; }; =20 #endif diff --git a/include/hw/char/max78000_uart.h b/include/hw/char/max78000_uar= t.h index cf90d51dbfa..ac93f83389a 100644 --- a/include/hw/char/max78000_uart.h +++ b/include/hw/char/max78000_uart.h @@ -72,7 +72,7 @@ struct Max78000UartState { =20 Fifo8 rx_fifo; =20 - CharBackend chr; + CharFrontend chr; qemu_irq irq; }; #endif /* HW_STM32F2XX_USART_H */ diff --git a/include/hw/char/nrf51_uart.h b/include/hw/char/nrf51_uart.h index 561b6383c40..03d8c2a20d2 100644 --- a/include/hw/char/nrf51_uart.h +++ b/include/hw/char/nrf51_uart.h @@ -59,7 +59,7 @@ struct NRF51UARTState { SysBusDevice parent_obj; =20 MemoryRegion iomem; - CharBackend chr; + CharFrontend chr; qemu_irq irq; guint watch_tag; =20 diff --git a/include/hw/char/parallel.h b/include/hw/char/parallel.h index 7b04478226b..3f8d9b59a76 100644 --- a/include/hw/char/parallel.h +++ b/include/hw/char/parallel.h @@ -15,7 +15,7 @@ typedef struct ParallelState { uint8_t control; qemu_irq irq; int irq_pending; - CharBackend chr; + CharFrontend chr; int hw_driver; int epp_timeout; uint32_t last_read_offset; /* For debugging */ diff --git a/include/hw/char/pl011.h b/include/hw/char/pl011.h index 299ca9b18bb..2d4ff01c815 100644 --- a/include/hw/char/pl011.h +++ b/include/hw/char/pl011.h @@ -47,7 +47,7 @@ struct PL011State { int read_pos; int read_count; int read_trigger; - CharBackend chr; + CharFrontend chr; qemu_irq irq[6]; Clock *clk; bool migrate_clk; diff --git a/include/hw/char/renesas_sci.h b/include/hw/char/renesas_sci.h index a4764e3eee3..90e784f36a3 100644 --- a/include/hw/char/renesas_sci.h +++ b/include/hw/char/renesas_sci.h @@ -33,7 +33,7 @@ struct RSCIState { =20 MemoryRegion memory; QEMUTimer timer; - CharBackend chr; + CharFrontend chr; qemu_irq irq[SCI_NR_IRQ]; =20 uint8_t smr; diff --git a/include/hw/char/riscv_htif.h b/include/hw/char/riscv_htif.h index ee0ca299024..9d61e60d0a9 100644 --- a/include/hw/char/riscv_htif.h +++ b/include/hw/char/riscv_htif.h @@ -36,7 +36,7 @@ typedef struct HTIFState { hwaddr fromhost_offset; MemoryRegion mmio; =20 - CharBackend chr; + CharFrontend chr; uint64_t pending_read; } HTIFState; =20 diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 4bf90a46f3c..486c0e0f35e 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -54,7 +54,7 @@ struct SerialState { it can be reset while reading iir */ int thr_ipending; qemu_irq irq; - CharBackend chr; + CharFrontend chr; int last_break_enable; uint32_t baudbase; uint32_t tsr_retry; diff --git a/include/hw/char/shakti_uart.h b/include/hw/char/shakti_uart.h index 526c408233f..e5e775d7c9a 100644 --- a/include/hw/char/shakti_uart.h +++ b/include/hw/char/shakti_uart.h @@ -68,7 +68,7 @@ typedef struct { uint32_t uart_iq_cycles; uint32_t uart_rx_threshold; =20 - CharBackend chr; + CharFrontend chr; } ShaktiUartState; =20 #endif /* HW_SHAKTI_UART_H */ diff --git a/include/hw/char/sifive_uart.h b/include/hw/char/sifive_uart.h index 0846cf62188..6486c3f4a5d 100644 --- a/include/hw/char/sifive_uart.h +++ b/include/hw/char/sifive_uart.h @@ -67,7 +67,7 @@ struct SiFiveUARTState { /*< public >*/ qemu_irq irq; MemoryRegion mmio; - CharBackend chr; + CharFrontend chr; =20 uint32_t txfifo; uint32_t ie; diff --git a/include/hw/char/stm32f2xx_usart.h b/include/hw/char/stm32f2xx_= usart.h index fdfa7424a70..f9018b8b8f6 100644 --- a/include/hw/char/stm32f2xx_usart.h +++ b/include/hw/char/stm32f2xx_usart.h @@ -73,7 +73,7 @@ struct STM32F2XXUsartState { uint32_t usart_cr3; uint32_t usart_gtpr; =20 - CharBackend chr; + CharFrontend chr; qemu_irq irq; }; #endif /* HW_STM32F2XX_USART_H */ diff --git a/include/hw/char/stm32l4x5_usart.h b/include/hw/char/stm32l4x5_= usart.h index dd3866682a3..cdf7419f533 100644 --- a/include/hw/char/stm32l4x5_usart.h +++ b/include/hw/char/stm32l4x5_usart.h @@ -53,7 +53,7 @@ struct Stm32l4x5UsartBaseState { uint32_t tdr; =20 Clock *clk; - CharBackend chr; + CharFrontend chr; qemu_irq irq; guint watch_tag; }; diff --git a/include/hw/misc/ivshmem-flat.h b/include/hw/misc/ivshmem-flat.h index 3eca99004ef..d656e578085 100644 --- a/include/hw/misc/ivshmem-flat.h +++ b/include/hw/misc/ivshmem-flat.h @@ -65,7 +65,7 @@ struct IvshmemFTState { QTAILQ_HEAD(, IvshmemPeer) peer; IvshmemPeer own; =20 - CharBackend server_chr; + CharFrontend server_chr; =20 /* IRQ */ qemu_irq irq; diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properti= es-system.h index 9601a11a090..5c6cc5eae8b 100644 --- a/include/hw/qdev-properties-system.h +++ b/include/hw/qdev-properties-system.h @@ -38,7 +38,7 @@ extern const PropertyInfo qdev_prop_virtio_gpu_output_lis= t; DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pci_devfn, int32_t) =20 #define DEFINE_PROP_CHR(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharBackend) + DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharFrontend) #define DEFINE_PROP_NETDEV(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_netdev, NICPeers) #define DEFINE_PROP_DRIVE(_n, _s, _f) \ diff --git a/include/hw/virtio/vhost-user-base.h b/include/hw/virtio/vhost-= user-base.h index 387e434b804..d5d2f081aec 100644 --- a/include/hw/virtio/vhost-user-base.h +++ b/include/hw/virtio/vhost-user-base.h @@ -20,7 +20,7 @@ struct VHostUserBase { VirtIODevice parent_obj; =20 /* Properties */ - CharBackend chardev; + CharFrontend chardev; uint16_t virtio_id; uint32_t num_vqs; uint32_t vq_size; /* can't exceed VIRTIO_QUEUE_MAX */ diff --git a/include/hw/virtio/vhost-user-blk.h b/include/hw/virtio/vhost-u= ser-blk.h index a10f7856725..8158d4673d4 100644 --- a/include/hw/virtio/vhost-user-blk.h +++ b/include/hw/virtio/vhost-user-blk.h @@ -29,7 +29,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(VHostUserBlk, VHOST_USER_BLK) =20 struct VHostUserBlk { VirtIODevice parent_obj; - CharBackend chardev; + CharFrontend chardev; int32_t bootindex; struct virtio_blk_config blkcfg; uint16_t num_queues; diff --git a/include/hw/virtio/vhost-user-fs.h b/include/hw/virtio/vhost-us= er-fs.h index 94c3aaa84ed..5699ea03a1a 100644 --- a/include/hw/virtio/vhost-user-fs.h +++ b/include/hw/virtio/vhost-user-fs.h @@ -24,7 +24,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(VHostUserFS, VHOST_USER_FS) =20 typedef struct { - CharBackend chardev; + CharFrontend chardev; char *tag; uint16_t num_request_queues; uint16_t queue_size; diff --git a/include/hw/virtio/vhost-user-scmi.h b/include/hw/virtio/vhost-= user-scmi.h index c90db77dd55..30ab0d7ab73 100644 --- a/include/hw/virtio/vhost-user-scmi.h +++ b/include/hw/virtio/vhost-user-scmi.h @@ -18,7 +18,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(VHostUserSCMI, VHOST_USER_SCMI= ); =20 struct VHostUserSCMI { VirtIODevice parent; - CharBackend chardev; + CharFrontend chardev; struct vhost_virtqueue *vhost_vqs; struct vhost_dev vhost_dev; VhostUserState vhost_user; diff --git a/include/hw/virtio/vhost-user-vsock.h b/include/hw/virtio/vhost= -user-vsock.h index 67aa46c9527..5db6938b8b1 100644 --- a/include/hw/virtio/vhost-user-vsock.h +++ b/include/hw/virtio/vhost-user-vsock.h @@ -20,7 +20,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(VHostUserVSock, VHOST_USER_VSOCK) =20 typedef struct { - CharBackend chardev; + CharFrontend chardev; } VHostUserVSockConf; =20 struct VHostUserVSock { diff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h index 9a3f238b43c..55d5725ef84 100644 --- a/include/hw/virtio/vhost-user.h +++ b/include/hw/virtio/vhost-user.h @@ -64,7 +64,7 @@ typedef struct VhostUserHostNotifier { * @memory_slots: */ typedef struct VhostUserState { - CharBackend *chr; + CharFrontend *chr; GPtrArray *notifiers; int memory_slots; bool supports_config; @@ -82,7 +82,7 @@ typedef struct VhostUserState { * * Return: true on success, false on error while setting errp. */ -bool vhost_user_init(VhostUserState *user, CharBackend *chr, Error **errp); +bool vhost_user_init(VhostUserState *user, CharFrontend *chr, Error **errp= ); =20 /** * vhost_user_cleanup() - cleanup state @@ -96,7 +96,7 @@ void vhost_user_cleanup(VhostUserState *user); /** * vhost_user_async_close() - cleanup vhost-user post connection drop * @d: DeviceState for the associated device (passed to callback) - * @chardev: the CharBackend associated with the connection + * @chardev: the CharFrontend associated with the connection * @vhost: the common vhost device * @cb: the user callback function to complete the clean-up * @@ -108,7 +108,7 @@ void vhost_user_cleanup(VhostUserState *user); typedef void (*vu_async_close_fn)(DeviceState *cb); =20 void vhost_user_async_close(DeviceState *d, - CharBackend *chardev, struct vhost_dev *vhost, + CharFrontend *chardev, struct vhost_dev *vhost, vu_async_close_fn cb); =20 #endif diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 9f16f89a36d..58e0f91fda6 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -257,7 +257,7 @@ struct VhostUserGPU { =20 VhostUserBackend *vhost; int vhost_gpu_fd; /* closed by the chardev */ - CharBackend vhost_chr; + CharFrontend vhost_chr; QemuDmaBuf *dmabuf[VIRTIO_GPU_MAX_SCANOUTS]; bool backend_blocked; }; diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scs= i.h index 31e852ed6c4..b6028bb5cd2 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -58,7 +58,7 @@ struct VirtIOSCSIConf { uint32_t cmd_per_lun; char *vhostfd; char *wwpn; - CharBackend chardev; + CharFrontend chardev; uint32_t boot_tpgt; IOThread *iothread; IOThreadVirtQueueMappingList *iothread_vq_mapping_list; diff --git a/include/system/qtest.h b/include/system/qtest.h index 84b1f8c6ee4..7f6dc01d147 100644 --- a/include/system/qtest.h +++ b/include/system/qtest.h @@ -23,8 +23,8 @@ static inline bool qtest_enabled(void) return qtest_allowed; } =20 -void G_GNUC_PRINTF(2, 3) qtest_sendf(CharBackend *chr, const char *fmt, ..= .); -void qtest_set_command_cb(bool (*pc_cb)(CharBackend *chr, gchar **words)); +void G_GNUC_PRINTF(2, 3) qtest_sendf(CharFrontend *chr, const char *fmt, .= ..); +void qtest_set_command_cb(bool (*pc_cb)(CharFrontend *chr, gchar **words)); bool qtest_driver(void); =20 void qtest_server_init(const char *qtest_chrdev, const char *qtest_log, Er= ror **errp); diff --git a/include/system/vhost-user-backend.h b/include/system/vhost-use= r-backend.h index 5634ebdb2eb..3184c8e7993 100644 --- a/include/system/vhost-user-backend.h +++ b/include/system/vhost-user-backend.h @@ -32,7 +32,7 @@ struct VhostUserBackend { Object parent; =20 char *chr_name; - CharBackend chr; + CharFrontend chr; VhostUserState vhost_user; struct vhost_dev dev; VirtIODevice *vdev; diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index 5676eb334e8..7735c731083 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -93,7 +93,7 @@ typedef struct HMPCommand { } HMPCommand; =20 struct Monitor { - CharBackend chr; + CharFrontend chr; int suspend_cnt; /* Needs to be accessed atomically */ bool is_qmp; bool skip_flush; diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-use= r.c index cb04e68b022..cc478d9902d 100644 --- a/backends/cryptodev-vhost-user.c +++ b/backends/cryptodev-vhost-user.c @@ -46,7 +46,7 @@ struct CryptoDevBackendVhostUser { CryptoDevBackend parent_obj; =20 VhostUserState vhost_user; - CharBackend chr; + CharFrontend chr; char *chr_name; bool opened; CryptoDevBackendVhost *vhost_crypto[MAX_CRYPTO_QUEUE_NUM]; diff --git a/backends/rng-egd.c b/backends/rng-egd.c index 9fd3393ede2..1d92bd71cf7 100644 --- a/backends/rng-egd.c +++ b/backends/rng-egd.c @@ -24,7 +24,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(RngEgd, RNG_EGD) struct RngEgd { RngBackend parent; =20 - CharBackend chr; + CharFrontend chr; char *chr_name; }; =20 diff --git a/backends/tpm/tpm_emulator.c b/backends/tpm/tpm_emulator.c index dacfca5ab7e..f32b67dac7b 100644 --- a/backends/tpm/tpm_emulator.c +++ b/backends/tpm/tpm_emulator.c @@ -69,7 +69,7 @@ struct TPMEmulator { TPMBackend parent; =20 TPMEmulatorOptions *options; - CharBackend ctrl_chr; + CharFrontend ctrl_chr; QIOChannel *data_ioc; TPMVersion tpm_version; uint32_t caps; /* capabilities of the TPM */ @@ -126,7 +126,7 @@ static int tpm_emulator_ctrlcmd(TPMEmulator *tpm, unsig= ned long cmd, void *msg, size_t msg_len_in, size_t msg_len_out_err, size_t msg_len_out_total) { - CharBackend *dev =3D &tpm->ctrl_chr; + CharFrontend *dev =3D &tpm->ctrl_chr; uint32_t cmd_no =3D cpu_to_be32(cmd); ssize_t n =3D sizeof(uint32_t) + msg_len_in; ptm_res res; diff --git a/chardev/char-fe.c b/chardev/char-fe.c index 158a5f4f551..34b83fc1c4a 100644 --- a/chardev/char-fe.c +++ b/chardev/char-fe.c @@ -30,9 +30,9 @@ #include "chardev/char-io.h" #include "chardev-internal.h" =20 -int qemu_chr_fe_write(CharBackend *be, const uint8_t *buf, int len) +int qemu_chr_fe_write(CharFrontend *c, const uint8_t *buf, int len) { - Chardev *s =3D be->chr; + Chardev *s =3D c->chr; =20 if (!s) { return 0; @@ -41,9 +41,9 @@ int qemu_chr_fe_write(CharBackend *be, const uint8_t *buf= , int len) return qemu_chr_write(s, buf, len, false); } =20 -int qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, int len) +int qemu_chr_fe_write_all(CharFrontend *c, const uint8_t *buf, int len) { - Chardev *s =3D be->chr; + Chardev *s =3D c->chr; =20 if (!s) { return 0; @@ -52,9 +52,9 @@ int qemu_chr_fe_write_all(CharBackend *be, const uint8_t = *buf, int len) return qemu_chr_write(s, buf, len, true); } =20 -int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, int len) +int qemu_chr_fe_read_all(CharFrontend *c, uint8_t *buf, int len) { - Chardev *s =3D be->chr; + Chardev *s =3D c->chr; int offset =3D 0; int res; =20 @@ -95,9 +95,9 @@ int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, i= nt len) return offset; } =20 -int qemu_chr_fe_ioctl(CharBackend *be, int cmd, void *arg) +int qemu_chr_fe_ioctl(CharFrontend *c, int cmd, void *arg) { - Chardev *s =3D be->chr; + Chardev *s =3D c->chr; int res; =20 if (!s || !CHARDEV_GET_CLASS(s)->chr_ioctl || qemu_chr_replay(s)) { @@ -109,11 +109,11 @@ int qemu_chr_fe_ioctl(CharBackend *be, int cmd, void = *arg) return res; } =20 -int qemu_chr_fe_get_msgfd(CharBackend *be) +int qemu_chr_fe_get_msgfd(CharFrontend *c) { - Chardev *s =3D be->chr; + Chardev *s =3D c->chr; int fd; - int res =3D (qemu_chr_fe_get_msgfds(be, &fd, 1) =3D=3D 1) ? fd : -1; + int res =3D (qemu_chr_fe_get_msgfds(c, &fd, 1) =3D=3D 1) ? fd : -1; if (s && qemu_chr_replay(s)) { error_report("Replay: get msgfd is not supported " "for serial devices yet"); @@ -122,9 +122,9 @@ int qemu_chr_fe_get_msgfd(CharBackend *be) return res; } =20 -int qemu_chr_fe_get_msgfds(CharBackend *be, int *fds, int len) +int qemu_chr_fe_get_msgfds(CharFrontend *c, int *fds, int len) { - Chardev *s =3D be->chr; + Chardev *s =3D c->chr; =20 if (!s) { return -1; @@ -134,9 +134,9 @@ int qemu_chr_fe_get_msgfds(CharBackend *be, int *fds, i= nt len) CHARDEV_GET_CLASS(s)->get_msgfds(s, fds, len) : -1; } =20 -int qemu_chr_fe_set_msgfds(CharBackend *be, int *fds, int num) +int qemu_chr_fe_set_msgfds(CharFrontend *c, int *fds, int num) { - Chardev *s =3D be->chr; + Chardev *s =3D c->chr; =20 if (!s) { return -1; @@ -146,9 +146,9 @@ int qemu_chr_fe_set_msgfds(CharBackend *be, int *fds, i= nt num) CHARDEV_GET_CLASS(s)->set_msgfds(s, fds, num) : -1; } =20 -void qemu_chr_fe_accept_input(CharBackend *be) +void qemu_chr_fe_accept_input(CharFrontend *c) { - Chardev *s =3D be->chr; + Chardev *s =3D c->chr; =20 if (!s) { return; @@ -160,7 +160,7 @@ void qemu_chr_fe_accept_input(CharBackend *be) qemu_notify_event(); } =20 -void qemu_chr_fe_printf(CharBackend *be, const char *fmt, ...) +void qemu_chr_fe_printf(CharFrontend *c, const char *fmt, ...) { char buf[CHR_READ_BUF_LEN]; va_list ap; @@ -168,28 +168,28 @@ void qemu_chr_fe_printf(CharBackend *be, const char *= fmt, ...) vsnprintf(buf, sizeof(buf), fmt, ap); /* XXX this blocks entire thread. Rewrite to use * qemu_chr_fe_write and background I/O callbacks */ - qemu_chr_fe_write_all(be, (uint8_t *)buf, strlen(buf)); + qemu_chr_fe_write_all(c, (uint8_t *)buf, strlen(buf)); va_end(ap); } =20 -Chardev *qemu_chr_fe_get_driver(CharBackend *be) +Chardev *qemu_chr_fe_get_driver(CharFrontend *c) { /* this is unsafe for the users that support chardev hotswap */ - assert(be->chr_be_change =3D=3D NULL); - return be->chr; + assert(c->chr_be_change =3D=3D NULL); + return c->chr; } =20 -bool qemu_chr_fe_backend_connected(CharBackend *be) +bool qemu_chr_fe_backend_connected(CharFrontend *c) { - return !!be->chr; + return !!c->chr; } =20 -bool qemu_chr_fe_backend_open(CharBackend *be) +bool qemu_chr_fe_backend_open(CharFrontend *c) { - return be->chr && be->chr->be_open; + return c->chr && c->chr->be_open; } =20 -bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Error **errp) +bool qemu_chr_fe_init(CharFrontend *c, Chardev *s, Error **errp) { unsigned int tag =3D 0; =20 @@ -197,49 +197,49 @@ bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Err= or **errp) if (CHARDEV_IS_MUX(s)) { MuxChardev *d =3D MUX_CHARDEV(s); =20 - if (!mux_chr_attach_frontend(d, b, &tag, errp)) { + if (!mux_chr_attach_frontend(d, c, &tag, errp)) { return false; } - } else if (s->be) { + } else if (s->fe) { error_setg(errp, "chardev '%s' is already in use", s->label); return false; } else { - s->be =3D b; + s->fe =3D c; } } =20 - b->fe_is_open =3D false; - b->tag =3D tag; - b->chr =3D s; + c->fe_is_open =3D false; + c->tag =3D tag; + c->chr =3D s; return true; } =20 -void qemu_chr_fe_deinit(CharBackend *b, bool del) +void qemu_chr_fe_deinit(CharFrontend *c, bool del) { - assert(b); + assert(c); =20 - if (b->chr) { - qemu_chr_fe_set_handlers(b, NULL, NULL, NULL, NULL, NULL, NULL, tr= ue); - if (b->chr->be =3D=3D b) { - b->chr->be =3D NULL; + if (c->chr) { + qemu_chr_fe_set_handlers(c, NULL, NULL, NULL, NULL, NULL, NULL, tr= ue); + if (c->chr->fe =3D=3D c) { + c->chr->fe =3D NULL; } - if (CHARDEV_IS_MUX(b->chr)) { - MuxChardev *d =3D MUX_CHARDEV(b->chr); - mux_chr_detach_frontend(d, b->tag); + if (CHARDEV_IS_MUX(c->chr)) { + MuxChardev *d =3D MUX_CHARDEV(c->chr); + mux_chr_detach_frontend(d, c->tag); } if (del) { - Object *obj =3D OBJECT(b->chr); + Object *obj =3D OBJECT(c->chr); if (obj->parent) { object_unparent(obj); } else { object_unref(obj); } } - b->chr =3D NULL; + c->chr =3D NULL; } } =20 -void qemu_chr_fe_set_handlers_full(CharBackend *b, +void qemu_chr_fe_set_handlers_full(CharFrontend *c, IOCanReadHandler *fd_can_read, IOReadHandler *fd_read, IOEventHandler *fd_event, @@ -252,7 +252,7 @@ void qemu_chr_fe_set_handlers_full(CharBackend *b, Chardev *s; bool fe_open; =20 - s =3D b->chr; + s =3D c->chr; if (!s) { return; } @@ -263,20 +263,20 @@ void qemu_chr_fe_set_handlers_full(CharBackend *b, } else { fe_open =3D true; } - b->chr_can_read =3D fd_can_read; - b->chr_read =3D fd_read; - b->chr_event =3D fd_event; - b->chr_be_change =3D be_change; - b->opaque =3D opaque; + c->chr_can_read =3D fd_can_read; + c->chr_read =3D fd_read; + c->chr_event =3D fd_event; + c->chr_be_change =3D be_change; + c->opaque =3D opaque; =20 qemu_chr_be_update_read_handlers(s, context); =20 if (set_open) { - qemu_chr_fe_set_open(b, fe_open); + qemu_chr_fe_set_open(c, fe_open); } =20 if (fe_open) { - qemu_chr_fe_take_focus(b); + qemu_chr_fe_take_focus(c); /* We're connecting to an already opened device, so let's make sur= e we also get the open event */ if (sync_state && s->be_open) { @@ -285,7 +285,7 @@ void qemu_chr_fe_set_handlers_full(CharBackend *b, } } =20 -void qemu_chr_fe_set_handlers(CharBackend *b, +void qemu_chr_fe_set_handlers(CharFrontend *c, IOCanReadHandler *fd_can_read, IOReadHandler *fd_read, IOEventHandler *fd_event, @@ -294,62 +294,62 @@ void qemu_chr_fe_set_handlers(CharBackend *b, GMainContext *context, bool set_open) { - qemu_chr_fe_set_handlers_full(b, fd_can_read, fd_read, fd_event, be_ch= ange, + qemu_chr_fe_set_handlers_full(c, fd_can_read, fd_read, fd_event, be_ch= ange, opaque, context, set_open, true); } =20 -void qemu_chr_fe_take_focus(CharBackend *b) +void qemu_chr_fe_take_focus(CharFrontend *c) { - if (!b->chr) { + if (!c->chr) { return; } =20 - if (CHARDEV_IS_MUX(b->chr)) { - mux_set_focus(b->chr, b->tag); + if (CHARDEV_IS_MUX(c->chr)) { + mux_set_focus(c->chr, c->tag); } } =20 -int qemu_chr_fe_wait_connected(CharBackend *be, Error **errp) +int qemu_chr_fe_wait_connected(CharFrontend *c, Error **errp) { - if (!be->chr) { + if (!c->chr) { error_setg(errp, "missing associated backend"); return -1; } =20 - return qemu_chr_wait_connected(be->chr, errp); + return qemu_chr_wait_connected(c->chr, errp); } =20 -void qemu_chr_fe_set_echo(CharBackend *be, bool echo) +void qemu_chr_fe_set_echo(CharFrontend *c, bool echo) { - Chardev *chr =3D be->chr; + Chardev *chr =3D c->chr; =20 if (chr && CHARDEV_GET_CLASS(chr)->chr_set_echo) { CHARDEV_GET_CLASS(chr)->chr_set_echo(chr, echo); } } =20 -void qemu_chr_fe_set_open(CharBackend *be, bool is_open) +void qemu_chr_fe_set_open(CharFrontend *c, bool is_open) { - Chardev *chr =3D be->chr; + Chardev *chr =3D c->chr; =20 if (!chr) { return; } =20 - if (be->fe_is_open =3D=3D is_open) { + if (c->fe_is_open =3D=3D is_open) { return; } - be->fe_is_open =3D is_open; + c->fe_is_open =3D is_open; if (CHARDEV_GET_CLASS(chr)->chr_set_fe_open) { CHARDEV_GET_CLASS(chr)->chr_set_fe_open(chr, is_open); } } =20 -guint qemu_chr_fe_add_watch(CharBackend *be, GIOCondition cond, +guint qemu_chr_fe_add_watch(CharFrontend *c, GIOCondition cond, FEWatchFunc func, void *user_data) { - Chardev *s =3D be->chr; + Chardev *s =3D c->chr; GSource *src; guint tag; =20 @@ -369,9 +369,9 @@ guint qemu_chr_fe_add_watch(CharBackend *be, GIOConditi= on cond, return tag; } =20 -void qemu_chr_fe_disconnect(CharBackend *be) +void qemu_chr_fe_disconnect(CharFrontend *c) { - Chardev *chr =3D be->chr; + Chardev *chr =3D c->chr; =20 if (chr && CHARDEV_GET_CLASS(chr)->chr_disconnect) { CHARDEV_GET_CLASS(chr)->chr_disconnect(chr); diff --git a/chardev/char-hub.c b/chardev/char-hub.c index 16ffee2017a..d0967c22336 100644 --- a/chardev/char-hub.c +++ b/chardev/char-hub.c @@ -54,7 +54,7 @@ static int hub_chr_write(Chardev *chr, const uint8_t *buf= , int len) d->be_eagain_ind =3D -1; =20 for (i =3D 0; i < d->be_cnt; i++) { - if (!d->backends[i].be.chr->be_open) { + if (!d->backends[i].fe.chr->be_open) { /* Skip closed backend */ continue; } @@ -64,7 +64,7 @@ static int hub_chr_write(Chardev *chr, const uint8_t *buf= , int len) ret =3D MIN(written, ret); continue; } - r =3D qemu_chr_fe_write(&d->backends[i].be, buf, len); + r =3D qemu_chr_fe_write(&d->backends[i].fe, buf, len); if (r < 0) { if (errno =3D=3D EAGAIN) { /* Set index and expect to be called soon on watch wake up= */ @@ -84,7 +84,7 @@ static int hub_chr_write(Chardev *chr, const uint8_t *buf= , int len) static int hub_chr_can_read(void *opaque) { HubCharBackend *backend =3D opaque; - CharBackend *fe =3D backend->hub->parent.be; + CharFrontend *fe =3D backend->hub->parent.fe; =20 if (fe && fe->chr_can_read) { return fe->chr_can_read(fe->opaque); @@ -96,7 +96,7 @@ static int hub_chr_can_read(void *opaque) static void hub_chr_read(void *opaque, const uint8_t *buf, int size) { HubCharBackend *backend =3D opaque; - CharBackend *fe =3D backend->hub->parent.be; + CharFrontend *fe =3D backend->hub->parent.fe; =20 if (fe && fe->chr_read) { fe->chr_read(fe->opaque, buf, size); @@ -107,7 +107,7 @@ static void hub_chr_event(void *opaque, QEMUChrEvent ev= ent) { HubCharBackend *backend =3D opaque; HubChardev *d =3D backend->hub; - CharBackend *fe =3D d->parent.be; + CharFrontend *fe =3D d->parent.fe; =20 if (event =3D=3D CHR_EVENT_OPENED) { /* @@ -147,7 +147,7 @@ static GSource *hub_chr_add_watch(Chardev *s, GIOCondit= ion cond) } =20 assert(d->be_eagain_ind < d->be_cnt); - chr =3D qemu_chr_fe_get_driver(&d->backends[d->be_eagain_ind].be); + chr =3D qemu_chr_fe_get_driver(&d->backends[d->be_eagain_ind].fe); cc =3D CHARDEV_GET_CLASS(chr); if (!cc->chr_add_watch) { return NULL; @@ -167,7 +167,7 @@ static bool hub_chr_attach_chardev(HubChardev *d, Chard= ev *chr, d->parent.label); return false; } - ret =3D qemu_chr_fe_init(&d->backends[d->be_cnt].be, chr, errp); + ret =3D qemu_chr_fe_init(&d->backends[d->be_cnt].fe, chr, errp); if (ret) { d->backends[d->be_cnt].hub =3D d; d->backends[d->be_cnt].be_ind =3D d->be_cnt; @@ -183,7 +183,7 @@ static void char_hub_finalize(Object *obj) int i; =20 for (i =3D 0; i < d->be_cnt; i++) { - qemu_chr_fe_deinit(&d->backends[i].be, false); + qemu_chr_fe_deinit(&d->backends[i].fe, false); } } =20 @@ -193,7 +193,7 @@ static void hub_chr_update_read_handlers(Chardev *chr) int i; =20 for (i =3D 0; i < d->be_cnt; i++) { - qemu_chr_fe_set_handlers_full(&d->backends[i].be, + qemu_chr_fe_set_handlers_full(&d->backends[i].fe, hub_chr_can_read, hub_chr_read, hub_chr_event, diff --git a/chardev/char-mux.c b/chardev/char-mux.c index 6b36290e2c4..db9e89f441d 100644 --- a/chardev/char-mux.c +++ b/chardev/char-mux.c @@ -128,10 +128,10 @@ static void mux_print_help(Chardev *chr) static void mux_chr_send_event(MuxChardev *d, unsigned int mux_nr, QEMUChrEvent event) { - CharBackend *be =3D d->backends[mux_nr]; + CharFrontend *fe =3D d->frontends[mux_nr]; =20 - if (be && be->chr_event) { - be->chr_event(be->opaque, event); + if (fe && fe->chr_event) { + fe->chr_event(fe->opaque, event); } } =20 @@ -200,11 +200,11 @@ static void mux_chr_accept_input(Chardev *chr) { MuxChardev *d =3D MUX_CHARDEV(chr); int m =3D d->focus; - CharBackend *be =3D d->backends[m]; + CharFrontend *fe =3D d->frontends[m]; =20 - while (be && d->prod[m] !=3D d->cons[m] && - be->chr_can_read && be->chr_can_read(be->opaque)) { - be->chr_read(be->opaque, + while (fe && d->prod[m] !=3D d->cons[m] && + fe->chr_can_read && fe->chr_can_read(fe->opaque)) { + fe->chr_read(fe->opaque, &d->buffer[m][d->cons[m]++ & MUX_BUFFER_MASK], 1); } } @@ -213,14 +213,14 @@ static int mux_chr_can_read(void *opaque) { MuxChardev *d =3D MUX_CHARDEV(opaque); int m =3D d->focus; - CharBackend *be =3D d->backends[m]; + CharFrontend *fe =3D d->frontends[m]; =20 if ((d->prod[m] - d->cons[m]) < MUX_BUFFER_SIZE) { return 1; } =20 - if (be && be->chr_can_read) { - return be->chr_can_read(be->opaque); + if (fe && fe->chr_can_read) { + return fe->chr_can_read(fe->opaque); } =20 return 0; @@ -231,7 +231,7 @@ static void mux_chr_read(void *opaque, const uint8_t *b= uf, int size) Chardev *chr =3D CHARDEV(opaque); MuxChardev *d =3D MUX_CHARDEV(opaque); int m =3D d->focus; - CharBackend *be =3D d->backends[m]; + CharFrontend *fe =3D d->frontends[m]; int i; =20 mux_chr_accept_input(opaque); @@ -239,9 +239,9 @@ static void mux_chr_read(void *opaque, const uint8_t *b= uf, int size) for (i =3D 0; i < size; i++) if (mux_proc_byte(chr, d, buf[i])) { if (d->prod[m] =3D=3D d->cons[m] && - be && be->chr_can_read && - be->chr_can_read(be->opaque)) { - be->chr_read(be->opaque, &buf[i], 1); + fe && fe->chr_can_read && + fe->chr_can_read(fe->opaque)) { + fe->chr_read(fe->opaque, &buf[i], 1); } else { d->buffer[m][d->prod[m]++ & MUX_BUFFER_MASK] =3D buf[i]; } @@ -289,9 +289,9 @@ static void char_mux_finalize(Object *obj) =20 bit =3D -1; while ((bit =3D find_next_bit(&d->mux_bitset, MAX_MUX, bit + 1)) < MAX= _MUX) { - CharBackend *be =3D d->backends[bit]; + CharFrontend *be =3D d->frontends[bit]; be->chr =3D NULL; - d->backends[bit] =3D NULL; + d->frontends[bit] =3D NULL; } d->mux_bitset =3D 0; qemu_chr_fe_deinit(&d->chr, false); @@ -311,7 +311,7 @@ static void mux_chr_update_read_handlers(Chardev *chr) chr->gcontext, true, false); } =20 -bool mux_chr_attach_frontend(MuxChardev *d, CharBackend *b, +bool mux_chr_attach_frontend(MuxChardev *d, CharFrontend *c, unsigned int *tag, Error **errp) { unsigned int bit; @@ -328,7 +328,7 @@ bool mux_chr_attach_frontend(MuxChardev *d, CharBackend= *b, } =20 d->mux_bitset |=3D (1ul << bit); - d->backends[bit] =3D b; + d->frontends[bit] =3D c; *tag =3D bit; =20 return true; @@ -341,7 +341,7 @@ bool mux_chr_detach_frontend(MuxChardev *d, unsigned in= t tag) } =20 d->mux_bitset &=3D ~(1ul << tag); - d->backends[tag] =3D NULL; + d->frontends[tag] =3D NULL; =20 return true; } @@ -357,7 +357,7 @@ void mux_set_focus(Chardev *chr, unsigned int focus) } =20 d->focus =3D focus; - chr->be =3D d->backends[focus]; + chr->fe =3D d->frontends[focus]; mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_IN); } =20 diff --git a/chardev/char.c b/chardev/char.c index bbebd246c3a..30b21fedce4 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -53,13 +53,13 @@ Object *get_chardevs_root(void) =20 static void chr_be_event(Chardev *s, QEMUChrEvent event) { - CharBackend *be =3D s->be; + CharFrontend *fe =3D s->fe; =20 - if (!be || !be->chr_event) { + if (!fe || !fe->chr_event) { return; } =20 - be->chr_event(be->opaque, event); + fe->chr_event(fe->opaque, event); } =20 void qemu_chr_be_event(Chardev *s, QEMUChrEvent event) @@ -197,21 +197,21 @@ int qemu_chr_write(Chardev *s, const uint8_t *buf, in= t len, bool write_all) =20 int qemu_chr_be_can_write(Chardev *s) { - CharBackend *be =3D s->be; + CharFrontend *fe =3D s->fe; =20 - if (!be || !be->chr_can_read) { + if (!fe || !fe->chr_can_read) { return 0; } =20 - return be->chr_can_read(be->opaque); + return fe->chr_can_read(fe->opaque); } =20 void qemu_chr_be_write_impl(Chardev *s, const uint8_t *buf, int len) { - CharBackend *be =3D s->be; + CharFrontend *fe =3D s->fe; =20 - if (be && be->chr_read) { - be->chr_read(be->opaque, buf, len); + if (fe && fe->chr_read) { + fe->chr_read(fe->opaque, buf, len); } } =20 @@ -307,8 +307,8 @@ static void char_finalize(Object *obj) { Chardev *chr =3D CHARDEV(obj); =20 - if (chr->be) { - chr->be->chr =3D NULL; + if (chr->fe) { + chr->fe->chr =3D NULL; } g_free(chr->filename); g_free(chr->label); @@ -335,7 +335,7 @@ static bool qemu_chr_is_busy(Chardev *s) MuxChardev *d =3D MUX_CHARDEV(s); return d->mux_bitset !=3D 0; } else { - return s->be !=3D NULL; + return s->fe !=3D NULL; } } =20 @@ -798,7 +798,7 @@ static int qmp_query_chardev_foreach(Object *obj, void = *data) =20 value->label =3D g_strdup(chr->label); value->filename =3D g_strdup(chr->filename); - value->frontend_open =3D chr->be && chr->be->fe_is_open; + value->frontend_open =3D chr->fe && chr->fe->fe_is_open; =20 QAPI_LIST_PREPEND(*list, value); =20 @@ -1112,7 +1112,7 @@ err: ChardevReturn *qmp_chardev_change(const char *id, ChardevBackend *backend, Error **errp) { - CharBackend *be; + CharFrontend *fe; const ChardevClass *cc, *cc_new; Chardev *chr, *chr_new; bool closed_sent =3D false; @@ -1136,14 +1136,14 @@ ChardevReturn *qmp_chardev_change(const char *id, C= hardevBackend *backend, return NULL; } =20 - be =3D chr->be; - if (!be) { + fe =3D chr->fe; + if (!fe) { /* easy case */ object_unparent(OBJECT(chr)); return qmp_chardev_add(id, backend, errp); } =20 - if (!be->chr_be_change) { + if (!fe->chr_be_change) { error_setg(errp, "Chardev user does not support chardev hotswap"); return NULL; } @@ -1171,13 +1171,13 @@ ChardevReturn *qmp_chardev_change(const char *id, C= hardevBackend *backend, closed_sent =3D true; } =20 - chr->be =3D NULL; - qemu_chr_fe_init(be, chr_new, &error_abort); + chr->fe =3D NULL; + qemu_chr_fe_init(fe, chr_new, &error_abort); =20 - if (be->chr_be_change(be->opaque) < 0) { + if (fe->chr_be_change(fe->opaque) < 0) { error_setg(errp, "Chardev '%s' change failed", chr_new->label); - chr_new->be =3D NULL; - qemu_chr_fe_init(be, chr, &error_abort); + chr_new->fe =3D NULL; + qemu_chr_fe_init(fe, chr, &error_abort); if (closed_sent) { qemu_chr_be_event(chr, CHR_EVENT_OPENED); } diff --git a/gdbstub/system.c b/gdbstub/system.c index 5221c579d90..e2220c1ae48 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -34,7 +34,7 @@ =20 /* System emulation specific state */ typedef struct { - CharBackend chr; + CharFrontend chr; Chardev *mon_chr; } GDBSystemState; =20 diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c index 229c98ddd90..059b07907d8 100644 --- a/hw/arm/strongarm.c +++ b/hw/arm/strongarm.c @@ -927,7 +927,7 @@ struct StrongARMUARTState { SysBusDevice parent_obj; =20 MemoryRegion iomem; - CharBackend chr; + CharFrontend chr; qemu_irq irq; =20 uint8_t utcr0; diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c index bf44aaf9e4a..bb323adda55 100644 --- a/hw/char/debugcon.c +++ b/hw/char/debugcon.c @@ -40,7 +40,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(ISADebugconState, ISA_DEBUGCON= _DEVICE) =20 typedef struct DebugconState { MemoryRegion io; - CharBackend chr; + CharFrontend chr; uint32_t readback; } DebugconState; =20 diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c index 6521b4cedd9..9e45d819904 100644 --- a/hw/char/exynos4210_uart.c +++ b/hw/char/exynos4210_uart.c @@ -154,7 +154,7 @@ struct Exynos4210UartState { QEMUTimer *fifo_timeout_timer; uint64_t wordtime; /* word time in ns */ =20 - CharBackend chr; + CharFrontend chr; qemu_irq irq; qemu_irq dmairq; =20 diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c index 81c26e33899..b2d5a40bb4d 100644 --- a/hw/char/grlib_apbuart.c +++ b/hw/char/grlib_apbuart.c @@ -84,7 +84,7 @@ struct UART { MemoryRegion iomem; qemu_irq irq; =20 - CharBackend chr; + CharFrontend chr; =20 /* registers */ uint32_t status; diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c index 752c6c818ab..d0108d0b9a7 100644 --- a/hw/char/ipoctal232.c +++ b/hw/char/ipoctal232.c @@ -99,7 +99,7 @@ typedef struct SCC2698Block SCC2698Block; =20 struct SCC2698Channel { IPOctalState *ipoctal; - CharBackend dev; + CharFrontend dev; bool rx_enabled; uint8_t mr[2]; uint8_t mr_idx; diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c index 87bfcbebdc5..f14de59530c 100644 --- a/hw/char/mcf_uart.c +++ b/hw/char/mcf_uart.c @@ -36,7 +36,7 @@ struct mcf_uart_state { int tx_enabled; int rx_enabled; qemu_irq irq; - CharBackend chr; + CharFrontend chr; }; =20 #define TYPE_MCF_UART "mcf-uart" diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index 3e40d5e4342..c51308f9c5c 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -41,7 +41,7 @@ typedef struct OprtnsCommand { =20 struct SCLPConsoleLM { SCLPEvent event; - CharBackend chr; + CharFrontend chr; bool echo; /* immediate echo of input if true = */ uint32_t write_errors; /* errors writing to char layer = */ uint32_t length; /* length of byte stream in buffer = */ diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index 95e3045178e..2abf861dbcf 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -35,7 +35,7 @@ typedef struct ASCIIConsoleData { =20 struct SCLPConsole { SCLPEvent event; - CharBackend chr; + CharFrontend chr; uint8_t iov[SIZE_BUFFER_VT220]; uint32_t iov_sclp; /* offset in buf for SCLP read operation = */ uint32_t iov_bs; /* offset in buf for char layer read operation= */ diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c index 30447fa018a..83227a84a60 100644 --- a/hw/char/sh_serial.c +++ b/hw/char/sh_serial.c @@ -67,7 +67,7 @@ struct SHSerialState { int flags; int rtrg; =20 - CharBackend chr; + CharFrontend chr; QEMUTimer fifo_timeout_timer; uint64_t etu; /* Elementary Time Unit (ns) */ =20 diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c index fc8ea604f8d..766b2bfcac0 100644 --- a/hw/char/spapr_vty.c +++ b/hw/char/spapr_vty.c @@ -14,7 +14,7 @@ =20 struct SpaprVioVty { SpaprVioDevice sdev; - CharBackend chardev; + CharFrontend chardev; uint32_t in, out; uint8_t buf[VTERM_BUFSIZE]; }; diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c index d950c172921..c993f67b42a 100644 --- a/hw/char/terminal3270.c +++ b/hw/char/terminal3270.c @@ -30,7 +30,7 @@ =20 struct Terminal3270 { EmulatedCcw3270Device cdev; - CharBackend chr; + CharFrontend chr; uint8_t inv[INPUT_BUFFER_SIZE]; uint8_t outv[OUTPUT_BUFFER_SIZE]; int in_len; diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c index 0932a3572b7..1b669c9be83 100644 --- a/hw/char/virtio-console.c +++ b/hw/char/virtio-console.c @@ -30,7 +30,7 @@ DECLARE_INSTANCE_CHECKER(VirtConsole, VIRTIO_CONSOLE, struct VirtConsole { VirtIOSerialPort parent_obj; =20 - CharBackend chr; + CharFrontend chr; guint watch; }; =20 diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c index 9c34a554bfa..462476553ff 100644 --- a/hw/char/xen_console.c +++ b/hw/char/xen_console.c @@ -53,7 +53,7 @@ struct XenConsole { char *fe_path; unsigned int ring_ref; void *sring; - CharBackend chr; + CharFrontend chr; int backlog; }; typedef struct XenConsole XenConsole; diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c index 8008171eea9..8feb58a898e 100644 --- a/hw/char/xilinx_uartlite.c +++ b/hw/char/xilinx_uartlite.c @@ -60,7 +60,7 @@ struct XilinxUARTLite { =20 EndianMode model_endianness; MemoryRegion mmio; - CharBackend chr; + CharFrontend chr; qemu_irq irq; =20 uint8_t rx_fifo[8]; diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 1f810b7ddf2..c15371f8cd1 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -258,10 +258,10 @@ const PropertyInfo qdev_prop_drive_iothread =3D { static void get_chr(Object *obj, Visitor *v, const char *name, void *opaqu= e, Error **errp) { - CharBackend *be =3D object_field_prop_ptr(obj, opaque); + CharFrontend *fe =3D object_field_prop_ptr(obj, opaque); char *p; =20 - p =3D g_strdup(be->chr && be->chr->label ? be->chr->label : ""); + p =3D g_strdup(fe->chr && fe->chr->label ? fe->chr->label : ""); visit_type_str(v, name, &p, errp); g_free(p); } @@ -271,7 +271,7 @@ static void set_chr(Object *obj, Visitor *v, const char= *name, void *opaque, { ERRP_GUARD(); const Property *prop =3D opaque; - CharBackend *be =3D object_field_prop_ptr(obj, prop); + CharFrontend *fe =3D object_field_prop_ptr(obj, prop); Chardev *s; char *str; =20 @@ -283,13 +283,13 @@ static void set_chr(Object *obj, Visitor *v, const ch= ar *name, void *opaque, * TODO Should this really be an error? If no, the old value * needs to be released before we store the new one. */ - if (!check_prop_still_unset(obj, name, be->chr, str, false, errp)) { + if (!check_prop_still_unset(obj, name, fe->chr, str, false, errp)) { return; } =20 if (!*str) { g_free(str); - be->chr =3D NULL; + fe->chr =3D NULL; return; } =20 @@ -297,7 +297,7 @@ static void set_chr(Object *obj, Visitor *v, const char= *name, void *opaque, if (s =3D=3D NULL) { error_setg(errp, "Property '%s.%s' can't find value '%s'", object_get_typename(obj), name, str); - } else if (!qemu_chr_fe_init(be, s, errp)) { + } else if (!qemu_chr_fe_init(fe, s, errp)) { error_prepend(errp, "Property '%s.%s' can't take value '%s': ", object_get_typename(obj), name, str); } @@ -307,9 +307,9 @@ static void set_chr(Object *obj, Visitor *v, const char= *name, void *opaque, static void release_chr(Object *obj, const char *name, void *opaque) { const Property *prop =3D opaque; - CharBackend *be =3D object_field_prop_ptr(obj, prop); + CharFrontend *fe =3D object_field_prop_ptr(obj, prop); =20 - qemu_chr_fe_deinit(be, false); + qemu_chr_fe_deinit(fe, false); } =20 const PropertyInfo qdev_prop_chr =3D { diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index cddca69b938..570bfb27361 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -149,7 +149,7 @@ static void io_cpu_write(void *opaque, hwaddr addr, ch =3D val; debugout =3D serial_hd(0); if (debugout) { - qemu_chr_fe_write_all(debugout->be, &ch, 1); + qemu_chr_fe_write_all(debugout->fe, &ch, 1); } else { fprintf(stderr, "%c", ch); } diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c index 9f1ba7b2f87..2c6c5155792 100644 --- a/hw/ipmi/ipmi_bmc_extern.c +++ b/hw/ipmi/ipmi_bmc_extern.c @@ -67,7 +67,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(IPMIBmcExtern, IPMI_BMC_EXTERN) struct IPMIBmcExtern { IPMIBmc parent; =20 - CharBackend chr; + CharFrontend chr; =20 bool connected; =20 diff --git a/hw/mips/boston.c b/hw/mips/boston.c index 149a263bd5a..8ecac41d47a 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -68,7 +68,7 @@ struct BostonState { SerialMM *uart; Clock *cpuclk; =20 - CharBackend lcd_display; + CharFrontend lcd_display; char lcd_content[8]; bool lcd_inited; =20 diff --git a/hw/mips/malta.c b/hw/mips/malta.c index 02da629b5af..a3b7632ad90 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -89,7 +89,7 @@ typedef struct { uint32_t i2coe; uint32_t i2cout; uint32_t i2csel; - CharBackend display; + CharFrontend display; char display_text[9]; SerialMM *uart; bool display_inited; diff --git a/hw/misc/ivshmem-pci.c b/hw/misc/ivshmem-pci.c index 2748db9286e..636d0b83dee 100644 --- a/hw/misc/ivshmem-pci.c +++ b/hw/misc/ivshmem-pci.c @@ -94,7 +94,7 @@ struct IVShmemState { =20 /* exactly one of these two may be set */ HostMemoryBackend *hostmem; /* with interrupts */ - CharBackend server_chr; /* without interrupts */ + CharFrontend server_chr; /* without interrupts */ =20 /* registers */ uint32_t intrmask; diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index 1f78fe406e7..a6715b4026d 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -623,7 +623,7 @@ static uint64_t qtest_rtas_call(char *cmd, uint32_t nar= gs, uint64_t args, return H_PARAMETER; } =20 -static bool spapr_qtest_callback(CharBackend *chr, gchar **words) +static bool spapr_qtest_callback(CharFrontend *chr, gchar **words) { if (strcmp(words[0], "rtas") =3D=3D 0) { uint64_t res, args, ret; diff --git a/hw/riscv/riscv_hart.c b/hw/riscv/riscv_hart.c index 7f2676008cf..4d51a93dd52 100644 --- a/hw/riscv/riscv_hart.c +++ b/hw/riscv/riscv_hart.c @@ -78,7 +78,7 @@ static void csr_call(char *cmd, uint64_t cpu_num, int csr= no, uint64_t *val) g_assert(ret =3D=3D RISCV_EXCP_NONE); } =20 -static bool csr_qtest_callback(CharBackend *chr, gchar **words) +static bool csr_qtest_callback(CharFrontend *chr, gchar **words) { if (strcmp(words[0], "csr") =3D=3D 0) { =20 diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index 1eea21a7337..c8aada0988d 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -56,7 +56,7 @@ typedef struct PassthruState PassthruState; =20 struct PassthruState { CCIDCardState base; - CharBackend cs; + CharFrontend cs; uint8_t vscard_in_data[VSCARD_IN_SIZE]; uint32_t vscard_in_pos; uint32_t vscard_in_hdr; diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index 1c116d8b0fe..2eb52b2e01e 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -105,7 +105,7 @@ struct USBSerialState { uint8_t xoff; QEMUSerialSetParams params; int latency; /* ms */ - CharBackend cs; + CharFrontend cs; }; =20 #define TYPE_USB_SERIAL "usb-serial-dev" diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index f516ff42a11..d603a4a6f96 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -113,7 +113,7 @@ struct PacketIdQueue { struct USBRedirDevice { USBDevice dev; /* Properties */ - CharBackend cs; + CharFrontend cs; bool enable_streams; bool suppress_remote_wake; bool in_write; diff --git a/hw/virtio/vhost-stub.c b/hw/virtio/vhost-stub.c index 52d42adab26..7321dc92106 100644 --- a/hw/virtio/vhost-stub.c +++ b/hw/virtio/vhost-stub.c @@ -12,7 +12,7 @@ unsigned int vhost_get_free_memslots(void) return UINT_MAX; } =20 -bool vhost_user_init(VhostUserState *user, CharBackend *chr, Error **errp) +bool vhost_user_init(VhostUserState *user, CharFrontend *chr, Error **errp) { return false; } diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 36c9c2e04d6..aac98f898af 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -275,7 +275,7 @@ struct scrub_regions { static int vhost_user_read_header(struct vhost_dev *dev, VhostUserMsg *msg) { struct vhost_user *u =3D dev->opaque; - CharBackend *chr =3D u->user->chr; + CharFrontend *chr =3D u->user->chr; uint8_t *p =3D (uint8_t *) msg; int r, size =3D VHOST_USER_HDR_SIZE; =20 @@ -303,7 +303,7 @@ static int vhost_user_read_header(struct vhost_dev *dev= , VhostUserMsg *msg) static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg) { struct vhost_user *u =3D dev->opaque; - CharBackend *chr =3D u->user->chr; + CharFrontend *chr =3D u->user->chr; uint8_t *p =3D (uint8_t *) msg; int r, size; =20 @@ -383,7 +383,7 @@ static int vhost_user_write(struct vhost_dev *dev, Vhos= tUserMsg *msg, int *fds, int fd_num) { struct vhost_user *u =3D dev->opaque; - CharBackend *chr =3D u->user->chr; + CharFrontend *chr =3D u->user->chr; int ret, size =3D VHOST_USER_HDR_SIZE + msg->hdr.size; =20 /* @@ -1680,7 +1680,7 @@ int vhost_user_get_shared_object(struct vhost_dev *de= v, unsigned char *uuid, int *dmabuf_fd) { struct vhost_user *u =3D dev->opaque; - CharBackend *chr =3D u->user->chr; + CharFrontend *chr =3D u->user->chr; int ret; VhostUserMsg msg =3D { .hdr.request =3D VHOST_USER_GET_SHARED_OBJECT, @@ -1721,7 +1721,7 @@ vhost_user_backend_handle_shared_object_lookup(struct= vhost_user *u, VhostUserPayload *payload) { QemuUUID uuid; - CharBackend *chr =3D u->user->chr; + CharFrontend *chr =3D u->user->chr; Error *local_err =3D NULL; int dmabuf_fd =3D -1; int fd_num =3D 0; @@ -2004,7 +2004,7 @@ static int vhost_user_postcopy_advise(struct vhost_de= v *dev, Error **errp) { #ifdef CONFIG_LINUX struct vhost_user *u =3D dev->opaque; - CharBackend *chr =3D u->user->chr; + CharFrontend *chr =3D u->user->chr; int ufd; int ret; VhostUserMsg msg =3D { @@ -2670,7 +2670,7 @@ static int vhost_user_get_inflight_fd(struct vhost_de= v *dev, int fd; int ret; struct vhost_user *u =3D dev->opaque; - CharBackend *chr =3D u->user->chr; + CharFrontend *chr =3D u->user->chr; VhostUserMsg msg =3D { .hdr.request =3D VHOST_USER_GET_INFLIGHT_FD, .hdr.flags =3D VHOST_USER_VERSION, @@ -2761,7 +2761,7 @@ static void vhost_user_state_destroy(gpointer data) vhost_user_host_notifier_remove(n, NULL, true); } =20 -bool vhost_user_init(VhostUserState *user, CharBackend *chr, Error **errp) +bool vhost_user_init(VhostUserState *user, CharFrontend *chr, Error **errp) { if (user->chr) { error_setg(errp, "Cannot initialize vhost-user state"); @@ -2787,7 +2787,7 @@ void vhost_user_cleanup(VhostUserState *user) typedef struct { vu_async_close_fn cb; DeviceState *dev; - CharBackend *cd; + CharFrontend *cd; struct vhost_dev *vhost; } VhostAsyncCallback; =20 @@ -2806,7 +2806,7 @@ static void vhost_user_async_close_bh(void *opaque) * purposes. */ void vhost_user_async_close(DeviceState *d, - CharBackend *chardev, struct vhost_dev *vhost, + CharFrontend *chardev, struct vhost_dev *vhost, vu_async_close_fn cb) { if (!runstate_check(RUN_STATE_SHUTDOWN)) { diff --git a/net/colo-compare.c b/net/colo-compare.c index 0e1844ee4cb..95018b47049 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -88,7 +88,7 @@ static uint32_t max_queue_size; typedef struct SendCo { Coroutine *co; struct CompareState *s; - CharBackend *chr; + CharFrontend *chr; GQueue send_list; bool notify_remote_frame; bool done; @@ -108,10 +108,10 @@ struct CompareState { char *sec_indev; char *outdev; char *notify_dev; - CharBackend chr_pri_in; - CharBackend chr_sec_in; - CharBackend chr_out; - CharBackend chr_notify_dev; + CharFrontend chr_pri_in; + CharFrontend chr_sec_in; + CharFrontend chr_out; + CharFrontend chr_notify_dev; SocketReadState pri_rs; SocketReadState sec_rs; SocketReadState notify_rs; diff --git a/net/filter-mirror.c b/net/filter-mirror.c index 27734c91a71..8e01e98f405 100644 --- a/net/filter-mirror.c +++ b/net/filter-mirror.c @@ -37,8 +37,8 @@ struct MirrorState { NetFilterState parent_obj; char *indev; char *outdev; - CharBackend chr_in; - CharBackend chr_out; + CharFrontend chr_in; + CharFrontend chr_out; SocketReadState rs; bool vnet_hdr; }; diff --git a/net/passt.c b/net/passt.c index 32ecffb763b..9ed811a5142 100644 --- a/net/passt.c +++ b/net/passt.c @@ -71,7 +71,7 @@ typedef struct NetPasstState { /* vhost user */ VhostUserState *vhost_user; VHostNetState *vhost_net; - CharBackend vhost_chr; + CharFrontend vhost_chr; guint vhost_watch; uint64_t acked_features; bool started; diff --git a/net/slirp.c b/net/slirp.c index c627a9dd24b..120eef6122b 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -80,7 +80,7 @@ struct slirp_config_str { }; =20 struct GuestFwd { - CharBackend hd; + CharFrontend hd; struct in_addr server; int port; Slirp *slirp; diff --git a/net/vhost-user.c b/net/vhost-user.c index 8b96157145a..a4bb49bbcff 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -65,7 +65,7 @@ static const int user_feature_bits[] =3D { =20 typedef struct NetVhostUserState { NetClientState nc; - CharBackend chr; /* only queue index 0 */ + CharFrontend chr; /* only queue index 0 */ VhostUserState *vhost_user; VHostNetState *vhost_net; guint watch; diff --git a/semihosting/console.c b/semihosting/console.c index c3683a15668..a4db8d8e76d 100644 --- a/semihosting/console.c +++ b/semihosting/console.c @@ -30,7 +30,7 @@ =20 /* Access to this structure is protected by the BQL */ typedef struct SemihostingConsole { - CharBackend backend; + CharFrontend frontend; Chardev *chr; GSList *sleeping_cpus; bool got; @@ -122,8 +122,8 @@ void qemu_semihosting_console_init(Chardev *chr) console.chr =3D chr; if (chr) { fifo8_create(&console.fifo, FIFO_SIZE); - qemu_chr_fe_init(&console.backend, chr, &error_abort); - qemu_chr_fe_set_handlers(&console.backend, + qemu_chr_fe_init(&console.frontend, chr, &error_abort); + qemu_chr_fe_set_handlers(&console.frontend, console_can_read, console_read, NULL, NULL, &console, diff --git a/system/qtest.c b/system/qtest.c index fa42c9f9215..e4d1cd75daa 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -44,7 +44,7 @@ struct QTest { bool has_machine_link; char *chr_name; Chardev *chr; - CharBackend qtest_chr; + CharFrontend qtest_chr; char *log; }; =20 @@ -293,20 +293,20 @@ static void G_GNUC_PRINTF(1, 2) qtest_log_send(const = char *fmt, ...) static void qtest_server_char_be_send(void *opaque, const char *str) { size_t len =3D strlen(str); - CharBackend* chr =3D (CharBackend *)opaque; + CharFrontend* chr =3D (CharFrontend *)opaque; qemu_chr_fe_write_all(chr, (uint8_t *)str, len); if (qtest_log_fp && qtest_opened) { fprintf(qtest_log_fp, "%s", str); } } =20 -static void qtest_send(CharBackend *chr, const char *str) +static void qtest_send(CharFrontend *chr, const char *str) { qtest_log_timestamp(); qtest_server_send(qtest_server_send_opaque, str); } =20 -void qtest_sendf(CharBackend *chr, const char *fmt, ...) +void qtest_sendf(CharFrontend *chr, const char *fmt, ...) { va_list ap; gchar *buffer; @@ -324,16 +324,16 @@ static void qtest_irq_handler(void *opaque, int n, in= t level) qemu_set_irq(old_irq, level); =20 if (irq_levels[n] !=3D level) { - CharBackend *chr =3D &qtest->qtest_chr; + CharFrontend *chr =3D &qtest->qtest_chr; irq_levels[n] =3D level; qtest_sendf(chr, "IRQ %s %d\n", level ? "raise" : "lower", n); } } =20 -static bool (*process_command_cb)(CharBackend *chr, gchar **words); +static bool (*process_command_cb)(CharFrontend *chr, gchar **words); =20 -void qtest_set_command_cb(bool (*pc_cb)(CharBackend *chr, gchar **words)) +void qtest_set_command_cb(bool (*pc_cb)(CharFrontend *chr, gchar **words)) { assert(!process_command_cb); /* Switch to a list if we need more than= one */ =20 @@ -349,7 +349,7 @@ static void qtest_install_gpio_out_intercept(DeviceStat= e *dev, const char *name, *disconnected =3D qdev_intercept_gpio_out(dev, icpt, name, n); } =20 -static void qtest_process_command(CharBackend *chr, gchar **words) +static void qtest_process_command(CharFrontend *chr, gchar **words) { const gchar *command; =20 @@ -757,7 +757,7 @@ static void qtest_process_command(CharBackend *chr, gch= ar **words) * Process as much of @inbuf as we can in newline terminated chunks. * Remove the processed commands from @inbuf as we go. */ -static void qtest_process_inbuf(CharBackend *chr, GString *inbuf) +static void qtest_process_inbuf(CharFrontend *chr, GString *inbuf) { char *end; =20 @@ -773,7 +773,7 @@ static void qtest_process_inbuf(CharBackend *chr, GStri= ng *inbuf) =20 static void qtest_read(void *opaque, const uint8_t *buf, int size) { - CharBackend *chr =3D opaque; + CharFrontend *chr =3D opaque; =20 g_string_append_len(inbuf, (const gchar *)buf, size); qtest_process_inbuf(chr, inbuf); diff --git a/target/hppa/sys_helper.c b/target/hppa/sys_helper.c index 6e65fadcc7b..88109f0181a 100644 --- a/target/hppa/sys_helper.c +++ b/target/hppa/sys_helper.c @@ -135,7 +135,7 @@ void HELPER(rfi_r)(CPUHPPAState *env) */ void HELPER(diag_console_output)(CPUHPPAState *env) { - CharBackend *serial_backend; + CharFrontend *fe; Chardev *serial_port; unsigned char c; =20 @@ -145,14 +145,14 @@ void HELPER(diag_console_output)(CPUHPPAState *env) return; } =20 - /* get serial_backend for the serial port */ - serial_backend =3D serial_port->be; - if (!serial_backend || - !qemu_chr_fe_backend_connected(serial_backend)) { + /* get the frontend for the serial port */ + fe =3D serial_port->fe; + if (!fe || + !qemu_chr_fe_backend_connected(fe)) { return; } =20 c =3D (unsigned char)env->gr[26]; - qemu_chr_fe_write(serial_backend, &c, sizeof(c)); + qemu_chr_fe_write(fe, &c, sizeof(c)); } #endif diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c index 000e44b2b7c..47e672c7aac 100644 --- a/target/riscv/kvm/kvm-cpu.c +++ b/target/riscv/kvm/kvm-cpu.c @@ -1598,7 +1598,7 @@ static void kvm_riscv_handle_sbi_dbcn(CPUState *cs, s= truct kvm_run *run) buf =3D g_malloc0(num_bytes); =20 if (run->riscv_sbi.function_id =3D=3D SBI_EXT_DBCN_CONSOLE_READ) { - ret =3D qemu_chr_fe_read_all(serial_hd(0)->be, buf, num_bytes); + ret =3D qemu_chr_fe_read_all(serial_hd(0)->fe, buf, num_bytes); if (ret < 0) { error_report("SBI_EXT_DBCN_CONSOLE_READ: error when " "reading chardev"); @@ -1609,7 +1609,7 @@ static void kvm_riscv_handle_sbi_dbcn(CPUState *cs, s= truct kvm_run *run) } else { address_space_read(cs->as, addr, attrs, buf, num_bytes); =20 - ret =3D qemu_chr_fe_write_all(serial_hd(0)->be, buf, num_bytes= ); + ret =3D qemu_chr_fe_write_all(serial_hd(0)->fe, buf, num_bytes= ); if (ret < 0) { error_report("SBI_EXT_DBCN_CONSOLE_WRITE: error when " "writing chardev"); @@ -1622,7 +1622,7 @@ static void kvm_riscv_handle_sbi_dbcn(CPUState *cs, s= truct kvm_run *run) break; case SBI_EXT_DBCN_CONSOLE_WRITE_BYTE: ch =3D run->riscv_sbi.args[0]; - ret =3D qemu_chr_fe_write_all(serial_hd(0)->be, &ch, sizeof(ch)); + ret =3D qemu_chr_fe_write_all(serial_hd(0)->fe, &ch, sizeof(ch)); =20 if (ret < 0) { error_report("SBI_EXT_DBCN_CONSOLE_WRITE_BYTE: error when " @@ -1645,10 +1645,10 @@ static int kvm_riscv_handle_sbi(CPUState *cs, struc= t kvm_run *run) switch (run->riscv_sbi.extension_id) { case SBI_EXT_0_1_CONSOLE_PUTCHAR: ch =3D run->riscv_sbi.args[0]; - qemu_chr_fe_write(serial_hd(0)->be, &ch, sizeof(ch)); + qemu_chr_fe_write(serial_hd(0)->fe, &ch, sizeof(ch)); break; case SBI_EXT_0_1_CONSOLE_GETCHAR: - ret =3D qemu_chr_fe_read_all(serial_hd(0)->be, &ch, sizeof(ch)); + ret =3D qemu_chr_fe_read_all(serial_hd(0)->fe, &ch, sizeof(ch)); if (ret =3D=3D sizeof(ch)) { run->riscv_sbi.ret[0] =3D ch; } else { diff --git a/target/xtensa/xtensa-semi.c b/target/xtensa/xtensa-semi.c index 431c263dc57..552815ebfdb 100644 --- a/target/xtensa/xtensa-semi.c +++ b/target/xtensa/xtensa-semi.c @@ -148,7 +148,7 @@ static uint32_t errno_h2g(int host_errno) } =20 typedef struct XtensaSimConsole { - CharBackend be; + CharFrontend fe; struct { char buffer[16]; size_t offset; @@ -182,8 +182,8 @@ void xtensa_sim_open_console(Chardev *chr) { static XtensaSimConsole console; =20 - qemu_chr_fe_init(&console.be, chr, &error_abort); - qemu_chr_fe_set_handlers(&console.be, + qemu_chr_fe_init(&console.fe, chr, &error_abort); + qemu_chr_fe_set_handlers(&console.fe, sim_console_can_read, sim_console_read, NULL, NULL, &console, @@ -227,7 +227,7 @@ void HELPER(simcall)(CPUXtensaState *env) len -=3D io_sz; if (fd < 3 && sim_console) { if (is_write && (fd =3D=3D 1 || fd =3D=3D 2)) { - io_done =3D qemu_chr_fe_write_all(&sim_console= ->be, + io_done =3D qemu_chr_fe_write_all(&sim_console= ->fe, buf, io_sz); regs[3] =3D errno_h2g(errno); } else if (!is_write && fd =3D=3D 0) { @@ -241,7 +241,7 @@ void HELPER(simcall)(CPUXtensaState *env) sim_console->input.buffer + io_don= e, sim_console->input.offset - io_don= e); sim_console->input.offset -=3D io_done; - qemu_chr_fe_accept_input(&sim_console->be); + qemu_chr_fe_accept_input(&sim_console->fe); } else { io_done =3D -1; regs[3] =3D TARGET_EAGAIN; diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index 609ff24059c..d2bb21d5b9b 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -155,7 +155,7 @@ typedef struct TestServer { gchar *mig_path; gchar *chr_name; gchar *tmpfs; - CharBackend chr; + CharFrontend chr; int fds_num; int fds[VHOST_MEMORY_MAX_NREGIONS]; VhostUserMemory memory; @@ -180,10 +180,10 @@ struct vhost_user_ops { =20 /* VHOST-USER commands. */ uint64_t (*get_features)(TestServer *s); - void (*set_features)(TestServer *s, CharBackend *chr, + void (*set_features)(TestServer *s, CharFrontend *chr, VhostUserMsg *msg); void (*get_protocol_features)(TestServer *s, - CharBackend *chr, VhostUserMsg *msg); + CharFrontend *chr, VhostUserMsg *msg); }; =20 static const char *init_hugepagefs(void); @@ -331,7 +331,7 @@ static int chr_can_read(void *opaque) static void chr_read(void *opaque, const uint8_t *buf, int size) { TestServer *s =3D opaque; - CharBackend *chr =3D &s->chr; + CharFrontend *chr =3D &s->chr; VhostUserMsg msg; uint8_t *p =3D (uint8_t *) &msg; int fd =3D -1; @@ -1051,7 +1051,7 @@ static uint64_t vu_net_get_features(TestServer *s) return features; } =20 -static void vu_net_set_features(TestServer *s, CharBackend *chr, +static void vu_net_set_features(TestServer *s, CharFrontend *chr, VhostUserMsg *msg) { g_assert(msg->payload.u64 & (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES)= ); @@ -1061,7 +1061,7 @@ static void vu_net_set_features(TestServer *s, CharBa= ckend *chr, } } =20 -static void vu_net_get_protocol_features(TestServer *s, CharBackend *chr, +static void vu_net_get_protocol_features(TestServer *s, CharFrontend *chr, VhostUserMsg *msg) { /* send back features to qemu */ @@ -1148,7 +1148,7 @@ static uint64_t vu_gpio_get_features(TestServer *s) * that we support VHOST_USER_PROTOCOL_F_CONFIG as gpio would use it * talking to a read vhost-user daemon. */ -static void vu_gpio_get_protocol_features(TestServer *s, CharBackend *chr, +static void vu_gpio_get_protocol_features(TestServer *s, CharFrontend *chr, VhostUserMsg *msg) { /* send back features to qemu */ @@ -1191,7 +1191,7 @@ static uint64_t vu_scmi_get_features(TestServer *s) 0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES; } =20 -static void vu_scmi_get_protocol_features(TestServer *s, CharBackend *chr, +static void vu_scmi_get_protocol_features(TestServer *s, CharFrontend *chr, VhostUserMsg *msg) { msg->flags |=3D VHOST_USER_REPLY_MASK; diff --git a/tests/unit/test-char.c b/tests/unit/test-char.c index e156b173295..8a98e42cad0 100644 --- a/tests/unit/test-char.c +++ b/tests/unit/test-char.c @@ -107,18 +107,18 @@ static void char_console_test(void) static void char_stdio_test_subprocess(void) { Chardev *chr; - CharBackend be; + CharFrontend c; int ret; =20 chr =3D qemu_chr_new("label", "stdio", NULL); g_assert_nonnull(chr); =20 - qemu_chr_fe_init(&be, chr, &error_abort); - qemu_chr_fe_set_open(&be, true); - ret =3D qemu_chr_fe_write(&be, (void *)"buf", 4); + qemu_chr_fe_init(&c, chr, &error_abort); + qemu_chr_fe_set_open(&c, true); + ret =3D qemu_chr_fe_write(&c, (void *)"buf", 4); g_assert_cmpint(ret, =3D=3D, 4); =20 - qemu_chr_fe_deinit(&be, true); + qemu_chr_fe_deinit(&c, true); } =20 static void char_stdio_test(void) @@ -132,7 +132,7 @@ static void char_ringbuf_test(void) { QemuOpts *opts; Chardev *chr; - CharBackend be; + CharFrontend c; char *data; int ret; =20 @@ -153,8 +153,8 @@ static void char_ringbuf_test(void) g_assert_nonnull(chr); qemu_opts_del(opts); =20 - qemu_chr_fe_init(&be, chr, &error_abort); - ret =3D qemu_chr_fe_write(&be, (void *)"buff", 4); + qemu_chr_fe_init(&c, chr, &error_abort); + ret =3D qemu_chr_fe_write(&c, (void *)"buff", 4); g_assert_cmpint(ret, =3D=3D, 4); =20 data =3D qmp_ringbuf_read("ringbuf-label", 4, false, 0, &error_abort); @@ -165,7 +165,7 @@ static void char_ringbuf_test(void) g_assert_cmpstr(data, =3D=3D, ""); g_free(data); =20 - qemu_chr_fe_deinit(&be, true); + qemu_chr_fe_deinit(&c, true); =20 /* check alias */ opts =3D qemu_opts_create(qemu_find_opts("chardev"), "memory-label", @@ -184,7 +184,7 @@ static void char_mux_test(void) Chardev *chr, *base; char *data; FeHandler h1 =3D { 0, false, 0, false, }, h2 =3D { 0, false, 0, false,= }; - CharBackend chr_be1, chr_be2; + CharFrontend chr_fe1, chr_fe2; Error *error =3D NULL; =20 /* Create mux and chardev to be immediately removed */ @@ -210,8 +210,8 @@ static void char_mux_test(void) g_assert_nonnull(chr); qemu_opts_del(opts); =20 - qemu_chr_fe_init(&chr_be1, chr, &error_abort); - qemu_chr_fe_set_handlers(&chr_be1, + qemu_chr_fe_init(&chr_fe1, chr, &error_abort); + qemu_chr_fe_set_handlers(&chr_fe1, fe_can_read, fe_read, fe_event, @@ -219,15 +219,15 @@ static void char_mux_test(void) &h1, NULL, true); =20 - qemu_chr_fe_init(&chr_be2, chr, &error_abort); - qemu_chr_fe_set_handlers(&chr_be2, + qemu_chr_fe_init(&chr_fe2, chr, &error_abort); + qemu_chr_fe_set_handlers(&chr_fe2, fe_can_read, fe_read, fe_event, NULL, &h2, NULL, true); - qemu_chr_fe_take_focus(&chr_be2); + qemu_chr_fe_take_focus(&chr_fe2); =20 base =3D qemu_chr_find("mux-label-base"); g_assert_cmpint(qemu_chr_be_can_write(base), !=3D, 0); @@ -271,8 +271,8 @@ static void char_mux_test(void) g_assert_cmpint(h2.last_event, =3D=3D, CHR_EVENT_MUX_OUT); =20 /* open/close state and corresponding events */ - g_assert_true(qemu_chr_fe_backend_open(&chr_be1)); - g_assert_true(qemu_chr_fe_backend_open(&chr_be2)); + g_assert_true(qemu_chr_fe_backend_open(&chr_fe1)); + g_assert_true(qemu_chr_fe_backend_open(&chr_fe2)); g_assert_true(h1.is_open); g_assert_false(h1.openclose_mismatch); g_assert_true(h2.is_open); @@ -280,22 +280,22 @@ static void char_mux_test(void) =20 h1.openclose_count =3D h2.openclose_count =3D 0; =20 - qemu_chr_fe_set_handlers(&chr_be1, NULL, NULL, NULL, NULL, + qemu_chr_fe_set_handlers(&chr_fe1, NULL, NULL, NULL, NULL, NULL, NULL, false); - qemu_chr_fe_set_handlers(&chr_be2, NULL, NULL, NULL, NULL, + qemu_chr_fe_set_handlers(&chr_fe2, NULL, NULL, NULL, NULL, NULL, NULL, false); g_assert_cmpint(h1.openclose_count, =3D=3D, 0); g_assert_cmpint(h2.openclose_count, =3D=3D, 0); =20 h1.is_open =3D h2.is_open =3D false; - qemu_chr_fe_set_handlers(&chr_be1, + qemu_chr_fe_set_handlers(&chr_fe1, NULL, NULL, fe_event, NULL, &h1, NULL, false); - qemu_chr_fe_set_handlers(&chr_be2, + qemu_chr_fe_set_handlers(&chr_fe2, NULL, NULL, fe_event, @@ -314,14 +314,14 @@ static void char_mux_test(void) g_assert_cmpint(h2.openclose_count, =3D=3D, 3); g_assert_false(h2.openclose_mismatch); =20 - qemu_chr_fe_set_handlers(&chr_be2, + qemu_chr_fe_set_handlers(&chr_fe2, fe_can_read, fe_read, fe_event, NULL, &h2, NULL, false); - qemu_chr_fe_set_handlers(&chr_be1, + qemu_chr_fe_set_handlers(&chr_fe1, fe_can_read, fe_read, fe_event, @@ -330,7 +330,7 @@ static void char_mux_test(void) NULL, false); =20 /* remove first handler */ - qemu_chr_fe_set_handlers(&chr_be1, NULL, NULL, NULL, NULL, + qemu_chr_fe_set_handlers(&chr_fe1, NULL, NULL, NULL, NULL, NULL, NULL, true); qemu_chr_be_write(base, (void *)"hello", 6); g_assert_cmpint(h1.read_count, =3D=3D, 0); @@ -349,13 +349,13 @@ static void char_mux_test(void) g_assert_cmpint(strlen(data), !=3D, 0); g_free(data); =20 - qemu_chr_fe_deinit(&chr_be1, false); + qemu_chr_fe_deinit(&chr_fe1, false); =20 qmp_chardev_remove("mux-label", &error); g_assert_cmpstr(error_get_pretty(error), =3D=3D, "Chardev 'mux-label' = is busy"); error_free(error); =20 - qemu_chr_fe_deinit(&chr_be2, false); + qemu_chr_fe_deinit(&chr_fe2, false); qmp_chardev_remove("mux-label", &error_abort); } =20 @@ -366,7 +366,7 @@ static void char_hub_test(void) char *data; FeHandler h =3D { 0, false, 0, false, }; Error *error =3D NULL; - CharBackend chr_be; + CharFrontend chr_fe; int ret, i; =20 #define RB_SIZE 128 @@ -497,8 +497,8 @@ static void char_hub_test(void) qemu_opts_del(opts); =20 /* Attach hub to a frontend */ - qemu_chr_fe_init(&chr_be, hub, &error_abort); - qemu_chr_fe_set_handlers(&chr_be, + qemu_chr_fe_init(&chr_fe, hub, &error_abort); + qemu_chr_fe_set_handlers(&chr_fe, fe_can_read, fe_read, fe_event, @@ -507,7 +507,7 @@ static void char_hub_test(void) NULL, true); =20 /* Fails second time */ - qemu_chr_fe_init(&chr_be, hub, &error); + qemu_chr_fe_init(&chr_fe, hub, &error); g_assert_cmpstr(error_get_pretty(error), =3D=3D, "chardev 'hub0' is al= ready in use"); error_free(error); error =3D NULL; @@ -531,7 +531,7 @@ static void char_hub_test(void) h.read_count =3D 0; =20 /* Write to frontend, chr_be */ - ret =3D qemu_chr_fe_write(&chr_be, (void *)"heyhey", 6); + ret =3D qemu_chr_fe_write(&chr_fe, (void *)"heyhey", 6); g_assert_cmpint(ret, =3D=3D, 6); =20 data =3D qmp_ringbuf_read("chr1", RB_SIZE, false, 0, &error_abort); @@ -557,7 +557,7 @@ static void char_hub_test(void) error =3D NULL; =20 /* Finalize frontend */ - qemu_chr_fe_deinit(&chr_be, false); + qemu_chr_fe_deinit(&chr_fe, false); =20 /* Finalize hub0 */ qmp_chardev_remove("hub0", &error_abort); @@ -632,8 +632,8 @@ static void char_hub_test(void) qemu_opts_del(opts); =20 /* Attach hub to a frontend */ - qemu_chr_fe_init(&chr_be, hub, &error_abort); - qemu_chr_fe_set_handlers(&chr_be, + qemu_chr_fe_init(&chr_fe, hub, &error_abort); + qemu_chr_fe_set_handlers(&chr_fe, fe_can_read, fe_read, fe_event, @@ -642,7 +642,7 @@ static void char_hub_test(void) NULL, true); =20 /* Write to frontend, chr_be */ - ret =3D qemu_chr_fe_write(&chr_be, (void *)"thisis", 6); + ret =3D qemu_chr_fe_write(&chr_fe, (void *)"thisis", 6); g_assert_cmpint(ret, =3D=3D, 6); =20 data =3D qmp_ringbuf_read("chr1", RB_SIZE, false, 0, &error_abort); @@ -663,7 +663,7 @@ static void char_hub_test(void) close(fd); =20 /* Add watch. 0 indicates no watches if nothing to wait for */ - ret =3D qemu_chr_fe_add_watch(&chr_be, G_IO_OUT | G_IO_HUP, + ret =3D qemu_chr_fe_add_watch(&chr_fe, G_IO_OUT | G_IO_HUP, NULL, NULL); g_assert_cmpint(ret, =3D=3D, 0); =20 @@ -672,14 +672,14 @@ static void char_hub_test(void) * power of two to fit nicely the whole pipe buffer. */ len =3D 0; - while ((ret =3D qemu_chr_fe_write(&chr_be, (void *)"thisisit", 8)) + while ((ret =3D qemu_chr_fe_write(&chr_fe, (void *)"thisisit", 8)) !=3D -1) { len +=3D ret; } g_assert_cmpint(errno, =3D=3D, EAGAIN); =20 /* Further all writes should cause EAGAIN */ - ret =3D qemu_chr_fe_write(&chr_be, (void *)"b", 1); + ret =3D qemu_chr_fe_write(&chr_fe, (void *)"b", 1); g_assert_cmpint(ret, =3D=3D, -1); g_assert_cmpint(errno, =3D=3D, EAGAIN); =20 @@ -687,7 +687,7 @@ static void char_hub_test(void) * Add watch. Non 0 indicates we have a blocked chardev, which * can wakes us up when write is possible. */ - ret =3D qemu_chr_fe_add_watch(&chr_be, G_IO_OUT | G_IO_HUP, + ret =3D qemu_chr_fe_add_watch(&chr_fe, G_IO_OUT | G_IO_HUP, NULL, NULL); g_assert_cmpint(ret, !=3D, 0); g_source_remove(ret); @@ -712,10 +712,10 @@ static void char_hub_test(void) * was already consumed and drained by the ring buffers, but * pipe have not recieved that yet. */ - ret =3D qemu_chr_fe_write(&chr_be, (void *)"thisisit", 8); + ret =3D qemu_chr_fe_write(&chr_fe, (void *)"thisisit", 8); g_assert_cmpint(ret, =3D=3D, 8); =20 - ret =3D qemu_chr_fe_write(&chr_be, (void *)"streamisrestored", 16); + ret =3D qemu_chr_fe_write(&chr_fe, (void *)"streamisrestored", 16); g_assert_cmpint(ret, =3D=3D, 16); =20 data =3D qmp_ringbuf_read("chr1", RB_SIZE, false, 0, &error_abort); @@ -744,7 +744,7 @@ static void char_hub_test(void) g_free(pipe); =20 /* Finalize frontend */ - qemu_chr_fe_deinit(&chr_be, false); + qemu_chr_fe_deinit(&chr_fe, false); =20 /* Finalize hub0 */ qmp_chardev_remove("hub0", &error_abort); @@ -803,10 +803,10 @@ static void websock_client_read(void *opaque, const u= int8_t *buf, int size) Chardev *chr_client =3D opaque; =20 if (websock_check_http_headers((char *) buf, size)) { - qemu_chr_fe_write(chr_client->be, ping, sizeof(ping)); + qemu_chr_fe_write(chr_client->fe, ping, sizeof(ping)); } else if (buf[0] =3D=3D 0x8a && buf[1] =3D=3D 0x05) { g_assert(strncmp((char *) buf + 2, "hello", 5) =3D=3D 0); - qemu_chr_fe_write(chr_client->be, binary, sizeof(binary)); + qemu_chr_fe_write(chr_client->fe, binary, sizeof(binary)); } else { g_assert(buf[0] =3D=3D 0x88 && buf[1] =3D=3D 0x16); g_assert(strncmp((char *) buf + 4, "peer requested close", 10) =3D= =3D 0); @@ -828,8 +828,8 @@ static void char_websock_test(void) const char *port; char *tmp; char *handshake_port; - CharBackend be; - CharBackend client_be; + CharFrontend fe; + CharFrontend client_fe; Chardev *chr_client; Chardev *chr =3D qemu_chr_new("server", "websocket:127.0.0.1:0,server=3Don,wait=3D= off", NULL); @@ -852,13 +852,13 @@ static void char_websock_test(void) handshake_port =3D g_strdup_printf(handshake, port, port); qobject_unref(qdict); =20 - qemu_chr_fe_init(&be, chr, &error_abort); - qemu_chr_fe_set_handlers(&be, websock_server_can_read, websock_server_= read, + qemu_chr_fe_init(&fe, chr, &error_abort); + qemu_chr_fe_set_handlers(&fe, websock_server_can_read, websock_server_= read, NULL, NULL, chr, NULL, true); =20 chr_client =3D qemu_chr_new("client", tmp, NULL); - qemu_chr_fe_init(&client_be, chr_client, &error_abort); - qemu_chr_fe_set_handlers(&client_be, websock_client_can_read, + qemu_chr_fe_init(&client_fe, chr_client, &error_abort); + qemu_chr_fe_set_handlers(&client_fe, websock_client_can_read, websock_client_read, NULL, NULL, chr_client, NULL, true); g_free(tmp); @@ -887,7 +887,7 @@ static void char_pipe_test(void) gchar *tmp_path =3D g_dir_make_tmp("qemu-test-char.XXXXXX", NULL); gchar *tmp, *in, *out, *pipe =3D g_build_filename(tmp_path, "pipe", NU= LL); Chardev *chr; - CharBackend be; + CharFrontend c; int ret, fd; char buf[10]; FeHandler fe =3D { 0, }; @@ -906,9 +906,9 @@ static void char_pipe_test(void) g_assert_nonnull(chr); g_free(tmp); =20 - qemu_chr_fe_init(&be, chr, &error_abort); + qemu_chr_fe_init(&c, chr, &error_abort); =20 - ret =3D qemu_chr_fe_write(&be, (void *)"pipe-out", 9); + ret =3D qemu_chr_fe_write(&c, (void *)"pipe-out", 9); g_assert_cmpint(ret, =3D=3D, 9); =20 fd =3D open(out, O_RDWR); @@ -922,7 +922,7 @@ static void char_pipe_test(void) g_assert_cmpint(ret, =3D=3D, 8); close(fd); =20 - qemu_chr_fe_set_handlers(&be, + qemu_chr_fe_set_handlers(&c, fe_can_read, fe_read, fe_event, @@ -935,7 +935,7 @@ static void char_pipe_test(void) g_assert_cmpint(fe.read_count, =3D=3D, 8); g_assert_cmpstr(fe.read_buf, =3D=3D, "pipe-in"); =20 - qemu_chr_fe_deinit(&be, true); + qemu_chr_fe_deinit(&c, true); =20 g_assert(g_unlink(in) =3D=3D 0); g_assert(g_unlink(out) =3D=3D 0); @@ -951,8 +951,8 @@ typedef struct SocketIdleData { GMainLoop *loop; Chardev *chr; bool conn_expected; - CharBackend *be; - CharBackend *client_be; + CharFrontend *fe; + CharFrontend *client_fe; } SocketIdleData; =20 =20 @@ -993,7 +993,7 @@ static void char_udp_test_internal(Chardev *reuse_chr, = int sock) struct sockaddr_in other; SocketIdleData d =3D { 0, }; Chardev *chr; - CharBackend stack_be, *be =3D &stack_be; + CharFrontend stack_fe, *fe =3D &stack_fe; socklen_t alen =3D sizeof(other); int ret; char buf[10]; @@ -1001,7 +1001,7 @@ static void char_udp_test_internal(Chardev *reuse_chr= , int sock) =20 if (reuse_chr) { chr =3D reuse_chr; - be =3D chr->be; + fe =3D chr->fe; } else { int port; sock =3D make_udp_socket(&port); @@ -1009,11 +1009,11 @@ static void char_udp_test_internal(Chardev *reuse_c= hr, int sock) chr =3D qemu_chr_new("client", tmp, NULL); g_assert_nonnull(chr); =20 - qemu_chr_fe_init(be, chr, &error_abort); + qemu_chr_fe_init(fe, chr, &error_abort); } =20 d.chr =3D chr; - qemu_chr_fe_set_handlers(be, socket_can_read_hello, socket_read_hello, + qemu_chr_fe_set_handlers(fe, socket_can_read_hello, socket_read_hello, NULL, NULL, &d, NULL, true); ret =3D qemu_chr_write_all(chr, (uint8_t *)"hello", 5); g_assert_cmpint(ret, =3D=3D, 5); @@ -1028,7 +1028,7 @@ static void char_udp_test_internal(Chardev *reuse_chr= , int sock) =20 if (!reuse_chr) { close(sock); - qemu_chr_fe_deinit(be, true); + qemu_chr_fe_deinit(fe, true); } g_free(tmp); } @@ -1042,7 +1042,7 @@ static void char_udp_test(void) typedef struct { int event; bool got_pong; - CharBackend *be; + CharFrontend *fe; } CharSocketTestData; =20 =20 @@ -1063,13 +1063,13 @@ char_socket_event_with_error(void *opaque, QEMUChrE= vent event) { static bool first_error; CharSocketTestData *data =3D opaque; - CharBackend *be =3D data->be; + CharFrontend *fe =3D data->fe; data->event =3D event; switch (event) { case CHR_EVENT_OPENED: if (!first_error) { first_error =3D true; - qemu_chr_fe_disconnect(be); + qemu_chr_fe_disconnect(fe); } return; case CHR_EVENT_CLOSED: @@ -1185,7 +1185,7 @@ static void char_socket_server_test(gconstpointer opa= que) { const CharSocketServerTestConfig *config =3D opaque; Chardev *chr; - CharBackend be =3D {0}; + CharFrontend c =3D {0}; CharSocketTestData data =3D {0}; QObject *qaddr; SocketAddress *addr; @@ -1224,12 +1224,12 @@ static void char_socket_server_test(gconstpointer o= paque) visit_free(v); qobject_unref(qaddr); =20 - qemu_chr_fe_init(&be, chr, &error_abort); + qemu_chr_fe_init(&c, chr, &error_abort); =20 reconnect: data.event =3D -1; - data.be =3D &be; - qemu_chr_fe_set_handlers(&be, NULL, NULL, + data.fe =3D &c; + qemu_chr_fe_set_handlers(&c, NULL, NULL, char_socket_event, NULL, &data, NULL, true); g_assert(data.event =3D=3D -1); @@ -1260,13 +1260,13 @@ static void char_socket_server_test(gconstpointer o= paque) data.event =3D -1; =20 /* Send a greeting to the client */ - ret =3D qemu_chr_fe_write_all(&be, (const uint8_t *)SOCKET_PING, + ret =3D qemu_chr_fe_write_all(&c, (const uint8_t *)SOCKET_PING, sizeof(SOCKET_PING)); g_assert_cmpint(ret, =3D=3D, sizeof(SOCKET_PING)); g_assert(data.event =3D=3D -1); =20 /* Setup a callback to receive the reply to our greeting */ - qemu_chr_fe_set_handlers(&be, char_socket_can_read, + qemu_chr_fe_set_handlers(&c, char_socket_can_read, char_socket_read, char_socket_event, NULL, &data, NULL, true); @@ -1375,7 +1375,7 @@ static void char_socket_client_test(gconstpointer opa= que) QIOChannelSocket *ioc; char *optstr; Chardev *chr; - CharBackend be =3D {0}; + CharFrontend c =3D {0}; CharSocketTestData data =3D {0}; SocketAddress *addr; QemuThread thread; @@ -1431,12 +1431,12 @@ static void char_socket_client_test(gconstpointer o= paque) &error_abort)); } =20 - qemu_chr_fe_init(&be, chr, &error_abort); + qemu_chr_fe_init(&c, chr, &error_abort); =20 reconnect: data.event =3D -1; - data.be =3D &be; - qemu_chr_fe_set_handlers(&be, NULL, NULL, + data.fe =3D &c; + qemu_chr_fe_set_handlers(&c, NULL, NULL, event_cb, NULL, &data, NULL, true); if (config->reconnect) { @@ -1467,13 +1467,13 @@ static void char_socket_client_test(gconstpointer o= paque) g_assert(object_property_get_bool(OBJECT(chr), "connected", &error_abo= rt)); =20 /* Send a greeting to the server */ - ret =3D qemu_chr_fe_write_all(&be, (const uint8_t *)SOCKET_PING, + ret =3D qemu_chr_fe_write_all(&c, (const uint8_t *)SOCKET_PING, sizeof(SOCKET_PING)); g_assert_cmpint(ret, =3D=3D, sizeof(SOCKET_PING)); g_assert(data.event =3D=3D -1); =20 /* Setup a callback to receive the reply to our greeting */ - qemu_chr_fe_set_handlers(&be, char_socket_can_read, + qemu_chr_fe_set_handlers(&c, char_socket_can_read, char_socket_read, event_cb, NULL, &data, NULL, true); @@ -1521,7 +1521,7 @@ static void char_socket_server_two_clients_test(gcons= tpointer opaque) { SocketAddress *incoming_addr =3D (gpointer) opaque; Chardev *chr; - CharBackend be =3D {0}; + CharFrontend c =3D {0}; QObject *qaddr; SocketAddress *addr; Visitor *v; @@ -1558,9 +1558,9 @@ static void char_socket_server_two_clients_test(gcons= tpointer opaque) visit_free(v); qobject_unref(qaddr); =20 - qemu_chr_fe_init(&be, chr, &error_abort); + qemu_chr_fe_init(&c, chr, &error_abort); =20 - qemu_chr_fe_set_handlers(&be, char_socket_can_read, char_socket_discar= d_read, + qemu_chr_fe_set_handlers(&c, char_socket_can_read, char_socket_discard= _read, count_closed_event, NULL, &closed, NULL, true); =20 @@ -1570,7 +1570,7 @@ static void char_socket_server_two_clients_test(gcons= tpointer opaque) =20 /* switch the chardev to another context */ GMainContext *ctx =3D g_main_context_new(); - qemu_chr_fe_set_handlers(&be, char_socket_can_read, char_socket_discar= d_read, + qemu_chr_fe_set_handlers(&c, char_socket_can_read, char_socket_discard= _read, count_closed_event, NULL, &closed, ctx, true); =20 @@ -1649,7 +1649,7 @@ static void char_parallel_test(void) static void char_file_fifo_test(void) { Chardev *chr; - CharBackend be; + CharFrontend c; char *tmp_path =3D g_dir_make_tmp("qemu-test-char.XXXXXX", NULL); char *fifo =3D g_build_filename(tmp_path, "fifo", NULL); char *out =3D g_build_filename(tmp_path, "out", NULL); @@ -1671,8 +1671,8 @@ static void char_file_fifo_test(void) chr =3D qemu_chardev_new("label-file", TYPE_CHARDEV_FILE, &backend, NULL, &error_abort); =20 - qemu_chr_fe_init(&be, chr, &error_abort); - qemu_chr_fe_set_handlers(&be, + qemu_chr_fe_init(&c, chr, &error_abort); + qemu_chr_fe_set_handlers(&c, fe_can_read, fe_read, fe_event, @@ -1692,7 +1692,7 @@ static void char_file_fifo_test(void) g_assert_cmpint(fe.read_count, =3D=3D, 8); g_assert_cmpstr(fe.read_buf, =3D=3D, "fifo-in"); =20 - qemu_chr_fe_deinit(&be, true); + qemu_chr_fe_deinit(&c, true); =20 g_unlink(fifo); g_free(fifo); @@ -1752,7 +1752,7 @@ static void char_null_test(void) { Error *err =3D NULL; Chardev *chr; - CharBackend be; + CharFrontend c; int ret; =20 chr =3D qemu_chr_find("label-null"); @@ -1768,27 +1768,27 @@ static void char_null_test(void) QEMU_CHAR_FEATURE_RECONNECTABLE) =3D=3D false); =20 /* check max avail */ - qemu_chr_fe_init(&be, chr, &error_abort); - qemu_chr_fe_init(&be, chr, &err); + qemu_chr_fe_init(&c, chr, &error_abort); + qemu_chr_fe_init(&c, chr, &err); error_free_or_abort(&err); =20 /* deinit & reinit */ - qemu_chr_fe_deinit(&be, false); - qemu_chr_fe_init(&be, chr, &error_abort); + qemu_chr_fe_deinit(&c, false); + qemu_chr_fe_init(&c, chr, &error_abort); =20 - qemu_chr_fe_set_open(&be, true); + qemu_chr_fe_set_open(&c, true); =20 - qemu_chr_fe_set_handlers(&be, + qemu_chr_fe_set_handlers(&c, fe_can_read, fe_read, fe_event, NULL, NULL, NULL, true); =20 - ret =3D qemu_chr_fe_write(&be, (void *)"buf", 4); + ret =3D qemu_chr_fe_write(&c, (void *)"buf", 4); g_assert_cmpint(ret, =3D=3D, 4); =20 - qemu_chr_fe_deinit(&be, true); + qemu_chr_fe_deinit(&c, true); } =20 static void char_invalid_test(void) @@ -1814,7 +1814,7 @@ static void char_hotswap_test(void) { char *chr_args; Chardev *chr; - CharBackend be; + CharFrontend c; =20 gchar *tmp_path =3D g_dir_make_tmp("qemu-test-char.XXXXXX", NULL); char *filename =3D g_build_filename(tmp_path, "file", NULL); @@ -1830,32 +1830,32 @@ static void char_hotswap_test(void) chr_args =3D g_strdup_printf("udp:127.0.0.1:%d", port); =20 chr =3D qemu_chr_new("chardev", chr_args, NULL); - qemu_chr_fe_init(&be, chr, &error_abort); + qemu_chr_fe_init(&c, chr, &error_abort); =20 /* check that chardev operates correctly */ char_udp_test_internal(chr, sock); =20 /* set the handler that denies the hotswap */ - qemu_chr_fe_set_handlers(&be, NULL, NULL, + qemu_chr_fe_set_handlers(&c, NULL, NULL, NULL, chardev_change_denied, NULL, NULL, true= ); =20 /* now, change is denied and has to keep the old backend operating */ ret =3D qmp_chardev_change("chardev", &backend, NULL); g_assert(!ret); - g_assert(be.chr =3D=3D chr); + g_assert(c.chr =3D=3D chr); =20 char_udp_test_internal(chr, sock); =20 /* now allow the change */ - qemu_chr_fe_set_handlers(&be, NULL, NULL, + qemu_chr_fe_set_handlers(&c, NULL, NULL, NULL, chardev_change, NULL, NULL, true); =20 /* has to succeed now */ ret =3D qmp_chardev_change("chardev", &backend, &error_abort); - g_assert(be.chr !=3D chr); + g_assert(c.chr !=3D chr); =20 close(sock); - chr =3D be.chr; + chr =3D c.chr; =20 /* run the file chardev test */ char_file_test_internal(chr, filename); diff --git a/tests/unit/test-yank.c b/tests/unit/test-yank.c index 4acfb2f3f62..9fc86a21282 100644 --- a/tests/unit/test-yank.c +++ b/tests/unit/test-yank.c @@ -65,7 +65,7 @@ static void char_change_test(gconstpointer opaque) CharChangeTestConfig *conf =3D (gpointer) opaque; SocketAddress *addr; Chardev *chr; - CharBackend be; + CharFrontend fe; ChardevReturn *ret; QIOChannelSocket *ioc; QemuThread thread; @@ -144,9 +144,9 @@ static void char_change_test(gconstpointer opaque) qemu_thread_join(&thread); } =20 - qemu_chr_fe_init(&be, chr, &error_abort); + qemu_chr_fe_init(&fe, chr, &error_abort); /* allow chardev-change */ - qemu_chr_fe_set_handlers(&be, NULL, NULL, + qemu_chr_fe_set_handlers(&fe, NULL, NULL, NULL, chardev_change, NULL, NULL, true); =20 if (conf->fail) { @@ -154,7 +154,7 @@ static void char_change_test(gconstpointer opaque) ret =3D qmp_chardev_change("chardev", &fail_backend[conf->new_yank= ], NULL); g_assert_null(ret); - g_assert(be.chr =3D=3D chr); + g_assert(fe.chr =3D=3D chr); g_assert(is_yank_instance_registered() =3D=3D conf->old_yank); g_unsetenv("QTEST_SILENT_ERRORS"); } else { @@ -168,11 +168,11 @@ static void char_change_test(gconstpointer opaque) qemu_thread_join(&thread); } g_assert_nonnull(ret); - g_assert(be.chr !=3D chr); + g_assert(fe.chr !=3D chr); g_assert(is_yank_instance_registered() =3D=3D conf->new_yank); } =20 - object_unparent(OBJECT(be.chr)); + object_unparent(OBJECT(fe.chr)); object_unref(OBJECT(ioc)); qapi_free_ChardevReturn(ret); qapi_free_SocketAddress(addr); diff --git a/rust/bindings/src/lib.rs b/rust/bindings/src/lib.rs index 5bf03b13706..4c9bb794f79 100644 --- a/rust/bindings/src/lib.rs +++ b/rust/bindings/src/lib.rs @@ -28,8 +28,8 @@ // BQL is taken, either directly or via `BqlCell` and `BqlRefCell`. // When bindings for character devices are introduced, this can be // moved to the Opaque<> wrapper in src/chardev.rs. -unsafe impl Send for CharBackend {} -unsafe impl Sync for CharBackend {} +unsafe impl Send for CharFrontend {} +unsafe impl Sync for CharFrontend {} =20 // SAFETY: this is a pure data struct unsafe impl Send for CoalescedMemoryRange {} diff --git a/rust/chardev/src/bindings.rs b/rust/chardev/src/bindings.rs index 63bfbb8ce66..360b30d6a34 100644 --- a/rust/chardev/src/bindings.rs +++ b/rust/chardev/src/bindings.rs @@ -34,7 +34,7 @@ // BQL is taken, either directly or via `BqlCell` and `BqlRefCell`. // When bindings for character devices are introduced, this can be // moved to the Opaque<> wrapper in src/chardev.rs. -unsafe impl Send for CharBackend {} -unsafe impl Sync for CharBackend {} +unsafe impl Send for CharFrontend {} +unsafe impl Sync for CharFrontend {} =20 -unsafe impl Zeroable for CharBackend {} +unsafe impl Zeroable for CharFrontend {} diff --git a/rust/chardev/src/chardev.rs b/rust/chardev/src/chardev.rs index 2014479674f..f0b7975dbf7 100644 --- a/rust/chardev/src/chardev.rs +++ b/rust/chardev/src/chardev.rs @@ -6,7 +6,7 @@ //! //! Character devices in QEMU can run under the big QEMU lock or in a sepa= rate //! `GMainContext`. Here we only support the former, because the bindings -//! enforce that the BQL is taken whenever the functions in [`CharBackend`= ] are +//! enforce that the BQL is taken whenever the functions in [`CharFrontend= `] are //! called. =20 use std::{ @@ -32,25 +32,25 @@ pub type ChardevClass =3D bindings::ChardevClass; pub type Event =3D bindings::QEMUChrEvent; =20 -/// A safe wrapper around [`bindings::CharBackend`], denoting the character +/// A safe wrapper around [`bindings::CharFrontend`], denoting the charact= er /// back-end that is used for example by a device. Compared to the /// underlying C struct it adds BQL protection, and is marked as pinned /// because the QOM object ([`bindings::Chardev`]) contains a pointer to -/// the `CharBackend`. -pub struct CharBackend { - inner: BqlRefCell, +/// the `CharFrontend`. +pub struct CharFrontend { + inner: BqlRefCell, _pin: PhantomPinned, } =20 -pub struct CharBackendMut<'a>(BqlRefMut<'a, bindings::CharBackend>); +pub struct CharFrontendMut<'a>(BqlRefMut<'a, bindings::CharFrontend>); =20 -impl Write for CharBackendMut<'_> { +impl Write for CharFrontendMut<'_> { fn flush(&mut self) -> io::Result<()> { Ok(()) } =20 fn write(&mut self, buf: &[u8]) -> io::Result { - let chr: &mut bindings::CharBackend =3D &mut self.0; + let chr: &mut bindings::CharFrontend =3D &mut self.0; =20 let len =3D buf.len().try_into().unwrap(); let r =3D unsafe { bindings::qemu_chr_fe_write(addr_of_mut!(*chr),= buf.as_ptr(), len) }; @@ -58,7 +58,7 @@ fn write(&mut self, buf: &[u8]) -> io::Result { } =20 fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { - let chr: &mut bindings::CharBackend =3D &mut self.0; + let chr: &mut bindings::CharFrontend =3D &mut self.0; =20 let len =3D buf.len().try_into().unwrap(); let r =3D unsafe { bindings::qemu_chr_fe_write_all(addr_of_mut!(*c= hr), buf.as_ptr(), len) }; @@ -72,7 +72,7 @@ fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { } } =20 -impl Debug for CharBackend { +impl Debug for CharFrontend { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { // SAFETY: accessed just to print the values let chr =3D self.inner.as_ptr(); @@ -81,13 +81,13 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Resul= t { } =20 // FIXME: use something like PinnedDrop from the pinned_init crate -impl Drop for CharBackend { +impl Drop for CharFrontend { fn drop(&mut self) { self.disable_handlers(); } } =20 -impl CharBackend { +impl CharFrontend { /// Enable the front-end's character device handlers, if there is an /// associated `Chardev`. pub fn enable_handlers< @@ -198,7 +198,7 @@ pub fn accept_input(&self) { /// the big QEMU lock while the character device is borrowed, as /// that might cause C code to write to the character device. pub fn borrow_mut(&self) -> impl Write + '_ { - CharBackendMut(self.inner.borrow_mut()) + CharFrontendMut(self.inner.borrow_mut()) } =20 /// Send a continuous stream of zero bits on the line if `enabled` is diff --git a/rust/hw/char/pl011/src/device.rs b/rust/hw/char/pl011/src/devi= ce.rs index 8889d6e54fb..5e9b13fdf92 100644 --- a/rust/hw/char/pl011/src/device.rs +++ b/rust/hw/char/pl011/src/device.rs @@ -5,7 +5,7 @@ use std::{ffi::CStr, mem::size_of}; =20 use bql::BqlRefCell; -use chardev::{CharBackend, Chardev, Event}; +use chardev::{CharFrontend, Chardev, Event}; use common::{static_assert, uninit_field_mut}; use hwcore::{ Clock, ClockEvent, DeviceImpl, DeviceMethods, DeviceState, IRQState, I= nterruptSource, @@ -106,7 +106,7 @@ pub struct PL011State { pub iomem: MemoryRegion, #[doc(alias =3D "chr")] #[property(rename =3D "chardev")] - pub char_backend: CharBackend, + pub char_frontend: CharFrontend, pub regs: BqlRefCell, /// QEMU interrupts /// @@ -240,7 +240,7 @@ pub(self) fn write(&mut self, offset: RegisterOffset, v= alue: u32, device: &PL011 } let update =3D (self.line_control.send_break() !=3D new_va= l.send_break()) && { let break_enable =3D new_val.send_break(); - let _ =3D device.char_backend.send_break(break_enable); + let _ =3D device.char_frontend.send_break(break_enable= ); self.loopback_break(break_enable) }; self.line_control =3D new_val; @@ -561,7 +561,7 @@ fn read(&self, offset: hwaddr, _size: u32) -> u64 { trace::trace_pl011_read(offset, result, c""); if update_irq { self.update(); - self.char_backend.accept_input(); + self.char_frontend.accept_input(); } result.into() } @@ -579,7 +579,7 @@ fn write(&self, offset: hwaddr, value: u64, _size: u32)= { let ch: [u8; 1] =3D [value as u8]; // XXX this blocks entire thread. Rewrite to use // qemu_chr_fe_write and background I/O callbacks - let _ =3D self.char_backend.write_all(&ch); + let _ =3D self.char_frontend.write_all(&ch); } =20 update_irq =3D self.regs.borrow_mut().write(field, value as u3= 2, self); @@ -645,7 +645,7 @@ fn event(&self, event: Event) { } =20 fn realize(&self) -> util::Result<()> { - self.char_backend + self.char_frontend .enable_handlers(self, Self::can_receive, Self::receive, Self:= :event); Ok(()) } diff --git a/rust/hw/core/src/qdev.rs b/rust/hw/core/src/qdev.rs index c3097a284d7..4e983da28b7 100644 --- a/rust/hw/core/src/qdev.rs +++ b/rust/hw/core/src/qdev.rs @@ -156,7 +156,7 @@ unsafe impl $crate::qdev::QDevProp for $type { impl_qdev_prop!(usize, qdev_prop_usize); impl_qdev_prop!(i32, qdev_prop_int32); impl_qdev_prop!(i64, qdev_prop_int64); -impl_qdev_prop!(chardev::CharBackend, qdev_prop_chr); +impl_qdev_prop!(chardev::CharFrontend, qdev_prop_chr); =20 /// Trait to define device properties. /// --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761673129; cv=none; d=zohomail.com; s=zohoarc; b=DVaEDC9Wi74Fs+IIhafHUlPT2DSyRpENL8I8Yq5yDhJaMZ0zRhExSK/M+7BZ/yETKyrR0+VjPWYx9FXctKCG6oc3CHdQddnMGzVah6liolEzK4Cac3TowhwY+fwwx+8kst+uEZtLH9b/h8p+vUowfYELYRy83HBgH0jZF1esHRI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761673129; 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=qr/uEpcK466AGGfZ9FV3WnUVpqfKNyqxTrRn7SFpgZQ=; b=f9dSlnSoEA85oj1P6pqq0dZRJc53TkPSEp+i+scDgLZKf6IlQVV+ql+JDA02Mo7ukFWJI+KmFX8va+wV4qIFfP+v+nu18ZYe4qHZ68WNa6dRXX4Q+za8sAlaklQSHFepbCATSXfSxfbwcq866SrFF1GwxQ9F2Wv9LX4WkQCtU6M= 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 1761673129444829.0368992839904; Tue, 28 Oct 2025 10:38:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnbA-000682-36; Tue, 28 Oct 2025 13:35:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnb7-00064M-9Z for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnb3-0004Rp-La for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:04 -0400 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-299-01yRhUpsMXq1O-aDWbH_dA-1; Tue, 28 Oct 2025 13:34:57 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4770e0910e4so21463585e9.0 for ; Tue, 28 Oct 2025 10:34:56 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4771e3a88fdsm2549725e9.10.2025.10.28.10.34.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:34:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672898; 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=qr/uEpcK466AGGfZ9FV3WnUVpqfKNyqxTrRn7SFpgZQ=; b=VUHY+W0Y0pKzWFoNlYrNjOMyitWe5sxJN/WOx2GJK+BG7Kz7BlP35qJtn6BTTu5U5xDkeH Un2h4Tv8VAUDQXKwoOOkS3XtkofgEoPmR27x0htLVhTyyzA0a4Tmd0dYF9fcCQv1JYPkV9 vjFKORsquhqWVPxmGT65BaIU1g6kEp0= X-MC-Unique: 01yRhUpsMXq1O-aDWbH_dA-1 X-Mimecast-MFC-AGG-ID: 01yRhUpsMXq1O-aDWbH_dA_1761672896 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672895; x=1762277695; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qr/uEpcK466AGGfZ9FV3WnUVpqfKNyqxTrRn7SFpgZQ=; b=qVYrAL/QJ1lM3ZQ9/1Ig8g4MjbuFG85hcUZixZpb8pUZVhZvVMBLajqbSm4Ugnxorz agSraVET0VQVnLiqGGUhXQxuSTITb3XvtfOzq/t6Akj93Vup5My6a5NwEdhJcFRwlQs0 p+J3IQqVmjKapNmKULedkVauL00Oxd6xzQ/dIS2iFag1VVhJzEhAjjKQRiRfsxFeThe1 TVEk85tFeKEDR6BxB8w6Pe9XS33U9clRRzAQY1MJlAYcd02nO/66f7x+06/DMsah0e9D aUUt0nnoqHAacAp6nwrNse0RGXZ6MSvnDzUT42MjvZLALljfwIU7Ok4NlsDza88yo7DM L46A== X-Gm-Message-State: AOJu0YyZhG2Ee/zrrJyHXVAdoWvWDhlH4kFzHg3qcyTNg0mvS6K7GunO sBkpbx9034tYlF+i5l/eneaLyZyJOkIKhC0lp58oiPfT4mYsCwV0gzzhilgPmWgnvOczfsRqH49 WDnWC5O1YjB7KoZlUTf3Ui2sI97Mv6KF/kAs1G1J9+NnmsKRq+FoGifjcV0Wn4kheL8LzUyl/MS B9l6G+JBbf1EfpKstUPDjGFNnelfnpRk/htzi8uafQ X-Gm-Gg: ASbGnct80vmNikL/mnwD1q2wHSBw5GIBMOBKdHg7Zi8qK6nOZqVMqZjZ2yZ+dCeVHvk G1MnVnK/9DI00V6XitubHJDirNsJV/8eF4LqZan3U8damVAoSaFfQLqNeiWChpD9T8Pg4fioCc/ e2vL/lV+lni8uV3IIGTEoJGOxOTVMf2ZRl7PMyQRdOA2rcL2yTXub3CWwFJuWmnjU6X899NFepr o/m5q32hC06BqoKj8Gc8Hw8/Bnj4Cq8DDJOL12tdB4LiP+LhoEahdPKg6fOYnJbyU1+OFaoVkZS 8KA6H1+DuzVRnMwwly87gdJTmk6g6qLTMQSQGo9vk2LqA7oktDtsH/xAOTuNfjSRA9qDAYRJCC3 7WG11oZicSbwgIydlOt1dPpV+F5Mw6QNLNwa7QQTG6PwzzmNe4vJ3B0sW7aQjuOuWmCJjbKe1uA xqcKc= X-Received: by 2002:a05:600c:34c4:b0:46e:396b:f5ae with SMTP id 5b1f17b1804b1-4771e17ead6mr2531795e9.16.1761672895121; Tue, 28 Oct 2025 10:34:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGfw1dwTj0hmCE9hBgfMlpFmtS+eNd8iAUVZKJQ21M7A7aFSGLajfT+3e2Irc4RADEbmJm4fg== X-Received: by 2002:a05:600c:34c4:b0:46e:396b:f5ae with SMTP id 5b1f17b1804b1-4771e17ead6mr2531615e9.16.1761672894690; Tue, 28 Oct 2025 10:34:54 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 08/18] accel/mshv: initialize thread name Date: Tue, 28 Oct 2025 18:34:20 +0100 Message-ID: <20251028173430.2180057-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761673131757154100 Content-Type: text/plain; charset="utf-8" The initialization was dropped when the code was copied from existing accelerators. Coverity knows (CID 1641400). Fix it. Signed-off-by: Paolo Bonzini --- accel/mshv/mshv-all.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c index 45174f7c4eb..80428d130d5 100644 --- a/accel/mshv/mshv-all.c +++ b/accel/mshv/mshv-all.c @@ -596,6 +596,9 @@ static void mshv_start_vcpu_thread(CPUState *cpu) { char thread_name[VCPU_THREAD_NAME_SIZE]; =20 + snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/MSHV", + cpu->cpu_index); + cpu->thread =3D g_malloc0(sizeof(QemuThread)); cpu->halt_cond =3D g_malloc0(sizeof(QemuCond)); =20 --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761672964; cv=none; d=zohomail.com; s=zohoarc; b=R2arAKss3XgTCng0Qslgzoa+/mPY0I91kRA23zBkj4Ci3D0w34RB6LmRCf+zt7sqkXRtbVdgsCRSiL3KcGyZf1o86Tv3J0T8GNKjI9IWp2Xk1d0kYtN4qPBos1zlivAw4gF/mXMDlKtHnkvRyAABMRvd8tuMgtwMXxs6loO0Se0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761672964; 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=uNUgC+CpMFn7MC6N/Zib6jbMtfkLhzBQ6ENJcnYPLcY=; b=LTv57NmeqJX/kZo0g3pKrMpi6anSPKbd4BazdFyrFDwvE8YBm8Ltu/WdJEsnQ1KrCvPTLzlP/Ghn3sdIBGecMjMma9n7EBk6mRUGdFsKDJoZQcNcgaO+qr+nI4Lxom0aOoaOnN/nUrLEPOs2GAywOk/3cIx7LEIvmZfYDqKC21E= 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 1761672964452391.5951384596758; Tue, 28 Oct 2025 10:36:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnbH-0006DH-5S; Tue, 28 Oct 2025 13:35:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbF-0006Bp-Df for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnb8-0004Sc-M4 for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:13 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-682-kmWzT40lPXC-t_oV4CoUUw-1; Tue, 28 Oct 2025 13:35:00 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4711899ab0aso44619155e9.2 for ; Tue, 28 Oct 2025 10:35:00 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4771e202093sm3535315e9.11.2025.10.28.10.34.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:34:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672901; 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=uNUgC+CpMFn7MC6N/Zib6jbMtfkLhzBQ6ENJcnYPLcY=; b=UgeQ3lbihjE4uB/Q12iv9e+6L8p8PeWEgqqRshyAHxJQvviSGGDxqOK7b3Z28ZW2zqTI7g zovQoye6d6jM1+kswS7xHzQK4J7btf276ikBOrApzIUKkz1pF0fE/3CLOW/bKY5oQ5Aww7 r1NZNExI+VysuTGsJ7FS75o5zWEo0w8= X-MC-Unique: kmWzT40lPXC-t_oV4CoUUw-1 X-Mimecast-MFC-AGG-ID: kmWzT40lPXC-t_oV4CoUUw_1761672899 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672898; x=1762277698; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uNUgC+CpMFn7MC6N/Zib6jbMtfkLhzBQ6ENJcnYPLcY=; b=iNyDV4h3ijk8zo0Bhx68MdbbQXg50b+j7d9/QK2ih4/WywC84v6pWsQE5fhnA98733 YZbNcVoscpw87iQVa9sp0IvqWz7srBuSEAYsmO3WIeAFmufv77hYaB/x7iHn0GHCXwxp cXcMvIxhnpJbYagfwTDpGUfduPqtg/fQA795JXShX5wVbalBUklRvgA4SLQHuzCvhOJw FO3cxXQejZMAu/BlUT2j3oK39oZygi0w2lc8Mz2vdjhKPbjwZ2OIWEXkChBpFq3i9f2u nmBhJy0ocSJa3K8d6Kb3b2sxmrNdl3T4CH2eKqMz64hJyilBoBwlTlPf9cogPTQKpH5v tyMA== X-Gm-Message-State: AOJu0YwGPNsoLh/ml0uX6slumT09pGcLn91X7U5pxUnwzk4MeOqnLKHs ae2nJapB80ryGJiP+y4iaevQV2o5bE6MH6SfUXtlvBWIxYLmTT7n7EQoX5z/fkVoM51FVB8V/Vj JH7B6CF4UkgKjyIP9wf9QGyIlMZcC8DfKGOlRrM+HR9yy2B8oendjW2XiYCUPoo+f5euZwTo6HY lBym/RcnYBq2JtyPimrqmM95ylbnOEQxWJHtUoZSDw X-Gm-Gg: ASbGncvFX8mz5tED8OSu3lpWKIYmsv8TaSnseHsKC4f2tg4OMp3bQTnvo5g47a+PI3k +vgdqxxEE4MNYsMH+KnqjGkRCV1WW6RBfcs9wDHCbraMGFY/G+ZmpXquR9z81ou+fB5ji1E3XT8 bPfD+xE7VdkkOnwz7TOQhj6iNXWQ0tSs4XBmQw8y3fp7wsw5fk/bgUquZwrcnsRGgB0fb9HC+bY h06/33vlcZwAVQ0L1TAcCRQLSMXqcKst6P8BzXYm+r1HOrDXWz4aN/jN8LJzf8/mlvve6x+iRiC h7z/lTQpt5BX/3UJ9bxXEt80dI+aEUgnaEELopAR+WMfl+D66247WeJcBmJfrKPOcw6MSfz8wmZ CrO0v33ajflMLKDNziW0Q8dENTr4HsB3BKpt1bAmm4gNNIe2+o/gSXMlFX4wcpx+/Cqpl22n60H YvF/o= X-Received: by 2002:a05:600c:1992:b0:475:d952:342f with SMTP id 5b1f17b1804b1-4771e24e0fdmr2056235e9.39.1761672897803; Tue, 28 Oct 2025 10:34:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF3OeZeHSZv4NQ7tuLzYcaOXr9HroN3Ew7tD56JoIb97RfKqnz54BteuTIHb+bwl2DtvtGdJw== X-Received: by 2002:a05:600c:1992:b0:475:d952:342f with SMTP id 5b1f17b1804b1-4771e24e0fdmr2055935e9.39.1761672897248; Tue, 28 Oct 2025 10:34:57 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 09/18] accel/mshv: use return value of handle_pio_str_read Date: Tue, 28 Oct 2025 18:34:21 +0100 Message-ID: <20251028173430.2180057-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761672972022158500 Content-Type: text/plain; charset="utf-8" Coverity complains because we assign to ret here but then never read it again before we overwrite it with the call to set_x64_registers(). Analyzed-by: Peter Maydell Signed-off-by: Paolo Bonzini --- target/i386/mshv/mshv-cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c index 1f7b9cb37ec..1c3db02188c 100644 --- a/target/i386/mshv/mshv-cpu.c +++ b/target/i386/mshv/mshv-cpu.c @@ -1489,6 +1489,10 @@ static int handle_pio_str(CPUState *cpu, hv_x64_io_p= ort_intercept_message *info) reg_values[0] =3D info->rsi; } else { ret =3D handle_pio_str_read(cpu, info, repeat, port, direction_fla= g); + if (ret < 0) { + error_report("Failed to handle pio str read"); + return -1; + } reg_names[0] =3D HV_X64_REGISTER_RDI; reg_values[0] =3D info->rdi; } --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761672990; cv=none; d=zohomail.com; s=zohoarc; b=Zh86DnjlYQAcRYyF1UG4e+z8cBDzceg1Ovp8QTQICv34NgSbn2ihCf3W7dtu48zt/ltG3Yw2ZCTACNgyYSjU8kyZk8A4nfo5Iif18mavI0OEzfbylX0QRfJJe4UViYuN9+WUv1wAVYgQXQ2aSAzhJdkevDZC/sMtOiy2qoYzNzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761672990; 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=ReFN2kqAPL8IsCVhHHHqifymfPF4VTb9U8rKSLGrHj8=; b=cJlzhNlVFyN/+DfOY0KF8bROksRWRtlaFDk8W/badtYPptdZj+JOGtfqWN5agjk6UCkdY7wunE/jDvn2OmvHpMNBhex6SXMk48+cSSQSGCgDsOeycQYp4fAfrxV3lOiWM6Ufu3fRcZRUreb7VbNIbfkbftcD1eoE3/bA0e5QZe8= 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 1761672990829592.2791260367771; Tue, 28 Oct 2025 10:36:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnbK-0006Gb-Sk; Tue, 28 Oct 2025 13:35:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbG-0006Cs-DJ for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbB-0004cy-LN for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:14 -0400 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-452-FyajIfH6PaCC0txMZ6sTuQ-1; Tue, 28 Oct 2025 13:35:04 -0400 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-40fd1b17d2bso4001804f8f.1 for ; Tue, 28 Oct 2025 10:35:04 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429952b7b6fsm21553274f8f.1.2025.10.28.10.34.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672905; 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=ReFN2kqAPL8IsCVhHHHqifymfPF4VTb9U8rKSLGrHj8=; b=hHaL+yKQcC2yCQ534HO2pWQJhiTREKkNxYsqQ81WKlI4AF09xL/mKiDnkx4sCDxbS1A2gP orLJMRsRkS9O4bl6jEgZ6MeR31Fl0sIy9BpUbG1X435RSn0cVnItOkWoT1bhOYAU3x9AlF XE+pYdh7yiLGJ0Vnb6TFgp2ih0b8/y0= X-MC-Unique: FyajIfH6PaCC0txMZ6sTuQ-1 X-Mimecast-MFC-AGG-ID: FyajIfH6PaCC0txMZ6sTuQ_1761672903 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672902; x=1762277702; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ReFN2kqAPL8IsCVhHHHqifymfPF4VTb9U8rKSLGrHj8=; b=qw5e6/S1c2DQlZx/yRbg/vGkZqifMdvgpVl4kAuwMTe8uSXfYeJvfL/tsspix+rg+D jwCfNn9lw48sTHiguBXFfxC+phYFpuDF9FxTm+rVg0x2kkpNWQclxmCoOCrvLxSQ6Wmc 5jPvJT+8gIH8jHnAL97lUXi1MLdNVRaKmy2AWwLxrqZw5dWx3HUGEDOSw2CduSB6iORY moWxITrcKmWFH0HJrgu3AIubKl1dnSdLiC/f0HCHfV5IPrzGvSJYF6iOEZ9oWKDdeXCL wZQytC3NqsXXL5gEsqyAz59ksK/bOuQhLXdwT8ffcQqGSB8Fo0KPuQ0+vMFSknFywDig ChHQ== X-Gm-Message-State: AOJu0YwM8mdmZNY7knwf3mK3hFp4S9B5dXKgadBeo5aQwHAU0afR2ZWe 4woAINfx+uRTTre2iHqwrBP/rcbueJmRP4xgZifMgvQ4G7tpcxiGfxKyKwAD0YgWvR9LKgdmjeN HsV4e14z7nYYgAo0QNL2dL7VuMJp6KWocJjkL70k4U9ZQHyPCLSl8pBmlS60mnOoSz3z+xb/+hb GTzYYF8ConauAWlablIvzJrzbdILxYVedDySb+Xx33 X-Gm-Gg: ASbGncuKXrybtpiEVxtXJ2mZCHFnJaLAzDuYJA0BEFXdhALaNfugCE3UMCHAf7g7Vu9 L/Ft5vAS4nKqjQ49SCgQCKV8RS/6c4Uh+Wo50KnbfE5JPXHOJDnmN8M2MX3bfoWzub8NasEkLkB 8FVb28CtGhoJJNSh/6VOVmYViTBfJLMA/ae3LCxIMQ7wgbsePdJrkzivrbgfZJL+P8YsAzwNRqR dFiRLRiOokGJ6dFmDkLMcUGgblKCyNgbippB9ygVyYBMnx33+Anog52Hv0tKfIxhCohTNnW4ho1 y7xAx2pukCEb0mLkd+s6wWp/ylcgnAE+UmHZW1CPf3ZPsH+zIQny0HsTHwkFMT11XcMbOb2lqpD 78pZjaybdEjWNlikAqtUtXN29VfCKL4anskeUc4qbTgzvvHNiP1KMPNG3jD6MGmiRTfW8FaJs/8 wWVfY= X-Received: by 2002:a05:6000:4387:b0:427:1ba4:de9f with SMTP id ffacd0b85a97d-429a7e7343amr3814802f8f.31.1761672902334; Tue, 28 Oct 2025 10:35:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHT2RLj2fWL1AzF73jaY63KL9yuaOhB1rBsQWgDfIzoAohEvvic+cHuNoODIb6MckxK8TyQig== X-Received: by 2002:a05:6000:4387:b0:427:1ba4:de9f with SMTP id ffacd0b85a97d-429a7e7343amr3814777f8f.31.1761672901823; Tue, 28 Oct 2025 10:35:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 10/18] esp.c: fix esp_cdb_ready() FIFO wraparound limit calculation Date: Tue, 28 Oct 2025 18:34:22 +0100 Message-ID: <20251028173430.2180057-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761673002340158500 From: Mark Cave-Ayland The original calculation in commit 3cc70889a3 ("esp.c: prevent cmdfifo over= flow in esp_cdb_ready()") subtracted cmdfifo_cdb_offset from fifo8_num_used() to calculate the outstanding cmdfifo length, but this is incorrect because fifo8_num_used() can also include wraparound data. Instead calculate the maximum offset used by scsi_cdb_length() which is just the first byte after cmdfifo_cdb_offset, and then peek the entire content of the cmdfifo. The fifo8_peek_bufptr() result will then return the maximum length of remaining data up to the end of the internal cmdfifo array, which can then be used for the overflow check. Signed-off-by: Mark Cave-Ayland Fixes: 3cc70889a3 ("esp.c: prevent cmdfifo overflow in esp_cdb_ready()") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3082 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/r/20250925122846.527615-2-mark.cave-ayland@il= ande.co.uk Signed-off-by: Paolo Bonzini --- hw/scsi/esp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 1d264c40e57..2809fcdee09 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -447,7 +447,9 @@ static void write_response(ESPState *s) =20 static bool esp_cdb_ready(ESPState *s) { - int len =3D fifo8_num_used(&s->cmdfifo) - s->cmdfifo_cdb_offset; + /* scsi_cdb_length() only reads the first byte */ + int limit =3D s->cmdfifo_cdb_offset + 1; + int len =3D fifo8_num_used(&s->cmdfifo); const uint8_t *pbuf; uint32_t n; int cdblen; @@ -457,7 +459,7 @@ static bool esp_cdb_ready(ESPState *s) } =20 pbuf =3D fifo8_peek_bufptr(&s->cmdfifo, len, &n); - if (n < len) { + if (n < limit) { /* * In normal use the cmdfifo should never wrap, but include this c= heck * to prevent a malicious guest from reading past the end of the --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761673029; cv=none; d=zohomail.com; s=zohoarc; b=gSrjtp1NUguXeq/+XUcD1RN95YvpBoBwWoXUzNAoJsiZwxpEG9djJiQS14DkXLVplTKeNVnzmxUTKljSn12qNfcMINvIciY0jREvDnqO+z1N2B2PUqoHQuym2P3sXG2ZxS3bzGEgpHOGDFzzt046h6+E9Ii9qY5U1yem4p1uskY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761673029; 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=Ad+FmvUd3eJFOz6Qx4Phgo3HGeXx5lTIOPt67H+q248=; b=jvJ3Y+/zoz93DDda5ZWbG7Zh0n4mnAJEQHhp3tpd3sq4DH9rKTLgDdFCAcmArlDEb9/+adDuFQW32tQBQ4BapZRVA+jK6KsjOUZ954ddqSMLpTZOIkiXCt7pjgJ/+7yUj7Nnko5wrKpkTpIvSWZs0/gqQr/xl/t9yznmLTFujdI= 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 1761673029413430.99646350414514; Tue, 28 Oct 2025 10:37:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnbL-0006Gf-LY; Tue, 28 Oct 2025 13:35:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbG-0006Ct-Fn for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbD-0004fF-EA for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:14 -0400 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-463-xgH_8C12PVqr3DKd9wPWeQ-1; Tue, 28 Oct 2025 13:35:07 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-475da25c4c4so20141675e9.0 for ; Tue, 28 Oct 2025 10:35:06 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4771e39380dsm2183605e9.7.2025.10.28.10.35.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672908; 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=Ad+FmvUd3eJFOz6Qx4Phgo3HGeXx5lTIOPt67H+q248=; b=WjwbhuzhjHBCnqNY41DZV5orBiVIFbwPUmgElBVmc5QL+24M/26gP8F1wpCTn/JjzK9zw3 EOGwZbtEh7BO6RihwtY5VkGXYu6F8J6s08ShTRtEq6EhT0gyYUHAEqtres1ZQM7NVtWhx9 CK6HcRxE/yk7o/DsDF8On9LAsqu/1Ac= X-MC-Unique: xgH_8C12PVqr3DKd9wPWeQ-1 X-Mimecast-MFC-AGG-ID: xgH_8C12PVqr3DKd9wPWeQ_1761672906 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672905; x=1762277705; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ad+FmvUd3eJFOz6Qx4Phgo3HGeXx5lTIOPt67H+q248=; b=JzVmZ3eF1IhOQb+Ag3FA2vg1zkSdNOXhxzSRm3O8l48cJUGUyXpoXYTUlUsmkBQF7M Ga6buEDCke0QdlAjPRNcRuo1snTXvPij+eczcJJLUpoEkq9R+2BcAiOZQHD9U/3iadpx VZ1SU/visv4zd7Fp5AdJs0d89D733fZlLMzHZzBAvxITbOn388tD8LfJf05pIR9ginaL JRoNcHhMCllEsaTwJrEj2U1mXt6im7ap4YWok0y6iuxHEO4rIy1FCS3CKfjr4A4tS5RR 6s8bNUAry9GtG/8JraYirHPO993ZInFgt8oK66bi4Gv2o2ekWozJqAH5DTj3hNCcGKfG LKOg== X-Gm-Message-State: AOJu0YxUNG6MEb6x28LLpJg1bmWK56FSnTSqs2Y7ufH2jhMHOuzSdWfH DMWtybJWSIRabsYGhZsFI8YCOL/fn12KG4BM1IB3zVmYjtFqNYFwDGdybfo/NTtcOo/LtOaUNj2 46g18FDempUd6a1J9Rws1gzbpCFqc+HpT7Ln6SkMWeYGlZScrQqJjiNqOucTGabohHAfykdAasI MkaJkxNpAuaXQ/DCfjK5X/cXAWFI8jEcLQ9T0cB2FU X-Gm-Gg: ASbGncuGW2lg7szJZdBNxEg8FaL5mwxxJuquKy+Umm6dEKcpA38qUuoPOGzDMm7gg86 yUmSprPjVhlCDBuryN/jwURixSVtMoxfrHrYWrsIP3Pm5cNaB24FmgFtVO+T+RGf4v8Ib/Oup49 j5m44KwhvYQYfXMl/IHWCsS4csErCzSVNxlM2WbNB/Ib0Kqj4CYbd+nc0TuVr9LYHbDdvCbLabC 25veO32Y0l63Bwgxxb4Tz942JEa4gxqIqZGe6vLqtz/h7mJ3DRBg6fCf3ZV8iYrelZO+Dpx5jkU 76/KTHd9XTv+w1ApbOPhwArn1PMa2mxYFlKWuXaTdkDotuUcxdeWBoehmYS3cWzXeyvrqZObf58 l60AumISsQt+MSdSo/qkyEWZh1tfpnvrBI42ffabWMQO4m/lkBj2OjAzA3UJlfzwIqbbmrmXFEo amL3I= X-Received: by 2002:a05:600c:5491:b0:475:df91:de03 with SMTP id 5b1f17b1804b1-4771e20e433mr2383915e9.39.1761672904883; Tue, 28 Oct 2025 10:35:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPTQwCC6GeuAs4ewCVzqLyoLXpoYBmoML0KloB53c3B2FNdViDxnIOh8TsgQgchAOahrfk8w== X-Received: by 2002:a05:600c:5491:b0:475:df91:de03 with SMTP id 5b1f17b1804b1-4771e20e433mr2383585e9.39.1761672904421; Tue, 28 Oct 2025 10:35:04 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 11/18] qtest/am53c974-test: add additional test for cmdfifo overflow Date: Tue, 28 Oct 2025 18:34:23 +0100 Message-ID: <20251028173430.2180057-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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.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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761673036916158500 From: Mark Cave-Ayland Based upon the qtest reproducer posted to Gitlab issue #3082 at https://gitlab.com/qemu-project/qemu/-/issues/3082. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/r/20250925122846.527615-3-mark.cave-ayland@il= ande.co.uk Signed-off-by: Paolo Bonzini --- tests/qtest/am53c974-test.c | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/qtest/am53c974-test.c b/tests/qtest/am53c974-test.c index ed3ac7db20d..a3667275ac8 100644 --- a/tests/qtest/am53c974-test.c +++ b/tests/qtest/am53c974-test.c @@ -109,6 +109,44 @@ static void test_cmdfifo_overflow2_ok(void) qtest_quit(s); } =20 +/* Reported as https://issues.oss-fuzz.com/issues/439878564 */ +static void test_cmdfifo_overflow3_ok(void) +{ + QTestState *s =3D qtest_init( + "-device am53c974,id=3Dscsi -device scsi-hd,drive=3Ddisk0 " + "-drive id=3Ddisk0,if=3Dnone,file=3Dnull-co://,format=3Draw -nodef= aults"); + qtest_outl(s, 0xcf8, 0x80001010); + qtest_outl(s, 0xcfc, 0xc000); + qtest_outl(s, 0xcf8, 0x80001004); + qtest_outw(s, 0xcfc, 0x01); + qtest_outb(s, 0xc00c, 0x43); + qtest_outl(s, 0xc00b, 0x9100); + qtest_outl(s, 0xc009, 0x02000000); + qtest_outl(s, 0xc000, 0x0b); + qtest_outl(s, 0xc00b, 0x00); + qtest_outl(s, 0xc00b, 0x00); + qtest_outl(s, 0xc00b, 0xc200); + qtest_outl(s, 0xc00b, 0x1000); + qtest_outl(s, 0xc00b, 0x9000); + qtest_outb(s, 0xc008, 0x00); + qtest_outb(s, 0xc008, 0x00); + qtest_outl(s, 0xc03f, 0x0300); + qtest_outl(s, 0xc00b, 0x00); + qtest_outw(s, 0xc00b, 0x4200); + qtest_outl(s, 0xc00b, 0x00); + qtest_outw(s, 0xc00b, 0x1200); + qtest_outl(s, 0xc00b, 0x00); + qtest_outb(s, 0xc00c, 0x43); + qtest_outl(s, 0xc00b, 0x00); + qtest_outl(s, 0xc00b, 0x00); + qtest_outl(s, 0xc007, 0x00); + qtest_outl(s, 0xc007, 0x00); + qtest_outl(s, 0xc007, 0x00); + qtest_outl(s, 0xc00b, 0x1000); + qtest_outl(s, 0xc007, 0x00); + qtest_quit(s); +} + /* Reported as crash_0900379669 */ static void test_fifo_pop_buf(void) { @@ -266,6 +304,8 @@ int main(int argc, char **argv) test_cmdfifo_overflow_ok); qtest_add_func("am53c974/test_cmdfifo_overflow2_ok", test_cmdfifo_overflow2_ok); + qtest_add_func("am53c974/test_cmdfifo_overflow3_ok", + test_cmdfifo_overflow3_ok); qtest_add_func("am53c974/test_fifo_pop_buf", test_fifo_pop_buf); qtest_add_func("am53c974/test_target_selected_ok", --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761673052; cv=none; d=zohomail.com; s=zohoarc; b=EJOxvxR332kKnKhfOBEH0Ng1Z8Ut65s/pgkCSr18O+WBbkG0XBAZwVsO3nGQhVE4727W78ZcHDO8LoVIaIHrIF1GuqirfcxP/C/JgCP+kIrtPieb1E0iFHYCQnU1YCcpBH28IXpifNYSyguMHM7kxhGS8T6HXoAWDgrWA/39H2I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761673052; 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=dJJwl93Eh9oixq1cw/+plHG+ew8tbgNiOl2RmOmLQvg=; b=CD8bIqyqbGzIBrfe0/rNv2PbX4c8cCCuktAC23dJ5BxX5F8JLEVc+6SCt7AZAIrQAvdcP1RxnlNDuhbVli7LXExNVjnb58KKmAa1YJFPciaKSWG+2Erm5wDSD8KdViqIIHZMcJqLhCJiCfbNKebiGP54YiAMF3ZzEjoRacGZ/mo= 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 1761673052905992.723024893657; Tue, 28 Oct 2025 10:37:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnbM-0006Gw-8w; Tue, 28 Oct 2025 13:35:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbI-0006Ei-P6 for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbE-0004fh-Eg for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:16 -0400 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-44-c_x6qspiPuWlaxwXr1cDbQ-1; Tue, 28 Oct 2025 13:35:09 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4770e0910a1so15819895e9.2 for ; Tue, 28 Oct 2025 10:35:09 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47718493c61sm25002885e9.4.2025.10.28.10.35.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672911; 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=dJJwl93Eh9oixq1cw/+plHG+ew8tbgNiOl2RmOmLQvg=; b=PSUWs0mkBIH+E9Ybe3HYftDW0NpzMOGaett4Y/Qp2EQ31FuWmcwoisYU86UlN0UZMDQmkE sOe6gFituD0srnpXDe27YAbqeTQMGNRMNrRfxuGakU7eaCIhIktDEaeUU0JUfpuqOSwNZd Yot/lEVxvZLaHGTPEDFlxPIZ69fAEeI= X-MC-Unique: c_x6qspiPuWlaxwXr1cDbQ-1 X-Mimecast-MFC-AGG-ID: c_x6qspiPuWlaxwXr1cDbQ_1761672908 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672908; x=1762277708; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dJJwl93Eh9oixq1cw/+plHG+ew8tbgNiOl2RmOmLQvg=; b=SsTC/SSAQJGR+ME/H0VLhYu0sU0Gq55fxKfx/oPWVnev5J9uJjBtsksZ0oEiLkM1I1 xk/x1WM4YNHWE5gMXEvkoiN2d56lmRd0w9PjVM0huOYviQ4f9D57yZNXzxYw4pYA8l7H rIEzXgFXFdQ6HofhpDqQKorDrQuwf0Ah57FClZs7lTA/YmAqAYQS2+viAKPkUkB4ATUD YbkqotEwMknQW2QwnCSkH2/Bx0TiF4ak9ab1OWOco3gYB5FKzP2I+bzXX1VuuFqzNFvh RoyHFZgFOrApXG84x51pWboTGUOkhrUdmwVJCVatyVFVLO5N98CtOLwfQICktwMlHw2M UyGg== X-Gm-Message-State: AOJu0YyJfrAJFTAHnjn9CS/cr2Wzy9Q7WtpW02vMFLcyM3a28eAtMvUF eyCQFPzeYc/OYZ0prXzkqlDSHItGMyKK/fweFAB0+1JFl3sRdGyR1GE9Oij17iMI0JDhrRTnpjo RBCAFXVa24XJfuxWsuCIsEcK+2DhCOL3uzfIf6DDbfsh5qdVzF0zV75GYrcTR+uSrMVkiDfsPyU L4P31YIxc42PyMBivMcZMurbA+LY1VhXiPUfuTc1yC X-Gm-Gg: ASbGncuEQGCmIdem2Qz4YOq+1p6h3m7W9BgjdqIJ8ZZqrhrO1rQ7G9biUgmhI9uEQpz fRfv3UwAxfsho1DZOffb6iMeUQGdpjCFKAfOfzKIDLTY/yapqAtfswH5zC0BckgWi7+mD3xrS+M +v1gt76vWfavgv/HM8Yti/JxUzzmIpyjY0gO89u+oYJ5KBOZIbGfZH9AALxRA1pMjV2m2+KncKe oyZxcXhPuUBwqeMzU3hOx6mjCos9s3y0IwHuDIrGrfN8ALqR3bQJQ0IeIhL/PyIi0KqBfSMlZrD vvUEsyo338hSJMpVF1fBNJWPY73SMaerEhbpPGZDP2q3FBWJEjWN0hNYWrtT1U08dd5xlYvB19v PcBAlNz8yHpGAKQUG59Awvch9qCNtQ0Vg/H1eo557TztIdUGgRL+gPC9FVkCx15zCvTpDmViePs zDpmI= X-Received: by 2002:a05:600c:5197:b0:46e:2e93:589f with SMTP id 5b1f17b1804b1-4771e17ef8cmr2420455e9.14.1761672907614; Tue, 28 Oct 2025 10:35:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPkUU+dAv10MxRkRHfnhA0BtnY/MDOcbEVTYwfqdlHI4fPQinVEwWKurG9s7KIAA3VpwNZFQ== X-Received: by 2002:a05:600c:5197:b0:46e:2e93:589f with SMTP id 5b1f17b1804b1-4771e17ef8cmr2420215e9.14.1761672907106; Tue, 28 Oct 2025 10:35:07 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Zhao Liu Subject: [PULL 12/18] rust/qemu-macros: Convert bit value to u8 within #[property] Date: Tue, 28 Oct 2025 18:34:24 +0100 Message-ID: <20251028173430.2180057-13-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761673061024158500 Content-Type: text/plain; charset="utf-8" From: Zhao Liu For bit property, make the type conversion within the #[property] macro so that users do not need to handle the conversion. Suggested-by: Paolo Bonzini Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20251024041344.1389488-1-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini --- rust/hw/timer/hpet/src/device.rs | 2 +- rust/qemu-macros/src/lib.rs | 23 ++++++++++++++++++----- rust/qemu-macros/src/tests.rs | 15 ++++++++++++--- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/rust/hw/timer/hpet/src/device.rs b/rust/hw/timer/hpet/src/devi= ce.rs index 86638c07666..23f2eefd1cd 100644 --- a/rust/hw/timer/hpet/src/device.rs +++ b/rust/hw/timer/hpet/src/device.rs @@ -539,7 +539,7 @@ pub struct HPETState { // Internal state /// Capabilities that QEMU HPET supports. /// bit 0: MSI (or FSB) support. - #[property(rename =3D "msi", bit =3D HPET_FLAG_MSI_SUPPORT_SHIFT as u8= , default =3D false)] + #[property(rename =3D "msi", bit =3D HPET_FLAG_MSI_SUPPORT_SHIFT, defa= ult =3D false)] flags: u32, =20 /// Offset of main counter relative to qemu clock. diff --git a/rust/qemu-macros/src/lib.rs b/rust/qemu-macros/src/lib.rs index 50239f228be..ee417bb4b4e 100644 --- a/rust/qemu-macros/src/lib.rs +++ b/rust/qemu-macros/src/lib.rs @@ -262,12 +262,25 @@ macro_rules! str_to_c_str { }, )?; let field_ty =3D field.ty.clone(); - let qdev_prop =3D if bitnr.is_none() { - quote! { <#field_ty as ::hwcore::QDevProp>::BASE_INFO } + let (qdev_prop, bitval) =3D if let Some(bitval) =3D bitnr { + ( + quote! { <#field_ty as ::hwcore::QDevProp>::BIT_INFO }, + quote! { + { + const { + assert!(#bitval >=3D 0 && #bitval < #field_ty:= :BITS as _, + "bit number exceeds type bits range"); + } + #bitval as u8 + } + }, + ) } else { - quote! { <#field_ty as ::hwcore::QDevProp>::BIT_INFO } + ( + quote! { <#field_ty as ::hwcore::QDevProp>::BASE_INFO }, + quote! { 0 }, + ) }; - let bitnr =3D bitnr.unwrap_or(syn::Expr::Verbatim(quote! { 0 })); let set_default =3D defval.is_some(); let defval =3D defval.unwrap_or(syn::Expr::Verbatim(quote! { 0 })); properties_expanded.push(quote! { @@ -275,7 +288,7 @@ macro_rules! str_to_c_str { name: ::std::ffi::CStr::as_ptr(#prop_name), info: #qdev_prop, offset: ::core::mem::offset_of!(#name, #field_name) as isi= ze, - bitnr: #bitnr, + bitnr: #bitval, set_default: #set_default, defval: ::hwcore::bindings::Property__bindgen_ty_1 { u: #d= efval as u64 }, ..::common::Zeroable::ZERO diff --git a/rust/qemu-macros/src/tests.rs b/rust/qemu-macros/src/tests.rs index 65691412ff5..b65cf656fa3 100644 --- a/rust/qemu-macros/src/tests.rs +++ b/rust/qemu-macros/src/tests.rs @@ -179,7 +179,10 @@ unsafe impl ::hwcore::DevicePropertiesImpl for DummySt= ate { name: ::std::ffi::CStr::as_ptr(c"flags"), info: ::BIT_INFO, offset: ::core::mem::offset_of!(DummyState, flags)= as isize, - bitnr: 3, + bitnr : { + const { assert!(3 >=3D 0 && 3 < u32::BITS as _= , "bit number exceeds type bits range"); } + 3 as u8 + }, set_default: false, defval: ::hwcore::bindings::Property__bindgen_ty_1= { u: 0 as u64 }, ..::common::Zeroable::ZERO @@ -207,7 +210,10 @@ unsafe impl ::hwcore::DevicePropertiesImpl for DummySt= ate { name: ::std::ffi::CStr::as_ptr(c"flags"), info: ::BIT_INFO, offset: ::core::mem::offset_of!(DummyState, flags)= as isize, - bitnr: 3, + bitnr : { + const { assert!(3 >=3D 0 && 3 < u32::BITS as _= , "bit number exceeds type bits range"); } + 3 as u8 + }, set_default: true, defval: ::hwcore::bindings::Property__bindgen_ty_1= { u: true as u64 }, ..::common::Zeroable::ZERO @@ -235,7 +241,10 @@ unsafe impl ::hwcore::DevicePropertiesImpl for DummySt= ate { name: ::std::ffi::CStr::as_ptr(c"msi"), info: ::BIT_INFO, offset: ::core::mem::offset_of!(DummyState, flags)= as isize, - bitnr: 3, + bitnr : { + const { assert!(3 >=3D 0 && 3 < u64::BITS as _= , "bit number exceeds type bits range"); } + 3 as u8 + }, set_default: true, defval: ::hwcore::bindings::Property__bindgen_ty_1= { u: false as u64 }, ..::common::Zeroable::ZERO --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761673044; cv=none; d=zohomail.com; s=zohoarc; b=bGFzZMphwLv0aJiLfeTBoEP3ADsPJ1leOn9siQQP3szNLxv3AV7qsAPiz+uvNe/ueKI6eub8UEkEtX0JXvoOqNIv9oewKBIYWt4hIGJDSEyzgDK25jtddrYPyZaI1BSale2DK1Cf757xznCuPTrO2ZwPfrymAeNQ/DT7TYHKUq4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761673044; 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=E/r4/WhWamLiV42a70Dke9pt2v46dYWhx3stMUl9WaU=; b=cIeqCiFKJt8hhS6Y8t+AKlHsxVxwTIpD38/vIjumVfwpJ/nFlZTbRgVgNw2Ri2IlcoXDyXPhkmUz6/0pJL/VoC72CwMHBM/xGHz+EEA0l1GT0Cgy1ErflqiRFI1pTctg5b4tblTUPjcGh67mmv/azSrnh9nWNIb9GwiQqaJOTzs= 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 1761673044056468.55587537309657; Tue, 28 Oct 2025 10:37:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnbQ-0006Ie-IZ; Tue, 28 Oct 2025 13:35:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbO-0006H5-NJ for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbI-0004gY-FH for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:21 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-fZZk52f2PW2H4uVuUb4haA-1; Tue, 28 Oct 2025 13:35:13 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-475e89435e0so10638155e9.3 for ; Tue, 28 Oct 2025 10:35:12 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4771e3b9994sm1979945e9.16.2025.10.28.10.35.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:35:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672914; 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=E/r4/WhWamLiV42a70Dke9pt2v46dYWhx3stMUl9WaU=; b=baaU9XwpdHR4tkxscLldiJYATZyFaV6NW8ol2nJs9xWPhDD6QqLqlIsYw2STGUCZXLYbG8 0NnWhj1nkna0MUpFcQOoZR2WnFPj6/lMv15ZsxyBB4RCovHbVtqytdL6AJcur+qDtpSWmW nHbvbDYiyWnwwLoVFh4bl8MFxrbOBs8= X-MC-Unique: fZZk52f2PW2H4uVuUb4haA-1 X-Mimecast-MFC-AGG-ID: fZZk52f2PW2H4uVuUb4haA_1761672912 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672911; x=1762277711; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E/r4/WhWamLiV42a70Dke9pt2v46dYWhx3stMUl9WaU=; b=h7zG8V0lF1xoqQGi1/VegU8tT2kgTdtuaHJN82bpAbfcho2+RNJI7ccBXj4wa93uxI GJ4y18WTdVoNhf1BeIerWvlajC4hVW2631FCyFqc4g8A2SE2stuqEdHUL/dX2e404PPu XpwD8mSYeR2ZlPgpetCzueAcy1JayJL33HfOllAmo5kBY+39tX5oyTMv2tMegMKC6bsg +nrv8rEU028fL99huDqiJ2SRg8/GzcNchHPHgSgavNddW7/nFidRkqvrv3cjDwzY5x4q 3o1T73mlfSUIIwqfyqqH/1doqYhkgUAxa/LjMKrobaJVsVr2tqC4C4bjj5a9sxsRBcul E3rw== X-Gm-Message-State: AOJu0YwB+1fI43nwoBGupkQCqRVSbAiLHx0vMhawPcm5kbVb9LJaVe1V 16MRqmrPT/HceeiSRHZ2576fUQls/DuA3w8GYkmY9H0XDy4jUwWkWx2P5/NPgO0rBOPQj03guyq pMZnpf0djVPvzJ2IxfNGAvpCLRcMIvDdkAbhCJ3h5XvI/UdleqdLSX96sna94XG+mO/yd5zUJTm HnEiphfPaZ23bUGVbzkzj+IdruecicbKlISIqRvi5V X-Gm-Gg: ASbGncsNhOXifo+1hqPbpiGFtoFsHm9nXkufQVE9cJLUuHWOhEvYzPwLbwCmw14ursH Xy0o1onZYgtmTXSqq5fleAbi1Hm+mNeeYq8qDO+ecKV3KBeSrfKlqw9kdTxtuEdc05FeoUfW2OO RYDxZrX9LoCPt6KGWg5XsPXcIF81L0TJ33vy7xSU38u9Pr2VogWWikPkIrfwbKIXLwX31RtKDCi 00NjvXMoAG5K9RXGxHC7W1OECNZBGsLO2mLKP74/N5qMX0NaRO1HMfySmUhXwl/sL5uGXj9F3qV rGrWM4XgExF4q/5SNFeGlYXIVJs7sssc/6g9yYDB+PSKvzarXZivuy2c8XiAFdjp4j5a2svmRkO GQrTWQsRuB6ZiU03YsJ6sHDkeYaEPK4nBjhDj2uL7GwbuZMjd3Y0ClVt1Bg6Jsj7Wwz78xJyaYN 6Z/vI= X-Received: by 2002:a05:600c:620a:b0:477:bf0:b9da with SMTP id 5b1f17b1804b1-4771e1cac54mr2725825e9.19.1761672911401; Tue, 28 Oct 2025 10:35:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6laHfClOe2ffYNhva6Rk0eYXKnjczhODWpLWceuibr8QV4pMr7xhszGPluSwrYzJHGOExcQ== X-Received: by 2002:a05:600c:620a:b0:477:bf0:b9da with SMTP id 5b1f17b1804b1-4771e1cac54mr2725565e9.19.1761672910951; Tue, 28 Oct 2025 10:35:10 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 13/18] scsi: make SCSIRequest refcount atomic Date: Tue, 28 Oct 2025 18:34:25 +0100 Message-ID: <20251028173430.2180057-14-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761673046604154100 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-bus.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 9b12ee7f1c6..b9b115deedd 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -823,7 +823,6 @@ SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, S= CSIDevice *d, { SCSIRequest *req; SCSIBus *bus =3D scsi_bus_from_device(d); - BusState *qbus =3D BUS(bus); const int memset_off =3D offsetof(SCSIRequest, sense) + sizeof(req->sense); =20 @@ -838,8 +837,6 @@ SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, S= CSIDevice *d, req->status =3D -1; req->host_status =3D -1; req->ops =3D reqops; - object_ref(OBJECT(d)); - object_ref(OBJECT(qbus->parent)); notifier_list_init(&req->cancel_notifiers); =20 if (reqops->init_req) { @@ -1496,15 +1493,15 @@ void scsi_device_report_change(SCSIDevice *dev, SCS= ISense sense) =20 SCSIRequest *scsi_req_ref(SCSIRequest *req) { - assert(req->refcount > 0); - req->refcount++; + assert(qatomic_read(&req->refcount) > 0); + qatomic_inc(&req->refcount); return req; } =20 void scsi_req_unref(SCSIRequest *req) { - assert(req->refcount > 0); - if (--req->refcount =3D=3D 0) { + assert(qatomic_read(&req->refcount) > 0); + if (qatomic_fetch_dec(&req->refcount) =3D=3D 1) { BusState *qbus =3D req->dev->qdev.parent_bus; SCSIBus *bus =3D DO_UPCAST(SCSIBus, qbus, qbus); =20 @@ -1514,8 +1511,6 @@ void scsi_req_unref(SCSIRequest *req) if (req->ops->free_req) { req->ops->free_req(req); } - object_unref(OBJECT(req->dev)); - object_unref(OBJECT(qbus->parent)); g_free(req); } } --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761672986; cv=none; d=zohomail.com; s=zohoarc; b=YOnDWtvn702XO5eeGHq0Cz+xV4q2dDc7BSIGa2Z8VHJmWl78f31wugssiqX8pIOVsAk+CiYeMpyTK8yGoDz4sJW8nOsuoN7ugguaKY3Ptewo3HTNCQGJnlSpGOXwu/Jnyk4Fo0Emnr/mBZhwgWcOe2gQ98xYcDS2onNSHQwJ5IQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761672986; 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=1CJCXRRGP7uLhGWFgtNrE3fPS/hb7R8Y1xh7f9G0YyU=; b=MQMOE6RQ9yntzAevJpOEH5WX23RDOsVwKJbu7MW0roWH51uQ7PFhHbsPeeFxm2BsZV4xWLJYRY99FLeXuKaTOd3tUCmeIu38fol7kXUEsjrOsUs/8/7C0rOrFGmrDrhtjQOb4SR2cjQzBNu2tnjEL2GuOaUMVplHovHvDSQv5Ck= 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 1761672985994239.14955574408725; Tue, 28 Oct 2025 10:36:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnbk-0006Pd-5y; Tue, 28 Oct 2025 13:35:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbU-0006LX-PU for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbK-0004gy-FV for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:28 -0400 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-250-KoC2KdW9MNS_KwOW8rjGFg-1; Tue, 28 Oct 2025 13:35:15 -0400 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-475de1afec6so375785e9.1 for ; Tue, 28 Oct 2025 10:35:15 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4771e196a4bsm4168825e9.6.2025.10.28.10.35.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672917; 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=1CJCXRRGP7uLhGWFgtNrE3fPS/hb7R8Y1xh7f9G0YyU=; b=fjzxcmmHIKmR19U321SfHW+5cD1qBFdgQWCrum3Sxz1G3/HsJ10dHIorHTtv9icwzkmrQw DhSNzqkRSGpi9wXkYEMgf0/Qsu/Zv3nsNqsKrfAH5qcvZ11Q/qdUONttWyBshWOubVPEQ/ E0vQ1J9oAuqOyE/nBT2NzXJWpLZ0hSw= X-MC-Unique: KoC2KdW9MNS_KwOW8rjGFg-1 X-Mimecast-MFC-AGG-ID: KoC2KdW9MNS_KwOW8rjGFg_1761672915 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672914; x=1762277714; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1CJCXRRGP7uLhGWFgtNrE3fPS/hb7R8Y1xh7f9G0YyU=; b=Axb1nTV3HYznVgwslqtiz8ZMLWW6rUG91IV356r00DWn2Eq0/JA2PCutBB8Kv3xQjM RsweZkLiCtkkros+Ss+VrvMK02JW9N2jFe8q+LNp5dDXM2CnpW4wYzxV9kM1dt/TjEWl 9wK+WQsqfcCEAuzHABoEJjWtkXWkCUS/Sq05+QuEbf2eMWC5sTuuIlPvpi3fqf5HxS9a xTtked6cpqwX5qsew57Uo6ehhAJ9vxb7A80AmdRESTyErusJ5ythLtoO5BVB+e6QiKKW WFU6rMUHOk4PmE+MO7divym63h9DldIcOIAFY+Qyl3Js/FdqLbKEmufpRVU53Cn25C/r oGdg== X-Gm-Message-State: AOJu0YzCCGDq1r8TbzITQ+bsI7bti37I0USCuZ6SzH25HQcib/ZDZLQ5 1f3cKI7UA8xRfTQDgveJUQmpn0+HuDydRjup8FiFTWqdGMOAC8NZ2RLkvVMMedvPGFZtCSwayTU 4lU/+/UJhKgbt6qi7WJ5G5YzYBP25eNzKwq9eYgzNFmHKsklphB2Sdrte08F55gRSnCU3ssexT5 lVTrurHElf6WpLzlyoSZBz4cylgg4R4agpq1g2u+KU X-Gm-Gg: ASbGncvVt5vKeY3CFZr3hbZlsZnsTkBx89Ne/wPUbyct8Q0F1gUSf/KJ4//T6nOArGv IItAsM86H7WkGKn7brivwr0k/qA68Z2YD558mhgzHhI/zGvpbeCWqHcEh9Z4IEu/LSlotdSrC9x fNmVa2956HT7eMXrVtRQ2i5qK4HH+GKaPzrP+MtA22HypZ2nAtQOldKEUpDp7ykLLMNqJTgEgxB +/9rRXa6Em1HfzhkkpZg/BZ0HvKovsFKc1cg8m1TL/ene+H1KIhdi2rPv9P92A2Ud4VfImIkBYK 3zNXDHwYsvpB1mAdvtgVSXlL/2+Tjey//0J53WqWsOAn3Rj6TJ+BB/gP3PW7hDmHUHnSUQjE+5g 4fsn6SIqi0dysvuda8E6WlILe5wuafcLXLg2/8Q9w2fcdlRp5oukdPGE9dFRuzzGD+DlhUkQyFS NxPRs= X-Received: by 2002:a05:600c:a219:b0:477:115b:878d with SMTP id 5b1f17b1804b1-477181969damr21247395e9.15.1761672913648; Tue, 28 Oct 2025 10:35:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGe0BE3U50MxF4FLfVJUMMLlt3GnwC3c3MfG7x6VEJk3X2q5qIjKpngq3HtLGx09mqr+GrBNg== X-Received: by 2002:a05:600c:a219:b0:477:115b:878d with SMTP id 5b1f17b1804b1-477181969damr21247135e9.15.1761672913106; Tue, 28 Oct 2025 10:35:13 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 14/18] qdev: Change PropertyInfo method print() to return malloc'ed string Date: Tue, 28 Oct 2025 18:34:26 +0100 Message-ID: <20251028173430.2180057-15-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761672996181158500 From: Markus Armbruster Simpler (more so after the next commit), and no risk of truncation because the caller's buffer is too small. Performance doesn't matter; the method is only used for "info qdev". Signed-off-by: Markus Armbruster Link: https://lore.kernel.org/r/20251022101420.36059-2-armbru@redhat.com Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- include/hw/qdev-properties.h | 2 +- hw/core/qdev-properties-system.c | 7 +++---- hw/core/qdev-properties.c | 9 ++++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 0197aa4995e..60b81330097 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -34,7 +34,7 @@ struct PropertyInfo { const char *description; const QEnumLookup *enum_table; bool realized_set_allowed; /* allow setting property on realized devic= e */ - int (*print)(Object *obj, const Property *prop, char *dest, size_t len= ); + char *(*print)(Object *obj, const Property *prop); void (*set_default_value)(ObjectProperty *op, const Property *prop); ObjectProperty *(*create)(ObjectClass *oc, const char *name, const Property *prop); diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index c15371f8cd1..13cc91680b1 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -865,15 +865,14 @@ out: visit_end_alternate(v, (void **) &alt); } =20 -static int print_pci_devfn(Object *obj, const Property *prop, char *dest, - size_t len) +static char *print_pci_devfn(Object *obj, const Property *prop) { int32_t *ptr =3D object_field_prop_ptr(obj, prop); =20 if (*ptr =3D=3D -1) { - return snprintf(dest, len, ""); + return g_strdup(""); } else { - return snprintf(dest, len, "%02x.%x", *ptr >> 3, *ptr & 7); + return g_strdup_printf("%02x.%x", *ptr >> 3, *ptr & 7); } } =20 diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index b7e8a89ba5c..422a486969c 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1117,12 +1117,11 @@ static void qdev_get_legacy_property(Object *obj, V= isitor *v, Error **errp) { const Property *prop =3D opaque; + char *s; =20 - char buffer[1024]; - char *ptr =3D buffer; - - prop->info->print(obj, prop, buffer, sizeof(buffer)); - visit_type_str(v, name, &ptr, errp); + s =3D prop->info->print(obj, prop); + visit_type_str(v, name, &s, errp); + g_free(s); } =20 /** --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761673105; cv=none; d=zohomail.com; s=zohoarc; b=VIVoKpJ4O0kIXQvAFBnS3BgHrJJ5ctC/Z34gfhjX6EV0B3zBG/n3hoiom8o2iggus03A9WvBFsKkguEIZaD28xDquhUfUuIHUklzb8zJbPOre9se4jF8yjHbbtRM/t8tbJkUq/29oEtVaNTSHUjB3M786cGZDiI4VbPFYsJUuV4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761673105; 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=eLhLVJ2XarzKVk+Slx8EqzVV2n5CC0vk3GBdbky8+bk=; b=O1ufAQ53xd+z5poqu+8II9pWzC6xLgy89/B1sBCoWMJV3byHn7BmPZzPuVnTpgPauP+v8vVbj/Ph2kMPMsgWfsxYHU5lZTnCO4fopJAwhCA8ps8BgTMQn1J2/uUbtkWSKixdm0jRLJUT8diDSFaezlGnSffTKYoDjGjlbF/EF4w= 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 176167310554375.12258488913164; Tue, 28 Oct 2025 10:38:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnbt-0006Ws-Ki; Tue, 28 Oct 2025 13:35:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbW-0006Oo-Og for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbP-0004hx-Tj for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:30 -0400 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-546-bC7CMogrOjei_uKmrT1kSQ-1; Tue, 28 Oct 2025 13:35:20 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-475c422fd70so50648885e9.2 for ; Tue, 28 Oct 2025 10:35:20 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429952df473sm21505827f8f.42.2025.10.28.10.35.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:35:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672922; 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=eLhLVJ2XarzKVk+Slx8EqzVV2n5CC0vk3GBdbky8+bk=; b=YbF7G3QQzntxJwTEiMLAuFM8CuZTdHvLPX9Mr3LVqxmWRuKwLFhWIP9HvbiZ6rpnFjYxQG HkcG3NizHBVceX87W8bK7iv8S/Cfj1/fP/BHw4xftAxk0OFtN/nt2LOyknd+H1Qzomam3v nKsIzQcuSxPH/SltghMjbiLaiVZ1eOY= X-MC-Unique: bC7CMogrOjei_uKmrT1kSQ-1 X-Mimecast-MFC-AGG-ID: bC7CMogrOjei_uKmrT1kSQ_1761672919 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672919; x=1762277719; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eLhLVJ2XarzKVk+Slx8EqzVV2n5CC0vk3GBdbky8+bk=; b=he+/+zpwFlKe+YIbKTltQCSJlzQyxRW/CuZUYgLNnHEM90Ty2SWPtueuqtPiRbSJRx Xb0IRepVp/oyImGllFdRf9VGB+vyQbiL2640XrQhCwMzHfWrcovQquWneA6s0ygMR9Pa GJDzp26cmWRvLjyE7FmrTtvh6QYfQDVrpNWz1wYFdDGd0pEFySlny+NZsnH3b4T4WOCD S/z+o/9+rYULFfUmu1H8H5ACdMs5SulS9tbzJ+MYHBLM2pntokwXBInoPTIeqsOdQZ5C 0w8BQyWie7t5/K3dpZfQzlMiwK9VjhXMrchJhNxZ/1VUMqM5ldPwLRUexP3DVrBX2ru/ o0IQ== X-Gm-Message-State: AOJu0YyjmKphXWCEy8ExJyD2FHAhJIlN+WQhLr4sDLzCzzphB2U1xXOQ Gb30OZXHNq3ryikJ0pya7IM9RclsbP14idBECxoImxI13kDFRWgFlrlcohuHtHMz7I/XxgxEQUL Uc9rsO272QFG559qDD7SfapwWITb9vwhAgEllvTZJ50pwC4F9DWqtKEQxbdOs+SagCRDiWpeqXx WjP46hrJ0TtK6PgzkV+h82kkol312eABrI44xV/LA0 X-Gm-Gg: ASbGnctAwKY7uujId+CVV8IZ7lYul6cBGv86gvyioQ2RZWqY7ZS4Ej1YVVSA2cKrXQM k/+XwcJ0VqEXYk4c/i4pmKuZa4cAQks77hiPYWaRnE21nJkCn770TFPtSAoPORuX830m0Bfan1q H02h7sRqg0n4XSKOCGx1FI/qITm16Y6wOF8IIEby0yOPJ+NRvWWvAwn7m0PP2lY0OY2uI+L9f5s /3ojF+BYTYOunfsexBGN4rjDFOEWAexIs71blMgNBSe6sLpDmnJ+W7E1msgVljgOsIOxxCV69iC dhIBE5Nij4GgXFZmBPK+BLyEgs/iESwq/Z0RZ4csJ0rOtkF5jxF1jjjd2mut6YwBUiejhiATEut lLREIhP5NGloD9bWCswty7DScDsiNhINf1wOUYOncw6kLceEp2CnAh5RW8bRfgDmBjxb7lqLugf vwN94= X-Received: by 2002:a05:6000:1786:b0:426:fb28:7962 with SMTP id ffacd0b85a97d-429a7e86fdfmr4110812f8f.61.1761672918516; Tue, 28 Oct 2025 10:35:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYISxoFXRWT4CSQFkij0/JYLnvkQ9ZHEUxIVRSWMIjdtVxfJZ2pB4Kvct1JEbXqJvyYeHsRg== X-Received: by 2002:a05:6000:1786:b0:426:fb28:7962 with SMTP id ffacd0b85a97d-429a7e86fdfmr4110553f8f.61.1761672916739; Tue, 28 Oct 2025 10:35:16 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 15/18] hw/i386/isapc.c: warn rather than reject modern x86 CPU models Date: Tue, 28 Oct 2025 18:34:27 +0100 Message-ID: <20251028173430.2180057-16-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761673111659158502 From: Mark Cave-Ayland Commit e1e2909f8e ("hw/i386/pc_piix.c: restrict isapc machine to 32-bit CPU= s") restricted the isapc machine to 32-bit CPUs, but subsequent concern has been expressed as to the effect this could have on users. The outcome of the latest discussion is that we should exercise more caution and follow the official deprecation route, so instead of rejecting modern x= 86 CPUs issue a deprecation warning but allow the user to continue. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/r/20251023142926.964718-2-mark.caveayland@nut= anix.com Signed-off-by: Paolo Bonzini --- hw/i386/isapc.c | 55 ++++++++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/hw/i386/isapc.c b/hw/i386/isapc.c index 44f4a446724..1ba9ae22cc3 100644 --- a/hw/i386/isapc.c +++ b/hw/i386/isapc.c @@ -41,29 +41,31 @@ static void pc_init_isa(MachineState *machine) DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; int i; =20 - /* - * There is a small chance that someone unintentionally passes "-cpu m= ax" - * for the isapc machine, which will provide a much more modern 32-bit - * CPU than would be expected for an ISA-era PC. If the "max" cpu type= has - * been specified, choose the "best" 32-bit cpu possible which we cons= ider - * be the pentium3 (deliberately choosing an Intel CPU given that the - * default 486 CPU for the isapc machine is also an Intel CPU). - */ - if (!strcmp(machine->cpu_type, X86_CPU_TYPE_NAME("max"))) { - machine->cpu_type =3D X86_CPU_TYPE_NAME("pentium3"); - warn_report("-cpu max is invalid for isapc machine, using pentium3= "); - } + bool valid_cpu_type =3D false; + static const char * const valid_cpu_types[] =3D { + X86_CPU_TYPE_NAME("486"), + X86_CPU_TYPE_NAME("athlon"), + X86_CPU_TYPE_NAME("kvm32"), + X86_CPU_TYPE_NAME("pentium"), + X86_CPU_TYPE_NAME("pentium2"), + X86_CPU_TYPE_NAME("pentium3"), + X86_CPU_TYPE_NAME("qemu32"), + }; =20 /* - * Similarly if someone unintentionally passes "-cpu host" for the isa= pc - * machine then display a warning and also switch to the "best" 32-bit - * cpu possible which we consider to be the pentium3. This is because = any - * host CPU will already be modern than this, but it also ensures any - * newer CPU flags/features are filtered out for older guests. + * The isapc machine is supposed to represent a legacy ISA-only PC wit= h a + * 32-bit processor. For historical reasons the machine can still acce= pt + * almost any valid processor, but this is now deprecated in 10.2. Emit + * a warning if anyone tries to use a deprecated CPU. */ - if (!strcmp(machine->cpu_type, X86_CPU_TYPE_NAME("host"))) { - machine->cpu_type =3D X86_CPU_TYPE_NAME("pentium3"); - warn_report("-cpu host is invalid for isapc machine, using pentium= 3"); + for (i =3D 0; i < ARRAY_SIZE(valid_cpu_types); i++) { + if (!strcmp(machine->cpu_type, valid_cpu_types[i])) { + valid_cpu_type =3D true; + } + } + + if (!valid_cpu_type) { + warn_report("cpu type %s is deprecated for isapc machine", machine= ->cpu_type); } =20 if (machine->ram_size > 3.5 * GiB) { @@ -154,18 +156,6 @@ static void pc_init_isa(MachineState *machine) =20 static void isapc_machine_options(MachineClass *m) { - static const char * const valid_cpu_types[] =3D { - X86_CPU_TYPE_NAME("486"), - X86_CPU_TYPE_NAME("athlon"), - X86_CPU_TYPE_NAME("kvm32"), - X86_CPU_TYPE_NAME("pentium"), - X86_CPU_TYPE_NAME("pentium2"), - X86_CPU_TYPE_NAME("pentium3"), - X86_CPU_TYPE_NAME("qemu32"), - X86_CPU_TYPE_NAME("max"), - X86_CPU_TYPE_NAME("host"), - NULL - }; PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); =20 m->desc =3D "ISA-only PC"; @@ -180,7 +170,6 @@ static void isapc_machine_options(MachineClass *m) pcmc->has_reserved_memory =3D false; m->default_nic =3D "ne2k_isa"; m->default_cpu_type =3D X86_CPU_TYPE_NAME("486"); - m->valid_cpu_types =3D valid_cpu_types; m->no_floppy =3D !module_object_class_by_name(TYPE_ISA_FDC); m->no_parallel =3D !module_object_class_by_name(TYPE_ISA_PARALLEL); } --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761673085; cv=none; d=zohomail.com; s=zohoarc; b=I613pnJvDsnSmFBmw6LkeO0/afpzlaiL1SkAqscnuQ4rpq0u2FA8881WzGWFNDrLDB5j1eCwX097mLsjhHv/MzrfTkExWw2lauwIMLyY3Q1moK3dPOrDbw3fsUSou8FM3d+VQ2YDJW1jTHMFt9qnkRDFg/yVxYImflZMqEE8Gqs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761673085; 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=vckpxkN+2zf9nWzTVhWzyRLceLbltJfnKA80OjaV7BM=; b=D8O/zPCyTtQMxAf3bhhyRlmPmqwyZf0cRZo4Q+/MRvfYlM0rmftccREo5NegFX0BIYu1O+FHqTKdRkZjdRHX1S/juB0NyZVnGU+8zitqrYjUGbfAsdcqq25nEz45tB4Iyll/+JDjzqxs3JdUE85csfqSCJfflejErUMHTxFceQ8= 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 17616730852625.374576102688593; Tue, 28 Oct 2025 10:38:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnbt-0006Wc-CM; Tue, 28 Oct 2025 13:35:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbY-0006PH-0f for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbS-0004iL-0o for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:31 -0400 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-642-4uFWKARoNTe802k6FG2ikQ-1; Tue, 28 Oct 2025 13:35:23 -0400 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-40fd1b17d2bso4002105f8f.1 for ; Tue, 28 Oct 2025 10:35:23 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429952db80fsm21063326f8f.31.2025.10.28.10.35.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672924; 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=vckpxkN+2zf9nWzTVhWzyRLceLbltJfnKA80OjaV7BM=; b=R8+sbI3M7Q42Fjhak2tzFQ9CDfLXtKud5wsb2YsOl5haQDG2cdElXwMG5RGW75ruGp15XO kS1Y0+ItBQLilD4IyCKyH6gBZwoca8s96OPUDxdiCSynEAKVnIlzXaSvEiRVdMW+Nj+DBj Adl0TveaTY4GyAhkPRxtENgHYyYp+XY= X-MC-Unique: 4uFWKARoNTe802k6FG2ikQ-1 X-Mimecast-MFC-AGG-ID: 4uFWKARoNTe802k6FG2ikQ_1761672922 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672921; x=1762277721; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vckpxkN+2zf9nWzTVhWzyRLceLbltJfnKA80OjaV7BM=; b=sAHWvj7NVy5dVMSsTlGs8vJlQ9Cnrxj5fzws3gDkQfIkGlunqhzA3yMtnMLznhOXsc QrtuamqZcH1vmMKC5IwZVcVfhrGOrecucCjPa0UoTXb1m1UVtOdcrjWOxSYqqZo1cm7i DoxulxGM1nKKLE2kapcMYvOu0+JVksrpJ9MTAWuy6Iqj4xWsNUcACEmNqdALGFzByTTs pOosC1pspLgWCN2+rl44LEO5sgD1dk4ldo1dzgBEn0ZHiMYxqgVxXwSzPRAkVlv9gAWl Zzdvn87EiWjUsdDlHNewJMkAyku0PIwSanBRM1G09wrUFuez4Yl9sAMsXLXCfDi18QQ4 BWdw== X-Gm-Message-State: AOJu0YxVPLfgodFZD9z3Nmp1b1WEjIKx6OY6xNS+QthYjtcwFbPCV6a5 /SK6O46xDfMPkwwunwpzpcVztD6SHTIasdfrF5P4fm+u5RPGiaW9IoBXqGN1k3ooWsEv0ZY5png dC+MaRjGT+tP9C+N4zx0KYRY5sLrWAig9tiZYf5m9mfZfG5Lpz6g4YoszJGcQUmAlkOYWD2Y/u5 y6aJMSmYoScYLZpftuW9kYAChNZM9TJftYQZ3X1YLS X-Gm-Gg: ASbGnctcFD5r+w8RNznhjwtigEY1YbKsVplZ2Z82b91fRncDAcK1G0HEu7TVgnKc7qw GcSlP1Z1EnwpQQ6Rgmt3a7KouSUGtsHHxILWCd+yODu9MpHuuVsAMC4Qms5Zhq/3ETMMFDFQtMU l8GO1HYzjdl6haixwjBlfK/HZRwkTbEiC3C/2KBqcW79nOsFeIYgozDKHEC0VTpQa/TFB7/4CTI NHFOTiiOq/65k3wo/rE8RY3vjbF2qXuoZNKZbe8gPxCAFJPkytEN5+H3MC7+eDgRV8owzNEwuuY RNhch0pZ2yjThg+19dm8fONCKGa/9Snur9zvtA1HyZhCCyHyX9sjuwHfaXSii5XSCbaJ6CdgDEH xUXfRmUrN2TWs/8myoNphATe0b3Q8hL6eVWtYVOa1wRTNjpvMeEo77l2HK9x4wk0qQdN7yod/Qs diL3k= X-Received: by 2002:a05:6000:40d9:b0:427:665:e37f with SMTP id ffacd0b85a97d-429a7e36fe9mr3264917f8f.4.1761672921248; Tue, 28 Oct 2025 10:35:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGuJV/fNDosLI+4kYLXYP/ZE26uMxFED1RZQ5mPP8w5izpO32yraFWNs2YnuN089f4CjQU2+w== X-Received: by 2002:a05:6000:40d9:b0:427:665:e37f with SMTP id ffacd0b85a97d-429a7e36fe9mr3264897f8f.4.1761672920804; Tue, 28 Oct 2025 10:35:20 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 16/18] docs/about/deprecated.rst: document isapc deprecation for modern x86 CPU models Date: Tue, 28 Oct 2025 18:34:28 +0100 Message-ID: <20251028173430.2180057-17-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761673091374158500 From: Mark Cave-Ayland Add a new paragraph in the "Backwards compatibility" section documenting th= at using modern x86 CPU models with the isapc machine is deprecated, and will = be rejected in a future release. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/r/20251023142926.964718-3-mark.caveayland@nut= anix.com Signed-off-by: Paolo Bonzini --- docs/about/deprecated.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index dacf2882e44..020610132ff 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -544,6 +544,20 @@ available firmwares that are using the current (wrong)= name. The property is kept as is in 9.1, together with "riscv,delegation", to give more time for firmware developers to change their code. =20 +x86 "isapc" board use of modern x86 CPUs (since 10.2) +''''''''''''''''''''''''''''''''''''''''''''''''''''' + +The "isapc" board represents a historical x86 ISA PC and is intended for +older 32-bit x86 CPU models, defaulting to a 486 CPU model. Previously it +was possible (but non-sensical) to specify a more modern x86 CPU, including +``-cpu host`` or ``-cpu max`` even if the features were incompatible with = many +of the intended guest OSs. + +If the user requests a modern x86 CPU model (i.e. not one of ``486``, +``athlon``, ``kvm32``, ``pentium``, ``pentium2``, ``pentium3``or ``qemu32`= `) +a warning will be displayed until a future QEMU version when such CPUs will +be rejected. + Migration --------- =20 --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761673002; cv=none; d=zohomail.com; s=zohoarc; b=gp5aaDPEnT8a3FrBe/PrAfG0cy5C1W+vvddlJhb75I6rhmw79CvXBF15p3NJSYI2d9CtEx0Mvf86V2L0jDraSisN2givR1rj11sHyj4c1n7O1Y96e9JCDi25JQjkeFa8gDQY98itZanFAbO1Zo3uF+i9Bgzo3FFf9cVws4RHuYE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761673002; 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=JvVLcmN1GqwqMn3Ji8GB67JXuPEUaQwDOot0qHP2ciM=; b=cG2Me+Y9+eyCPt34YnbFDvGNZT0XFwVgr7+gvaTNxyg5FOTyRHO7I2h4OKmiqTQCKvZFUlIRZL1r+UhVX7j5r2h0QsDKUEBjSHsXPLrm2QI1rykP72pMUlTmLSwluckUOzWZJbo1cb9GTzbdQmAltpJd9FXUilwDBWe6tNMkbQs= 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 1761673002943862.0632417067272; Tue, 28 Oct 2025 10:36:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnc1-0006ak-CE; Tue, 28 Oct 2025 13:36:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbf-0006Qf-CB for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbW-0004iu-3q for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:38 -0400 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-625-N4rvixHENZ2THnlU46YcEw-1; Tue, 28 Oct 2025 13:35:25 -0400 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-471168953bdso1276165e9.1 for ; Tue, 28 Oct 2025 10:35:25 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4771e202093sm3555785e9.11.2025.10.28.10.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:35:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672928; 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=JvVLcmN1GqwqMn3Ji8GB67JXuPEUaQwDOot0qHP2ciM=; b=Zn4K+8dCzTZ/Sd4UHUkHvkGE4sm6h25l5SGuNfS+lszTBbB0chZdpdPFRLSNMxhCFTrJJN M/YA85R4eK23dIAp09GuaVUc5EeSr66OEMzxsMSMaqu59tFSPGHTmwc6MvGXQNs0ZpIhKt RL0V9lYaLWLvlEZFQIhZaJILP/7VjZs= X-MC-Unique: N4rvixHENZ2THnlU46YcEw-1 X-Mimecast-MFC-AGG-ID: N4rvixHENZ2THnlU46YcEw_1761672924 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672924; x=1762277724; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JvVLcmN1GqwqMn3Ji8GB67JXuPEUaQwDOot0qHP2ciM=; b=MUJ/MrlCBmJZV9bjNJ4FLXx7bZQKb3SER0ZEGKBAkRY6sFPz+v7JNkRyTO+BE7Itvn Ip/BEB906sZae23o1+PB5wwgk2Wkmj5KzYrMqihYoQ693w9wUIeb6KGJJ95Nf6+V+IRZ TG6aJQVrWtxfJQji1D/wHxq9PWrLp+BpQ0A/kTGP+ju9m9w61bsmPGPCVEu1HEAVHnIp FCigRqo7BZZygWwmpkwegCD/lID+rQ0t1T7w80YIGtC55Tna/BiElzDzvgmWmBfoKFIY 8bJFpBGd7kqV6ARSsYu1VOdJNk6wnOSI7W6tHdAH/jyp20thwuf4uEQ9O/wjrw3Fo96I DgiA== X-Gm-Message-State: AOJu0YzdL9+hOKyU6foE5HvuVyRo7KkG96iPHGf2QgqT3PSR2x9pxy57 Cr2TH4JLdXiwmeN8hLZv2CkTzhNMJwTgl8kcM1MGSTxMMB1WXhW/mOVnae22lMZFZcc92Xfj29q HdcnWumhSlhhe0WVPtBhXqlOY+99Ko37sQabOzUGGObnGXMMJeu9Pvg8m+SX4AsLzKc4uyWCHjb X+Rg8IAvDJxNmI4CCAQlTMUT/+xgFm/t6C52uHZEgv X-Gm-Gg: ASbGncsy9H8Qb7pmLPfGzC2YjmyHFZr2i8mOidcjMVPMdUQ45yMctz3y2USKWNYhis1 MPMD0s5INFKyE5021SqTO99Lj0JKVWyaSV/asg0O56If2H/SljOEwgJVWyONX6X6zx4vvrgAT4l 6O9zB/S63tVDDfuBxqxeh8Q28KF4hKOOAIS9DLg9QFhBZf+2bUyM9Ls39C0zluf9FaMEjnO1VCj somaTnX3doZOpc7zfaHxaIEXLmh6RDck08ZvrnNtjd2TbVw+UZZj9ZyFh7m7JmH/KqIOAp6hpUd JUrhClQAD833H+6Xaq617+wu5+0jmC3dOqgrezzSrnHJlOHea5/7B/N8csiNmlObatBjGekNuYM vdRRjpPEBqsI0kPnC2Gf9W1Sc3IVjnCoI0diIonypxDpgrLGdbf2DTffQSV2/hej4IHCpq44qyR nPrUw= X-Received: by 2002:a05:600c:46d0:b0:471:665:e688 with SMTP id 5b1f17b1804b1-4771e68ff23mr470865e9.17.1761672923695; Tue, 28 Oct 2025 10:35:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEg3dJnndn9MLNODg5OH4lLFWo9eGfh77ZhdB2PVGRU3eRKhfdYb3afomVEo1Xod4ovsniKgg== X-Received: by 2002:a05:600c:46d0:b0:471:665:e688 with SMTP id 5b1f17b1804b1-4771e68ff23mr470565e9.17.1761672923249; Tue, 28 Oct 2025 10:35:23 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org Subject: [PULL 17/18] target/i386: clear CPU_INTERRUPT_SIPI for all accelerators Date: Tue, 28 Oct 2025 18:34:29 +0100 Message-ID: <20251028173430.2180057-18-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761673004295158500 Content-Type: text/plain; charset="utf-8" Similar to what commit df32e5c5 did for TCG; fixes boot with multiple processors on WHPX and probably more accelerators Fixes: df32e5c568c ("i386/cpu: Prevent delivering SIPI during SMM in TCG mo= de", 2025-10-14) Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3178 Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini --- target/i386/hvf/x86hvf.c | 1 + target/i386/kvm/kvm.c | 1 + target/i386/nvmm/nvmm-all.c | 1 + target/i386/whpx/whpx-all.c | 1 + 4 files changed, 4 insertions(+) diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index a502437c303..3838c9f5a6f 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -446,6 +446,7 @@ int hvf_process_events(CPUState *cs) cs->halted =3D 0; } if (cpu_test_interrupt(cs, CPU_INTERRUPT_SIPI)) { + cpu_reset_interrupt(cs, CPU_INTERRUPT_SIPI); cpu_synchronize_state(cs); do_cpu_sipi(cpu); } diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 4dea1ed8f0f..60c79811382 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -5659,6 +5659,7 @@ int kvm_arch_process_async_events(CPUState *cs) cs->halted =3D 0; } if (cpu_test_interrupt(cs, CPU_INTERRUPT_SIPI)) { + cpu_reset_interrupt(cs, CPU_INTERRUPT_SIPI); kvm_cpu_synchronize_state(cs); do_cpu_sipi(cpu); } diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c index 2e442baf4b7..b9bd9ed985a 100644 --- a/target/i386/nvmm/nvmm-all.c +++ b/target/i386/nvmm/nvmm-all.c @@ -709,6 +709,7 @@ nvmm_vcpu_loop(CPUState *cpu) cpu->halted =3D false; } if (cpu_test_interrupt(cpu, CPU_INTERRUPT_SIPI)) { + cpu_reset_interrupt(cpu, CPU_INTERRUPT_SIPI); nvmm_cpu_synchronize_state(cpu); do_cpu_sipi(x86_cpu); } diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 256761834c9..6bf8d5f4bbb 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1621,6 +1621,7 @@ static void whpx_vcpu_process_async_events(CPUState *= cpu) } =20 if (cpu_test_interrupt(cpu, CPU_INTERRUPT_SIPI)) { + cpu_reset_interrupt(cpu, CPU_INTERRUPT_SIPI); whpx_cpu_synchronize_state(cpu); do_cpu_sipi(x86_cpu); } --=20 2.51.1 From nobody Fri Nov 14 18:20:09 2025 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=1761672965; cv=none; d=zohomail.com; s=zohoarc; b=X6FmVbGR4ikYoUfC6Xg+9HM5gzhdNXsATb/pYbzyzhLI3Cp6TCvn885OugtNX3W0d0E0YoXrJA26AqnPSBvHfh8XsSVv4hbwaP1z1EHc9VgBcfhF+SEUI6lZ/6f1HxYl9JJk5irkepIWc+xEAdumf/YwSRACeBN9rW1hn3R6le8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761672965; 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=a574bfKXPLraHbw9jj5peIvYFBrcTFaJN0NoFwezcZA=; b=RgV2F2i1anIeHhtks31a36GVmtu+2T/TaSKX4iroWPiU4ULM59O0UQoV293ujGtOVSqGR9Jjs6QSUi9sARGwyK8eac5mRGSAKAtiaRdWKe2rzrA4Vo3JyclkBZntUGQIfFhN4+2wnCD6sZDvcGrk6l15PcGh2E83/qi5YJcjhQM= 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 1761672965269677.4411819957477; Tue, 28 Oct 2025 10:36:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnbw-0006a4-8m; Tue, 28 Oct 2025 13:35:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbc-0006QV-Fp for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbZ-0004jM-0d for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:36 -0400 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-373-nzvv6ZSXM--4k-6Gt1sIjA-1; Tue, 28 Oct 2025 13:35:29 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4710d174c31so57781205e9.0 for ; Tue, 28 Oct 2025 10:35:29 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4771e3b68fesm2201735e9.13.2025.10.28.10.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672931; 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=a574bfKXPLraHbw9jj5peIvYFBrcTFaJN0NoFwezcZA=; b=i1WyCTufu0I+kJ0B2QZmH7tOgjz4KyMBseQXe4DE4CT5Sknpe4AJUcuA8y0tN+XTR2oqe2 g0XCPM3vJeDChovUHJgXyeKBbMlV2lscJwOHBUWYBynLJyDO2oqhAXZxY4nz5mEN+3qaQN +FzE5USgoDx4a8Uo6iCqEFz39xv+GDo= X-MC-Unique: nzvv6ZSXM--4k-6Gt1sIjA-1 X-Mimecast-MFC-AGG-ID: nzvv6ZSXM--4k-6Gt1sIjA_1761672928 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672928; x=1762277728; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a574bfKXPLraHbw9jj5peIvYFBrcTFaJN0NoFwezcZA=; b=sAARNm0f/3wEKM/5JU8eMOgK9wEaNJfI7+iC+R7Q+HKf1o5rXHKRxSGx1dtuUM3K97 xQUlRRJn8ON7I2tW2Lqx6CqZizD1YjrEP6+Xr10z3dI3a7mNsDWHEApurvDyS1WCJbsS 7rp1N6mgB5JD7so3f+PDgxoqxruqHW/pYDNNc490NJIvp1RkfmxwL53vRnO3bT0AF9jP r5ohYIYSE0fovctgAejjW0x3WuuM9PW+yUaH8mAJddc4i2eh02cLyO339GvzvnvpS+Yt uzS9Z1kAb5nMiKvbFIYeq+8GkCp3OuB1IjIfto37to0l1dOBUnQh5MbP5+ED54p2dbs+ ydzw== X-Gm-Message-State: AOJu0Yw/7yrmMOPQrkzVcZsoNScvPbQ7B9QX4OKAznB5XVKyxqCMDpQA GgIp+fBngxGXtGAAn0BHM82wgbcuTUllzXYOs+7CMknyCtUguFWEtmC1g9QHvhD5IsENrrMYAiC qspvw407hErrBKfYu1qcTn+hyDjWTEDcDi8Og+daV1i8h3P9TUubIia+Dx/HFaTJRTMf8bW4ch5 JUt2cwIXnIV2DFP/8y8KGDXeoP+9M4cXksAkMG8F9K X-Gm-Gg: ASbGnctQRMDEng5Od0dk/6B7pWZb5AgjZsVRvoA4VjHyOFaOsuwNO8+n0UGC/Z5Lffw 8XuaCd4x432IPDADX1kI+7hU7T39w0po6BhAwBsCyt9Jd17IqaMTD4ZeqBHDmDINr+PuOwBpRbF mVUvFGV0CzegJkbv90crXtUC1gMAJ6sU8WVa4WaFxUX4qVcFhKADDx36Cf7lNbv4vu4bWJF5Lye w0B8jncSIeIGIUcBOqbzYshy9iCGaLPqvaSDZaFejFPaL69q9wI0wniL0bpzdQVO53AKNVjbKz6 0qsji5KAM+Ku80l7UXrt/UQRlH1vPdTcIwlKQw95g38n7g5So1+BoZSnQJERAqTFBP4DXm41ymx RLZQ81ab7OprxZ1jTk1Wb2wm18MLenssCWeU8D6aIyT0JttDqkJdaeMTnGevt7QcO5jKquMhCEa gOWTk= X-Received: by 2002:a05:600d:8381:b0:477:f2c:2923 with SMTP id 5b1f17b1804b1-4771e56e32emr536425e9.30.1761672927940; Tue, 28 Oct 2025 10:35:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZnNqbPfLo6BNj/Nj51EuyWMQJ2GPGJ3ogkcjnhMRXiYI+dTiwJPV/kvQsrC0wZ2F5gwmy8Q== X-Received: by 2002:a05:600d:8381:b0:477:f2c:2923 with SMTP id 5b1f17b1804b1-4771e56e32emr536225e9.30.1761672927387; Tue, 28 Oct 2025 10:35:27 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Chen Miao Subject: [PULL 18/18] rust: migration: allow passing ParentField<> to vmstate_of! Date: Tue, 28 Oct 2025 18:34:30 +0100 Message-ID: <20251028173430.2180057-19-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 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: 1761672968076154100 Content-Type: text/plain; charset="utf-8" The common superclass for devices could have its own migration state; for it to be included in the subclass's VMState, ParentField<> must implement the VMState trait. Reported-by: Chen Miao Signed-off-by: Paolo Bonzini --- roms/opensbi | 2 +- rust/migration/src/vmstate.rs | 3 ++- rust/qom/src/qom.rs | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/roms/opensbi b/roms/opensbi index a32a9106911..43cace6c367 160000 --- a/roms/opensbi +++ b/roms/opensbi @@ -1 +1 @@ -Subproject commit a32a91069119e7a5aa31e6bc51d5e00860be3d80 +Subproject commit 43cace6c3671e5172d0df0a8963e552bb04b7b20 diff --git a/rust/migration/src/vmstate.rs b/rust/migration/src/vmstate.rs index 42e5df8d818..5a237c409ac 100644 --- a/rust/migration/src/vmstate.rs +++ b/rust/migration/src/vmstate.rs @@ -268,7 +268,7 @@ macro_rules! impl_vmstate_transparent { ($type:ty where $base:tt: VMState $($where:tt)*) =3D> { unsafe impl<$base> $crate::vmstate::VMState for $type where $base:= $crate::vmstate::VMState $($where)* { const BASE: $crate::vmstate::VMStateField =3D $crate::vmstate:= :VMStateField { - size: mem::size_of::<$type>(), + size: ::core::mem::size_of::<$type>(), ..<$base as $crate::vmstate::VMState>::BASE }; const VARRAY_FLAG: $crate::bindings::VMStateFlags =3D <$base a= s $crate::vmstate::VMState>::VARRAY_FLAG; @@ -282,6 +282,7 @@ unsafe impl<$base> $crate::vmstate::VMState for $type w= here $base: $crate::vmsta impl_vmstate_transparent!(std::cell::UnsafeCell where T: VMState); impl_vmstate_transparent!(std::pin::Pin where T: VMState); impl_vmstate_transparent!(common::Opaque where T: VMState); +impl_vmstate_transparent!(std::mem::ManuallyDrop where T: VMState); =20 #[macro_export] macro_rules! impl_vmstate_bitsized { diff --git a/rust/qom/src/qom.rs b/rust/qom/src/qom.rs index 5808051cd77..84455cea79b 100644 --- a/rust/qom/src/qom.rs +++ b/rust/qom/src/qom.rs @@ -102,7 +102,7 @@ }; =20 use common::Opaque; -use migration::impl_vmstate_pointer; +use migration::{impl_vmstate_pointer, impl_vmstate_transparent}; =20 use crate::bindings::{ self, object_class_dynamic_cast, object_dynamic_cast, object_get_class= , object_get_typename, @@ -182,6 +182,7 @@ fn as_ref(&self) -> &$parent { #[derive(Debug)] #[repr(transparent)] pub struct ParentField(std::mem::ManuallyDrop); +impl_vmstate_transparent!(ParentField where T: VMState + ObjectType); =20 impl Deref for ParentField { type Target =3D T; --=20 2.51.1