From patchwork Mon Jan 13 17:35:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 856933 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp1545759wrc; Mon, 13 Jan 2025 09:37:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV8plEWwkUoPCcnJgpkkGxuvw+6dTw/ViCZgnfl/nlkzBPI7TzyvpDKuWdW2DJ8oRCU038z/g==@linaro.org X-Google-Smtp-Source: AGHT+IEh4yClE/t/K9/B2E1/x0j7fXB1J528oJEXfk7NWtG1f8BLTj4BAogotkkD2yLsOsZmeBVw X-Received: by 2002:ac8:5903:0:b0:466:77d0:5941 with SMTP id d75a77b69052e-46c70fd484dmr308737081cf.10.1736789855486; Mon, 13 Jan 2025 09:37:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736789855; cv=none; d=google.com; s=arc-20240605; b=SxtnqHbVU3EkBcZE1jud0G/3C/Olygy9sqoa+zMXdVtYhiGFFcOcGSxeZQ784wuGJL qdDAgkIUYiRVSPofcFkyxxFJFyOn6i5gialFFlUblApLdfKnLUsccAV+G7JR2+GlU3p0 Ivx0Kg10K+dOXqphlZ0K1KNw4Zgr++6JrhJOulnfofMZiSwJTIbHky/FeiOE1RBup1n3 I1gOHC+Zsao5Lb4blKbufWZJ+wpmqRhnO9PL+5fWVhErbgZJ2Yw1iJ7CvNM0wy1o3S9U +eehvNn6bitavyABdybSIKPUjJ7MsaOaVCePDCfdhR5f7k904tyuEeKe2oNZ7pji2uF1 NyJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DzCNbwIo87x4lOEY4ICfv2t12PV5Rydbl8ocZx/cYns=; fh=Pa0Kx7VcbCaepe9+5NP9LrCZ4BMLIY/WxZiYNx05RvE=; b=WQ60OrFgWUN+MWQ4vfBl3MsBf4yHwGIrgmNTMK3ae62iWsvSbU/sEKgLb+1GH7GG6O jflvjK4EAd0K3m1f81S3/c/rGKlZe/ySuCuxzMWkQKYVV87y04Oe+xXybCfLRRqxDq3/ 6+XZiCx7AKR7bDff9zyac25mffP0hrBhqyDUzARAvCItlr4gciu4/PCfTqrg1j7zT+wz 9hgI78sQ8HNV+LrdQvIOe5do6inoP7gHXPYyjtzchewYhDX+HJCF0HME018ZER1obbEq zZiCz6TwfozTo1wDA4HakO+ydeArzDnBJnLGwjPpwgxk8aQAqqh9BBUtMJAngD5piAHb Hffg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cbgcKYzo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46c87412ccesi101881811cf.476.2025.01.13.09.37.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Jan 2025 09:37:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cbgcKYzo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXON3-0002NL-Bq; Mon, 13 Jan 2025 12:37:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tXOMS-00022d-2m for qemu-devel@nongnu.org; Mon, 13 Jan 2025 12:36:25 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXOMK-0006yr-76 for qemu-devel@nongnu.org; Mon, 13 Jan 2025 12:36:19 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4361fe642ddso48330945e9.2 for ; Mon, 13 Jan 2025 09:36:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736789772; x=1737394572; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DzCNbwIo87x4lOEY4ICfv2t12PV5Rydbl8ocZx/cYns=; b=cbgcKYzonekfIJxgcVEhT+CYJ/npyycy0FNGWWRCGn/Z8/luj7vzrUeUt7enX5H1Rz qR1lM3FgvKglYgHhOXi3IgOWdH55FJVjGDDytRJ2/AHPBBbJ3DyZsKJHObJqIzx+jJ48 yFhsUuPcvbuUu7CKuZaGUu4WNRmy1pPuTPh+ahlPU5MZfmljludgBjidhOrQkU8cXtRs ab3cbCXAUqPT2q2Cx/fGRnRbynkbfQKnuxce+7dqzrcFaT8/Ws+g/RDJsO/GtElJGt51 dAqPVVnOuWHN8sQvFBYvc4FrJ+d3CMFkk1JdMwnJgMFZ9UiN/KBAfpNb0lUusif3hX43 nBHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736789772; x=1737394572; 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=DzCNbwIo87x4lOEY4ICfv2t12PV5Rydbl8ocZx/cYns=; b=rxYES3OxINPlZTENh1p45qWyjWcRwEQNCvgKYa8Gstz1brEjn8QNEg324eBl9JeXWz yZ3JzAASJLqVDfZP8cTn+0MzgdyMdG0owav1ce0YV0BUAqo2hLsa3TzPDMNIRGqKv3Xm RP8i0suIxLIMbubd1oXJS3LXxjaH26GbcK9X79lox6nrh29FGOno65S9lYo0lzwWkeiu f5pVwUuRRLjXwqFaTVj3KiFhfWnWbilhW3RsIHq94PTFAGNjbWdm4+Ac0Xy5XMxj26sf PwtNvJjJDfsOS7u++g1Fw350XI/gGpl1MQ0edFfvimXcWlylX15/E+ktOIUmlMOTUuND SYhg== X-Gm-Message-State: AOJu0Yy0KzdB+izDEpk+yY00S+NkptysY47xg4o/dDs6zyJ7Z0n8C1z2 f0U6aPa96fLjobu6skVZjb1RciWcmsHFAOEwd3dZy4C5fsCCickcd18JaE3uh31SfSNPAxdyYI3 03bk= X-Gm-Gg: ASbGncso5el0WxMLGQWeR7AfigXU8QVO5IK2z5CPOtEb8KZGm6XuyYLNLdrcq4aHUnW 2SSQqF3zk9+kBfFuuO3gwtDb3gzXmTnhkYltweBNZH7FfL0mPw4DSRhc447tiafAarvtMtO/oSf iER2NjvRV6ZnUy2lhZ52xrfXsZCkUx0q7w2u8vxjf+6aasR+CJ8jdoDQVP+mfJsYV8puXlDahwT Ok6n0+GWL4H0n03P4mdavlqYLPL7B5cfkgN2RpBBleasCxq8O+rul79D4tCI34+qANAbMjoda+6 715UWcljl/r7Zw8HCq9iqvXdkcDMug4= X-Received: by 2002:a5d:5848:0:b0:385:df5d:622c with SMTP id ffacd0b85a97d-38a8730dec4mr17115771f8f.30.1736789771685; Mon, 13 Jan 2025 09:36:11 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e383654sm12945329f8f.30.2025.01.13.09.36.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Jan 2025 09:36:11 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Igor Mammedov Subject: [PULL v2 06/55] hw/qdev: Pass bus argument to qdev_hotplug_allowed() Date: Mon, 13 Jan 2025 18:35:58 +0100 Message-ID: <20250113173604.46931-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250113173604.46931-1-philmd@linaro.org> References: <20250113173604.46931-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki In preparation of checking the parent bus is hot(un)pluggable in a few commits, pass a 'bus' argument to qdev_hotplug_allowed(). Signed-off-by: Akihiko Odaki [PMD: Split from bigger patch, part 1/6] Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Igor Mammedov Message-Id: <20250110091908.64454-2-philmd@linaro.org> --- include/hw/qdev-core.h | 2 +- hw/core/qdev-hotplug.c | 2 +- system/qdev-monitor.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 89575e74e27..930b00fb09a 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -540,7 +540,7 @@ void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id, int required_for_version); HotplugHandler *qdev_get_bus_hotplug_handler(DeviceState *dev); HotplugHandler *qdev_get_machine_hotplug_handler(DeviceState *dev); -bool qdev_hotplug_allowed(DeviceState *dev, Error **errp); +bool qdev_hotplug_allowed(DeviceState *dev, BusState *bus, Error **errp); /** * qdev_get_hotplug_handler() - Get handler responsible for device wiring diff --git a/hw/core/qdev-hotplug.c b/hw/core/qdev-hotplug.c index d495d0e9c70..19fbb11a316 100644 --- a/hw/core/qdev-hotplug.c +++ b/hw/core/qdev-hotplug.c @@ -30,7 +30,7 @@ HotplugHandler *qdev_get_machine_hotplug_handler(DeviceState *dev) return NULL; } -bool qdev_hotplug_allowed(DeviceState *dev, Error **errp) +bool qdev_hotplug_allowed(DeviceState *dev, BusState *bus, Error **errp) { MachineState *machine; MachineClass *mc; diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 23043b1e0d5..83388dc0c4a 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -691,7 +691,7 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts, /* Check whether the hotplug is allowed by the machine */ if (phase_check(PHASE_MACHINE_READY)) { - if (!qdev_hotplug_allowed(dev, errp)) { + if (!qdev_hotplug_allowed(dev, bus, errp)) { goto err_del_dev; } From patchwork Mon Jan 13 17:35:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 856934 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp1545760wrc; Mon, 13 Jan 2025 09:37:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUx6obzcPBYJ0WJIVcnZWhj4i956Ms2ASd2mH0ydf9xpDN7q3O4HxnmTVnSoKNkvJ/A67kOXw==@linaro.org X-Google-Smtp-Source: AGHT+IHLMdEsHq83RXhhQfvUTSzt7kAFgCd735UMx3bJYVsKGQhe2bD9lrtdUF6rskW0qLcIMoy1 X-Received: by 2002:a05:622a:154:b0:466:a93f:c1c9 with SMTP id d75a77b69052e-46c7102c947mr268141301cf.24.1736789855717; Mon, 13 Jan 2025 09:37:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736789855; cv=none; d=google.com; s=arc-20240605; b=jDy8KtzbOajc/0DuDGAnOnQYQg3Bj1xP0eBmg7csSw+F0z/EFLzqVzMfM0ijXPwy21 sUx50mIKmIuJ0jwjALYXlpyPOz5jT0XGXw4w3Fkckdj+j03whs0I88USaH01VKvaiT+0 dRrOtASEJo/gYwW6Gxnona2uHc7I3uLq24OPwbTAX8Oksd5NMRhefcKfNJIfA6dN21Ta 8/X8jk77Rl6qQL9Cp2HWSnP5YWKqCZ0VWAhlWxb5f4Meyy6KMERz6QuIId47J+657kpo ti1oeUE3QUrfdJqN3iXDzlxBLlIsXJv4LWduSc4Fk7SSSaI8EqBFM7eI3aeG3+2lEYWQ jAJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UfFTRmuQecjymNg1z1Zlqe+xEmRGvh9kuRZqED+itwE=; fh=Pa0Kx7VcbCaepe9+5NP9LrCZ4BMLIY/WxZiYNx05RvE=; b=boIlU7oLyd9Jwkt4ZqxUBZuUYi/A/WN5Bc/aj7wONwKZM6+mIayize9+2j3wrwlSUC Ce1O+6CGY9/y6fcrk48AzOetIDSumazbwNqddHHBJZZ2UOoPEuGhXD/kRZxxzg3h+dzh n0y/ieffYHRuoKZVtDmG7C52IRk3ABrVASI4Zsq3/wG7dSBjQ9kEXCCmdfUho6WpB9YW VbajRYeY2KOitUoHPSi4Y4FWTC8Q2twBR2GdBjcbY0e0I70/6Z74qSI00FpBj7xL5Zdv fQD2PhhIziiSJMkBSTvGNUpEfap8j7uyMONZYzuIae5z5gtYA2KB+IX2xvI1VKD5UY2D uzqw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZOKvLh+J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46c87331457si94775561cf.121.2025.01.13.09.37.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Jan 2025 09:37:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZOKvLh+J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXONF-0002da-JC; Mon, 13 Jan 2025 12:37:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tXOMT-00023W-Vv for qemu-devel@nongnu.org; Mon, 13 Jan 2025 12:36:26 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXOMO-0006zd-1M for qemu-devel@nongnu.org; Mon, 13 Jan 2025 12:36:25 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-436249df846so31978425e9.3 for ; Mon, 13 Jan 2025 09:36:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736789777; x=1737394577; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UfFTRmuQecjymNg1z1Zlqe+xEmRGvh9kuRZqED+itwE=; b=ZOKvLh+JkRlsluoteN1EmHKMLQzwVivrz/7yL6YLeQUSk6RRmvnztPdqb+ZJEb/XA5 fv5CIi12lvCZJBqmD02g78AN2yiXSXh8vfL9E9ZxgNOl2uLe84OqloymcS2zi4OJZRLi 46IcbFOtfSWwf3A7VWo6xuzZqFxd5VjqB4TshbzLXW+5e1xVOoUQYKzZ8mMg3y0p/NN/ gjB7u4lBb45bcJoA+tUJ6J7BWHtbHTivjdqBhsekWNxcVmubw89sgbt7UHYUwhh0xxaG +MHpaZOPPsfd1hXz0qswHv7Lg+NijhTXBPRzALX8CYHt4iPf5c+BDDAWRPagpKjebbOf 4c+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736789777; x=1737394577; 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=UfFTRmuQecjymNg1z1Zlqe+xEmRGvh9kuRZqED+itwE=; b=GABy7RcfIUQMEs2bKyieROM5cTssYccyUFtdHAiBRsgYf+rH1CGKzmLstz1EfetiwO y84/BSbguZA2b618kgm+EhZ4SMnnA8BzyrGNW4cwcUHJWqZIUNSRYxRFvsNDlH5W2PBw VXLSiKiPUNOB0/SDkkAp7HPhYsQUAIh1tzt6WZLkS9StEWrQOM6SndwgQ56ce+pKSqTt ogd8XnI1KCPGZgoxKp1wo0WzcdBBRO3tL2/9c7nNZvZAs6x8wtIQ6ShHuibpbhtrAE2M 66L2bJ9BYNM+paHQ2ObC2KihjlqZ4sj0NbvXqnhSBFiyTD0RZr6aR5EdcXut7D/CmEsK 0oBw== X-Gm-Message-State: AOJu0YwHkVyxp3p64ttWV69FaQofpkEUOVJO9oejUnKJovRO3jDtH4s/ IVo/+bWHwDrraPJm+SRnkeAhOaS2WVQ9zFkCCMjMItI1O5zAJ4PndTaJiMZMFsbLmIPF9hGoyZP xMwY= X-Gm-Gg: ASbGncsjkQOSMroN526NjI6d71us2PoKiD14HFJR08yjG2my9i6d1L2ynt4JHhLcF7L 8ddWi2K185uiK38yxWS5Jrf5xoWs5b3ZFZbMZO3px/fXvNL7yIlPl8mCILxaZS+DUIGNYOpMg6B J4SXSjBL0NiT+IKyBqRa0PTxCk/n8x1Q3r7721qpN3R4wKmkS9y/YxjN0xZ0mjKZs08BnSJs0PL u/HmNaVdqC6Y9QfnCbP3MoKTzH3f283nqkDDiyeQJFmxCLkI8fb3T0WCFbOAIu7aLVCOv/zZ/Hm rP3jR+exIy1bmfphdPMgr3/KF2o7Q9A= X-Received: by 2002:a05:600c:1f95:b0:434:a525:7257 with SMTP id 5b1f17b1804b1-436e26d946cmr167014235e9.21.1736789776632; Mon, 13 Jan 2025 09:36:16 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e4b81d7sm12730247f8f.73.2025.01.13.09.36.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Jan 2025 09:36:15 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Igor Mammedov Subject: [PULL v2 07/55] hw/qdev: Factor qdev_hotunplug_allowed() out Date: Mon, 13 Jan 2025 18:35:59 +0100 Message-ID: <20250113173604.46931-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250113173604.46931-1-philmd@linaro.org> References: <20250113173604.46931-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki Factor qdev_hotunplug_allowed() out of qdev_unplug(). Start checking the device is not blocked. Signed-off-by: Akihiko Odaki [PMD: Split from bigger patch, part 2/6] Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Igor Mammedov Message-Id: <20250110091908.64454-3-philmd@linaro.org> --- include/hw/qdev-core.h | 1 + hw/core/qdev-hotplug.c | 5 +++++ system/qdev-monitor.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 930b00fb09a..530f3da7021 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -541,6 +541,7 @@ void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id, HotplugHandler *qdev_get_bus_hotplug_handler(DeviceState *dev); HotplugHandler *qdev_get_machine_hotplug_handler(DeviceState *dev); bool qdev_hotplug_allowed(DeviceState *dev, BusState *bus, Error **errp); +bool qdev_hotunplug_allowed(DeviceState *dev, Error **errp); /** * qdev_get_hotplug_handler() - Get handler responsible for device wiring diff --git a/hw/core/qdev-hotplug.c b/hw/core/qdev-hotplug.c index 19fbb11a316..dc35110e735 100644 --- a/hw/core/qdev-hotplug.c +++ b/hw/core/qdev-hotplug.c @@ -47,6 +47,11 @@ bool qdev_hotplug_allowed(DeviceState *dev, BusState *bus, Error **errp) return true; } +bool qdev_hotunplug_allowed(DeviceState *dev, Error **errp) +{ + return !qdev_unplug_blocked(dev, errp); +} + HotplugHandler *qdev_get_bus_hotplug_handler(DeviceState *dev) { if (dev->parent_bus) { diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 83388dc0c4a..511d1aa83c2 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -909,7 +909,7 @@ void qdev_unplug(DeviceState *dev, Error **errp) HotplugHandlerClass *hdc; Error *local_err = NULL; - if (qdev_unplug_blocked(dev, errp)) { + if (!qdev_hotunplug_allowed(dev, errp)) { return; } From patchwork Mon Jan 13 17:36:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 856932 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp1545756wrc; Mon, 13 Jan 2025 09:37:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXHJiMcnnAta+CrjYORIJeVAC3y2GbUXMnJvH5D2BQqCQkWp+P6/QXRzNBuC/Dbw7MqbpOlvQ==@linaro.org X-Google-Smtp-Source: AGHT+IEdgGQame3D+Hp2IRBoEytbU6y38cc/2ZopHRomNn2dBdVncA0OY4UCfxba5tTEvy08EeT8 X-Received: by 2002:a05:6214:2267:b0:6d8:f612:e27d with SMTP id 6a1803df08f44-6df9b2dd8a6mr272494526d6.32.1736789855506; Mon, 13 Jan 2025 09:37:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736789855; cv=none; d=google.com; s=arc-20240605; b=ESXSuxNXrlySIQSnUOCxlz5m4FCN5hRvt7q0PrvGoT6eFVsoZLCGb2qrwRI1u64do/ EEZKnoYJoUUzfzmKmbJf65H9YYrA4UoBG3muXekngRBN2vEaFVS5eeWcnHUY9zbq7sUT SBziqvnAYOY8EO4O2nUpqvWCFi/xshU/NJiU0SZG4zfU0n7zqWeaCumehcDv/0i40qoc 3MFrml7mzClSXLwKnvkYMyN9f6ms7fO9BF80+8jquiIa4d9GdBH3tfd8dkWMAxQR+MRa Jvf56ALOirY2FrfrvG+vhgKg60H6JzJlgqUgt2EGofBJmXPO0RnN1Tf/6iNxSZobh08Y wffg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OUfr49xKtxGGKC5FU33V2zWTBLM60pMyiEdF047/1BY=; fh=Pa0Kx7VcbCaepe9+5NP9LrCZ4BMLIY/WxZiYNx05RvE=; b=QjscOwPHN6BZUM900jr7kcBZKRksHZbOUSJDB1yJ+XniSKZhHD/s6d0SrYz1f/Wwjh sM6kStHvCOVSLKEH4GDNMUzU+WLGroJCdfgi5J3sCqcPd1beuqHalN99Qb/BccCMBAtv qk3pkSUi2xYHvz/0NXCaMjXDpFHdlaMWG1eiGk0QYbUf/dbkluINmMp1wfCtPs4YhES+ 6fV7kT+jEL79QNEhkndScrznkmqHF5ygc8QXrh5aQaDlLadWmi4ULsITaVc1UziDayp5 7zmQcQbli4s9HEtnQ+cbdyi5AMmVN228dZ5fSxXAfv0EHHc2tMMHAfmOpwEqT0eb9c0y WQHQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LnMn1Xx8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46c87424ce1si100919491cf.609.2025.01.13.09.37.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Jan 2025 09:37:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LnMn1Xx8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXONF-0002dL-H5; Mon, 13 Jan 2025 12:37:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tXOMU-00024A-GP for qemu-devel@nongnu.org; Mon, 13 Jan 2025 12:36:27 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXOMR-0006zw-RQ for qemu-devel@nongnu.org; Mon, 13 Jan 2025 12:36:26 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-385e06af753so2319849f8f.2 for ; Mon, 13 Jan 2025 09:36:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736789781; x=1737394581; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OUfr49xKtxGGKC5FU33V2zWTBLM60pMyiEdF047/1BY=; b=LnMn1Xx8JAwsyMCgvRVubEuKzZh4g0GdjSr2vkd0Y72Ob6phP9qeGahaSYFx+WnNWG wAqcUoOh+zO6SPh8zoeyiWC06W5HcIblr5rOVbY/2ETSroSRp22ksAUv6bTGYHUYd341 LXacYgwkgyK8tmIhrFZsv0igM1eDMrCisdneRYB+Xu/73/66MhbH5DkrfFDdfIVQRa9T H11z7bLb9LeBLcwLnENGMl6oIcPr63ICYx3g5iMlZkhcDoQojZmDYG4DrW7nMEKzoxKv jZc4x1hA9TYvzcrX5GaAI2O/9HLVe0wgeoYxDzOaXfgPoMegBZkRRWHWqK7h+dvzsrw2 fP+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736789781; x=1737394581; 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=OUfr49xKtxGGKC5FU33V2zWTBLM60pMyiEdF047/1BY=; b=CWwffBs24uU+2cDQJq7RI90gCBZGWTvNo65xPsgt4Q5CyVm4BkN1uRnVavJTzqpK8P ol+5S8fByIsyKVIDhOZqflV2yTrtYXaipCxdXb8LQXNDCN1lL17tC4VGjx/tRByosTui XWrQlvyHd5xbhitXvpzB5/43ZguQSIWrU9J0eW15JNpmWuEHqjsER0rOq/sDV/zMwmoY Cgl9pvvysVnseClDpUAQMpWQhzbd3OrmAqz9bLhnLe5i93kV1PdbkSEkrwcaLdZ0K9Fm bPyWwyHyLSWvjC3BhQQw5di7B6c/Ip35/4V4WK6jjLUzsVea6+UX5MRNxI3YS0XHkFKL iJTQ== X-Gm-Message-State: AOJu0YyKpKYPW4PpPdTC2HhV5WYHz6SOfMNTzARiofoBU1fsIa00Ud3Q Ng58a3Asiro9QYV/kn6QRM1NEaQYYAPbAuHVzBa7aoVtfqZ3skX3CzzJfQUR7Y2z9l6/fs89X4F /ckM= X-Gm-Gg: ASbGncuyu/FPfUxCcVIOWStbYLC5GFQs5m5QFzUUkw8t+Zglp7D95MJ5ji/7b+tejy8 A+XqW4HFATJgqkXgEByERIwpXDUmVREIoSZQIBmCdRela73reyM3zqMfPfhxRJ4vJ8XtvpPF3Vp lBrpv4Gs2YWv8u/x/OJhdm1EpO9ApzWowXSbiszu5/82D+0Ro4xIbwhkzy3JCa6odt9MUjQXnoD LO30CsEHQsHe+FIOSiOMScw6ehW4aWO0iKjmRBYbAnAQG0xd9uw814xrVEJQ6U2dki8URHWGfG3 FX7kn4FcpIECJijRt4xIKtT1vozCW/E= X-Received: by 2002:a5d:47c4:0:b0:38a:41f8:8abf with SMTP id ffacd0b85a97d-38a87312917mr20841540f8f.31.1736789781410; Mon, 13 Jan 2025 09:36:21 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e4c3428sm12430145f8f.87.2025.01.13.09.36.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Jan 2025 09:36:20 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Igor Mammedov Subject: [PULL v2 08/55] hw/qdev: Introduce qdev_hotplug_unplug_allowed_common() Date: Mon, 13 Jan 2025 18:36:00 +0100 Message-ID: <20250113173604.46931-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250113173604.46931-1-philmd@linaro.org> References: <20250113173604.46931-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki Introduce qdev_hotplug_unplug_allowed_common() to hold common code between checking hot-plug/unplug is allowed. Signed-off-by: Akihiko Odaki [PMD: Split from bigger patch, part 3/6] Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Igor Mammedov Message-Id: <20250110091908.64454-4-philmd@linaro.org> --- hw/core/qdev-hotplug.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/core/qdev-hotplug.c b/hw/core/qdev-hotplug.c index dc35110e735..168d7964740 100644 --- a/hw/core/qdev-hotplug.c +++ b/hw/core/qdev-hotplug.c @@ -30,12 +30,22 @@ HotplugHandler *qdev_get_machine_hotplug_handler(DeviceState *dev) return NULL; } +static bool qdev_hotplug_unplug_allowed_common(DeviceState *dev, BusState *bus, + Error **errp) +{ + return true; +} + bool qdev_hotplug_allowed(DeviceState *dev, BusState *bus, Error **errp) { MachineState *machine; MachineClass *mc; Object *m_obj = qdev_get_machine(); + if (!qdev_hotplug_unplug_allowed_common(dev, bus, errp)) { + return false; + } + if (object_dynamic_cast(m_obj, TYPE_MACHINE)) { machine = MACHINE(m_obj); mc = MACHINE_GET_CLASS(machine); @@ -49,7 +59,8 @@ bool qdev_hotplug_allowed(DeviceState *dev, BusState *bus, Error **errp) bool qdev_hotunplug_allowed(DeviceState *dev, Error **errp) { - return !qdev_unplug_blocked(dev, errp); + return !qdev_unplug_blocked(dev, errp) && + qdev_hotplug_unplug_allowed_common(dev, dev->parent_bus, errp); } HotplugHandler *qdev_get_bus_hotplug_handler(DeviceState *dev) From patchwork Mon Jan 13 17:36:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 856935 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp1545766wrc; Mon, 13 Jan 2025 09:37:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW/htGKRlVDxl1DgcSmhsh4sMb1QS7FkQbtjkKL98n5Dcod/JGfsGo/9dYZGDIi0P3NIBKZag==@linaro.org X-Google-Smtp-Source: AGHT+IFgxdXlcEEywAp2T0c52pW/GnZhR4vrNe0w5jl9pfsPkKgnC6mOAVhPDZAyFsyVUAwiIHJm X-Received: by 2002:a05:620a:28ca:b0:7b6:d1f6:3df with SMTP id af79cd13be357-7bcd970a925mr3488913085a.21.1736789856320; Mon, 13 Jan 2025 09:37:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736789856; cv=none; d=google.com; s=arc-20240605; b=kfnnUPVpkS7DlYYX+oYBPnvyXgjE6VIDE+EHR1mvhY/dAIOQWaYH4cJFHcY58PPIlw RugsbrdJ8yGKrgCog2gfKeGCzo0BFX81oNsToZBNehRXvjJMEaViVvQr+b7o5+zDhFNd rMhz1Fzeq530Q64kXNVbwKWUR0Z/G7+HoAbNwp+cwYRtLodMWkEhg3+QNpcmDDedVtDB bjj8QPito1JMY8H9YtIbLBhO4QMoVDfDqD3ii5kR+SY7BXQD+rYommnIdK71ptpalnTi /8Zdp/kViWPqkSHEpahYXQvSDEU5W9OzH6+y0JrJzrxdVZwUuVU9Deb4JQhaKYEVBOEW 5wvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uzxOnDYWp3ING3ucvnPH2nA5sMkoderjORmFMdUDMqM=; fh=Pa0Kx7VcbCaepe9+5NP9LrCZ4BMLIY/WxZiYNx05RvE=; b=ceXDwev5ZmCvNBF1qTL8myfm0wqWOUisVqjNE2qqxyORleo1vHSx4Ju8+xm0DI7uZO rxvetu+BE5WEisOrPumNIVRytl6KjXVwogAnHxeAiYL6D6s+bwM+MEI5cH39tamfNsGd mBOvV5awSGY/9DzmyICGzmo8e9f56VzQeEC0wK742OfbZ3eS34p2FCqfmMPjDOA44QjG TMLBa0r1Hi17nbTHYYEurrekn8x69wIRPK0RFDaQDozvPBoc4okwn66/l93aPnklfxM6 1z1bQB1LCkeF5Sznk8dr6YuXrgb0wgQx8TbmFC2oF7eag0lBWSgQM10S4rFt+GAP01se ROFw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=baseB0KE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7bce3507ec9si1116282685a.520.2025.01.13.09.37.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Jan 2025 09:37:36 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=baseB0KE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXONJ-0002wX-8b; Mon, 13 Jan 2025 12:37:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tXOMX-00028D-SV for qemu-devel@nongnu.org; Mon, 13 Jan 2025 12:36:31 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXOMV-000719-Sb for qemu-devel@nongnu.org; Mon, 13 Jan 2025 12:36:29 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-43623f0c574so33103825e9.2 for ; Mon, 13 Jan 2025 09:36:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736789786; x=1737394586; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uzxOnDYWp3ING3ucvnPH2nA5sMkoderjORmFMdUDMqM=; b=baseB0KEmVR2sAa+jAs3CZqY71O0eIxuM1n7KoJ2JiVw/Q594U05vhBFPQa4CVZMIg X1smN49ewaxQgdhxGByNnlJBldeslW3mHYhTxe/5Cnp5RXu5cmEfTKIMJuMZqur7ybI6 zAlo0du+nKsk2JPq3/+XYgMlpZHEAfkkqcEZnSaN+Eg+MheYToR60o805Ne8ZYXuiLh/ jZ/GL30VvUD9M2kNcJzxOgucIfdfdTK+yUtbos/4uzZMOg05OOoq1yeGgwOlAi+8Uah6 NOn8E7BF0AwJXToyHnxBjCe/z+YHolLN9s0qjx1MLhTG5m9Uq4ruA6LD5K9QGYrnJ2Q2 vHsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736789786; x=1737394586; 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=uzxOnDYWp3ING3ucvnPH2nA5sMkoderjORmFMdUDMqM=; b=KcEqOLA6zXDx1g+B3fI6PR38fXD6xOuFBIDV8OuRlKOvBqlCPPSfaLLv1o2CfakhYu F1e3x2sAhp2fzkFD3j+Gqgvj6nk2RVlQdMa/2xTX+oaWP3qWAeRZ3fcLLozM2HYlY7uB KPenMzmAcatLceP+l/TrxUg5VkyK3DkrqQ729UxJ3TEUjxNWLk0K5KAokAoQve9u8fAJ utbAwxa6o1vCbcZBxGOSRusWP6IxU8e7ua03tdrAu4MKyaSBg5Mnzyx5mXk1kMGvF+Vb HUWCqCJpARRCg9Q7Vh83TQTFQYyo1FhGWHixFJC+h3eUEcbBgR3KonPwS0iLz3h3A1T5 /lmg== X-Gm-Message-State: AOJu0Yw9JX8pTqH4+WcYnzL/2ZyNrozyVWKDNYhePWF9wdje3U6PhHuQ gg0u/c0MxEH23kpSj1Ua3Y0ZRCuLWXlH3FT7MhLesmMxRkEjTpX6aMyvre5DIl/uwmXG0xEXLCy PZF0= X-Gm-Gg: ASbGncuwLv0SmXapE3G4vd11uvRcCiSV9Nt24D9W5Qp8SG6PnuBQx+x4ReTPts8mxo+ 33166w2yl5entFMGBE/DOSkQeU4GKEmm7MrxJd7naaBPE4EqJtp65LzkneDVmMJpo2iU0VyjKkx HDMENlXBWZwjLPbOnJtqZsFrfzkxLkMwkwCr7bQyPe9sfP4XeJXtiAgH2MRR45AxbiJTrQCdV6Q tT8QbH1CZuPtO7mu2HsbW8/N46Ne2i81GF9RrOHejHKcyHjC7H/aLtc8+sOPrnHcUzSdDJW8gat bS2qH+dN0E128T8fdrgYwVufABe5Y2k= X-Received: by 2002:a05:600c:4ed3:b0:434:f7e3:bfbd with SMTP id 5b1f17b1804b1-436e26dda8cmr175373635e9.23.1736789786163; Mon, 13 Jan 2025 09:36:26 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e2e89f29sm184467465e9.28.2025.01.13.09.36.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Jan 2025 09:36:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Igor Mammedov Subject: [PULL v2 09/55] hw/qdev: Check DevClass::hotpluggable in hotplug_unplug_allowed_common Date: Mon, 13 Jan 2025 18:36:01 +0100 Message-ID: <20250113173604.46931-5-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250113173604.46931-1-philmd@linaro.org> References: <20250113173604.46931-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki Check the same code once in the common helper. Signed-off-by: Akihiko Odaki [PMD: Split from bigger patch, part 4/6] Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Igor Mammedov Message-Id: <20250110091908.64454-5-philmd@linaro.org> --- hw/core/qdev-hotplug.c | 9 +++++++++ system/qdev-monitor.c | 10 +--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/hw/core/qdev-hotplug.c b/hw/core/qdev-hotplug.c index 168d7964740..1d77fffb5e0 100644 --- a/hw/core/qdev-hotplug.c +++ b/hw/core/qdev-hotplug.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "hw/qdev-core.h" #include "hw/boards.h" +#include "qapi/error.h" HotplugHandler *qdev_get_machine_hotplug_handler(DeviceState *dev) { @@ -33,6 +34,14 @@ HotplugHandler *qdev_get_machine_hotplug_handler(DeviceState *dev) static bool qdev_hotplug_unplug_allowed_common(DeviceState *dev, BusState *bus, Error **errp) { + DeviceClass *dc = DEVICE_GET_CLASS(dev); + + if (!dc->hotpluggable) { + error_setg(errp, "Device '%s' does not support hotplugging", + object_get_typename(OBJECT(dev))); + return false; + } + return true; } diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 511d1aa83c2..81f747b38fa 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -263,8 +263,7 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp) } dc = DEVICE_CLASS(oc); - if (!dc->user_creatable || - (phase_check(PHASE_MACHINE_READY) && !dc->hotpluggable)) { + if (!dc->user_creatable) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver", "a pluggable device type"); return NULL; @@ -904,7 +903,6 @@ static DeviceState *find_device_state(const char *id, bool use_generic_error, void qdev_unplug(DeviceState *dev, Error **errp) { - DeviceClass *dc = DEVICE_GET_CLASS(dev); HotplugHandler *hotplug_ctrl; HotplugHandlerClass *hdc; Error *local_err = NULL; @@ -919,12 +917,6 @@ void qdev_unplug(DeviceState *dev, Error **errp) return; } - if (!dc->hotpluggable) { - error_setg(errp, "Device '%s' does not support hotplugging", - object_get_typename(OBJECT(dev))); - return; - } - if (migration_is_running() && !dev->allow_unplug_during_migration) { error_setg(errp, "device_del not allowed while migrating"); return; From patchwork Mon Jan 13 17:36:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 856937 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp1546118wrc; Mon, 13 Jan 2025 09:38:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVArA+G3duglpY2iYy22pVlKm5gWISTtp1Aplgn7Y/iByeW0ih/Q5lpIY5x4X9fXgvmXtDGKQ==@linaro.org X-Google-Smtp-Source: AGHT+IHDc4H2qCF0MlbVOCPsQ8GG2ep35gErssmDkRWS6JQ311WcKd66Ol7FdeuZDvI386Q1o9I6 X-Received: by 2002:a05:620a:4492:b0:7b6:d3e5:4f45 with SMTP id af79cd13be357-7bcd971725dmr3354027385a.30.1736789912766; Mon, 13 Jan 2025 09:38:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736789912; cv=none; d=google.com; s=arc-20240605; b=HaiQkdGAhwMQTcsY5HOFfFEITvYrIwMmcVP5yZV0VMvoxpozKbpsAXoVP1BjwrlVYF Fi2iaxaCaOhf5ryw5dpdJgvzL2KkqL0Bb0DQVSZBYaKTu9pYnVg8Jq8HnZSHKZDVIWUf gL6WFkR32VZ3MFmSMwYX7REkk2sHqGinlacINBmWrQRRtUSzKU63jRp99Ec19LgTMJYt 7W5rvIVIInZXPf3FHeQKIagDdAY4EcLa/o/KJKdpXi5hK9YT0b6oLwIj29CDz0gowo/d Y0QNqiLnhr74xXrh9AMGnVeYcW2E3HrmCcngxAzG5ITq7PaLO+irz2f2MfyfgzHZvZY/ wTEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9K5rXE6D64Zw+S58ipW/6GTsDDRWIpLeh+hDNnJwfH8=; fh=Pa0Kx7VcbCaepe9+5NP9LrCZ4BMLIY/WxZiYNx05RvE=; b=Q2XV5TWe8veGjcor/wKCSV8/OKvwfxo6uZHUP65JxomZD8W3VSpdgNvvmGrbHuL6AT eec8lOGHAsqJg0uNdC9Oc2tp5ZyWKfbNifwW98X6uQnSW9MyNNuBGsYx36+rSVXKFfAE RM6wWEVddqNUZxPNT1KjY1qFkBzsv9kS2HFj9xsMxv6WRLDJOyGK87fNhl2Ym9CnwJ/k c+iB9Llnv3A1f3UW1mB41l9DJQD7PTiiZd6yCFKVoVpynmp7xKIc5GlwBheVi4Ew0uwZ DTIq1bDa7R+YuFYkkLpmv2zquhPslHoaGihHNPnBj52X7ZuVkyLZIS45oOWS7V8ZPUib rx2g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pa8XMhZu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7bce330725csi1094616085a.303.2025.01.13.09.38.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Jan 2025 09:38:32 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pa8XMhZu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXONL-00038H-Nj; Mon, 13 Jan 2025 12:37:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tXOMe-0002Dm-CK for qemu-devel@nongnu.org; Mon, 13 Jan 2025 12:36:39 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXOMb-00071m-IK for qemu-devel@nongnu.org; Mon, 13 Jan 2025 12:36:36 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43675b1155bso52677665e9.2 for ; Mon, 13 Jan 2025 09:36:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736789791; x=1737394591; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9K5rXE6D64Zw+S58ipW/6GTsDDRWIpLeh+hDNnJwfH8=; b=pa8XMhZuQryc7Yv0MpNGgdb2FGiLGzIkyls63oDyRSUYyTde5S8o/tzXx0S35/Eup9 yRtere6zhIWrs3GDXDyBNcr8//Q4Xo1lhDTPr7v6+8RKYqpGMRZkHpDfLBRFucyuupDf iijectX/HJ7z5Zv4GmmxLDyoAfcKtlBucu+GoGyrlP32VspuQKOn6QYx7IXIKxTjK/3r JeMCpQ8XB6dcPvtdHn3xvLMBNBPpjI9Whnv/DW3KWO1iIzZnrzZYEfsyK6BGpFeYGuIi DBBoUwp4p2/hWFf5PF/bkbWu57tGYvkWraNMtkP3gIsdUYkBWS+e147hnjOxWKC7//Ad 2rtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736789791; x=1737394591; 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=9K5rXE6D64Zw+S58ipW/6GTsDDRWIpLeh+hDNnJwfH8=; b=mHq58KqdFyOP2i+qQj7P+ATMext0QYwcHV7AbSc+dBZzUaakeXy5BT84EM0F0o+F+T eUWP3tOccgjo06J/nxbfD2SccYCoPeUeodBBtPwlEITB+vfzexHCB/OtOsAUBwS+Xyim IGcqR78PQmBvMiTMntOpfYWqIr5oCDsrOzxAh9apagTWDTeFvZkQ7Sdf7JFjrWaHqfH1 4YErCooJ178i2+CjMsl3XM8pGfX7BxQCIxg2BEX6kvIXXargL8pKsd84uqqgvhebdcYO G+bfQt5imHyJ/9792XHVIvk9E5K1BwJubKukK2jU/uI/+sTOyBnj41AOg8+tqYkpo0wT nY8A== X-Gm-Message-State: AOJu0Yz3LSmKwUUWKahvhCapa8327yNvPYi34fveB2Yinf+RcL9sAXym 3A5rT+O0V241pkp+UGLBMwYE3YfbczMr+F/w8sHsCv2favyVXc7iVPpMN3NMEwfmtVhmwUlr9E3 umfs= X-Gm-Gg: ASbGncstrfkXXliEnCapXhurC9Tj0KqvDdLFKKqlm3LQ7rB927grTQqPfhVuaTW24Z0 94VFxGlW/R1JFsIKqeM/vM91DzvZ1aLJhEi2Bk6vAOW/cGG1DMbznP6oxqDseKxk/wjP3aBH+sq ZwAh3Rtg7Z9AK2490cUgBue3mQwEEdeF9Jm38YE5IuauhrT8suk5M98SifI9aWCzHmzB/6Co5D/ FbxJ1+7epfigg3XznAR29pzi0Cm456qK3nDTT+t7xLb4auSeksEju70DB1xqDkeb+J9pxyG/vfB i3T1V6us4N3ndzObV/Y4NpD5Z/oC5l0= X-Received: by 2002:a05:600c:354e:b0:434:f9c4:a850 with SMTP id 5b1f17b1804b1-436e269c42dmr223133295e9.10.1736789790784; Mon, 13 Jan 2025 09:36:30 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e9dc860bsm150457005e9.9.2025.01.13.09.36.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Jan 2025 09:36:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Igor Mammedov Subject: [PULL v2 10/55] hw/qdev: Check qbus_is_hotpluggable in hotplug_unplug_allowed_common Date: Mon, 13 Jan 2025 18:36:02 +0100 Message-ID: <20250113173604.46931-6-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250113173604.46931-1-philmd@linaro.org> References: <20250113173604.46931-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki Check the same code once in the common helper. Signed-off-by: Akihiko Odaki [PMD: Split from bigger patch, part 5/6] Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Igor Mammedov Message-Id: <20250110091908.64454-6-philmd@linaro.org> --- hw/core/qdev-hotplug.c | 8 ++++++++ system/qdev-monitor.c | 11 ----------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/hw/core/qdev-hotplug.c b/hw/core/qdev-hotplug.c index 1d77fffb5e0..f6422cd0e4e 100644 --- a/hw/core/qdev-hotplug.c +++ b/hw/core/qdev-hotplug.c @@ -42,6 +42,14 @@ static bool qdev_hotplug_unplug_allowed_common(DeviceState *dev, BusState *bus, return false; } + if (bus) { + if (!qbus_is_hotpluggable(bus)) { + error_setg(errp, "Bus '%s' does not support hotplugging", + bus->name); + return false; + } + } + return true; } diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 81f747b38fa..e27d25c5859 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -675,11 +675,6 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts, return NULL; } - if (phase_check(PHASE_MACHINE_READY) && bus && !qbus_is_hotpluggable(bus)) { - error_setg(errp, "Bus '%s' does not support hotplugging", bus->name); - return NULL; - } - if (migration_is_running()) { error_setg(errp, "device_add not allowed while migrating"); return NULL; @@ -911,12 +906,6 @@ void qdev_unplug(DeviceState *dev, Error **errp) return; } - if (dev->parent_bus && !qbus_is_hotpluggable(dev->parent_bus)) { - error_setg(errp, "Bus '%s' does not support hotplugging", - dev->parent_bus->name); - return; - } - if (migration_is_running() && !dev->allow_unplug_during_migration) { error_setg(errp, "device_del not allowed while migrating"); return; From patchwork Mon Jan 13 17:36:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 856939 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp1546242wrc; Mon, 13 Jan 2025 09:38:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVnBdnQWcDyiAmzcariqzgsWZw1wrMaS+1sKyYRPaXkcOUobT73sLoSjFtU0IjgVv22WAG45g==@linaro.org X-Google-Smtp-Source: AGHT+IFAgWspJfs5B+UOrDfuhnCF0rsR1oM0VXfVQiYtA2m7BYMu01QvNeZFG8EEQhftGHejjnnX X-Received: by 2002:a05:620a:19a3:b0:7b6:7618:d7ce with SMTP id af79cd13be357-7bcd96e88c8mr3569204485a.10.1736789934600; Mon, 13 Jan 2025 09:38:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736789934; cv=none; d=google.com; s=arc-20240605; b=R4xgqKi3AYaup228Qsufw1uVYIVlg/kfgeAouFl9VLy3G1siBihb0ehBQduyfrWH4W nWuKy9xMxXoQnY0qG9uiycp4eoaZPSQbFEDpjMkGrrC1Xqa5euzzwsL93rWbjz2EVRbR SfQn3JdvOaqbqiR9bLmg4Ay52KGNmp9nfsTaw+esnmnwopF7/HLkl7rsJWZwd1dOK10z bLFwpx9OQQsHd3Rn5GlCFdLuWsu3i45fdm+jbMBh6ic1TcB9kgyRbrTe6ip1j9xP3t29 8pz0qNo7D/qWGjq4HN4bmsXNO9W32J3MPs4d85KawVDUIahF8KQcOU2euOD2YFIT8f+w A1hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=So15p+H+DSsGmUuH6+mgWAC3ycngOqSbmiFDKA1MmyA=; fh=Pa0Kx7VcbCaepe9+5NP9LrCZ4BMLIY/WxZiYNx05RvE=; b=O0JZc7x4SNX1JBo4HWMBKAmmojdCP0SKfCWoOOXaa71vDLUvQB/Ov6XS7Rd2O35JCy Kmx9nI+enNjfH132xG7ZkNSbNzK8LGlbX17PKJCAj9GW1+JiuDpg6Zq3oDi/3e1knA2O uS5PwodcwPL/6Owf9SFoArkQaGagCQ8JB6kX/HtJgs8nDpEtjfByT1B4NkncbNRPNkRw hVdcJIkRj253Ml1NxmrDjI/WbpG88eTgnGiTqXjNtlRY1jQIIgC1u5rm55dg3Dfl9V7a +X3XI48CiY/fGQkiOtTrx3opvzJmdyThEgjTKnyMCfRVRdj/S0kXGcQBfhO7NEpzuOBr FNig==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cHjv8KqM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7bce322a4a9si1159275585a.57.2025.01.13.09.38.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Jan 2025 09:38:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cHjv8KqM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXONL-00035Z-3A; Mon, 13 Jan 2025 12:37:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tXOMg-0002En-Rp for qemu-devel@nongnu.org; Mon, 13 Jan 2025 12:36:39 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXOMf-00072D-8L for qemu-devel@nongnu.org; Mon, 13 Jan 2025 12:36:38 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4361fe642ddso48335545e9.2 for ; Mon, 13 Jan 2025 09:36:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736789795; x=1737394595; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=So15p+H+DSsGmUuH6+mgWAC3ycngOqSbmiFDKA1MmyA=; b=cHjv8KqM0maYDidtTkfqeZAeZ+mxjvl9vjmigK6M8AXU0qd/b60TJCFx8sDcllCIAI 7jPz/zzxOyk6paiuea79Dufrp5ahoOSVo1vtcN6m+3MKZPQy9Bvcife75SXsjIlRxXkS 5qgJOvMSJIKSGP+RqotdT1LZVCRym6ilkCk4D+nqxmtyouFOly3js3kw2vbQhXxs9fhJ ROKyMA7EXjhFeFM4dOmex2by7YgMOk/ohi6Ui8crj6DlZ8iBWxN3ZnKEXwZjCGbtOGe8 hoye5egl+R77jp/tbPb3PFOABbW2bIlKC6e60VOP6w31RRamPv+nZNpKPFykxAIHS+PH 4dkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736789795; x=1737394595; 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=So15p+H+DSsGmUuH6+mgWAC3ycngOqSbmiFDKA1MmyA=; b=jCSCHdSAKlE/Ot42G+elOHs5pNeiXI1rSac1tzQRBHGuiSkM9TYsAUMTgIfvWS67r0 ETZN9I99BceyJWoeoe5Defhbnscag1eG25glnSA6d/9y/X/LMuBN0YayrChAdnatYYlx lwNIumNjW9rrRH2ZfgT6y3IupLOYAZY9hoObVlUXirlf0Hz+2nRBB1kP8p2821jMbmtK dcnRj0Rt4kJqJXc26S5nK0lU+T2SAF2seMf6gNMUxhUnmEVh5dTSk369IUlaBa7gMVZZ af1dtPhawqFwBtVFhtE78FaOqM+eryLC8mVX28IHhCmYCeRb7WiiH5KzwN6DjQux6t3n C1qg== X-Gm-Message-State: AOJu0YxI9LGckoUNRzK+vqTyRcEJ8dfyLPEXYf/zfgSZPfZpw6NkqwuR jfRvkE3Nk4Nu7bBcEPC6BMWCGAImCH5TkfhivY+ImIsWHARFhwtumt+UAz4u/FAJsUUeBvrf5Np TOEQ= X-Gm-Gg: ASbGncv64Mrnn03w8h0fmmVfzBqLH5Cfbgc2p1RbHahco5k39bl77PkmhuTzMgjzgNr a/0/S0jf9JOvG9IR1pRYzohFyy1c2UJKNjggCrUxZInmAfjmOxKWjvRBhHXwzqU0LLCDFnKOqWp lvuHOhE0HM0W8l9OTVFOYt6H0g9t27TZmuffxztIt9Sd01ZZZmozxDBkQDjln97udIsILUjsS6i xcDDv3rd96LVQDFS4StyV31zJKcgTFlbMlcwLydGt50X252lcVClbdmzPauiGjDxmf1OaTHLZN2 Qw0pxHY6xbMVm8YlX5EEklbXmDwN9Rs= X-Received: by 2002:a05:600c:4f8e:b0:436:fb02:e90 with SMTP id 5b1f17b1804b1-436fb021066mr56367155e9.10.1736789795403; Mon, 13 Jan 2025 09:36:35 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e9d8fba4sm150936005e9.4.2025.01.13.09.36.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Jan 2025 09:36:34 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Igor Mammedov Subject: [PULL v2 11/55] hw/qdev: Check machine_hotplug_handler in hotplug_unplug_allowed_common Date: Mon, 13 Jan 2025 18:36:03 +0100 Message-ID: <20250113173604.46931-7-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250113173604.46931-1-philmd@linaro.org> References: <20250113173604.46931-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki Commit 03fcbd9dc508 ("qdev: Check for the availability of a hotplug controller before adding a device") says: > The qdev_unplug() function contains a g_assert(hotplug_ctrl) > statement, so QEMU crashes when the user tries to device_add + > device_del a device that does not have a corresponding hotplug > controller. > The code in qdev_device_add() already checks whether the bus has a > proper hotplug controller, but for devices that do not have a > corresponding bus, here is no appropriate check available yet. In that > case we should check whether the machine itself provides a suitable > hotplug controller and refuse to plug the device if none is available. However, it forgot to add the corresponding check to qdev_unplug(). Check the machine hotplug handler once in the common qdev_hotplug_unplug_allowed_common() helper so both hotplug and hot-unplug path are covered. Fixes: 7716b8ca74 ("qdev: HotplugHandler: Add support for unplugging BUS-less devices") Signed-off-by: Akihiko Odaki [PMD: Split from bigger patch, part 6/6] Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Igor Mammedov Message-Id: <20250110091908.64454-7-philmd@linaro.org> --- hw/core/qdev-hotplug.c | 10 ++++++++++ system/qdev-monitor.c | 14 +++----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hw/core/qdev-hotplug.c b/hw/core/qdev-hotplug.c index f6422cd0e4e..ff176dc1bb3 100644 --- a/hw/core/qdev-hotplug.c +++ b/hw/core/qdev-hotplug.c @@ -48,6 +48,16 @@ static bool qdev_hotplug_unplug_allowed_common(DeviceState *dev, BusState *bus, bus->name); return false; } + } else { + if (!qdev_get_machine_hotplug_handler(dev)) { + /* + * No bus, no machine hotplug handler --> device is not hotpluggable + */ + error_setg(errp, + "Device '%s' can not be hotplugged on this machine", + object_get_typename(OBJECT(dev))); + return false; + } } return true; diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index e27d25c5859..861c25c855f 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -684,17 +684,9 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts, dev = qdev_new(driver); /* Check whether the hotplug is allowed by the machine */ - if (phase_check(PHASE_MACHINE_READY)) { - if (!qdev_hotplug_allowed(dev, bus, errp)) { - goto err_del_dev; - } - - if (!bus && !qdev_get_machine_hotplug_handler(dev)) { - /* No bus, no machine hotplug handler --> device is not hotpluggable */ - error_setg(errp, "Device '%s' can not be hotplugged on this machine", - driver); - goto err_del_dev; - } + if (phase_check(PHASE_MACHINE_READY) && + !qdev_hotplug_allowed(dev, bus, errp)) { + goto err_del_dev; } /* From patchwork Mon Jan 13 17:36:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 856938 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp1546238wrc; Mon, 13 Jan 2025 09:38:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXcOVVGaONz+xmzkutYdmLLSY+8ZH+T12MEeJLq/6mXdQtYzp2DsHAOK68knVutP9ZGWLvLgA==@linaro.org X-Google-Smtp-Source: AGHT+IEwXQ/osN5qXya45b4kZrWpf8lLC7t8qlrJaOYw3LlMW4KtKnVPMZSPaPV9ek0jA3AkPuPr X-Received: by 2002:a05:6214:501a:b0:6df:9740:68a3 with SMTP id 6a1803df08f44-6df9b2b3231mr393965466d6.38.1736789934256; Mon, 13 Jan 2025 09:38:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736789934; cv=none; d=google.com; s=arc-20240605; b=XYoA3eAVMXWC0DqL3ADsBPvBHg24KIPq582iprJfn4RrI9QQQJucDw6utT2OzBHJvx vaIa5Djxv1LYglitoRei/3eN20nz8zVwRM2VRJFmKnLxUnBH6KXCRYLGTDmdIDhLdV4i 7jm0HBGepFOkChGwPmRu9AXgT3db68jXwUOQO3ncy+I/F1xPTVonHi4/J3yN6/Odt2IS q3WjDw4OFsBDhixBgn1xkuQJfAJiFXWucDLX/YOrHVoKib5rEOHNQmCk4EaYA2S+13gD rvRNHSRhA8sOl5RpmdM2ndOvUd8RwxrDhnMtd2v5436fX9BstLh/gIrjx865qnwqNsuc Z7ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HyhgHy5lutIfTsw5uCOmzhS68O1wU1WLlga8mlFXRVY=; fh=VLoBKQbFMlzRbsMYzkJiJ+BGo/GTHSJUCe+Rui8l45g=; b=arwXN2y51RuOFJ1dmdtmyqf43WIKX0rs0GDmVnQbEDlSa7++oJy7GBe/0aFTVoFxfO cKowBCEDDi/aPDw4WpiPlZ0yzsVS7WxTDUkoQ8/JYcq58vSwX+SdKTfwgCap/tbarn9F CflMZ/S+PAReAKawG0jGT3OdriL0zwo6OeZNsaAEtFaB3diXozSW2bcAv1sj3WCsr11x BIOxl6tnnzmJHYyAgAoQqhJmuDfgpmSI43iTtp5zB8ouR9aRNCE/H77qKnNKfMFoPDmG gUuz46cq7aB63bWb4fs7Sxj6dLLoA7OPZjI/LMOMKyKWyw5+hbdABnGV71pJY6R6GKjB kqCQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PFZHJVVs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46c87415ec8si91729191cf.574.2025.01.13.09.38.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Jan 2025 09:38:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PFZHJVVs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tXONL-00037S-IB; Mon, 13 Jan 2025 12:37:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tXOMn-0002L2-6j for qemu-devel@nongnu.org; Mon, 13 Jan 2025 12:36:48 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tXOMl-00072Q-GV for qemu-devel@nongnu.org; Mon, 13 Jan 2025 12:36:44 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-436a39e4891so32067885e9.1 for ; Mon, 13 Jan 2025 09:36:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736789800; x=1737394600; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HyhgHy5lutIfTsw5uCOmzhS68O1wU1WLlga8mlFXRVY=; b=PFZHJVVsckWNauKHEOMtPaEGpbye3zVcihsoBDeQhFDswHYftoAGDa2mTh1IVKvwec tkVSCBb/cCMzMNQbefhzSd9CT87Q6468AAw51QmLZ0Y2hqlwTjpf9FoTq+ZwpbrNJ5fh ioBBailgqIRKmXQcDNXC1m43o1ss0m3xcu+0snlO6ymK0/LsYl1tFHLl8eBGH3fgHsF1 JkFsaZr/Dw1iZRD0c3z3I+sAUqrcFbdqUAhr/YnbHE1/zyRy7kiTA9i/WkiDFWfRA/lb NjX1TLsgnlIqet413kUD2qJ3ZxIANR+c8jG9fzQhfKYPFNjsja6w8B4qTMU2eHp4e85k yDew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736789800; x=1737394600; 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=HyhgHy5lutIfTsw5uCOmzhS68O1wU1WLlga8mlFXRVY=; b=Gm5TmGe9Uy2i+UqnklRBVEcdNE5WzCm3ac5jHhWPUNZGls4MkKOECXO4b39hCZf+qk 73/SKT0THsCjpdPlmGKGp4hQgXo2SXvetL5CifploR7m9bf8Nkwt7l4vdp+kLd9FlKH+ Hz4mj6KDrCb5ndCb0iMcqT7RA71jFIlOdjr1QgQgxz9fQZ8EtMSpT/0aNEqeNKrpeCNT OhcfUJlZbvdButPNHalMUo7AYRwVOIAPRvCwbg+zJivBBQUsCJNOQXvvqZuQnPY9CzCx 79nLpSHqp+vbZGDMGgyiX3Z+/HiepBqQNdKt9k7O09PRoZit+mR1TkMcJ3goNdbVol1K 5LYA== X-Gm-Message-State: AOJu0YyfE97v3jdnavwsVucSICKTmmFqdCwAkBoqGNPkZPqYaw260du6 fmnUX/J3YgPKkWGfkNeBe3qvoxA5ox3yRLneRFKf8zpbtDhw4PsQNcDAqg1WiVAFl2pY23VCQuv ilcg= X-Gm-Gg: ASbGncvvmBQ9gj963z2NpkvycwvwlWpzf6VZwyocuej+9mqSMDqJ+fCcNvkw6TWxgpw HLARDyhC49Hlw3oqdrJLbd0LouyNgHVFtILDrjkyAqYw4VENMn6iCbUCsc0irwPNbQv0/biUu8a dzL+oWzrNJaqeyz505Oe6ezFlwZdNEqNG7e6/OjcZo1eKKPE0rIXnP9VcAKLsyN2WWo8jMWyJ9I u/let2MJdI68GMm0XAeHKS8XVznY3dn2kAz9Cl1Y+uztNZ1X+81lx/cPw4turAvVl9J8lHa9cSH gmbGbrvkJsnTzsxeIKWKBnJPnE1sAak= X-Received: by 2002:a05:600c:314f:b0:435:9ed3:5688 with SMTP id 5b1f17b1804b1-436e26a1f79mr218206415e9.18.1736789799982; Mon, 13 Jan 2025 09:36:39 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e2da6336sm185094455e9.8.2025.01.13.09.36.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Jan 2025 09:36:39 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jiaxun Yang , =?utf-8?q?Signed-off-by=3A_Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= Subject: [PULL v2 55/55] Add a b4 configuration file Date: Mon, 13 Jan 2025 18:36:04 +0100 Message-ID: <20250113173604.46931-8-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250113173604.46931-1-philmd@linaro.org> References: <20250113173604.46931-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Jiaxun Yang b4 [1] is a convenient tool to manage patch series with mailing list working flow. Add a project default config file to match QEMU's mailing list conventions as well as adopting differences on scripting. Examples of b4: ``` $ b4 prep --check Checking patches using: scripts/checkpatch.pl -q --terse --no-summary --mailback - --- Signed-off-by: Jiaxun Yang --- Changes in v2: - Add lore masks (philmd) from: https://lore.kernel.org/qemu-devel/20241224135054.10243-1-philmd@linaro.org/ - Link to v1: https://lore.kernel.org/r/20241222-b4-config-v1-1-b3667beb30a4@flygoat.com --- ● cc5a4c890fed: Add a b4 configuration file ● checkpatch.pl: 27: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? --- Success: 0, Warning: 1, Error: 0 ``` ``` $ b4 prep -c Will collect To: addresses using echo Will collect Cc: addresses using get_maintainer.pl Collecting To/Cc addresses + To: qemu-devel@nongnu.org --- You can trim/expand this list with: b4 prep --edit-cover Invoking git-filter-repo to update the cover letter. New history written in 0.02 seconds... Completely finished after 0.06 seconds ``` [1]: https://b4.docs.kernel.org/ Co-developed-by: Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Jiaxun Yang Message-ID: <20250102-b4-config-v2-1-cc7299e399bb@flygoat.com> Signed-off-by: Philippe Mathieu-Daudé --- .b4-config | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .b4-config diff --git a/.b4-config b/.b4-config new file mode 100644 index 00000000000..4b9b2fe290f --- /dev/null +++ b/.b4-config @@ -0,0 +1,14 @@ +# +# Common b4 settings that can be used to send patches to QEMU upstream. +# https://b4.docs.kernel.org/ +# + +[b4] + send-series-to = qemu-devel@nongnu.org + send-auto-to-cmd = echo + send-auto-cc-cmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback + am-perpatch-check-cmd = scripts/checkpatch.pl -q --terse --no-summary --mailback - + prep-perpatch-check-cmd = scripts/checkpatch.pl -q --terse --no-summary --mailback - + searchmask = https://lore.kernel.org/qemu-devel/?x=m&t=1&q=%s + linkmask = https://lore.kernel.org/qemu-devel/%s + linktrailermask = Message-ID: <%s>