From patchwork Fri Nov 10 20:42:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 13452789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 48FBAC4332F for ; Fri, 10 Nov 2023 20:43:04 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.630793.983888 (Exim 4.92) (envelope-from ) id 1r1YKp-0004yx-P7; Fri, 10 Nov 2023 20:42:35 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 630793.983888; Fri, 10 Nov 2023 20:42:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1YKp-0004yq-MA; Fri, 10 Nov 2023 20:42:35 +0000 Received: by outflank-mailman (input) for mailman id 630793; Fri, 10 Nov 2023 20:42: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 1r1YKo-0004yj-0X for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 20:42:34 +0000 Received: from mx0a-0039f301.pphosted.com (mx0a-0039f301.pphosted.com [148.163.133.242]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id aac58679-8009-11ee-98da-6d05b1d4d9a1; Fri, 10 Nov 2023 21:42:31 +0100 (CET) Received: from pps.filterd (m0174677.ppops.net [127.0.0.1]) by mx0a-0039f301.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AAKIjQs010025; Fri, 10 Nov 2023 20:42:26 GMT Received: from eur05-am6-obe.outbound.protection.outlook.com (mail-am6eur05lp2104.outbound.protection.outlook.com [104.47.18.104]) by mx0a-0039f301.pphosted.com (PPS) with ESMTPS id 3u9kkysufj-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 10 Nov 2023 20:42:26 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by DB3PR0302MB8991.eurprd03.prod.outlook.com (2603:10a6:10:437::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.29; Fri, 10 Nov 2023 20:42: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%5]) with mapi id 15.20.6977.019; Fri, 10 Nov 2023 20:42:22 +0000 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: aac58679-8009-11ee-98da-6d05b1d4d9a1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AFlv+cRUfIHOzTpuKPONH2keS/ngQwhpsNVDHbQKm7s6VSU3RbMGtweQs4XUVtS+C9skJ+dLnQN57wvl86H0tYteb+blj4AFQZLE0hcsfi7Fxfpx8COMBF4w83UIrDwreI28/Nimn91VGqXY+srZ9oYyWa2/oU/WhdeCkkwUuL7BNtqQCm7NXHfonEovFn6yL6H/CwOMh01IvGBMlL/IUFpswTx6W7UUEGCYYWlr0xi8TfNneZphar3VEAIlwOLD1rbYsYNFyM6pNPReGuQilA4vkeRsW/PVCpIkbcVdg/ZSL94r7O09zgOaafEPq0v52mrpMTUXeTH0qh6tNKY4DQ== 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=UnRtHURNzIPLY0JeVnzQOo2dxqvod8upLt3UTqjtXyc=; b=mjJR8ebmXmodBIyS8X0qHXslXnTMoAiIuwmYjGWd34FJzp7k7RMPezZktIEW64tBSWgdMPdjRQ1krwbkulaBMnMdXXfExFsC5CZ3InxA6cRdZF3yIgxOksa1w/intCg5RarVChex26QbuIlVw4LJOyiDWNOwF5smvWB8q6YHjhUqzJIMVl/14UyMvNsTW5HeDvWTmcSCSuOHKz8ERX6osqlRU01hgfMqOiEPS3pwSIfWEdgrIc8h/mbbAIvSMHERn0JDCbeMuefER7VDtSJ+FBY+zvNLtTQ6htx+F/Oy9dnvbMdfN7wfRzKZgtEBOo81uCKZOiu0MIdgL/ZYA9rysQ== 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=UnRtHURNzIPLY0JeVnzQOo2dxqvod8upLt3UTqjtXyc=; b=jnOZv8V5g+HU5vED9+PeS0uHs1PXt+mkG/5kGwVmvONgXmh8mSGyPz7JKtPvz0wVVCzp7PkAvQMmcaBkArKD+EsbkPnMl6Iy7cffwix3csNGHKKnQdkq6OZQ18xMqJOl1YDPvtf7z9ZrWpg9+nyidCthrkm0Hd5wXzerxcV8sfB09t45iig8oFDMjK4h2N7hHMsx0IJ7tgbxi9NTblQOe7RQET9mCm6J7uk2vCur3jVBxK+80yjsxMWBA+VzkcO7ag+rjx8SvVWzRvq7Gshbdj0NlA8o+FKp+sBrY0UxOt+b8OcbsXBkasozyg9Tpy8AApeGFBrhyegEvwHhIJncoA== From: Volodymyr Babchuk To: "qemu-devel@nongnu.org" CC: Oleksandr Tyshchenko , Volodymyr Babchuk , Stefano Stabellini , Anthony Perard , Paul Durrant , Kevin Wolf , Hanna Reitz , "open list:X86 Xen CPUs" , "open list:Block layer core" Subject: [PATCH v1 1/7] xen-block: Do not write frontend nodes Thread-Topic: [PATCH v1 1/7] xen-block: Do not write frontend nodes Thread-Index: AQHaFBZngjGHt2Wnc0CJ36bDt34c6A== Date: Fri, 10 Nov 2023 20:42:21 +0000 Message-ID: <20231110204207.2927514-2-volodymyr_babchuk@epam.com> References: <20231110204207.2927514-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231110204207.2927514-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_|DB3PR0302MB8991:EE_ x-ms-office365-filtering-correlation-id: 7e7ff430-02f3-4bbb-08d3-08dbe22d8a6a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: +t2p/y7ZRDtOXl8MyGRMsxJ1lL4x70IflYG65zjO2x4DwsKjW5PmLEcCZc+NfYLkWNvsZqzO3lbY3TQ+KU6gXpPeJBafAmt4r+FDGI6CA8/oaAsqVAIgylmWcnUQnuFmYJvlYXPOe890SrfvH7peKyqoWoiz68xpYZaDyGRZV7UvKjoT0HZW6rUgFE0/G3/chNUGhh4eo6O6P5dFOLdUcM88cCFhA4Afm0xC4xHi9OwWFkflYMr7AeBf02Y2C+Pb/BOurklrNBMWBAs+UOmrhWAy6MOT9IpF6M+Uyd/FA2C4DSzwNXykCq9cGeeFwYjAm/c/Cr2ushefM4DSt0Vvi+bJYc4jTiQH42qP/Bo5HVx6iEBCTX7EK190OyhrVA47IeCgUbRMMtysccl75D58qIJrqU5URirl6T13lRIRIYIuaQ6aqLpTc7UsVgb5SQz6Yenib6rhjVDT1qzwoVPF9PmZfXPX912O3L214YEvYimCn3FH1wmyzvyPNiZk0uA5LRDaR/FQMVV/RFsgPCOITHy3nhV2Xz4jd28cfQZVhia3oHCzfYL3RQtjufEYs1D95dmD6YmavaPmjDzUjnJniaX/fAtDecTLUjkbqYh+uXptzf3yLa9QUFg4r6fU+qFI 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)(136003)(376002)(346002)(39860400002)(396003)(366004)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(41300700001)(2906002)(8936002)(4326008)(86362001)(5660300002)(38070700009)(8676002)(316002)(36756003)(83380400001)(38100700002)(478600001)(2616005)(1076003)(6512007)(6486002)(71200400001)(122000001)(6506007)(55236004)(91956017)(76116006)(66556008)(66446008)(26005)(6916009)(64756008)(66476007)(66946007)(54906003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?341y8SHaRk1EQ0QaPLM8F6h?= =?iso-8859-1?q?8YKA7bwcqC1Cb1MoLd0PR9LJDK3ktkrV/3l81niSqoAyrtuG42GUe/4maa1j?= =?iso-8859-1?q?rq054Iv/SaQK2PnGEgTDpyYHxFOFUIF9RIsGksnxofRFII/7zQ8v08d0XMSW?= =?iso-8859-1?q?LFJGslmnj/xqYcj3GW9LzOx9Kisw1kZdTETuwYPTrmr0CICo93TAhzHOQ352?= =?iso-8859-1?q?mBUFaNv770/3drh+NlokAt31+Fm7Zc+jVIgKsvli/rVHB/mr4R+UhZ34XIV/?= =?iso-8859-1?q?7IPKdvLRh43ZxuE7DhTEh93rVYD3IBNdf/kKT31b071snFOGNIsG0ZPMp3t+?= =?iso-8859-1?q?Yn9M9vHdisZfLLLiQJRV9wxUgC3FWxdB8RcoDtjAysCguctFzI8Tlhqgn3Ck?= =?iso-8859-1?q?NwjP0dml+i4NZdf9NhME9QgvCs0mZo9BFcOH88eb3PuWNLihFOY22vO/RBhJ?= =?iso-8859-1?q?bFuW/tv9WL7mQObEJCNA2tmaGwKbx+BW/CONPGIVjeHnSZRt11QKMyOKaswl?= =?iso-8859-1?q?EJwCAfCF4Cnv/FaYYooghKRxP3UTYqmieGiplpMCEza3L34R9JI8I9SNiMub?= =?iso-8859-1?q?/Ly0Ga3T8DFzzTQOCmEjWcp93PkicE7B/y1DKNFDZa1T1kTK31RwjHdUnZyQ?= =?iso-8859-1?q?Pl1nxOxcCPKr1Wx0zQJOkSxUhOc7GK25aBbeltwguN/gbOzS0+UTfJQqQZ8q?= =?iso-8859-1?q?wXg1k90BTKVWhN6SHWHmskolaKyozsCXclWaUzch1RVR+8acjZW0BY/Ar7KH?= =?iso-8859-1?q?x4lKfTidxWzd6XSdu9MdIoSc6dFtnCHYTF7nLtOEmWDyRZHWMw+po9Th1yiJ?= =?iso-8859-1?q?AKxHzKzkVeGW30XO+apCYZi+CTCQDSR6g8pt631opoiJpT/iMdP1hNFcTtzH?= =?iso-8859-1?q?jWHMxAYKgn2rcChaaFXH1kkZj2RcTTCqxHLE+zzcg+G5Q5Bvjs928qBJ95Cq?= =?iso-8859-1?q?gQ+iOv6D1D9xpll4lNgCXbgzzrOFwcQd+oLy4OtFHo+4lR10A53RZv2ItoUA?= =?iso-8859-1?q?SazXOXbvt1qtY1XZW9O1atqUrEPXdDNY1k3sMOH8Xtn9jesPNpRUO8wVyIg8?= =?iso-8859-1?q?WURNEWn9B6kqZM355ALVO4vp8yLarQwE3uQ+RgaoFPSHJ6bLBN46r0Ts5Tox?= =?iso-8859-1?q?/YQ22U8/ImfNwSD/s27d7w++qEsMBGqIu5XHHyTJ1Cyt21j7qKM7hsUPr2Gj?= =?iso-8859-1?q?W5jHJRNjhWySpT87GAlU3NIfR15F3K1PuOcopdLLwMxcME5Mm2AqWh5wiaGN?= =?iso-8859-1?q?9p86ZELI6/sH4qnCX03X5Sk68KwHCs2VQJzuQN4ATS0dA5w93moUOjwSHKF+?= =?iso-8859-1?q?saZtzd0nxWkHxlb2nxGbnUrOgTAq92UG5Z/ZnxAdihzNuQEm7cm3YiC+2p3c?= =?iso-8859-1?q?2d2s7AkLgpMTvjrMK1+8TK/129xGqf0ASlOruk907ZWgP2hRdsmftjNsQqJ5?= =?iso-8859-1?q?dAwpJ7+YkfzeRO4rX7RJrTxBvwEh78Gsyr1Oz55yMWAYPFlvIhV0jpfItHMF?= =?iso-8859-1?q?w9cN5Lb3JjLfs/uRL9jTaoa9pLAnxwoKgJKyCENkEJewS7H9toJx6ax62l57?= =?iso-8859-1?q?8HZe293GNyP1Scz3LjkAI++Th1lulJ1/K4XCEeB3SSNAjT1BDfbVs06gqY3A?= =?iso-8859-1?q?14UH8C23OOT57dHiAVP4CkWehiMg7uUf9NbHusw=3D=3D?= 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: 7e7ff430-02f3-4bbb-08d3-08dbe22d8a6a X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2023 20:42:21.5521 (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: +zFXmpaAZ3YQ9XZADoakCzmb4xIBYWzFCDwrR6dpMEUJ5PCMtm8OKNtjm6z39PMVQPmBWXLEQPstNyD6CcvCV4Dnp65tEutR2CLXBwg5ic0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0302MB8991 X-Proofpoint-GUID: ZHeeUMuC7l0RDea5kDJ6Zrl-9h5z9xBi X-Proofpoint-ORIG-GUID: ZHeeUMuC7l0RDea5kDJ6Zrl-9h5z9xBi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-10_18,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 suspectscore=0 mlxscore=0 phishscore=0 clxscore=1011 bulkscore=0 priorityscore=1501 mlxlogscore=691 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311100172 From: Oleksandr Tyshchenko The PV backend running in other than Dom0 domain (non toolstack domain) is not allowed to write frontend nodes. The more, the backend does not need to do that at all, this is purely toolstack/xl devd business. I do not know for what reason the backend does that here, this is not really needed, probably it is just a leftover and all xen_device_frontend_printf() instances should go away completely. Signed-off-by: Oleksandr Tyshchenko Signed-off-by: Volodymyr Babchuk --- hw/block/xen-block.c | 11 +++++++---- hw/xen/xen-bus.c | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index a07cd7eb5d..dc4d477c22 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -221,6 +221,7 @@ static void xen_block_realize(XenDevice *xendev, Error **errp) XenBlockVdev *vdev = &blockdev->props.vdev; BlockConf *conf = &blockdev->props.conf; BlockBackend *blk = conf->blk; + XenBus *xenbus = XEN_BUS(qdev_get_parent_bus(DEVICE(xendev))); if (vdev->type == XEN_BLOCK_VDEV_TYPE_INVALID) { error_setg(errp, "vdev property not set"); @@ -280,10 +281,12 @@ static void xen_block_realize(XenDevice *xendev, Error **errp) xen_device_backend_printf(xendev, "info", "%u", blockdev->info); - xen_device_frontend_printf(xendev, "virtual-device", "%lu", - vdev->number); - xen_device_frontend_printf(xendev, "device-type", "%s", - blockdev->device_type); + if (xenbus->backend_id == 0) { + 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); diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index ece8ec40cd..06d5192aca 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -1048,7 +1048,7 @@ static void xen_device_realize(DeviceState *dev, Error **errp) xen_device_backend_set_online(xendev, true); xen_device_backend_set_state(xendev, XenbusStateInitWait); - if (!xen_device_frontend_exists(xendev)) { + if (!xen_device_frontend_exists(xendev) && xenbus->backend_id == 0) { xen_device_frontend_printf(xendev, "backend", "%s", xendev->backend_path); xen_device_frontend_printf(xendev, "backend-id", "%u", From patchwork Fri Nov 10 20:42:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 13452792 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 551CDC4167B for ; Fri, 10 Nov 2023 20:43:12 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.630794.983897 (Exim 4.92) (envelope-from ) id 1r1YKs-0005Ds-04; Fri, 10 Nov 2023 20:42:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 630794.983897; Fri, 10 Nov 2023 20:42:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1YKr-0005Dl-Tm; Fri, 10 Nov 2023 20:42:37 +0000 Received: by outflank-mailman (input) for mailman id 630794; Fri, 10 Nov 2023 20:42:36 +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 1r1YKq-0004yp-H5 for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 20:42:36 +0000 Received: from mx0a-0039f301.pphosted.com (mx0a-0039f301.pphosted.com [148.163.133.242]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id aadc3ae5-8009-11ee-9b0e-b553b5be7939; Fri, 10 Nov 2023 21:42:32 +0100 (CET) Received: from pps.filterd (m0174677.ppops.net [127.0.0.1]) by mx0a-0039f301.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AAKIjQt010025; Fri, 10 Nov 2023 20:42:27 GMT Received: from eur05-am6-obe.outbound.protection.outlook.com (mail-am6eur05lp2104.outbound.protection.outlook.com [104.47.18.104]) by mx0a-0039f301.pphosted.com (PPS) with ESMTPS id 3u9kkysufj-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 10 Nov 2023 20:42:27 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by DB3PR0302MB8991.eurprd03.prod.outlook.com (2603:10a6:10:437::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.29; Fri, 10 Nov 2023 20:42: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%5]) with mapi id 15.20.6977.019; Fri, 10 Nov 2023 20:42:23 +0000 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: aadc3ae5-8009-11ee-9b0e-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C7dj0MfiNhBcQRxOXWlLu+E8hDVjZ4M/bAd97c+F09PNhDkq6PB+58Oi811KA+U5QsX5i6jHY4e4Wt4304XprWFNR+t9Y1qankKjmD2epfw3E0+T3I03rBmXx+NetH7LdEmJiposO5pEv9bvgYxaXpcxjEeAmEcQhS0I/Hc70HsC9gyYkKKtfnbgVfAYQuBB9Ri4B/IiUmb1C6wBt99wQwM2E901Fvxbm98VwtGuGbd3bgD6on+6gRW/ooMP5fDZzdBVJOZ+4pPJ38qj4NF3b7Vi9P/jhzRNv5vANNXd3LCoV9W7jeLSBRXeCCpysC2Nvu92PqBlcLZI8M1/TK4L8w== 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=OKWARBfkUGbfwrphZNisw+1lvrxJ4IcHq6RYQnSJRuE=; b=E26+7tTYs5Vb45W2X5Nga72XsY/IoP4LX8fHXDkAKXZ3PlYsLbh18raJ81iZQQZQaG/38GWH2SXgy2gBvEeLdnZqdHnuRsMrF9Syp6sUTtXkFnx6JHw56Qx26e6vqlouKJmhJrZ2oPAc7YpOr45xmPX4EJsuvW6HLTMltwc6OnCccYKWckVf/AacYqMaMEvVwCHHO6QxqH51Rz8C8qx4VZ+mB/M6aSTQIBFuOQ0SxT7uF34qklJf+YjON8lbkVjz3i2JLNmwaoJEwt5Wods5c9nn9wpyI85lO3qkXITNoBsYlsYXhlxsBvlFiyRjrJeVnRvlISWt5V1ohCRtTDQH0Q== 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=OKWARBfkUGbfwrphZNisw+1lvrxJ4IcHq6RYQnSJRuE=; b=BNIe2UUcVtrvYCL9/nRZ8oH+N9+9MFwo/bxvlJYU2vxi9rwIjIG4xzlfR6qCon+lH0nZukftKOSbzv9+QhFxqPaer3/YbFsVYJgh9sEvZUBTrClVJNqeCwwn15h8fE5/XYEv570YZQondgAKe/DiAY7fw5EPdwJ8Eua/iBVIYeKmheCl7ZHRJOWS39KaawYKdE+2nL1vDqojC9LSUul/lIcDMA/S9vCXqhTW26nYOaer9MtkzMifC7lAU1YiOuUq4h6pFMpUrMovytMg3IdavnLWNzZ8lQICWvk7aKYxd/x/xlYya7E1fHHRqv65rv3x4iZupqr0YTRyny0jewleqg== From: Volodymyr Babchuk To: "qemu-devel@nongnu.org" CC: Oleksandr Tyshchenko , Volodymyr Babchuk , Stefano Stabellini , Anthony Perard , Paul Durrant , "open list:X86 Xen CPUs" Subject: [PATCH v1 2/7] xen-bus: Do not destroy frontend/backend directories Thread-Topic: [PATCH v1 2/7] xen-bus: Do not destroy frontend/backend directories Thread-Index: AQHaFBZnKqlUX8wCr0GIKTREthBW5Q== Date: Fri, 10 Nov 2023 20:42:22 +0000 Message-ID: <20231110204207.2927514-3-volodymyr_babchuk@epam.com> References: <20231110204207.2927514-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231110204207.2927514-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_|DB3PR0302MB8991:EE_ x-ms-office365-filtering-correlation-id: 5bc8600f-bd49-4902-caac-08dbe22d8aac x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: eMdTJYD8hdUfjYRSfS49W/otw7oU2rlT7EZkqGf1DooukUiBpoK9jUnSvMo2/4ejhwEJ1TSlJM5alts0x+Q479PTwHvu/NmPcKGtNDr8igBN8spOOATeULQnekd/nSG0cBsaLpkYBK4EUYoxNCb3Q2I9ihpv16U8AJXZzJd5s6DXEJPy8FfmB89UQzL2aL8SR26X5D01s9hhOQz17EZwAez1TlmGPRyZSYhJpsQ/mSuXx6x6bWP8e357/R6lQLBEPgnSLvr9+9AtMnYpFUr1bm373HTNNxO3xRPbXCViW4PZ3zh7opC8t2DMKjryPRiGBzPoDLxkmzJnMCKRxGv8inoZmYazCg58+FR2hId6cZKyJ6IzeqQSLTK+ZSl6VFW+bchrs56QIpf9ZM+wIJyRYmA508cS/a05szLh/0bF0VxCbNuZU8vP6oJPhWF3lsNUP5Tb5RIVjYW0IFDPN2OpOFySCmtbfp1hLEbnIKyu/3R/y1MM8cfQiag8G/oRr6xxJjO3KSO7iblvseXtNjhm01fyIrSOd4Cwrb/L1i94Yel/yY9QjIGBiqLbZRRJSMFgwi1A0Bb3+7teaNnY872SsVvnq8sNd293Ya/wEOnBkRCzXXgpeaBXd10kh+VdzUfB 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)(136003)(376002)(346002)(39860400002)(396003)(366004)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(41300700001)(2906002)(8936002)(4326008)(86362001)(5660300002)(38070700009)(8676002)(316002)(36756003)(83380400001)(38100700002)(478600001)(2616005)(1076003)(6512007)(6486002)(71200400001)(122000001)(6506007)(55236004)(91956017)(76116006)(66556008)(66446008)(26005)(6916009)(64756008)(66476007)(66946007)(54906003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?232sTjS/Gy/kngS8P2pcprt?= =?iso-8859-1?q?A+UZK7UcGFy+3w4XwY9/Z2d5IMTkpNJsuPiH549jXIFHIriUBo49FPcfrWlB?= =?iso-8859-1?q?cMuAJZ5+rW5QAbLuIyPsOORTiGH9uY8Fm4wDLlVJ3ZtyN3ka2wNCBxA81WFB?= =?iso-8859-1?q?u7DpU3AwsW+qi2+BBxv9zkEulL54vDtcQJaSp8tXCTRid606zo8o4BucM4j/?= =?iso-8859-1?q?FBjMxCM0SOREZaHg1oDirJGuJ+GHQJnB5HkpvkRyJxTyERs3+vUfSQHmqVx2?= =?iso-8859-1?q?x9CwBGptfZQoZ3+n+ey9FYgyPDFO28t1Dk+ctp4lJsPL1fUYgJMb+xpTukdO?= =?iso-8859-1?q?JwYrle8YPsL6EKahj4Dg1ppSr/qWkbS8fWu/TEYJJOYBqSdFtLG01lv7cmml?= =?iso-8859-1?q?Mx3d6YFE/PSgXYNhVuE9hfkV4xetBTx4fMNtWiMYVb9EFdesbKJ3DBfB0427?= =?iso-8859-1?q?3IneXS57if8aTVn67FoUAbX9BRYvEzFe4AlPSBVawky4teYMX1k4cWOd3iN1?= =?iso-8859-1?q?Sh4foN9qbgW+LSfcpq8yDOK6Z48YRuLJuA4y9KTPfZMB9kVfwzCElNPJMP58?= =?iso-8859-1?q?rpHRmy5C8uhzy/EnRvt1PftvSGswT32dfNZz8vydAILzn7gKLzUUPrGX1ZmW?= =?iso-8859-1?q?N9dxJSXy036tv4+s/YKVH0z0G4GJTcb1Qr60PrjsxFp9gZf6ouBh1LbK+QgJ?= =?iso-8859-1?q?5hg/Y+A2IgH/nHrH8EQD28km+E4tIBI/H+Jizgq5sHkm43C7m2DMdhYVaj73?= =?iso-8859-1?q?4bDr1fdNBoMxuqtU9INEGIQntP9OYKDm5tYqIZGZBrFfP5WPwe5xRnwhLbTs?= =?iso-8859-1?q?cYSgc77S5lFTYiwV/Ha3u3AMLqcwR0TETi36L0JPj2qdX3iJWrinfl/xJXaq?= =?iso-8859-1?q?HQjBmwqB/RjqymTub57MuhexCXMrmiVCtwGqFKmaEyL6YCzkfeAnDI6NXOiR?= =?iso-8859-1?q?bvN82Asb1aK5hjXS5dn8KVDO6mlYXmRpfrwKjLwTWprZm1Jy08KCHxFV5jXW?= =?iso-8859-1?q?3iIPU5iiuEYj3GPZTOzIQLnzDFkqx2I7218Qxj5YlTxfLrtssX2iHD5csMi2?= =?iso-8859-1?q?n0I16UhrLwyVlhMF61RlyPU3/EF9KwTO/MoRApQVaEngj7LDR+KGG7iFIv2y?= =?iso-8859-1?q?1pkn+9Q2hHyK/Zd/8qdNKDA18CINMF0p9So5kNg+IClF4b+8m4NedWGacedp?= =?iso-8859-1?q?ddUbJwiC/NORVfnAeQEMwF3GHQAzpCXXHdMox5VX8dLqm+0UWKyy4+YEsuiJ?= =?iso-8859-1?q?aqqzkba6jBxtvz0Iifx5F25jz2lo4K9NFta5v2svK1kp5TBks4FQQWaUL+Qi?= =?iso-8859-1?q?RuvX41J6Oh6dUx5O0aPMur8ALdlrHp10C5beUmEONP/RhbpNUZtvwzWDqeGe?= =?iso-8859-1?q?jx81dmuADqLTlqJAK9ut7mv2xDAalRLg2jCHx/qU0k7q7/BErOUbIkriBBTu?= =?iso-8859-1?q?j62DiBXncLtTJMZWPN4+8lGVuw3/m935n2WaiX45DAiVR5UAU/J3JdqIyQJ2?= =?iso-8859-1?q?YPimJB3zTo2lQGOLlTxdFsK5ZQ9QXtFjFMqpdIovfSKyKrAJIQMtX3IpVI0t?= =?iso-8859-1?q?mOz4AcBeeBOMXugQ90976pNXmTDEG8RjCy1czQzLSbRNY9XSnuXXMFPW9Q5x?= =?iso-8859-1?q?gRR/O/j4mo9kEdBmTNiG+vEDV6d5dFu6q56qczQ=3D=3D?= 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: 5bc8600f-bd49-4902-caac-08dbe22d8aac X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2023 20:42:22.3490 (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: 9kgIgaLSbA0ltG1jaSIk80Pe31b2A3q3L0zvgGTgvkIsDcF81mLGR1gaUpfjxsniawGKFWNA7zylwSu+UkBu6qEdmht3+/gYttvKHfuWA4s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0302MB8991 X-Proofpoint-GUID: kKNgRHbizpDH08hwtsCO87z5qaDmoW4x X-Proofpoint-ORIG-GUID: kKNgRHbizpDH08hwtsCO87z5qaDmoW4x X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-10_18,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 suspectscore=0 mlxscore=0 phishscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 mlxlogscore=631 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311100172 From: Oleksandr Tyshchenko The PV backend running in other than Dom0 domain (non toolstack domain) is not allowed to destroy frontend/backend directories. The more, it does not need to do that at all, this is purely toolstack/xl devd business. I do not know for what reason the backend does that here, this is not really needed, probably it is just a leftover and all xs_node_destroy() instances should go away completely. Signed-off-by: Oleksandr Tyshchenko Signed-off-by: Volodymyr Babchuk Signed-off-by: David Woodhouse --- hw/xen/xen-bus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index 06d5192aca..75474d4b43 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -598,8 +598,9 @@ static void xen_device_backend_destroy(XenDevice *xendev) g_assert(xenbus->xsh); - xs_node_destroy(xenbus->xsh, XBT_NULL, xendev->backend_path, - &local_err); + if (xenbus->backend_id == 0) + xs_node_destroy(xenbus->xsh, XBT_NULL, xendev->backend_path, + &local_err); g_free(xendev->backend_path); xendev->backend_path = NULL; @@ -754,8 +755,9 @@ static void xen_device_frontend_destroy(XenDevice *xendev) g_assert(xenbus->xsh); - xs_node_destroy(xenbus->xsh, XBT_NULL, xendev->frontend_path, - &local_err); + if (xenbus->backend_id == 0) + xs_node_destroy(xenbus->xsh, XBT_NULL, xendev->frontend_path, + &local_err); g_free(xendev->frontend_path); xendev->frontend_path = NULL; From patchwork Fri Nov 10 20:42:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 13452790 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 60924C4167B for ; Fri, 10 Nov 2023 20:43:08 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.630798.983938 (Exim 4.92) (envelope-from ) id 1r1YKy-0006Hw-CW; Fri, 10 Nov 2023 20:42:44 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 630798.983938; Fri, 10 Nov 2023 20:42:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1YKy-0006Hi-8W; Fri, 10 Nov 2023 20:42:44 +0000 Received: by outflank-mailman (input) for mailman id 630798; Fri, 10 Nov 2023 20:42:42 +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 1r1YKw-0004yp-OO for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 20:42:42 +0000 Received: from mx0a-0039f301.pphosted.com (mx0a-0039f301.pphosted.com [148.163.133.242]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b0766972-8009-11ee-9b0e-b553b5be7939; Fri, 10 Nov 2023 21:42:40 +0100 (CET) Received: from pps.filterd (m0174677.ppops.net [127.0.0.1]) by mx0a-0039f301.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AAKIjQu010025; Fri, 10 Nov 2023 20:42:28 GMT Received: from eur05-am6-obe.outbound.protection.outlook.com (mail-am6eur05lp2104.outbound.protection.outlook.com [104.47.18.104]) by mx0a-0039f301.pphosted.com (PPS) with ESMTPS id 3u9kkysufj-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 10 Nov 2023 20:42:27 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by DB3PR0302MB8991.eurprd03.prod.outlook.com (2603:10a6:10:437::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.29; Fri, 10 Nov 2023 20:42: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%5]) with mapi id 15.20.6977.019; Fri, 10 Nov 2023 20:42:23 +0000 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: b0766972-8009-11ee-9b0e-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dKcz7x8xXlO4kWqIz9otbJNVc4wI2HkDTsHnmnw6opnLvqoi8bI4eDGEbtGWi6cUSTAYt4lG8IssbW3zJWvx/K+mgjlw5ePCKioTtMJ8BESpH/FVj2oTK+4jffg/S2IY0y/Cwfuzn0MpU2h6ngtRoQMZjoGXw0FXAklqpCqSpS6eeu4dmTONjlflvNgyJGRBTE0SIVa+xevGAmv8q6Bpoo0E7uTYFhe4jyH9ILcOm3ir/uM8SqVhjXg0FZLhzesAfTQOC2P9PMVz1eywUipCCNkc95SDyLPybgyIMgaAhvTZ1ac4bO6mMKKcVBR0RFajA3W29vzN1RDsCnnLheQLLg== 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=SABzLS8E3EK1EwtQXVPOLYVkhNHLc3HH77gb89y98Ks=; b=BlTJ+vasQ1Cj1ZYyJZRxH+ZDDoJlAHrEhiij7cvT6BELs0wC7JiqRsCXRaUc0rqkRM7KTh4dHlCICtjdPNF4A6sLNECZUFJ1gBpZqdJSaZXRig2/NDnMHy9gEJS0qaqCWgQ59XVphNwAxmF/42tFD0uS0mcP1eua7O2x9aAifvXunZjhBMGpa0XGq6rAY4V9MVu8GxQken11HLpUCezidzGlZan6elhXN/isvtpNXDyMTbBypdJwqo3jErdxyu9iVfTAvzKBZnqqEouevVdzAzSwOyJEqcxNZ8GCNQxBz+3dwzjvXT8k6fkycx9eEDaGYtEzkwD02eff9F4s//B0Vg== 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=SABzLS8E3EK1EwtQXVPOLYVkhNHLc3HH77gb89y98Ks=; b=oP4WRw5c4LEQBuvGKyNQUcvT1gNXC+ibxESZQpHwy6KhVw6Iuc3QHlakjetZRJ8vDVhl+y3lVow5ndYTx6WXMjjutiR6qaRik5g9zEZbOd5zw+jCzCqN4Z21XnxjowCpkCgTsCU3K3XDp4BrQAzS1LCb9HcymhcbpOqPvhd08zRbbPosLLjNU/45cjy9teetxChSwt9eCoDsCl3FjzuxHBWm3IBoFVSnXzhKZv54du2dsD7z0vVBg1nrBYjR3DNiYKNzNgPEWAiUZcRS5KemL/FB5obhC/oR+WdAvhS20U70AeXxKvFDEYcUp0S8K4ZGgevqCZWb2EZR/A2NxWrn6w== From: Volodymyr Babchuk To: "qemu-devel@nongnu.org" CC: Volodymyr Babchuk , David Woodhouse , Paul Durrant , "Michael S. Tsirkin" , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Stefano Stabellini , Anthony Perard , "open list:X86 Xen CPUs" Subject: [PATCH v1 3/7] xen: xenstore: add possibility to preserve owner Thread-Topic: [PATCH v1 3/7] xen: xenstore: add possibility to preserve owner Thread-Index: AQHaFBZoS99E/RofVU6d/7dbafCRig== Date: Fri, 10 Nov 2023 20:42:22 +0000 Message-ID: <20231110204207.2927514-4-volodymyr_babchuk@epam.com> References: <20231110204207.2927514-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231110204207.2927514-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_|DB3PR0302MB8991:EE_ x-ms-office365-filtering-correlation-id: 77270297-91eb-4348-0324-08dbe22d8ae6 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: +a2Yghv5ArmvyyJbAO9TzYFQtRBgH77ysh6SAyw5lEDcY5veCuiPVCt6lzXvYOdLs2VxvN/bbFAGJgvoCRe+G26pUFvqfCOFZN8ZWrARa7EqQk8hjPD+Nhw4yJDePcH/nZYIHmxtRG+QE0zFnP8u8MUXAn82cu3uT8E1rCLMBblYp6JLK85J8g/FhLLJGYYZmP4u82bCQnFiXe/i3ZT/45mrHO+d24X/gjCgo0jdf3NVXkEZ6/VLGRfspcgmL2cMHpbpD45o1lDT3M3BJ4e07FzoYcZWYWD98sdXE8T6N4ECRnU+sNF/RSGH/wo+zpjWoxEIzRjA/jqkdzKDx32+szAe5yCgpyizLSb0oJnx77XprSLLVlzNcd0y5+WCD9Oo6spOes+ObHA7F57VLmP8Y0YceZyVw8j+UTF3f6l2n9LxV8I3QYP3HVrufCTOEkKYYhDE3YmUGpuY6/sef+UKkVClKMZoaXdydX2LzbzKctpmmDhswaBjesvLWbLM4J+pUw21aZJNjh3mBkviL9kUnHrLjnF5thYmirW7Trxc+PRaKucKV1RHRGps8d2mpAo9YT3LQT+Ay7Fw9Jk0TBx3Knkza0O2DoW7C6rdlhtPmfPUmqlMOQpAd4gwHkILcK51 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)(136003)(376002)(346002)(39860400002)(396003)(366004)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(41300700001)(2906002)(8936002)(4326008)(86362001)(7416002)(5660300002)(38070700009)(8676002)(316002)(36756003)(83380400001)(38100700002)(478600001)(2616005)(1076003)(6512007)(6486002)(71200400001)(122000001)(6506007)(55236004)(91956017)(76116006)(66556008)(66446008)(26005)(6916009)(64756008)(66476007)(66946007)(54906003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?HWygDQEb1PyFhR+kL4GJ9sr?= =?iso-8859-1?q?PJBGZX6do22PpT5Z1cW1ZpH0799bRH+CvpjqYcp3dWIwbloXapxCndoQJkNJ?= =?iso-8859-1?q?uHcjB0sPNLrW+I2cxwni0WxoI0lLuxrk9CxWjiej+pQKw74a1PzG8Xj3asWb?= =?iso-8859-1?q?YTpgikX8+lHNrubA52ywwI89p2Hx9EimksgxUTYF3slhuKYMDz11NAX2XtZq?= =?iso-8859-1?q?h7B34CaJEqAUvvcwvyMJUkpJW2oZJA6NktjOQYfI0br5nNZRI9y+9cNjqS+W?= =?iso-8859-1?q?VNBwfG99KPnYnWS7tRPXTYlCHUWgAf+qvkNjVdPWkizuaBZ4v2QTeGXQkj4N?= =?iso-8859-1?q?fVQ1GYcZk6BPUciTijtazTOnQ/ht/3X07YV7qIJYL+X6x7Hc8vYuAFmv0GkW?= =?iso-8859-1?q?41TF4NCOHbaMRypMuwXyYBiBaUShIUMx5+YyAvhmjfAuAJNRy7AHr+2ndySL?= =?iso-8859-1?q?lVp833JOQPbSmSlypo0sO9Hsvz5ZGfcDXpLCiB7JFY7nuCgBF805bLi3NndB?= =?iso-8859-1?q?XqKqWs4cP0G3/YMLAOEibptwwLSD4K1wVjoImcYFYAakV6BqgMFjcUYaSrPi?= =?iso-8859-1?q?HPANmhKIR179mlieSlURQgDGeKshT61AO79QaFSacqi8NSR6Ts7oTf3URh6V?= =?iso-8859-1?q?bFOTj19gf52Ag3YQ6KW9cMu6yVLwuXpWXXv/RvCRHCOws5WPUp07rcl3m07G?= =?iso-8859-1?q?XUBHqvQatsXXRqdN2BjkxlLQemRM9S6i9x4nFcBWS60tbMig9FUF0dafIGMP?= =?iso-8859-1?q?Nk9nQiAXPBM/vo+rQNRtuXxy9SG0+gwXUtzNz50Ri1zpjziiEeLzyyHpvTSM?= =?iso-8859-1?q?tPIfzrPgmw8I2vyqlLVxNwCUkaxV6sNdwLlBnX8h8em/pZ6WXk/DmnmLCFbD?= =?iso-8859-1?q?uoF/P/ijYPNzpT5i3IoXDlDSuiatPowqszi7l+bgHayoYUXqTZgTeUu+ucEz?= =?iso-8859-1?q?gpJnHx8tcwujkR2SXQGUQxAsrBZySVa2PxqQ0l4kooHXyXL/tt0Ay6CHBGSg?= =?iso-8859-1?q?RSHr8vGSroW39KYuuU3SHP8ARQnSF1Y9e0vlPqBB9MrTGlFEl0Pgat7s3yv+?= =?iso-8859-1?q?YSamMuUe5QIkNmXlFY7IhjbrYbKVV+oYhlKo6lhI8TgHon/BDGB/aJrasVUw?= =?iso-8859-1?q?COvUhyHx4htDv1QfGzhQctkaasH1Lz44T/JGIcMwk5x/OHYaTgXFvmK36WFS?= =?iso-8859-1?q?eCN2gE11YLAhNwaKZwrSDT9SIBLaiMqiF/9J6ezEiQ75kw/HbTGUkLBYDMn4?= =?iso-8859-1?q?wgGjjidUj6kC8uSl6V4blVcepLcIvFSPOj+d8gu2yRHlFUWqDtCGWsnbNtnW?= =?iso-8859-1?q?VSvBUVa7/XMMj29qKx1yx2dYO9vyj4PKh3zzTiQNPbncKa+6jcCKctOHytKb?= =?iso-8859-1?q?78Z2YI/lvLS+b7sW8bQRdWO5r05zO5H9dXKnlNJQXwO90+aew8+Obep2ysIh?= =?iso-8859-1?q?6fnIjIj7Di7gMDJe0LGX7Pf82Pl6q/CtXz2fdYYg90xX8jEJftA3ZD+Si7IV?= =?iso-8859-1?q?7mQQHPrgXte/6wktbssahKM4u21gYl7rdgBnwLLziLebxtUEN2iW2m6jidAP?= =?iso-8859-1?q?Wx13ThctbkWG5w6XT6bQGLe+V0bj+bc4e1811eanseSR3Xd7hbMKXlzpb+qi?= =?iso-8859-1?q?iEDxlZUH46LgGnF+AR31zGtx9OknjwGk6MS4crg=3D=3D?= 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: 77270297-91eb-4348-0324-08dbe22d8ae6 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2023 20:42:22.8222 (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: Oa45hKbQ2wDZG6dY7ToKqKfLd/1QA2aaw2GaUN/X6GUfMzjt5CxK3sZczkRfndpLUec+NAqcFeQ3yRghmoMfApynPzdJJEmigu9vtJLQcbg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0302MB8991 X-Proofpoint-GUID: BLNE5bGVc9v_qqRAms0kbUuAPLVvFkZl X-Proofpoint-ORIG-GUID: BLNE5bGVc9v_qqRAms0kbUuAPLVvFkZl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-10_18,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 suspectscore=0 mlxscore=0 phishscore=0 clxscore=1011 bulkscore=0 priorityscore=1501 mlxlogscore=943 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311100172 Add option to preserve owner when creating an entry in Xen Store. This may be needed in cases when Qemu is working as device model in a domain that is Domain-0, e.g. in driver domain. "owner" parameter for qemu_xen_xs_create() function can have special value XS_PRESERVE_OWNER, which will make specific implementation to get original owner of an entry and pass it back to set_permissions() call. Signed-off-by: Volodymyr Babchuk --- hw/i386/kvm/xen_xenstore.c | 18 ++++++++++++++++++ hw/xen/xen-operations.c | 12 ++++++++++++ include/hw/xen/xen_backend_ops.h | 2 ++ 3 files changed, 32 insertions(+) diff --git a/hw/i386/kvm/xen_xenstore.c b/hw/i386/kvm/xen_xenstore.c index 660d0b72f9..7b894a9884 100644 --- a/hw/i386/kvm/xen_xenstore.c +++ b/hw/i386/kvm/xen_xenstore.c @@ -1572,6 +1572,24 @@ static bool xs_be_create(struct qemu_xs_handle *h, xs_transaction_t t, return false; } + if (owner == XS_PRESERVE_OWNER) { + GList *perms; + char letter; + + err = xs_impl_get_perms(h->impl, 0, t, path, &perms); + if (err) { + errno = err; + return false; + } + + if (sscanf(perms->data, "%c%u", &letter, &owner) != 2) { + errno = EFAULT; + g_list_free_full(perms, g_free); + return false; + } + g_list_free_full(perms, g_free); + } + perms_list = g_list_append(perms_list, xs_perm_as_string(XS_PERM_NONE, owner)); perms_list = g_list_append(perms_list, diff --git a/hw/xen/xen-operations.c b/hw/xen/xen-operations.c index e00983ec44..1df59b3c08 100644 --- a/hw/xen/xen-operations.c +++ b/hw/xen/xen-operations.c @@ -300,6 +300,18 @@ static bool libxenstore_create(struct qemu_xs_handle *h, xs_transaction_t t, return false; } + if (owner == XS_PRESERVE_OWNER) { + struct xs_permissions *tmp; + unsigned int num; + + tmp = xs_get_permissions(h->xsh, 0, path, &num); + if (tmp == NULL) { + return false; + } + perms_list[0].id = tmp[0].id; + free(tmp); + } + return xs_set_permissions(h->xsh, t, path, perms_list, ARRAY_SIZE(perms_list)); } diff --git a/include/hw/xen/xen_backend_ops.h b/include/hw/xen/xen_backend_ops.h index 90cca85f52..273e414559 100644 --- a/include/hw/xen/xen_backend_ops.h +++ b/include/hw/xen/xen_backend_ops.h @@ -266,6 +266,8 @@ typedef uint32_t xs_transaction_t; #define XS_PERM_READ 0x01 #define XS_PERM_WRITE 0x02 +#define XS_PRESERVE_OWNER 0xFFFE + struct xenstore_backend_ops { struct qemu_xs_handle *(*open)(void); void (*close)(struct qemu_xs_handle *h); From patchwork Fri Nov 10 20:42:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 13452788 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 50C0EC07352 for ; Fri, 10 Nov 2023 20:43:04 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.630795.983904 (Exim 4.92) (envelope-from ) id 1r1YKs-0005HF-BT; Fri, 10 Nov 2023 20:42:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 630795.983904; Fri, 10 Nov 2023 20:42: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 1r1YKs-0005Gk-5J; Fri, 10 Nov 2023 20:42:38 +0000 Received: by outflank-mailman (input) for mailman id 630795; Fri, 10 Nov 2023 20:42:36 +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 1r1YKq-0004yp-O6 for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 20:42:36 +0000 Received: from mx0a-0039f301.pphosted.com (mx0a-0039f301.pphosted.com [148.163.133.242]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id abc769dc-8009-11ee-9b0e-b553b5be7939; Fri, 10 Nov 2023 21:42:33 +0100 (CET) Received: from pps.filterd (m0174677.ppops.net [127.0.0.1]) by mx0a-0039f301.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AAKIjQv010025; Fri, 10 Nov 2023 20:42:29 GMT Received: from eur05-am6-obe.outbound.protection.outlook.com (mail-am6eur05lp2104.outbound.protection.outlook.com [104.47.18.104]) by mx0a-0039f301.pphosted.com (PPS) with ESMTPS id 3u9kkysufj-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 10 Nov 2023 20:42:28 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by DB3PR0302MB8991.eurprd03.prod.outlook.com (2603:10a6:10:437::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.29; Fri, 10 Nov 2023 20:42: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%5]) with mapi id 15.20.6977.019; Fri, 10 Nov 2023 20:42:23 +0000 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: abc769dc-8009-11ee-9b0e-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PLzbX+PFHfdrpRDvIHh/f7PsfqIacoGaQkRrO8MspJ5r/z10EryU2zR+5nyrvcHJQCBsz0/r3gbmLGZUZ7yUq97zUChu/gqEbyZmHbOQAONo3RsEW7Gsd0EPgbQQH2eU7rGXyCN9zFge89C4yGwxKVUVRf7unl4j3e8xc1gEaLWWJ+UEJUNIAE5E5j5Yi/ddgbi0iVjudVo4cWDrpGpJ79wsw0f1ulc9QSbZSFOCKXhEOzNhrO3TPOW/QRaWzRbS0z1dzEW5J81lJy16206Lsv2LuKBzu3fm5nQjFpKsrkkPICvAi8cOfjB4omcw39tv2BawW/FqnSF8gtOqE3CtOw== 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=gvW436DHGoKHwxC73icUcWiaYr0+vXQ+sVSK+d7PBeg=; b=NrMHJiUYnSClmG816XDXYmI+1IUU4zufT0z6svvjtdu1QeBk62D1ii5RTukXffD2d71xf4fflD0v8oXrMHlv2yAPHt9uTlZa5K6NxrYUcJq0QUSk+cEw7SFkccb1og6dxPStbiZklI0Hay2jCX9/legUw4We41hUni8yUZ/ylAnS6dp8IlkAm+rMovF3xg5Wi3cY/NNAsONBpZAmqi2pQwTncLep+/+1Jo4nbYAcJ3OkUKFgPHNC3TRFKxB8jlrto2KQldF2rWR56hIYWIeBPN1lVhEC915R5J6S1u8Xo3tdo8+JLpQOBO6lNoVyYwgOcLCIWhIxcaDHMlNAimXsrg== 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=gvW436DHGoKHwxC73icUcWiaYr0+vXQ+sVSK+d7PBeg=; b=G5tIeKCiYONkoAE1+JYYUJ8NQL6C51brQmsEYkH9Cw1e3xv/uztgaTFhoA9E+2hD2FNnrr+4btYXxuBbsmYw2Y8/8TJBg5XCLEPIg45AUTpW2NhxksSa+ZOiL0sejg8UWXNoVAh8dGl55Hd4EHXvEdEoIBl8mzejuVrsd8QRvyeQn2yTq5CXJtn2kBMfsWYpM4XcHTV1IpI4qOeqWCV4MrsXhPcjU0AO44eVBNVEQjpiPIsGABn8bkuHGSugb10M45wNdiyiTmcfaKqjK1ANCpomSn5uZqVBjhxeSL7jYMB5FHhIJyPR9Tw34fQjp93rINYjTFi2IBj7BYROcvMUaQ== From: Volodymyr Babchuk To: "qemu-devel@nongnu.org" CC: Oleksandr Tyshchenko , Volodymyr Babchuk , Stefano Stabellini , Anthony Perard , Paul Durrant , "open list:X86 Xen CPUs" Subject: [PATCH v1 4/7] xen_pvdev: Do not assume Dom0 when creating a directrory Thread-Topic: [PATCH v1 4/7] xen_pvdev: Do not assume Dom0 when creating a directrory Thread-Index: AQHaFBZoMLHgqbm5ZUeTIEOOIKOHAA== Date: Fri, 10 Nov 2023 20:42:23 +0000 Message-ID: <20231110204207.2927514-5-volodymyr_babchuk@epam.com> References: <20231110204207.2927514-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231110204207.2927514-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_|DB3PR0302MB8991:EE_ x-ms-office365-filtering-correlation-id: 42f2e465-0743-49e9-3ba7-08dbe22d8b1f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9AnWrnyU4cpyeXaqz6rMYJVaIi2R7rkJocbJGcGqLL/P9pMFO09TbONg8nbvbqKlBEVi9s2QfMrLWBzlfs72oo9KgiM0zgdkoVDSbkRadklanWodmrcZDHlPTiGvL3VxmSKBoX7pQcvVg2qRjSir4tFENXtcvLNHZI6NhX+wn6tZQnzTYqFE4SJi18cURyQpeB8GISrnBWJmWtIEdZ3pBKImEQDCt3fqWkNP6oXvLv12Q3Fzk1UtSP2Iegx/54fZ8XwrZnkAWQQSWZ5fyl0hWfg4TviHVZOZgw+bhEkdLZsxmrA+W1eAyzpMzzeP6cUpidYkT7BtcodF67mWVcSeugY3cRqLKgEnfUzRLM8s/O7SGe/IaItckBw52iXnqw6zDWRwFUUkDkG0J+uzHzDjVB2YbSC27yVatJzlwYxh37sf+Q/kkW+KMAHIpJ9kI1tTpu4uWc7EaRHXIHIgu4TX+mgYYDe14t6LqVCoJR2k7sSS9oCCBLKw9HGK+qtL7qGe4A6N5f8F4Gue3tHUVCDUq9SmeIgKhVKZt+lfb1JOfuw7v/Kf7dfRVRYIlk02YzOTd3Aj5c/MgJ/0iw+5NbN0508KKdwcGegDvtpjHICRhLTzjLhdQkEhmHem4siC2Xu5 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)(136003)(376002)(346002)(39860400002)(396003)(366004)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(41300700001)(2906002)(8936002)(4326008)(4744005)(86362001)(5660300002)(38070700009)(8676002)(316002)(36756003)(83380400001)(38100700002)(478600001)(2616005)(1076003)(6512007)(6486002)(71200400001)(122000001)(6506007)(55236004)(91956017)(76116006)(66556008)(66446008)(26005)(6916009)(64756008)(66476007)(66946007)(54906003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?6jAyKfAeJlgQWEybzi/BOux?= =?iso-8859-1?q?fXmGcsnT+2Da9xE9MkpQRhUhA9osB1o72SRp2hgyoBs4RrEI20M4b0tBPTpf?= =?iso-8859-1?q?JDlxW+mjMLUtt5SdCu8nSlhROpMP4CG/ISggdmlJjrU0coEDa+Yc0wQ+BZQk?= =?iso-8859-1?q?mgUGUJUFkg6WOhXdmWDqW77eF38/8g0FKkaNfIkthwudliq7E+16Na1DiM+m?= =?iso-8859-1?q?sitgNicGE/KIejRESmAn/yMw3O5TDQPvSxBMHsa6hD1DVb2A7hdaybzU/0l2?= =?iso-8859-1?q?JmcJ44fuAFVh1mvAxSIfSyoyZ+9/bNapeCg+OzrSYwwYl51/Jkukxorj3TxM?= =?iso-8859-1?q?/BEnIL1yKOGd3FqOTaOI9c0jxjnoqN9s9lPArIvJFqsEvvohfYzOQMZYOcu4?= =?iso-8859-1?q?dA0wmdC+RNy1Iwx/R+CPaL5kV6ZFVkF7z4sb+ddTB8X5JWewm5PmxqosUOFe?= =?iso-8859-1?q?7WpsPOLkdIryRzj+m7Uxt5GJxWGae5sGYhdg1RfelzdeU17keHI58Yk9pFc7?= =?iso-8859-1?q?bUTl+8eUKU9zGro+PCexnS6K/bg9tiJwvcUrVwN3sk+R+eQc5e68eKVnhEhm?= =?iso-8859-1?q?FFj+BtjXCsWHEzc5gdBEquK3aGM73HxFMJm5LuZufugIZaEOnuuCQKj1jy5j?= =?iso-8859-1?q?3M8RZS13QyuWV9i2DNzMBmzb0a0PlhPCuZfyR9YGuhXp1bdJGl7VvC4HpIBd?= =?iso-8859-1?q?MBTpjGU9fa4dfvKLajxhLD1YW1QWl5KfNFGdwmUDEGLT9Kh+MiqIWMdgPs3Y?= =?iso-8859-1?q?vbZbqaihrazNZ1+qU5LUDy6kAIBAak+JsrFHWClRlLr1ZY7wSXh9ELP0ge+D?= =?iso-8859-1?q?qh5H0vDAWCQu3lORxo53f/WS4TMdDbzHE7oZxyLKoIAoOPdbWRODF0hKv0EX?= =?iso-8859-1?q?08UxfJycTytG5g8fNs0ZoInzjCqKKbBAv8VtN5WreBAupvqfSlPetOLf0AIC?= =?iso-8859-1?q?0JBUOtRagy7e2YtWykNujZfXujbJ5MLQ/Dck9KIq9XTQ8fKh7j1j1aNhpWtY?= =?iso-8859-1?q?VkKjMdv3YYXZlckRXmiYHUvTIiN7Svt0LcfOHcpfyIMv/+cM5fiiji/dUfa3?= =?iso-8859-1?q?XV+Xf4yjX+ne3iYoKQluj6dSZmJIsPTTq3Z0jSF9kfiYdFT4MzGVbsjL3OO3?= =?iso-8859-1?q?EaPJZ7jfGr0EvJC5k36/DmC9pWaEillI7If/hH6EGTG296HNdsW7FQNwYv3M?= =?iso-8859-1?q?V9i6e3cm6PrGwU3lL203YtBkMKsCuiEbl8XMycyexdYGm8gTYTJqAQx/DN/C?= =?iso-8859-1?q?WvuSurktyfLsRP0fABKTS3CFcRCjyBHy2psid3ahP44j3e2uPZTmlZkOMUI6?= =?iso-8859-1?q?dnhdnRwZhX6Jl2KWZ2J7YbVEQNh5v7yZEJfIGoxJFX2oXExY6mdEpAlhPRKx?= =?iso-8859-1?q?GNH2eiHMfpRq0AImF1+Vbjs3htas8RoyjRQnQbQL09pqoA+W+eQDO2pvns1V?= =?iso-8859-1?q?tmFXvWtsqeeVlgkfatTfjOhaQZR/R8yMcBtfhITnaTuzstSbcng2phJV6gDa?= =?iso-8859-1?q?fbt1sM+7PRgGfPB0hBSScCWKGZ9yFFypzCm16YIYGL+bnhvReQTvG3CVF6nQ?= =?iso-8859-1?q?TNGGNOw8jKn0HaiNSapWC0PpvUaEkFzZypLVnlS1sPbeIX4LsXjapL+zkSZp?= =?iso-8859-1?q?1DbBd0nOoodhH4zqeB+9bPgoUJnAh4LfRNgRA9g=3D=3D?= 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: 42f2e465-0743-49e9-3ba7-08dbe22d8b1f X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2023 20:42:23.2225 (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: fOncCzEfv+h6yDb8uPraSPueoRoUPP85zBDlMuxCDhfgt4gtBqdtx6Y2sEGhkSqsVvfcfTdKOUFOUlLdCV++GPCyk1lQUUtIdY7v6xsUBdQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0302MB8991 X-Proofpoint-GUID: w1g9lBFxP7b-80B2x1nYalgPezXtntVp X-Proofpoint-ORIG-GUID: w1g9lBFxP7b-80B2x1nYalgPezXtntVp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-10_18,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 suspectscore=0 mlxscore=0 phishscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 mlxlogscore=593 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311100172 From: Oleksandr Tyshchenko Instead of forcing the owner to domid 0, use XS_PRESERVE_OWNER to save the previous owner of the directory. Note that for other than Dom0 domain (non toolstack domain) the "driver_domain" property should be set in domain config file for the toolstack to create required directories in advance. Signed-off-by: Oleksandr Tyshchenko Signed-off-by: Volodymyr Babchuk --- hw/xen/xen_pvdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xen/xen_pvdev.c b/hw/xen/xen_pvdev.c index c5ad71e8dc..42bdd4f6c8 100644 --- a/hw/xen/xen_pvdev.c +++ b/hw/xen/xen_pvdev.c @@ -60,7 +60,8 @@ void xen_config_cleanup(void) int xenstore_mkdir(char *path, int p) { - if (!qemu_xen_xs_create(xenstore, 0, 0, xen_domid, p, path)) { + if (!qemu_xen_xs_create(xenstore, 0, XS_PRESERVE_OWNER, + xen_domid, p, path)) { xen_pv_printf(NULL, 0, "xs_mkdir %s: failed\n", path); return -1; } From patchwork Fri Nov 10 20:42:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 13452791 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 94B45C4167D for ; Fri, 10 Nov 2023 20:43:08 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.630796.983909 (Exim 4.92) (envelope-from ) id 1r1YKs-0005O9-JK; Fri, 10 Nov 2023 20:42:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 630796.983909; Fri, 10 Nov 2023 20:42: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 1r1YKs-0005Mt-E6; Fri, 10 Nov 2023 20:42:38 +0000 Received: by outflank-mailman (input) for mailman id 630796; Fri, 10 Nov 2023 20:42: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 1r1YKq-0004yp-V4 for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 20:42:36 +0000 Received: from mx0a-0039f301.pphosted.com (mx0a-0039f301.pphosted.com [148.163.133.242]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ac2cad76-8009-11ee-9b0e-b553b5be7939; Fri, 10 Nov 2023 21:42:33 +0100 (CET) Received: from pps.filterd (m0174677.ppops.net [127.0.0.1]) by mx0a-0039f301.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AAKIjQw010025; Fri, 10 Nov 2023 20:42:29 GMT Received: from eur05-am6-obe.outbound.protection.outlook.com (mail-am6eur05lp2104.outbound.protection.outlook.com [104.47.18.104]) by mx0a-0039f301.pphosted.com (PPS) with ESMTPS id 3u9kkysufj-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 10 Nov 2023 20:42:29 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by DB3PR0302MB8991.eurprd03.prod.outlook.com (2603:10a6:10:437::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.29; Fri, 10 Nov 2023 20:42:24 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822%5]) with mapi id 15.20.6977.019; Fri, 10 Nov 2023 20:42:24 +0000 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: ac2cad76-8009-11ee-9b0e-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l7P7vS5qGnKmGuBUQrXZQz8y8GUn3VwSxrXtQW6EIfrO1OYgVCG3NI8LKeAU9n914lSb3/7RudL2L1zFPqgMsqKbf8lp3BAc1ur7NEyTMQLpbSzOqxgqPr0AyLVx1hHZwonqxLwdacXs/F/MIG0sNG+X0rtgtUKCs01g/JjWRnNsr0d4U1S3TMyL0x+ie5PoOjiwVTLv3NFgKGxstuy+HR9HSSv2NCrQiAtPLOmGSBXle5CHKgBYDtR/sy+vBTpgs8GNIucb5qGnoQVGF9+e+0vrQu/EBaLNDAO9ceHy4lt8NkNv5yys6gAUerrS7WVUzmBgUMu6bYh+3zOOjzdUIg== 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=MrOm9LNsn91tP/CeZzcWh0KSoCIqcM3e2ReDFqdpkMs=; b=MWJuumrsANCXTTfhbrqqArsfoSGQwtAwmOkSD/68Vu/CQrn32XKYlzt46IehEyGs76XNFOn8u0wRJgv0qEsp8JNas2oCSpOJHKeHEIo+UL77ONGpELLH96N41XB6vySXFVTreMTg/suptPTgpWyKt2HiUoYFp1BEcUKCWwlygfzTkWXpCuXXqxn7J2QuXaIyJeF5F9CUfUSGfY4o39mDtH841Z+drLBLblBQKgrIt1OJHahP6wMDL2HepsY132iMlyxHcOftAhwUSwma0rYiskBJJRxuAOGgt3iHUZXOaO6eg+/WRn4RYAnrbePEFgWGDPVuRjTn7VGErVHEE5rpOw== 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=MrOm9LNsn91tP/CeZzcWh0KSoCIqcM3e2ReDFqdpkMs=; b=Z7wiTcmSJVEYD+hzPUh9SND3rduTyjqI49Pzvlv3ttOvIbFD0ahOjQyJDKF1vNiBblW6tx9NnUfBTsEtWoinQ6jVCNnTWXseLDmoLPI00G+Z+in4UHSNLpZJwV/NXAPAadccu91FKjq01BD2rtLetUGYlxzqPm78OHH8ZRac+AJ46LDF4f75FT0KuZGOPOmNCiW2c8Qq/Pp90skmxd0kbJVfjZGkoMGrbYnHSJh1Tf4+tQxUWfh8psQdXYCeAfYXWxWHijhJvGPP2MAKhmk5/RmtLZmv/s3nw9LuE8l70Yjrr183wwxe39AKieiCcOhDA8H+c9xR6YX2GDElTWVvCA== From: Volodymyr Babchuk To: "qemu-devel@nongnu.org" CC: Oleksandr Tyshchenko , Volodymyr Babchuk , Stefano Stabellini , Anthony Perard , Paul Durrant , "open list:X86 Xen CPUs" Subject: [PATCH v1 5/7] xen-bus: Set offline if backend's state is XenbusStateClosed Thread-Topic: [PATCH v1 5/7] xen-bus: Set offline if backend's state is XenbusStateClosed Thread-Index: AQHaFBZoiczA8QKKJkeUUC5gOc8rQg== Date: Fri, 10 Nov 2023 20:42:23 +0000 Message-ID: <20231110204207.2927514-6-volodymyr_babchuk@epam.com> References: <20231110204207.2927514-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231110204207.2927514-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_|DB3PR0302MB8991:EE_ x-ms-office365-filtering-correlation-id: 5703c808-08b1-42e3-7423-08dbe22d8b58 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: sOWUR49bPCHq2MDz4OKjUebc6vL1/adN+YxOBCawkCdh289XyABMU17ZIHdt3zae6BUL+oTOpbcJXoTxvHuFAlMMBdU4OpWAizWs9lMQK//lueKKf6qyLFESjY2jB3oeokSVEjy9RVENSfxXQxjE4gNQFUY2dWbXxGvEKzHLXTnTYLj7tZjkYO7Nyj8dPGDdjf8tt7Zs2DDwce5uwZhfo921VZgNjvITHh2ujworYJbsDOHgVtRVpeO7Z4LbZm/G0kUC/77WNeHe8mDV1I5Nc6Inb2RcglR/fWAByZaorDGtN+nv0ZD/lr96uHRwpeOux5bnQRu0YB2tvytlLCcTQ4STX5FUTsWcUL+cPlH+oT9dBgwa0cIF5hsWSRrakdZdq48q1zE7YPcMVAvqHZjOa9Cx7R30Xy1Ml2CFFN6ImtuWYeHvmm20BmBDCvOFZl83fnl9w/K0NzSV2C0+U9D9yVbo8GwIL0BmJaBDLSmrGnYmNePe0LEeGawADZG4zL3EHFBeMlU7qzPANauGyOtgGiL4l8566K1a6gAsi+EoMJRNu/DiDAUdjmvgpjPTTMADKfsW9jQyS6jd5e3DSegNUEFEz5xcXoWiw8AB9UlTONY+TWChdATiKpD5IE81hVov 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)(136003)(376002)(346002)(39860400002)(396003)(366004)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(41300700001)(2906002)(8936002)(4326008)(4744005)(86362001)(5660300002)(38070700009)(8676002)(316002)(36756003)(83380400001)(38100700002)(478600001)(2616005)(1076003)(6512007)(6486002)(71200400001)(122000001)(6506007)(55236004)(91956017)(76116006)(66556008)(66446008)(26005)(6916009)(64756008)(66476007)(66946007)(54906003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?/FSoOQPzYuRmlIFZl0HXXBf?= =?iso-8859-1?q?rupib9qLujN5V2UPKaGu12YeZkQV23hCfFkIqFiACkHR/djiff0fcA4ZNhYa?= =?iso-8859-1?q?MK9IxiFtlSRDRsijprxBJBuQuuqSXDnqCK+DyaoeqL2HYkiOeQ0+AUt7h9p4?= =?iso-8859-1?q?BT/gOzz07KEGNuHXeT5I2Fd0RcN15o3yFJ2tJ0yjgkY3qIu06ctw7CTPejOj?= =?iso-8859-1?q?aV1smIyET0rJdS5oCA1UlyxOrWWqjZjJ4XaV7BJxfKthmVkR5OlQQk5+4v3f?= =?iso-8859-1?q?nm85NT/tC7hkoLyBDXbQfG+UuUFCgsMGm+z+7I4IIu9w0rbH2NVKmrWIBaqy?= =?iso-8859-1?q?1QvHD++HmD0t6LYptgfOBVI3aKAoHouX2F63KQ9uRBVpD4TEqWZudwcSpapv?= =?iso-8859-1?q?ASL7Rw8vI9DIg3o0Glcg1a3r5xdA1HLRzHZth3LrdlA0qxeAK7z9a66lAdtf?= =?iso-8859-1?q?FJNaicvUOvR/GFB8pCxx8yz58LLUJooh/y65oIne7sUGBKwnWGSk2MEj5zse?= =?iso-8859-1?q?9xoab65QhVvlgSPDeEhSTW0+u+TxYhUvcAs4bqohYXZe40m4AtIy52afhka3?= =?iso-8859-1?q?e1L3jDhTGFSy/XAshd2zfT4yVFS9sygxLdztItiUfn6svZKNSC0s8mh7H0/p?= =?iso-8859-1?q?ryfS8CK0ZrvWft/Q7W3pEpUymKULw0A0IFLZ5pzXbrRryXUBSJdxZFzgNihg?= =?iso-8859-1?q?2yNH+cwLS1oc2ClujJ8fspHqotmPzWqxe9jAMNJqXU5p9LPzYovKsjE2C1DZ?= =?iso-8859-1?q?QXO6vdvXAFB4yLSBdSBZTSFBna/JoGW8Nbic5Y0fLXC/6ZKBaSSsieBon96z?= =?iso-8859-1?q?cub2lpj7F/7y5hMNKI3jIRC+HoXyBgdkPAgfIABBIO+Lgj55zzNWt1sduw24?= =?iso-8859-1?q?RTunpHhu5PXc4mX9yAoglRNpxmfH/pKJq4xnjwShiV6bLT3zVnoSftaCRdeU?= =?iso-8859-1?q?JKTcuV0iPwYE4pYwELXhcTTTkUaKXMXO7n7UXIh29ztnqT+3COt9vlYVbVQ7?= =?iso-8859-1?q?xNHKTQRsr+kK71Cqv71NUAnipe6qUM+fHKlZPzhUk3tv+0tw66LPEm/YBW73?= =?iso-8859-1?q?+rhCmo/EM/hQfpoc3e1QN3pwbalqIbugHmIK3Kya5+NslVuKAFqKxg0Kwhyv?= =?iso-8859-1?q?j8eE3RwuZ57zC3CGe9LqgMe8MyZgtHaFn7DNRyjRY7yHxYnXGh1Y90OhmPqX?= =?iso-8859-1?q?X5k5BWTjOC9aDZK4kEsGBgORGgRQqUV59/KaAZ/lwMBiym4d3A8A/AbUWX6x?= =?iso-8859-1?q?HEmZZ/s7egmwdYJ/YBSxWLapFLDCb/Fn1cyhVJaKuu0Bkcvt+YAI4eXgKTkQ?= =?iso-8859-1?q?NQTa3VwlaxCYajiGtKcBl1wLqRRk79rgE+3PLlbsEZTPKJHNO933G4DV0i76?= =?iso-8859-1?q?V9iGXEOQKmb8Qu2iW5ZNsc2bas/w598Pbbe5YvfHw1G6gCtM/Tfn3Eky3LvG?= =?iso-8859-1?q?8FOkLLRDYgDrEh4/vSeLKH//+1MsW+gT/ZMbj02oAASgtlW4wzrinkl2g1/h?= =?iso-8859-1?q?NGbIaAj65ve4K/ilPvuL6hXVMs4m9X1GE5XtPNMSz3blAAu4LA0VVtGD/Gso?= =?iso-8859-1?q?rcoRHHpMEKuOrOZ1bAOzHipr2caAfcaAPmxWN6lAmfU7Q1CN9s1v9NSJYOaU?= =?iso-8859-1?q?+B/wptAQpBLo5G+cNgFpG5rKnjIWD7K+T7FFSZA=3D=3D?= 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: 5703c808-08b1-42e3-7423-08dbe22d8b58 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2023 20:42:23.5860 (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: h4tOOluxqO/4qLsSZ71s/8uGodtx/tTK1A/oB/q+pw/PxM7PTNVc6xuXjWs7VmAOigTjSZvqrWFoM+hJ+tEiGM8NqVj0JTH0+SPYRQUxg3Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0302MB8991 X-Proofpoint-GUID: CO5DezGelvZJUtJQjvaAJuNKkslVZEkG X-Proofpoint-ORIG-GUID: CO5DezGelvZJUtJQjvaAJuNKkslVZEkG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-10_18,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 suspectscore=0 mlxscore=0 phishscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311100172 From: Oleksandr Tyshchenko Both state (XenbusStateClosed) and online (0) are expected by toolstack/xl devd to completely destroy the device. But "offline" is never being set by the backend resulting in timeout during domain destruction, garbage in Xestore and still running Qemu instance. Signed-off-by: Oleksandr Tyshchenko Signed-off-by: Volodymyr Babchuk --- hw/xen/xen-bus.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index 75474d4b43..6e7ec3af64 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -519,6 +519,10 @@ static void xen_device_backend_changed(void *opaque, const char *path) xen_device_backend_set_state(xendev, XenbusStateClosed); } + if (xen_device_backend_get_state(xendev) == XenbusStateClosed) { + xen_device_backend_set_online(xendev, false); + } + /* * If a backend is still 'online' then we should leave it alone but, * if a backend is not 'online', then the device is a candidate From patchwork Fri Nov 10 20:42:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 13452787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00F04C4167D for ; Fri, 10 Nov 2023 20:43:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.630797.983928 (Exim 4.92) (envelope-from ) id 1r1YKu-0005xl-Va; Fri, 10 Nov 2023 20:42:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 630797.983928; Fri, 10 Nov 2023 20:42:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1YKu-0005xY-Sf; Fri, 10 Nov 2023 20:42:40 +0000 Received: by outflank-mailman (input) for mailman id 630797; Fri, 10 Nov 2023 20:42:40 +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 1r1YKt-0004yp-VS for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 20:42:40 +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 aec3391b-8009-11ee-9b0e-b553b5be7939; Fri, 10 Nov 2023 21:42:37 +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 3AAKI1MQ020361; Fri, 10 Nov 2023 20:42:32 GMT Received: from eur01-he1-obe.outbound.protection.outlook.com (mail-he1eur01lp2050.outbound.protection.outlook.com [104.47.0.50]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3u9jbx27f5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 10 Nov 2023 20:42:32 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by DB3PR0302MB8991.eurprd03.prod.outlook.com (2603:10a6:10:437::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.29; Fri, 10 Nov 2023 20:42:25 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822%5]) with mapi id 15.20.6977.019; Fri, 10 Nov 2023 20:42:25 +0000 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: aec3391b-8009-11ee-9b0e-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i8jo9DaTQHselkLEVbKvhgXbwpfsRdbiK+1l7/PCa8iR8Gk5YyIeT9HV6BkS9PAhaSJ8IFT79zRSUNwLLoXzwI/cQvkQtCO8Qc4iNhT1YxDH7OJprI/lU8C8OASE9P9/OCtGlW4WN8eJqS1Kfs1/CjwpXB4X5n80K6Ap+0Tf5U6wPZbeLxgkvuVZbuUgQQHeusSCbNDugaj/gyacPO+ky9oazzuK6Ft9jo4ekYvSnlIcAxN+mHUNNTbr+Vlv9aaAOr3YBLq+p/BxxdcQO3EVmZ2HCYC9zy7/CDl0n+hkyWHBYEdd1yPv3agC3sGeLRwg2Kd2L7jPuNJRlfrvqVbqKw== 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=jQr5NbNk/LsGXPtDi59H3/Vtk1SC+nBMV+Y5YtBMVTo=; b=b/f3xonK41fGxgUOG6XCVUT1y3oD0GxUckYAvmieiGqRLrSLTG8Ei+jDAlaYn5jzjEhfbvsdJTCw8f1OCPmF2/Lpqe/uFgsjI5eBXmimU2dVnuuJM0tAMH0M5mFVGZcVc2UzU+WOiwsvVA2JATMYIwNmxxcWbwzzESAYR3TXOfe1P9n8wSZ0+ADOaD5+4FlhKVcW84AK57DinBygcXDanKQbkzEsqrPzvMPcahUF5OSPU67VNRmZxlUZXbV6a6QGexWjbPfcU9UGxlLEIdssaT8w6AvKVzDu3Xqf6HYyxS38rR5SDzZCllhzMTzWkQnygR3OnkevSfYVQQSJA0xPrA== 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=jQr5NbNk/LsGXPtDi59H3/Vtk1SC+nBMV+Y5YtBMVTo=; b=S2u5aL+6ddDqU33BeXbGx+uFPhBonH0LPJv21LudYVehVh+b4jfF3QL+9TkYoenVVImWfGrU4seDd13IQ+0iEG9l2S1CDYAruFETWQB5LlYG84xbm10fxPOWHSNdoJt4vMk+w4Gg+dL7vB7VGNAklQJB97UKRvvdGE628R0s9QaUBmi7EgtBmUczGkBQQoW2L7KUSVsd9MrFv4Y3Nxl2KEs3LGH9XFnAvKoMM8qA/xlOvoxs+uf67qyZ369UHMF9hOZHBqfeK6jaVM9X1O3OirsrMwFmmdaqX7MUi4jLw4Fdp6Yl6zLfVvwndBFJE6qwJ4JQSIeKQiIAOO8PhjrH3g== From: Volodymyr Babchuk To: "qemu-devel@nongnu.org" CC: Oleksandr Tyshchenko , Volodymyr Babchuk , Peter Maydell , Stefano Stabellini , Anthony Perard , Paul Durrant , "open list:ARM TCG CPUs" , "open list:X86 Xen CPUs" Subject: [PATCH v1 7/7] xen_arm: Add basic virtio-pci support Thread-Topic: [PATCH v1 7/7] xen_arm: Add basic virtio-pci support Thread-Index: AQHaFBZpa05Dc66DRUqpQfiy75awpQ== Date: Fri, 10 Nov 2023 20:42:24 +0000 Message-ID: <20231110204207.2927514-8-volodymyr_babchuk@epam.com> References: <20231110204207.2927514-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231110204207.2927514-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_|DB3PR0302MB8991:EE_ x-ms-office365-filtering-correlation-id: b652af3a-6098-4dfb-1f13-08dbe22d8be5 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: P1MjZH/ndxFdNGjLrLQjyodaCcCWHvZef0JEMD0iq414F9M9++NgC055vSsfzq4tn9yaJtNLsxWvIeLgoXryFIHBnLLMr456fayHsj79XCKeZzqLFrJGSn3yCcxy+2JQthI5/MkfNKfGHbIJFXxUzHta+RKb/tyE31RwaKu8zSIufwuuOXjhcmVZTOty6wx2suZHOwa6Av8VW8C+7CSuXu5hN3fENmyrhawagflAa5nVSZT/V2uQ4CMzgm5BUc7HfvzKxanSjLCFi8U/xGd+fSjaNV0Dnt+0CIDaZyk1SQOALxNN97Bb0u95yh2p8L33ThPSlYyU1TTRMro4Zpat3fh1X6cx1i0YkT14jsCgmfflFF7Qfi+pIAHLAIMMG0h2AvAvT8xqdPmkllcwnwqK9X/Mwf0Ae5jgqtZwpDpk+Kzqo0rt/IpLe+/msY4LJbx/x/GuX/9Z9YboWKVuUXCM6ODubBHSYR/ahGBSTd40RVQddx3k6KBn3zInqyh5JLrumeq9BlqxcIJzxKwYdTR//Fq6Dze431Mg/uvde2Es2jtSiYu60UiIY0NqutGgvDfITVkioF+AUyzCOajGdbci6evmbFezkkSmbF7fgCoeTR2CFdKuELoqO4iMjtMjlmN8 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)(136003)(376002)(346002)(39860400002)(396003)(366004)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(41300700001)(2906002)(8936002)(4326008)(86362001)(5660300002)(38070700009)(8676002)(316002)(36756003)(83380400001)(38100700002)(478600001)(2616005)(1076003)(6512007)(6486002)(71200400001)(122000001)(6506007)(55236004)(91956017)(76116006)(66556008)(66446008)(26005)(6916009)(64756008)(66476007)(66946007)(54906003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?hZ8QAbO3H9AAWFxvJi4+qIf?= =?iso-8859-1?q?oTqamDgikWUCihisG4Ag6mkRkHL6HCruAvOW+hqc0Y4xs8gFl5/PY4vJ7mrn?= =?iso-8859-1?q?KlI0imy4RNOdVTs30Aa8NxtbtgyS69wPqaU8OM2FxrEEWLoMkZS6RX6m7EkF?= =?iso-8859-1?q?eUqYPr/n1qu00qW0FndUAzLXv3Hv4o4/OaJu7V0bqsuYv/Y925QIFc+ZZVR3?= =?iso-8859-1?q?/JCDVO+7Zt1V8WA8k3Hqlw34iHrJOTkBXPtUTpONSXvP0An4i+xws45jx/Hi?= =?iso-8859-1?q?EqEhPpSOU2MGwRvBw6/b3S6ueCEuNAcxgSatpZ9jVUadWBr5EA+V9ReFDOKe?= =?iso-8859-1?q?C7Kz1FJhKsvQvDuVpSiOBBH4RRXce6JvA1MEtqrx6VApnCdv8IEhJ+gXGnyP?= =?iso-8859-1?q?IL+BZ84fKj6Uq57TdqmnjHhVa6qzHMV+huoPBTMNErAx1cO+A/cnJjndcblH?= =?iso-8859-1?q?gXyjTkXVxlNDCZjnpPcV8Wglj0+gIT6FxpwjgEG9VaWBjeuQKkSCn5U3Vcri?= =?iso-8859-1?q?jGWw7yJMHBZnszmzg7NM5fbw7wLFYYWkjXhd/A/l2PzNp2AfTYxzEPRkIk4M?= =?iso-8859-1?q?07Z5RGOTRRgYJItKMVuybZiIdJunqgI5VNk2PhpRvI9FjuYO6vL6VmTM5Ceq?= =?iso-8859-1?q?NkhNOOAD24RxLJsXRCtsj6MBbIW5y0VXSYdsjrEsNQVo49tXyli1vtZofAIk?= =?iso-8859-1?q?KbwuNpw/7zQ3ydsEru2UQd7AEg/Y4shbjrI6PjkFmYpY7g4N3uB4tTga7HgR?= =?iso-8859-1?q?Yk3W6frN2Tpri1V8sLUHaSUj/c1zrm8JeaTuhgc230SqA6eCHflSOs5v9Wpz?= =?iso-8859-1?q?Z0EoIAjxK2sFqsi7QjURDY1I2e20NA0xwYjN/0R75JYXkN1j318BDn+ab2Ip?= =?iso-8859-1?q?jZ8eCOxRQKM8cyP4fO/me85exuWQ+CKQHo0BDeEJR/AM8plbKrblQ8NBdq9c?= =?iso-8859-1?q?tAPsOvac2Fj37wn5TnuL4Atp4uoxxSJebzU9wXYh/kFFepc8lCzE1A7yRu3k?= =?iso-8859-1?q?K8Yf5qKA2uINH9sEQUiIVeSMxmXjm5iQRAZo0vlW015BPPzgGl4521rhq0Uc?= =?iso-8859-1?q?tmDFjgL6rC60SXPcpMo8Pf0vwWqlPVStGwSgPJ03jv1RKNYqoR8jOOBZBIGE?= =?iso-8859-1?q?FPIdu2GGXlHSvfSc82jboOU+iGZtLOQQYQq0oFNmdGtVJthfnsrukV0XWY3K?= =?iso-8859-1?q?asHz2Sf/hwjWfuseS+tL2TErANF2Gil71F7IG2b/T9V2bkzGDfG9I4tcD7V2?= =?iso-8859-1?q?uF7GjdNMIdP5Rq93r9UeswhWFTqQJARANxgflqTFPPHnQ+GNcXfR6x0/zsFD?= =?iso-8859-1?q?8fr37sbOLeIeQ8zGaqKPz1CCA4phMoXn5JaldGuinvgAH8l7ppZhFK7XIQl9?= =?iso-8859-1?q?wPYwEjIsxFTXX2zH5qLfFdUt1B+ycbj4f/w/q81AE5dFUqElaNzagz/n5HgK?= =?iso-8859-1?q?K/Ls3mAr0FJxEcXQB6NioK4vFVrlCwsfcovxjLDoiP9H8PQnT25ZYTn9XnDB?= =?iso-8859-1?q?e0NtlzqRha65HwTKMnJ0KBUgpIzGYhsk7NNDSRzIaRhutrx35o/cXnYch4qM?= =?iso-8859-1?q?PrSupuQRvdmJv8IFh3+UA93lw2O7eQo49eEp04qOlIura9KPEKQAU3zXjWug?= =?iso-8859-1?q?kOUfLtNul1p2NCIId6jgFzpVA24QshFfGrELthA=3D=3D?= 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: b652af3a-6098-4dfb-1f13-08dbe22d8be5 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2023 20:42:24.6686 (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: gxMo61Dihk/IxNaBZ/nZDzUwECoAne/6QWKbp9wyEubTH5ytiEI0Dz3UOdOJCX24rVm+4j2lbB3WEPSh7If4IWYfyuk8PpFLKpEAJhZ/VJw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0302MB8991 X-Proofpoint-ORIG-GUID: LhxBLxz5CcYwugUNNU8YpKjHme2Csnma X-Proofpoint-GUID: LhxBLxz5CcYwugUNNU8YpKjHme2Csnma X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-10_18,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 mlxlogscore=908 malwarescore=0 suspectscore=0 clxscore=1011 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311100172 From: Oleksandr Tyshchenko This patch adds basic virtio-pci support for xen_arm machine. It provides a flexible way to configure virtio-pci resources with xenstore. 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 --- hw/arm/xen_arm.c | 186 ++++++++++++++++++++++++++++++++++++ hw/xen/xen-hvm-common.c | 9 +- include/hw/xen/xen_native.h | 8 +- 3 files changed, 200 insertions(+), 3 deletions(-) diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c index a2b41dc2de..4a0a6726a8 100644 --- a/hw/arm/xen_arm.c +++ b/hw/arm/xen_arm.c @@ -22,6 +22,7 @@ */ #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "qemu/error-report.h" #include "qapi/qapi-commands-migration.h" #include "qapi/visitor.h" @@ -34,6 +35,9 @@ #include "hw/xen/xen-hvm-common.h" #include "sysemu/tpm.h" #include "hw/xen/arch_hvm.h" +#include "exec/address-spaces.h" +#include "hw/pci-host/gpex.h" +#include "hw/virtio/virtio-pci.h" #define TYPE_XEN_ARM MACHINE_TYPE_NAME("xenpvh") OBJECT_DECLARE_SIMPLE_TYPE(XenArmState, XEN_ARM) @@ -58,6 +62,11 @@ struct XenArmState { struct { uint64_t tpm_base_addr; } cfg; + + MemMapEntry pcie_mmio; + MemMapEntry pcie_ecam; + MemMapEntry pcie_mmio_high; + int pcie_irq; }; static MemoryRegion ram_lo, ram_hi; @@ -73,6 +82,7 @@ static MemoryRegion ram_lo, ram_hi; #define NR_VIRTIO_MMIO_DEVICES \ (GUEST_VIRTIO_MMIO_SPI_LAST - GUEST_VIRTIO_MMIO_SPI_FIRST) +/* TODO It should be xendevicemodel_set_pci_intx_level() for PCI interrupts. */ static void xen_set_irq(void *opaque, int irq, int level) { xendevicemodel_set_irq_level(xen_dmod, xen_domid, irq, level); @@ -127,6 +137,176 @@ static void xen_init_ram(MachineState *machine) } } +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 = qdev_new(TYPE_GPEX_HOST); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + + /* Map ECAM space */ + ecam_alias = g_new0(MemoryRegion, 1); + ecam_reg = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); + memory_region_init_alias(ecam_alias, OBJECT(dev), "pcie-ecam", + ecam_reg, 0, xam->pcie_ecam.size); + memory_region_add_subregion(get_system_memory(), xam->pcie_ecam.base, + ecam_alias); + + /* Map the MMIO space */ + mmio_alias = g_new0(MemoryRegion, 1); + mmio_reg = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 1); + memory_region_init_alias(mmio_alias, OBJECT(dev), "pcie-mmio", + mmio_reg, + xam->pcie_mmio.base, + xam->pcie_mmio.size); + memory_region_add_subregion(get_system_memory(), xam->pcie_mmio.base, + mmio_alias); + + /* Map the MMIO_HIGH space */ + mmio_alias_high = g_new0(MemoryRegion, 1); + memory_region_init_alias(mmio_alias_high, OBJECT(dev), "pcie-mmio-high", + mmio_reg, + xam->pcie_mmio_high.base, + xam->pcie_mmio_high.size); + memory_region_add_subregion(get_system_memory(), xam->pcie_mmio_high.base, + mmio_alias_high); + + /* Legacy PCI interrupts (#INTA - #INTD) */ + for (i = 0; i < GPEX_NUM_IRQS; i++) { + qemu_irq irq = qemu_allocate_irq(xen_set_irq, NULL, + xam->pcie_irq + i); + + sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, irq); + gpex_set_irq_num(GPEX_HOST(dev), i, xam->pcie_irq + i); + } + + DPRINTF("Created PCIe host bridge\n"); +} + +static bool xen_read_pcie_prop(XenArmState *xam, unsigned int xen_domid, + const char *prop_name, unsigned long *data) +{ + char path[128], *value = NULL; + unsigned int len; + bool ret = true; + + snprintf(path, sizeof(path), "device-model/%d/virtio_pci_host/%s", + xen_domid, prop_name); + value = xs_read(xam->state->xenstore, XBT_NULL, path, &len); + + if (qemu_strtou64(value, NULL, 16, data)) { + error_report("xenpv: Failed to get 'virtio_pci_host/%s' prop", + prop_name); + ret = false; + } + + free(value); + + return ret; +} + +static int xen_get_pcie_params(XenArmState *xam) +{ + char path[128], *value = NULL, **entries = NULL; + unsigned int len, tmp; + int rc = -1; + + snprintf(path, sizeof(path), "device-model/%d/virtio_pci_host", + xen_domid); + entries = xs_directory(xam->state->xenstore, XBT_NULL, path, &len); + if (entries == NULL) { + error_report("xenpv: 'virtio_pci_host' dir is not present"); + return -1; + } + free(entries); + if (len != 9) { + error_report("xenpv: Unexpected number of entries in 'virtio_pci_host' dir"); + goto out; + } + + snprintf(path, sizeof(path), "device-model/%d/virtio_pci_host/id", + xen_domid); + value = xs_read(xam->state->xenstore, XBT_NULL, path, &len); + if (qemu_strtoui(value, NULL, 10, &tmp)) { + error_report("xenpv: Failed to get 'virtio_pci_host/id' prop"); + goto out; + } + free(value); + value = NULL; + if (tmp > 0xffff) { + error_report("xenpv: Wrong 'virtio_pci_host/id' value %u", tmp); + goto out; + } + xen_pci_segment = tmp; + + if (!xen_read_pcie_prop(xam, xen_domid, "ecam_base", + &xam->pcie_ecam.base)) { + goto out; + } + + if (!xen_read_pcie_prop(xam, xen_domid, "ecam_size", + &xam->pcie_ecam.size)) { + goto out; + } + + if (!xen_read_pcie_prop(xam, xen_domid, "mem_base", + &xam->pcie_mmio.base)) { + goto out; + } + + if (!xen_read_pcie_prop(xam, xen_domid, "mem_size", + &xam->pcie_mmio.base)) { + goto out; + } + + if (!xen_read_pcie_prop(xam, xen_domid, "prefetch_mem_base", + &xam->pcie_mmio_high.base)) { + goto out; + } + + if (!xen_read_pcie_prop(xam, xen_domid, "prefetch_mem_size", + &xam->pcie_mmio_high.size)) { + goto out; + } + + snprintf(path, sizeof(path), "device-model/%d/virtio_pci_host/irq_first", + xen_domid); + value = xs_read(xam->state->xenstore, XBT_NULL, path, &len); + if (qemu_strtoi(value, NULL, 10, &xam->pcie_irq)) { + error_report("xenpv: Failed to get 'virtio_pci_host/irq_first' prop"); + goto out; + } + free(value); + value = NULL; + DPRINTF("PCIe host bridge: irq_first %u\n", xam->pcie_irq); + + snprintf(path, sizeof(path), "device-model/%d/virtio_pci_host/num_irqs", + xen_domid); + value = xs_read(xam->state->xenstore, XBT_NULL, path, &len); + if (qemu_strtoui(value, NULL, 10, &tmp)) { + error_report("xenpv: Failed to get 'virtio_pci_host/num_irqs' prop"); + goto out; + } + free(value); + value = NULL; + if (tmp != GPEX_NUM_IRQS) { + error_report("xenpv: Wrong 'virtio_pci_host/num_irqs' value %u", tmp); + goto out; + } + DPRINTF("PCIe host bridge: num_irqs %u\n", tmp); + + rc = 0; +out: + if (value) { + free(value); + } + + return rc; +} + void arch_handle_ioreq(XenIOState *state, ioreq_t *req) { hw_error("Invalid ioreq type 0x%x\n", req->type); @@ -187,6 +367,12 @@ static void xen_arm_init(MachineState *machine) xen_register_ioreq(xam->state, machine->smp.cpus, &xen_memory_listener); xen_create_virtio_mmio_devices(xam); + if (!xen_get_pcie_params(xam)) { + xen_create_pcie(xam); + } else { + DPRINTF("PCIe host bridge is not available," + "only virtio-mmio can be used\n"); + } #ifdef CONFIG_TPM if (xam->cfg.tpm_base_addr) { diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index b7255977a5..b1eb2972d5 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); } +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) } QLIST_FOREACH(xendev, &state->dev_list, entry) { - if (xendev->sbdf != 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)) != sbdf) { continue; } diff --git a/include/hw/xen/xen_native.h b/include/hw/xen/xen_native.h index 5d2718261f..a8fac902f1 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_addr); } +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, 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, trace_xen_unmap_pcidev(ioservid, pci_dev_bus_num(pci_dev), PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn)); - 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));