From patchwork Fri Jun 10 19:50:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jag Raman X-Patchwork-Id: 12878043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 121BDC43334 for ; Fri, 10 Jun 2022 20:03:26 +0000 (UTC) Received: from localhost ([::1]:59952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzkqs-0001bb-3X for qemu-devel@archiver.kernel.org; Fri, 10 Jun 2022 16:03:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzkf0-0000Bl-N4 for qemu-devel@nongnu.org; Fri, 10 Jun 2022 15:51:10 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:59262) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzkev-0000PT-SI for qemu-devel@nongnu.org; Fri, 10 Jun 2022 15:51:10 -0400 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25AJiBnp009130; Fri, 10 Jun 2022 19:50:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=ezs4Sf67fjK10WgD/7RvcUDz7aSscd9W02JfSQT2ykc=; b=Y8kM+OsNZ+kdm6IgYuuPutKAvdXnm/tKWRKjQV/d8G2cp6V20qbL+So0xDSN6tmBrn+8 8e2FDgJY/nfuZkEz0LrNk7BvLXWbVA6lcfAHqwvGFM9wccHGB+3ZSRRyVeVjnZz1irYA 1YEcOySxWB6GICpsOMiggqJPM87BeAtMH9u5hu4jFFz0tAlkadZusSuS9x//bRxugYke e0Zqm6+65nbXzcOGeI7Pg72sonhkd109SCoJ0d2fX+oeOnTlNJfD/MOPDYRQUOckRFSq W6JIZL4FSZkY3iCeaBo9Q1yf++Jmmwy+AmgGoDJP+epq9AFTOy4T0kPCTbHEBzPJZ09J pg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gfydqxdes-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 10 Jun 2022 19:50:55 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25AJkgoC023013; Fri, 10 Jun 2022 19:50:54 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2176.outbound.protection.outlook.com [104.47.56.176]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gfwu6egag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 10 Jun 2022 19:50:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hx/KVra+b5fL15e+q5CFcFpXktzW2b9vQXQAL04yO6os2JNpQFl8Rb5dSE0ajToVcN/Mo3Frbvac4E5Ncb4OPqvO+0/17oWGQqFI2VOYiUslOOVXkZUoaKF3HKS/OsKBmKwp93wddXLaxjk8NkSZCbUzCqAivlQ5YGD+Me9IUd1jf3U2mX2p+C9Q01XGrWQtP4A5JrIMPYx0Kko0LJsBI1+BOeFsyMQJgofq0i20NpVGestkPC0bY67As/IKFzXzrEyS6XYK7CosmX1OsaS8+y0FtQp+cAC2cNuVuOseKllmT8dgAhdP6Zs97Jhm1gTca+tvTRMrtg3/zTiwfC1Wug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ezs4Sf67fjK10WgD/7RvcUDz7aSscd9W02JfSQT2ykc=; b=JrrXMWOm000yS8X95/4RXgMux+7hrWYM8tYNazqkicsthL8ZgOAHVTwpkLa8+dkP84YZ0xG+CZ4d39QO38ZAHJWbgw93N08BYxA9fbATYLucUXj2qnzHrt23hOjw200k13dL5nW8MNCGmNfL5wT54eJR7rM7jXD5HrJ+58vyrpIS0gjpJ3XLkKhzZ14C1fyaHGUOgbKubeqz7MqJCHizjGXHecvOd1nnMNKo6v2gsQi1gnp6qKZMcE7w4HwGXwCBmNJgPC0rDtj/y/nwHdLxXBe0qowONov9jBgkYbQ+S27Me4PTY6Cf+vJ3JzOWKa7OG4R+pnRMqwuCZKqYe86IyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ezs4Sf67fjK10WgD/7RvcUDz7aSscd9W02JfSQT2ykc=; b=fV4J/nrsS05OihU6zpM8VgfJxvzt3uejFmmNZh0jJuOwTafG1KkYe9Pti9+f+zbc6nYm9eG/gdnvCLkVmfSlx2uqoReHEZEPJPqL8Af2qRs54TsXJfjgjsvIfrfus3e8T19OujsAUsaRUrQ0EZrZ4wuY0iGih++uFAp0GoHBM3g= Received: from MN2PR10MB4013.namprd10.prod.outlook.com (2603:10b6:208:185::25) by DM4PR10MB6254.namprd10.prod.outlook.com (2603:10b6:8:8f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Fri, 10 Jun 2022 19:50:52 +0000 Received: from MN2PR10MB4013.namprd10.prod.outlook.com ([fe80::e9cb:e1ca:8189:f191]) by MN2PR10MB4013.namprd10.prod.outlook.com ([fe80::e9cb:e1ca:8189:f191%7]) with mapi id 15.20.5314.020; Fri, 10 Jun 2022 19:50:52 +0000 From: Jagannathan Raman To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, mst@redhat.com, alex.williamson@redhat.com, f4bug@amsat.org, pbonzini@redhat.com, marcandre.lureau@redhat.com, thuth@redhat.com, bleal@redhat.com, berrange@redhat.com, peter.maydell@linaro.org, eduardo@habkost.net, marcel.apfelbaum@gmail.com, eblake@redhat.com, armbru@redhat.com, quintela@redhat.com, dgilbert@redhat.com, imammedo@redhat.com, peterx@redhat.com, john.levon@nutanix.com, thanos.makatos@nutanix.com, elena.ufimtseva@oracle.com, john.g.johnson@oracle.com, kanth.ghatraju@oracle.com, jag.raman@oracle.com Subject: [PATCH v11 02/14] remote/machine: add HotplugHandler for remote machine Date: Fri, 10 Jun 2022 15:50:29 -0400 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: X-ClientProxiedBy: DM5PR04CA0046.namprd04.prod.outlook.com (2603:10b6:3:12b::32) To MN2PR10MB4013.namprd10.prod.outlook.com (2603:10b6:208:185::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 22f63981-24d9-465a-cbf4-08da4b1a865c X-MS-TrafficTypeDiagnostic: DM4PR10MB6254:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p92CBdItwvytW3f+BE8i3PVcjy6MYM9aGEDiTld/Wa0w9Q2XrpUjoJ1a5UHidJmv5rzO5scn+IBMRBjxVe0k3WMAszf7JZ2b9z62O0w1UzSnSiP18Jcr9bDgUWGPC7V3sdmnIlHv183eTuvqyZRVVimDO5LqdlVs/q1iRDuXHWSCLJRygrwqBnd6i3LyW/E8rYdLIHpK7sW4dd35gsbwf+/oZMo1QFlY5CYk0bjS/5FxtKnU9I/S+wOSIwhunMfLjfmH3LfB5CkmvIw2YZMMDv9klqObQCeS55f1t53kluXTCqJhk1i/lB9P928y8iJiW01XElFC0C/eOpbMVFQR/RE1To8GMDoaIJ7jul3lab5gFz9hiusfhTd1+NftozBN/jjTO6s9vumzIU8b44HNebJ2cPXmvPgDXryfumzD317ekTDP+xo+O7blEMGT84lFyDvNGQNXUnRB7UZ/UOE84uxHq2OMPsbPpa7864UAVxd54qd654JXHNJcthiKGIMvFMOWI2gVmOB3Z2eRIhJVZuc4hyOJiEgejwp5UAEBxQ3uc97Hy3nETr0Wxn8qeZ3N/fhIopWJgd3LSYyHrHN7iXkKbwJo1VwizD7Vv69WWqYbKi69uW5QkM81gfhMTdrv828JgTDnGqTbP69LLM800pFiQbw7AJh8VbBsvYcpqL/nOCpSWgPupZTWJuaYhCDf0Hp8rVtisIk41sVFYMlfJQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR10MB4013.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(38100700002)(26005)(8936002)(2616005)(6512007)(6666004)(36756003)(186003)(6916009)(316002)(6486002)(38350700002)(2906002)(6506007)(86362001)(107886003)(66946007)(8676002)(4326008)(66556008)(5660300002)(7416002)(52116002)(508600001)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7x1Hh5O2geNQZCnEhJMlDwuP2RghP5Sp8CEml8bYxv2ALHPXDerZYeI4trYS7unMW3chgDy5bvEVI1c9k8SzWzyVlgLWK/t+Nam3RZJqYCQaFNUtUhRTvCAJ3Gr2ifeESf5SEypQLDGMe7Gynbbup/iWto979I3IBQbWG26Rcv0qPdMCiTNO59fBggsQMDvF4PJwvm9ShIvQnleLlvY33p2+trxLHzGGYqNMHqPPPj8MZ2KSoyAGViH2+7UZOyU1aYjautIsM8+BllOo/pGSHr4h9pV0xyIkeHdJjwoMmbydB5pO51YTDsjoY2eoMEAQir8YfjaVFEFGZqo3iKpXoljtDaShHmagLLWqkbTDvGguceO16sBPKeIMvCa8/w6RHEBPdkeSH66wZ+SL0DZAnTtQLmxrnqCcAobSTVEAFuvLEd/L7L8iP6c1fK06WoJHuGZrqiDhFXbDSeXX0W/JYCb+mN5xbVva2C+UFy1VisCQ9N0Mouv2Qsq9resTamMmetskrp7n1uhePbr0v8/cbTvFNVIL1X0TsnI+Kt00XvY7kYhwE5s/SQilxJoV5pQ02qfTHgEsyku+WmBnvgqmYiZB8xrogSmEWSsWZHFTeGaHRrTsoMpt/Ws2sTnADism3w4rvcYLs3zkR1r6tNRVMt8OlnI7SII7nHBAlmIw4XS/1KLC2c1ruq041yhPUt/WPTqy/WEM6yyi1eC+hqIVImUxTAdIEsrJWXZWBOKB74Hdsc9F73PHk5QoNzs6Q/chQIYkjGLYXbQ47rlVz6IALPG5+0c6/6fLUJMZVtenb8v/nWajY/98DdYMNLSvVaMISXSt2ke6nhZQsB0HSjDPRop6Kd83OGW0mrZ5S84XSfpAxJuxwrZuIL4jnj0f2sPvi53nptYxFfTsoCMlScOsc9OpM5gRF+fghdxEOu6v7Kx4QjwUExoPuLfnjDOCxmIr2tcY+QhEFJPR7Urz83qN4VqDdRH+FkANlclenBMsBd1zIR1rymwfqjLUKhjOh/ic5rF28FzxnKtsxBslbihy8k6zxL5qpNKVWeJM17OWS+N2ViBuQOSWEt8tKY4EliApXOLwc8M6J9qdwqcWRpv/1Hrxf7Tm4EPYP/y0hJnynUIsxEBaz3juFUnmzETg6LGn2raYHrItxi+OEXC2GeVcM93I+wBIY5tjRX9v8BW1NIB9ji3AqXxVLcSNP9JZ8X7nGXtQMX00Vot2Av3Dk0Nc+YG4xHvuCZxy5D+K9JdnmVf0MlyJjBlCToVTTJgTwMG4HpMzRMBebYCXmPNcZfjDgbF9MQXCGp06iYTMb3ZGQ08Pl/ObKWIDJi9hXOxtiVLWZCBd/7/YHg7WfY1r9K5L8pv/xoREK85WLiJw+MSoABZUhaDsBe0RItbUuJKFihu0qJyetX99aHrelCacp35Itb+zc9rhu8erbjpsYJU5Hr3L3+S75dckhtjQamFG45ro03MDAFTFkgnceTA6Z1bSZCZOedNJLzDuIudXOF8wbQD2dOuIikMS7uDndXnRGFpdk/1AzL3fRPtCZFDRVAsk91oYmUwgHQgkEH1uuEaHcBF3uHfj2fGP37LSYsTnZ5NPAtbFGvHPNarigMNFlhsfYfxboMcdgbnMj1+Pzathe9e7LVtNR5Xo2a7yKzIPhugKBr6YnyKPNrztaby8EqVytosr/ADLcUdDK9CoDMi5XQO+I4tsejlh8fdjGJP1QgNXTajVTpGiyh5yDTdiMWBwlA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22f63981-24d9-465a-cbf4-08da4b1a865c X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB4013.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2022 19:50:52.3682 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wmShbvqYvMK3/Hvl1wzuj2MtHBgB1CuCmYdWldiqgkJvdKheqDTPx6HJP3irnbE1XkiVS+PYovXJWPRbEGDBoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6254 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-10_08:2022-06-09, 2022-06-10 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 adultscore=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206100076 X-Proofpoint-GUID: 0B01p0Hvv-oRSwHd86a8cCiNg4RPS86v X-Proofpoint-ORIG-GUID: 0B01p0Hvv-oRSwHd86a8cCiNg4RPS86v Received-SPF: pass client-ip=205.220.165.32; envelope-from=jag.raman@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, 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Allow hotplugging of PCI(e) devices to remote machine Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman Reviewed-by: Stefan Hajnoczi --- hw/remote/machine.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/remote/machine.c b/hw/remote/machine.c index 92d71d47bb..a97e53e250 100644 --- a/hw/remote/machine.c +++ b/hw/remote/machine.c @@ -20,6 +20,7 @@ #include "qapi/error.h" #include "hw/pci/pci_host.h" #include "hw/remote/iohub.h" +#include "hw/qdev-core.h" static void remote_machine_init(MachineState *machine) { @@ -53,14 +54,19 @@ static void remote_machine_init(MachineState *machine) pci_bus_irqs(pci_host->bus, remote_iohub_set_irq, remote_iohub_map_irq, &s->iohub, REMOTE_IOHUB_NB_PIRQS); + + qbus_set_hotplug_handler(BUS(pci_host->bus), OBJECT(s)); } static void remote_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); + HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); mc->init = remote_machine_init; mc->desc = "Experimental remote machine"; + + hc->unplug = qdev_simple_device_unplug_cb; } static const TypeInfo remote_machine = { @@ -68,6 +74,10 @@ static const TypeInfo remote_machine = { .parent = TYPE_MACHINE, .instance_size = sizeof(RemoteMachineState), .class_init = remote_machine_class_init, + .interfaces = (InterfaceInfo[]) { + { TYPE_HOTPLUG_HANDLER }, + { } + } }; static void remote_machine_register_types(void)