From nobody Thu Sep 3 07:04:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1787534456; cv=none; d=zohomail.com; s=zohoarc; b=ian+x0Bn6hele9/yIztNMhXvHuXd3G4rUFaQzDzkYu4aXTD5Z7PwuAlsBm9IDZPo3lcIuPzlt2KoYBMNFNCS2XZ+UlhpnJMYtoyfoP3r1xhNXIlxJKvSDYqu2cDTuBoAKUP6t2+lBdlBhJKIuwmXDrqXnz5O/61zmb6GagMZU7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787534456; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=R5A5rX8ZNolp5d6iXru1bTvNH5HsxNPxzQWKsW5ngQk=; b=UXKW67MVgaF1CsAPzjE6G+IjmO1ml0insXyJ9N7Rm/fC6ayvByDoVCJ0Gn8e6ZM3DVly3VL3qh39eSfKYROv1FGMl6qjrIC1VlCzdZtXcjKb3TobyIb1AGVq9oh4pxBHcZqsCWIm0mfUaevZ/sPm78vVVNYf6GgaVREbQ+AXANs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1787534456979701.5719419129781; Sun, 23 Aug 2026 18:20:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1398597.1634769 (Exim 4.92) (envelope-from ) id 1wyJMI-00074k-N1; Mon, 24 Aug 2026 01:20:18 +0000 Received: by outflank-mailman (output) from mailman id 1398597.1634769; Mon, 24 Aug 2026 01:20:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyJMI-00074V-HZ; Mon, 24 Aug 2026 01:20:18 +0000 Received: by outflank-mailman (input) for mailman id 1398597; Mon, 24 Aug 2026 01:20:17 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyJMH-00070j-3C for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 01:20:17 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wyJMG-00Cy13-2O for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 03:20:16 +0200 Received: from [10.42.69.1] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a8b9c46-2eae-0a2a0a5409dd-0a2a4501a1d6-2 for ; Mon, 24 Aug 2026 03:20:16 +0200 Received: from [205.220.165.32] (helo=mx0a-00069f02.pphosted.com) by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a8b9c4e-5984-0a2a45010019-cddca5202e80-3 for ; Mon, 24 Aug 2026 03:20:15 +0200 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67NNoaSp184913; Mon, 24 Aug 2026 01:19:53 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4g73n79bq9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:19:53 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 67O1FUFU013327; Mon, 24 Aug 2026 01:19:52 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4g84kh6xjv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:19:51 +0000 (GMT) Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 67O1JmVr024683; Mon, 24 Aug 2026 01:19:51 GMT Received: from localhost.localdomain (ca-dev80.us.oracle.com [10.211.9.80]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 4g84kh6xgy-2; Mon, 24 Aug 2026 01:19:51 +0000 (GMT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=corp-2025-04-25 header.d=oracle.com header.i="@oracle.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=R5A5r X8ZNolp5d6iXru1bTvNH5HsxNPxzQWKsW5ngQk=; b=gexwkAxCTCU2CTSujcgAK 3b40guQVoS/q1ESM3aJSUtXJBCg0qBsResRkB2M8et1OZhAYd5AfOADKiZFK/9yW zVTXzoIVmND4T2DxKG9/n6yY3sd6MDElh4006CGkkrG8EClIyT5DdXKmC0RZK6tW izvuAndZ5I01MA1cV2Bo3edh3sCIW2taWutahqRAej+Ae7l07omLFWsyPqtb7xFX MNFS3Dj147awOAezMukwigAmo90TekjjY+Xb7tOEs/85+dkNd4kALHnZINMyfr2R wpC8fIDrSxc5/sEeNjMUPitQmxWEu0ofbLNa3VSH1NudrD7PTAoDilxeG9w32iEP Q== From: Dongli Zhang To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org Cc: dave@treblig.org, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, philmd@mailo.com, aurelien@aurel32.net, mjrosato@linux.ibm.com, alifm@linux.ibm.com, farman@linux.ibm.com, richard.henderson@linaro.org, iii@linux.ibm.com, david@kernel.org, pasic@linux.ibm.com, borntraeger@linux.ibm.com, cohuck@redhat.com, alex@shazbot.org, clg@redhat.com, akrowiak@linux.ibm.com, jjherne@linux.ibm.com, sstabellini@kernel.org, anthony@xenproject.org, edgar.iglesias@gmail.com, pbonzini@redhat.com, berrange@redhat.com, eblake@redhat.com, armbru@redhat.com, joe.jin@oracle.com Subject: [PATCH 1/8] qdev: Add force argument to qdev_unplug Date: Sun, 23 Aug 2026 18:13:31 -0700 Message-ID: <20260824011420.752806-2-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260824011420.752806-1-dongli.zhang@oracle.com> References: <20260824011420.752806-1-dongli.zhang@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-24_01,2026-08-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2608240009 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfX0pZHNniCXxvo +jYK89Xqx9BAiviF5TDhspqHIW99mm31IX6CyflKwUVl4yjJq97il/iY4iuqP+Z806+R1k78DX/ RxzPoZv4I7SqKF9v8pJNyZhIlIjIVFRzLIAWKgpf02BgLC+kXyjx9tRGvIVwLyJb0l1ZDyOVi6l g2z7npr3VTEALBmvYct58QWhdGTGDJhN8cYem57Em8MJQV5CR+5+ZNCxdAZahWF/ORj0pWtmAup dmZtx/b2/QIOIFvM99diCzYM90nMqW1xPNw/aUMN9sCvlo67oovCYRzHYxXwFfFotrARKhgQ7ms vE6ReUgiewTyerpp1V5QkaaBTdetvJr1lK2UsvF7Qh4u+6nMZak5n2p7OTZCYuWfJSF5cNsF87j xptUB80Gg09hbRA4BHVmANBGETue9A/ma014LFXodMcjHj7fCV1C+xT8VQl2qWU8lm7pdWGvkqH zMpM8usZTyeSOAYkE0mTcCEhmKWF+X9vCUL0ZZsw= X-Proofpoint-ORIG-GUID: zjVPwpTg9rN1xiA-29n-6Ur4p4ty26Y7 X-Authority-Analysis: v=2.4 cv=Os9/DS/t c=1 sm=1 tr=0 ts=6a8b9c39 b=1 cx=c_pps a=e1sVV491RgrpLwSTMOnk8w==:117 a=e1sVV491RgrpLwSTMOnk8w==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=EIcjfB9IiI4px24ztqRk:22 a=yPCof4ZbAAAA:8 a=DmdIBfvRwVG_7NqPh9cA:9 a=O8hF6Hzn-FEA:10 a=5yU3S35YU4bGjq-dph-N:22 a=Bho9c0fBagfJEIQBS7DQ:22 cc=ntf awl=host:13521 X-Proofpoint-Spam-Info: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfX3/8k42mkVOnG 5hfcO/Qymt00VmDX9zzro68WRF+zuLyRDXj2XcOGiqF+VWdd+i0MFvP0zFX7BGXvg3jSzWxnFG8 CDp5NJP1zNEOhZlN0rwLTfGnn4OPrTlR9V8HciqVOSkAtTMww6yK X-Proofpoint-GUID: zjVPwpTg9rN1xiA-29n-6Ur4p4ty26Y7 X-purgate-ID: tlsNG-d62444/1787534416-C4F47757-E080D29F/0/0 X-purgate-type: clean X-purgate-size: 5214 X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1787534457264158500 Content-Type: text/plain; charset="utf-8" Add a force argument to qdev_unplug() and update all existing callers to pass false. No functional change. The upcoming patches will add the hotplug controller callback used to implement it to force detach a PCI device. Signed-off-by: Dongli Zhang Reviewed-by: Jason J. Herne --- hw/s390x/s390-pci-bus.c | 4 ++-- hw/vfio/ap.c | 2 +- hw/vfio/ccw.c | 2 +- hw/vfio/pci.c | 2 +- hw/xen/xen-legacy-backend.c | 2 +- hw/xen/xen_pvdev.c | 2 +- include/hw/core/qdev.h | 2 +- system/qdev-monitor.c | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index eff980fdfe..11ff9bcce5 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1276,7 +1276,7 @@ static void s390_pcihost_unplug_request(HotplugHandle= r *hotplug_dev, } =20 pbdev->pci_unplug_request_processed =3D true; - qdev_unplug(DEVICE(pbdev), errp); + qdev_unplug(DEVICE(pbdev), false, errp); } else if (object_dynamic_cast(OBJECT(dev), TYPE_S390_PCI_DEVICE)) { pbdev =3D S390_PCI_DEVICE(dev); =20 @@ -1287,7 +1287,7 @@ static void s390_pcihost_unplug_request(HotplugHandle= r *hotplug_dev, * is not blocked, e.g. because it's a PCI bridge). */ if (pbdev->pdev && !pbdev->pci_unplug_request_processed) { - qdev_unplug(DEVICE(pbdev->pdev), errp); + qdev_unplug(DEVICE(pbdev->pdev), false, errp); return; } pbdev->pci_unplug_request_processed =3D false; diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c index 6e2a1223ea..8e7c72dc8b 100644 --- a/hw/vfio/ap.c +++ b/hw/vfio/ap.c @@ -79,7 +79,7 @@ static void vfio_ap_req_notifier_handler(void *opaque) return; } =20 - qdev_unplug(DEVICE(vapdev), &err); + qdev_unplug(DEVICE(vapdev), false, &err); =20 if (err) { warn_reportf_err(err, VFIO_MSG_PREFIX, vapdev->vdev.name); diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c index c3dc7c1962..c7d48966dc 100644 --- a/hw/vfio/ccw.c +++ b/hw/vfio/ccw.c @@ -282,7 +282,7 @@ static void vfio_ccw_req_notifier_handler(void *opaque) return; } =20 - qdev_unplug(DEVICE(vcdev), &err); + qdev_unplug(DEVICE(vcdev), false, &err); if (err) { warn_reportf_err(err, VFIO_MSG_PREFIX, vcdev->vdev.name); } diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 428ab2f069..aafa841241 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3328,7 +3328,7 @@ static void vfio_req_notifier_handler(void *opaque) return; } =20 - qdev_unplug(DEVICE(vdev), &err); + qdev_unplug(DEVICE(vdev), false, &err); if (err) { warn_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name); } diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c index 7977b52712..4aa0339887 100644 --- a/hw/xen/xen-legacy-backend.c +++ b/hw/xen/xen-legacy-backend.c @@ -186,7 +186,7 @@ static struct XenLegacyDevice *xen_be_get_xendev(const = char *type, int dom, xendev->evtchndev =3D qemu_xen_evtchn_open(); if (xendev->evtchndev =3D=3D NULL) { xen_pv_printf(NULL, 0, "can't open evtchn device\n"); - qdev_unplug(DEVICE(xendev), NULL); + qdev_unplug(DEVICE(xendev), false, NULL); return NULL; } qemu_set_cloexec(qemu_xen_evtchn_fd(xendev->evtchndev)); diff --git a/hw/xen/xen_pvdev.c b/hw/xen/xen_pvdev.c index e36370e2ee..9518f5b3b5 100644 --- a/hw/xen/xen_pvdev.c +++ b/hw/xen/xen_pvdev.c @@ -273,7 +273,7 @@ void xen_pv_del_xendev(struct XenLegacyDevice *xendev) =20 QTAILQ_REMOVE(&xendevs, xendev, next); =20 - qdev_unplug(DEVICE(xendev), NULL); + qdev_unplug(DEVICE(xendev), false, NULL); } =20 void xen_pv_insert_xendev(struct XenLegacyDevice *xendev) diff --git a/include/hw/core/qdev.h b/include/hw/core/qdev.h index 37f7d33551..c1daa74914 100644 --- a/include/hw/core/qdev.h +++ b/include/hw/core/qdev.h @@ -527,7 +527,7 @@ bool qdev_hotunplug_allowed(DeviceState *dev, Error **e= rrp); * or NULL if there aren't any. */ HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev); -void qdev_unplug(DeviceState *dev, Error **errp); +void qdev_unplug(DeviceState *dev, bool force, Error **errp); int qdev_sync_config(DeviceState *dev, Error **errp); void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp); diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 00fed791cc..3606a347a0 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -912,7 +912,7 @@ static DeviceState *find_device_state(const char *id, b= ool use_generic_error, return dev; } =20 -void qdev_unplug(DeviceState *dev, Error **errp) +void qdev_unplug(DeviceState *dev, bool force, Error **errp) { HotplugHandler *hotplug_ctrl; HotplugHandlerClass *hdc; @@ -960,7 +960,7 @@ void qmp_device_del(const char *id, Error **errp) return; } =20 - qdev_unplug(dev, errp); + qdev_unplug(dev, false, errp); } } =20 --=20 2.43.5 From nobody Thu Sep 3 07:04:40 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1787534470; cv=none; d=zohomail.com; s=zohoarc; b=g7zG39xudrpdH6hRMKjYLrjb5Evr39HEy7B4zIDvwP2Nh0BQbTrhHwMgtvyOxReOHccYRco2A4SAH+DuTHadIk1mX270JG3cNGGtbikOTcyGtFv8zrjz8r7Prk0zGc7pxTyRwvC1UDjGbEcdd864g3vJTptegzMBcaM/GqgMBko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787534470; 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=rUdN0aeKDSMQqE11yR1hJ7bU2ydRSC3JxdFwpQzV/nk=; b=OJiMsDK4WfTWzHlFdxcAslyRtgTZNmTTDmCUkWrh7/VKjerKe/rGz7ABas0yA83p2nml/iWdd4vroV+50Sl0SAQPJq4Z1H9TK4ji7/D8N3sXcKTfMv9gxrxrk5eDfYfdFhaBPTbhw5/ZZT6It+PC1ZhGQDc3+CMp3/K3zGVfSkU= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1787534470618355.7047669043485; Sun, 23 Aug 2026 18:21:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wyJMS-0001K1-Ok; Sun, 23 Aug 2026 21:20:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wyJMO-0001Hm-8m; Sun, 23 Aug 2026 21:20:24 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wyJMG-0003To-Q7; Sun, 23 Aug 2026 21:20:21 -0400 Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67NKeTTk080588; Mon, 24 Aug 2026 01:19:56 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4g72p9sd8k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:19:56 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 67O1FUex013276; Mon, 24 Aug 2026 01:19:55 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4g84kh6xkr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:19:54 +0000 (GMT) Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 67O1JmVt024683; Mon, 24 Aug 2026 01:19:54 GMT Received: from localhost.localdomain (ca-dev80.us.oracle.com [10.211.9.80]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 4g84kh6xgy-3; Mon, 24 Aug 2026 01:19:54 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=rUdN0 aeKDSMQqE11yR1hJ7bU2ydRSC3JxdFwpQzV/nk=; b=NCFIEJvt2ZBHnB8T0AxWy ZOXACdKzmXfuTtW7FEFMm2K/ZuyzrInrJZtGHsH7ihoGH993WKuow1razVzq4Wr4 GdZMQTv2ZU8JMNoYeLOzc2HCz1aTyKLjGSFmJtmYYWpLXxSOO7JfYRAbGlVIBNAo 0+HgW2Yf6X/lVDZLclcGl+JazsEtnaPCAkhTcS7/iVtjnA/5HAqh/c1AcS3Y7lko +PKjIk3G3d6qbxEHZZuMzIbznhEIPfyIFDHUSmTAgk0RJvRKuN4qWwp2Ago+JpDl H7Jsta9rkcevTSxQaqoC3UYr1LTLI14RrQ7uqm798paKocIlh1TfjjKFeCcZVx/7 w== From: Dongli Zhang To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org Cc: dave@treblig.org, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, philmd@mailo.com, aurelien@aurel32.net, mjrosato@linux.ibm.com, alifm@linux.ibm.com, farman@linux.ibm.com, richard.henderson@linaro.org, iii@linux.ibm.com, david@kernel.org, pasic@linux.ibm.com, borntraeger@linux.ibm.com, cohuck@redhat.com, alex@shazbot.org, clg@redhat.com, akrowiak@linux.ibm.com, jjherne@linux.ibm.com, sstabellini@kernel.org, anthony@xenproject.org, edgar.iglesias@gmail.com, pbonzini@redhat.com, berrange@redhat.com, eblake@redhat.com, armbru@redhat.com, joe.jin@oracle.com Subject: [PATCH 2/8] qdev: hotplug: Add force_unplug handler callback Date: Sun, 23 Aug 2026 18:13:32 -0700 Message-ID: <20260824011420.752806-3-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260824011420.752806-1-dongli.zhang@oracle.com> References: <20260824011420.752806-1-dongli.zhang@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-24_01,2026-08-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2608240009 X-Proofpoint-ORIG-GUID: G6ZUnmDnatOdqyyPUSBLTMwgv6ngryTY X-Authority-Analysis: v=2.4 cv=EqfiaycA c=1 sm=1 tr=0 ts=6a8b9c3c b=1 cx=c_pps a=e1sVV491RgrpLwSTMOnk8w==:117 a=e1sVV491RgrpLwSTMOnk8w==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=x0eKOSpe3m1H3M0S9YoZ:22 a=yPCof4ZbAAAA:8 a=R0-9NCqHhopK7IinchQA:9 a=5yU3S35YU4bGjq-dph-N:22 a=Bho9c0fBagfJEIQBS7DQ:22 cc=ntf awl=host:13521 X-Proofpoint-GUID: G6ZUnmDnatOdqyyPUSBLTMwgv6ngryTY X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfXxWgLRDFowCsU 5e+mNH+Ar5z8qIYae8wTu+DgxKud9tTIHDzx9xOtBiNas0QiqJSgvtZzng1XokCXEUwPevvItpS K15PQn51jTzyad8GpI1IKHED71M/ZeFSv+jrrATnaDM2jPU9u1Ah54zHBhbApL7cEwKjuyvBn6E K2ZZUaVNyfYte5gyB6dUGYpG+CoHNBn071ncpSUkZFtQCduuiObJwyUrhizr6a7PTB0XyR/DL3H nS/diGOxLEDmdx7RJ9h3VBnI3bQAneooxjI1SXLFgR8O8SdHCP5fVu69LyrSls07OCp4bihD5gy QEzQjCyPwAynUB1TSuLXGsLCrx5wRKrUI9CR3Px39+5h3sy3KrVed6E7ECr2DCSv9CWzvAi8j9g 0/cK1B07edIJHRDcz7b3/Lg2wqo9h930FRrCNKUt7Uusf3x3+iFb6R45W/chExfJdnUk57y1yjR tfOhubkfOiUMtv+GNcp6gCZ4CWxKtQtxiP2IoMBU= X-Proofpoint-Spam-Info: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfXwd+CFlCS9IfR 8VEsTphbiUSSvdZcRBkpKBOm9QlsVre4/GuUwmpUFQGlHeoPCXtj7lqH35E6Ca9CP+cRvz4DASN 0F1r2h/E3xz7o8pAfFRkpEnKv5rnZihU+DSLydPiOvnYvvHfZZZJ 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.165.32; envelope-from=dongli.zhang@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1787534472101158500 Content-Type: text/plain; charset="utf-8" Add a HotplugHandlerClass force_unplug callback and a wrapper used by the generic qdev unplug path. When qdev_unplug() is called with force=3Dtrue, delegate to the hotplug controller if it implements force_unplug. Controllers without the callback return a normal error. This makes forced removal available only for controllers that explicitly implement the operation. Signed-off-by: Dongli Zhang --- hw/core/hotplug.c | 11 +++++++++++ include/hw/core/hotplug.h | 12 ++++++++++++ system/qdev-monitor.c | 10 +++++++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/hw/core/hotplug.c b/hw/core/hotplug.c index 68aabad8ae..0e44d98cf7 100644 --- a/hw/core/hotplug.c +++ b/hw/core/hotplug.c @@ -57,6 +57,17 @@ void hotplug_handler_unplug(HotplugHandler *plug_handler, } } =20 +void hotplug_handler_force_unplug(HotplugHandler *plug_handler, + DeviceState *plugged_dev, + Error **errp) +{ + HotplugHandlerClass *hdc =3D HOTPLUG_HANDLER_GET_CLASS(plug_handler); + + if (hdc->force_unplug) { + hdc->force_unplug(plug_handler, plugged_dev, errp); + } +} + static const TypeInfo hotplug_handler_info =3D { .name =3D TYPE_HOTPLUG_HANDLER, .parent =3D TYPE_INTERFACE, diff --git a/include/hw/core/hotplug.h b/include/hw/core/hotplug.h index a9840ed485..300ac4fa8f 100644 --- a/include/hw/core/hotplug.h +++ b/include/hw/core/hotplug.h @@ -48,6 +48,8 @@ typedef void (*hotplug_fn)(HotplugHandler *plug_handler, * @unplug: unplug callback. * Used for device removal with devices that implement * asynchronous and synchronous (surprise) removal. + * @force_unplug: force unplug callback. + * Used to complete enforced removal without guest cooperat= ion. * @is_hotpluggable_bus: called to check if bus/its parent allow hotplug o= n bus */ struct HotplugHandlerClass { @@ -59,6 +61,7 @@ struct HotplugHandlerClass { hotplug_fn plug; hotplug_fn unplug_request; hotplug_fn unplug; + hotplug_fn force_unplug; bool (*is_hotpluggable_bus)(HotplugHandler *plug_handler, BusState *bu= s); }; =20 @@ -96,4 +99,13 @@ void hotplug_handler_unplug_request(HotplugHandler *plug= _handler, void hotplug_handler_unplug(HotplugHandler *plug_handler, DeviceState *plugged_dev, Error **errp); + +/** + * hotplug_handler_force_unplug: + * + * Calls #HotplugHandlerClass.force_unplug callback of @plug_handler. + */ +void hotplug_handler_force_unplug(HotplugHandler *plug_handler, + DeviceState *plugged_dev, + Error **errp); #endif diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 3606a347a0..fa3cae246b 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -937,7 +937,15 @@ void qdev_unplug(DeviceState *dev, bool force, Error *= *errp) /* If device supports async unplug just request it to be done, * otherwise just remove it synchronously */ hdc =3D HOTPLUG_HANDLER_GET_CLASS(hotplug_ctrl); - if (hdc->unplug_request) { + + if (force) { + if (!hdc->force_unplug) { + error_setg(&local_err, "Device '%s' does not support forced un= plug", + dev->id ? dev->id : object_get_typename(OBJECT(dev)= )); + } else { + hotplug_handler_force_unplug(hotplug_ctrl, dev, &local_err); + } + } else if (hdc->unplug_request) { hotplug_handler_unplug_request(hotplug_ctrl, dev, &local_err); } else { hotplug_handler_unplug(hotplug_ctrl, dev, &local_err); --=20 2.43.5 From nobody Thu Sep 3 07:04:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1787534449; cv=none; d=zohomail.com; s=zohoarc; b=fDE5h1GGAEJ1WyLkm+otxAJdcyqptxybVB8pgB3GC5LGExoN8ZJC5/aOaTm3BOaAwCLC1pBxpy5UXD9RyZF4Hfd41P9Gsy5U4vBKBAIBJRQgoL81I9XPNg82OhovvMQQg3uv+9ILdY1eJ96S54UHgfqxhvUQQ9tK6ZehUEjVdgg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787534449; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=o1MVWyxP3jMV2LjBZ5MFVpAxRVDRz0Duhs68xTBpXHQ=; b=HitKks1IEOIOs011sBASFmqEX135xs5atpn8WFmJZPocWWPGDkYtQZBKgQsBhHlYBdUt63nJkIZcqKMKe0WQsyf03bDqpOvBtSfQWYw7DfTib7vQf8W7f9FKdTvDxsO5I5dK8xb/tDtzW8LzqDmyNNlmXIuw0nSrKluN3YeVG8c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1787534449015229.53355281173754; Sun, 23 Aug 2026 18:20:49 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1398596.1634763 (Exim 4.92) (envelope-from ) id 1wyJMI-000720-Ct; Mon, 24 Aug 2026 01:20:18 +0000 Received: by outflank-mailman (output) from mailman id 1398596.1634763; Mon, 24 Aug 2026 01:20:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyJMI-00071s-AJ; Mon, 24 Aug 2026 01:20:18 +0000 Received: by outflank-mailman (input) for mailman id 1398596; Mon, 24 Aug 2026 01:20:16 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyJMG-00070g-IX for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 01:20:16 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wyJMF-008wuR-Vd for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 03:20:15 +0200 Received: from [10.42.69.10] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a8b9c21-bab6-0a2a0a5309dd-0a2a450ae05e-10 for ; Mon, 24 Aug 2026 03:20:15 +0200 Received: from [205.220.165.32] (helo=mx0a-00069f02.pphosted.com) by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a8b9c4d-f2d2-0a2a450a0019-cddca5202b3e-3 for ; Mon, 24 Aug 2026 03:20:15 +0200 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67NNGJJp129681; Mon, 24 Aug 2026 01:19:59 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4g73n79bqb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:19:59 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 67O1FUMx013225; Mon, 24 Aug 2026 01:19:58 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4g84kh6xmk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:19:57 +0000 (GMT) Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 67O1JmVv024683; Mon, 24 Aug 2026 01:19:57 GMT Received: from localhost.localdomain (ca-dev80.us.oracle.com [10.211.9.80]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 4g84kh6xgy-4; Mon, 24 Aug 2026 01:19:57 +0000 (GMT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=corp-2025-04-25 header.d=oracle.com header.i="@oracle.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=o1MVW yxP3jMV2LjBZ5MFVpAxRVDRz0Duhs68xTBpXHQ=; b=J34IT8lY11ReMNdj8nfV8 twCPp2ctcv+ehSDUl4DjBCA6u8hLI7PU++mpmzahIeZZmguU+qlfBJTF8Kzaq0me nxNQnivcq7r3eAX/OORaK34CwLSlZuqcwd5b3Cp+9OqFFZ8+CmU0ZfgBPmat25aa KWn/m1Vd7aGwDPcKYAnF0oQJdh0TcZO7mFmSji/18THmvLVNO5lk1BCaeM6fTqL2 1BHXO1jAu06BSI56mAUlzw/lVtkDSELIz/kUNKfkDnc2BpMrg/COOuh51YNzDsb8 5pwPX+rTs/OPA25hBf5J0krnTf9aWJDTETmiWNiFLVUZEkqi7vZgQ5N6GLPweb2+ w== From: Dongli Zhang To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org Cc: dave@treblig.org, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, philmd@mailo.com, aurelien@aurel32.net, mjrosato@linux.ibm.com, alifm@linux.ibm.com, farman@linux.ibm.com, richard.henderson@linaro.org, iii@linux.ibm.com, david@kernel.org, pasic@linux.ibm.com, borntraeger@linux.ibm.com, cohuck@redhat.com, alex@shazbot.org, clg@redhat.com, akrowiak@linux.ibm.com, jjherne@linux.ibm.com, sstabellini@kernel.org, anthony@xenproject.org, edgar.iglesias@gmail.com, pbonzini@redhat.com, berrange@redhat.com, eblake@redhat.com, armbru@redhat.com, joe.jin@oracle.com Subject: [PATCH 3/8] qdev: Support forced device_del in QMP and HMP Date: Sun, 23 Aug 2026 18:13:33 -0700 Message-ID: <20260824011420.752806-4-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260824011420.752806-1-dongli.zhang@oracle.com> References: <20260824011420.752806-1-dongli.zhang@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-24_01,2026-08-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2608240009 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfX1V1IPWwVdfcS eXs0te3xFWOXdO6BoZvxCXT4GQCSBT5R7F0d4BADl7L3lUHuOr3RTWRzkbth0unfBU5m53HmZI0 dkfqdGo78ppGi3v5PMed89Nele1DU6zhW2N/4ok48vOY5mDIx2WmQZno8d/cliY8/xKywCLPuGt 8pGIPioXNu4/XB2iw/zjQPnCS2HHo0MhBZ4V4dxfWN6xVWhUxi8jo6MLKZvsIBw6RR/E0Mnpy7P QdHaI2AqIcfM9p0WcgmJvFi81Eq9WUUEYwngL4LUdCQo/hCC8FTAyRys8VxQeaDNGt+k3jkcRm/ EHNlHNzvsMpocACMEN5tgoZcG6IblPP92/zYXjIoI34yATnASWGDK3hrqqlqMZNd6cILEoC8mRk rXG8Re+Fjq1EnAfYiId8nEtfSB1Mdj4u7CJTprtMlC2RUcJnLuqsHh255y4ODTDJun9O7yh+DMR YoeP6J8/sUmKpvM49GZxfDeLGTjJf0L0aLRQ59Eo= X-Proofpoint-ORIG-GUID: 7H4XMNOBu3TKzfSJd7HuTZ9YSddM9Gng X-Authority-Analysis: v=2.4 cv=Os9/DS/t c=1 sm=1 tr=0 ts=6a8b9c3f b=1 cx=c_pps a=e1sVV491RgrpLwSTMOnk8w==:117 a=e1sVV491RgrpLwSTMOnk8w==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=EIcjfB9IiI4px24ztqRk:22 a=yPCof4ZbAAAA:8 a=VK-ukoX-n8eK6wX5QKAA:9 a=5yU3S35YU4bGjq-dph-N:22 a=Bho9c0fBagfJEIQBS7DQ:22 cc=ntf awl=host:13521 X-Proofpoint-Spam-Info: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfX4rgmhFCdIY8n y/gjdQdOF3Gaw9tA7jadsiTfFTbwMzSeg/I1l8qb8sSzCVzEhJQQTzTPOEGO8c4SycTXhsyE+Gb YGJe5qwQxtOC3ezaxm6/32s5tFE7hopLJW2pmrpbWR5T1f6XZE8c X-Proofpoint-GUID: 7H4XMNOBu3TKzfSJd7HuTZ9YSddM9Gng X-purgate-ID: tlsNG-4011c0/1787534415-536D6CFC-6F581DA1/0/0 X-purgate-type: clean X-purgate-size: 4161 X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1787534449456158500 Content-Type: text/plain; charset="utf-8" Add an optional force argument to the QMP device_del command and expose it in HMP as "device_del -f". When force is requested, qdev_unplug() bypasses the pending deletion guard and asks the selected hotplug controller to complete removal through its force_unplug callback. Controllers that do not implement the callback reject the operation. Forced removal bypasses guest cooperation. Signed-off-by: Dongli Zhang --- hmp-commands.hx | 11 ++++++----- qapi/qdev.json | 11 +++++++++-- system/qdev-monitor.c | 11 +++++++---- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 43ff220b5f..022502b20f 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -708,17 +708,18 @@ ERST =20 { .name =3D "device_del", - .args_type =3D "id:s", - .params =3D "device", - .help =3D "remove device", + .args_type =3D "force:-f,id:s", + .params =3D "[-f] device", + .help =3D "remove device, use -f to force removal", .cmd =3D hmp_device_del, .command_completion =3D device_del_completion, }, =20 SRST -``device_del`` *id* +``device_del`` [*-f*] *id* Remove device *id*. *id* may be a short ID - or a QOM object path. + or a QOM object path. Use -f to force removal without waiting for + guest cooperation. ERST =20 { diff --git a/qapi/qdev.json b/qapi/qdev.json index 974cf9c583..cb5b5ad1db 100644 --- a/qapi/qdev.json +++ b/qapi/qdev.json @@ -90,6 +90,11 @@ # # @id: the device's ID or QOM path # +# @force: if true, remove the device without waiting for guest +# cooperation. The guest may still be using the device. This can +# cause guest-visible errors, I/O failures, or guest crashes. +# (since 11.2) +# # Errors: # - If @id is not a valid device, DeviceNotFound # @@ -101,7 +106,9 @@ # will automatically complete removal for all devices. If a # guest-side error in the hot removal process is detected, the # device will not be removed and a `DEVICE_UNPLUG_GUEST_ERROR` -# event is sent. Some errors cannot be detected. +# event is sent. Some errors cannot be detected. If @force is +# true, guest cooperation is bypassed, but backend cleanup is still +# performed through the device's normal unrealize path. # # Since: 0.14 # @@ -117,7 +124,7 @@ # "arguments": { "id": "/machine/peripheral-anon/device[0]" } } # <- { "return": {} } ## -{ 'command': 'device_del', 'data': {'id': 'str'} } +{ 'command': 'device_del', 'data': {'id': 'str', '*force': 'bool'} } =20 ## # @DEVICE_DELETED: diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index fa3cae246b..ca10a25c46 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -956,11 +956,13 @@ void qdev_unplug(DeviceState *dev, bool force, Error = **errp) error_propagate(errp, local_err); } =20 -void qmp_device_del(const char *id, Error **errp) +void qmp_device_del(const char *id, bool has_force, bool force, Error **er= rp) { DeviceState *dev =3D find_device_state(id, false, errp); + bool do_force =3D has_force && force; + if (dev !=3D NULL) { - if (dev->pending_deleted_event && + if (!do_force && dev->pending_deleted_event && (dev->pending_deleted_expires_ms =3D=3D 0 || dev->pending_deleted_expires_ms > qemu_clock_get_ms(QEMU_CLOC= K_VIRTUAL))) { error_setg(errp, "Device %s is already in the " @@ -968,7 +970,7 @@ void qmp_device_del(const char *id, Error **errp) return; } =20 - qdev_unplug(dev, false, errp); + qdev_unplug(dev, do_force, errp); } } =20 @@ -1046,9 +1048,10 @@ out: void hmp_device_del(Monitor *mon, const QDict *qdict) { const char *id =3D qdict_get_str(qdict, "id"); + bool force =3D qdict_get_try_bool(qdict, "force", false); Error *err =3D NULL; =20 - qmp_device_del(id, &err); + qmp_device_del(id, true, force, &err); hmp_handle_error(mon, err); } =20 --=20 2.43.5 From nobody Thu Sep 3 07:04:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1787534449; cv=none; d=zohomail.com; s=zohoarc; b=TBwIVP9ViAPkgmUstEKtgnHW0nJIiJXrFy4rO1XNenfUjqnrF4ci/fGqjN1lGR3bwOWW6YT0tUozYn1+Ei4kBRsUj5PKaIohYQ3DrS3hO7cVmVR+XQ/GGBgf04M7+SUGsxUKBMiqohJoMX74gU9gSU1Y3nJXFbgoQSolmqSx/t4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787534449; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=clxy8VJLIb7ZVJZkEiuc8N2CQZhizNUvRA7//cEUtk4=; b=lCTXvIGB02fPA9OEFqWhggcLMWi41dChmV5cPln/0CpQSySeHUTDpUGlyWSdIfK4JcNkfNArtczQi2vOjhHJ6kICWW7aN4aPiONKLNnvDPS8uphiM/JRwyZHsyHTxJ/8oDisYb8t7p51drdvQ3gkqxJkMX+zyAtN4+ZzhVDAqeI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1787534449546103.19668254403973; Sun, 23 Aug 2026 18:20:49 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1398598.1634781 (Exim 4.92) (envelope-from ) id 1wyJMJ-0007S4-UA; Mon, 24 Aug 2026 01:20:19 +0000 Received: by outflank-mailman (output) from mailman id 1398598.1634781; Mon, 24 Aug 2026 01:20:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyJMJ-0007Rd-Or; Mon, 24 Aug 2026 01:20:19 +0000 Received: by outflank-mailman (input) for mailman id 1398598; Mon, 24 Aug 2026 01:20:18 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyJMH-00071F-Rp for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 01:20:17 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wyJMH-00AZzb-8q for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 03:20:17 +0200 Received: from [10.42.69.6] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a8b9c28-e002-0a2a0a5209dd-0a2a45068ddc-16 for ; Mon, 24 Aug 2026 03:20:17 +0200 Received: from [205.220.177.32] (helo=mx0b-00069f02.pphosted.com) by tlsNG-16d1c6.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a8b9c4f-195a-0a2a45060019-cddcb12056a8-3 for ; Mon, 24 Aug 2026 03:20:17 +0200 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67NNt1FC4056749; Mon, 24 Aug 2026 01:20:02 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4g72j1sdhp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:20:01 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 67O1FUje013312; Mon, 24 Aug 2026 01:20:01 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4g84kh6xne-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:20:01 +0000 (GMT) Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 67O1JmVx024683; Mon, 24 Aug 2026 01:20:00 GMT Received: from localhost.localdomain (ca-dev80.us.oracle.com [10.211.9.80]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 4g84kh6xgy-5; Mon, 24 Aug 2026 01:20:00 +0000 (GMT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=corp-2025-04-25 header.d=oracle.com header.i="@oracle.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=clxy8 VJLIb7ZVJZkEiuc8N2CQZhizNUvRA7//cEUtk4=; b=hvsHAuMhUGs6xaYlqVxp/ bo5JnIHFTW1HpVlJmyaHv30W0b6+NG/pTtZ7S2WHEsBeRMfPDwiOs/eB5p6H8/vW 2TDcJQfJ0hcXSSxCc5MMecZAUQGcYYkm+QWUTM9WwL4rlcrRMOGDze/sBUHVcglu C5rB/ZccJHTjE3kNE1sPg4LF/iKWWZBWZAgQ1MSMcI3T6GabaUerFmEgZL5/IUjw zmEfWDRWRLxGoKSbKDl+RqHEYG+E5jMxLP5BaPE97u4UcHp/UsMGT59rawmPPECX cC+ulxmbQ5VTaLqSG0W9Oqc9bafXSnG+Q9DqM1+tC5zJzNZ8aOOX8vCxTxvNPIGH A== From: Dongli Zhang To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org Cc: dave@treblig.org, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, philmd@mailo.com, aurelien@aurel32.net, mjrosato@linux.ibm.com, alifm@linux.ibm.com, farman@linux.ibm.com, richard.henderson@linaro.org, iii@linux.ibm.com, david@kernel.org, pasic@linux.ibm.com, borntraeger@linux.ibm.com, cohuck@redhat.com, alex@shazbot.org, clg@redhat.com, akrowiak@linux.ibm.com, jjherne@linux.ibm.com, sstabellini@kernel.org, anthony@xenproject.org, edgar.iglesias@gmail.com, pbonzini@redhat.com, berrange@redhat.com, eblake@redhat.com, armbru@redhat.com, joe.jin@oracle.com Subject: [PATCH 4/8] hw/acpi/pcihp: Add forced slot unplug helper Date: Sun, 23 Aug 2026 18:13:34 -0700 Message-ID: <20260824011420.752806-5-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260824011420.752806-1-dongli.zhang@oracle.com> References: <20260824011420.752806-1-dongli.zhang@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-24_01,2026-08-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2608240009 X-Proofpoint-Spam-Info: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfX2FZAv+NEUzMh 0/f+D6S5WYim0n+8BmCp6KjrBXbs+jJMsdc5T6R3e9Xkl2pF6lgcmCWIyomY8ag7ITGJfRjgbmp GNrmiT0ppLxwZz8+mxz5cpK1saXK0NOosQmGm/EqiHgS0Sx5vbG5 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfXyJNsWrGl5CgZ 2HDfYy7qKdHFHQqmRLTgn/EHqM17beE4ci0yr9qKKO/1ZB5eY19THVJurYZY62rst7Szl9uDbe0 O477WhCm610LcWZEDH3mnTid139r/318CtQalmAfQB3qoaYddB+FiGMcjeWJBdnndIebrZemEG/ kAMmVRrxn7HvSKKQBAlzgSzdybZU3ZXh0Jd4DBwiNMsAxaQyWSovQB8T7Mxxj36234cIp2xZSyE UslijqD6FqtBW2ZhzES7idcXNlyuUA23wSN/hzJTO1ZXKypghjuV0YDKQr9K6k6O2SSOtJT7x62 cYjn8fxIrQalceoRiIY8Ocj6VGib1LfLnygWMyhrRXPkPZ8DSDrDjQj21f8OOpK8wkjVBncSnJ8 UZLpdXFJzwaI5KPf2giTtoOIheR5XxKK0RXjRfF0xIfp8pr5+PIgq5NCGPrDG714LQOpzwtwvcA egfsm6g3eE+pDoR3WVl6fNz7/uPHVGPiayaIflXU= X-Proofpoint-GUID: Cx5bsTKMuR6dct4cv0ju6y6bw1dVa-YM X-Authority-Analysis: v=2.4 cv=Wek8rUhX c=1 sm=1 tr=0 ts=6a8b9c41 b=1 cx=c_pps a=e1sVV491RgrpLwSTMOnk8w==:117 a=e1sVV491RgrpLwSTMOnk8w==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=o5oIOnhZENCTenyL_yNV:22 a=yPCof4ZbAAAA:8 a=ux9k6O4l50MFplsCWjgA:9 a=5yU3S35YU4bGjq-dph-N:22 a=Bho9c0fBagfJEIQBS7DQ:22 cc=ntf awl=host:13521 X-Proofpoint-ORIG-GUID: Cx5bsTKMuR6dct4cv0ju6y6bw1dVa-YM X-purgate-ID: tlsNG-16d1c6/1787534417-1F4C977B-BF8E7114/0/0 X-purgate-type: clean X-purgate-size: 2978 X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1787534451256158500 Content-Type: text/plain; charset="utf-8" Add acpi_pcihp_device_force_unplug_cb() to complete PCI slot removal through the existing ACPI PCI hotplug eject path. Forced unplug intentionally does not introduce a separate teardown sequence. It lets management trigger the same slot completion helper that is already reachable when the guest writes the ACPI EJ register. Signed-off-by: Dongli Zhang --- hw/acpi/acpi-pci-hotplug-stub.c | 6 ++++++ hw/acpi/pcihp.c | 17 +++++++++++++++++ include/hw/acpi/pcihp.h | 3 +++ 3 files changed, 26 insertions(+) diff --git a/hw/acpi/acpi-pci-hotplug-stub.c b/hw/acpi/acpi-pci-hotplug-stu= b.c index d58ea726a8..9451a45c0b 100644 --- a/hw/acpi/acpi-pci-hotplug-stub.c +++ b/hw/acpi/acpi-pci-hotplug-stub.c @@ -30,6 +30,12 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandler = *hotplug_dev, { } =20 +void acpi_pcihp_device_force_unplug_cb(HotplugHandler *hotplug_dev, + AcpiPciHpState *s, DeviceState *dev, + Error **errp) +{ +} + void acpi_pcihp_reset(AcpiPciHpState *s) { } diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 87162ff2c0..7a1f2b873a 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -367,6 +367,23 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandle= r *hotplug_dev, acpi_send_event(DEVICE(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS); } =20 +void acpi_pcihp_device_force_unplug_cb(HotplugHandler *hotplug_dev, + AcpiPciHpState *s, DeviceState *dev, + Error **errp) +{ + PCIDevice *pdev =3D PCI_DEVICE(dev); + int slot =3D PCI_SLOT(pdev->devfn); + int bsel =3D acpi_pcihp_get_bsel(pci_get_bus(pdev)); + + if (bsel < 0) { + error_setg(errp, "Unsupported bus. Bus doesn't have property '" + ACPI_PCIHP_PROP_BSEL "' set"); + return; + } + + acpi_pcihp_eject_slot(s, bsel, 1U << slot); +} + bool acpi_pcihp_is_hotpluggable_bus(AcpiPciHpState *s, BusState *bus) { Object *o =3D OBJECT(bus->parent); diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h index efce5fd2e1..13c131b8e8 100644 --- a/include/hw/acpi/pcihp.h +++ b/include/hw/acpi/pcihp.h @@ -75,6 +75,9 @@ void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_= dev, AcpiPciHpState *s, void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s, DeviceState *d= ev, Error **errp); +void acpi_pcihp_device_force_unplug_cb(HotplugHandler *hotplug_dev, + AcpiPciHpState *s, DeviceState *dev, + Error **errp); =20 void build_acpi_pci_hotplug(Aml *table, AmlRegionSpace rs, uint64_t pcihp_= addr); void build_append_pci_dsm_func0_common(Aml *ctx, Aml *retvar); --=20 2.43.5 From nobody Thu Sep 3 07:04:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1787534444; cv=none; d=zohomail.com; s=zohoarc; b=J45lN/pf26ZW5UM/adueBVSNUbrlPGFqxk4D+fVOpKRzrbRcLnrNT7qyxi+SfVMek5v4XbqRSQmZFoaprPtr3CkqpQh6FOoq+E6t4wn32Qm6IUtGmIsUgRei37hRTLnE1tIPgcRgxtVlLST8whUGRw5WnUqBWr4VbVI2qenzg5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787534444; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZkCph0zQMEceV1V18yZjC3gcjw4ROxQqcgj3PoAbDGw=; b=c8XbVQCdw7YF+bVPA8UNEz6MDCg8WvL8j6tsZ2z5soap+7Z81XvKf99oAe2OnutQNHmmmf/jGoEerF1t9VZKtCWfwxY/TCMUzcaJWFsUtUdUn9btXzJYk2paeVpxg8qBrvvmA4pWxXM2x1rBBn2at7UT9365eiM3/RwFve+hgiM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 178753444476958.08193058108941; Sun, 23 Aug 2026 18:20:44 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1398599.1634785 (Exim 4.92) (envelope-from ) id 1wyJMK-0007U3-5d; Mon, 24 Aug 2026 01:20:20 +0000 Received: by outflank-mailman (output) from mailman id 1398599.1634785; Mon, 24 Aug 2026 01:20:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyJMK-0007Sj-12; Mon, 24 Aug 2026 01:20:20 +0000 Received: by outflank-mailman (input) for mailman id 1398599; Mon, 24 Aug 2026 01:20:18 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyJMI-00071S-5E for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 01:20:18 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wyJMH-00AZzb-Ia for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 03:20:17 +0200 Received: from [10.42.69.6] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a8b9c28-e002-0a2a0a5209dd-0a2a45068ddc-18 for ; Mon, 24 Aug 2026 03:20:17 +0200 Received: from [205.220.177.32] (helo=mx0b-00069f02.pphosted.com) by tlsNG-16d1c6.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a8b9c50-195a-0a2a45060019-cddcb120582a-3 for ; Mon, 24 Aug 2026 03:20:17 +0200 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67O00kWL3992865; Mon, 24 Aug 2026 01:20:05 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4g726bhdp9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:20:04 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 67O1FURi013245; Mon, 24 Aug 2026 01:20:04 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4g84kh6xq4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:20:04 +0000 (GMT) Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 67O1JmW1024683; Mon, 24 Aug 2026 01:20:03 GMT Received: from localhost.localdomain (ca-dev80.us.oracle.com [10.211.9.80]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 4g84kh6xgy-6; Mon, 24 Aug 2026 01:20:03 +0000 (GMT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=corp-2025-04-25 header.d=oracle.com header.i="@oracle.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=ZkCph 0zQMEceV1V18yZjC3gcjw4ROxQqcgj3PoAbDGw=; b=K+ppLH/PCrj/wbA/jzZyt bdWHWQsvBzJP3uHHw0XVLHrTgqphOE8xm6sv4c059cmQtpVO+0EohzFiC2r2t2wJ gbK72cj5QYQpd4zlR3Pj5JlySk2DNqIxDPow3OPvB5cyzuuO2eJCNc917BuBXFbE B1Hf1v3SmNbum+TIuj2ohgbbVcc5dEPwqwSFc6Bud1ubjYj0CDPxUqXZuEjuKmUS jmw1wUjZVY9yejj23QxQERzBShuELPBA12M1EM/r1y6o/lOa4tz4r1wUGxIU44Wx 0MmIrv1Li2sqU2zPBS71UGJi9LiBxcq0UyzBAOGjgXb2mK5kDV477Q24t0TpV3S5 g== From: Dongli Zhang To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org Cc: dave@treblig.org, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, philmd@mailo.com, aurelien@aurel32.net, mjrosato@linux.ibm.com, alifm@linux.ibm.com, farman@linux.ibm.com, richard.henderson@linaro.org, iii@linux.ibm.com, david@kernel.org, pasic@linux.ibm.com, borntraeger@linux.ibm.com, cohuck@redhat.com, alex@shazbot.org, clg@redhat.com, akrowiak@linux.ibm.com, jjherne@linux.ibm.com, sstabellini@kernel.org, anthony@xenproject.org, edgar.iglesias@gmail.com, pbonzini@redhat.com, berrange@redhat.com, eblake@redhat.com, armbru@redhat.com, joe.jin@oracle.com Subject: [PATCH 5/8] hw/acpi/piix4: Support forced PCI unplug Date: Sun, 23 Aug 2026 18:13:35 -0700 Message-ID: <20260824011420.752806-6-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260824011420.752806-1-dongli.zhang@oracle.com> References: <20260824011420.752806-1-dongli.zhang@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-24_01,2026-08-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2608240009 X-Authority-Analysis: v=2.4 cv=Q6niJY2a c=1 sm=1 tr=0 ts=6a8b9c44 b=1 cx=c_pps a=e1sVV491RgrpLwSTMOnk8w==:117 a=e1sVV491RgrpLwSTMOnk8w==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=x4eqshVgHu-cdnggieHk:22 a=yPCof4ZbAAAA:8 a=sVUD1VjQnF4y5snLtUwA:9 a=5yU3S35YU4bGjq-dph-N:22 a=Bho9c0fBagfJEIQBS7DQ:22 cc=ntf awl=host:13521 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfXxvMG/AodywxN jCyivwTyKNJb7pSvrie6I6RuCokvMF818rlPF/8bsoT0lCdzDmVzD4+NE+ApH2tNNrMR29QI5vH anCSfJXwMSn8z9g4yRkYBLJhEllboYQdR0mYgvtnTOI2tygxcVXlp2gXMcNjY5bdMTVdVy3XRpy laFF9tvkH1QdRK0yFgl/ZdEyTF158dwT7d72qSHbJhdpZhUKFap93RJxyPEeEwVvBtD2bExAJc3 A7Kx3mGRPcsDclRFwoGTz+j1hA6geSYW8y/l98FSUO1P4W9EQc33VoswjNARv9DLmJbxvOXNwMG JD3psO7dHlYK+SouXuCgwMhr9MeH2LxvI6+LOvBTjJZwc/RT3Gx/aw9pHyRj+Pi1DfUMQzPLjRr F+54t1AGpMLhGcirKbnldfuTeZLRSmF/vvsrA+AycOv/aNGvPYM537nGfrH7CS7qtDhHT+77DU5 YJtx4JTtE1XpJo83Aw2HghZBAnRKht72ekQZFnFs= X-Proofpoint-GUID: BQ11WiPJKvoDJTnITlj-K1M2Dpi6kofY X-Proofpoint-Spam-Info: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfX7PdpZXwEuZUR Kgpvj5Y7N7TTyuKSMp5OJlRcXWjHfLjfn7glgHYeRaDpIakhtEpRIbV+XwtwlegXouqk0gUb+/J 7oNzYP0rhwchNLwIlmNs4M0BGlJHxMf85/XFZ/BF0V0dvNDxdY2C X-Proofpoint-ORIG-GUID: BQ11WiPJKvoDJTnITlj-K1M2Dpi6kofY X-purgate-ID: tlsNG-16d1c6/1787534417-1ECC577B-B3BCA6E3/0/0 X-purgate-type: clean X-purgate-size: 1666 X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1787534445399158500 Content-Type: text/plain; charset="utf-8" Support forced PCI unplug for PIIX4. This enables forced removal for ACPI PCI hotplug on i440fx machines while rejecting non-PCI devices. Signed-off-by: Dongli Zhang --- hw/acpi/piix4.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 9b7f50c7af..7cfdcb7935 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -383,6 +383,20 @@ static void piix4_device_unplug_cb(HotplugHandler *hot= plug_dev, } } =20 +static void piix4_device_force_unplug_cb(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp) +{ + PIIX4PMState *s =3D PIIX4_PM(hotplug_dev); + + if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { + acpi_pcihp_device_force_unplug_cb(hotplug_dev, &s->acpi_pci_hotplu= g, + dev, errp); + } else { + error_setg(errp, "acpi: forced device unplug for not supported dev= ice" + " type: %s", object_get_typename(OBJECT(dev))); + } +} + static bool piix4_is_hotpluggable_bus(HotplugHandler *hotplug_dev, BusState *bus) { @@ -604,6 +618,7 @@ static void piix4_pm_class_init(ObjectClass *klass, con= st void *data) hc->plug =3D piix4_device_plug_cb; hc->unplug_request =3D piix4_device_unplug_request_cb; hc->unplug =3D piix4_device_unplug_cb; + hc->force_unplug =3D piix4_device_force_unplug_cb; hc->is_hotpluggable_bus =3D piix4_is_hotpluggable_bus; adevc->ospm_status =3D piix4_ospm_status; adevc->send_event =3D piix4_send_gpe; --=20 2.43.5 From nobody Thu Sep 3 07:04:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1787534450; cv=none; d=zohomail.com; s=zohoarc; b=Ib0Migu5g39aYJ5IDfmFg3Suz9dnriIOaWTOI7VU7cN6NllpV3FhOLsil6jVnWpYtI+G8zS3ElzHGwsCDsbDIsvXKdEP4iscywUGYxx28R4FTQkbFrGyMwIQeABlQcN6F2Bh9D5U1fMQDvMoYWjMpV8g09DISl5l5xINeRX1iCs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787534450; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aTU6WvwCf7dVFveRp+8Di7qF8n2TK1NxXJQMZxinPeE=; b=AIRp9v4o2G7pd+Bq4HSxNKn4scenvyfAKu84R/y+JCOIfGatzFk91TZmcFrSyNCCW2Lovkqg5pNlK19iLO43KbFlZNecjJulMpapICte5ltJshd+K+nvsJ38YkE+5O74PF13TcW63eWQ6RP2QvjmU73l+KUMZ9vJtb8p5YrC88M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1787534450235358.67281606828135; Sun, 23 Aug 2026 18:20:50 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1398600.1634799 (Exim 4.92) (envelope-from ) id 1wyJML-0007ua-LP; Mon, 24 Aug 2026 01:20:21 +0000 Received: by outflank-mailman (output) from mailman id 1398600.1634799; Mon, 24 Aug 2026 01:20:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyJML-0007th-Fk; Mon, 24 Aug 2026 01:20:21 +0000 Received: by outflank-mailman (input) for mailman id 1398600; Mon, 24 Aug 2026 01:20:20 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyJMK-0007bX-Kj for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 01:20:20 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wyJMK-008wuR-1U for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 03:20:20 +0200 Received: from [10.42.69.10] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a8b9c21-bab6-0a2a0a5309dd-0a2a450ae05e-12 for ; Mon, 24 Aug 2026 03:20:19 +0200 Received: from [205.220.177.32] (helo=mx0b-00069f02.pphosted.com) by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a8b9c52-f2d2-0a2a450a0019-cddcb1206432-3 for ; Mon, 24 Aug 2026 03:20:19 +0200 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67NNt1FD4056749; Mon, 24 Aug 2026 01:20:08 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4g72j1sdht-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:20:07 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 67O1FUaD013237; Mon, 24 Aug 2026 01:20:07 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4g84kh6xsb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:20:07 +0000 (GMT) Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 67O1JmW3024683; Mon, 24 Aug 2026 01:20:06 GMT Received: from localhost.localdomain (ca-dev80.us.oracle.com [10.211.9.80]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 4g84kh6xgy-7; Mon, 24 Aug 2026 01:20:06 +0000 (GMT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=corp-2025-04-25 header.d=oracle.com header.i="@oracle.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=aTU6W vwCf7dVFveRp+8Di7qF8n2TK1NxXJQMZxinPeE=; b=h+NJIWBFVetrCAi6JPQMq AnZre7DU29ds7rqUasZtpPzPuZ3euvUW10mHK+tuic0pdes4MIH1iiMRdAeG6Wx4 UkeIdxvdZnhQx4Jhtpcx1wbIUmuBuJUcQmlOtqBMUue48Dt/uYEqCzONjSc6efn8 nXNZptIM1DGZ1NSLIIfe/zv5DzVaZ/iz6BCtRgt+DI631cx6BSYunnxETOw6w/ZT 2CIbNyNL+9dTjWgtMjDcHfjOKRMBiwfvIBrNLnner9LnSjct/Pqj9K8LdovdtUzj dnmJI0LlM0WsSJ6LG7EUJktRUR6VpqCMCsCLMu5eG06rQIcl+DQzH22aE6zkOfav w== From: Dongli Zhang To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org Cc: dave@treblig.org, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, philmd@mailo.com, aurelien@aurel32.net, mjrosato@linux.ibm.com, alifm@linux.ibm.com, farman@linux.ibm.com, richard.henderson@linaro.org, iii@linux.ibm.com, david@kernel.org, pasic@linux.ibm.com, borntraeger@linux.ibm.com, cohuck@redhat.com, alex@shazbot.org, clg@redhat.com, akrowiak@linux.ibm.com, jjherne@linux.ibm.com, sstabellini@kernel.org, anthony@xenproject.org, edgar.iglesias@gmail.com, pbonzini@redhat.com, berrange@redhat.com, eblake@redhat.com, armbru@redhat.com, joe.jin@oracle.com Subject: [PATCH 6/8] hw/acpi/ich9: Support forced PCI unplug Date: Sun, 23 Aug 2026 18:13:36 -0700 Message-ID: <20260824011420.752806-7-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260824011420.752806-1-dongli.zhang@oracle.com> References: <20260824011420.752806-1-dongli.zhang@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-24_01,2026-08-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2608240009 X-Proofpoint-Spam-Info: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfXz9YOZ9qDy8HS +SghGegefBKikkhHiHni+UOguA7ph92WpeC5j+tg0tD/71PJyCnN0y+p6HH0J9DdGygzEn0qN9Q N8Vpym8vv6fAp9PbYFSCMiq/oSHsDv2UgTBICsP5Yrj9iQhO6BPs X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfX4rJccOSNWSDH ePO5OlzXZFL00+0OOA6BTz8zLWPUznzKMDCJBIAzVgQftNo52LqRmAEvDitqBOdwAx1dy7fD5dl N62MxNPp5KDPYRs3d7N55R5f5uc2lRzKJocY8tw3VcuuKTou4DcpFiZ+ud2eand4vFyGbR9mUM5 Dc6nio5El7HqsTdIaxTxR1Fwtjwo3uvCtpiHPvEBC+Iq1xYqhF1aUqJP54bc3EFSern7AwY/p67 1/V2ZUO6KtpRLU+g+H3DYFE8kXcffZYlYRRz4PNNybF3UBIKSQKeiU1k34sngAiLefzIMWwog6F wijyu79VehyMfdQVbx17/XI2/kRr9CM8aI7V21A/eF3fXFzlTu4npEn1E8QKDYt/E5GWoWfO2kR 7kHrqf1hgalIDJn6WELVTDHts3lqU85oXPhrxCGr8cFhlBdiV1dEQBOIi0Swt6Hbfs3j10al3hO thPb48eBM0/6LXCsMTrcWwtN5+UvgSd5DoRI5GeA= X-Proofpoint-GUID: vHD5v_s0FE83Tiu0YxCJBrdfCIEalDCo X-Authority-Analysis: v=2.4 cv=Wek8rUhX c=1 sm=1 tr=0 ts=6a8b9c47 b=1 cx=c_pps a=e1sVV491RgrpLwSTMOnk8w==:117 a=e1sVV491RgrpLwSTMOnk8w==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=o5oIOnhZENCTenyL_yNV:22 a=yPCof4ZbAAAA:8 a=WNH3IyxyIQbYLsLU91AA:9 a=5yU3S35YU4bGjq-dph-N:22 a=Bho9c0fBagfJEIQBS7DQ:22 cc=ntf awl=host:13521 X-Proofpoint-ORIG-GUID: vHD5v_s0FE83Tiu0YxCJBrdfCIEalDCo X-purgate-ID: tlsNG-4011c0/1787534419-506CECFC-31AB1BBB/0/0 X-purgate-type: clean X-purgate-size: 2691 X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1787534451271158500 Content-Type: text/plain; charset="utf-8" Support forced PCI unplug for ICH9. This enables forced removal for ACPI PCI hotplug on q35 machines while rejecting non-PCI devices. Signed-off-by: Dongli Zhang --- hw/acpi/ich9.c | 15 +++++++++++++++ hw/isa/lpc_ich9.c | 1 + include/hw/acpi/ich9.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 5e8f8a7eaf..4bcaf3858b 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -528,6 +528,21 @@ void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_= dev, DeviceState *dev, } } =20 +void ich9_pm_device_force_unplug_cb(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp) +{ + ICH9LPCState *lpc =3D ICH9_LPC_DEVICE(hotplug_dev); + + if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { + acpi_pcihp_device_force_unplug_cb(hotplug_dev, + &lpc->pm.acpi_pci_hotplug, + dev, errp); + } else { + error_setg(errp, "acpi: forced device unplug for not supported dev= ice" + " type: %s", object_get_typename(OBJECT(dev))); + } +} + bool ich9_pm_is_hotpluggable_bus(HotplugHandler *hotplug_dev, BusState *bu= s) { ICH9LPCState *lpc =3D ICH9_LPC_DEVICE(hotplug_dev); diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index edf9783ec8..6d734ffc47 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -908,6 +908,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, con= st void *data) hc->plug =3D ich9_pm_device_plug_cb; hc->unplug_request =3D ich9_pm_device_unplug_request_cb; hc->unplug =3D ich9_pm_device_unplug_cb; + hc->force_unplug =3D ich9_pm_device_force_unplug_cb; hc->is_hotpluggable_bus =3D ich9_pm_is_hotpluggable_bus; adevc->ospm_status =3D ich9_pm_ospm_status; adevc->send_event =3D ich9_send_gpe; diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h index 30990fcef5..cc9f50a60f 100644 --- a/include/hw/acpi/ich9.h +++ b/include/hw/acpi/ich9.h @@ -93,6 +93,8 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hot= plug_dev, DeviceState *dev, Error **errp); void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *de= v, Error **errp); +void ich9_pm_device_force_unplug_cb(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp); bool ich9_pm_is_hotpluggable_bus(HotplugHandler *hotplug_dev, BusState *bu= s); =20 void ich9_pm_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list); --=20 2.43.5 From nobody Thu Sep 3 07:04:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1787534444; cv=none; d=zohomail.com; s=zohoarc; b=eZjzowZK3aL5Nv4023QmlL9PmqimmwhEZxeDfqbnNCfeSt5lycLBhYsYRSL+VPcFNDn1ktv1W+RjFTAW5Z9GH/51YHFjPe2REIKIKire9GPJCi6HePvY5PPWAQMJVInOwE3k15ski+8rEduvkIcAllf/sjoRcv+x7fX2eYLjL3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787534444; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=38jU8IIonVi12pQd4z21bPmb4kb4ECiPZZIFqO5pnuc=; b=YxXXWct2Q8JVFeF76XNQqkpy5BEbWsxr+nTo0HXYw1FHobR7o9zlCZgiksI7oqufFo1fuwkOjVnu9oJwzW2xjmP9ZRuaXt6PHYwOzYkF66eT7VJIqgiSKySLgOo5glT1awPeKDFfLrJWiAVRFKDPhz82xzaXzchodedGexy6sMI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1787534444612923.2720226140108; Sun, 23 Aug 2026 18:20:44 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1398602.1634808 (Exim 4.92) (envelope-from ) id 1wyJMO-0008Dp-Qq; Mon, 24 Aug 2026 01:20:24 +0000 Received: by outflank-mailman (output) from mailman id 1398602.1634808; Mon, 24 Aug 2026 01:20:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyJMO-0008Di-Ny; Mon, 24 Aug 2026 01:20:24 +0000 Received: by outflank-mailman (input) for mailman id 1398602; Mon, 24 Aug 2026 01:20:23 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyJMN-00089r-2F for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 01:20:23 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wyJMM-00Cy13-FS for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 03:20:22 +0200 Received: from [10.42.69.9] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a8b9bbf-2eae-0a2a0a5409dd-0a2a4509d37a-48 for ; Mon, 24 Aug 2026 03:20:22 +0200 Received: from [205.220.177.32] (helo=mx0b-00069f02.pphosted.com) by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a8b9c55-be1a-0a2a45090019-cddcb120710e-3 for ; Mon, 24 Aug 2026 03:20:22 +0200 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67O002f64065363; Mon, 24 Aug 2026 01:20:11 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4g72j1sdhu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:20:10 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 67O1FUjg013312; Mon, 24 Aug 2026 01:20:10 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4g84kh6xtw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:20:10 +0000 (GMT) Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 67O1JmW5024683; Mon, 24 Aug 2026 01:20:09 GMT Received: from localhost.localdomain (ca-dev80.us.oracle.com [10.211.9.80]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 4g84kh6xgy-8; Mon, 24 Aug 2026 01:20:09 +0000 (GMT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=corp-2025-04-25 header.d=oracle.com header.i="@oracle.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=38jU8 IIonVi12pQd4z21bPmb4kb4ECiPZZIFqO5pnuc=; b=pScvHeuAnFaWyC2fLr0tu rnK+ZjY9niD/EvSZTO3T2+YUhWSLITVC6hZ3IC6XAGzbPxBKySQP8/a8eRvtqZF9 1JdLkZzyny/rLLEIp2+c9aTpm8b0pyIQNLz2eAuKfzVDOxUzqckjskwt0oQkncjW y5zLH3XGJBSYbND6PlqS9BIo7FqRWwvTcHtqfJGYuFAxf1Rb4jzA8QjzDpMSG6Jt XuvoVb4+LoF9fpJIFSQHMsM0NZnpMWmTV59v1T3HHRsSvF/4EoaFs87U9QG9ArDg vGcpr8PgE+njSrGm6b4jSqmsvTpqxPcB7Q33ghtktr47lq3D5c4IRmeKh6G1+mEp w== From: Dongli Zhang To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org Cc: dave@treblig.org, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, philmd@mailo.com, aurelien@aurel32.net, mjrosato@linux.ibm.com, alifm@linux.ibm.com, farman@linux.ibm.com, richard.henderson@linaro.org, iii@linux.ibm.com, david@kernel.org, pasic@linux.ibm.com, borntraeger@linux.ibm.com, cohuck@redhat.com, alex@shazbot.org, clg@redhat.com, akrowiak@linux.ibm.com, jjherne@linux.ibm.com, sstabellini@kernel.org, anthony@xenproject.org, edgar.iglesias@gmail.com, pbonzini@redhat.com, berrange@redhat.com, eblake@redhat.com, armbru@redhat.com, joe.jin@oracle.com Subject: [PATCH 7/8] hw/acpi/ged: Support forced PCI unplug Date: Sun, 23 Aug 2026 18:13:37 -0700 Message-ID: <20260824011420.752806-8-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260824011420.752806-1-dongli.zhang@oracle.com> References: <20260824011420.752806-1-dongli.zhang@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-24_01,2026-08-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2608240009 X-Proofpoint-Spam-Info: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfX24Chf8itq7kY c0iNGcrg2LAQYuKnGGGof6DEc5T0g8uxuU5MknKuRYVbahwnf5i/OhEpRLgeAM7Dt9fvMLlU/Zu JWVG8c0/lNV34IrtQvl/u4laiCRADkbE2JbG64JpT7b3bQgYs5cg X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfXypoIER7KOFEN yyOZFSUuWb97Na0ZmDw9aCkSMXjadybURfwMgWOU8R7nlBwKgN0Ybriz+mQ8l27GupAVOO3ngOz 0WWJDJ8ldYaIkhrLfG6uxHqmeuObwA79mMoGflM5nUAwGAaCNGN4SuWQbapMEJ4UzjTjTB5BwuR Tcqrv+3M5EzTdGdcrIxcOJ+7Vfsi0XSAixwnJ73jkZiNpbvALgWQKvThQxbofGpuQCR619f8TgW o5W+PfCHSv7Z5PIsjmIo+/S/B+N23aVxIidj8G7TlBRnwvn2Lu7o+Y03cP52vcrpIIt5XJita2z +yh6Evo5COtnvGhbpNPD5iHEadc74wIcuslvOSiHRkuK4lr6rKLTAqmKT2ZvzF054kT6uzei3kD efkLZdlaDsNYJGxuXl0Djxoi0JkRDPJyL27YigFLEgc2VEUpyS04ssiojdaXWrnk2zEbmToYQYm bAR2w+M4DrPTjJcyXsXeejR6lkuC3rB0NjTI/1PU= X-Proofpoint-GUID: W6iMb0pF__v8G2uZQ2ZPsCy8u0z8KVqP X-Authority-Analysis: v=2.4 cv=Wek8rUhX c=1 sm=1 tr=0 ts=6a8b9c4a b=1 cx=c_pps a=e1sVV491RgrpLwSTMOnk8w==:117 a=e1sVV491RgrpLwSTMOnk8w==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=o5oIOnhZENCTenyL_yNV:22 a=yPCof4ZbAAAA:8 a=G0a9BTs-aq7rllif8c0A:9 a=5yU3S35YU4bGjq-dph-N:22 a=Bho9c0fBagfJEIQBS7DQ:22 cc=ntf awl=host:13521 X-Proofpoint-ORIG-GUID: W6iMb0pF__v8G2uZQ2ZPsCy8u0z8KVqP X-purgate-ID: tlsNG-bad1c0/1787534422-FC610034-DA0F896A/0/0 X-purgate-type: clean X-purgate-size: 1728 X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1787534445413158500 Content-Type: text/plain; charset="utf-8" Support forced PCI unplug for generic event device (ged). This enables forced removal for ACPI PCI hotplug on arm64 virt machines while rejecting non-PCI devices. Signed-off-by: Dongli Zhang --- hw/acpi/generic_event_device.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c index 9e9416d406..3c041f5c26 100644 --- a/hw/acpi/generic_event_device.c +++ b/hw/acpi/generic_event_device.c @@ -314,6 +314,20 @@ static void acpi_ged_unplug_cb(HotplugHandler *hotplug= _dev, } } =20 +static void acpi_ged_force_unplug_cb(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp) +{ + AcpiGedState *s =3D ACPI_GED(hotplug_dev); + + if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { + acpi_pcihp_device_force_unplug_cb(hotplug_dev, &s->pcihp_state, + dev, errp); + } else { + error_setg(errp, "acpi: forced device unplug for unsupported devic= e" + " type: %s", object_get_typename(OBJECT(dev))); + } +} + static void acpi_ged_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***li= st) { AcpiGedState *s =3D ACPI_GED(adev); @@ -603,6 +617,7 @@ static void acpi_ged_class_init(ObjectClass *class, con= st void *data) hc->plug =3D acpi_ged_device_plug_cb; hc->unplug_request =3D acpi_ged_unplug_request_cb; hc->unplug =3D acpi_ged_unplug_cb; + hc->force_unplug =3D acpi_ged_force_unplug_cb; resettable_class_set_parent_phases(rc, NULL, ged_reset_hold, NULL, &gedc->parent_phases); =20 --=20 2.43.5 From nobody Thu Sep 3 07:04:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1787534455; cv=none; d=zohomail.com; s=zohoarc; b=eLrJYfSTDJTZotZ4vzisCeaHSx0Z0Ai0UXZUVUh8f7G6w5n1MUgf2wf3X2CHZtKP8dYHmM9okExJeCRbwzalBjyP2Vxgziup0RF/UyaqwsusVdZcR5QkMOnJuaEkttG4EF2BSa0s5t8u4BBJSVEisS48cUFKlHZLOW67JHYYvyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787534455; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XvAUBQoXJbUB6s9aMnBe/fHC44+ByRRCLPqOgVKeuAU=; b=nOgOKCtRknbMxruXUUPVJWruHEpJdu6msWD3Au0lKI+NPSQb61VMedMscntqsjikzImnY5SGiOS+m8IVWBz6MmwSWshgH4h+V2Ez0Q3taUEoAG/4IVgYdRueZ2BlINo7N82VGxCA1kTFM8AUfCWlERhbv7WwT43OtQcdDhPRuqY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1787534455015975.2049369705869; Sun, 23 Aug 2026 18:20:55 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1398607.1634816 (Exim 4.92) (envelope-from ) id 1wyJMT-00009d-4J; Mon, 24 Aug 2026 01:20:29 +0000 Received: by outflank-mailman (output) from mailman id 1398607.1634816; Mon, 24 Aug 2026 01:20:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyJMT-00009Q-14; Mon, 24 Aug 2026 01:20:29 +0000 Received: by outflank-mailman (input) for mailman id 1398607; Mon, 24 Aug 2026 01:20:27 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyJMR-00005x-Oz for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 01:20:27 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wyJMR-00AZzb-5z for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 03:20:27 +0200 Received: from [10.42.69.6] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a8b9c28-e002-0a2a0a5209dd-0a2a45068ddc-28 for ; Mon, 24 Aug 2026 03:20:27 +0200 Received: from [205.220.177.32] (helo=mx0b-00069f02.pphosted.com) by tlsNG-16d1c6.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a8b9c59-195a-0a2a45060019-cddcb12089c8-3 for ; Mon, 24 Aug 2026 03:20:26 +0200 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67O0Ap2W4093319; Mon, 24 Aug 2026 01:20:14 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4g73csscpa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:20:13 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 67O1FUME013326; Mon, 24 Aug 2026 01:20:13 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4g84kh6xva-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Aug 2026 01:20:13 +0000 (GMT) Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 67O1JmW7024683; Mon, 24 Aug 2026 01:20:12 GMT Received: from localhost.localdomain (ca-dev80.us.oracle.com [10.211.9.80]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 4g84kh6xgy-9; Mon, 24 Aug 2026 01:20:12 +0000 (GMT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=corp-2025-04-25 header.d=oracle.com header.i="@oracle.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=XvAUB QoXJbUB6s9aMnBe/fHC44+ByRRCLPqOgVKeuAU=; b=Y0MpiKVRey6ei+1/34zOS a54gCEOHbdPQ0e9QzNvN7YHTt/eLHnxWj7sjJvNF2TJRlfQf/Tna/zXYCYPQGOsu o1CqeNiGYjSJMGBaArYHjqmUBEm3ANVefTsbiI9iExpTiDy/O57OlmKoqKzwWLgl BN/TsUqm5hUUNy3+glZvAXk4ZnOWP3fgDGi5nblbnFlkDQlaGIx3LM/GdVx2zZkb Co+49SOAYPcwz8wPGYiWr6ZlHsWu8O+ahTvDh2C4si7U4DiEtj/oYMNSP23zn2rq wz/6oGnKTX9wcZ2NRNifFzhtT4lFeyJLzixh7m7BRIqP1rK0HXHDCWBFqU/l7k+E Q== From: Dongli Zhang To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org Cc: dave@treblig.org, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, philmd@mailo.com, aurelien@aurel32.net, mjrosato@linux.ibm.com, alifm@linux.ibm.com, farman@linux.ibm.com, richard.henderson@linaro.org, iii@linux.ibm.com, david@kernel.org, pasic@linux.ibm.com, borntraeger@linux.ibm.com, cohuck@redhat.com, alex@shazbot.org, clg@redhat.com, akrowiak@linux.ibm.com, jjherne@linux.ibm.com, sstabellini@kernel.org, anthony@xenproject.org, edgar.iglesias@gmail.com, pbonzini@redhat.com, berrange@redhat.com, eblake@redhat.com, armbru@redhat.com, joe.jin@oracle.com Subject: [PATCH 8/8] hw/pci/pcie: Support forced PCIe native unplug Date: Sun, 23 Aug 2026 18:13:38 -0700 Message-ID: <20260824011420.752806-9-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260824011420.752806-1-dongli.zhang@oracle.com> References: <20260824011420.752806-1-dongli.zhang@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-24_01,2026-08-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2608240009 X-Authority-Analysis: v=2.4 cv=D+h37PRj c=1 sm=1 tr=0 ts=6a8b9c4e b=1 cx=c_pps a=e1sVV491RgrpLwSTMOnk8w==:117 a=e1sVV491RgrpLwSTMOnk8w==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=3I1J8UUJPc9JN9BFgKH3:22 a=yPCof4ZbAAAA:8 a=IQMDJlptZtJ-cjhD5E0A:9 a=5yU3S35YU4bGjq-dph-N:22 a=Bho9c0fBagfJEIQBS7DQ:22 cc=ntf awl=host:13521 X-Proofpoint-Spam-Info: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfX5rG4lXUBNxHq T+o4qRB20FbSQ3VkEDo0kDPEQGcipZoPjbrAhux1NKndowjuN2sBil13UbyffaoxT7I9OStPXoi oKpY3xlRnw7DYH40382c7wXgk/SqNQDdbi87Fh/QPyJY6loUC8Sr X-Proofpoint-ORIG-GUID: 9fPHksSYfaSWwaY-VGY-i5dZnZuVka1r X-Proofpoint-GUID: 9fPHksSYfaSWwaY-VGY-i5dZnZuVka1r X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODI0MDAwOSBTYWx0ZWRfX99x47b0T2hs4 lWe2QX2cJi8aWQ+T2BCIwD9hyY9fQuc6qYrHdLK7e21Lrxi/eqwyM9CGGMUG2mL/oGHCX1eDZ6a 0q4EfeIACp+Nma3vsITTIYdWUcLayceHZoNmgJNLX3qktn6sUQoihHoxqEVb/vM2Dv3us7m1XP6 WBcSb+U/E9Qem2YaUlL8mQz23is7gLawKUVDH1DquPuoaEkXetx87y9DBQntyDfAYXxZsUDEKyY wQ74G0acFOp8+UdjmyJq2zAp9IXCubuw4oZuhqGITPuGdvP0eF6h4GdaSmHiO1kWYseA3LjWbLo OKoqIaYi0A6QMS0ZHvJyxoacdJbz8K+qdnUPmaZl5eWRuruUjGELJE5J+3jTvgZqZgwOGmKO8i6 PrltezR6ziKJrdjqpFv48rH8574fr0utBHzDEF91JkSbp6wQUx0FagpotuTD2qPdgewWfVgxjrH KxOLfVz0YUlGY1MOH/1+bfXrMHFYzPuk52BZaBnk= X-purgate-ID: tlsNG-16d1c6/1787534427-FDA0C77B-B16D083D/0/0 X-purgate-type: clean X-purgate-size: 2937 X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1787534455263158500 Content-Type: text/plain; charset="utf-8" Support forced PCIe native unplug by implementing force_unplug method. The forced path completes the pending slot unplug immediately through the existing PCIe slot removal helper, clears the attention button pressed status bit, and notifies the hotplug event. Signed-off-by: Dongli Zhang --- hw/pci/pcie.c | 20 ++++++++++++++++++++ hw/pci/pcie_port.c | 1 + include/hw/pci/pcie.h | 2 ++ 3 files changed, 23 insertions(+) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 4622c75e48..bd967ca73b 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -666,6 +666,26 @@ void pcie_cap_slot_unplug_request_cb(HotplugHandler *h= otplug_dev, pcie_cap_slot_push_attention_button(hotplug_pdev); } =20 +void pcie_cap_slot_force_unplug_cb(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp) +{ + PCIDevice *hotplug_pdev =3D PCI_DEVICE(hotplug_dev); + uint8_t *exp_cap =3D hotplug_pdev->config + hotplug_pdev->exp.exp_cap; + uint32_t sltcap =3D pci_get_word(exp_cap + PCI_EXP_SLTCAP); + + if ((sltcap & PCI_EXP_SLTCAP_HPC) =3D=3D 0) { + error_setg(errp, "Hot-unplug failed: " + "unsupported by the port device '%s'", + DEVICE(hotplug_pdev)->id); + return; + } + + pcie_cap_slot_do_unplug(hotplug_pdev); + pci_word_test_and_clear_mask(exp_cap + PCI_EXP_SLTSTA, + PCI_EXP_SLTSTA_ABP); + hotplug_event_notify(hotplug_pdev); +} + /* pci express slot for pci express root/downstream port PCI express capability slot registers */ void pcie_cap_slot_init(PCIDevice *dev, PCIESlot *s) diff --git a/hw/pci/pcie_port.c b/hw/pci/pcie_port.c index dbb6032160..4806c8289b 100644 --- a/hw/pci/pcie_port.c +++ b/hw/pci/pcie_port.c @@ -221,6 +221,7 @@ static void pcie_slot_class_init(ObjectClass *oc, const= void *data) hc->plug =3D pcie_cap_slot_plug_cb; hc->unplug =3D pcie_cap_slot_unplug_cb; hc->unplug_request =3D pcie_cap_slot_unplug_request_cb; + hc->force_unplug =3D pcie_cap_slot_force_unplug_cb; hc->is_hotpluggable_bus =3D pcie_slot_is_hotpluggable_bus; } =20 diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h index 71ba94874b..08c6c81f34 100644 --- a/include/hw/pci/pcie.h +++ b/include/hw/pci/pcie.h @@ -154,6 +154,8 @@ void pcie_cap_slot_unplug_cb(HotplugHandler *hotplug_de= v, DeviceState *dev, Error **errp); void pcie_cap_slot_unplug_request_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp); +void pcie_cap_slot_force_unplug_cb(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp); =20 void pcie_pasid_common_init(PCIDevice *dev, uint16_t offset, uint8_t pasid_width, bool exec_perm, bool priv= _mod); --=20 2.43.5