From nobody Wed Nov 27 02:19:05 2024 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; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1701481316; cv=pass; d=zohomail.com; s=zohoarc; b=QJC1V4NgDsjd/fwvm5xjFaTBCuU4WeC6kLrJmgV8f+wVnJvUQ7dmo9jJVvDskZy+Bw8OPcWlpgcA0yZPvVLYo9pZiZlYVHouTRuQm8arpx841e+oB9jnIokR6Z8T3Bg61Ld/AlS2KAIhOsd9IwoXAnxGmFR193pSnQkRc9JckvM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701481316; h=Content-Type: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=xHbTU4afcP4VPCt7c5t9HdrtExRFqhrJyZbbFA7antU=; b=h827nltZ5siR2MEe6EIRBE/kzQugwt6SghWDR7N9QnPOUIfFbTpuygb0JFDAv+ifg8drEfrbNJUW5ywHJ+IuabGJnXq3q6mroVF0XKWFogpRCEBpKewAVIxYYUeOj+jFMinl5PqdZDAkpf2LqsWasyxIsTdiUzs5EheGks96yhA= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1701481316475535.4065515270969; Fri, 1 Dec 2023 17:41:56 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.645876.1008412 (Exim 4.92) (envelope-from ) id 1r9F0g-000736-Pb; Sat, 02 Dec 2023 01:41:34 +0000 Received: by outflank-mailman (output) from mailman id 645876.1008412; Sat, 02 Dec 2023 01:41:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r9F0g-00072z-LK; Sat, 02 Dec 2023 01:41:34 +0000 Received: by outflank-mailman (input) for mailman id 645876; Sat, 02 Dec 2023 01:41:33 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r9F0f-00072l-0t for xen-devel@lists.xenproject.org; Sat, 02 Dec 2023 01:41:33 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id eaa68380-90b3-11ee-98e5-6d05b1d4d9a1; Sat, 02 Dec 2023 02:41:31 +0100 (CET) Received: from pps.filterd (m0174683.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 3B21X1Qm015641; Sat, 2 Dec 2023 01:41:26 GMT Received: from eur05-vi1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2168.outbound.protection.outlook.com [104.47.17.168]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3uqa3aucrx-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 02 Dec 2023 01:41:26 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by AS8PR03MB7285.eurprd03.prod.outlook.com (2603:10a6:20b:2ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.27; Sat, 2 Dec 2023 01:41:21 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822%6]) with mapi id 15.20.7046.027; Sat, 2 Dec 2023 01:41:21 +0000 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" X-Inumbo-ID: eaa68380-90b3-11ee-98e5-6d05b1d4d9a1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Al0hqmWcJ5SVYym2QD9l6trDde0nES0K+LUnxEcDfZ0dE+piyaYEJh6mMMezzU9cmSizQLheQIGWrte5zqc/4l3VU+9vhp60KS2DCgJr+wRoe1GulOc45J6h+4AgdwsGP44I2Nk2U/9Hs5nIvhg9J1HFu0G0kbKNGgaBuutF+6rVIZ0iUVstJqqVos3e91ytgMyuaB7paDtCcVKlYFhBRILsVv3EWUgofUwPc6h3hMcFWEoyzrIrx+XvtoXth+z5o8DJRP7NevNTRTq8Yp/8lDAKqCu9Exy6vkh7NGEHIlYswOKsIGnIkCoo+cCPJtHHlrWHesR9+c8lwJXDHjL0tA== 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=xHbTU4afcP4VPCt7c5t9HdrtExRFqhrJyZbbFA7antU=; b=LXYNTES626N6WVrrtUj8y2tH9yuJhV+u7CWfoXGN5SsTJ4zj0TK/70X/+HLFhBSbJFRARGXp5YClMKw8mYN90+lrjBOrzw+K58n9sO/gKUAgKldjLmhdc9u5gFQj7ccEg8dlj/rmLFuqHDR2i1JSLRxraAaYeDrB0CNFML2C6GnHf5jS9U1dhx0M3uBS3YAgkDY1a4gwJ4/kQtnqnn5KqlKJ9yLnqCGCvH6XC2SfAvswRvHcwtApAmRXxQWx649SZ8Z088t6gfve1V7FMjPHSZ+m0Uf24PCcyuO+5vk1lmTLizdFNl1jS0s56YSSFHelywo3G3TN9VMY7mAN3LJohg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xHbTU4afcP4VPCt7c5t9HdrtExRFqhrJyZbbFA7antU=; b=PtHfUbJaDc5STELSmfCJq0P8LXFjcTdBkb3y2rmA93rEaP9PJ4KF6Qac6dC3hcDP+cdlYqxN84cJzW06sVFdqSnpqMR9JA+dukqUFdMs4fBsOFK7QfXFNpyYIc7t7Zd1sQgp6TGBfG6044mgx5q8lGYtZMElEqBpZeVaMZIofr3M5l5sWS/Pj+41U1TvQU0y43bqFCWI27GrbglVUAYzhxENHcrgE7F747dhH5mxYUrrRkWe2GbUanEW+iIHSlZ3xQ3cvtwiXOIayiVpS5Gj7Vc0p4IjfbQ5U4A1T6xfK4H8XRG39FXJYM2PmIrTOFP1uZNrxIIqy3jDvF1GI//bdQ== From: Volodymyr Babchuk To: "qemu-devel@nongnu.org" CC: David Woodhouse , Stefano Stabellini , Julien Grall , Paul Durrant , Anthony Perard , Kevin Wolf , Hanna Reitz , =?iso-8859-1?Q?Marc-Andr=E9_Lureau?= , Paolo Bonzini , Jason Wang , "open list:X86 Xen CPUs" , "open list:Block layer core" Subject: [PATCH v4 1/6] hw/xen: Set XenBackendInstance in the XenDevice before realizing it Thread-Topic: [PATCH v4 1/6] hw/xen: Set XenBackendInstance in the XenDevice before realizing it Thread-Index: AQHaJMCmNcy1jH3c30+hdicFpfwJ+Q== Date: Sat, 2 Dec 2023 01:41:21 +0000 Message-ID: <20231202014108.2017803-2-volodymyr_babchuk@epam.com> References: <20231202014108.2017803-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231202014108.2017803-1-volodymyr_babchuk@epam.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.42.0 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB3710:EE_|AS8PR03MB7285:EE_ x-ms-office365-filtering-correlation-id: 55de17d1-f2c3-49db-c873-08dbf2d7c995 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: SEmRHbAvkOF1F+M92scRmJda/E2LKTScNWl3z+dwwicVp9uQcdr+2iVtygauYY69ujsvNQ8fDDLrg+hZfMy0hbGE2xC2ir/I8syyhAqBgzqxb0YCEFfHEtDWjxKregYsAm5ozxD8c/4L5H545pnKuXOH3PGF+eWJYkO272X6ZyIg5EoKkjsJCQ9QIYtUXq9vz/ZQJkTuqeu+lTc0Wsh073ytOdtVkKGbc+8mzzmECRDHBMk4vtvAhcs068WR74F4iZJ/tDThkH9letr9MyxUHxzgjXH3vYqzdYvmLZX3J7DA1LBXfvZswojXSVITZBpTyNPbHe3T1ts5YLk0Wk1Lwi77EQAJKEYb7lgdOfsgS6P3NvyCd8ZTmqBl4MRXmmlJnM5HZ3rxIAPfm0QnqrsNZgaLV0y8KJbCQ+/s3FIokXDQzVmNa85lLjjX7xqmYDf+WJvpY8mjxgnjVFfct7z+TfLYX5d0cxYhNaAfUoeKU3fcu5bMpeocUvU3ZvN0gGQV+iSHsZZ+mfB6mjZS15U50wfosfVbTXhjTv0FdJIP6AkvkzsMdSygxR0M6yrYjBn21/rTZP1uOjjOTH6JhfYGCk4fbzEnO7XGRwAXGEAtZdFKgFuBGS5g4tPJk2PDPOW8 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB3710.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(376002)(396003)(366004)(346002)(136003)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(122000001)(38070700009)(41300700001)(2906002)(7416002)(5660300002)(83380400001)(71200400001)(55236004)(38100700002)(6506007)(6512007)(1076003)(2616005)(26005)(66556008)(478600001)(91956017)(6486002)(36756003)(76116006)(66946007)(64756008)(66446008)(8936002)(6916009)(54906003)(86362001)(66476007)(4326008)(316002)(8676002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?a7Qj4f9DRmURavv37ag2UMatMN5hyNgP8Z7r55nTOXOvP97FvNHsSE4rnd?= =?iso-8859-1?Q?8kWS7yXkUo6ngjiKMiuu4Xc7u9Ek3dWG9oz22Bld/rVcOQf2/z1CcX2ZKg?= =?iso-8859-1?Q?oRErpsyVYit/08RSKW5zrFC2XXaLb6+Rt8oP4AvjpnOusvvChMrw2+CpCV?= =?iso-8859-1?Q?ztscTZaLvYU4JTMvXUClaeSMWcCr1jo/0ftUvcQq+py4IJMw4j6XZ0eCRb?= =?iso-8859-1?Q?Ju8opI9MfTZQkO36v/MEEdA2vxyX/pyhOCqbzChz4emeKs0Zy7lTd5+TRa?= =?iso-8859-1?Q?xTZ6jaHeTqm8Jca9ZBO9KQZnBEfikqs51X5HwhzDJUwBD6tRZewSdiLKaj?= =?iso-8859-1?Q?xnIt+nRJ0TVmlTNIr4kRcO0LwkUmPKcUet86uarcAQPuC6egtszvMCIUDh?= =?iso-8859-1?Q?2RBb2CFE9LhzDtQDCX3VcmcZzuFrYcJltrtRz/qSySq4eHJ7YfXBw/J28Q?= =?iso-8859-1?Q?d9cw89STJk7wR7dMDmSQS3mKeq+Lh9oDI/jRljCOzXnl33VSFRbmxLYNDm?= =?iso-8859-1?Q?u5zBan9DGWNuqju1zNn3cp+caWkx0H5vD09MYK81dBWVwFnme6MGzQW7Bt?= =?iso-8859-1?Q?dSfqpwI49JsZ5QpgSFvm3s9PTYBBfdPc+3Z+kWa8hRwVtZOoX7KTc+BOdu?= =?iso-8859-1?Q?sw3NZ6NZnQ6V79afHbr8z/HZhn8f+cq/x2p4L7HP50rZmwBLzC1n4BKJ/0?= =?iso-8859-1?Q?TNLTvCFS+woyXbtwmW7ERZieFT57lUQIrfhfJdNZajITUkJY8DqOCKpwzk?= =?iso-8859-1?Q?eFfKSPyMW3N2xvGtXwoRG1Qdx6XJ79xeqBM01f0RvLeG8j9CpF6AUSZXDK?= =?iso-8859-1?Q?5MAv0mvogyK4Wc55/rhMmzuiw/CYdDF/ocasUEGiU78U+tu9oJvcNoTrr6?= =?iso-8859-1?Q?XWkrZYA8IfdLlqW3KHL4tLvd/1mDk4W5k5iP0Mo0Y8TilucpdGan/J+ct1?= =?iso-8859-1?Q?a6HNuJXx3j7zYjeUgQ+pDM+uMK08bD+CdJL1dGcGsE+GKHmJ6Lc6Z5cA5Q?= =?iso-8859-1?Q?uNgwB/cl9TPaHkKWbZ4eR5Hzi992wxMBqyhrZLgG0oBBTQ5pgAJpG0+cEu?= =?iso-8859-1?Q?nGCiOSspgqef70yEZhZLk6yKqKmJOKC//n+EXZeSN9G6evxLkhDXM4p8fl?= =?iso-8859-1?Q?t6hDhrisnOHFsqE872s3SWiLRvjRJiwtiofzCeljUGCmLvjusAxruCX5it?= =?iso-8859-1?Q?grZfP8badv/l+56Gtc/dAxL7Ghh/6E71Lx62aLMUf2vT5kOaf7MBM0DCD+?= =?iso-8859-1?Q?9rPQ2AZqzG8ytYzRgeWgQZg546nKUG96hTqeugm0uWBS+pUaI9qT7KSVd8?= =?iso-8859-1?Q?26Rp/yocBvWEPF5h9PSdUo/N0GRUWXA7QY4kqNeR7TP6yV6jYZ20xWSqRs?= =?iso-8859-1?Q?ToGtOQoJrYp++EXAMjrtH1PAsjYIwfJLr2dHQYEvTf1aJV7Aq/h++uJRm8?= =?iso-8859-1?Q?1GTatKPZcLP1B8kvq065kzAZ1uKKoguuyneolgBXulrpcl3IYVPHd0ZduL?= =?iso-8859-1?Q?DILV8nHaVs5AEak6MFaSjnHFW4M1bPIITB2qs8oepSjmj2+NVYvL/J6fZF?= =?iso-8859-1?Q?ra2nrHkFN/pARedFLTC6eCmNFuXMlfHxNSF3wTspQzafiAP6xKwVcTjxKI?= =?iso-8859-1?Q?tSjq/l/MQon7RjonEVWNN6FRp/noaZjHEeT5Gu+kW3YLfMNPrLNZjlCA?= =?iso-8859-1?Q?=3D=3D?= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB3710.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55de17d1-f2c3-49db-c873-08dbf2d7c995 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2023 01:41:21.4747 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: OlIU3njXmpGSqJXQCcZYXlAx7K8RNyQRla0IH1J9p5qpS3pMlSPmWdjKjFd0KoFuLc82GOF8QnZx85xzSAJckddQmurvz+W4CcJRzUILGik= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7285 X-Proofpoint-ORIG-GUID: NY1ySJ2ni0D9wvujoIJInK0EAWdhitnJ X-Proofpoint-GUID: NY1ySJ2ni0D9wvujoIJInK0EAWdhitnJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-01_24,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=412 malwarescore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 adultscore=0 spamscore=0 impostorscore=0 clxscore=1015 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312020009 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1701481316740000001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse This allows a XenDevice implementation to know whether it was created by QEMU, or merely discovered in XenStore after the toolstack created it. This will allow us to create frontend/backend nodes only when we should, rather than unconditionally attempting to overwrite them from a driver domain which doesn't have privileges to do so. As an added benefit, it also means we no longer have to call the xen_backend_set_device() function from the device models immediately after calling qdev_realize_and_unref(). Even though we could make the argument that it's safe to do so, and the pointer to the unreffed device *will* actually still be valid, it still made my skin itch to look at it. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- hw/block/xen-block.c | 3 +-- hw/char/xen_console.c | 2 +- hw/net/xen_nic.c | 2 +- hw/xen/xen-backend.c | 15 +-------------- hw/xen/xen-bus.c | 4 ++++ include/hw/xen/xen-backend.h | 2 -- include/hw/xen/xen-bus.h | 2 ++ 7 files changed, 10 insertions(+), 20 deletions(-) diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index 6d64ede94f..c2ac9db4a2 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -1081,13 +1081,12 @@ static void xen_block_device_create(XenBackendInsta= nce *backend, =20 blockdev->iothread =3D iothread; blockdev->drive =3D drive; + xendev->backend =3D backend; =20 if (!qdev_realize_and_unref(DEVICE(xendev), BUS(xenbus), errp)) { error_prepend(errp, "realization of device %s failed: ", type); goto fail; } - - xen_backend_set_device(backend, xendev); return; =20 fail: diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c index 5cbee2f184..bef8a3a621 100644 --- a/hw/char/xen_console.c +++ b/hw/char/xen_console.c @@ -600,8 +600,8 @@ static void xen_console_device_create(XenBackendInstanc= e *backend, goto fail; } =20 + xendev->backend =3D backend; if (qdev_realize_and_unref(DEVICE(xendev), BUS(xenbus), errp)) { - xen_backend_set_device(backend, xendev); goto done; } =20 diff --git a/hw/net/xen_nic.c b/hw/net/xen_nic.c index af4ba3f1e6..afa10c96e8 100644 --- a/hw/net/xen_nic.c +++ b/hw/net/xen_nic.c @@ -627,8 +627,8 @@ static void xen_net_device_create(XenBackendInstance *b= ackend, net->dev =3D number; memcpy(&net->conf.macaddr, &mac, sizeof(mac)); =20 + xendev->backend =3D backend; if (qdev_realize_and_unref(DEVICE(xendev), BUS(xenbus), errp)) { - xen_backend_set_device(backend, xendev); return; } =20 diff --git a/hw/xen/xen-backend.c b/hw/xen/xen-backend.c index b9bf70a9f5..b2e753ebc8 100644 --- a/hw/xen/xen-backend.c +++ b/hw/xen/xen-backend.c @@ -88,19 +88,6 @@ static void xen_backend_list_add(XenBackendInstance *bac= kend) QLIST_INSERT_HEAD(&backend_list, backend, entry); } =20 -static XenBackendInstance *xen_backend_list_find(XenDevice *xendev) -{ - XenBackendInstance *backend; - - QLIST_FOREACH(backend, &backend_list, entry) { - if (backend->xendev =3D=3D xendev) { - return backend; - } - } - - return NULL; -} - bool xen_backend_exists(const char *type, const char *name) { const XenBackendImpl *impl =3D xen_backend_table_lookup(type); @@ -170,7 +157,7 @@ XenDevice *xen_backend_get_device(XenBackendInstance *b= ackend) =20 bool xen_backend_try_device_destroy(XenDevice *xendev, Error **errp) { - XenBackendInstance *backend =3D xen_backend_list_find(xendev); + XenBackendInstance *backend =3D xendev->backend; const XenBackendImpl *impl; =20 if (!backend) { diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index 4973e7d9c9..dd0171ab98 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -1079,6 +1079,10 @@ static void xen_device_realize(DeviceState *dev, Err= or **errp) } } =20 + if (xendev->backend) { + xen_backend_set_device(xendev->backend, xendev); + } + xendev->exit.notify =3D xen_device_exit; qemu_add_exit_notifier(&xendev->exit); return; diff --git a/include/hw/xen/xen-backend.h b/include/hw/xen/xen-backend.h index 0f01631ae7..ea080ba7c9 100644 --- a/include/hw/xen/xen-backend.h +++ b/include/hw/xen/xen-backend.h @@ -10,8 +10,6 @@ =20 #include "hw/xen/xen-bus.h" =20 -typedef struct XenBackendInstance XenBackendInstance; - typedef void (*XenBackendDeviceCreate)(XenBackendInstance *backend, QDict *opts, Error **errp); typedef void (*XenBackendDeviceDestroy)(XenBackendInstance *backend, diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h index 334ddd1ff6..7647c4c38e 100644 --- a/include/hw/xen/xen-bus.h +++ b/include/hw/xen/xen-bus.h @@ -14,9 +14,11 @@ #include "qom/object.h" =20 typedef struct XenEventChannel XenEventChannel; +typedef struct XenBackendInstance XenBackendInstance; =20 struct XenDevice { DeviceState qdev; + XenBackendInstance *backend; domid_t frontend_id; char *name; struct qemu_xs_handle *xsh; --=20 2.42.0 From nobody Wed Nov 27 02:19:05 2024 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; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1701481315; cv=pass; d=zohomail.com; s=zohoarc; b=E8y/4x36+2JQRoGpHNd7tqIBb4VjKBL59JImAjfie7JlvwZOAgKGWJ7R1IWxbKpPHhJ1OvA8O3rJhEBNp1VKLZcYgPYUqwEPxXuTS9lEQzeXpOJvaiB36oW6DotGWicY9rXM0f/Qe9FL+sjso1KZb8lz3z0vTOUCx9pcnirGYAE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701481315; h=Content-Type: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=e1n55VDPs3q/qzv0KviJW7OAskEpl6y9Jb0QmGMv7BY=; b=e11GDAwxE2GgImGTjVoYEhlpFD99GFFVxnu3GLdTg2mFNAARJO90Tm40vVZMWzqx6ZkzO4ZdKYHcgrmwJQzAaC4ygYH3tVRoYAgzIBdFH0Rsma7PweDEL4gcohqoPN7XbTHXdCj2Fb3Plat3tD9ZHVxj+JAKUyw1bmPxxsfQ9vU= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 170148131528436.95749802092246; Fri, 1 Dec 2023 17:41:55 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.645878.1008431 (Exim 4.92) (envelope-from ) id 1r9F0i-0007XY-BP; Sat, 02 Dec 2023 01:41:36 +0000 Received: by outflank-mailman (output) from mailman id 645878.1008431; Sat, 02 Dec 2023 01:41:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r9F0i-0007Wl-8l; Sat, 02 Dec 2023 01:41:36 +0000 Received: by outflank-mailman (input) for mailman id 645878; Sat, 02 Dec 2023 01:41:34 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r9F0g-00072l-LZ for xen-devel@lists.xenproject.org; Sat, 02 Dec 2023 01:41:34 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ebe81143-90b3-11ee-98e5-6d05b1d4d9a1; Sat, 02 Dec 2023 02:41:33 +0100 (CET) Received: from pps.filterd (m0174680.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B21Xj1F026535; Sat, 2 Dec 2023 01:41:28 GMT Received: from eur05-vi1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2169.outbound.protection.outlook.com [104.47.17.169]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3uqt8mg21a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 02 Dec 2023 01:41:28 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by AS8PR03MB7285.eurprd03.prod.outlook.com (2603:10a6:20b:2ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.27; Sat, 2 Dec 2023 01:41:22 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822%6]) with mapi id 15.20.7046.027; Sat, 2 Dec 2023 01:41:22 +0000 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" X-Inumbo-ID: ebe81143-90b3-11ee-98e5-6d05b1d4d9a1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SEAmJw/RfgQlQetNGPXo4byxBirZelVMJD5WPeHgSFmJUwbhNzYy5i9cdd7y333i6TR7fB5xFPJPAvkM1jPqYR5YHa2iyNNTd9mcoDbs8QBO9lcV/O0TxMnt+THk7htiA+aJRr12XbdlOROacR4Qhjrf6wZoEAPrsdWuJ8o9XowXuc9YNI/mv3q8PP411fM0tl3fv207rGUJAW6CtjPBLNjmi5+jsqqis9wwX+TVvOFRwgOaz8gSVhdYYV/NCwqseqEYTmmp1ozhtWkxysdnsi+TeICxVJo8sCKXblgvp74/4DCzvXWRnaqlMm/PseJbNx6q+Xsap42b7UvG9J+A/Q== 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=e1n55VDPs3q/qzv0KviJW7OAskEpl6y9Jb0QmGMv7BY=; b=H14uBLZ9SV8COi0sLNJoH9JCpr2imtKK7egkdqVmpFf35Rxh+r5LlHDoQbfM61YSB2pOrEnhOZUKyc4kGWEIkvap2ImddRXuXfPjy2d/e2rZs2ccuoHFBnKxWe0a3FW5tEMgPhj+WDScFR1E0Ibr4n62c7WubZBkxGFlb3GNfS6rfPRIZIlznjdpNODp+KkvK4WYpG7orhpeONQZ+72QeY1oV4n2v+Ip4q6NBj8dzfm9qUosI9IcRQpq/4u7SFhKgQICxMN2tMZkMUdLQQ4rm2SdOTEmjLLB/sHhASvcF984IPEKl/cVMCMn+0jhPodBNMdcXXX11c3oSuO4eKLnYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e1n55VDPs3q/qzv0KviJW7OAskEpl6y9Jb0QmGMv7BY=; b=cCkpiFp+kXiGriRoI8mV6kMEJOnSJtDNVWy2iCabs7WeOdbpPOd2/mAAG2Q5U1dD+Ta9bTEQcj53B0ijvxqCNzn3PviFqluGOAdV/z2KTrJ9zDURaIEdOk/Q1+xP2XZG/uoR1MJ0T5pzKOdidB5+t8oyzwQny7kt0L57fGpVUh4Be/N9j0C/EBCZeBTLnazDXzQyid3SvNh7DPp9iCzepSdpI70tQPqFiMPZHbGmzEzu3wWTtNLMeh9+bLT/6S0yJ8efWxy2A8Zb5P2kkFnp+YJ1ySLYmFvIEvV2VPH9R0xCQdf7gg0t96VJcTvm/9YRUG/kMJIPkNmb2OLVJ1lCEA== From: Volodymyr Babchuk To: "qemu-devel@nongnu.org" CC: David Woodhouse , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Paul Durrant , Oleksandr Tyshchenko , Anthony Perard , Paul Durrant , Kevin Wolf , Hanna Reitz , Jason Wang , "open list:X86 Xen CPUs" , "open list:Block layer core" Subject: [PATCH v4 2/6] xen: backends: don't overwrite XenStore nodes created by toolstack Thread-Topic: [PATCH v4 2/6] xen: backends: don't overwrite XenStore nodes created by toolstack Thread-Index: AQHaJMCnWt9mOmaDRU+ewbw5BkugTg== Date: Sat, 2 Dec 2023 01:41:21 +0000 Message-ID: <20231202014108.2017803-3-volodymyr_babchuk@epam.com> References: <20231202014108.2017803-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231202014108.2017803-1-volodymyr_babchuk@epam.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.42.0 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB3710:EE_|AS8PR03MB7285:EE_ x-ms-office365-filtering-correlation-id: 2d1ede76-dd9d-4e19-7f6d-08dbf2d7c9c3 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MMThguZxYyc2qA1XGKMz68EIW9kBjMLwXgX1YRmjswg5MpXuBZMFqz4530j4qTmvGfEzf4QpvDgn/ZGqW2ETHypnn2BcQho5f1rD3ECd795v8+XuB7jrOAmJxPkooUBrMKz7qHqpk8g0N5x+cAZJz0+BmnFMg2y+/kbMU8AR/IqKs34JbBTlCZ0McssgU2gp10rCPLkn6EehBP9CjJKxXwde8qG22pBVtINOaTOi+WaaRY71TYSs5O0Fhf4iWbWRCw7dPk00VHowuHpQv+3ax1C8lpSAZ/2ejsn/iv+RKYuip/Nn3rTqT9Zwp44W8fJXH2Q1lvxcBjJ1feEQtENMU7i506AbhuIxBqV4s6Sw2bfLNg0YUwF1WLQK9+4GHrE/bp8/AzonGKIy8ymzvoFP71cAQorIg2P3MueX5DaMWeiUiYlBBesRcDCzfOLBIAC/TynUCvHuc20pw69qwkEd3u7RD2lzskg1zaP1YnMCKkgnrZUqOceiJnOCYcIqUc17xJDvtGLD2TQLB/FsjdqeVb/EXJHXw5ZHmj5pvzniU6sKsg0p/R6kXA0HffwGtitOX40aPKkAGWMZNfUuSD9+45NWMDCfTIyjRGTKLXffsTU3bqhPFSeLuXr1mduZOgma x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB3710.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(376002)(396003)(366004)(346002)(136003)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(122000001)(38070700009)(41300700001)(2906002)(7416002)(5660300002)(83380400001)(71200400001)(55236004)(38100700002)(6506007)(6512007)(1076003)(2616005)(26005)(66556008)(478600001)(91956017)(6486002)(36756003)(76116006)(66946007)(64756008)(66446008)(8936002)(6916009)(54906003)(86362001)(66476007)(4326008)(316002)(8676002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?51HpuABsT+tbpDbgqyY9AbOxSV3pOA+yo7ZIgcKPxX3+Yl3xlM+Vbh+7BR?= =?iso-8859-1?Q?XYv4jUYUkebgveC2lO21EB41Jr5YTve61LB+pxcCCSlhdMzGf0aQsoEhDF?= =?iso-8859-1?Q?FvJOxUkVM4EsfgSN2fMJPybvwzn2GsQtC8E8uyDiR/lHutVXVqDrAMQSfe?= =?iso-8859-1?Q?xQ6WzSOv5NUj7lOtIX6cr5JEkkzXHYyOnpjQ92ux7FEYPBvNXmBR6cBAMF?= =?iso-8859-1?Q?nnfV5wBs4jLtyahgH8ko1lx1oXHMxyPDd4Q5FxwqrU3MkzlxkhN8jU6htt?= =?iso-8859-1?Q?cF4GlEdWrRiEr41xMrYETpOC3MQnnx+ikNPlTKTDOU2tU3HQZihVIJOLSD?= =?iso-8859-1?Q?6nXP0FoNwiYu7KxOlR+Lik4T4bbnbPWrOrOCrCQl4VQp+76Y0bjO5maDB6?= =?iso-8859-1?Q?vNFd2ypi4InVFYGWifRbN3gwvh0JzhlUsbRIewwvVqFmAtKaDjhsHu8E8Y?= =?iso-8859-1?Q?839dLGyN4unOoUouWTUVFiwX8q1l5nCcyF6PdQ3lW8tbV3WUgVwWCDyR+f?= =?iso-8859-1?Q?rVmPzX9cPBop8WyTrH32xdcPnfTodRDQDt06Thpl9S3WV3sO20J83XhRNU?= =?iso-8859-1?Q?QKVLwujHjgxg2aNQ2cy2fB7vzVRkLIqBOahgE8r/AC/CTHI4aYFMcY5302?= =?iso-8859-1?Q?EGxV0F4AsBKz08TKx/NQXmEWS59XgX6QhJAAO+dD8x8MaV7g2vZ53JvSbX?= =?iso-8859-1?Q?X4xtl/j8W0mAm8RkmUJACAAJHT04dQEGNtE1b6NGZCnpST6oAfz1Y5DUU7?= =?iso-8859-1?Q?L8SpGkOpH3RXieHaLIdSF1rTeBeo4VlGNaUGFad9GfReksU4P4JkBrFPxT?= =?iso-8859-1?Q?2Le1rzzGswcfJNsOblU4GNuwa3f9RMQ5ztY3zGp33xfBTQQ0KiTA6PCELu?= =?iso-8859-1?Q?OJDn7a3QfEg90voMtLBRCy7fAvcUpCuVoBu3OuqAHVoqFYHd6kw0htoH3W?= =?iso-8859-1?Q?cziwFFfg2Bg07YlqkX6oaeiA/jbH0ism9ogZpHAxQeaeorK9OnE32CXUsB?= =?iso-8859-1?Q?WAh6dcgySAahJ3ujvVhQybOQk6iW4Fa7Or0uhIT3QJAxOKyM6N9/jEl9dO?= =?iso-8859-1?Q?YyQ03bLk1pqACIgT2hMA+547J22FgmGpC2850M4guwbP30lXN1vcPgRagH?= =?iso-8859-1?Q?cgmsEwuc1L8GY+vzkGHkOpf9fb5XI2+RHoZkjJFKZlvqZ+b9OgoeAby4K0?= =?iso-8859-1?Q?iSRqWyCRfNwh9lyypwXwYPlrlCgYj3UGiWr9grCTXgkUqCrPVn6PI/aNBI?= =?iso-8859-1?Q?oq1Qr+29RfYBqfbGw52YqTcSrisxnbTHA0GC+dcm43bXVQHX9XsYjF9GLY?= =?iso-8859-1?Q?9NIJR1LWsiWZ/D7O733mnUp9qnPf7kAI7acAK/adUOXXdZw6mBQvV+mqjg?= =?iso-8859-1?Q?qzZDdYAVujc4yoyHUDacRewipRBz9hblr8xMtH9nFYmxQ6TKLd7YvfjBHv?= =?iso-8859-1?Q?wVTqXVVgCTH+KIlFa8dxkourpkmKKQqKVjFwk/8AAysb2uMFyOe7VrpyHk?= =?iso-8859-1?Q?bCIpSg8dCkcA9vsk3URnSn0wxZUee/zfXd7ZzLur08dAkA4+Qh9MUNB1IL?= =?iso-8859-1?Q?Zydfq0x1+ubuKDbWQwEir4+KU6Iqn8TfrkdnaJNUkgFcngs8RbnkvuzvUs?= =?iso-8859-1?Q?1yfrMF32EWwJ1zCgl8cFKuCRt6o7rbYfq1HT/UCYDEQnyqvAlYBq3aCg?= =?iso-8859-1?Q?=3D=3D?= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB3710.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d1ede76-dd9d-4e19-7f6d-08dbf2d7c9c3 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2023 01:41:21.8562 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: cMQRk7WlMAfSNsVqy3636sGywGbOhKOh16PGYpKJeoRjC0y1+tJpdgxeO5Gr7PVYuecS2oLks5jbrBk0WCeJBQlTiBHDGHyfDKTPiZzLWgc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7285 X-Proofpoint-ORIG-GUID: vAFYO3NAXhPymQwhKxackEVEJwcDayWJ X-Proofpoint-GUID: vAFYO3NAXhPymQwhKxackEVEJwcDayWJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-01_24,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 phishscore=0 suspectscore=0 impostorscore=0 mlxscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312020009 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1701481316748000002 Content-Type: text/plain; charset="utf-8" Xen PV devices in QEMU can be created in two ways: either by QEMU itself, if they were passed via command line, or by Xen toolstack. In the latter case, QEMU scans XenStore entries and configures devices accordingly. In the second case we don't want QEMU to write/delete front-end entries for two reasons: it might have no access to those entries if it is running in un-privileged domain and it is just incorrect to overwrite entries already provided by Xen toolstack, because toolstack manages those nodes. For example, it might read backend- or frontend- state to be sure that they are both disconnected and it is safe to destroy a domain. This patch checks presence of xendev->backend to check if Xen PV device was configured by Xen toolstack to decide if it should touch frontend entries in XenStore. Also, when we need to remove XenStore entries during device teardown only if they weren't created by Xen toolstack. If they were created by toolstack, then it is toolstack's job to do proper clean-up. Suggested-by: Paul Durrant Suggested-by: David Woodhouse Co-Authored-by: Oleksandr Tyshchenko Signed-off-by: Volodymyr Babchuk Reviewed-by: David Woodhouse --- Changes in v4: - don't touch "tty" entry in the console backend Changes in v3: - Rephrased the commit message --- hw/block/xen-block.c | 16 +++++++++------- hw/net/xen_nic.c | 18 ++++++++++-------- hw/xen/xen-bus.c | 14 +++++++++----- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index c2ac9db4a2..dac519a6d3 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -390,13 +390,15 @@ static void xen_block_realize(XenDevice *xendev, Erro= r **errp) =20 xen_device_backend_printf(xendev, "info", "%u", blockdev->info); =20 - xen_device_frontend_printf(xendev, "virtual-device", "%lu", - vdev->number); - xen_device_frontend_printf(xendev, "device-type", "%s", - blockdev->device_type); - - xen_device_backend_printf(xendev, "sector-size", "%u", - conf->logical_block_size); + if (!xendev->backend) { + xen_device_frontend_printf(xendev, "virtual-device", "%lu", + vdev->number); + xen_device_frontend_printf(xendev, "device-type", "%s", + blockdev->device_type); + + xen_device_backend_printf(xendev, "sector-size", "%u", + conf->logical_block_size); + } =20 xen_block_set_size(blockdev); =20 diff --git a/hw/net/xen_nic.c b/hw/net/xen_nic.c index afa10c96e8..27442bef38 100644 --- a/hw/net/xen_nic.c +++ b/hw/net/xen_nic.c @@ -315,14 +315,16 @@ static void xen_netdev_realize(XenDevice *xendev, Err= or **errp) =20 qemu_macaddr_default_if_unset(&netdev->conf.macaddr); =20 - xen_device_frontend_printf(xendev, "mac", "%02x:%02x:%02x:%02x:%02x:%0= 2x", - netdev->conf.macaddr.a[0], - netdev->conf.macaddr.a[1], - netdev->conf.macaddr.a[2], - netdev->conf.macaddr.a[3], - netdev->conf.macaddr.a[4], - netdev->conf.macaddr.a[5]); - + if (!xendev->backend) { + xen_device_frontend_printf(xendev, "mac", + "%02x:%02x:%02x:%02x:%02x:%02x", + netdev->conf.macaddr.a[0], + netdev->conf.macaddr.a[1], + netdev->conf.macaddr.a[2], + netdev->conf.macaddr.a[3], + netdev->conf.macaddr.a[4], + netdev->conf.macaddr.a[5]); + } netdev->nic =3D qemu_new_nic(&net_xen_info, &netdev->conf, object_get_typename(OBJECT(xendev)), DEVICE(xendev)->id, netdev); diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index dd0171ab98..d0f17aeb27 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -599,8 +599,10 @@ static void xen_device_backend_destroy(XenDevice *xend= ev) =20 g_assert(xenbus->xsh); =20 - xs_node_destroy(xenbus->xsh, XBT_NULL, xendev->backend_path, - &local_err); + if (!xendev->backend) { + xs_node_destroy(xenbus->xsh, XBT_NULL, xendev->backend_path, + &local_err); + } g_free(xendev->backend_path); xendev->backend_path =3D NULL; =20 @@ -764,8 +766,10 @@ static void xen_device_frontend_destroy(XenDevice *xen= dev) =20 g_assert(xenbus->xsh); =20 - xs_node_destroy(xenbus->xsh, XBT_NULL, xendev->frontend_path, - &local_err); + if (!xendev->backend) { + xs_node_destroy(xenbus->xsh, XBT_NULL, xendev->frontend_path, + &local_err); + } g_free(xendev->frontend_path); xendev->frontend_path =3D NULL; =20 @@ -1063,7 +1067,7 @@ static void xen_device_realize(DeviceState *dev, Erro= r **errp) xen_device_backend_set_online(xendev, true); xen_device_backend_set_state(xendev, XenbusStateInitWait); =20 - if (!xen_device_frontend_exists(xendev)) { + if (!xen_device_frontend_exists(xendev) && !xendev->backend) { xen_device_frontend_printf(xendev, "backend", "%s", xendev->backend_path); xen_device_frontend_printf(xendev, "backend-id", "%u", --=20 2.42.0 From nobody Wed Nov 27 02:19:05 2024 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; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1701481362; cv=pass; d=zohomail.com; s=zohoarc; b=e0Bu4w3o0FRAqqtW9IixwOj9Y7gTH5VXvsWmEycZWKedzkQaWd8Qx5qig742sm7BGzFqBwLbVImdhTngVFR3hsbtWDe0GX3NMmIIQLz6JmhabwywHoDg3qpXU/cRkKld9iV3OdU4QZG1Rg7XEf/qRpGo9GGdLfEVWU6790hkY8g= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701481362; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HQ7QrNqUdBOnC13Grzj8pxJaSJ4ipHc7/EE49RhGldU=; b=EqaBDdJjmncJ0YpYutac4DUEQQ9PsjjunLpoAVCav0HBz0fQyG6VSMZNQUw9WASo4bG43WPPHxLwCR5PraK5EwMQVkMb2kHXONvFIquxVWYzRT3DR7xY61CBA6HGwveswMccYbCZiyHxwz/+W6Gd+Qe42uo7KDbrmgTQ5+9cxDw= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1701481362144950.8149253490618; Fri, 1 Dec 2023 17:42:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r9F1P-0007RE-UG; Fri, 01 Dec 2023 20:42:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r9F0u-0007M4-6b for qemu-devel@nongnu.org; Fri, 01 Dec 2023 20:41:48 -0500 Received: from mx0b-0039f301.pphosted.com ([148.163.137.242]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r9F0r-00057l-6h for qemu-devel@nongnu.org; Fri, 01 Dec 2023 20:41:47 -0500 Received: from pps.filterd (m0174683.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 3B21X1Qn015641; Sat, 2 Dec 2023 01:41:27 GMT Received: from eur05-vi1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2168.outbound.protection.outlook.com [104.47.17.168]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3uqa3aucrx-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 02 Dec 2023 01:41:26 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by AS8PR03MB7285.eurprd03.prod.outlook.com (2603:10a6:20b:2ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.27; Sat, 2 Dec 2023 01:41:22 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822%6]) with mapi id 15.20.7046.027; Sat, 2 Dec 2023 01:41:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZGD0e7m4fHO7rrIi7b57NDXGrXsJOiVyUOQy6QMj+OD4PhtJTsbeq7/+d/zTjTRUPF7J3+tk9+sNb3ouWuBfhogPutkQ6w4rAXeGdyWfKymZFICKlvB3Tq3M4ZKHJeFE8s1mvFB2H+j7au+M/J3NbyuZiJzcl0U6U1Pli9m3kd7LFWF6aEOMf+EGOSSNJbvJAq+4DKFAppxDZAKy4mj/0tm6BXoD9EtTIVUNsN0uUKbErO5ibGLO5m+98HjcvW8hOipaEqt7xNy3IRq1Um0FJNVsZhsiN7hvZUr1bnX1FbAN4eegDQ3oDqrg2e+gKaCPfO1g5afqe/RSaV7cZmffvQ== 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=HQ7QrNqUdBOnC13Grzj8pxJaSJ4ipHc7/EE49RhGldU=; b=cX1rfShD156QCdWssHvQjWQ7exwpWXv6TaVaMioyH5dszq/Q4n9GMbR2Iyi7+F2QJyTjBijmtwwrymT2/GOLtb2RryrEaXo6yeMydfeZNgyNgc9M5BZ/IgZ9p+0lPbAwQAkMgQ/RsZVZ3gpCcmKa6jmS0xz2dc7iEFncOqivbv0xpSEukmBuV6f2N3jgkuEuQkDFhNcN5sys1+Nje7ztQkbuJJDeQcX8TrIBeC4aOmITYofa3Ib40sIyivAS5NSfdNKyJ4zml15AGhii06+hrpXIYQC/g15cxUWgey41y+RGxjFeJqIiU4AbRMZVYHZjjQ1JJXgbQf35wzJibQC57w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HQ7QrNqUdBOnC13Grzj8pxJaSJ4ipHc7/EE49RhGldU=; b=SZkF2URPDxzMOTe+isYiG4g0ofM5LAgNufi560Af0UXCpvs9tZdW5XLdSdyyGvAdY7FZwO0Y1nph6TUADDpbYt83VSRVmLUUw5lG6YV5tDlpGd0jZmseM/zWZHU9G7b6Jxuo/04uQVRJ/aqJSmEIWvBqSAUNFrfV7a9m4i7dSUiw/mUp47wB3YjTUqiSjTFsm8Szx3hWHf2IlyuB8qA8oLeJC0qNJXhbUJyfQylHjwij0rNMFSWjJAwTLvb5FWb5Gzw+7z/MKjFey1GhZnQq5rYZSiCAmKn2tPNV+0qikesvN4oPtWf4ppe3Z+dK54wffSiy93YiC6+LlKENP0IGuQ== From: Volodymyr Babchuk To: "qemu-devel@nongnu.org" CC: David Woodhouse , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Anthony Perard , Paul Durrant , "open list:X86 Xen CPUs" Subject: [PATCH v4 3/6] xen: decouple generic xen code from legacy backends codebase Thread-Topic: [PATCH v4 3/6] xen: decouple generic xen code from legacy backends codebase Thread-Index: AQHaJMCnSKd/ZWVB1UiEphLKoDVW4A== Date: Sat, 2 Dec 2023 01:41:22 +0000 Message-ID: <20231202014108.2017803-4-volodymyr_babchuk@epam.com> References: <20231202014108.2017803-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231202014108.2017803-1-volodymyr_babchuk@epam.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.42.0 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB3710:EE_|AS8PR03MB7285:EE_ x-ms-office365-filtering-correlation-id: 7c35c8ea-f2f4-4658-e979-08dbf2d7ca0f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8E8Asu8bD+G16EADm3fUcQycwlOIrVhUcCRzC37BVbITNdVpHuLU+Y1/OhqQUTzMdWX+dE7tExnWIskackhmE8NBm99p50SZx8RQR6VgBq2apabHh5is15YC8lqFje/BzSDhablref1oErRtUQUGTnwtOonmhw0iYT6Sxmnm59pC7k81mwuybGzQE5oOmyIUE/NUrQ2Ea/ed9iIuzNcUrG0r9cBIPd3PYwx7ov/I2PY9vob4hSalcT5n/u6tDPGvD5tcJmqTJRWr7P0ITNg4Fr/PtKUf53pUI7A/ZUIglRiAQWBhoppMdq7lgSMDGfOTfC6J1jt+d5nWm2kPct8Hn4rDgGnTyaJZ8RqecIx/n2HWRfDp9UPtru2vRA9YNiqEHFsh6se9i3GDHU4la5szy74LBvwvsUzLBK3V8CC3B/LZzvuD0VRkT9xMr2Sj6jM8mrp5kdwdu4GWKsN/7GaOijgS5X5wmiqNSsQrMF87Z5PKpKwPjvmJN/iznnxzhZ7VKiRSJ+qirlKXTk+g8sU2tW6o5J9RVfwLgderNPKtPRQ0WV5f1LnKhDZXbUuaQRMeVVDpf7DC6CTHEC2i9CDXl/mC01s3DC1o90rU5DYfZZ8N3e03XyfxRI7PRx/hl6HSH4KohYopgiGLvFKHs3OCLg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR03MB3710.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(376002)(396003)(366004)(346002)(136003)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(122000001)(38070700009)(41300700001)(2906002)(5660300002)(83380400001)(71200400001)(55236004)(38100700002)(6506007)(6512007)(1076003)(2616005)(26005)(66556008)(478600001)(91956017)(6486002)(36756003)(76116006)(66946007)(64756008)(66446008)(8936002)(6916009)(54906003)(86362001)(66476007)(4326008)(316002)(8676002)(41533002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?w85TDjIJhgU03SEmx2jVb22I8cG9cEEElvfMr5gAeeyBTrb6jR9xlwXV4s?= =?iso-8859-1?Q?x/kArsPOEZXSGDKjieueNpchi7CDqwYN53vFzSVJKNvhYK3ylnar3zgzIJ?= =?iso-8859-1?Q?9Q4yJNcEcXe0g0qRS6QWNyOvYEudotb/TVzLWgh0/f/zrBjiHNc50CxdyK?= =?iso-8859-1?Q?zp7QihUKZvQsci/7IMfA29/C25mAZh5uyGACmvnhge4j64jXh847rjbbTq?= =?iso-8859-1?Q?C14ogDLdEH262Cu8QuRH+5tdKuk2oqvc/PKDdWgv6UIQV/23pvRcM4H8Kk?= =?iso-8859-1?Q?omt5UIuqVBrkBWf7LFXsXnfVUwpbXdfaFL9l4MJRorvDV8hz7UYlxEE19A?= =?iso-8859-1?Q?WMPhiCnUXVa9lrZ6BuudL8KHTXB7fHmmCKMyXNwIsU275ffj/x5Dyv4OpE?= =?iso-8859-1?Q?A+13Bn9Pm7jfJY1UwinlgUlqWQhES1g5jTj5X3dGm0t513KyN44sHLe8jt?= =?iso-8859-1?Q?aPbu/Fo1rONqvVonSAA9BlMUVaZ0gWyzZvXaHDUMyZlGmqkaG11RDKgOKE?= =?iso-8859-1?Q?0BX3fq0fh5jbuHDYsWEVOvvfs9/Hskwgzgyw04V0XdNADxWkrBZrT2EqCX?= =?iso-8859-1?Q?hAz1ZoLIGdKjuWJhuktJK0GcqwYmasgR8sK80eqvEahFmJoNxgRkubiktA?= =?iso-8859-1?Q?2qllMkYiU/7P6jKjKNwBAmELs28bz82otcAhuYj/lhgya3E5dM0jO2CNcd?= =?iso-8859-1?Q?M3Hs81vBHlugsWR8e1XiTNxu+JSPmbbKCTJhDRgMqgwsOBkgRCvIlHntKD?= =?iso-8859-1?Q?ykp/QjUmhDmS92Lux/Rjcc3vOKjCXm1mUHCqYixSqZBJpjOWzSC58vLL36?= =?iso-8859-1?Q?6s5Tz61D8CL90bgszowyi7KuwOk8zXDPqzNWggSBvL4r9vaZM2deEKf1rk?= =?iso-8859-1?Q?QFfgk2bubFUTL6dr/Z3Y1FnsjEBQNeGNWDuQUKHDkHG/iPAkrgHhDTijhe?= =?iso-8859-1?Q?+6uSVPH33Siz96IlObP2ji11m96TpMyphq0qhqeKkXLVzolySMBTG5NFf6?= =?iso-8859-1?Q?mPe6JtBzOO700ThldhBZKvtPMvY2DvhLRYkLBK4kS92CubQ5zUDiLtALKn?= =?iso-8859-1?Q?Z2vVzF/MlRW9bsGILRBFg2nuRbFxKCE79ZZlOBqYNM2vohgyZdemmUVSVQ?= =?iso-8859-1?Q?dd0dOWOF7tFHHs3BJk2SZnJK9R59u+m4YMnMka7k+giNBxf/LRllu4JfiJ?= =?iso-8859-1?Q?hyRJUTUCceFK5eOk5/2WLutx1jlAIE0jETgJKH/ucjfPdZjDqIkArjei04?= =?iso-8859-1?Q?mNmZwHoQwIEB1GmqyTsxzsGR72jN5lv3sHvDVreKP0JgT8yLIpG6BjixNj?= =?iso-8859-1?Q?6uR6yULBNK9POoc+1EMR/7rkxRlbrsnh2dC4seIJICCdbn9GoaK1irh2hN?= =?iso-8859-1?Q?CDLzId6XfsADZx0/VFmnSxlZDu1HHBBeVfcnEJuJHuy7rG6xOhgMSKd9Pb?= =?iso-8859-1?Q?uGlmgNeL0FNUl/zwhADltHda7vS8GLVoy2A9JhFoPT+E+05As9FnyjB8Zl?= =?iso-8859-1?Q?l7Ei9IUhGpzprxwODIrF/md5fziur2RMTngmLbGB5UzazltyduOdBMeNgo?= =?iso-8859-1?Q?pOWedCd/uFmzoqIgxtMtDoWcwwvKpo2mH8z9zdiS/1gQ2Eat2p4jUZW/XQ?= =?iso-8859-1?Q?BS5KgT+z46iFdfFn2aZZIojiRVJJUOeVjD8WPXwSk6MY7MqJMMBAKOow?= =?iso-8859-1?Q?=3D=3D?= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB3710.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c35c8ea-f2f4-4658-e979-08dbf2d7ca0f X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2023 01:41:22.4783 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: yRvAfL4Bfj9hEDUmG8q06hammh8xmttkHjqlkeXanvuPrlqCG2gm4xwfpUXyWQipmk0+E6qKtJ+FIu7I1Nn+HCAdepHfhvR+Uz2c5R6B7SM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7285 X-Proofpoint-ORIG-GUID: kWKuNfjc1JuJ-6sL3MVA_lOQrCrkuJ_e X-Proofpoint-GUID: kWKuNfjc1JuJ-6sL3MVA_lOQrCrkuJ_e X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-01_24,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=851 malwarescore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 adultscore=0 spamscore=0 impostorscore=0 clxscore=1015 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312020009 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.137.242; envelope-from=prvs=6700ee1bd8=volodymyr_babchuk@epam.com; helo=mx0b-0039f301.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_H5=0.001, RCVD_IN_MSPIKE_WL=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1701481362791000003 Content-Type: text/plain; charset="utf-8" In xen-all.c there are unneeded dependencies on xen-legacy-backend.c: - xen_init() uses xen_pv_printf() to report errors, but it does not provide a pointer to the struct XenLegacyDevice, so it is kind of useless, we can use standard error_report() instead. - xen-all.c has function xenstore_record_dm_state() which uses global variable "xenstore" defined and initialized in xen-legacy-backend.c It is used exactly once, so we can just open a new connection to the xenstore, update DM state and close connection back. Those two changes allows us to remove xen-legacy-backend.c at all, what should be done in the future anyways. But right now this patch moves us one step close to have QEMU build without legacy Xen backends. Signed-off-by: Volodymyr Babchuk Reviewed-by: Paul Durrant --- In v4: - New in v4, previous was part of "xen: add option to disable legacy backends" - Do not move xenstore global variable from xen-legacy-backend.c, instead use a local variable. --- accel/xen/xen-all.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c index 5ff0cb8bd9..6c2342581f 100644 --- a/accel/xen/xen-all.c +++ b/accel/xen/xen-all.c @@ -33,12 +33,20 @@ xendevicemodel_handle *xen_dmod; static void xenstore_record_dm_state(const char *state) { char path[50]; + struct qemu_xs_handle *xsh =3D qemu_xen_xs_open(); + + if (!xsh) { + error_report("error opening xenstore"); + exit(1); + } =20 snprintf(path, sizeof (path), "device-model/%u/state", xen_domid); - if (!qemu_xen_xs_write(xenstore, XBT_NULL, path, state, strlen(state))= ) { + if (!qemu_xen_xs_write(xsh, XBT_NULL, path, state, strlen(state))) { error_report("error recording dm state"); exit(1); } + + qemu_xen_xs_close(xsh); } =20 =20 @@ -80,18 +88,18 @@ static int xen_init(MachineState *ms) =20 xen_xc =3D xc_interface_open(0, 0, 0); if (xen_xc =3D=3D NULL) { - xen_pv_printf(NULL, 0, "can't open xen interface\n"); + error_report("can't open xen interface\n"); return -1; } xen_fmem =3D xenforeignmemory_open(0, 0); if (xen_fmem =3D=3D NULL) { - xen_pv_printf(NULL, 0, "can't open xen fmem interface\n"); + error_report("can't open xen fmem interface\n"); xc_interface_close(xen_xc); return -1; } xen_dmod =3D xendevicemodel_open(0, 0); if (xen_dmod =3D=3D NULL) { - xen_pv_printf(NULL, 0, "can't open xen devicemodel interface\n"); + error_report("can't open xen devicemodel interface\n"); xenforeignmemory_close(xen_fmem); xc_interface_close(xen_xc); return -1; --=20 2.42.0 From nobody Wed Nov 27 02:19:05 2024 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; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1701481330; cv=pass; d=zohomail.com; s=zohoarc; b=TNVsYVFqNlbh1GJ/Xp8f/2a6Qr72tTCmME79jDQtBLFLQzBcjgaOHjyzipf3XZ1sdeDF31W/fsFB876uojEsj5S86Pc6KY6ntngHxaPvfizaWktuCmQyXpJcb1N0hhCaUyavahqEtrg/n2Y2IG7VhoKTUJI9Y6oVVs946BpCfOk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701481330; h=Content-Type: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=Fd2GMMSSgW+cobh8ZFxigRxf9cE6MrLzy6vrJfU+U7k=; b=nNm2Cx9Ej7muOBZZrkw5rjw6aJAxal2LvHbc4PPLCbnBTcaARxfHR4/U0a1SN2xI/Q6VaRTv2p5vkIyZpkDt7xxuh68uDMrfTI6kUwbpVvn/eC5Mw4wNumXq2bBLkFGIc+pRuAALMOZ61grK6eaqOLPZ6v2sfldKTJxoJr4VPC4= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1701481330726806.9890112167567; Fri, 1 Dec 2023 17:42:10 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.645880.1008452 (Exim 4.92) (envelope-from ) id 1r9F0w-0008MS-7c; Sat, 02 Dec 2023 01:41:50 +0000 Received: by outflank-mailman (output) from mailman id 645880.1008452; Sat, 02 Dec 2023 01:41:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r9F0w-0008MD-2S; Sat, 02 Dec 2023 01:41:50 +0000 Received: by outflank-mailman (input) for mailman id 645880; Sat, 02 Dec 2023 01:41:48 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r9F0u-00072l-4D for xen-devel@lists.xenproject.org; Sat, 02 Dec 2023 01:41:48 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f42cf6f0-90b3-11ee-98e5-6d05b1d4d9a1; Sat, 02 Dec 2023 02:41:47 +0100 (CET) Received: from pps.filterd (m0174683.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 3B21X1Qp015641; Sat, 2 Dec 2023 01:41:28 GMT Received: from eur05-vi1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2168.outbound.protection.outlook.com [104.47.17.168]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3uqa3aucrx-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 02 Dec 2023 01:41:28 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by AS8PR03MB7285.eurprd03.prod.outlook.com (2603:10a6:20b:2ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.27; Sat, 2 Dec 2023 01:41:23 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822%6]) with mapi id 15.20.7046.027; Sat, 2 Dec 2023 01:41:22 +0000 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" X-Inumbo-ID: f42cf6f0-90b3-11ee-98e5-6d05b1d4d9a1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=evgsby7gz/Ac8GwTIfqoRFTRzPmH0hKPD7MXGciMQApj+h6bzr+qiBXDrqvdOeHSOTiAOCf2dDrxrwVXvoQH2IwR9hYCNEtrMDpbhs+TPIl9H8bPeGpytNIkv+Fm9myvomwhMI4W3O2Z35Po3s5jzalZqSjsgNFrvDLuBhNhLc2MFXD9daFmSvZ9OV4QLAl0AwZ9WJ4zE49kMCvnxG6f+qPb21O8K0pXLZW1pRnVBaCZW2ULZGqycTE77OZBnEoW+2cV6iKY4eD85YYh9eCBlbpnVTyzKRTttn/21GDgqQ4roTIW2cwVV1lVoDSyYUnJX1aVprKUchrIzYA6Wj4PoA== 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=Fd2GMMSSgW+cobh8ZFxigRxf9cE6MrLzy6vrJfU+U7k=; b=H8nppiCDopCEb4w4RFLyg5fnqD7n2zxU61EBUWHbI7dOQh95DbaHny/Xn1hZZNUwFC0mYifREFd4Iw5RFHXhyUVHFHxJ44akhw/vcxBpPynz5yrZSqdfpxXlaVdnDUxwqkuhrRabjGIOgGpfEJpEBBCnhI3qhOf+i55FriY0wLlvogGnlKshgNzpr3hExRwz+G0s0iEop5NBxNSOM5wY5fZMnV+KAc2QJ7x+Qr4lrJYK7AIhIMHXF6DDuqY+Vh7cH3Ix/+iuKp0UelppDyWDOGJYuhF0t6KYH06xbG5YCVL77dyJsp/OkLmEtdDDaV8hJXK7P0iRBeETrtmadSi+Nw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Fd2GMMSSgW+cobh8ZFxigRxf9cE6MrLzy6vrJfU+U7k=; b=fhiCsy4UcIdXcJzerKHyeBvLKrFvEnwvUEo38J+B4dtHk+/M0ljwut9yWBYxVk6Jx5thkuLPhrNCj+uVumXUltzf0wyiv2bDAAmONj/xUVfLA6SHIohdh4Jo3ojqh6vgEXP4EYfes49mYNtWDb2oMDOhZ+K8q5gSL3yXyovbKPaAX7kgGrwth4C5Zre7fUmYyeiL4+rYcVXyW5VLE79psW3zhB0NlqOkdqYYCRFRTdXLvJkPCJ5RiU6qBvy6f5FuBL/adjNxjD9R0dublAjDDtZmL3TSHf7wmss6mU7w1wmgVbgPeotG+WbWQeDQpsIkBvI289drc5/Fh2CtdRPAbA== From: Volodymyr Babchuk To: "qemu-devel@nongnu.org" CC: David Woodhouse , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Greg Kurz , Christian Schoenebeck , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Gerd Hoffmann , Anthony Perard , Paul Durrant , =?iso-8859-1?Q?Marc-Andr=E9_Lureau?= , =?iso-8859-1?Q?Daniel_P=2E_Berrang=E9?= , Thomas Huth , =?iso-8859-1?Q?Philippe_Mathieu-Daud=E9?= , "open list:X86 Xen CPUs" Subject: [RFC PATCH v4 4/6] xen: add option to disable legacy backends Thread-Topic: [RFC PATCH v4 4/6] xen: add option to disable legacy backends Thread-Index: AQHaJMCn9jPeta/9M0OenQld9P6brA== Date: Sat, 2 Dec 2023 01:41:22 +0000 Message-ID: <20231202014108.2017803-5-volodymyr_babchuk@epam.com> References: <20231202014108.2017803-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231202014108.2017803-1-volodymyr_babchuk@epam.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.42.0 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB3710:EE_|AS8PR03MB7285:EE_ x-ms-office365-filtering-correlation-id: 5480e286-e83e-4782-b3d8-08dbf2d7ca52 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: CerkD+0MuaBOyAz3p6g74xYtIv9wM49imDVSzEdH3vDYnA3TKQ/rNAsW0LPMKG2ffUlv06Q57NdqD3EpzEKMz8vy3FIRgSoDx+DhZMgyFyoBG6TW6H0nM7cTgy62y6VMkZJ9ZajZcnR9PxjPt8PAz5jMfFSb405akum1WdBgRwO/YQIB9I4Op/hoxpX2y6JeoVlnOT3/yAQ20IfICBWtxzrBuVyHzXj40KVqrll+/M5y+dF44MJPbwoK6uL9SH3DMfSTearFMsNZK+cU1xxZApcKmJhn8fr12Of3W3ymCod57+SqXYdV+5yy9IIgk3onppc1a2VuUOa0NyCgPKHm/HqY7iD+ujZEMihs6ULLDYjjJUlanHg3feVXsHFFbvB9URV5LpF1k6C8wdYwET+c7vxVL6EUWuFpFsbPdDQDHaZBmN5zAO8mYfAYCFfxmWV2/YC3BH3+x/jOy+G0KcvnNI1me00rPnUj7yRGROwETs6zWApkW4d0xoxPkMaLZkj6bH2EMo+J65TN2YbQKyDw+pObl2U2wSh51xdBDYdwf1VqF6/VjKo/ZyECydhc5AQtw3bL0C174OpevwPOjB5QoWTbTnGrz2/4XsB4OBx3tHz7q84SohuyZcBZuUZg9m3lME+XxSEEs5Jf+l3O1d4e1Q== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB3710.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(376002)(396003)(366004)(346002)(136003)(230173577357003)(230273577357003)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(122000001)(38070700009)(41300700001)(2906002)(7416002)(5660300002)(83380400001)(71200400001)(55236004)(38100700002)(6506007)(6512007)(1076003)(2616005)(26005)(66556008)(478600001)(91956017)(966005)(6486002)(36756003)(76116006)(66946007)(64756008)(66446008)(8936002)(6916009)(54906003)(86362001)(66476007)(4326008)(316002)(8676002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?VDaAzlQx3V58HmlzhgqPi4loXNjVAuABbd53jLxEG/sNIsj1WGzNiNpctK?= =?iso-8859-1?Q?FL4qcwfYU4+IhSAJIoibLF/26qGFCTR6P0y42LaVa+xFOTHVMqnHoEljHY?= =?iso-8859-1?Q?rSbjUGyHnuii5/9CSYRNybCv2OZvXAwIy7LQ0+BY3l/zK5ynrZ1ZMVPyw2?= =?iso-8859-1?Q?EwqBxFymhHzeyl73w11KcSTM4wWa8nlbn63FJt594XHO5bhlaz/AZUIB8u?= =?iso-8859-1?Q?cECmvxGZUmUkE/2fBnn1O1VMbl/l/VxXQtyzKqvNtudp4TW5BYwB7ZHPli?= =?iso-8859-1?Q?/hd3BtrdgAI/hsPNEBQQfSBqDmYyeLTRxHRguGQyesEUeOBoVQYISsdSkD?= =?iso-8859-1?Q?qlzuR32seLeic430mKHMbfu2J3DSkZyrPNt/2LnOmKSwSCYF2OtQpNtqxx?= =?iso-8859-1?Q?DsE5suCT/6HyQ96r4wLu4K45XuY56fK6lHPZTkQnFZdxioBojyqpN3pZGH?= =?iso-8859-1?Q?JfAzs6HFYBGhBGpNGt1qQ3R6ywKoekdZaZD5MOJpnMyE1cnDGyHhVEwzNs?= =?iso-8859-1?Q?wnDc0i5dRf9UAmhgbpPVxZ/kZjLx0Nl3E6JdtmLiQ2Zu38+AAgKKd19LVC?= =?iso-8859-1?Q?WjkLyHoEr2FA5iu6YJEHy577zVd8k2WPPlVPRhXpKWO4LOHNPh03fV9qCC?= =?iso-8859-1?Q?97tQexVsPoaRADIiXwIAMxNtbpKVbkNPCk1RHbbhFQqtCpi1fiKGuJaBFX?= =?iso-8859-1?Q?ovPBoQcu0/3uTY+giBx7oXKn5Q83yGPUooNUng7Jpa780DspH1nsfuPoA7?= =?iso-8859-1?Q?YkaMDtZx5QFslBoKPu+w5FxIgZqQBcCjVWW9LFSAq8ftEESM9xjRy+ehJs?= =?iso-8859-1?Q?mVVZCnrP5apO8SQNqIYONFXL0mf9r72aU+jyRxWp3aDhU+Jiyekp3HVEzN?= =?iso-8859-1?Q?RD2NGz/S5iHUjpRAIVdPEaQzEf8ACQ0CjfW+JkCArc0gUiEIpLlsu04S69?= =?iso-8859-1?Q?kr1xYdeUrlS25qTrI6GbSg+fWORhg77+Ec3b9xyMrkcBqPOgR0UPGdnF60?= =?iso-8859-1?Q?pZXvosrul2U1G0/woR5Mvw6PaXeHziDD7xtcKMblvCkDPyEFRXS1TuyTo6?= =?iso-8859-1?Q?HJGpcgUslb1mFGviemRbzgPUI/JiCgktF1DNqEoUUqLGNTLD2rXJ/FNuzJ?= =?iso-8859-1?Q?QGcouD1Tho6q/u2B2UuoIHlugSCbOSLoSqtIJ2OXSauxMoeK3gmD9aQbz6?= =?iso-8859-1?Q?uQiXLN+HBCn1BHhfHoKMuLtuEnf0AVEHoJ2dYaUGN2IKCXKtaEtZMDaVyr?= =?iso-8859-1?Q?ekNm20vVcEuc4NDMB1y4aMV+ZWhfukcj+oRYWD2talnCwBu7E7hq3meRF0?= =?iso-8859-1?Q?slRHEGsnUaoh9TkhKlnIq7W1JLa0RmL4WWeoKm8laDNUZleYgHu19250Kq?= =?iso-8859-1?Q?econ0iUM3gR+uGe+CAsudp4nvvIThbVpT9F0oWGmYHumKGVyOcADDAYmK9?= =?iso-8859-1?Q?GsT1e/XXAZJ7m7v4UEpUYp7T8dNKY602XQUzryzseRRKx8FkqJN+UpXeX/?= =?iso-8859-1?Q?T8TCrPQ7dDpKYs9og019SVfsrLF9kp+wxY1As0VPNwha1KloYAj0shqjhi?= =?iso-8859-1?Q?SyLLUF59TssiwtDgjUCmMuyH1FIVy/UWGNhWj9qP7sgOzAd3VmEWs0BUyd?= =?iso-8859-1?Q?Ht3yGMgc1SsgaAmsKYcjOK0s7Cdk5NAOWxaj81VEEUbMjVPLHQy3Udog?= =?iso-8859-1?Q?=3D=3D?= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB3710.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5480e286-e83e-4782-b3d8-08dbf2d7ca52 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2023 01:41:22.9033 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: a1qj5xIyQoXDsKFOo/VQUNU3VnUIgQn/vGUHu79TGShyRiwd+nswyBKKUDkz/0BPoZL9hhI5/tGNHz4LNnnRRAwhsgUl9SDAlUdoZwZBejE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7285 X-Proofpoint-ORIG-GUID: auP1DLL3KenOzM_fnUodKFyRiOKe1i-B X-Proofpoint-GUID: auP1DLL3KenOzM_fnUodKFyRiOKe1i-B X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-01_24,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 adultscore=0 spamscore=0 impostorscore=0 clxscore=1015 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312020009 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1701481332750000001 Content-Type: text/plain; charset="utf-8" This patch makes legacy backends optional. As was discussed at [1] this is a solution to a problem when we can't run QEMU as a device model in a non-privileged domain. This is because legacy backends assume that they are always running in domain with ID =3D 0. Actually, this may prevent running QEMU in a privileged domain with ID not equal to zero. With this patch it is possible to provide "--disable-xen-legacy-backends" configure option to get QEMU binary that can run in a driver domain. With price of not be able to use legacy backends of course. [1] https://lists.gnu.org/archive/html/qemu-devel/2023-11/msg05022.html Signed-off-by: Volodymyr Babchuk --- I am not sure if I made correct changes to build system, so this patch is tagged as RFC. Changes in v3: - New patch in v3 --- hw/9pfs/meson.build | 4 +++- hw/display/meson.build | 4 +++- hw/i386/pc.c | 2 ++ hw/usb/meson.build | 5 ++++- hw/xen/meson.build | 11 ++++++++--- hw/xen/xen-hvm-common.c | 2 ++ hw/xenpv/xen_machine_pv.c | 2 ++ meson.build | 5 +++++ meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 4 ++++ 10 files changed, 35 insertions(+), 6 deletions(-) diff --git a/hw/9pfs/meson.build b/hw/9pfs/meson.build index 2944ea63c3..e8306ba8d2 100644 --- a/hw/9pfs/meson.build +++ b/hw/9pfs/meson.build @@ -15,7 +15,9 @@ fs_ss.add(files( )) fs_ss.add(when: 'CONFIG_LINUX', if_true: files('9p-util-linux.c')) fs_ss.add(when: 'CONFIG_DARWIN', if_true: files('9p-util-darwin.c')) -fs_ss.add(when: 'CONFIG_XEN_BUS', if_true: files('xen-9p-backend.c')) +if have_xen_legacy_backends + fs_ss.add(when: 'CONFIG_XEN_BUS', if_true: files('xen-9p-backend.c')) +endif system_ss.add_all(when: 'CONFIG_FSDEV_9P', if_true: fs_ss) =20 specific_ss.add(when: 'CONFIG_VIRTIO_9P', if_true: files('virtio-9p-device= .c')) diff --git a/hw/display/meson.build b/hw/display/meson.build index 344dfe3d8c..18d657f6b3 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -14,7 +14,9 @@ system_ss.add(when: 'CONFIG_PL110', if_true: files('pl110= .c')) system_ss.add(when: 'CONFIG_SII9022', if_true: files('sii9022.c')) system_ss.add(when: 'CONFIG_SSD0303', if_true: files('ssd0303.c')) system_ss.add(when: 'CONFIG_SSD0323', if_true: files('ssd0323.c')) -system_ss.add(when: 'CONFIG_XEN_BUS', if_true: files('xenfb.c')) +if have_xen_legacy_backends + system_ss.add(when: 'CONFIG_XEN_BUS', if_true: files('xenfb.c')) +endif =20 system_ss.add(when: 'CONFIG_VGA_PCI', if_true: files('vga-pci.c')) system_ss.add(when: 'CONFIG_VGA_ISA', if_true: files('vga-isa.c')) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 29b9964733..91857af428 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1263,7 +1263,9 @@ void pc_basic_device_init(struct PCMachineState *pcms, pci_create_simple(pcms->bus, -1, "xen-platform"); } pcms->xenbus =3D xen_bus_init(); +#ifdef CONFIG_XEN_LEGACY_BACKENDS xen_be_init(); +#endif } #endif =20 diff --git a/hw/usb/meson.build b/hw/usb/meson.build index e94149ebde..8d395745b2 100644 --- a/hw/usb/meson.build +++ b/hw/usb/meson.build @@ -84,6 +84,9 @@ if libusb.found() hw_usb_modules +=3D {'host': usbhost_ss} endif =20 -system_ss.add(when: ['CONFIG_USB', 'CONFIG_XEN_BUS', libusb], if_true: fil= es('xen-usb.c')) +if have_xen_legacy_backends + system_ss.add(when: ['CONFIG_USB', 'CONFIG_XEN_BUS', libusb], + if_true: files('xen-usb.c')) +endif =20 modules +=3D { 'hw-usb': hw_usb_modules } diff --git a/hw/xen/meson.build b/hw/xen/meson.build index d887fa9ba4..964c3364f2 100644 --- a/hw/xen/meson.build +++ b/hw/xen/meson.build @@ -2,11 +2,16 @@ system_ss.add(when: ['CONFIG_XEN_BUS'], if_true: files( 'xen-backend.c', 'xen-bus-helper.c', 'xen-bus.c', - 'xen-legacy-backend.c', - 'xen_devconfig.c', - 'xen_pvdev.c', )) =20 +if have_xen_legacy_backends + system_ss.add(when: ['CONFIG_XEN_BUS'], if_true: files( + 'xen_pvdev.c', + 'xen-legacy-backend.c', + 'xen_devconfig.c', + )) +endif + system_ss.add(when: ['CONFIG_XEN', xen], if_true: files( 'xen-operations.c', )) diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index 565dc39c8f..2e7897dbd2 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -869,7 +869,9 @@ void xen_register_ioreq(XenIOState *state, unsigned int= max_cpus, =20 xen_bus_init(); =20 +#ifdef CONFIG_XEN_LEGACY_BACKENDS xen_be_init(); +#endif =20 return; =20 diff --git a/hw/xenpv/xen_machine_pv.c b/hw/xenpv/xen_machine_pv.c index 9f9f137f99..03a55f345c 100644 --- a/hw/xenpv/xen_machine_pv.c +++ b/hw/xenpv/xen_machine_pv.c @@ -37,7 +37,9 @@ static void xen_init_pv(MachineState *machine) setup_xen_backend_ops(); =20 /* Initialize backend core & drivers */ +#ifdef CONFIG_XEN_LEGACY_BACKENDS xen_be_init(); +#endif =20 switch (xen_mode) { case XEN_ATTACH: diff --git a/meson.build b/meson.build index ec01f8b138..c8a43dd97d 100644 --- a/meson.build +++ b/meson.build @@ -1749,6 +1749,9 @@ have_xen_pci_passthrough =3D get_option('xen_pci_pass= through') \ error_message: 'Xen PCI passthrough not available on this platf= orm') \ .allowed() =20 +have_xen_legacy_backends =3D get_option('xen-legacy-backends').require(xen= .found(), + error_message: 'Xen legacy backends requested but Xen not enabl= ed').allowed() + =20 cacard =3D not_found if not get_option('smartcard').auto() or have_system @@ -2219,6 +2222,7 @@ config_host_data.set('CONFIG_DBUS_DISPLAY', dbus_disp= lay) config_host_data.set('CONFIG_CFI', get_option('cfi')) config_host_data.set('CONFIG_SELINUX', selinux.found()) config_host_data.set('CONFIG_XEN_BACKEND', xen.found()) +config_host_data.set('CONFIG_XEN_LEGACY_BACKENDS', have_xen_legacy_backend= s) config_host_data.set('CONFIG_LIBDW', libdw.found()) if xen.found() # protect from xen.version() having less than three components @@ -3049,6 +3053,7 @@ config_all +=3D config_targetos config_all +=3D config_all_disas config_all +=3D { 'CONFIG_XEN': xen.found(), + 'CONFIG_XEN_LEGACY_BACKENDS': have_xen_legacy_backends, 'CONFIG_SYSTEM_ONLY': have_system, 'CONFIG_USER_ONLY': have_user, 'CONFIG_ALL': true, diff --git a/meson_options.txt b/meson_options.txt index c9baeda639..91dd677257 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -77,6 +77,8 @@ option('nvmm', type: 'feature', value: 'auto', description: 'NVMM acceleration support') option('xen', type: 'feature', value: 'auto', description: 'Xen backend support') +option('xen-legacy-backends', type: 'feature', value: 'auto', + description: 'Xen legacy backends (9pfs, fb, qusb) support') option('xen_pci_passthrough', type: 'feature', value: 'auto', description: 'Xen PCI passthrough support') option('tcg', type: 'feature', value: 'enabled', diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 680fa3f581..b5acef008f 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -218,6 +218,8 @@ meson_options_help() { printf "%s\n" ' werror Treat warnings as errors' printf "%s\n" ' whpx WHPX acceleration support' printf "%s\n" ' xen Xen backend support' + printf "%s\n" ' xen-legacy-backends' + printf "%s\n" ' Xen legacy backends (9pfs, fb, qusb) su= pport' printf "%s\n" ' xen-pci-passthrough' printf "%s\n" ' Xen PCI passthrough support' printf "%s\n" ' xkbcommon xkbcommon support' @@ -556,6 +558,8 @@ _meson_option_parse() { --disable-whpx) printf "%s" -Dwhpx=3Ddisabled ;; --enable-xen) printf "%s" -Dxen=3Denabled ;; --disable-xen) printf "%s" -Dxen=3Ddisabled ;; + --enable-xen-legacy-backends) printf "%s" -Dxen-legacy-backends=3Denab= led ;; + --disable-xen-legacy-backends) printf "%s" -Dxen-legacy-backends=3Ddis= abled ;; --enable-xen-pci-passthrough) printf "%s" -Dxen_pci_passthrough=3Denab= led ;; --disable-xen-pci-passthrough) printf "%s" -Dxen_pci_passthrough=3Ddis= abled ;; --enable-xkbcommon) printf "%s" -Dxkbcommon=3Denabled ;; --=20 2.42.0 From nobody Wed Nov 27 02:19:05 2024 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; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1701481456; cv=pass; d=zohomail.com; s=zohoarc; b=XwK6bIJm2lswaNmzx3doq0bS5SFdDImJBVJd2dzCdiW4Nj4QXybfHHhX9dnH4MGNP2mgrhMY6BFVjpmSKv61ONgE0o6Ft6hRVl4FVrlosAC5cHOWAqvQK7Gl2GZYLl/JbX/SpJIdT0UD52NoAGkB9EvmQiWTq7vLug3dd2wp5Fc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701481456; h=Content-ID:Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=602dKa1VR8fPvQHqtVLjjZVu2RbSyKF63LAUWSpxQ3M=; b=ZM9biixLZTKqhLPmbl37KFO+OBw+/N0z43Aj/Qg7GL9UryUdqfTQmxyUwjtJbd7MjFI2ZCV6WVFDh1cIohZUFK5sK5FEUcB4OUmNh42WVBpRVejYcYg9AXTp0Q4Y2SxraY6xkVq+bPLF/NZG/GpcCfR428mpD7iQVSUOBkd/o9o= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1701481456660779.2138237844067; Fri, 1 Dec 2023 17:44:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r9F1f-0007ZE-Fe; Fri, 01 Dec 2023 20:42:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r9F0u-0007M3-6B; Fri, 01 Dec 2023 20:41:48 -0500 Received: from mx0b-0039f301.pphosted.com ([148.163.137.242]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r9F0n-00057W-TB; Fri, 01 Dec 2023 20:41:47 -0500 Received: from pps.filterd (m0174683.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 3B21X1Qo015641; Sat, 2 Dec 2023 01:41:28 GMT Received: from eur05-vi1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2168.outbound.protection.outlook.com [104.47.17.168]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3uqa3aucrx-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 02 Dec 2023 01:41:27 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by AS8PR03MB7285.eurprd03.prod.outlook.com (2603:10a6:20b:2ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.27; Sat, 2 Dec 2023 01:41:23 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822%6]) with mapi id 15.20.7046.027; Sat, 2 Dec 2023 01:41:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OaLUJZVHbDztQuejeV3sVzX9LQU04aVbSmv6N1+oehtTnAAhn/d0BRXPldl2gYXq2KaPN9ErL2dLwwsVPG4DzjCbs/+cBHHP7vzC4FXsZ1ZlidenVD2ZGTl7Z0Z6LueVkvtprsCld3qxHXba9Jib6WuP3dGZ3PxtWY3m6VF4fojNRb5hpSeI6KGDfwL4hxq8PV9aWQM+lLemx6GrB9atYebLl/6dfb+4nHC02TVaYBW3xmxCDMz51aD7gFzUCUCJuqbPh63ihiqIZlmF8BS5P/LkLfgbLOz4AEclRyjotWpYccn0n+RVFF6Rbn1Y2LXH0KZNY5QbnsvXiGUSbxfUlQ== 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=602dKa1VR8fPvQHqtVLjjZVu2RbSyKF63LAUWSpxQ3M=; b=n5j+mlTaClkxyp0BuuIR4D9Qif3k2R5aIZOsruCjfVhMMaE/Fb2MKDI//oLt6GoKcTLPaF9Dbm0ddoBOKOB4xpSh1zxkxO0glRHmR4rkciPCN9ss8tbXO6fmg07dyVR7YZ5uSThrKtBmeVZ7v3cams7U1+VeV6DXSwSj1oOeJRYxYn84+twy38J8vOmVfHgu3J6AFgL6RSsWUxG3Yz+GfoGnRmrDYpnD0GcJKyMsCsM5tT6cuZxRWO/8rmC6yqZpAy1t6DKT4CrswmJUFMsDgt8JfH/SrdVs0SpQJciGGQVymv2BwWjmITd7P/AV9tYeyblDOXqM3ehKqZ1UG1nXBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=602dKa1VR8fPvQHqtVLjjZVu2RbSyKF63LAUWSpxQ3M=; b=jmtdybKPcY4lEbWoQ99WvmhKu6sGJJDGM3Vv4VcsJgkESUcB7X2AhT9dOMfKwrbezhkHQ8sR6CQSNihRCRfSZZ2nBsO6YBFWIRVA0/Y3UrF18GiihDS5g7jm+X8nBCnJtA48k3CGXvXv0hfwJcnf/EFvArRK8nLuxkiIAMZo2tWQ/7bGIn833iHAmNL46MVTHkaVSntgX1i8gHBeZjxct5s/ewXcV2NjXKACPB7Pc/3AFNMRr7Tn2LeTVe9VmaAJgdv7TvugrjW72J/E4IvdR51qoQcsmpy5YQPh0Ecjr13RoHkn8DKo6/Izcpu67GZqEDLQLDnv3lobQOvLy0RAdg== From: Volodymyr Babchuk To: "qemu-devel@nongnu.org" CC: David Woodhouse , Stefano Stabellini , Julien Grall , Oleksandr Tyshchenko , Volodymyr Babchuk , =?utf-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= , Peter Maydell , "open list:ARM TCG CPUs" Subject: [PATCH v4 5/6] xen_arm: set mc->max_cpus to GUEST_MAX_VCPUS Thread-Topic: [PATCH v4 5/6] xen_arm: set mc->max_cpus to GUEST_MAX_VCPUS Thread-Index: AQHaJMCoUgquUnKvjU6ewDeCcsRksA== Date: Sat, 2 Dec 2023 01:41:23 +0000 Message-ID: <20231202014108.2017803-6-volodymyr_babchuk@epam.com> References: <20231202014108.2017803-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231202014108.2017803-1-volodymyr_babchuk@epam.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.42.0 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB3710:EE_|AS8PR03MB7285:EE_ x-ms-office365-filtering-correlation-id: e70983a7-4d8f-4f2d-df4e-08dbf2d7ca8b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: +s0BWuGbZAopSfMhTEaqbTkFuUiXuR19EHTqtUxKwmvHHJrR2SZyYgmi6h8dGwpOhF0U1Rgpakk8Ien6fQ4WcXK6H5Rd6R1ZfhmCFIBg99OpJFdcLgnpw45HZfvbuKtyuTU7tEW7rDlw5uCm0G2w8MUBLfgvhZ3eTqCSVOyLK9TQYXKKuyantVjZiqjOfvprou4in6zz6VMVmC+K70Eq9l53ActWBCybkQy9+yjIAEzkvxSTgugvYvQkz/6IIkK9y01NjgRyj8RVq7zubFxZu/8aWxh6H0MBO1eWdD5BnT/TS+T3XwsgbqAR7FWhjXG9jvGStypGUEQgrqyS9r6T595gg/ndFj7VOdCuYQXKmZFHR+/RPSyFNtFHJaOK7anCLQ5zwL0fwpqfqywmmftWkg8OVljiV1H6B3xP1B9dDP0vn3zSXHQx5sUhvOO0a+3XOXHOTcJYGOvBxuMSMQXoMBaACOD+xc4awbtWNlM9Ju229ONPeMKiUiL+3u4POjwlGo+H/TP97svK9JAP9+QABsK3Oe0IeHo9+0NZhln8us7b5XVjHUqISrx0e8/EQ/V9eRo9ifJEZNTNe2xVPj8FqkevFhzA6UP2ZqLmXU54XSySZ2aGImMwtqpfE0bAh6V1 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR03MB3710.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(376002)(396003)(366004)(346002)(136003)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(122000001)(38070700009)(41300700001)(2906002)(5660300002)(83380400001)(71200400001)(55236004)(38100700002)(6506007)(6512007)(1076003)(2616005)(26005)(66556008)(478600001)(91956017)(6486002)(36756003)(76116006)(66946007)(64756008)(66446008)(8936002)(6916009)(54906003)(86362001)(66476007)(4326008)(316002)(8676002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?ZlV5eThXcW9ZOWYxb3VxbTh6SEVUWmJ1S3BIclJFQ0dmR3gybXd6YmRKT05L?= =?utf-8?B?amY3UXUwVmo1aWdib2pzbkdFUkJtWXNqZmJhZThqZ2Zka1d1L1Z2aTh3U0ha?= =?utf-8?B?elRPNkRoRkorRlBMeERXbVVDZGx0dlhhQTRmNk1adXpNYkU1QTJWWmY5WS91?= =?utf-8?B?Mm55K0JnMUQ2bVBQeWk2NGw0UEY5RTdMY0MzR2hEc0tSbUcwYVRmYkxpRlZ6?= =?utf-8?B?RHRpUjRVUENod0RDVHM0Zk9oTGorSDFUUkQ0aEdJdURJRW52aHE0RmZZQk9B?= =?utf-8?B?MVR3NldKM2taLzdEbzdMd3htcmU3RWRyaFZZOUhDRHUrMEF5b2MvbGpYT3dv?= =?utf-8?B?ZWZ5b1B0N0NlNjJ5Zi94bk5tak11MGo3dlJKNEFQUjBsdlFHMFVZd2FvTGhy?= =?utf-8?B?cjhhdlFieTFrYkZwc1Vpem1rNHE1VDYxRGd4TDNwUEVuTlkrRzRpRTVwVU1F?= =?utf-8?B?aEJnZ2p3YW9EdmFFdDhxVVhZTmpoejZzOHcyaXhpZjVjaXhVVHRhOHRoSy9L?= =?utf-8?B?Szl5aCtoM0Q0SExDbXA3bHc0T0tub1QwOC9GbzVXUTZKbnVEMzlUUjRXOFhW?= =?utf-8?B?UHduV1lsT3BBZmZtZjd3VDd4Uko3R3lyQVFDSFBRMFdUK0l4NFNnTjc4RCtF?= =?utf-8?B?YUwvR1NwcmV6YndPbTlQenVQbDluSlNSeHE1bS9JU3V5Y2dxM2xScnBSMHEr?= =?utf-8?B?dUt5aGYwRk44Njdabm8zUzVaYXF1RHdKeEdhSUZSa2IxdlZFQStxWlFnc2RD?= =?utf-8?B?N1p5T1BUUEJPWXgyb25xR1FTdTk1MktmV0xyU3M4ZmNsNEgybDN0TVVPU2p4?= =?utf-8?B?TkY1OUVkWHlDZ0N3b0U4c3pXVXJuMmFabEpIeGVkYWZSb1RTKzFwME1Yd0dm?= =?utf-8?B?bytIQ2h1M0NoYi94WURuQWo0QVZ0Q2I5YkdGSFZFeERsRUdXVEFyQ2xBUEFS?= =?utf-8?B?R2tRUXBadVBrVi9xVjBwU25GTkMrcWhjQjRaN1ZzbTZibVp1d29NdjAxYjBk?= =?utf-8?B?NTVzTUUyRzkzTkdqRmFLUit3a0FsSXlSWGRQTEUxYm5TWVY0c3pYd3RvMWZp?= =?utf-8?B?MUVHcmxDVEdVVWg0ckhEUUdBY21VOXMyTUVGeUhyMERWUFA2amJaMkRoOHIy?= =?utf-8?B?R09TYXlLUitjRWgvOFpYT2JBWmg2T3VvZ3VwS0oycDl2RkFEak51Tjh5cmo3?= =?utf-8?B?cCtZV3JneUora01OY09tWDFrK2RBdU1nSlIrUnQrSEhVME9RMzM5NjVhZkk1?= =?utf-8?B?QzJQRStKM0pxOWpsSm9xMzRhTGc3ODZUenpiRTRzeVk3b0lGSUx1cWRYTFU4?= =?utf-8?B?THFUQTRFTldtME1oS3lWQk1kVDBiUW9zUDRmSHEza3pOdkk5RHY3S2NZdHFi?= =?utf-8?B?alVjZW5NbmVGUEhuQXZzRDRMZWMzRE0va2xWdE41VkNWZXpTSHd2U2tlMm5m?= =?utf-8?B?QS9YY2psb1dCd0VRVjd4VUdOZFpJYTkzOVdTNHcvaU9hY2F3Z1BvRHAwbllG?= =?utf-8?B?bUZVSVJ4UWRGMjZsVWtacGdOWWkwK1dvaXpJNHZXNWRYeTNJSCtRUlFDODM1?= =?utf-8?B?VTdndVhYMFZIUW9wTk5nZWEwVjhwMTJnMytISUpRWVNvdUh0czJqaWgwSkFV?= =?utf-8?B?djB0RW5ZTjhHMGM0YjU2ZkNZQkxoNVBWMnVsTVcxbnhkSGdDN3V0bHJ5cFBh?= =?utf-8?B?U0tqYjlNNC9CTHpkVHBBVkE3cmF0ZmRLRHJtVE8xL01vaDJKbXo1YURPNFY1?= =?utf-8?B?NXF3RSt4M2greXJlVkh5UmdhUFlBRENnb3RlY0JSa0lNTWwrRytYazg4VVdK?= =?utf-8?B?K2NmdG5wQStBTlRIOW9IYnRQRVpnWUNPQzRIMDZpcnRlOUVHbktPZUdGWXFo?= =?utf-8?B?VHFiWjlYWGg1TkFoc2hwUkFsSUNlMFptbDErdXZYNTI1WndIU0p2MnZtVzJI?= =?utf-8?B?WmwzU1VuSmxjbThkUmU4WDZUVmhidXJKVk1KdEJvWVhER21QZk9TMFZBMnFH?= =?utf-8?B?Q2wrWHlSd3Y5SVdQUnZJWXZERFU3THNxR1pHTms1MU42REc1dk1tcmFlSHla?= =?utf-8?B?VGhQclkvYUdwTFRLMlJVT0MrZjZ5cSsxUUUzdW13VVYxVnZaUERZbTZEQ0Zp?= =?utf-8?B?RVQ2ZG5pMEFkZnB0cW14dDA4L3Z2YTdvaWRuWGNSMXlpR2hFNEtkRkI2dXJy?= =?utf-8?B?VVE9PQ==?= Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB3710.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e70983a7-4d8f-4f2d-df4e-08dbf2d7ca8b X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2023 01:41:23.2558 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 93VqHggG33F6TgXuJ/tp66ZEcCvhd05TUHlugZb2BVT1QYQD+oEV6jiM32nRXuyNPtb5/A2Nh11NbNZ/fqpuSFmg5uaOwPOcOc0sGQeMk/Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7285 X-Proofpoint-ORIG-GUID: 8ZBby8TmH1h2ph8djR-WB88q5H98YnKi X-Proofpoint-GUID: 8ZBby8TmH1h2ph8djR-WB88q5H98YnKi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-01_24,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 adultscore=0 spamscore=0 impostorscore=0 clxscore=1015 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312020009 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.137.242; envelope-from=prvs=6700ee1bd8=volodymyr_babchuk@epam.com; helo=mx0b-0039f301.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_H5=0.001, RCVD_IN_MSPIKE_WL=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1701481457055000001 From: Oleksandr Tyshchenko The number of vCPUs used for the IOREQ configuration (machine->smp.cpus) should really match the system value as for each vCPU we setup a dedicated evtchn for the communication with Xen at the runtime. This is needed for the IOREQ to be properly configured and work if the involved domain has more than one vCPU assigned. Set the number of current supported guest vCPUs here (128) which is defined in public header arch-arm.h. So when the toolstack pass max_vcpus using "-smp" arg, machine creation will not fail. Signed-off-by: Oleksandr Tyshchenko Signed-off-by: Volodymyr Babchuk Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/xen_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c index a5631529d0..b9c3ae14b6 100644 --- a/hw/arm/xen_arm.c +++ b/hw/arm/xen_arm.c @@ -231,7 +231,7 @@ static void xen_arm_machine_class_init(ObjectClass *oc,= void *data) MachineClass *mc =3D MACHINE_CLASS(oc); mc->desc =3D "Xen Para-virtualized PC"; mc->init =3D xen_arm_init; - mc->max_cpus =3D 1; + mc->max_cpus =3D GUEST_MAX_VCPUS; mc->default_machine_opts =3D "accel=3Dxen"; /* Set explicitly here to make sure that real ram_size is passed */ mc->default_ram_size =3D 0; --=20 2.42.0 From nobody Wed Nov 27 02:19:05 2024 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; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1701481321; cv=pass; d=zohomail.com; s=zohoarc; b=m/AfwtYR4jDZp/rKYqmqZ2z9nABGMdPZHeGffibWGpGksng/0JngMVue92fP7vtzsj8BvluPQj6FiqLkUNKCNq1zovEquwDjd0Zn+KmgZdJAq56mcopssNK/K0AwnvrsBUefTv/rkcfLNosCWpITHxDpGVSZ6e0dFxdQllw1+lc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701481321; h=Content-Type: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=D1sE3o7/1/WPykkUQrLgvygBnr35JJ7+xArB8a3+h6c=; b=Xx5YGWBu4jvE/AkrTTUNvNaK1ZheIaWW9TTrHs1Hh+XkYB5Zt47biaMSx0bYfR5fQrXTqvdo7xUTPQa5xY2Qtz0Y9Pnw6pifZrXGK5CdmH80Wcn5kz7aiuRzon/sUI3lJVagn8qGS1kl6GEbZB8qGe/a7hcCz5iFZV6zpHIvpRA= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1701481321441809.0155389295238; Fri, 1 Dec 2023 17:42:01 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.645879.1008441 (Exim 4.92) (envelope-from ) id 1r9F0k-0007qM-KU; Sat, 02 Dec 2023 01:41:38 +0000 Received: by outflank-mailman (output) from mailman id 645879.1008441; Sat, 02 Dec 2023 01:41:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r9F0k-0007qD-H4; Sat, 02 Dec 2023 01:41:38 +0000 Received: by outflank-mailman (input) for mailman id 645879; Sat, 02 Dec 2023 01:41:37 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r9F0j-0007jp-Cq for xen-devel@lists.xenproject.org; Sat, 02 Dec 2023 01:41:37 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ec9ee78c-90b3-11ee-9b0f-b553b5be7939; Sat, 02 Dec 2023 02:41:34 +0100 (CET) Received: from pps.filterd (m0174680.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B21Xj1G026535; Sat, 2 Dec 2023 01:41:29 GMT Received: from eur05-vi1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2169.outbound.protection.outlook.com [104.47.17.169]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3uqt8mg21a-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 02 Dec 2023 01:41:28 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by AS8PR03MB7285.eurprd03.prod.outlook.com (2603:10a6:20b:2ef::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.27; Sat, 2 Dec 2023 01:41:23 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822%6]) with mapi id 15.20.7046.027; Sat, 2 Dec 2023 01:41:23 +0000 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" X-Inumbo-ID: ec9ee78c-90b3-11ee-9b0f-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jGCrxnIg0hx0I3TroprqXEzfV37pt5UBN3qgZ6sHOIaLco2UI05WeDf63axAmzWBd1/ijxxnXvwdweK6tu5lvhRh/RE+9pTP2G8+adDlbIglzwzWlrTAlXvLTdZlxluGQ6Y1HzLvDwnDhEB8ENNjyYSYxPvSOUkniY/a3CuaElP/XImGEWNw0iSULnK7yu/eBtZxzuVRHG/G5bmTujZrKe+OJUMebD51rhRpp84UM8e0B2xjpe2Fhud/cZHFe6Y1fkUB5U4ajOPBpH1CRtfn8WnhO2XXDt6pAmEm8SEW2xDdI+WpUZb9hS/MfkXt2A72Suhg93v+zVj28YGEBXjprA== 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=D1sE3o7/1/WPykkUQrLgvygBnr35JJ7+xArB8a3+h6c=; b=Ga0bvfX1781S5oJ36DK+txA+SIru21JrwNvdbJA++aWoarOvheBw3/tnmIdU3JzvffKVBSpIia+uHH61hAwwglTylple+AMST8z7oAkwrzW2ibFejJznUTSYEN5FtcOq7I0/lMpJYLb9M/CPIYx/DZbJBRlhgPNE5DkCQxpPFoBxh7ea2kdd7SSl7eyTNIKnDT68F8tRAFQuccw+7QsZNEungjBazOEbRkq4ZJIMR/rrbzn+O+uTGdroywaErbZfvQhCCmzU8R4oDUe7C/Rr432dZZrVs5UqFN8M05jvU5CFuUBYzdlbIAdOvMjKhv3P2YRytKx9gF5pumb4nO8DPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D1sE3o7/1/WPykkUQrLgvygBnr35JJ7+xArB8a3+h6c=; b=cjla2c6sIf2gY0Bk6CbEMrhNTKF/v206Un2TND/fDyd7GBqGM9BxXmgrjtap7b76z5p5VYirm4ZhY0wE4wZ4sLdXsK59MAizaW7YcDyO/+7wFvrWq7dWYQ+ChqVtKV2ONVmyrYpPVocNre63zSwgptZAe9iVX8HhLdRqaQKMOTggMCqfgUkQHp9cKzEfBOfJdWkGNjajtuSm9uRDMYpqVbbmPO7xM+ZcZGFWNuX7eTU0GU0CfH9tOgRPJuKvvqCVO4/XDZhNsshIicso3duyWw5XUa5F75C1xTOq/oG17RfziQxRg4nCcjGKaRKHg7/G6pnwDjsogErtABe/RCOJYg== From: Volodymyr Babchuk To: "qemu-devel@nongnu.org" CC: David Woodhouse , Stefano Stabellini , Julien Grall , Oleksandr Tyshchenko , Volodymyr Babchuk , Peter Maydell , Anthony Perard , Paul Durrant , "open list:ARM TCG CPUs" , "open list:X86 Xen CPUs" Subject: [PATCH v4 6/6] xen_arm: Add virtual PCIe host bridge support Thread-Topic: [PATCH v4 6/6] xen_arm: Add virtual PCIe host bridge support Thread-Index: AQHaJMCo0BornjVbl0aSaRGzaWWdGA== Date: Sat, 2 Dec 2023 01:41:23 +0000 Message-ID: <20231202014108.2017803-7-volodymyr_babchuk@epam.com> References: <20231202014108.2017803-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231202014108.2017803-1-volodymyr_babchuk@epam.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.42.0 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB3710:EE_|AS8PR03MB7285:EE_ x-ms-office365-filtering-correlation-id: 949ee9dc-8a24-4199-2fba-08dbf2d7cad8 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: KjcoTtbcWIF5OI9JMph43mydcyPVte4s3LMDrNx5qdhvPSNe0/0WYy66kIGdvXPRsG1OII0xO4bQtscefMIdVX1GLtLX9HiNsE6VNylJ28AQEVf/qwoqky8TFmL7sFI4IjznsGXRT/Z31s3w7mFvDPTdiaDZoTIPaXP3PvF2hH9308KG+blQiApKyMSaUkaWxroEdgnkK0L3oWAwUuBBvH8SVOMbhrYs+3KWV4hM1P8eZZzxbbG/s5RVQXM6L8/1aKNEHxaCRhfIUxH2HNIKPnjqiPB0l3xror0VlAV31QJigvn6CsheyKvdMmPccdjCy9NDSoY3IxD1HTaaQZnW9wpkYb7GJYeEuFmqoY2CffJY+RjvBCnnsT8gXGloDrIn5fjk8OPtVu/6QzJsMXG9OdRG06CscvbvNfginu52f/g2u8tmgq3Nnq7okFaMEmYkjYx9OgF74oNmhl+VjUnFH2ciraxSmirBoAr3IHLPvVkwkT5VKizaXLIJ8+G/qUjOky2BX/tti/DDu0VgFutkR7eiYujXkLr1zad/X1Q4aJ+SK9ujG7CjYuQVFCB2Hmi8AaTQV15Y6lXTeEV+45w9UaDxv8Zl4KXDfPvJMeBKrraK2pxBuZtiZ6S2gEXFYYYr x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB3710.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(376002)(396003)(366004)(346002)(136003)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(122000001)(38070700009)(41300700001)(2906002)(30864003)(5660300002)(83380400001)(71200400001)(55236004)(38100700002)(6506007)(6512007)(1076003)(2616005)(26005)(66556008)(478600001)(91956017)(6486002)(36756003)(76116006)(66946007)(64756008)(66446008)(8936002)(6916009)(54906003)(86362001)(66476007)(4326008)(316002)(8676002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?VhgFjOw+sealzzey+FGUtYx94cTDA3Fwtvwmq16SmwvPTlWgX5H3ssFwFL?= =?iso-8859-1?Q?0Fosjv3h/vxxmJmoZXu9zVwy31vbYcKHiR5dQ08rEMxG7izt6aAlNsTG1k?= =?iso-8859-1?Q?Wp7NLi6lmjzElnlT1FH+1W7Bh8xcgqT7TXyV3Wq76j3GPSNwslqNI6ICMl?= =?iso-8859-1?Q?qYewA6FbZ+PbXTJw6nt98MtcsvsaAhuRFGxmfZ2KxEvjIAurslCK+tHa9X?= =?iso-8859-1?Q?AiBNsmGB47HQH36nDPL9pyNfUfXU7nZaM56c1OojZqxCmWuxqjaVBV52kP?= =?iso-8859-1?Q?KmGhZ0RCPCQwmbz7Xz0XyZpHoIQ3iZ+8beBJE3TwuMVqZ7NOJJnxBrcApO?= =?iso-8859-1?Q?8p3Ux6bwxtbXP5htXiqyWxeYkJ6Mfk+635xCpJIROSScArkQq+TAOLHxGk?= =?iso-8859-1?Q?zceKiRNevznDa9wLalBJYdQ2whq105PF/ddDJWm2c+k1pTf09p+Ya14eeO?= =?iso-8859-1?Q?4ICz7qvhdzlYlK750kqsNdzI08MkhhXYbwoZ9wIfVCpfbhOoRwTjYZptnG?= =?iso-8859-1?Q?cKx7YZbWVny7y/ftvuhcb+I/LGfNSPW+S9KFOQVzLvQ+UBlQvVbA6tMY4U?= =?iso-8859-1?Q?tkOTzdWRKecrUvNw9wBMN883xslrNE2Tnav1A7oGvcxOGuWVRp48NMYt1v?= =?iso-8859-1?Q?QEW9FSELaWS13fkGoJ7RfPfXT9DWcGDwaCtV7ORvjjFNtDUseseL67fv2S?= =?iso-8859-1?Q?FLYnQ2nUpSWRQg5pUdY6zZSdegViUWjxrnQz3x4fkniSozTynM8wQi2zMp?= =?iso-8859-1?Q?W1zLJi/Nj7/88/kin6ARaxEBjymdb11E3N4PnidqHP1TonsV6V44WaVyx3?= =?iso-8859-1?Q?R2LR6pDh58b+DDkMluWTaO9VpFVQsCQNp9JmbUly/azjNtK+GBoCUyoy0u?= =?iso-8859-1?Q?pLJTEF9D/V02rNYvpvfYVKi0m22cXrvQx+HRwvEjaxfo/T/w6UBuJqwkb8?= =?iso-8859-1?Q?fNA6C2fhZ9H/gcFCW1PqiOlKidG1CuYhAF+0CZkn+GY2RR9jlKT03YbeZf?= =?iso-8859-1?Q?qBrXSuBifypJswmMCgvcTY1RaWE3fz0I0xKY3kRV9E9EXcq+HcyoQBqmI/?= =?iso-8859-1?Q?aSYhrTr0c0fmMg9E53DHYYdC6kOet5T/UvahnLJrAIgxcoyOCzcSeIkm43?= =?iso-8859-1?Q?p6Pi47OMb9KNR71cqcoa16Wrwr9XtX/ib0dDmL9sM9vz9QzpyfIMQoZQ6p?= =?iso-8859-1?Q?K35griJGW7/Ct2S+wPhd4Z8ezmc3dqkQkiNBeruRoOlpGBE/1L/1TxNi4l?= =?iso-8859-1?Q?AWvLxMlcJdWDOR0tsGT3RtBjnK6knZfXiYm8frb5cqAG74njybQDIsAYP4?= =?iso-8859-1?Q?Hmx3TPX6pmHmzh1Grnu0uX7hUHhZ31PbUoj2UfVt8wNCqSr5LfphHVJ6uO?= =?iso-8859-1?Q?mdMq2fLw7nA3JjWLWe0J/jeV8Zz0r+Dxs+6fvDodPxdT08VWYRCezs5f5B?= =?iso-8859-1?Q?X0izHYqIxbhUcYsYRMSMgGxw5EzF4U8Z9VxBaOIkGNNwPXbua2HRWXm0mA?= =?iso-8859-1?Q?YPspzzGL2IlgKMuuBbyy3Tp63gvqZu/BMLL/uMP5T9lRq+Ohl+dsr7R4O/?= =?iso-8859-1?Q?XRwlG8s3yMhTUD3ScLcf+wvbzh5O+Ai7yxOOvxZNpEoeSM7/tQJY1YdvWS?= =?iso-8859-1?Q?2aazPX28x5hKi7u0r88hOWWSRgeAZeKlox4+osPF3zv6V29n0QFQ5pow?= =?iso-8859-1?Q?=3D=3D?= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB3710.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 949ee9dc-8a24-4199-2fba-08dbf2d7cad8 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2023 01:41:23.7697 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: K5v7ptYctR9rW7ZhsrwIHjfqXwoq44w6D1no8yvkruzTXjGGCP8BfZJENombVT6PWoRF/fHWT/9E7P7bBxmCDTJNraWf7drlA2uQX0A819I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7285 X-Proofpoint-ORIG-GUID: zPLSo3Bgabl3StRLPmaNAY-xl3gPbGSz X-Proofpoint-GUID: zPLSo3Bgabl3StRLPmaNAY-xl3gPbGSz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-01_24,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 phishscore=0 suspectscore=0 impostorscore=0 mlxscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312020009 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1701481322676000001 Content-Type: text/plain; charset="utf-8" From: Oleksandr Tyshchenko The bridge is needed for virtio-pci support, as QEMU can emulate the whole bridge with any virtio-pci devices connected to it. This patch provides a flexible way to configure PCIe bridge resources using QEMU machine properties. We made this for several reasons: - We don't want to clash with vPCI devices, so we need information from Xen toolstack on which PCI bus to use. - The guest memory layout that describes these resources is not stable and may vary between guests, so we cannot rely on static resources to be always the same for both ends. - Also the device-models which run in different domains and serve virtio-pci devices for the same guest should use different host bridge resources for Xen to distinguish. The rule for the guest device-tree generation is one PCI host bridge per backend domain. Signed-off-by: Oleksandr Tyshchenko Signed-off-by: Volodymyr Babchuk --- Changes in v3: - Use QOM properties instead of reading from XenStore - Remove unneeded includes - Move pcie_* fields into "struct cfg" Changes in v2: - Renamed virtio_pci_host to pcie_host entries in XenStore, because there is nothing specific to virtio-pci: any PCI device can be emulated via this newly created bridge. --- hw/arm/xen_arm.c | 226 ++++++++++++++++++++++++++++++++++++ hw/xen/xen-hvm-common.c | 9 +- include/hw/xen/xen_native.h | 8 +- 3 files changed, 240 insertions(+), 3 deletions(-) diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c index b9c3ae14b6..dc6d3a1d82 100644 --- a/hw/arm/xen_arm.c +++ b/hw/arm/xen_arm.c @@ -34,6 +34,7 @@ #include "hw/xen/xen-hvm-common.h" #include "sysemu/tpm.h" #include "hw/xen/arch_hvm.h" +#include "hw/pci-host/gpex.h" =20 #define TYPE_XEN_ARM MACHINE_TYPE_NAME("xenpvh") OBJECT_DECLARE_SIMPLE_TYPE(XenArmState, XEN_ARM) @@ -57,6 +58,10 @@ struct XenArmState { =20 struct { uint64_t tpm_base_addr; + MemMapEntry pcie_mmio; + MemMapEntry pcie_ecam; + MemMapEntry pcie_mmio_high; + int pcie_irq_base; } cfg; }; =20 @@ -73,6 +78,15 @@ static MemoryRegion ram_lo, ram_hi; #define NR_VIRTIO_MMIO_DEVICES \ (GUEST_VIRTIO_MMIO_SPI_LAST - GUEST_VIRTIO_MMIO_SPI_FIRST) =20 +#define XEN_ARM_PCIE_ECAM_BASE "pcie-ecam-base" +#define XEN_ARM_PCIE_ECAM_SIZE "pcie-ecam-size" +#define XEN_ARM_PCIE_MEM_BASE "pcie-mem-base" +#define XEN_ARM_PCIE_MEM_SIZE "pcie-mem-size" +#define XEN_ARM_PCIE_PREFETCH_BASE "pcie-prefetch-mem-base" +#define XEN_ARM_PCIE_PREFETCH_SIZE "pcie-prefetch-mem-size" +#define XEN_ARM_PCIE_IRQ_BASE "pcie-irq-base" + +/* TODO It should be xendevicemodel_set_pci_intx_level() for PCI interrupt= s. */ static void xen_set_irq(void *opaque, int irq, int level) { if (xendevicemodel_set_irq_level(xen_dmod, xen_domid, irq, level)) { @@ -129,6 +143,89 @@ static void xen_init_ram(MachineState *machine) } } =20 +static bool xen_validate_pcie_config(XenArmState *xam) +{ + if (xam->cfg.pcie_ecam.base =3D=3D 0 && + xam->cfg.pcie_ecam.size =3D=3D 0 && + xam->cfg.pcie_mmio.base =3D=3D 0 && + xam->cfg.pcie_mmio.size =3D=3D 0 && + xam->cfg.pcie_mmio_high.base =3D=3D 0 && + xam->cfg.pcie_mmio_high.size =3D=3D 0 && + xam->cfg.pcie_irq_base =3D=3D 0) { + + /* It's okay, user just don't want PCIe brige */ + + return false; + } + + if (xam->cfg.pcie_ecam.base =3D=3D 0 || + xam->cfg.pcie_ecam.size =3D=3D 0 || + xam->cfg.pcie_mmio.base =3D=3D 0 || + xam->cfg.pcie_mmio.size =3D=3D 0 || + xam->cfg.pcie_mmio_high.base =3D=3D 0 || + xam->cfg.pcie_mmio_high.size =3D=3D 0 || + xam->cfg.pcie_irq_base =3D=3D 0) { + + /* User provided some PCIe options, but not all of them */ + + error_printf("Incomplete PCIe bridge configuration\n"); + + exit(1); + } + + return true; +} + +static void xen_create_pcie(XenArmState *xam) +{ + MemoryRegion *mmio_alias, *mmio_alias_high, *mmio_reg; + MemoryRegion *ecam_alias, *ecam_reg; + DeviceState *dev; + int i; + + dev =3D qdev_new(TYPE_GPEX_HOST); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + + /* Map ECAM space */ + ecam_alias =3D g_new0(MemoryRegion, 1); + ecam_reg =3D sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); + memory_region_init_alias(ecam_alias, OBJECT(dev), "pcie-ecam", + ecam_reg, 0, xam->cfg.pcie_ecam.size); + memory_region_add_subregion(get_system_memory(), xam->cfg.pcie_ecam.ba= se, + ecam_alias); + + /* Map the MMIO space */ + mmio_alias =3D g_new0(MemoryRegion, 1); + mmio_reg =3D sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 1); + memory_region_init_alias(mmio_alias, OBJECT(dev), "pcie-mmio", + mmio_reg, + xam->cfg.pcie_mmio.base, + xam->cfg.pcie_mmio.size); + memory_region_add_subregion(get_system_memory(), xam->cfg.pcie_mmio.ba= se, + mmio_alias); + + /* Map the MMIO_HIGH space */ + mmio_alias_high =3D g_new0(MemoryRegion, 1); + memory_region_init_alias(mmio_alias_high, OBJECT(dev), "pcie-mmio-high= ", + mmio_reg, + xam->cfg.pcie_mmio_high.base, + xam->cfg.pcie_mmio_high.size); + memory_region_add_subregion(get_system_memory(), + xam->cfg.pcie_mmio_high.base, + mmio_alias_high); + + /* Legacy PCI interrupts (#INTA - #INTD) */ + for (i =3D 0; i < GPEX_NUM_IRQS; i++) { + qemu_irq irq =3D qemu_allocate_irq(xen_set_irq, NULL, + xam->cfg.pcie_irq_base + i); + + sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, irq); + gpex_set_irq_num(GPEX_HOST(dev), i, xam->cfg.pcie_irq_base + i); + } + + DPRINTF("Created PCIe host bridge\n"); +} + void arch_handle_ioreq(XenIOState *state, ioreq_t *req) { hw_error("Invalid ioreq type 0x%x\n", req->type); @@ -189,6 +286,12 @@ static void xen_arm_init(MachineState *machine) xen_register_ioreq(xam->state, machine->smp.cpus, &xen_memory_listener= ); =20 xen_create_virtio_mmio_devices(xam); + if (xen_validate_pcie_config(xam)) { + xen_create_pcie(xam); + } else { + DPRINTF("PCIe host bridge is not configured," + " only virtio-mmio can be used\n"); + } =20 #ifdef CONFIG_TPM if (xam->cfg.tpm_base_addr) { @@ -225,6 +328,90 @@ static void xen_arm_set_tpm_base_addr(Object *obj, Vis= itor *v, } #endif =20 +static void xen_arm_get_pcie_prop(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + XenArmState *xam =3D XEN_ARM(obj); + hwaddr *target; + + if (!strcmp(name, XEN_ARM_PCIE_ECAM_BASE)) { + target =3D &xam->cfg.pcie_ecam.base; + } else if (!strcmp(name, XEN_ARM_PCIE_ECAM_SIZE)) { + target =3D &xam->cfg.pcie_ecam.size; + } else if (!strcmp(name, XEN_ARM_PCIE_MEM_BASE)) { + target =3D &xam->cfg.pcie_mmio.base; + } else if (!strcmp(name, XEN_ARM_PCIE_MEM_SIZE)) { + target =3D &xam->cfg.pcie_mmio.size; + } else if (!strcmp(name, XEN_ARM_PCIE_PREFETCH_BASE)) { + target =3D &xam->cfg.pcie_mmio_high.base; + } else if (!strcmp(name, XEN_ARM_PCIE_PREFETCH_SIZE)) { + target =3D &xam->cfg.pcie_mmio_high.size; + } else { + /* Unreachable */ + assert(false); + return; + } + + visit_type_uint64(v, name, target, errp); +} + +static void xen_arm_set_pcie_prop(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + XenArmState *xam =3D XEN_ARM(obj); + uint64_t value; + hwaddr *target; + + if (!strcmp(name, XEN_ARM_PCIE_ECAM_BASE)) { + target =3D &xam->cfg.pcie_ecam.base; + } else if (!strcmp(name, XEN_ARM_PCIE_ECAM_SIZE)) { + target =3D &xam->cfg.pcie_ecam.size; + } else if (!strcmp(name, XEN_ARM_PCIE_MEM_BASE)) { + target =3D &xam->cfg.pcie_mmio.base; + } else if (!strcmp(name, XEN_ARM_PCIE_MEM_SIZE)) { + target =3D &xam->cfg.pcie_mmio.size; + } else if (!strcmp(name, XEN_ARM_PCIE_PREFETCH_BASE)) { + target =3D &xam->cfg.pcie_mmio_high.base; + } else if (!strcmp(name, XEN_ARM_PCIE_PREFETCH_SIZE)) { + target =3D &xam->cfg.pcie_mmio_high.size; + } else { + /* Unreachable */ + assert(false); + return; + } + + if (!visit_type_uint64(v, name, &value, errp)) { + return; + } + *target =3D value; +} + +static void xen_arm_get_pcie_irq_base(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + XenArmState *xam =3D XEN_ARM(obj); + int64_t value =3D xam->cfg.pcie_irq_base; + + visit_type_int(v, name, &value, errp); +} + +static void xen_arm_set_pcie_irq_base(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + XenArmState *xam =3D XEN_ARM(obj); + int64_t value; + + if (!visit_type_int(v, name, &value, errp)) { + return; + } + + xam->cfg.pcie_irq_base =3D value; +} + static void xen_arm_machine_class_init(ObjectClass *oc, void *data) { =20 @@ -246,6 +433,45 @@ static void xen_arm_machine_class_init(ObjectClass *oc= , void *data) =20 machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); #endif + + object_class_property_add(oc, XEN_ARM_PCIE_ECAM_BASE, "uint64_t", + xen_arm_get_pcie_prop, + xen_arm_set_pcie_prop, NULL, NULL); + object_class_property_set_description(oc, XEN_ARM_PCIE_ECAM_BASE, + "Base address for ECAM range of virtual PCIe host bridge"); + object_class_property_add(oc, XEN_ARM_PCIE_ECAM_SIZE, "uint64_t", + xen_arm_get_pcie_prop, + xen_arm_set_pcie_prop, NULL, NULL); + object_class_property_set_description(oc, XEN_ARM_PCIE_ECAM_SIZE, + "Size of ECAM range of virtual PCIe host bridge"); + + object_class_property_add(oc, XEN_ARM_PCIE_MEM_BASE, "uint64_t", + xen_arm_get_pcie_prop, + xen_arm_set_pcie_prop, NULL, NULL); + object_class_property_set_description(oc, XEN_ARM_PCIE_MEM_BASE, + "Base address for non-prefetchable memory of virtual PCIe host bri= dge"); + object_class_property_add(oc, XEN_ARM_PCIE_MEM_SIZE, "uint64_t", + xen_arm_get_pcie_prop, + xen_arm_set_pcie_prop, NULL, NULL); + object_class_property_set_description(oc, XEN_ARM_PCIE_MEM_SIZE, + "Size of non-prefetchable memory of virtual PCIe host bridge"); + + object_class_property_add(oc, XEN_ARM_PCIE_PREFETCH_BASE, "uint64_t", + xen_arm_get_pcie_prop, + xen_arm_set_pcie_prop, NULL, NULL); + object_class_property_set_description(oc, XEN_ARM_PCIE_PREFETCH_BASE, + "Base address for prefetchable memory of virtual PCIe host bridge"= ); + object_class_property_add(oc, XEN_ARM_PCIE_PREFETCH_SIZE, "uint64_t", + xen_arm_get_pcie_prop, + xen_arm_set_pcie_prop, NULL, NULL); + object_class_property_set_description(oc, XEN_ARM_PCIE_PREFETCH_SIZE, + "Size of prefetchable memory of virtual PCIe host bridge"); + + object_class_property_add(oc, XEN_ARM_PCIE_IRQ_BASE, "int", + xen_arm_get_pcie_irq_base, + xen_arm_set_pcie_irq_base, NULL, NULL); + object_class_property_set_description(oc, XEN_ARM_PCIE_IRQ_BASE, + "Number of first PCI legacy interrupt for PCIe host bridge"); } =20 static const TypeInfo xen_arm_machine_type =3D { diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index 2e7897dbd2..19fcccdb16 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -47,6 +47,8 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, = MemoryRegion *mr, g_free(pfn_list); } =20 +uint16_t xen_pci_segment; + static void xen_set_memory(struct MemoryListener *listener, MemoryRegionSection *section, bool add) @@ -382,7 +384,12 @@ static void cpu_ioreq_config(XenIOState *state, ioreq_= t *req) } =20 QLIST_FOREACH(xendev, &state->dev_list, entry) { - if (xendev->sbdf !=3D sbdf) { + /* + * As we append xen_pci_segment just before forming dm_op in + * xen_map_pcidev() we need to check with appended xen_pci_segment + * here as well. + */ + if ((xendev->sbdf | (xen_pci_segment << 16)) !=3D sbdf) { continue; } =20 diff --git a/include/hw/xen/xen_native.h b/include/hw/xen/xen_native.h index 6f09c48823..2b1debaff4 100644 --- a/include/hw/xen/xen_native.h +++ b/include/hw/xen/xen_native.h @@ -431,6 +431,8 @@ static inline void xen_unmap_io_section(domid_t dom, 0, start_addr, end_add= r); } =20 +extern uint16_t xen_pci_segment; + static inline void xen_map_pcidev(domid_t dom, ioservid_t ioservid, PCIDevice *pci_dev) @@ -441,7 +443,8 @@ static inline void xen_map_pcidev(domid_t dom, =20 trace_xen_map_pcidev(ioservid, pci_dev_bus_num(pci_dev), PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn= )); - xendevicemodel_map_pcidev_to_ioreq_server(xen_dmod, dom, ioservid, 0, + xendevicemodel_map_pcidev_to_ioreq_server(xen_dmod, dom, ioservid, + xen_pci_segment, pci_dev_bus_num(pci_dev), PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn)); @@ -457,7 +460,8 @@ static inline void xen_unmap_pcidev(domid_t dom, =20 trace_xen_unmap_pcidev(ioservid, pci_dev_bus_num(pci_dev), PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->dev= fn)); - xendevicemodel_unmap_pcidev_from_ioreq_server(xen_dmod, dom, ioservid,= 0, + xendevicemodel_unmap_pcidev_from_ioreq_server(xen_dmod, dom, ioservid, + xen_pci_segment, pci_dev_bus_num(pci_dev), PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn)= ); --=20 2.42.0