From nobody Thu May 2 02:55:14 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=oracle.com); dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1660221575; cv=pass; d=zohomail.com; s=zohoarc; b=IWntNT4hRdzdA3t+KI72IrCBnLdAsVPpWRib9mXOsAKGHXJMxxaA74r9lupPkRZATGNhlY0aSTlfOIrcUDn/iODPDRhWGdwxa7JSWm4IPIeA+ds5m0xUk5yBPHG1KnJicYQzik3tIRFBEB//DJQYZBlLXJJo729B5uOiYCwnqhM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660221575; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZdXVhQSGRp/vUezjkr6a9HUNBsRXizw2zvjD5p+51h0=; b=XSfCXnkiNX5+GlpdsP8jAfLt3Wf5yCaCHPuM8NGQQV/oW8tgNGzDOakuRjkpJsRqkgTz3e5q4b04m2XH3HGqdoiy5kt3DJUwjgQFMGbhlK0ydK+Db661UNwk5fkfM+i8zEy/216gozpn3XKTgDRse0zwuwUWXilcuqxk34EoJuU= 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=oracle.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660221575471640.28999051989; Thu, 11 Aug 2022 05:39:35 -0700 (PDT) Received: from localhost ([::1]:58036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oM7TI-0007uJ-AC for importer@patchew.org; Thu, 11 Aug 2022 08:39:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM7H0-00026v-JM; Thu, 11 Aug 2022 08:26:50 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:29208) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM7Gw-0002Vl-5G; Thu, 11 Aug 2022 08:26:50 -0400 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27BCMrqo025143; Thu, 11 Aug 2022 12:26:26 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3huwqdvjtg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Aug 2022 12:26:26 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 27B9BWN7040716; Thu, 11 Aug 2022 12:26:25 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2045.outbound.protection.outlook.com [104.47.73.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3huwqgt90q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Aug 2022 12:26:25 +0000 Received: from PH0PR10MB4664.namprd10.prod.outlook.com (2603:10b6:510:41::11) by PH0PR10MB5846.namprd10.prod.outlook.com (2603:10b6:510:14c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.10; Thu, 11 Aug 2022 12:26:23 +0000 Received: from PH0PR10MB4664.namprd10.prod.outlook.com ([fe80::a9e2:3c71:4b09:789]) by PH0PR10MB4664.namprd10.prod.outlook.com ([fe80::a9e2:3c71:4b09:789%9]) with mapi id 15.20.5525.011; Thu, 11 Aug 2022 12:26:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2022-7-12; bh=ZdXVhQSGRp/vUezjkr6a9HUNBsRXizw2zvjD5p+51h0=; b=NJczu8FFFpg0NYRAdn/xPTONAu8kSrXELQyHevw2VilXLTSoUIigk5nKD4wowlry/THF ExF8aiFFtyFyaHP6m7K/2FBPxDFdMkXqsNvuL/iGwpfU6Kz1YidfSQdFFKPZMyATgqJj u/mGAB1/nIZOPY44RkcZTUVvCOW9lcLZMyTgU4/4Z7BjESAWGHfPrLJ/YGGE5O185cmv FrP1XZh81afDNaHZAJJPc/nUeADfK2zOunzoF98gZ7iSHetEvxLUKyvFOVKbFI7o2z6H afYfUg+b7wAucIw7dVof4ZxHvMlTIcFDYF7Ua6UxIkl79I8AyIbNdWo0fcrKihYiaofC Og== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EX95NP7G63Hql7hfMVS9mdm5GcyVMHnzcRhugsBXRWJd6u4sKOu8N5PjHmBXrYnHIOkuMSKc64zgS2HfBfVNtiMgCeFtWSIrARdtyapk9VwULd+/YRCsaV/DXE/a1osnM420VrsglMAQYd2tjKyXTBoQZvctIihNwpdEBXNgVAAe1FM3/XI8oTy3DGdhfKqsHLIFm24HPub1XIZdzSZn6UX3vkRUqQNcex0rjojZNji8ToM7Rwq8vay6cfw+IBesFXAmO1V+QmEjl2Dc4fRsV4FfjGkqYyjnYi3nWTir5sRUnjv2DljGIYQxoBzeAspry+jqhJG+J5e5tQcJNKpFDg== 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=ZdXVhQSGRp/vUezjkr6a9HUNBsRXizw2zvjD5p+51h0=; b=QmRsgTwmqrg9eSP9xv0astTQAS32i6JB7c7I0CXQX7W4FaKuROkNmVWd1ABy2F3PF1ihcRPL4Afh88fcGz+6shwrn/dkeGbGhEirNH+wMBEH4BNwCvUEI0Gq+fbROWq18k3v381VBUXN5lZcPPPE4PAowodo9QWFhi+NwVpCmHMSAoUzMv+dXciFqRH8H66eRl2LYlf460urGU54g8iq9yp6JOC4zileBSwlAQzseoBwHUB/TpoGlmkj8Pu0KW4BQ/iNMmCpoDu/aA3EZXUkiDOoKmaS0Vu4AtiNL4HEq5bvNI1OPOHkFCixstHVa7WTEZRFKfB2oxMm2QCLL0Chmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZdXVhQSGRp/vUezjkr6a9HUNBsRXizw2zvjD5p+51h0=; b=yDv4r3Y7jSGHdUe3ym7NJLFLywGyIDTMezS4aVscWT9D7+4iC3BpWsY5qIE5YwhwO8AGXVnHGDo2T8a6G+BbHzV/3frCUsKK3OnD2sl9L8StkmNp1n6RS6HF7d88KlJfyTKBl2uED7CAsskgwTl0cM+XH1nRAVvZmXDwqzGc2vk= From: Jonah Palmer To: qemu-devel@nongnu.org Cc: mst@redhat.com, qemu_oss@crudebyte.com, kraxel@redhat.com, si-wei.liu@oracle.com, joao.m.martins@oracle.com, eblake@redhat.com, qemu-block@nongnu.org, david@redhat.com, armbru@redhat.com, arei.gonglei@huawei.com, marcandre.lureau@redhat.com, lvivier@redhat.com, thuth@redhat.com, michael.roth@amd.com, groug@kaod.org, dgilbert@redhat.com, eric.auger@redhat.com, stefanha@redhat.com, boris.ostrovsky@oracle.com, kwolf@redhat.com, mathieu.poirier@linaro.org, raphael.norwitz@nutanix.com, pbonzini@redhat.com Subject: [PATCH v15 1/6] qmp: add QMP command x-query-virtio Date: Thu, 11 Aug 2022 08:24:39 -0400 Message-Id: <1660220684-24909-2-git-send-email-jonah.palmer@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1660220684-24909-1-git-send-email-jonah.palmer@oracle.com> References: <1660220684-24909-1-git-send-email-jonah.palmer@oracle.com> X-ClientProxiedBy: DM6PR03CA0077.namprd03.prod.outlook.com (2603:10b6:5:333::10) To PH0PR10MB4664.namprd10.prod.outlook.com (2603:10b6:510:41::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ab66fb49-bfb1-42b4-6ac0-08da7b94b3b7 X-MS-TrafficTypeDiagnostic: PH0PR10MB5846:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iv3otVBLecYAa+CVcDrBblfRkVD//Zn0N91/LUH1zqx1kT0yE+arFoN/kQDDTsWlTRBdvv6CuHS0kMsLfF6WYUkaXNZjjygtZC7n5NJTAH3v60MRVZiQzBv7bQXLv6qNcWC9m6JZvTRlK/9aUGOeimljzG5nNxcMrruIu1m45OKItbki9thp45DQ7Jo+FsxRf/d0EuSjWQGDKNkZLhDsNEBpj+LA8iw8+Id+lw+FH2Df+L/5/YuSONmm4TI13aTFnXu0svrC4Rc4zQJoCfcddtbUBCVtGJXM1H16S3GtVU0GMGEqWnESO5woemA5oKiWsG6pvDQsrTUPfTI3tJLDEgqog5+ADU+Ixe3ohh/zAtD7rIyALIhpEtA47jH+kTme2GCkv3YRnbwtpbBO0UoU6ITJgb2Abdy+dnypIP3ks3yV19iHafsH4PjDZwcPuVjndp4dsCvV9/lhlEurKcJdw/+aHnrmq+dCTyo3Lj4ilKzafWHU0NARZYIqKbp2wUe2ca/iU9B62lxq7hDeMPyDlCdQpqoCAjG4+VruX2FeqEhnUvoM6p0dKS0qg+O3M3z/mkkmcZwBfwoSySPgdV3h5ktMaqFXF/PztCbG4jNqJ5X0AXUZzkfBfGaDJI9FmtVzyCMyQ6hHf2r7sfMLN3cgvV30GC1VdoyHxWGyhn79c/yTZUPD2+MfYp1YU+1XlTGGkpPCpVqJEy9D5Ox+eLDWpQRm8nV/9Mf7CU5eZuNXiLuAKMHMdLmN3ILfuZj0xtSfAtJL5Fj3SA9qvlQ05+n/4Ev6kZu2927lLyCPHvGaEC8= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR10MB4664.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(136003)(346002)(39860400002)(396003)(376002)(38100700002)(316002)(38350700002)(6916009)(66476007)(66556008)(4326008)(8676002)(8936002)(5660300002)(86362001)(66946007)(44832011)(6506007)(6666004)(6512007)(52116002)(26005)(41300700001)(83380400001)(186003)(2616005)(7416002)(478600001)(6486002)(36756003)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?42NgA4oZdm+JSdpsoDJZPSxKSC7LdrYPVKqdxG/jYPTLAwjeelkiEYiLUuqL?= =?us-ascii?Q?61nvmVQ4v6X2BZuyGGgd76yfqHKRK6IudlJFi2wiO2gDYjOQY0WnDNQOGaIf?= =?us-ascii?Q?CdgEJo3Z22qygObW8G9Zy9J42g+8Ph3oZfja1y2AT6cdGwbfFjwd8vv+hITG?= =?us-ascii?Q?P0byRy8BufW74TlLv88w5vuhyPgk83cML6536Utj5eGZH8FqJlP8/hNHGb+C?= =?us-ascii?Q?L5loGxbXF+LSFlOhiWGTJD6XB4G4A/DzGEr+/xuMkyyUSufsm/bbA+NlEFRA?= =?us-ascii?Q?sYKFyeedPOCt5zaH64Q6UlcUnd5e2F8jvpu6bK+WsoBAbHCay+Y+hxhF3Y0Y?= =?us-ascii?Q?tgmLPgvgzVaTjyLYuIoCFAAZTvL4cBClz3bqS6b1FgHoaZyna3OppxgRBZ5y?= =?us-ascii?Q?mdVTKvv9T8zsqbuVDzKBMzERsNA2+2mqa7Sthpy17EsVGy+coN1ej3fd7b3G?= =?us-ascii?Q?xwS81hyKu6qeu2mt1Kndec9esZOsoBGYa3XWMs2ZchlXNY4uzXbo7LmZmX1b?= =?us-ascii?Q?EblH+pL9NS2GHzm4aWYpLqUD5MIxV2MtLE+PAdtj7rIh9R3ZdAgvnnZRVz7c?= =?us-ascii?Q?IVsXi2NOC50h6nfqFM5v7mBcILN6Qwyj9LT3a09Zyk6zDMCa9seF3bu7/+Ri?= =?us-ascii?Q?I+SPo8ftozOMhjErgcA0WtvGGlEiT8Cf4m1MhdDhFGoEIni7VX7IBdR0qqfd?= =?us-ascii?Q?mC9Bkh+ID6sjbjcutX4THQ39JnKMqqaO0MWXFPiZs0Hg0sYVnWywydX6okP+?= =?us-ascii?Q?RgwWHRNdEOIpVPOF3AOLKv7Yiyf9F5dj0gX7ujG4F315UmWsClDfqQeFizTV?= =?us-ascii?Q?0EfH4j2r51eoj52YRVxrJwZYIAnCCgfNPBB5EQlzh8JNij/pvDYqPeT5PVi0?= =?us-ascii?Q?/CZDQTJYuoGj83d0Oh9bWzbap3kmFsz/n9pi9JKJhrMlXHU/0JhpTeJfEq+8?= =?us-ascii?Q?Twp5wYwnwvfTts55lxvscBPvZFFHXQpxjVk7Cax6PCBCgHilrwFCvwvMZP5K?= =?us-ascii?Q?brzuQGZ4PeZ67H9cYlYiDYNEOP8UDwXu54gpm5dqW6vaU2lAYWf7CYutebqW?= =?us-ascii?Q?KArHT087G97AsAsxogJavwmF6Yo/hmOscP5wgRxwAA/ZYbBv3563NF93c40B?= =?us-ascii?Q?A9oMGaVNdmSYLfOg8AK4OStCb5smc3psWZ/70FtUGGGZPUg1s81huO8erU+A?= =?us-ascii?Q?n51YBn+35JmzqPtkMJP1wi+OLgtjM+krHbwdq3B8Xfd/02LQYeNlFL7cPMuq?= =?us-ascii?Q?CvRs+RJ+smPYDDRVUKUJNHU1NsuqirJ3gnFN7J2StJfkKj/ukkh7PzXrrRke?= =?us-ascii?Q?QhCgDpCdeTLHJpmlYHDOnDtW4JrZlqPMAet1vqUs5if6/Vjbo3LDna3LAMeW?= =?us-ascii?Q?aXqISZT9PVLypPBlvckAQ18G32UNQWpJIugo28pelg/pS2T1IF3AcRwpzl6s?= =?us-ascii?Q?3E219ROd9wvb7xnbd4R6+swJROvOiJrVhUWByFJywnqo0gOVp+Sne8r9V8Mm?= =?us-ascii?Q?iZ7/M2hPe+9WEqvF+kFJnodhxugvd50hPUuz232JIuWX6imEYZFw2zHsEJsG?= =?us-ascii?Q?phxUhJo7gEnP1TmNJOlyjcS4qBAkcLmvei8l1GUx?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: =?us-ascii?Q?0q5n7vE1pzkALTBfWssZ8THoSlK2jYLlBKNwXSnhh7qpdN8k5+dj21+pZgi7?= =?us-ascii?Q?kIb7LN3W+xcFBWaX4gjYjw4UB+pWbEuvLXLXW7Fi7o/Ar2EJbI0ckARzoO6n?= =?us-ascii?Q?9Z542TdNICMW0d2621ECW7vth47wXBDE7V9RqMhCSbaI2J3wtqJ3aYDedyuM?= =?us-ascii?Q?tvU1NK0TP7eXRsikO3u4BJBKYCcici+/2ugU8bYdLmaSY2ge9XeizSDDhDi8?= =?us-ascii?Q?ZglKlG+BLgQ1LiKjmsvy7ZSB0vBaimwEwTcVnKCjLx1K9UzC5GbLRFosjAtP?= =?us-ascii?Q?1B5CSrw8BESWlbrbVhBwJReZzQ8DNJTeH/bnmTmdSaVZLiExdhIHl3+Moq9H?= =?us-ascii?Q?eKfPoAjQ7AHKOaRbVaEkm/UM24L9M7SBZrIRgHrgm5kCMuJTRhJ+ohy7UGnU?= =?us-ascii?Q?eww9lRqWbvHJ90TU1Ste/xETfvmHOcKpznbx6KZKpj7zrB9drVD1LpcAVqac?= =?us-ascii?Q?EtKStEXi5yymmm+uQyf9ePy5guacZcTF/aLWt4UIqRDAXb8A4cJQiIvOB1kz?= =?us-ascii?Q?GKKWvl8dH9utvirH35P2t9rkFp07LxSCNGV4PuuIDXYVE/3I2/ilDAadVmUy?= =?us-ascii?Q?OeYO8d8ANdCsOilvndELNG20kfvU3la+P9p+aHaVuPhd029P+/702ICpF2w1?= =?us-ascii?Q?FW14aN6U8KwMaNja2Ts4BtUEeprRNi9gdRgzJkCNIY3WleabQ3lEBT3aq7SK?= =?us-ascii?Q?QBJHmJDYBsUYGc5wrUBHTQ6Rt5dn1lounyqHmJbIOPz7TC4w5eY+2eUrBLz5?= =?us-ascii?Q?kC3oavcYsXV70UrhQG0NXzsBdZJhBMteQkVCOEGaNEiRd3cJov67BwxIsRcq?= =?us-ascii?Q?0BNoMNWcEeG+lN8NPpkqI9DR6deIDbPGkJNN60QK4AM7cOxrcX2/ZNpARBAQ?= =?us-ascii?Q?F260MBZYvhBPio77rjflC5kiIRjtlrGFJXqJ7E+1eGIp84rxAb673tZcQFxx?= =?us-ascii?Q?376fOP/DMGUZh/nhj4IOKJHnn9BHkMpdoB8mI6ZLczWYLvYr9F7ynVmPMmYU?= =?us-ascii?Q?H2mna+ipC/kbkdT54679QP9yPrx9muKivQMSfIFU6KTJnyv2nVP7ACYUJK/K?= =?us-ascii?Q?BiWwIVKPGqTags2M01fRuocgqVM9kUMnzPct4H5eJ5HPCUmY+n7FVAWS7lSU?= =?us-ascii?Q?fkuSbD8tMuYUbjr88OHiXysG52t8FMi8vhyJa6h+p/s+7IcU18/9HSF5fjmw?= =?us-ascii?Q?E0zdp6xK4lAzB3nQ9o0gG0tqIlZyDi8qhOYXwkVKSleon7Ni+cg4hdn/11xz?= =?us-ascii?Q?ZKZcqzdwGG3WrgXWqnoCEvtUcZzLDMY4R5Lktttwv6RS/yMR7cYtE1qkGyJy?= =?us-ascii?Q?hTt8vB1av4+1QZJw1JKmAiYky2CSHW5f4NcqpyROoms+xIJtUxHIvwTZLb31?= =?us-ascii?Q?JJamAOoNK4UazmajQlOLL27vbTh430DtKirOk6T8gnCIgwb6jdPMs+OHpPaB?= =?us-ascii?Q?JCrx+83MuITq/LJj21o4E6zIytFTjSLxl1/G3gzat6lflUs7wGD0VF8AetdJ?= =?us-ascii?Q?cFuVzm1CI1o/cd6J7+px33l/ZKfYSks/wPnO60h5rRTq9SAmEEw5vpUBG8i4?= =?us-ascii?Q?SnBCedZNe+4tpA2LcIK/N98PPYPy9TYdCKixtfzJG1jbPoDhXmSsnnP2Z7sp?= =?us-ascii?Q?cplXv+unSnwhJUWYrVh6/ltSZShXOY3TLDC/qzkkRf5Q1RbDStgK5KDikB6R?= =?us-ascii?Q?hj8od2jCDuEPB9g+vwZFl6LjSh/qv6RZSeKnZYQmJlsRx0Fz6BUbXd97kP48?= =?us-ascii?Q?R7nINlhHn4yX/50Y7eUE0SY2oXdZnrRUq8P1kg72TvzlDom5wcH+VNanRWkx?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-1: QMfKjr4WwiqdxQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab66fb49-bfb1-42b4-6ac0-08da7b94b3b7 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB4664.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2022 12:26:22.8583 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: A7gJmTe9kcAwUVc+/3y0M0IxjtdTgy4qbEd0tP65qO7cHZc9IbrelV3pOaOBSZTCFTjPVIVZThLPCPmYAMNd5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5846 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-11_10,2022-08-11_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208110038 X-Proofpoint-GUID: 0pjNwnwyYuvLVMkdSOTa7zLjGUvVAO55 X-Proofpoint-ORIG-GUID: 0pjNwnwyYuvLVMkdSOTa7zLjGUvVAO55 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=205.220.165.32; envelope-from=jonah.palmer@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1660221577616100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Laurent Vivier This new command lists all the instances of VirtIODevices with their canonical QOM path and name. [Jonah: @virtio_list duplicates information that already exists in the QOM composition tree. However, extracting necessary information from this tree seems to be a bit convoluted. Instead, we still create our own list of realized virtio devices but use @qmp_qom_get with the device's canonical QOM path to confirm that the device exists and is realized. If the device exists but is actually not realized, then we remove it from our list (for synchronicity to the QOM composition tree). Also, the QMP command @x-query-virtio is redundant as @qom-list and @qom-get are sufficient to search '/machine/' for realized virtio devices. However, @x-query-virtio is much more convenient in listing realized virtio devices.] Signed-off-by: Laurent Vivier Signed-off-by: Jonah Palmer --- hw/virtio/meson.build | 2 ++ hw/virtio/virtio-stub.c | 14 ++++++++ hw/virtio/virtio.c | 44 ++++++++++++++++++++++++ include/hw/virtio/virtio.h | 1 + qapi/meson.build | 1 + qapi/qapi-schema.json | 1 + qapi/virtio.json | 68 ++++++++++++++++++++++++++++++++++++++ tests/qtest/qmp-cmd-test.c | 1 + 8 files changed, 132 insertions(+) create mode 100644 hw/virtio/virtio-stub.c create mode 100644 qapi/virtio.json diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index 7e8877fd64..e16f1b22d4 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -60,4 +60,6 @@ virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: vir= tio_pci_ss) specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: virtio_ss) softmmu_ss.add_all(when: 'CONFIG_VIRTIO', if_true: softmmu_virtio_ss) softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c')) +softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('virtio-stub.c')) softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c')) +softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('virtio-stub.c')) diff --git a/hw/virtio/virtio-stub.c b/hw/virtio/virtio-stub.c new file mode 100644 index 0000000000..05a81edc92 --- /dev/null +++ b/hw/virtio/virtio-stub.c @@ -0,0 +1,14 @@ +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-virtio.h" + +static void *qmp_virtio_unsupported(Error **errp) +{ + error_setg(errp, "Virtio is disabled"); + return NULL; +} + +VirtioInfoList *qmp_x_query_virtio(Error **errp) +{ + return qmp_virtio_unsupported(errp); +} diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 5d607aeaa0..bdfa82e9c0 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -13,12 +13,18 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qmp/qdict.h" +#include "qapi/qapi-commands-virtio.h" +#include "qapi/qapi-commands-qom.h" +#include "qapi/qapi-visit-virtio.h" +#include "qapi/qmp/qjson.h" #include "cpu.h" #include "trace.h" #include "qemu/error-report.h" #include "qemu/log.h" #include "qemu/main-loop.h" #include "qemu/module.h" +#include "qom/object_interfaces.h" #include "hw/virtio/virtio.h" #include "migration/qemu-file-types.h" #include "qemu/atomic.h" @@ -29,6 +35,9 @@ #include "sysemu/runstate.h" #include "standard-headers/linux/virtio_ids.h" =20 +/* QAPI list of realized VirtIODevices */ +static QTAILQ_HEAD(, VirtIODevice) virtio_list; + /* * The alignment to use between consumer and producer parts of vring. * x86 pagesize again. This is the default, used by transports like PCI @@ -3698,6 +3707,7 @@ static void virtio_device_realize(DeviceState *dev, E= rror **errp) vdev->listener.commit =3D virtio_memory_listener_commit; vdev->listener.name =3D "virtio"; memory_listener_register(&vdev->listener, vdev->dma_as); + QTAILQ_INSERT_TAIL(&virtio_list, vdev, next); } =20 static void virtio_device_unrealize(DeviceState *dev) @@ -3712,6 +3722,7 @@ static void virtio_device_unrealize(DeviceState *dev) vdc->unrealize(dev); } =20 + QTAILQ_REMOVE(&virtio_list, vdev, next); g_free(vdev->bus_name); vdev->bus_name =3D NULL; } @@ -3885,6 +3896,8 @@ static void virtio_device_class_init(ObjectClass *kla= ss, void *data) vdc->stop_ioeventfd =3D virtio_device_stop_ioeventfd_impl; =20 vdc->legacy_features |=3D VIRTIO_LEGACY_FEATURES; + + QTAILQ_INIT(&virtio_list); } =20 bool virtio_device_ioeventfd_enabled(VirtIODevice *vdev) @@ -3895,6 +3908,37 @@ bool virtio_device_ioeventfd_enabled(VirtIODevice *v= dev) return virtio_bus_ioeventfd_enabled(vbus); } =20 +VirtioInfoList *qmp_x_query_virtio(Error **errp) +{ + VirtioInfoList *list =3D NULL; + VirtioInfoList *node; + VirtIODevice *vdev; + + QTAILQ_FOREACH(vdev, &virtio_list, next) { + DeviceState *dev =3D DEVICE(vdev); + Error *err =3D NULL; + QObject *obj =3D qmp_qom_get(dev->canonical_path, "realized", &err= ); + + if (err =3D=3D NULL) { + GString *is_realized =3D qobject_to_json_pretty(obj, true); + /* virtio device is NOT realized, remove it from list */ + if (!strncmp(is_realized->str, "false", 4)) { + QTAILQ_REMOVE(&virtio_list, vdev, next); + } else { + node =3D g_new0(VirtioInfoList, 1); + node->value =3D g_new(VirtioInfo, 1); + node->value->path =3D g_strdup(dev->canonical_path); + node->value->name =3D g_strdup(vdev->name); + QAPI_LIST_PREPEND(list, node->value); + } + g_string_free(is_realized, true); + } + qobject_unref(obj); + } + + return list; +} + static const TypeInfo virtio_device_info =3D { .name =3D TYPE_VIRTIO_DEVICE, .parent =3D TYPE_DEVICE, diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index db1c0ddf6b..375eb5671b 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -110,6 +110,7 @@ struct VirtIODevice bool use_guest_notifier_mask; AddressSpace *dma_as; QLIST_HEAD(, VirtQueue) *vector_queues; + QTAILQ_ENTRY(VirtIODevice) next; }; =20 struct VirtioDeviceClass { diff --git a/qapi/meson.build b/qapi/meson.build index fd5c93d643..c35ba874d2 100644 --- a/qapi/meson.build +++ b/qapi/meson.build @@ -49,6 +49,7 @@ qapi_all_modules =3D [ 'stats', 'trace', 'transaction', + 'virtio', 'yank', ] if have_system diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json index 92d7ecc52c..f000b90744 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -94,3 +94,4 @@ { 'include': 'acpi.json' } { 'include': 'pci.json' } { 'include': 'stats.json' } +{ 'include': 'virtio.json' } diff --git a/qapi/virtio.json b/qapi/virtio.json new file mode 100644 index 0000000000..03896e423f --- /dev/null +++ b/qapi/virtio.json @@ -0,0 +1,68 @@ +# -*- Mode: Python -*- +# vim: filetype=3Dpython +# + +## +# =3D Virtio devices +## + +## +# @VirtioInfo: +# +# Basic information about a given VirtIODevice +# +# @path: The VirtIODevice's canonical QOM path +# +# @name: Name of the VirtIODevice +# +# Since: 7.1 +# +## +{ 'struct': 'VirtioInfo', + 'data': { 'path': 'str', + 'name': 'str' } } + +## +# @x-query-virtio: +# +# Returns a list of all realized VirtIODevices +# +# Features: +# @unstable: This command is meant for debugging. +# +# Returns: List of gathered VirtIODevices +# +# Since: 7.1 +# +# Example: +# +# -> { "execute": "x-query-virtio" } +# <- { "return": [ +# { +# "name": "virtio-input", +# "path": "/machine/peripheral-anon/device[4]/virtio-backend" +# }, +# { +# "name": "virtio-crypto", +# "path": "/machine/peripheral/crypto0/virtio-backend" +# }, +# { +# "name": "virtio-scsi", +# "path": "/machine/peripheral-anon/device[2]/virtio-backend" +# }, +# { +# "name": "virtio-net", +# "path": "/machine/peripheral-anon/device[1]/virtio-backend" +# }, +# { +# "name": "virtio-serial", +# "path": "/machine/peripheral-anon/device[0]/virtio-backend" +# } +# ] +# } +# +## + +{ 'command': 'x-query-virtio', + 'returns': [ 'VirtioInfo' ], + 'features': [ 'unstable' ] } diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c index af00712458..897e4e937b 100644 --- a/tests/qtest/qmp-cmd-test.c +++ b/tests/qtest/qmp-cmd-test.c @@ -103,6 +103,7 @@ static bool query_is_ignored(const char *cmd) "query-gic-capabilities", /* arm */ /* Success depends on target-specific build configuration: */ "query-pci", /* CONFIG_PCI */ + "x-query-virtio", /* CONFIG_VIRTIO */ /* Success depends on launching SEV guest */ "query-sev-launch-measure", /* Success depends on Host or Hypervisor SEV support */ --=20 2.31.1 From nobody Thu May 2 02:55:14 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=oracle.com); dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1660222360; cv=pass; d=zohomail.com; s=zohoarc; b=Kzi/90jid79XQfz9IaEBvZ/Kf/loVPs4GZK1yBhtQvyy3Rwy4e+oNyqPiFj57dumeJfWA3UV0jESwquwxJFWyStsYTV9FRkHDS5eJMpNDKzCbg9SujaU5OmjVNNC5849fO02V8tnWcgDzvxL1LdWNgByrRQxiTQ2Sn9Zq2sxdM0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660222360; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ltmkdgwklAJjdo/AcRs6lKIt0h6tLjJw0RRzBD/K5NU=; b=lYcdNE5kubakQ19xS643kPqStYxag8IXmbmqA739aYJVXrty+LygBeGCtTWMmB9R2hEfjGchEoK2XE/jjyk5ojoZc+Eh0Leg/jxUhPyUBjwK5HaAX1Ei1LyonW4iVjPr3udfwJYa6EDebo80yuFT7BKG/S51g6hN5p8VbQuK5xs= 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=oracle.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660222360782837.0445849770927; Thu, 11 Aug 2022 05:52:40 -0700 (PDT) Received: from localhost ([::1]:51982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oM7fw-0008E1-Og for importer@patchew.org; Thu, 11 Aug 2022 08:52:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM7H2-0002Cn-FF; Thu, 11 Aug 2022 08:26:52 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:41936) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM7Gz-0002WV-Gw; Thu, 11 Aug 2022 08:26:52 -0400 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27BCNBxF009377; Thu, 11 Aug 2022 12:26:34 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3huwqgmecr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Aug 2022 12:26:34 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 27B9KXjx004979; Thu, 11 Aug 2022 12:26:32 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3huwqjk2kf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Aug 2022 12:26:32 +0000 Received: from PH0PR10MB4664.namprd10.prod.outlook.com (2603:10b6:510:41::11) by DM5PR10MB1770.namprd10.prod.outlook.com (2603:10b6:4:c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.15; Thu, 11 Aug 2022 12:26:30 +0000 Received: from PH0PR10MB4664.namprd10.prod.outlook.com ([fe80::a9e2:3c71:4b09:789]) by PH0PR10MB4664.namprd10.prod.outlook.com ([fe80::a9e2:3c71:4b09:789%9]) with mapi id 15.20.5525.011; Thu, 11 Aug 2022 12:26:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2022-7-12; bh=ltmkdgwklAJjdo/AcRs6lKIt0h6tLjJw0RRzBD/K5NU=; b=r2Lpc8/MzAFIIifIohHjqcMSzH2HeNzxELnwdscXjUg2lNQvtQrkEY9SFKLgvEKV9MgR +hV/5fNbpe1DootzxfoVN798soRLMwV9kZOzaeAZcOPpLZ4o4JsklI6i2+4RQa84lU0W EDgCYLls1ElNlA68ZNjOG4WYk+lfTmGnD5B/BcGPkVxdCQg422gg3k/VHetjadBmD3dY B/dHfHzUl4YU7bcx57aaJoHVgDtSznex76utPLm050GB1lDZt4z2oKPNXkgGZ9LHm0f6 CvKWbsfN5RXe3ocTtLt2c4CBycAUEvDbJKmzoLH/Qse4B06eyrI23pJUjVR+rr7FgtLr mw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QrNYbXtnfZbQ4PUEuQdXI/+UPlpzrT7swBOCXb+qBYECCnF2uuVTdmimucHcnZCLssucIlhA+XLPodYtOhjuKEpji5LZrQ0DV2N+QuI2bJWD42eSfbM6rOloMje0iuJSdlpDthGVLcWx/QdEF1hL7LhagkdAdAccul4yHBP8K31olPKnjbmLiI1a1q+FC9vzbIsOtvetXNhfcrbW8GZ/iSKjqgC/UEd9xppQLyEg+N5xpN6UovKh9kd8uZlEYFQR8IlrAOjThAc/RVy6OZQ6srRY279LhTdrO684h/1EgvdgmyuewDg/odKocIUN20CXE+4EXxhPBdvfguJDhwHRPA== 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=ltmkdgwklAJjdo/AcRs6lKIt0h6tLjJw0RRzBD/K5NU=; b=MEJ4kt/rJlkXXXiTZcuozQ86uELoPhH48Cw50jxkjbX6Qy+NpEwG7bDgE2nyfk0vHY7zwwgiinW7QGxSEO0LTtN/9G5PoJQiH7MKSqK9/5cC62hyEQvb6p4eR1Xvc7z9Fsoj+q9cv1IsEGNcU5dlBaSCOYTCNuoSpRtw1la+fUD08Xz3bavNj/+jTcCIG7Xrtr5hIBjHibHr2zt6QpXUnGFsvbH6kvPNJskclh/BcQtAaQ926v0Lg6jaRCTABRHrsNuo4MzsOVsYLnOtrzcCqGrPK8wHW+iQirhiOXoGPU4emCrUMLI84cO9SXj8qTu7KJu/w2qImHSsRLvNzIe5Yw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ltmkdgwklAJjdo/AcRs6lKIt0h6tLjJw0RRzBD/K5NU=; b=k7+tTZbbeq6YgzFYjr9ez+5nTUdkjP1/gxkYJgymMRhooRAf1W0/s1Cua5OQnbBLBBMXna2Re0hFxCXIxIbIlqQFpaHcPy0UNDd8l+QeEaX9AAUbFLB76HC2D/Z3R8Rc5Jjz4nP9UYTSL4VrkmYvRsEUJ6OhAaQw7gXuAF9V/gg= From: Jonah Palmer To: qemu-devel@nongnu.org Cc: mst@redhat.com, qemu_oss@crudebyte.com, kraxel@redhat.com, si-wei.liu@oracle.com, joao.m.martins@oracle.com, eblake@redhat.com, qemu-block@nongnu.org, david@redhat.com, armbru@redhat.com, arei.gonglei@huawei.com, marcandre.lureau@redhat.com, lvivier@redhat.com, thuth@redhat.com, michael.roth@amd.com, groug@kaod.org, dgilbert@redhat.com, eric.auger@redhat.com, stefanha@redhat.com, boris.ostrovsky@oracle.com, kwolf@redhat.com, mathieu.poirier@linaro.org, raphael.norwitz@nutanix.com, pbonzini@redhat.com Subject: [PATCH v15 2/6] qmp: add QMP command x-query-virtio-status Date: Thu, 11 Aug 2022 08:24:40 -0400 Message-Id: <1660220684-24909-3-git-send-email-jonah.palmer@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1660220684-24909-1-git-send-email-jonah.palmer@oracle.com> References: <1660220684-24909-1-git-send-email-jonah.palmer@oracle.com> X-ClientProxiedBy: DM6PR03CA0077.namprd03.prod.outlook.com (2603:10b6:5:333::10) To PH0PR10MB4664.namprd10.prod.outlook.com (2603:10b6:510:41::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d54d753d-bdaf-4e63-a062-08da7b94b77f X-MS-TrafficTypeDiagnostic: DM5PR10MB1770:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j5fIhjV2Rjju74c8DruwNT9nVmH+8KgBDFLHMQMwEm+HRMNzcjzktsfYtzRGjoWhuzJ2zpXRTBzP5Cb+AvXKxz9TwTK0cCjssqyc7XSVqiLfZ+Gq58QNk09vNeguhc1mFmscDNHYNKh9fzm3YJjsMFbmWHZ4IVqpBY4MvOis+/lDH4idXaG26WwJor5rV9HL0/EqPdLAzTCMv4r7+rlS5GdICumuBrr5DWqxE+LJtDDNF2kZ0+5X8hPoFLFZ6I4PPo+xc2KOEFlMgij79jzCmHJrxxhMQ0xgHIEzrZEWt4AI1MMdFHfSvZJ1Bl6X1ffujnWNhko47XnnQS9Styy3c51w2kxDVFSbJZ3Lzq/+uQ+V/YPonlZHVzC8iawTFh+JtAYZeAvJNUXUH8Z07NOey/6eTfdQlvZIaJYnoG1irHdB8x86WZc3Bm7AnyUJKmqWPN9gDzDIVtxJ5fSsBHKEGgVjVAWCrRMv+gz8PzhlpAft2617le1kYXsrcM3fsc/GmK0tiqiEjq4HSrphhIXq5Ox7GZfJ0WKSmQlQd8+ot9lNgBh8IX+v8z9zcIBfqCfZPsensl5mMW2bFOiEmxuOvQhBkcNnKbkNmmfyQcJkpuX5yU0Y3gdqD2PYn4AHDV5u2ifW5JdOQ3t8RYO1IoweFayvByIqW0u2Owm8nhkMTuGGqtClteELh5osWbkYjhNgFeSpl6Riat5v6fG9o6yceidPfSbY2WXMR8724wp5XJ9W7e8ht9by9o3wG3yyKVi41a9YQuh2Z06GCUVbqo78Fwk0cLuEDf1IBOfrF2hYWaE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR10MB4664.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(376002)(346002)(136003)(366004)(396003)(39860400002)(6916009)(8936002)(2906002)(186003)(7416002)(44832011)(316002)(30864003)(66556008)(8676002)(4326008)(2616005)(66476007)(5660300002)(66946007)(478600001)(38100700002)(6486002)(6666004)(38350700002)(36756003)(41300700001)(26005)(6512007)(86362001)(6506007)(52116002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?dgH0uupqTDUHBCY1CljOIF53LvDgmAo5IB3162Z9fNc3r90X8NhFDWfJo0YB?= =?us-ascii?Q?aliaR4E8yVcDiVYR1H05a7/n2YndQn1hdn1puRNW1+sUamFpjbHTaQ2WBlsC?= =?us-ascii?Q?YApQUbw2VfcoRSVLOixpRMFafXcYwOd4Gunw1eWHXH9BYmOOIkSH1GZHQAjB?= =?us-ascii?Q?/35zG8rxMAd0vpEy+8PK2ia2zaDxpGze26rnBA4zmXqDMJDqmoQTCHXKymAC?= =?us-ascii?Q?KcD0M16z80rrt8bh1czWU/8nFPDtPacZuP80klCscl4MJ4RWWj+UTEp4dA7P?= =?us-ascii?Q?3Mms2JQSzOnh5BsAlnTnez5mqgrDlwNdQZFvhw0qyyu5Yj8y5MPxj4V3NeoG?= =?us-ascii?Q?2Hfa49wlwBdMGd6W2BWURlGKKRD/V77gbTj9n7GKHI5vBOSxdOcv6TVXxjlE?= =?us-ascii?Q?seiTlZChmZwvaYyk9HIfT4zqlb0uqRu8zkSOXVjudpLmR5tgvEVPuY3w9oZT?= =?us-ascii?Q?o94MU0BEcHNG1LT5RFzAy1iVZiaoQB76iUcBzBIgKf8NZ6gGRLa5zaVC/f9T?= =?us-ascii?Q?kTui1xjpsLpnObD/PzD7JA2jCMKzfZ31gd/zpxFqTwiXaQUXaWSFxGsEpdf3?= =?us-ascii?Q?oPnVCXoSd64G2EFGCkcSvR0cDoMsWpbhRfIZ2xmbbrsjudTl5EQXP3105McT?= =?us-ascii?Q?HBOPbtvgSJ0UH7Z4Qx7UXZ/iVjwu5+N+DapVm7bF0b1QpFx4XES3sHcXRjgP?= =?us-ascii?Q?l6rohT6Bw0mOh1EbuKVqf+PplVD6VPrMcC5k8RWZs6Tl09VwkrTFhrlNkMZe?= =?us-ascii?Q?PE6EaDRywYDUSFQGU+ypiY+u/9nxyXDWztL0cRial5f74eBDP+vY5lgUAw2x?= =?us-ascii?Q?OkIGQMwh92eamzC0vgjcprJBy1mpoZcfupsy54kSjEg3OhuSg6/9lmFHa2PT?= =?us-ascii?Q?pMzxRKtS9R2N1nZorFafEFElzZTLvlKFeKqPOU71YO2TywnlnhGVsxMDdhlA?= =?us-ascii?Q?DBbYC/Pc7GqfkAoxE+cq0mln1zsjNyTBIUPpA3GrQVi/yVnc0bNSQpbgZHhR?= =?us-ascii?Q?vIXrBJImJWC8+dcXUq5wWuJEW5XVG3VtjibT1wwLO1K/kQS7urnu/ax0SEH9?= =?us-ascii?Q?HB5kR8pITSVzMrnhSn1X/wji/VNDhf5iTTvCbCdi1IeLbpBXJXYDiY0pzWpq?= =?us-ascii?Q?+fbJxwmXR9Lse+J5sQDPyPFIc6ClBkrUCNcC535eT+lqgUsaRyJ/IxWrEwiV?= =?us-ascii?Q?tpyZwmvA93YIWvksRWM6fb1cZA3lUPQukU2n9P5syUN9YJRz1iRmu6ribEyL?= =?us-ascii?Q?KJAq7TfjgwE6Yl4UwZ0jKNjeeN0pFmXVRQ3+M5RF4Apm5dzU8r4Rff2mdaJZ?= =?us-ascii?Q?Y3pcBRIdqEtt2xYWBncmcXtiZcSp6V+XXh2Rz9d1SmBheFf+c5iGumLAIAST?= =?us-ascii?Q?yeuzj1eiqbsESjRlO0lZEAB7/oMnZ2IJu8um9kC5XroHTJLSW2J0IkSbYaov?= =?us-ascii?Q?dMmI/EH4Y/regIoIDwWUgSp44/R+bW5/3rK3Y5XQCOjrf0JSCh5UwPusxp+H?= =?us-ascii?Q?crvmyehmfKbJhiuL0p4bcK+9mFH6vogxBZOTZnimKi5q+wLddynKPN5PmeDa?= =?us-ascii?Q?PJvGiwqCCpu2qAxpga21hH7ArbSO0J5YJ128WByH?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d54d753d-bdaf-4e63-a062-08da7b94b77f X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB4664.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2022 12:26:29.2348 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7edCI4/t4bRIP1OA5jC0aqFKgEKX18lCAnhI9u8svL3nsnqlaGvu+VT1Io2kmMP6FZ/6/dfZYiKiIXNfG5b+8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR10MB1770 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-11_05,2022-08-11_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 spamscore=0 bulkscore=0 adultscore=0 malwarescore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208110038 X-Proofpoint-GUID: t-L5PNBxpk-6XC2UxAMCexA6w9423EX0 X-Proofpoint-ORIG-GUID: t-L5PNBxpk-6XC2UxAMCexA6w9423EX0 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=205.220.165.32; envelope-from=jonah.palmer@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1660222363837100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Laurent Vivier This new command shows the status of a VirtIODevice, including its corresponding vhost device's status (if active). Next patch will improve output by decoding feature bits, including vhost device's feature bits (backend, protocol, acked, and features). Also will decode status bits of a VirtIODevice. [Jonah: From patch v12; added a check to @virtio_device_find to ensure synchronicity between @virtio_list and the devices in the QOM composition tree.] Signed-off-by: Laurent Vivier Signed-off-by: Jonah Palmer --- hw/virtio/virtio-stub.c | 5 + hw/virtio/virtio.c | 104 +++++++++++++++++++ qapi/virtio.json | 222 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 331 insertions(+) diff --git a/hw/virtio/virtio-stub.c b/hw/virtio/virtio-stub.c index 05a81edc92..0b432e8de7 100644 --- a/hw/virtio/virtio-stub.c +++ b/hw/virtio/virtio-stub.c @@ -12,3 +12,8 @@ VirtioInfoList *qmp_x_query_virtio(Error **errp) { return qmp_virtio_unsupported(errp); } + +VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp) +{ + return qmp_virtio_unsupported(errp); +} diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index bdfa82e9c0..3e0a484660 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -3939,6 +3939,110 @@ VirtioInfoList *qmp_x_query_virtio(Error **errp) return list; } =20 +static VirtIODevice *virtio_device_find(const char *path) +{ + VirtIODevice *vdev; + + QTAILQ_FOREACH(vdev, &virtio_list, next) { + DeviceState *dev =3D DEVICE(vdev); + + if (strcmp(dev->canonical_path, path) !=3D 0) { + continue; + } + + Error *err =3D NULL; + QObject *obj =3D qmp_qom_get(dev->canonical_path, "realized", &err= ); + if (err =3D=3D NULL) { + GString *is_realized =3D qobject_to_json_pretty(obj, true); + /* virtio device is NOT realized, remove it from list */ + if (!strncmp(is_realized->str, "false", 4)) { + g_string_free(is_realized, true); + qobject_unref(obj); + QTAILQ_REMOVE(&virtio_list, vdev, next); + return NULL; + } + g_string_free(is_realized, true); + } else { + /* virtio device doesn't exist in QOM tree */ + QTAILQ_REMOVE(&virtio_list, vdev, next); + qobject_unref(obj); + return NULL; + } + /* device exists in QOM tree & is realized */ + qobject_unref(obj); + return vdev; + } + return NULL; +} + +VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp) +{ + VirtIODevice *vdev; + VirtioStatus *status; + + vdev =3D virtio_device_find(path); + if (vdev =3D=3D NULL) { + error_setg(errp, "Path %s is not a VirtIODevice", path); + return NULL; + } + + status =3D g_new0(VirtioStatus, 1); + status->name =3D g_strdup(vdev->name); + status->device_id =3D vdev->device_id; + status->vhost_started =3D vdev->vhost_started; + status->guest_features =3D vdev->guest_features; + status->host_features =3D vdev->host_features; + status->backend_features =3D vdev->backend_features; + + switch (vdev->device_endian) { + case VIRTIO_DEVICE_ENDIAN_LITTLE: + status->device_endian =3D g_strdup("little"); + break; + case VIRTIO_DEVICE_ENDIAN_BIG: + status->device_endian =3D g_strdup("big"); + break; + default: + status->device_endian =3D g_strdup("unknown"); + break; + } + + status->num_vqs =3D virtio_get_num_queues(vdev); + status->status =3D vdev->status; + status->isr =3D vdev->isr; + status->queue_sel =3D vdev->queue_sel; + status->vm_running =3D vdev->vm_running; + status->broken =3D vdev->broken; + status->disabled =3D vdev->disabled; + status->use_started =3D vdev->use_started; + status->started =3D vdev->started; + status->start_on_kick =3D vdev->start_on_kick; + status->disable_legacy_check =3D vdev->disable_legacy_check; + status->bus_name =3D g_strdup(vdev->bus_name); + status->use_guest_notifier_mask =3D vdev->use_guest_notifier_mask; + status->has_vhost_dev =3D vdev->vhost_started; + + if (vdev->vhost_started) { + VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_GET_CLASS(vdev); + struct vhost_dev *hdev =3D vdc->get_vhost(vdev); + + status->vhost_dev =3D g_new0(VhostStatus, 1); + status->vhost_dev->n_mem_sections =3D hdev->n_mem_sections; + status->vhost_dev->n_tmp_sections =3D hdev->n_tmp_sections; + status->vhost_dev->nvqs =3D hdev->nvqs; + status->vhost_dev->vq_index =3D hdev->vq_index; + status->vhost_dev->features =3D hdev->features; + status->vhost_dev->acked_features =3D hdev->acked_features; + status->vhost_dev->backend_features =3D hdev->backend_features; + status->vhost_dev->protocol_features =3D hdev->protocol_features; + status->vhost_dev->max_queues =3D hdev->max_queues; + status->vhost_dev->backend_cap =3D hdev->backend_cap; + status->vhost_dev->log_enabled =3D hdev->log_enabled; + status->vhost_dev->log_size =3D hdev->log_size; + } + + return status; +} + static const TypeInfo virtio_device_info =3D { .name =3D TYPE_VIRTIO_DEVICE, .parent =3D TYPE_DEVICE, diff --git a/qapi/virtio.json b/qapi/virtio.json index 03896e423f..c86b3bc635 100644 --- a/qapi/virtio.json +++ b/qapi/virtio.json @@ -66,3 +66,225 @@ { 'command': 'x-query-virtio', 'returns': [ 'VirtioInfo' ], 'features': [ 'unstable' ] } + +## +# @VhostStatus: +# +# Information about a vhost device. This information will only be +# displayed if the vhost device is active. +# +# @n-mem-sections: vhost_dev n_mem_sections +# +# @n-tmp-sections: vhost_dev n_tmp_sections +# +# @nvqs: vhost_dev nvqs (number of virtqueues being used) +# +# @vq-index: vhost_dev vq_index +# +# @features: vhost_dev features +# +# @acked-features: vhost_dev acked_features +# +# @backend-features: vhost_dev backend_features +# +# @protocol-features: vhost_dev protocol_features +# +# @max-queues: vhost_dev max_queues +# +# @backend-cap: vhost_dev backend_cap +# +# @log-enabled: vhost_dev log_enabled flag +# +# @log-size: vhost_dev log_size +# +# Since: 7.1 +# +## + +{ 'struct': 'VhostStatus', + 'data': { 'n-mem-sections': 'int', + 'n-tmp-sections': 'int', + 'nvqs': 'uint32', + 'vq-index': 'int', + 'features': 'uint64', + 'acked-features': 'uint64', + 'backend-features': 'uint64', + 'protocol-features': 'uint64', + 'max-queues': 'uint64', + 'backend-cap': 'uint64', + 'log-enabled': 'bool', + 'log-size': 'uint64' } } + +## +# @VirtioStatus: +# +# Full status of the virtio device with most VirtIODevice members. +# Also includes the full status of the corresponding vhost device +# if the vhost device is active. +# +# @name: VirtIODevice name +# +# @device-id: VirtIODevice ID +# +# @vhost-started: VirtIODevice vhost_started flag +# +# @guest-features: VirtIODevice guest_features +# +# @host-features: VirtIODevice host_features +# +# @backend-features: VirtIODevice backend_features +# +# @device-endian: VirtIODevice device_endian +# +# @num-vqs: VirtIODevice virtqueue count. This is the number of active +# virtqueues being used by the VirtIODevice. +# +# @status: VirtIODevice configuration status (VirtioDeviceStatus) +# +# @isr: VirtIODevice ISR +# +# @queue-sel: VirtIODevice queue_sel +# +# @vm-running: VirtIODevice vm_running flag +# +# @broken: VirtIODevice broken flag +# +# @disabled: VirtIODevice disabled flag +# +# @use-started: VirtIODevice use_started flag +# +# @started: VirtIODevice started flag +# +# @start-on-kick: VirtIODevice start_on_kick flag +# +# @disable-legacy-check: VirtIODevice disabled_legacy_check flag +# +# @bus-name: VirtIODevice bus_name +# +# @use-guest-notifier-mask: VirtIODevice use_guest_notifier_mask flag +# +# @vhost-dev: Corresponding vhost device info for a given VirtIODevice. +# Present if the given VirtIODevice has an active vhost +# device. +# +# Since: 7.1 +# +## + +{ 'struct': 'VirtioStatus', + 'data': { 'name': 'str', + 'device-id': 'uint16', + 'vhost-started': 'bool', + 'device-endian': 'str', + 'guest-features': 'uint64', + 'host-features': 'uint64', + 'backend-features': 'uint64', + 'num-vqs': 'int', + 'status': 'uint8', + 'isr': 'uint8', + 'queue-sel': 'uint16', + 'vm-running': 'bool', + 'broken': 'bool', + 'disabled': 'bool', + 'use-started': 'bool', + 'started': 'bool', + 'start-on-kick': 'bool', + 'disable-legacy-check': 'bool', + 'bus-name': 'str', + 'use-guest-notifier-mask': 'bool', + '*vhost-dev': 'VhostStatus' } } + +## +# @x-query-virtio-status: +# +# Poll for a comprehensive status of a given virtio device +# +# @path: Canonical QOM path of the VirtIODevice +# +# Features: +# @unstable: This command is meant for debugging. +# +# Returns: VirtioStatus of the virtio device +# +# Since: 7.1 +# +# Examples: +# +# 1. Poll for the status of virtio-crypto (no vhost-crypto active) +# +# -> { "execute": "x-query-virtio-status", +# "arguments": { "path": "/machine/peripheral/crypto0/virtio-backend"= } +# } +# <- { "return": { +# "device-endian": "little", +# "bus-name": "", +# "disable-legacy-check": false, +# "name": "virtio-crypto", +# "started": true, +# "device-id": 20, +# "backend-features": 0, +# "start-on-kick": false, +# "isr": 1, +# "broken": false, +# "status": 15, +# "num-vqs": 2, +# "guest-features": 5100273664, +# "host-features": 6325010432, +# "use-guest-notifier-mask": true, +# "vm-running": true, +# "queue-sel": 1, +# "disabled": false, +# "vhost-started": false, +# "use-started": true +# } +# } +# +# 2. Poll for the status of virtio-net (vhost-net is active) +# +# -> { "execute": "x-query-virtio-status", +# "arguments": { "path": "/machine/peripheral-anon/device[1]/virtio-b= ackend" } +# } +# <- { "return": { +# "device-endian": "little", +# "bus-name": "", +# "disabled-legacy-check": false, +# "name": "virtio-net", +# "started": true, +# "device-id": 1, +# "vhost-dev": { +# "n-tmp-sections": 4, +# "n-mem-sections": 4, +# "max-queues": 1, +# "backend-cap": 2, +# "log-size": 0, +# "backend-features": 0, +# "nvqs": 2, +# "protocol-features": 0, +# "vq-index": 0, +# "log-enabled": false, +# "acked-features": 5100306432, +# "features": 13908344832 +# }, +# "backend-features": 6337593319, +# "start-on-kick": false, +# "isr": 1, +# "broken": false, +# "status": 15, +# "num-vqs": 3, +# "guest-features": 5111807911, +# "host-features": 6337593319, +# "use-guest-notifier-mask": true, +# "vm-running": true, +# "queue-sel": 2, +# "disabled": false, +# "vhost-started": true, +# "use-started": true +# } +# } +# +## + +{ 'command': 'x-query-virtio-status', + 'data': { 'path': 'str' }, + 'returns': 'VirtioStatus', + 'features': [ 'unstable' ] } --=20 2.31.1 From nobody Thu May 2 02:55:14 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=oracle.com); dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1660223305; cv=pass; d=zohomail.com; s=zohoarc; b=AsWfXsWigVPa+f+OBSvg9ZRs5YPo0rvEASCKSr0ArLigts4ylq5JEb0Zc3cSUCm6e1x+VKWCDnC1dIQMHKoaPn9WhfJOWEtlS3Bq4t4vJu0+/DBuHR7cxUUo9LiflUyb9Vz2Fh2Ti+W1+BmWmil7BUR/9N1Io7XDV5kYLshqAkw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660223305; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Xxsqk/xDQZ+ShBcWAvgEqQr6KEYIDwFDna6YBQa2iF0=; b=mmir5651AgfoBe6rzra6LEKdjUmJRucK0FFVh5iSyNoj10RsLS8dU6q6BDhhBu1Kqx0EuJ310reJVoiZR0CE8eIVzsMpantw+BZhNEefgvzmdkDD2u43bcfTFhmBO3IEcuG7OMTM0YX644wRy+FG+FRAsF/JNO9IhKCtru6Geh8= 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=oracle.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660223305101543.8904265805558; Thu, 11 Aug 2022 06:08:25 -0700 (PDT) Received: from localhost ([::1]:48220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oM7vA-0000hQ-Pg for importer@patchew.org; Thu, 11 Aug 2022 09:08:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM7HF-0002fN-Ro; Thu, 11 Aug 2022 08:27:06 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:63098) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM7HB-0002Xr-Fg; Thu, 11 Aug 2022 08:27:05 -0400 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27BCMwL2007995; Thu, 11 Aug 2022 12:26:41 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3huwqj4fub-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Aug 2022 12:26:41 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 27B9NVFl020666; Thu, 11 Aug 2022 12:26:39 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2173.outbound.protection.outlook.com [104.47.55.173]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3huwqjk06r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Aug 2022 12:26:39 +0000 Received: from PH0PR10MB4664.namprd10.prod.outlook.com (2603:10b6:510:41::11) by DM5PR10MB1770.namprd10.prod.outlook.com (2603:10b6:4:c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.15; Thu, 11 Aug 2022 12:26:36 +0000 Received: from PH0PR10MB4664.namprd10.prod.outlook.com ([fe80::a9e2:3c71:4b09:789]) by PH0PR10MB4664.namprd10.prod.outlook.com ([fe80::a9e2:3c71:4b09:789%9]) with mapi id 15.20.5525.011; Thu, 11 Aug 2022 12:26:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2022-7-12; bh=Xxsqk/xDQZ+ShBcWAvgEqQr6KEYIDwFDna6YBQa2iF0=; b=cxv23WMqE7P/6gbAXkXHUUY3udQPg0bDVOLV0sVQTbOVonld7ySf2sspd0l+OWA2obJl hnNB/aJIRDvpmlwzxrZbfMN6lbK66PTCvhWaNDlhbh2TeaN/sGbIKegWEGsY1m1wWPzb iS3MBz9hQ4DPPuejaZHtOFYW7fzh7uPxPor881FrWjGmBrSgxl31vvY9mv7Xv7zEmM8M YRmVzR68AxXn/HgjM6V5U2CvlOkhuccDF/qgXVf9BZ54bqvB2NWx0qVMZWG/W1FtamXe P7JxOjz8Ah2qgdXDwqD9P582yoI6/owdVc8M1SKapeUEta8CwkxvWYMf76OxjZIctDdf GA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W6jjlXYc5kkpXuUdzVjPL7VWBaTpzfuG50jcuPknAoyQmn4vWTD4q8CVDAUunu4jBOij/xc2/RUPgzQjOqZvULdjXwHqV03AHBSsAQjF1VThLVz3+kcfpzzgPRfmRKfKMw8E6vU3Q9j2J5Tpu10JL1eiO2GA1nNintgod3zQKCg1mTmUOi195lkq+WAiShHgGttPwVqGtN+P6Hy0Ra8WxMf7/LhvcFxzryyTHDYsLdRE70W7XUYqXf3yEVLD0zSEWusG8lFrwb+nx0OSREq/ANuqaM2zQvIrL885KejET/TC9WhUNUBgIg62t6GR4hm0i4XE/XMbvpOJAKKsem4MNg== 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=Xxsqk/xDQZ+ShBcWAvgEqQr6KEYIDwFDna6YBQa2iF0=; b=GeyuzB1JmTGOBUKoDNmrF12iQ2l4OYWXBsSqzldqZeRbYxwLVTkCttAaYcLOppOhGDnVW7UxahagJ9bafNo3YIZCXuhZQvi6Mh8Bs6+4wi1s2ulOFvEjFgX9Eug+930zo3yLM9i+Reyl5siTYleeAVyJfNKk8VYIIuyTy/2N5UobhxctuXnLeqnJQsg0DaPgq+yOv0TDzfb/yiQP7vFA+LxERaYN0OjkUWtGNhp7sJERt26ej5/DKeMod+SUWGMwIeLmZip2PjLvzBLMHwS1hae3RZd3PRXlWGT9EVdh8KWnskiruKPKbuPU+Bp/hS/d12WVQd9ya4axypJaZec4qQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Xxsqk/xDQZ+ShBcWAvgEqQr6KEYIDwFDna6YBQa2iF0=; b=GmtLmjkH70ASDV4Je39NCiVhRc0b/l1ycfvFe8c4NpLGqWXQLs279oTXtPKwfvYh6+6YpGgCHXMAJLW8Om4LRKIyzhwoMSm44Ij26WtzQQ6y6sK0+tXW9CUpqUNI1RBNn18mVa0bmDugK1G7AaE5fx8bCJS3EO9teMHbu+qCHJ0= From: Jonah Palmer To: qemu-devel@nongnu.org Cc: mst@redhat.com, qemu_oss@crudebyte.com, kraxel@redhat.com, si-wei.liu@oracle.com, joao.m.martins@oracle.com, eblake@redhat.com, qemu-block@nongnu.org, david@redhat.com, armbru@redhat.com, arei.gonglei@huawei.com, marcandre.lureau@redhat.com, lvivier@redhat.com, thuth@redhat.com, michael.roth@amd.com, groug@kaod.org, dgilbert@redhat.com, eric.auger@redhat.com, stefanha@redhat.com, boris.ostrovsky@oracle.com, kwolf@redhat.com, mathieu.poirier@linaro.org, raphael.norwitz@nutanix.com, pbonzini@redhat.com Subject: [PATCH v15 3/6] qmp: decode feature & status bits in virtio-status Date: Thu, 11 Aug 2022 08:24:41 -0400 Message-Id: <1660220684-24909-4-git-send-email-jonah.palmer@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1660220684-24909-1-git-send-email-jonah.palmer@oracle.com> References: <1660220684-24909-1-git-send-email-jonah.palmer@oracle.com> X-ClientProxiedBy: DM6PR03CA0077.namprd03.prod.outlook.com (2603:10b6:5:333::10) To PH0PR10MB4664.namprd10.prod.outlook.com (2603:10b6:510:41::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 37071b82-1b49-4c4d-bb12-08da7b94bb4c X-MS-TrafficTypeDiagnostic: DM5PR10MB1770:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Iw3Lmv/7NqqAP+muWpcGAlqxxZCx4ckNgbfXOMz1Zju1OjE9eG+pPmhw4bZniMH6MA3rXJqoX9sj2lTHYxzCFv9rhkGujQ3Npeb+xm5YlD2QeC2iI1LYdFAEorRZtG3suElgSn4+Jo2s2g3UBQMcXThXhSNXDDtsZeCFsbra8FioNeWzlLwawVShYrVZIM3kIlZEjTeB1kp244Es4QaUJn38g2KUj3dOb9MYfjpvjAIUru3Hp6GmiuBLIeH1Jw2Nz9TqLHW0oRQc/5jQRRwgDRCLaHSmAZQ8wzM7GrnvvrZzGoGaqaoiYdbNDo3s+vhXK8K2wan1FWTS5+4jy/OhjOuMIsEGd4v5WAUV+DivtcsoodRbC6G+DarNS7451ZwIUF2wwINz7LgACOozKqNt900Tpez1LoplqwjVI+f18Q+WyIxHLHLj1hkvN3yKPnCDUXQRPaDFMYxW1ZSWokZoFWiuzNs1y0SG+e4gimrDUUlF4l95rPZpklBqHJesF8HkzmVhcHPUkZIa28AmzNPxyZj5C/alozsevr1yrWMkBZ/UHmQGzB1w5iEQtwJiVdobKwgepdvAE/DjHhAx9YQbfoB3LQRhfeZ/nKrwE+ar+INpEWlwDJEWWDhRI+LiMEKGKPcHFe/8XUkT/PH35tVax1Jk7n9BsC+rAc2kFPttyX97uEGGwt1+Brm2uaL5A6q7F/X6SdfNRS40QOxETDL5yAm4GHuKMlOle8s1dmSO8A0xNmhNdMuYjwUAjq29jPgQTZz7tvs9e3jxARaObqQMqugc59l4jlGusj0qfjx+Exc= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR10MB4664.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(376002)(346002)(136003)(366004)(396003)(39860400002)(6916009)(8936002)(2906002)(186003)(7416002)(44832011)(316002)(30864003)(66556008)(8676002)(4326008)(2616005)(66476007)(5660300002)(66946007)(478600001)(38100700002)(6486002)(6666004)(38350700002)(36756003)(41300700001)(26005)(6512007)(86362001)(6506007)(52116002)(83380400001)(579004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?psp83cV0eBRoxNWg37Ob+w7a2J9/7AK4gARvrJa+YZBl2kTk0fGFCTZKKLOE?= =?us-ascii?Q?H16oN9LPGA1f27sYYO5dJeot/BsllSFX0t06TMQNfafgnGMGkp/6io7pVvPt?= =?us-ascii?Q?N7wUTc/8n2YMKKhAgpXAhYLHr177s2l3XawVyVP2d+9c+NSVPIoQJpPqyaXe?= =?us-ascii?Q?RogVSeuHiQho8MiCY2LBJkkNdCDwCzgvj+UnJSdUms/omYO+K0OZTT3DZZdb?= =?us-ascii?Q?sBFIFrU+oPDvL/nP0J9ESBmzYmdreG/wp0jmr2u+js1R+AoxTwBhdCYZECGK?= =?us-ascii?Q?Ma3bwRULHwK98IWaXwUIboWsowvXJwAPVu7GUvWhlk/ffz+1CSajnRW8SBA6?= =?us-ascii?Q?fQ9480AcNdClFq0EgRndfdNGPzZfcVsr7Gy8dbndropYX7GDtNDIJV3TH/aR?= =?us-ascii?Q?l46ReJfTUYWRjukJTSn59+FVBv7I40xa2GZND/7J2i/vHfJQUZW5I73nW4c9?= =?us-ascii?Q?jFmFziguRjKJbYm9CBJRi63v86kC+XV1BurPKp4qko/LQGZ53jXNqEAzLhtc?= =?us-ascii?Q?U6TabZNCpF05OV8xL/NOKfSQS7JSWxw93gGLN144fYYh2i5/hlMu1EaQQqxQ?= =?us-ascii?Q?9XsQ+Vmlsb4+K4lx89juxsYCtOjgRDRHz4Dw6SeKUu8ckjqwdWPzJ8PyqpBG?= =?us-ascii?Q?Efm2z/liL+Q0khxHO45MrDyK7i3SHUFYdq7Ahx4VTRfYwkN5bwndXJ2yYzUX?= =?us-ascii?Q?lnnBDeWTjZZlo0XS434eFlib95y7W5P87/uXEmeMN5U5mJ6NGCPRxR/ETwFp?= =?us-ascii?Q?ln96PBsAjy6CeXWzTxnbL14Injv1+tynbIJ4/A1xuwuWH2RnUCmVDrC9Zsu5?= =?us-ascii?Q?1gdj+v0FXUONH5qlpi25+igIHN1GuLjfpcG314GbeVfMgCmqOB445sGAAAOt?= =?us-ascii?Q?ybm0jQsm8FXiFspB4g5rLA/sKnZZlRzL+HdFElXEOJS6eayYWjICxDmR7CBq?= =?us-ascii?Q?xQskZN7uxwXvdjtrpIJyG66o9viHtnpZ/D4/2HK2tSD2kmZti+FvArkDugIu?= =?us-ascii?Q?Z9NpYkVuMXkAdrQ6BVpLOA3cmjzVY8zm5juXh6UGOQMp90VXP7wyFPpGCnSE?= =?us-ascii?Q?aEjw0DXfE2PJ0/AVH13JBvUJINNugVneHMY4zwCir+AuyrbqCKhFQxeUUqLI?= =?us-ascii?Q?64X9mVE3pnjYBITdwqGuaIEjvf5m21ecLEKenuFrkR68RgnUYkOw+FLCkeeq?= =?us-ascii?Q?JMdQYxrJ0+exhFXBolz7P9T/9mdesdMP05+X8immadomI3XFuYQBihc/L+ct?= =?us-ascii?Q?8MaEbrv+nQc7f7QaUXOBGwb776OG9aUeRIYoC0t3GPJHfjgj2evTwPgCsm46?= =?us-ascii?Q?MVENeUolott25EnbiuVpCf+c82813BlO8zmJ2D1bM2TmDuIpPvJLwpeGZBAw?= =?us-ascii?Q?giMbs8/225t3WXnqXqJ/huWzURrXP4T28P+7qjP/NwhDa4ddiplr5ZSQZbLD?= =?us-ascii?Q?KH/snkW6XbZnGqRervmPz6ILet1DnCmHKsr3j1PjJedGlEOU/Y2L0JdFKUJ0?= =?us-ascii?Q?rWcsB8GhNlF3iljKA1W422EmDVjZYJyb0MxD60IM9lnPcqaAuj2ClSH6zkSZ?= =?us-ascii?Q?lUIf283tN1ngZFeclxEH2U2+lzfRBGlRc4qkEVPk?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37071b82-1b49-4c4d-bb12-08da7b94bb4c X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB4664.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2022 12:26:35.9725 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UkgCyGtY0gRDptFo053uONsN2HneqVa7A9OVhMZIpN2C++5YAc3Eui0G9aGp1Fv5gPwgZsSTIrLm9h9HfOFIXg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR10MB1770 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-11_10,2022-08-11_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 mlxscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208110038 X-Proofpoint-ORIG-GUID: ePgeMYNjUcZpv6SOwbsEXXog0X-rdN21 X-Proofpoint-GUID: ePgeMYNjUcZpv6SOwbsEXXog0X-rdN21 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=205.220.165.32; envelope-from=jonah.palmer@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1660223306352100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Laurent Vivier Display feature names instead of bitmaps for host, guest, and backend for VirtIODevices. Display status names instead of bitmaps for VirtIODevices. Display feature names instead of bitmaps for backend, protocol, acked, and features (hdev->features) for vhost devices. Decode features according to device ID. Decode statuses according to configuration status bitmap (config_status_map). Decode vhost user protocol features according to vhost user protocol bitmap (vhost_user_protocol_map). Transport features are on the first line. Undecoded bits (if any) are stored in a separate field. [Jonah: Several changes made to this patch from prev. version (v14): - Moved all device features mappings to hw/virtio/virtio.c - Renamed device features mappings (less generic) - Generalized @FEATURE_ENTRY macro for all device mappings - Virtio device feature map definitions include descriptions of feature bits - Moved @VHOST_USER_F_PROTOCOL_FEATURES feature bit from transport feature map to vhost-user-supported device feature mappings (blk, fs, i2c, rng, net, gpu, input, scsi, vsock) - New feature bit added for virtio-vsock: @VIRTIO_VSOCK_F_SEQPACKET - New feature bit added for virtio-iommu: @VIRTIO_IOMMU_F_BYPASS_CONFIG - New feature bit added for virtio-mem: @VIRTIO_MEM_F_UNPLUGGED_INACCESSIB= LE - New virtio transport feature bit added: @VIRTIO_F_IN_ORDER - Added device feature map definition for virtio-rng ] Signed-off-by: Laurent Vivier Signed-off-by: Jonah Palmer --- As mentioned in the cover letter, there's a bit of confusion for me here regarding a 30 feature bit that I've been seeing in all of the PCI virtio devices that I've defined when bringing up a guest. The only 30 feature bits that are defined are @VHOST_USER_F_PROTOCOL_FEATURES & @VIRTIO_F_BAD_FEATURE. Initially, I thought that this must be the vhost-user 'protocol-features' feature bit (since the 'bad-feature' bit would mean negotiation is broken), but I noticed that this bit was still being set on devices that don't even have vhost-user support (e.g. virtio-serial), nor was I using vhost-user on any of my virtio devices. On closer inspection, with a little printf debugging, I confirmed my suspicion that every PCI virtio device *is* in fact having this 'bad-featu= re' feature set. Futhermore, *none* of my devices actually set the 'protocol-features' feature (which makes sense since I wasn't using vhost-user). What doesn't make sense to me though is why this 'bad-feature' bit is being set at all, as it implies that negotiation has failed for the device. In short, I've left out defining the 'bad-feature' feature bit in the transport features map to avoid confusion. However, I'm afraid that this m= ay cause even more confusion since (1) non-vhost-user-supported devices will show 'unknown-dev-features' (e.g. virtio-serial) and (2) vhost-user-suppor= ted devices (e.g. virtio-net) *not* using vhost-user will show @VHOST_USER_F_PROTOCOL_FEATURES when in reality it's @VIRTIO_F_BAD_FEATURE. Please let me know how you would like me to address this. Thanks. hw/virtio/virtio.c | 643 ++++++++++++++++++++++++++++++++++++- include/hw/virtio/vhost.h | 3 + include/hw/virtio/virtio.h | 5 + qapi/virtio.json | 251 +++++++++++++-- 4 files changed, 874 insertions(+), 28 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 3e0a484660..23bdc77a95 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -34,10 +34,433 @@ #include "sysemu/dma.h" #include "sysemu/runstate.h" #include "standard-headers/linux/virtio_ids.h" +#include "standard-headers/linux/vhost_types.h" +#include "standard-headers/linux/virtio_blk.h" +#include "standard-headers/linux/virtio_console.h" +#include "standard-headers/linux/virtio_gpu.h" +#include "standard-headers/linux/virtio_net.h" +#include "standard-headers/linux/virtio_scsi.h" +#include "standard-headers/linux/virtio_i2c.h" +#include "standard-headers/linux/virtio_balloon.h" +#include "standard-headers/linux/virtio_iommu.h" +#include "standard-headers/linux/virtio_mem.h" +#include "standard-headers/linux/virtio_vsock.h" +#include CONFIG_DEVICES =20 /* QAPI list of realized VirtIODevices */ static QTAILQ_HEAD(, VirtIODevice) virtio_list; =20 +/* + * Maximum size of virtio device config space + */ +#define VHOST_USER_MAX_CONFIG_SIZE 256 + +#define FEATURE_ENTRY(name, desc) (qmp_virtio_feature_map_t) \ + { .virtio_bit =3D name, .feature_desc =3D desc } + +enum VhostUserProtocolFeature { + VHOST_USER_PROTOCOL_F_MQ =3D 0, + VHOST_USER_PROTOCOL_F_LOG_SHMFD =3D 1, + VHOST_USER_PROTOCOL_F_RARP =3D 2, + VHOST_USER_PROTOCOL_F_REPLY_ACK =3D 3, + VHOST_USER_PROTOCOL_F_NET_MTU =3D 4, + VHOST_USER_PROTOCOL_F_SLAVE_REQ =3D 5, + VHOST_USER_PROTOCOL_F_CROSS_ENDIAN =3D 6, + VHOST_USER_PROTOCOL_F_CRYPTO_SESSION =3D 7, + VHOST_USER_PROTOCOL_F_PAGEFAULT =3D 8, + VHOST_USER_PROTOCOL_F_CONFIG =3D 9, + VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD =3D 10, + VHOST_USER_PROTOCOL_F_HOST_NOTIFIER =3D 11, + VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD =3D 12, + VHOST_USER_PROTOCOL_F_RESET_DEVICE =3D 13, + VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS =3D 14, + VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS =3D 15, + VHOST_USER_PROTOCOL_F_MAX +}; + +/* Virtio transport features mapping */ +static qmp_virtio_feature_map_t virtio_transport_map[] =3D { + /* Virtio device transport features */ +#ifndef VIRTIO_CONFIG_NO_LEGACY + FEATURE_ENTRY(VIRTIO_F_NOTIFY_ON_EMPTY, \ + "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out of avai= l. " + "descs. on VQ"), + FEATURE_ENTRY(VIRTIO_F_ANY_LAYOUT, \ + "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. layouts"), +#endif /* !VIRTIO_CONFIG_NO_LEGACY */ + FEATURE_ENTRY(VIRTIO_F_VERSION_1, \ + "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)"), + FEATURE_ENTRY(VIRTIO_F_IOMMU_PLATFORM, \ + "VIRTIO_F_IOMMU_PLATFORM: Device can be used on IOMMU platform= "), + FEATURE_ENTRY(VIRTIO_F_RING_PACKED, \ + "VIRTIO_F_RING_PACKED: Device supports packed VQ layout"), + FEATURE_ENTRY(VIRTIO_F_IN_ORDER, \ + "VIRTIO_F_IN_ORDER: Device uses buffers in same order as made " + "available by driver"), + FEATURE_ENTRY(VIRTIO_F_ORDER_PLATFORM, \ + "VIRTIO_F_ORDER_PLATFORM: Memory accesses ordered by platform"= ), + FEATURE_ENTRY(VIRTIO_F_SR_IOV, \ + "VIRTIO_F_SR_IOV: Device supports single root I/O virtualizati= on"), + /* Virtio ring transport features */ + FEATURE_ENTRY(VIRTIO_RING_F_INDIRECT_DESC, \ + "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported"), + FEATURE_ENTRY(VIRTIO_RING_F_EVENT_IDX, \ + "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled"), + { -1, "" } +}; + +/* Vhost-user protocol features mapping */ +static qmp_virtio_feature_map_t vhost_user_protocol_map[] =3D { + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_MQ, \ + "VHOST_USER_PROTOCOL_F_MQ: Multiqueue protocol supported"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_LOG_SHMFD, \ + "VHOST_USER_PROTOCOL_F_LOG_SHMFD: Shared log memory fd support= ed"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_RARP, \ + "VHOST_USER_PROTOCOL_F_RARP: Vhost-user back-end RARP broadcas= ting " + "supported"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_REPLY_ACK, \ + "VHOST_USER_PROTOCOL_F_REPLY_ACK: Requested operation status a= ck. " + "supported"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_NET_MTU, \ + "VHOST_USER_PROTOCOL_F_NET_MTU: Expose host MTU to guest suppo= rted"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_SLAVE_REQ, \ + "VHOST_USER_PROTOCOL_F_SLAVE_REQ: Socket fd for back-end initi= ated " + "requests supported"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_CROSS_ENDIAN, \ + "VHOST_USER_PROTOCOL_F_CROSS_ENDIAN: Endianness of VQs for leg= acy " + "devices supported"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_CRYPTO_SESSION, \ + "VHOST_USER_PROTOCOL_F_CRYPTO_SESSION: Session creation for cr= ypto " + "operations supported"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_PAGEFAULT, \ + "VHOST_USER_PROTOCOL_F_PAGEFAULT: Request servicing on userfau= ltfd " + "for accessed pages supported"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_CONFIG, \ + "VHOST_USER_PROTOCOL_F_CONFIG: Vhost-user messaging for virtio= " + "device configuration space supported"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD, \ + "VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD: Slave fd communication " + "channel supported"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_HOST_NOTIFIER, \ + "VHOST_USER_PROTOCOL_F_HOST_NOTIFIER: Host notifiers for speci= fied " + "VQs supported"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD, \ + "VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD: Shared inflight I/O buf= fers " + "supported"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_RESET_DEVICE, \ + "VHOST_USER_PROTOCOL_F_RESET_DEVICE: Disabling all rings and " + "resetting internal device state supported"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS, \ + "VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS: In-band messaging= " + "supported"), + FEATURE_ENTRY(VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS, \ + "VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS: Configuration for " + "memory slots supported"), + { -1, "" } +}; + +/* virtio device configuration statuses */ +static qmp_virtio_feature_map_t virtio_config_status_map[] =3D { + FEATURE_ENTRY(VIRTIO_CONFIG_S_DRIVER_OK, \ + "VIRTIO_CONFIG_S_DRIVER_OK: Driver setup and ready"), + FEATURE_ENTRY(VIRTIO_CONFIG_S_FEATURES_OK, \ + "VIRTIO_CONFIG_S_FEATURES_OK: Feature negotiation complete"), + FEATURE_ENTRY(VIRTIO_CONFIG_S_DRIVER, \ + "VIRTIO_CONFIG_S_DRIVER: Guest OS compatible with device"), + FEATURE_ENTRY(VIRTIO_CONFIG_S_NEEDS_RESET, \ + "VIRTIO_CONFIG_S_NEEDS_RESET: Irrecoverable error, device need= s " + "reset"), + FEATURE_ENTRY(VIRTIO_CONFIG_S_FAILED, \ + "VIRTIO_CONFIG_S_FAILED: Error in guest, device failed"), + FEATURE_ENTRY(VIRTIO_CONFIG_S_ACKNOWLEDGE, \ + "VIRTIO_CONFIG_S_ACKNOWLEDGE: Valid virtio device found"), + { -1, "" } +}; + +/* virtio-blk features mapping */ +qmp_virtio_feature_map_t virtio_blk_feature_map[] =3D { + FEATURE_ENTRY(VIRTIO_BLK_F_SIZE_MAX, \ + "VIRTIO_BLK_F_SIZE_MAX: Max segment size is size_max"), + FEATURE_ENTRY(VIRTIO_BLK_F_SEG_MAX, \ + "VIRTIO_BLK_F_SEG_MAX: Max segments in a request is seg_max"), + FEATURE_ENTRY(VIRTIO_BLK_F_GEOMETRY, \ + "VIRTIO_BLK_F_GEOMETRY: Legacy geometry available"), + FEATURE_ENTRY(VIRTIO_BLK_F_RO, \ + "VIRTIO_BLK_F_RO: Device is read-only"), + FEATURE_ENTRY(VIRTIO_BLK_F_BLK_SIZE, \ + "VIRTIO_BLK_F_BLK_SIZE: Block size of disk available"), + FEATURE_ENTRY(VIRTIO_BLK_F_TOPOLOGY, \ + "VIRTIO_BLK_F_TOPOLOGY: Topology information available"), + FEATURE_ENTRY(VIRTIO_BLK_F_MQ, \ + "VIRTIO_BLK_F_MQ: Multiqueue supported"), + FEATURE_ENTRY(VIRTIO_BLK_F_DISCARD, \ + "VIRTIO_BLK_F_DISCARD: Discard command supported"), + FEATURE_ENTRY(VIRTIO_BLK_F_WRITE_ZEROES, \ + "VIRTIO_BLK_F_WRITE_ZEROES: Write zeroes command supported"), +#ifndef VIRTIO_BLK_NO_LEGACY + FEATURE_ENTRY(VIRTIO_BLK_F_BARRIER, \ + "VIRTIO_BLK_F_BARRIER: Request barriers supported"), + FEATURE_ENTRY(VIRTIO_BLK_F_SCSI, \ + "VIRTIO_BLK_F_SCSI: SCSI packet commands supported"), + FEATURE_ENTRY(VIRTIO_BLK_F_FLUSH, \ + "VIRTIO_BLK_F_FLUSH: Flush command supported"), + FEATURE_ENTRY(VIRTIO_BLK_F_CONFIG_WCE, \ + "VIRTIO_BLK_F_CONFIG_WCE: Cache writeback and writethrough mod= es " + "supported"), +#endif /* !VIRTIO_BLK_NO_LEGACY */ + FEATURE_ENTRY(VHOST_F_LOG_ALL, \ + "VHOST_F_LOG_ALL: Logging write descriptors supported"), + FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \ + "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features " + "negotiation supported"), + { -1, "" } +}; + +/* virtio-serial features mapping */ +qmp_virtio_feature_map_t virtio_serial_feature_map[] =3D { + FEATURE_ENTRY(VIRTIO_CONSOLE_F_SIZE, \ + "VIRTIO_CONSOLE_F_SIZE: Host providing console size"), + FEATURE_ENTRY(VIRTIO_CONSOLE_F_MULTIPORT, \ + "VIRTIO_CONSOLE_F_MULTIPORT: Multiple ports for device support= ed"), + FEATURE_ENTRY(VIRTIO_CONSOLE_F_EMERG_WRITE, \ + "VIRTIO_CONSOLE_F_EMERG_WRITE: Emergency write supported"), + { -1, "" } +}; + +/* virtio-gpu features mapping */ +qmp_virtio_feature_map_t virtio_gpu_feature_map[] =3D { + FEATURE_ENTRY(VIRTIO_GPU_F_VIRGL, \ + "VIRTIO_GPU_F_VIRGL: Virgl 3D mode supported"), + FEATURE_ENTRY(VIRTIO_GPU_F_EDID, \ + "VIRTIO_GPU_F_EDID: EDID metadata supported"), + FEATURE_ENTRY(VIRTIO_GPU_F_RESOURCE_UUID, \ + "VIRTIO_GPU_F_RESOURCE_UUID: Resource UUID assigning supported= "), + FEATURE_ENTRY(VIRTIO_GPU_F_RESOURCE_BLOB, \ + "VIRTIO_GPU_F_RESOURCE_BLOB: Size-based blob resources support= ed"), + FEATURE_ENTRY(VIRTIO_GPU_F_CONTEXT_INIT, \ + "VIRTIO_GPU_F_CONTEXT_INIT: Context types and synchronization " + "timelines supported"), + FEATURE_ENTRY(VHOST_F_LOG_ALL, \ + "VHOST_F_LOG_ALL: Logging write descriptors supported"), + FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \ + "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features " + "negotiation supported"), + { -1, "" } +}; + +/* virtio-input features mapping */ +qmp_virtio_feature_map_t virtio_input_feature_map[] =3D { + FEATURE_ENTRY(VHOST_F_LOG_ALL, \ + "VHOST_F_LOG_ALL: Logging write descriptors supported"), + FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \ + "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features " + "negotiation supported"), + { -1, "" } +}; + +/* virtio-net features mapping */ +qmp_virtio_feature_map_t virtio_net_feature_map[] =3D { + FEATURE_ENTRY(VIRTIO_NET_F_CSUM, \ + "VIRTIO_NET_F_CSUM: Device handling packets with partial check= sum " + "supported"), + FEATURE_ENTRY(VIRTIO_NET_F_GUEST_CSUM, \ + "VIRTIO_NET_F_GUEST_CSUM: Driver handling packets with partial= " + "checksum supported"), + FEATURE_ENTRY(VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, \ + "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channel offloading " + "reconfig. supported"), + FEATURE_ENTRY(VIRTIO_NET_F_MTU, \ + "VIRTIO_NET_F_MTU: Device max MTU reporting supported"), + FEATURE_ENTRY(VIRTIO_NET_F_MAC, \ + "VIRTIO_NET_F_MAC: Device has given MAC address"), + FEATURE_ENTRY(VIRTIO_NET_F_GUEST_TSO4, \ + "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4"), + FEATURE_ENTRY(VIRTIO_NET_F_GUEST_TSO6, \ + "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6"), + FEATURE_ENTRY(VIRTIO_NET_F_GUEST_ECN, \ + "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO with ECN"), + FEATURE_ENTRY(VIRTIO_NET_F_GUEST_UFO, \ + "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO"), + FEATURE_ENTRY(VIRTIO_NET_F_HOST_TSO4, \ + "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4"), + FEATURE_ENTRY(VIRTIO_NET_F_HOST_TSO6, \ + "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6"), + FEATURE_ENTRY(VIRTIO_NET_F_HOST_ECN, \ + "VIRTIO_NET_F_HOST_ECN: Device can receive TSO with ECN"), + FEATURE_ENTRY(VIRTIO_NET_F_HOST_UFO, \ + "VIRTIO_NET_F_HOST_UFO: Device can receive UFO"), + FEATURE_ENTRY(VIRTIO_NET_F_MRG_RXBUF, \ + "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers"), + FEATURE_ENTRY(VIRTIO_NET_F_STATUS, \ + "VIRTIO_NET_F_STATUS: Configuration status field available"), + FEATURE_ENTRY(VIRTIO_NET_F_CTRL_VQ, \ + "VIRTIO_NET_F_CTRL_VQ: Control channel available"), + FEATURE_ENTRY(VIRTIO_NET_F_CTRL_RX, \ + "VIRTIO_NET_F_CTRL_RX: Control channel RX mode supported"), + FEATURE_ENTRY(VIRTIO_NET_F_CTRL_VLAN, \ + "VIRTIO_NET_F_CTRL_VLAN: Control channel VLAN filtering suppor= ted"), + FEATURE_ENTRY(VIRTIO_NET_F_CTRL_RX_EXTRA, \ + "VIRTIO_NET_F_CTRL_RX_EXTRA: Extra RX mode control supported"), + FEATURE_ENTRY(VIRTIO_NET_F_GUEST_ANNOUNCE, \ + "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sending gratuitous packet= s " + "supported"), + FEATURE_ENTRY(VIRTIO_NET_F_MQ, \ + "VIRTIO_NET_F_MQ: Multiqueue with automatic receive steering " + "supported"), + FEATURE_ENTRY(VIRTIO_NET_F_CTRL_MAC_ADDR, \ + "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through control " + "channel"), + FEATURE_ENTRY(VIRTIO_NET_F_HASH_REPORT, \ + "VIRTIO_NET_F_HASH_REPORT: Hash reporting supported"), + FEATURE_ENTRY(VIRTIO_NET_F_RSS, \ + "VIRTIO_NET_F_RSS: RSS RX steering supported"), + FEATURE_ENTRY(VIRTIO_NET_F_RSC_EXT, \ + "VIRTIO_NET_F_RSC_EXT: Extended coalescing info supported"), + FEATURE_ENTRY(VIRTIO_NET_F_STANDBY, \ + "VIRTIO_NET_F_STANDBY: Device acting as standby for primary " + "device with same MAC addr. supported"), + FEATURE_ENTRY(VIRTIO_NET_F_SPEED_DUPLEX, \ + "VIRTIO_NET_F_SPEED_DUPLEX: Device set linkspeed and duplex"), +#ifndef VIRTIO_NET_NO_LEGACY + FEATURE_ENTRY(VIRTIO_NET_F_GSO, \ + "VIRTIO_NET_F_GSO: Handling GSO-type packets supported"), +#endif /* !VIRTIO_NET_NO_LEGACY */ + FEATURE_ENTRY(VHOST_NET_F_VIRTIO_NET_HDR, \ + "VHOST_NET_F_VIRTIO_NET_HDR: Virtio-net headers for RX and TX " + "packets supported"), + FEATURE_ENTRY(VHOST_F_LOG_ALL, \ + "VHOST_F_LOG_ALL: Logging write descriptors supported"), + FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \ + "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features " + "negotiation supported"), + { -1, "" } +}; + +/* virtio-scsi features mapping */ +qmp_virtio_feature_map_t virtio_scsi_feature_map[] =3D { + FEATURE_ENTRY(VIRTIO_SCSI_F_INOUT, \ + "VIRTIO_SCSI_F_INOUT: Requests including read and writable dat= a " + "buffers suppoted"), + FEATURE_ENTRY(VIRTIO_SCSI_F_HOTPLUG, \ + "VIRTIO_SCSI_F_HOTPLUG: Reporting and handling hot-plug events= " + "supported"), + FEATURE_ENTRY(VIRTIO_SCSI_F_CHANGE, \ + "VIRTIO_SCSI_F_CHANGE: Reporting and handling LUN changes " + "supported"), + FEATURE_ENTRY(VIRTIO_SCSI_F_T10_PI, \ + "VIRTIO_SCSI_F_T10_PI: T10 info included in request header"), + FEATURE_ENTRY(VHOST_F_LOG_ALL, \ + "VHOST_F_LOG_ALL: Logging write descriptors supported"), + FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \ + "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features " + "negotiation supported"), + { -1, "" } +}; + +/* virtio/vhost-user-fs features mapping */ +qmp_virtio_feature_map_t virtio_fs_feature_map[] =3D { + FEATURE_ENTRY(VHOST_F_LOG_ALL, \ + "VHOST_F_LOG_ALL: Logging write descriptors supported"), + FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \ + "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features " + "negotiation supported"), + { -1, "" } +}; + +/* virtio/vhost-user-i2c features mapping */ +qmp_virtio_feature_map_t virtio_i2c_feature_map[] =3D { + FEATURE_ENTRY(VIRTIO_I2C_F_ZERO_LENGTH_REQUEST, \ + "VIRTIO_I2C_F_ZERO_LEGNTH_REQUEST: Zero length requests suppor= ted"), + FEATURE_ENTRY(VHOST_F_LOG_ALL, \ + "VHOST_F_LOG_ALL: Logging write descriptors supported"), + FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \ + "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features " + "negotiation supported"), + { -1, "" } +}; + +/* virtio/vhost-vsock features mapping */ +qmp_virtio_feature_map_t virtio_vsock_feature_map[] =3D { + FEATURE_ENTRY(VIRTIO_VSOCK_F_SEQPACKET, \ + "VIRTIO_VSOCK_F_SEQPACKET: SOCK_SEQPACKET supported"), + FEATURE_ENTRY(VHOST_F_LOG_ALL, \ + "VHOST_F_LOG_ALL: Logging write descriptors supported"), + FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \ + "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features " + "negotiation supported"), + { -1, "" } +}; + +/* virtio-balloon features mapping */ +qmp_virtio_feature_map_t virtio_balloon_feature_map[] =3D { + FEATURE_ENTRY(VIRTIO_BALLOON_F_MUST_TELL_HOST, \ + "VIRTIO_BALLOON_F_MUST_TELL_HOST: Tell host before reclaiming " + "pages"), + FEATURE_ENTRY(VIRTIO_BALLOON_F_STATS_VQ, \ + "VIRTIO_BALLOON_F_STATS_VQ: Guest memory stats VQ available"), + FEATURE_ENTRY(VIRTIO_BALLOON_F_DEFLATE_ON_OOM, \ + "VIRTIO_BALLOON_F_DEFLATE_ON_OOM: Deflate balloon when guest O= OM"), + FEATURE_ENTRY(VIRTIO_BALLOON_F_FREE_PAGE_HINT, \ + "VIRTIO_BALLOON_F_FREE_PAGE_HINT: VQ reporting free pages enab= led"), + FEATURE_ENTRY(VIRTIO_BALLOON_F_PAGE_POISON, \ + "VIRTIO_BALLOON_F_PAGE_POISON: Guest page poisoning enabled"), + FEATURE_ENTRY(VIRTIO_BALLOON_F_REPORTING, \ + "VIRTIO_BALLOON_F_REPORTING: Page reporting VQ enabled"), + { -1, "" } +}; + +/* virtio-crypto features mapping */ +qmp_virtio_feature_map_t virtio_crypto_feature_map[] =3D { + FEATURE_ENTRY(VHOST_F_LOG_ALL, \ + "VHOST_F_LOG_ALL: Logging write descriptors supported"), + { -1, "" } +}; + +/* virtio-iommu features mapping */ +qmp_virtio_feature_map_t virtio_iommu_feature_map[] =3D { + FEATURE_ENTRY(VIRTIO_IOMMU_F_INPUT_RANGE, \ + "VIRTIO_IOMMU_F_INPUT_RANGE: Range of available virtual addrs.= " + "available"), + FEATURE_ENTRY(VIRTIO_IOMMU_F_DOMAIN_RANGE, \ + "VIRTIO_IOMMU_F_DOMAIN_RANGE: Number of supported domains " + "available"), + FEATURE_ENTRY(VIRTIO_IOMMU_F_MAP_UNMAP, \ + "VIRTIO_IOMMU_F_MAP_UNMAP: Map and unmap requests available"), + FEATURE_ENTRY(VIRTIO_IOMMU_F_BYPASS, \ + "VIRTIO_IOMMU_F_BYPASS: Endpoints not attached to domains are = in " + "bypass mode"), + FEATURE_ENTRY(VIRTIO_IOMMU_F_PROBE, \ + "VIRTIO_IOMMU_F_PROBE: Probe requests available"), + FEATURE_ENTRY(VIRTIO_IOMMU_F_MMIO, \ + "VIRTIO_IOMMU_F_MMIO: VIRTIO_IOMMU_MAP_F_MMIO flag available"), + FEATURE_ENTRY(VIRTIO_IOMMU_F_BYPASS_CONFIG, \ + "VIRTIO_IOMMU_F_BYPASS_CONFIG: Bypass field of IOMMU config " + "available"), + { -1, "" } +}; + +/* virtio-mem features mapping */ +qmp_virtio_feature_map_t virtio_mem_feature_map[] =3D { +#ifndef CONFIG_ACPI + FEATURE_ENTRY(VIRTIO_MEM_F_ACPI_PXM, \ + "VIRTIO_MEM_F_ACPI_PXM: node_id is an ACPI PXM and is valid"), +#endif /* !CONFIG_ACPI */ + FEATURE_ENTRY(VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE, \ + "VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE: Unplugged memory cannot = be " + "accessed"), + { -1, "" } +}; + +/* virtio-rng features mapping */ +qmp_virtio_feature_map_t virtio_rng_feature_map[] =3D { + FEATURE_ENTRY(VHOST_F_LOG_ALL, \ + "VHOST_F_LOG_ALL: Logging write descriptors supported"), + FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \ + "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features " + "negotiation supported"), + { -1, "" } +}; + /* * The alignment to use between consumer and producer parts of vring. * x86 pagesize again. This is the default, used by transports like PCI @@ -3975,6 +4398,203 @@ static VirtIODevice *virtio_device_find(const char = *path) return NULL; } =20 +#define CONVERT_FEATURES(type, map, is_status, bitmap) \ + ({ \ + type *list =3D NULL; \ + type *node; \ + for (i =3D 0; map[i].virtio_bit !=3D -1; i++) { \ + if (is_status) { \ + bit =3D map[i].virtio_bit; \ + } \ + else { \ + bit =3D 1ULL << map[i].virtio_bit; \ + } \ + if ((bitmap & bit) =3D=3D 0) { \ + continue; \ + } \ + node =3D g_new0(type, 1); \ + node->value =3D g_strdup(map[i].feature_desc); \ + node->next =3D list; \ + list =3D node; \ + bitmap ^=3D bit; \ + } \ + list; \ + }) + +static VirtioDeviceStatus *qmp_decode_status(uint8_t bitmap) +{ + VirtioDeviceStatus *status; + uint8_t bit; + int i; + + status =3D g_new0(VirtioDeviceStatus, 1); + status->statuses =3D CONVERT_FEATURES(strList, virtio_config_status_ma= p, + 1, bitmap); + status->has_unknown_statuses =3D bitmap !=3D 0; + if (status->has_unknown_statuses) { + status->unknown_statuses =3D bitmap; + } + + return status; +} + +static VhostDeviceProtocols *qmp_decode_protocols(uint64_t bitmap) +{ + VhostDeviceProtocols *vhu_protocols; + uint64_t bit; + int i; + + vhu_protocols =3D g_new0(VhostDeviceProtocols, 1); + vhu_protocols->protocols =3D + CONVERT_FEATURES(strList, + vhost_user_protocol_map, 0, bitmap); + vhu_protocols->has_unknown_protocols =3D bitmap !=3D 0; + if (vhu_protocols->has_unknown_protocols) { + vhu_protocols->unknown_protocols =3D bitmap; + } + + return vhu_protocols; +} + +static VirtioDeviceFeatures *qmp_decode_features(uint16_t device_id, + uint64_t bitmap) +{ + VirtioDeviceFeatures *features; + uint64_t bit; + int i; + + features =3D g_new0(VirtioDeviceFeatures, 1); + features->has_dev_features =3D true; + + /* transport features */ + features->transports =3D CONVERT_FEATURES(strList, virtio_transport_ma= p, 0, + bitmap); + + /* device features */ + switch (device_id) { +#ifdef CONFIG_VIRTIO_SERIAL + case VIRTIO_ID_CONSOLE: + features->dev_features =3D + CONVERT_FEATURES(strList, virtio_serial_feature_map, 0, bitmap= ); + break; +#endif +#ifdef CONFIG_VIRTIO_BLK + case VIRTIO_ID_BLOCK: + features->dev_features =3D + CONVERT_FEATURES(strList, virtio_blk_feature_map, 0, bitmap); + break; +#endif +#ifdef CONFIG_VIRTIO_GPU + case VIRTIO_ID_GPU: + features->dev_features =3D + CONVERT_FEATURES(strList, virtio_gpu_feature_map, 0, bitmap); + break; +#endif +#ifdef CONFIG_VIRTIO_NET + case VIRTIO_ID_NET: + features->dev_features =3D + CONVERT_FEATURES(strList, virtio_net_feature_map, 0, bitmap); + break; +#endif +#ifdef CONFIG_VIRTIO_SCSI + case VIRTIO_ID_SCSI: + features->dev_features =3D + CONVERT_FEATURES(strList, virtio_scsi_feature_map, 0, bitmap); + break; +#endif +#ifdef CONFIG_VIRTIO_BALLOON + case VIRTIO_ID_BALLOON: + features->dev_features =3D + CONVERT_FEATURES(strList, virtio_balloon_feature_map, 0, bitma= p); + break; +#endif +#ifdef CONFIG_VIRTIO_IOMMU + case VIRTIO_ID_IOMMU: + features->dev_features =3D + CONVERT_FEATURES(strList, virtio_iommu_feature_map, 0, bitmap); + break; +#endif +#ifdef CONFIG_VIRTIO_INPUT + case VIRTIO_ID_INPUT: + features->dev_features =3D + CONVERT_FEATURES(strList, virtio_input_feature_map, 0, bitmap); + break; +#endif +#ifdef CONFIG_VHOST_USER_FS + case VIRTIO_ID_FS: + features->dev_features =3D + CONVERT_FEATURES(strList, virtio_fs_feature_map, 0, bitmap); + break; +#endif +#ifdef CONFIG_VHOST_VSOCK + case VIRTIO_ID_VSOCK: + features->dev_features =3D + CONVERT_FEATURES(strList, virtio_vsock_feature_map, 0, bitmap); + break; +#endif +#ifdef CONFIG_VIRTIO_CRYPTO + case VIRTIO_ID_CRYPTO: + features->dev_features =3D + CONVERT_FEATURES(strList, virtio_crypto_feature_map, 0, bitmap= ); + break; +#endif +#ifdef CONFIG_VIRTIO_MEM + case VIRTIO_ID_MEM: + features->dev_features =3D + CONVERT_FEATURES(strList, virtio_mem_feature_map, 0, bitmap); + break; +#endif +#ifdef CONFIG_VIRTIO_I2C_ADAPTER + case VIRTIO_ID_I2C_ADAPTER: + features->dev_features =3D + CONVERT_FEATURES(strList, virtio_i2c_feature_map, 0, bitmap); + break; +#endif +#ifdef CONFIG_VIRTIO_RNG + case VIRTIO_ID_RNG: + features->dev_features =3D + CONVERT_FEATURES(strList, virtio_rng_feature_map, 0, bitmap); + break; +#endif + /* No features */ + case VIRTIO_ID_9P: + case VIRTIO_ID_PMEM: + case VIRTIO_ID_IOMEM: + case VIRTIO_ID_RPMSG: + case VIRTIO_ID_CLOCK: + case VIRTIO_ID_MAC80211_WLAN: + case VIRTIO_ID_MAC80211_HWSIM: + case VIRTIO_ID_RPROC_SERIAL: + case VIRTIO_ID_MEMORY_BALLOON: + case VIRTIO_ID_CAIF: + case VIRTIO_ID_SIGNAL_DIST: + case VIRTIO_ID_PSTORE: + case VIRTIO_ID_SOUND: + case VIRTIO_ID_BT: + case VIRTIO_ID_RPMB: + case VIRTIO_ID_VIDEO_ENCODER: + case VIRTIO_ID_VIDEO_DECODER: + case VIRTIO_ID_SCMI: + case VIRTIO_ID_NITRO_SEC_MOD: + case VIRTIO_ID_WATCHDOG: + case VIRTIO_ID_CAN: + case VIRTIO_ID_DMABUF: + case VIRTIO_ID_PARAM_SERV: + case VIRTIO_ID_AUDIO_POLICY: + case VIRTIO_ID_GPIO: + break; + default: + g_assert_not_reached(); + } + + features->has_unknown_dev_features =3D bitmap !=3D 0; + if (features->has_unknown_dev_features) { + features->unknown_dev_features =3D bitmap; + } + + return features; +} + VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp) { VirtIODevice *vdev; @@ -3990,9 +4610,12 @@ VirtioStatus *qmp_x_query_virtio_status(const char *= path, Error **errp) status->name =3D g_strdup(vdev->name); status->device_id =3D vdev->device_id; status->vhost_started =3D vdev->vhost_started; - status->guest_features =3D vdev->guest_features; - status->host_features =3D vdev->host_features; - status->backend_features =3D vdev->backend_features; + status->guest_features =3D qmp_decode_features(vdev->device_id, + vdev->guest_features); + status->host_features =3D qmp_decode_features(vdev->device_id, + vdev->host_features); + status->backend_features =3D qmp_decode_features(vdev->device_id, + vdev->backend_features); =20 switch (vdev->device_endian) { case VIRTIO_DEVICE_ENDIAN_LITTLE: @@ -4007,7 +4630,7 @@ VirtioStatus *qmp_x_query_virtio_status(const char *p= ath, Error **errp) } =20 status->num_vqs =3D virtio_get_num_queues(vdev); - status->status =3D vdev->status; + status->status =3D qmp_decode_status(vdev->status); status->isr =3D vdev->isr; status->queue_sel =3D vdev->queue_sel; status->vm_running =3D vdev->vm_running; @@ -4030,10 +4653,14 @@ VirtioStatus *qmp_x_query_virtio_status(const char = *path, Error **errp) status->vhost_dev->n_tmp_sections =3D hdev->n_tmp_sections; status->vhost_dev->nvqs =3D hdev->nvqs; status->vhost_dev->vq_index =3D hdev->vq_index; - status->vhost_dev->features =3D hdev->features; - status->vhost_dev->acked_features =3D hdev->acked_features; - status->vhost_dev->backend_features =3D hdev->backend_features; - status->vhost_dev->protocol_features =3D hdev->protocol_features; + status->vhost_dev->features =3D + qmp_decode_features(vdev->device_id, hdev->features); + status->vhost_dev->acked_features =3D + qmp_decode_features(vdev->device_id, hdev->acked_features); + status->vhost_dev->backend_features =3D + qmp_decode_features(vdev->device_id, hdev->backend_features); + status->vhost_dev->protocol_features =3D + qmp_decode_protocols(hdev->protocol_features); status->vhost_dev->max_queues =3D hdev->max_queues; status->vhost_dev->backend_cap =3D hdev->backend_cap; status->vhost_dev->log_enabled =3D hdev->log_enabled; diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index a346f23d13..1f6655e149 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -5,6 +5,9 @@ #include "hw/virtio/virtio.h" #include "exec/memory.h" =20 +#define VHOST_F_DEVICE_IOTLB 63 +#define VHOST_USER_F_PROTOCOL_FEATURES 30 + /* Generic structures common for any vhost based device. */ =20 struct vhost_inflight { diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 375eb5671b..69025f2914 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -71,6 +71,11 @@ typedef struct VirtQueueElement #define TYPE_VIRTIO_DEVICE "virtio-device" OBJECT_DECLARE_TYPE(VirtIODevice, VirtioDeviceClass, VIRTIO_DEVICE) =20 +typedef struct { + int virtio_bit; + const char *feature_desc; +} qmp_virtio_feature_map_t; + enum virtio_device_endian { VIRTIO_DEVICE_ENDIAN_UNKNOWN, VIRTIO_DEVICE_ENDIAN_LITTLE, diff --git a/qapi/virtio.json b/qapi/virtio.json index c86b3bc635..c9c8201e66 100644 --- a/qapi/virtio.json +++ b/qapi/virtio.json @@ -106,10 +106,10 @@ 'n-tmp-sections': 'int', 'nvqs': 'uint32', 'vq-index': 'int', - 'features': 'uint64', - 'acked-features': 'uint64', - 'backend-features': 'uint64', - 'protocol-features': 'uint64', + 'features': 'VirtioDeviceFeatures', + 'acked-features': 'VirtioDeviceFeatures', + 'backend-features': 'VirtioDeviceFeatures', + 'protocol-features': 'VhostDeviceProtocols', 'max-queues': 'uint64', 'backend-cap': 'uint64', 'log-enabled': 'bool', @@ -176,11 +176,11 @@ 'device-id': 'uint16', 'vhost-started': 'bool', 'device-endian': 'str', - 'guest-features': 'uint64', - 'host-features': 'uint64', - 'backend-features': 'uint64', + 'guest-features': 'VirtioDeviceFeatures', + 'host-features': 'VirtioDeviceFeatures', + 'backend-features': 'VirtioDeviceFeatures', 'num-vqs': 'int', - 'status': 'uint8', + 'status': 'VirtioDeviceStatus', 'isr': 'uint8', 'queue-sel': 'uint16', 'vm-running': 'bool', @@ -222,14 +222,41 @@ # "name": "virtio-crypto", # "started": true, # "device-id": 20, -# "backend-features": 0, +# "backend-features": { +# "transports": [], +# "dev-features": [] +# }, # "start-on-kick": false, # "isr": 1, # "broken": false, -# "status": 15, +# "status": { +# "statuses": [ +# "VIRTIO_CONFIG_S_ACKNOWLEDGE: Valid virtio device found= ", +# "VIRTIO_CONFIG_S_DRIVER: Guest OS compatible with devic= e", +# "VIRTIO_CONFIG_S_FEATURES_OK: Feature negotiation compl= ete", +# "VIRTIO_CONFIG_S_DRIVER_OK: Driver setup and ready" +# ] +# }, # "num-vqs": 2, -# "guest-features": 5100273664, -# "host-features": 6325010432, +# "guest-features": { +# "dev-features": [], +# "transports": [ +# "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields en= abled", +# "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supp= orted", +# "VIRTIO_F_VERSION_1: Device compliant for v1 spec (lega= cy)" +# ] +# }, +# "host-features": { +# "unknown-dev-features": 1073741824, +# "dev-features": [], +# "transports": [ +# "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields en= abled", +# "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supp= orted", +# "VIRTIO_F_VERSION_1: Device compliant for v1 spec (lega= cy)", +# "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. la= youts", +# "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out = of avail. descs. on VQ" +# ] +# }, # "use-guest-notifier-mask": true, # "vm-running": true, # "queue-sel": 1, @@ -257,22 +284,147 @@ # "max-queues": 1, # "backend-cap": 2, # "log-size": 0, -# "backend-features": 0, +# "backend-features": { +# "dev-features": [], +# "transports": [] +# }, # "nvqs": 2, -# "protocol-features": 0, +# "protocol-features": { +# "protocols": [] +# }, # "vq-index": 0, # "log-enabled": false, -# "acked-features": 5100306432, -# "features": 13908344832 +# "acked-features": { +# "dev-features": [ +# "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive b= uffers" +# ], +# "transports": [ +# "VIRTIO_RING_F_EVENT_IDX: Used & avail. event field= s enabled", +# "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors = supported", +# "VIRTIO_F_VERSION_1: Device compliant for v1 spec (= legacy)" +# ] +# }, +# "features": { +# "dev-features": [ +# "VHOST_F_LOG_ALL: Logging write descriptors support= ed", +# "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive b= uffers" +# ], +# "transports": [ +# "VIRTIO_RING_F_EVENT_IDX: Used & avail. event field= s enabled", +# "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors = supported", +# "VIRTIO_F_IOMMU_PLATFORM: Device can be used on IOM= MU platform", +# "VIRTIO_F_VERSION_1: Device compliant for v1 spec (= legacy)", +# "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc= . layouts", +# "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs = out of avail. descs. on VQ" +# ] +# } +# }, +# "backend-features": { +# "dev-features": [ +# "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol fe= atures negotation supported", +# "VIRTIO_NET_F_GSO: Handling GSO-type packets supported", +# "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through co= ntrol channel", +# "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sending gratuitous= packets supported", +# "VIRTIO_NET_F_CTRL_RX_EXTRA: Extra RX mode control supp= orted", +# "VIRTIO_NET_F_CTRL_VLAN: Control channel VLAN filtering= supported", +# "VIRTIO_NET_F_CTRL_RX: Control channel RX mode supporte= d", +# "VIRTIO_NET_F_CTRL_VQ: Control channel available", +# "VIRTIO_NET_F_STATUS: Configuration status field availa= ble", +# "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffe= rs", +# "VIRTIO_NET_F_HOST_UFO: Device can receive UFO", +# "VIRTIO_NET_F_HOST_ECN: Device can receive TSO with ECN= ", +# "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6", +# "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4", +# "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO", +# "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO with EC= N", +# "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6", +# "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4", +# "VIRTIO_NET_F_MAC: Device has given MAC address", +# "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channel offl= oading reconfig. supported", +# "VIRTIO_NET_F_GUEST_CSUM: Driver handling packets with = partial checksum supported", +# "VIRTIO_NET_F_CSUM: Device handling packets with partia= l checksum supported" +# ], +# "transports": [ +# "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields en= abled", +# "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supp= orted", +# "VIRTIO_F_VERSION_1: Device compliant for v1 spec (lega= cy)", +# "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. la= youts", +# "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out = of avail. descs. on VQ" +# ] # }, -# "backend-features": 6337593319, # "start-on-kick": false, # "isr": 1, # "broken": false, -# "status": 15, +# "status": { +# "statuses": [ +# "VIRTIO_CONFIG_S_ACKNOWLEDGE: Valid virtio device found= ", +# "VIRTIO_CONFIG_S_DRIVER: Guest OS compatible with devic= e", +# "VIRTIO_CONFIG_S_FEATURES_OK: Feature negotiation compl= ete", +# "VIRTIO_CONFIG_S_DRIVER_OK: Driver setup and ready" +# ] +# }, # "num-vqs": 3, -# "guest-features": 5111807911, -# "host-features": 6337593319, +# "guest-features": { +# "dev-features": [ +# "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through co= ntrol channel", +# "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sending gratuitous= packets supported", +# "VIRTIO_NET_F_CTRL_VLAN: Control channel VLAN filtering= supported", +# "VIRTIO_NET_F_CTRL_RX: Control channel RX mode supporte= d", +# "VIRTIO_NET_F_CTRL_VQ: Control channel available", +# "VIRTIO_NET_F_STATUS: Configuration status field availa= ble", +# "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffe= rs", +# "VIRTIO_NET_F_HOST_UFO: Device can receive UFO", +# "VIRTIO_NET_F_HOST_ECN: Device can receive TSO with ECN= ", +# "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6", +# "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4", +# "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO", +# "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO with EC= N", +# "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6", +# "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4", +# "VIRTIO_NET_F_MAC: Device has given MAC address", +# "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channel offl= oading reconfig. supported", +# "VIRTIO_NET_F_GUEST_CSUM: Driver handling packets with = partial checksum supported", +# "VIRTIO_NET_F_CSUM: Device handling packets with partia= l checksum supported" +# ], +# "transports": [ +# "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields en= abled", +# "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supp= orted", +# "VIRTIO_F_VERSION_1: Device compliant for v1 spec (lega= cy)" +# ] +# }, +# "host-features": { +# "dev-features": [ +# "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol fe= atures negotation supported", +# "VIRTIO_NET_F_GSO: Handling GSO-type packets supported", +# "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through co= ntrol channel", +# "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sending gratuitous= packets supported", +# "VIRTIO_NET_F_CTRL_RX_EXTRA: Extra RX mode control supp= orted", +# "VIRTIO_NET_F_CTRL_VLAN: Control channel VLAN filtering= supported", +# "VIRTIO_NET_F_CTRL_RX: Control channel RX mode supporte= d", +# "VIRTIO_NET_F_CTRL_VQ: Control channel available", +# "VIRTIO_NET_F_STATUS: Configuration status field availa= ble", +# "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffe= rs", +# "VIRTIO_NET_F_HOST_UFO: Device can receive UFO", +# "VIRTIO_NET_F_HOST_ECN: Device can receive TSO with ECN= ", +# "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6", +# "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4", +# "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO", +# "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO with EC= N", +# "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6", +# "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4", +# "VIRTIO_NET_F_MAC: Device has given MAC address", +# "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channel offl= oading reconfig. supported", +# "VIRTIO_NET_F_GUEST_CSUM: Driver handling packets with = partial checksum supported", +# "VIRTIO_NET_F_CSUM: Device handling packets with partia= l checksum supported" +# ], +# "transports": [ +# "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields en= abled", +# "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supp= orted", +# "VIRTIO_F_VERSION_1: Device compliant for v1 spec (lega= cy)", +# "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. la= youts", +# "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out = of avail. descs. on VQ" +# ] +# }, # "use-guest-notifier-mask": true, # "vm-running": true, # "queue-sel": 2, @@ -288,3 +440,62 @@ 'data': { 'path': 'str' }, 'returns': 'VirtioStatus', 'features': [ 'unstable' ] } + +## +# @VirtioDeviceStatus: +# +# A structure defined to list the configuration statuses of a virtio +# device +# +# @statuses: List of decoded configuration statuses of the virtio +# device +# +# @unknown-statuses: Virtio device statuses bitmap that have not been deco= ded +# +# Since: 7.1 +## + +{ 'struct': 'VirtioDeviceStatus', + 'data': { 'statuses': [ 'str' ], + '*unknown-statuses': 'uint8' } } + +## +# @VhostDeviceProtocols: +# +# A structure defined to list the vhost user protocol features of a +# Vhost User device +# +# @protocols: List of decoded vhost user protocol features of a vhost +# user device +# +# @unknown-protocols: Vhost user device protocol features bitmap that +# have not been decoded +# +# Since: 7.1 +## + +{ 'struct': 'VhostDeviceProtocols', + 'data': { 'protocols': [ 'str' ], + '*unknown-protocols': 'uint64' } } + +## +# @VirtioDeviceFeatures: +# +# The common fields that apply to most Virtio devices. Some devices +# may not have their own device-specific features (e.g. virtio-rng). +# +# @transports: List of transport features of the virtio device +# +# @dev-features: List of device-specific features (if the device has +# unique features) +# +# @unknown-dev-features: Virtio device features bitmap that have not +# been decoded +# +# Since: 7.1 +## + +{ 'struct': 'VirtioDeviceFeatures', + 'data': { 'transports': [ 'str' ], + '*dev-features': [ 'str' ], + '*unknown-dev-features': 'uint64' } } --=20 2.31.1 From nobody Thu May 2 02:55:14 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=oracle.com); dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1660222786; cv=pass; d=zohomail.com; s=zohoarc; b=ZIJhtNSpSs2I3PUv8bQiYnplfRSSi0jAiih0XirHgRETj7/KdgpWq8I+XhzwM3F7BmLZrfsvXFsFsfcuMgH7pd/jG/DbYkaz9ZAuSKhxlvrOoDj5tcs7MRTPxbspjiG+2GGdBnrizetZvoj4gX7IBavtXvBlFUuco8jli+B+B+g= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660222786; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ICqDxdBHBzczb5LL1j7e+UR/tPOA3oOeU5rbzAZcRv0=; b=Glw3lmkWV+LClJQwS/xF4nKU5hieqMaz5OZESdE2A9QCdcZdvF9RvZtRHublBXGT8lSvZKa59KBndsGAtsyJKRaB36/9xFjfjfcntDI+uf1SDZ3tfLZ4KpPs8u5bSTodtf0aS3fpgGOJP2LcsRUcSMr3Y+tEDeXdxzjU1CZWHNo= 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=oracle.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660222786392942.9217482433038; Thu, 11 Aug 2022 05:59:46 -0700 (PDT) Received: from localhost ([::1]:39306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oM7mn-0002V4-S6 for importer@patchew.org; Thu, 11 Aug 2022 08:59:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM7HC-0002dZ-Or; Thu, 11 Aug 2022 08:27:02 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:60966) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM7HA-0002Xk-BD; Thu, 11 Aug 2022 08:27:02 -0400 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27BCMwd1007994; Thu, 11 Aug 2022 12:26:46 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3huwqj4fug-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Aug 2022 12:26:46 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 27B9AthN005040; Thu, 11 Aug 2022 12:26:44 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3huwqjk2qn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Aug 2022 12:26:44 +0000 Received: from PH0PR10MB4664.namprd10.prod.outlook.com (2603:10b6:510:41::11) by DM5PR10MB1770.namprd10.prod.outlook.com (2603:10b6:4:c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.15; Thu, 11 Aug 2022 12:26:42 +0000 Received: from PH0PR10MB4664.namprd10.prod.outlook.com ([fe80::a9e2:3c71:4b09:789]) by PH0PR10MB4664.namprd10.prod.outlook.com ([fe80::a9e2:3c71:4b09:789%9]) with mapi id 15.20.5525.011; Thu, 11 Aug 2022 12:26:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2022-7-12; bh=ICqDxdBHBzczb5LL1j7e+UR/tPOA3oOeU5rbzAZcRv0=; b=CwQtE05Es7NlgukfB5ynO4Ae6Dliu57H51yl63N7pxJq0AiLGzA7vjhr/YQhaNWc76It MVQByi5c+H2NFrZDJx4Ixo0iNmoyvOCIVbXQn6O0gGhKrgbtbdq2s5XTOV0gx1Pbdc+2 nu4IJ4lPgrQh/lfYaA9Oez2VmmW0BBkWoTFhgesQnThV2a/S0eFXGQMdF3XXAlxrncTu pqpsJm4XrXS9YFgUbwEv0tdXx2uz1NbVW5GGgayhG2qWjSdksFxR7f+AXHvlrHPy1uwT 14KswR2tGnY22O97MgHnmfm6AzAz/07/WNQxtFudz11as17M7QurUv6Hg31HK7ClmXGH FA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NpfDjcrRJKRQzjQMQUUagiEXi/yLaLBnBPcieZYTMfQEQWz9pzieSAWPGgd+qs+YuK8onPu4UAAFA5SG3NrLAHfsZX6DibExNv8cTqWEH1Oely71gSQ9EvmGNAp+s6aK9QHd1to/mRkUmR/BwxmUQE9ZMfqH6T7cxsLGQ3sNCS/biyGwKWkFetr+P14s32QTB0OWI1cVrj9OMKaAFaUEbvp697LuFQBLBwYG7ZgvnKHxDAO1iCLyzvyunWsq+H4j77rmOzkbz86ujhUOlkk6VTlXXfrI8yg4IwW73uzovE/IJTSV0UTqwjFmiKoZKwQOl/nYr/hODEhGgO52hsdo5g== 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=ICqDxdBHBzczb5LL1j7e+UR/tPOA3oOeU5rbzAZcRv0=; b=kxX+8mXQ2rfLl9FZiGQAWqot81jS3p9fJILzm6ROCYa71wwORpsCOOZGYCKOyJGDsmyVWeqKOLhKVHMUZKWhN6TfePshaTDx2kR1SG3SUtB5MYTVMYB0NJ7p1apUZ0z09blHl+JO/vZfntxOlGlv6sn9eUxnNH7PbccJWLVlP2T6MepTtqjizAnpPb12CwN1cKBascrgJyIXpgF12taGF8A8W3r5WLE2SyRDkX6XFqRwinHWJM8SBjBkkmH63JMxnY/Flt3iyiCz+DM0iv2DwzRHXxtnI7qEyoYtgrfwgWpHg5OAuYuuWmGJmLggapsWcqWRbgNXH4c7QULO4zzMyw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ICqDxdBHBzczb5LL1j7e+UR/tPOA3oOeU5rbzAZcRv0=; b=MKwZn91iRE6nxhRTCtYyBBRqsq0KFJbTmWWM+//LRTrqmFOVvT3pL1gcU1SdjtbdTd0oijFZTL8uf0mYcBD5vr0YOju+zmdP++u9cQb8O90RyieV9v+zPHkJJ/vUMdEnTfpxoYsAIAlYD8Cq1mCjVeqci2gymJu9eoKWv2Q3g/0= From: Jonah Palmer To: qemu-devel@nongnu.org Cc: mst@redhat.com, qemu_oss@crudebyte.com, kraxel@redhat.com, si-wei.liu@oracle.com, joao.m.martins@oracle.com, eblake@redhat.com, qemu-block@nongnu.org, david@redhat.com, armbru@redhat.com, arei.gonglei@huawei.com, marcandre.lureau@redhat.com, lvivier@redhat.com, thuth@redhat.com, michael.roth@amd.com, groug@kaod.org, dgilbert@redhat.com, eric.auger@redhat.com, stefanha@redhat.com, boris.ostrovsky@oracle.com, kwolf@redhat.com, mathieu.poirier@linaro.org, raphael.norwitz@nutanix.com, pbonzini@redhat.com Subject: [PATCH v15 4/6] qmp: add QMP commands for virtio/vhost queue-status Date: Thu, 11 Aug 2022 08:24:42 -0400 Message-Id: <1660220684-24909-5-git-send-email-jonah.palmer@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1660220684-24909-1-git-send-email-jonah.palmer@oracle.com> References: <1660220684-24909-1-git-send-email-jonah.palmer@oracle.com> X-ClientProxiedBy: DM6PR03CA0077.namprd03.prod.outlook.com (2603:10b6:5:333::10) To PH0PR10MB4664.namprd10.prod.outlook.com (2603:10b6:510:41::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f2ad972f-0b1a-4391-80a9-08da7b94bf36 X-MS-TrafficTypeDiagnostic: DM5PR10MB1770:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SIG5hP2FN3sH2RfuDcJGdN0WqRkCidStUVh9Qjq69TbbJ21Q2wvr4T0rOexgo0YPm0f1IMAMPeRaDJFbmvj7POSMxuC2yZSWfo/fGp0+3ufEbegv2jf+zlDC9Ayo5CTqlPaoCFJmrmaZJYVOSrvfEt3SGmEQAwPChmFJz3z901nX+44IPJgpbwPnNwJiMVpXvdKnyz6DLU+Pny0m+EUjcdZYp6/TyKFRiJas8mtYkdzYwZAPiJWFKceghKzBSQQJoTlF2F+AAJKwum6ew5hTQ/pUWeQw+wSP1kOqcVeRwuiteYDe7rtnYcQ+YXq2KC9pPEMuKjgHcLF3LU4FuuyY7ogSB4Rr6/z3Wjfl4kYg+myYwnTTKzQau7ewj3xEvaW/S90Y95kUgIxPBzU4eDvEiiETNhX7cxonSaMbALYjBvk+q2CwUpymnhuUQ489O725S0RievGkpHeicFppyff872eoAzQj/T5JCucs0NcyQzUJXx7LShYaP8acXAILFs0q/fvAqSz4XoDTL8nsYSnXQuY6ivZPmKh4Cd04PzdjGnU60jZ/eq12x1Hcf2rTuw3g90mWzlzBv7AfJGK6PpuSkQLqTFD85yEzRsbPjEawrULKWZ5eeVRwAoPC2veVQ9h6iHtgUeJBET7L6DW6gNx+eGOoLaxKLfNPcwYRZLGg2KrpVgSxm2nOaGraD2yIOnJggtcxJCe7EHTBEf6LNjMsf6VzlnEnLHB9O4P7BHPM8AsCz93y81s1/hW1V8M+cu8+0o51FYpjAG42aJv1v72TXMXe9uLGonk9vBBaPqn2uKI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR10MB4664.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(376002)(346002)(136003)(366004)(396003)(39860400002)(6916009)(8936002)(2906002)(186003)(7416002)(44832011)(316002)(30864003)(66556008)(8676002)(4326008)(2616005)(66476007)(5660300002)(66946007)(478600001)(38100700002)(6486002)(38350700002)(36756003)(41300700001)(26005)(6512007)(86362001)(6506007)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?RnZZ4OSNJjePBWO3JFDOt1gAXyjRYj51kOsmkOeLALMRuw5aVN30Vn2pyoLi?= =?us-ascii?Q?qfCKBruVlfBYTf9A3Y3+fJ4+YzQVXGrhe0is3SdpMDeMl16VXeAGEwM/njBx?= =?us-ascii?Q?lwGHTj04UsNO9CftiYn2bTs3W5H1umNWNGy1b/ZgOdZ8wF6nXfqIu9KttSwF?= =?us-ascii?Q?s0YMJJM5MbrrbmlTq+HIdCujz4E4UUpc4aOq+aXZ6NHI8P6IVbHji++PuXEi?= =?us-ascii?Q?M5FP2RE3oiBX2+ir3kgktoyGnUfed3yV26MyVtgRTir03Mpw1l16QOR+UQlj?= =?us-ascii?Q?Sb9Pz86/CjFwZL93dE/aZBvQKo1kLdpLDQQyydt5xIeT1thaw7CDUAXH+m/E?= =?us-ascii?Q?p3XXkqgp6kBuof2WSHqMros3d02MfnyoTRk63G9eK1XI+ps0mFM+HJOjndGN?= =?us-ascii?Q?jHB9k5lDGbx3VdE+RhWVV5dcnjXLEnnObycuLA+K4riXi4IsUP/hz64QWYpN?= =?us-ascii?Q?DXhIZcLWiG3IHUt5Shqoq1UWNo7WZKJHkqmGZm3k5HrpzgPjuyUCdZL7W1AE?= =?us-ascii?Q?zi8j84wyS0eaN2s8f2VVSUGA2gaWKL97YLpOCRMM0B63KD9VBlXLzSlh11Tf?= =?us-ascii?Q?eCqyoAc0KNccSeI5SPYzyN5UW9tdtN4hVAZ7HeVn8eJove+Okgs3LounoNOO?= =?us-ascii?Q?yClJoISgHGGrCrsMkthwJiymmjvqGa8Ytr5lWKkKrg01dcclqj3PtVPTv2qV?= =?us-ascii?Q?4cICTVaRxDPjjQgQEdwWSI8N9TwSF7GyLBMbGCRUR57LrQI1DKVf1el/fww2?= =?us-ascii?Q?rxuH347uPPp2v+pEs/YRysprO+j3BFjoJyR/5CTu68ZnRQag4/3YYP/+wy2Q?= =?us-ascii?Q?V7E7sKnVI4iW1L+2bLoIgjnLo6GFlMFpoy6RGAEBHwkbKpGtZpWTL/IiJYos?= =?us-ascii?Q?DsMF+0qlq7nQlC+WljMMrTL20W4U8aA3Q39/SIau66bc80dbxu8wWvtZAYmD?= =?us-ascii?Q?zWG4I/2QEo2w109686LPVuvbWpkVxgT3JvPIRbFsYgE1hsXblb+IcnquRwHT?= =?us-ascii?Q?qOMxsxDSmJUf5M1qDHbjj7h7rTYhtpHcvcHyrghS4yfJzwzHGijuwYaBb6qd?= =?us-ascii?Q?qlVqlhufn5u1RKsL8lfuqad6brUEXUrGx1eOpptSdpyrK2g1SnbopsJZzNkT?= =?us-ascii?Q?1up0rqZOQeL58EG8PEx8nXqolS37fJLdH3HOgm53S/BB6QUXTeh5ehJ3R9JN?= =?us-ascii?Q?XK7k1D6awdWPbVaUUTGs2QxXCHpgaJli6RU8NPzCMUsbDNDyhbVC0vORmHj8?= =?us-ascii?Q?uc25+agAbcftPnWMYm2ef/XKhTpNlfpWCgcRd06Ze55V+dl3nPpWzCqoxk3z?= =?us-ascii?Q?umotuDUaP33V2j3II6seIXZ/hR2Vw7K4VmEfT5G3RihCMs71pCFo1xTlrPzI?= =?us-ascii?Q?FbvEuTiauASkE1BYwJxwcv2qZu+hmSVUrRrbj4DL+GzNOXNP/Z4ivKIo/gIx?= =?us-ascii?Q?JfWKG2GRVt7FzurA6e1sHNy/tnJkxpIGfPDyZEyQEAYi6ZUD3ySl1DF/6clZ?= =?us-ascii?Q?DS9zHVWgFhWLVwxn5p2zHIy+PDRGBvAGGZkhCEdZ76eOzqxOMVTrKDxfN9RY?= =?us-ascii?Q?ztZqxiyLxm8nPqRgAauvhZZ3XQWO2YhMBmg1QKg9?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2ad972f-0b1a-4391-80a9-08da7b94bf36 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB4664.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2022 12:26:42.1617 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UDpoTKJNeN5CYdDYECEy98H8TE1aPdH+gPT3FuMjNiktCr/ON83RSM4fZ5L/CGrKX+Cj1L8HEsd24gzYyNf0iw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR10MB1770 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-11_05,2022-08-11_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 spamscore=0 bulkscore=0 adultscore=0 malwarescore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208110038 X-Proofpoint-ORIG-GUID: 9C8X689G7uO9imfoxttY7XkrF_9EqADN X-Proofpoint-GUID: 9C8X689G7uO9imfoxttY7XkrF_9EqADN 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=205.220.165.32; envelope-from=jonah.palmer@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1660222788648100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Laurent Vivier These new commands show the internal status of a VirtIODevice's VirtQueue and a vhost device's vhost_virtqueue (if active). Signed-off-by: Laurent Vivier Signed-off-by: Jonah Palmer --- hw/virtio/virtio-stub.c | 14 +++ hw/virtio/virtio.c | 103 ++++++++++++++++ qapi/virtio.json | 256 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 373 insertions(+) diff --git a/hw/virtio/virtio-stub.c b/hw/virtio/virtio-stub.c index 0b432e8de7..13e5f93652 100644 --- a/hw/virtio/virtio-stub.c +++ b/hw/virtio/virtio-stub.c @@ -17,3 +17,17 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path= , Error **errp) { return qmp_virtio_unsupported(errp); } + +VirtVhostQueueStatus *qmp_x_query_virtio_vhost_queue_status(const char *pa= th, + uint16_t queue, + Error **errp) +{ + return qmp_virtio_unsupported(errp); +} + +VirtQueueStatus *qmp_x_query_virtio_queue_status(const char *path, + uint16_t queue, + Error **errp) +{ + return qmp_virtio_unsupported(errp); +} diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 23bdc77a95..dc73b82b38 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -4670,6 +4670,109 @@ VirtioStatus *qmp_x_query_virtio_status(const char = *path, Error **errp) return status; } =20 +VirtVhostQueueStatus *qmp_x_query_virtio_vhost_queue_status(const char *pa= th, + uint16_t queue, + Error **errp) +{ + VirtIODevice *vdev; + VirtVhostQueueStatus *status; + + vdev =3D virtio_device_find(path); + if (vdev =3D=3D NULL) { + error_setg(errp, "Path %s is not a VirtIODevice", path); + return NULL; + } + + if (!vdev->vhost_started) { + error_setg(errp, "Error: vhost device has not started yet"); + return NULL; + } + + VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_GET_CLASS(vdev); + struct vhost_dev *hdev =3D vdc->get_vhost(vdev); + + if (queue < hdev->vq_index || queue >=3D hdev->vq_index + hdev->nvqs) { + error_setg(errp, "Invalid vhost virtqueue number %d", queue); + return NULL; + } + + status =3D g_new0(VirtVhostQueueStatus, 1); + status->name =3D g_strdup(vdev->name); + status->kick =3D hdev->vqs[queue].kick; + status->call =3D hdev->vqs[queue].call; + status->desc =3D (uintptr_t)hdev->vqs[queue].desc; + status->avail =3D (uintptr_t)hdev->vqs[queue].avail; + status->used =3D (uintptr_t)hdev->vqs[queue].used; + status->num =3D hdev->vqs[queue].num; + status->desc_phys =3D hdev->vqs[queue].desc_phys; + status->desc_size =3D hdev->vqs[queue].desc_size; + status->avail_phys =3D hdev->vqs[queue].avail_phys; + status->avail_size =3D hdev->vqs[queue].avail_size; + status->used_phys =3D hdev->vqs[queue].used_phys; + status->used_size =3D hdev->vqs[queue].used_size; + + return status; +} + +VirtQueueStatus *qmp_x_query_virtio_queue_status(const char *path, + uint16_t queue, + Error **errp) +{ + VirtIODevice *vdev; + VirtQueueStatus *status; + + vdev =3D virtio_device_find(path); + if (vdev =3D=3D NULL) { + error_setg(errp, "Path %s is not a VirtIODevice", path); + return NULL; + } + + if (queue >=3D VIRTIO_QUEUE_MAX || !virtio_queue_get_num(vdev, queue))= { + error_setg(errp, "Invalid virtqueue number %d", queue); + return NULL; + } + + status =3D g_new0(VirtQueueStatus, 1); + status->name =3D g_strdup(vdev->name); + status->queue_index =3D vdev->vq[queue].queue_index; + status->inuse =3D vdev->vq[queue].inuse; + status->vring_num =3D vdev->vq[queue].vring.num; + status->vring_num_default =3D vdev->vq[queue].vring.num_default; + status->vring_align =3D vdev->vq[queue].vring.align; + status->vring_desc =3D vdev->vq[queue].vring.desc; + status->vring_avail =3D vdev->vq[queue].vring.avail; + status->vring_used =3D vdev->vq[queue].vring.used; + status->used_idx =3D vdev->vq[queue].used_idx; + status->signalled_used =3D vdev->vq[queue].signalled_used; + status->signalled_used_valid =3D vdev->vq[queue].signalled_used_valid; + + if (vdev->vhost_started) { + VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_GET_CLASS(vdev); + struct vhost_dev *hdev =3D vdc->get_vhost(vdev); + + /* check if vq index exists for vhost as well */ + if (queue >=3D hdev->vq_index && queue < hdev->vq_index + hdev->nv= qs) { + status->has_last_avail_idx =3D true; + + int vhost_vq_index =3D + hdev->vhost_ops->vhost_get_vq_index(hdev, queue); + struct vhost_vring_state state =3D { + .index =3D vhost_vq_index, + }; + + status->last_avail_idx =3D + hdev->vhost_ops->vhost_get_vring_base(hdev, &state); + } + } else { + status->has_shadow_avail_idx =3D true; + status->has_last_avail_idx =3D true; + status->last_avail_idx =3D vdev->vq[queue].last_avail_idx; + status->shadow_avail_idx =3D vdev->vq[queue].shadow_avail_idx; + } + + return status; +} + static const TypeInfo virtio_device_info =3D { .name =3D TYPE_VIRTIO_DEVICE, .parent =3D TYPE_DEVICE, diff --git a/qapi/virtio.json b/qapi/virtio.json index c9c8201e66..d9050f3584 100644 --- a/qapi/virtio.json +++ b/qapi/virtio.json @@ -499,3 +499,259 @@ 'data': { 'transports': [ 'str' ], '*dev-features': [ 'str' ], '*unknown-dev-features': 'uint64' } } + +## +# @VirtQueueStatus: +# +# Information of a VirtIODevice VirtQueue, including most members of +# the VirtQueue data structure. +# +# @name: Name of the VirtIODevice that uses this VirtQueue +# +# @queue-index: VirtQueue queue_index +# +# @inuse: VirtQueue inuse +# +# @vring-num: VirtQueue vring.num +# +# @vring-num-default: VirtQueue vring.num_default +# +# @vring-align: VirtQueue vring.align +# +# @vring-desc: VirtQueue vring.desc (descriptor area) +# +# @vring-avail: VirtQueue vring.avail (driver area) +# +# @vring-used: VirtQueue vring.used (device area) +# +# @last-avail-idx: VirtQueue last_avail_idx or return of vhost_dev +# vhost_get_vring_base (if vhost active) +# +# @shadow-avail-idx: VirtQueue shadow_avail_idx +# +# @used-idx: VirtQueue used_idx +# +# @signalled-used: VirtQueue signalled_used +# +# @signalled-used-valid: VirtQueue signalled_used_valid flag +# +# Since: 7.1 +# +## + +{ 'struct': 'VirtQueueStatus', + 'data': { 'name': 'str', + 'queue-index': 'uint16', + 'inuse': 'uint32', + 'vring-num': 'uint32', + 'vring-num-default': 'uint32', + 'vring-align': 'uint32', + 'vring-desc': 'uint64', + 'vring-avail': 'uint64', + 'vring-used': 'uint64', + '*last-avail-idx': 'uint16', + '*shadow-avail-idx': 'uint16', + 'used-idx': 'uint16', + 'signalled-used': 'uint16', + 'signalled-used-valid': 'bool' } } + +## +# @x-query-virtio-queue-status: +# +# Return the status of a given VirtIODevice's VirtQueue +# +# @path: VirtIODevice canonical QOM path +# +# @queue: VirtQueue index to examine +# +# Features: +# @unstable: This command is meant for debugging. +# +# Returns: VirtQueueStatus of the VirtQueue +# +# Notes: last_avail_idx will not be displayed in the case where +# the selected VirtIODevice has a running vhost device and +# the VirtIODevice VirtQueue index (queue) does not exist for +# the corresponding vhost device vhost_virtqueue. Also, +# shadow_avail_idx will not be displayed in the case where +# the selected VirtIODevice has a running vhost device. +# +# Since: 7.1 +# +# Examples: +# +# 1. Get VirtQueueStatus for virtio-vsock (vhost-vsock running) +# +# -> { "execute": "x-query-virtio-queue-status", +# "arguments": { "path": "/machine/peripheral/vsock0/virtio-backend", +# "queue": 1 } +# } +# <- { "return": { +# "signalled-used": 0, +# "inuse": 0, +# "name": "vhost-vsock", +# "vring-align": 4096, +# "vring-desc": 5217370112, +# "signalled-used-valid": false, +# "vring-num-default": 128, +# "vring-avail": 5217372160, +# "queue-index": 1, +# "last-avail-idx": 0, +# "vring-used": 5217372480, +# "used-idx": 0, +# "vring-num": 128 +# } +# } +# +# 2. Get VirtQueueStatus for virtio-serial (no vhost) +# +# -> { "execute": "x-query-virtio-queue-status", +# "arguments": { "path": "/machine/peripheral-anon/device[0]/virtio-b= ackend", +# "queue": 20 } +# } +# <- { "return": { +# "signalled-used": 0, +# "inuse": 0, +# "name": "virtio-serial", +# "vring-align": 4096, +# "vring-desc": 5182074880, +# "signalled-used-valid": false, +# "vring-num-default": 128, +# "vring-avail": 5182076928, +# "queue-index": 20, +# "last-avail-idx": 0, +# "vring-used": 5182077248, +# "used-idx": 0, +# "shadow-avail-idx": 0, +# "vring-num": 128 +# } +# } +# +## + +{ 'command': 'x-query-virtio-queue-status', + 'data': { 'path': 'str', 'queue': 'uint16' }, + 'returns': 'VirtQueueStatus', + 'features': [ 'unstable' ] } + +## +# @VirtVhostQueueStatus: +# +# Information of a vhost device's vhost_virtqueue, including most +# members of the vhost_dev vhost_virtqueue data structure. +# +# @name: Name of the VirtIODevice that uses this vhost_virtqueue +# +# @kick: vhost_virtqueue kick +# +# @call: vhost_virtqueue call +# +# @desc: vhost_virtqueue desc +# +# @avail: vhost_virtqueue avail +# +# @used: vhost_virtqueue used +# +# @num: vhost_virtqueue num +# +# @desc-phys: vhost_virtqueue desc_phys (descriptor area phys. addr.) +# +# @desc-size: vhost_virtqueue desc_size +# +# @avail-phys: vhost_virtqueue avail_phys (driver area phys. addr.) +# +# @avail-size: vhost_virtqueue avail_size +# +# @used-phys: vhost_virtqueue used_phys (device area phys. addr.) +# +# @used-size: vhost_virtqueue used_size +# +# Since: 7.1 +# +## + +{ 'struct': 'VirtVhostQueueStatus', + 'data': { 'name': 'str', + 'kick': 'int', + 'call': 'int', + 'desc': 'uint64', + 'avail': 'uint64', + 'used': 'uint64', + 'num': 'int', + 'desc-phys': 'uint64', + 'desc-size': 'uint32', + 'avail-phys': 'uint64', + 'avail-size': 'uint32', + 'used-phys': 'uint64', + 'used-size': 'uint32' } } + +## +# @x-query-virtio-vhost-queue-status: +# +# Return information of a given vhost device's vhost_virtqueue +# +# @path: VirtIODevice canonical QOM path +# +# @queue: vhost_virtqueue index to examine +# +# Features: +# @unstable: This command is meant for debugging. +# +# Returns: VirtVhostQueueStatus of the vhost_virtqueue +# +# Since: 7.1 +# +# Examples: +# +# 1. Get vhost_virtqueue status for vhost-crypto +# +# -> { "execute": "x-query-virtio-vhost-queue-status", +# "arguments": { "path": "/machine/peripheral/crypto0/virtio-backend", +# "queue": 0 } +# } +# <- { "return": { +# "avail-phys": 5216124928, +# "name": "virtio-crypto", +# "used-phys": 5216127040, +# "avail-size": 2054, +# "desc-size": 16384, +# "used-size": 8198, +# "desc": 140141447430144, +# "num": 1024, +# "call": 0, +# "avail": 140141447446528, +# "desc-phys": 5216108544, +# "used": 140141447448640, +# "kick": 0 +# } +# } +# +# 2. Get vhost_virtqueue status for vhost-vsock +# +# -> { "execute": "x-query-virtio-vhost-queue-status", +# "arguments": { "path": "/machine/peripheral/vsock0/virtio-backend", +# "queue": 0 } +# } +# <- { "return": { +# "avail-phys": 5182261248, +# "name": "vhost-vsock", +# "used-phys": 5182261568, +# "avail-size": 262, +# "desc-size": 2048, +# "used-size": 1030, +# "desc": 140141413580800, +# "num": 128, +# "call": 0, +# "avail": 140141413582848, +# "desc-phys": 5182259200, +# "used": 140141413583168, +# "kick": 0 +# } +# } +# +## + +{ 'command': 'x-query-virtio-vhost-queue-status', + 'data': { 'path': 'str', 'queue': 'uint16' }, + 'returns': 'VirtVhostQueueStatus', + 'features': [ 'unstable' ] } --=20 2.31.1 From nobody Thu May 2 02:55:14 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=oracle.com); dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1660221994; cv=pass; d=zohomail.com; s=zohoarc; b=iya+Oenbp8yEOQvLkIR+J1nmghdELZeIlXdgVIyneg2C2WmMDn/JUkX6t9wPCBPY9okitQ+SaAdfwiK3TKGb5OziCYpH/iEtcFkzhzGqt3Ziev8TqRe3YEFOVX/XEwWW3QBgSHdsQ9YZgpyrVF7jLUGJpKx7PsF/v86WWg1ajd8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660221994; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1KRq+eTXPzCXkuTC27L1hSAgR231etRJ9gqIaA4qzEk=; b=AVUEyDATxx7aQXlo2JTKhhWPn3aek/vBVv/o4Ur9/3TdurE7RbPLRafVYJGKCzjJr7kkjf5ondmlXpK15e3QnGbErJT5QMKtHD3YoOsNcnlWMhKPTlxoenu0yCOUG7t64NqJ5XDB9lOm+SU0jLEnqQrrM+r5AOV+ndqtc+HU//A= 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=oracle.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660221994489854.2551506297862; Thu, 11 Aug 2022 05:46:34 -0700 (PDT) Received: from localhost ([::1]:39912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oM7a2-0007Ja-Bg for importer@patchew.org; Thu, 11 Aug 2022 08:46:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM7HT-0002nT-10; Thu, 11 Aug 2022 08:27:21 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:25456) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM7HQ-0002a0-0s; Thu, 11 Aug 2022 08:27:18 -0400 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27BCMskl025159; Thu, 11 Aug 2022 12:26:57 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3huwqdvjvh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Aug 2022 12:26:56 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 27B9M8Pb035331; Thu, 11 Aug 2022 12:26:54 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2177.outbound.protection.outlook.com [104.47.59.177]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3huwqk2tu2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Aug 2022 12:26:54 +0000 Received: from PH0PR10MB4664.namprd10.prod.outlook.com (2603:10b6:510:41::11) by DM5PR10MB1770.namprd10.prod.outlook.com (2603:10b6:4:c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.15; Thu, 11 Aug 2022 12:26:50 +0000 Received: from PH0PR10MB4664.namprd10.prod.outlook.com ([fe80::a9e2:3c71:4b09:789]) by PH0PR10MB4664.namprd10.prod.outlook.com ([fe80::a9e2:3c71:4b09:789%9]) with mapi id 15.20.5525.011; Thu, 11 Aug 2022 12:26:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2022-7-12; bh=1KRq+eTXPzCXkuTC27L1hSAgR231etRJ9gqIaA4qzEk=; b=1P+MNKOZtfdSr/NqqZrAVx3D5rJG2RuTEccG7FuMI0SZwIfItyskib3KghMttCC6NZD7 HwKBV9VRbmcJdkPox+L5tUM49j1c19r+r2t2E7s3WkhyURfqs5JzbRg/Vszyi+DVr+KU lBIcDX5sEn+IpeojH2RzzXBaeyOmdkhnJPNzjOfPlLfdsemMWguWW5+woLJpaCnoPYYr JteiPq06NmDRtARLWsS0gbsn6nlv5yqE6/Awy6f0ex3H2ZPtFspnWNWB8b3rFj+jyHTj vCscyQAsSpF1lrvSM+7bz02W4j7TZhR7uamMpgiRfhim+nD/0Aa6QUHKgd6p6Gp1XvJ2 ZQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j07jImYG8qYPnneIuKzx3FN0MAKTOAe+vAKQ2ZUSLq3M0wFpKMLhvM0znxgo3SPwn8QG2mX9s9NprxVpJG0u0bYIh02872xf42wtYATehHsav9vza9a9+oBAunuhV/ZbCHQ+soK086pg0NT1SzwKPueFRakEbNGTw00K/wP9ESFk3vStFwnS0N+cDDnT0IHkBr7gqdHeS/p1fRFaEKXuJ0PDGP9vtJUPnOTkldQpw/+K8tT3S6ZqUMc57SummId9J68c7ZcSWpi3A0c0QyXi9C8fbbd4O+eQdECE7EftG/skMrUeuWm2zuM9RM4VTy3kdFbQawfJP6CKFejX1op95Q== 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=1KRq+eTXPzCXkuTC27L1hSAgR231etRJ9gqIaA4qzEk=; b=dkS7ZqE7vCyiKMTD+MxLmF279Tyu3IMC+gowGURUrnGckkv3xBnQbQ0hTBsv46hoQEujkwehki2JLR6iWEy6PkAxNOre7PI+vT6Zeyy+o4BpqdWf+OgrlUjZvFo/alU6cFxN+f1ht3NSxQBBmxwZ9VG+5YElSVXMEG816Vo/JsfVNWbIyopK2iOo10nEY6AdrnHXcrk6OH5dWwoNeeGRlqG1eABfT7pfErl11XSYAAq9/8drpPopPUvY78H9dNGvUAz4Nk5e4mhSn/guPdlslticV5+XyobsuHb9ru8Ddfe1y9neKeH+4LIbviSu9/pB2gqDuzgUQgKLUgPxcSL8DA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1KRq+eTXPzCXkuTC27L1hSAgR231etRJ9gqIaA4qzEk=; b=p8TQNHol3jU5+4MzVV3u6sWYn3M/1mw6vJoQzX+pWrzqRIHgWDzWQelEMle7bC0SnhuKKwFgfSfhr834oqslPua+jjFHsQIAPc62ADZZhnqVk54bq4MZ9wfzEacUuHyRpS0Pg8ewcTomfFk/yBeyl3fTvOxSdFlLjJ+nbBd2caQ= From: Jonah Palmer To: qemu-devel@nongnu.org Cc: mst@redhat.com, qemu_oss@crudebyte.com, kraxel@redhat.com, si-wei.liu@oracle.com, joao.m.martins@oracle.com, eblake@redhat.com, qemu-block@nongnu.org, david@redhat.com, armbru@redhat.com, arei.gonglei@huawei.com, marcandre.lureau@redhat.com, lvivier@redhat.com, thuth@redhat.com, michael.roth@amd.com, groug@kaod.org, dgilbert@redhat.com, eric.auger@redhat.com, stefanha@redhat.com, boris.ostrovsky@oracle.com, kwolf@redhat.com, mathieu.poirier@linaro.org, raphael.norwitz@nutanix.com, pbonzini@redhat.com Subject: [PATCH v15 5/6] qmp: add QMP command x-query-virtio-queue-element Date: Thu, 11 Aug 2022 08:24:43 -0400 Message-Id: <1660220684-24909-6-git-send-email-jonah.palmer@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1660220684-24909-1-git-send-email-jonah.palmer@oracle.com> References: <1660220684-24909-1-git-send-email-jonah.palmer@oracle.com> X-ClientProxiedBy: DM6PR03CA0077.namprd03.prod.outlook.com (2603:10b6:5:333::10) To PH0PR10MB4664.namprd10.prod.outlook.com (2603:10b6:510:41::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5d0c5a14-a150-41c1-0a6b-08da7b94c43c X-MS-TrafficTypeDiagnostic: DM5PR10MB1770:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 80A0pOjcEm5n0p5o5RIGYM/4Dw+V72Sq/kIZmuGgMKTDL6YyDfjnytBBlkTxxflL+evLKpBJeHToRzYWZT+FzFR7qpauJhwdncNXsWQUkfryRa12Gcj5ytNiZ+r4y/ohtvTvvpdmMzF9D+fagz+fVsvB6pUlwrur7Wkt6ZKrUAKzm+3hwTi3YE4hkyArQbm44Hh6KH4+cNOSezmyf9ay+YyLe6m6vMiAtPHHS0Khw3ymBJGFHBCSKQlpbDvVw8gUpE/6D9IYmwQRh38dTokmIQAga4WTHMccRLx+5MGz+/R66G6TcpbpNhjJXUiNX7oPyiV7wTUNm3oqmkk3sU0wcJTbqj/DnScetPpakWPnensxUbVas8RxeI/hZpjtxUUqzu5/iBQvon/SXIqUnEYV6z59sr7Q+XbwTTnMi/KFS39eWU43iv5ObUFD9wJUfC3hBArI0tYIwM8JKTvgTJSXYOyALPlAX0RDx1wz6aOatBGvnPp0gv8xgTGxnhUUzP2hBd8zs4iNDqgt1ZnMnLYB9pUBLv1Z89WS0kUZ60UJJmo0TgcB98p8aDEvL6B+ihyq3ttp0ON9fQwWyCDsRgYr5B+OLfBwByo8P23Ao6npPJrEJSd3TblYs2LNbWEjTWYn7kdYpIsuMkEhbUQwLPG1Fy634HHVfUWWqdTxbnVZQ7AKaSY1dN5Lqy12JBYrESxn/sxD2AR791dKAu4WeoAd8Rcm6FQCVz2O8Tdd7wa+finmtlOBHIkOvOoYLWm5RGmiUXMYIH8opw+btmVuyaWrLoVUS+2zoBtb6xKSEOFf/K0= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR10MB4664.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(376002)(346002)(136003)(366004)(396003)(39860400002)(6916009)(8936002)(2906002)(186003)(7416002)(44832011)(316002)(66556008)(8676002)(4326008)(2616005)(66476007)(5660300002)(66946007)(478600001)(38100700002)(6486002)(6666004)(38350700002)(36756003)(41300700001)(26005)(6512007)(86362001)(6506007)(52116002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?6UGsfL3WkZ5KW+5nE36hEUbEF+ZY2TFPZBZBHs8EpQSMvzydffLNmAbwdsmg?= =?us-ascii?Q?W6iSXntvN6O1AzEqByAas314t8Qsl4E9YJTdiwkZ9wSRPsxZNSg0L6ZxWMvS?= =?us-ascii?Q?6oN7GxTQlUXn/7BYHsXPTFdyDzGG2wqKpl9d39tu74ccI0KhMs0KPUt0fE2z?= =?us-ascii?Q?vZa8AgldWKoQk3XsfGy/jFGDcD/Wqsq0H9uiSM9MeOk2LMIQuH0v1hyeYVal?= =?us-ascii?Q?pBj9bKIQt+EBZ9B9+iVLQZo7sbhIa7WL3cgNF7sSe1iIvBPM7oF9t8sf+goO?= =?us-ascii?Q?5y6grG+YzDebEbyc4om9e3J2nhI1gPQZwItPd1kU5oOCus2Jhv6NtwcNbqHG?= =?us-ascii?Q?0Xg+mQUbEAPsTo8Ps7DPHgLKL68nKcidACOkeNTNDtTVpioOrmbzuBMVlq/z?= =?us-ascii?Q?I1RJUIZXUrQ+44LiFe9acsfAVF6FlpikW9ZBmtvlBrxcdGdyW4hvUhFa2Apa?= =?us-ascii?Q?pk1qbXEYR+T+dshpIxlVVNhy5fiPeAyr5H0KwfMxLH/To237mJpP7YpJ+NIR?= =?us-ascii?Q?wGIEzBt/zJMIxQc0aqyg224B1c+AEoApSGn+IaJJQ76QgYhYxJk8gq3SPQh/?= =?us-ascii?Q?PWkhFidtiYBGputUhY/GBd63AT2Qk/z2fJJmqgj8WWlryV/UPsJ1FIoas/PX?= =?us-ascii?Q?eFU6dM+8TJ3L9ynS9KyCJfA4lUgiWc29G3KDZpbtBL8PHVbWcvoWUzfOGKHb?= =?us-ascii?Q?2xwmOZdp9DEyEQrb/Csnew1SJOqUQgKm044VIfFf9Z9yVYy3rX3RF/0BsoA9?= =?us-ascii?Q?DxWSWgLuufMISfNmOhFja6WOuFwaVSDq4DWKIzLM1eoeyswA0uuu5CSv7nbw?= =?us-ascii?Q?KTz9DxXWATTMKnoh31RAEbY8TA+4fwmM/lCV1U9Y7rZSsA11PTMlv5dUzL0U?= =?us-ascii?Q?2wxsAa/0zWvyuECVs651G4meELOLg8kKhAmzMtrwLPbpoziK6Sn0Tmbpfyd6?= =?us-ascii?Q?8+Fl14YQq4/HBVWR0htFZE4Cyg+69vJuG3F9bwYslf9TRhK1KmwU5yCNmxb3?= =?us-ascii?Q?g1Paq6JB8KxmlIA2LoWF4H0Uc+fst9qRDSFU/+CebT33YrLGetY1JrmFr2Z5?= =?us-ascii?Q?VCKtPgUO3UpBskU443YKsoQwu0h9x0jDCSZWuEETOBqBW+1bQvODJxbkdQUT?= =?us-ascii?Q?DRdwePTITKhd8Uc9Hzmu7BoC89KHyMWm/k9yTKP5w2fnTeQ1YqzWn+COIgU8?= =?us-ascii?Q?WeXKBdOsotjMepgL4afUdV0NzT4PI9lINcxrgHLTvaxcWV7biBxwhJpKhycb?= =?us-ascii?Q?Z6Q5dk727X+fj44AFqEMcRbTNHj3GoUYAPZBXcjaBmkULkz0lwWrhhZ+Tc31?= =?us-ascii?Q?5pDdSzm+CJ3kmE3g84VVkj2JgQqO/k9XUJXc9MVL0E3OBa5OWbPK3QRyxAjK?= =?us-ascii?Q?6rC9eaGrS80fBoJNU3e+jcNskR8eXWXLsth0qtzdHwSd81Yg2Oix39x3f8/6?= =?us-ascii?Q?Yc57p2eaADExdkgfKpbAILsOo/NbbpUa7b4XBjkjIUSWl78N0EyBNQ5qlTFA?= =?us-ascii?Q?yA2rm9R29i1tGZ4vDY0yDHXXEJtCWzgDp79ESGJVqWgo3F2LFvsL/zW1cFha?= =?us-ascii?Q?sq/qh7cCJ/6XQ9IBUWhuRdbJAcMdAzVETaVEHl0R?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d0c5a14-a150-41c1-0a6b-08da7b94c43c X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB4664.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2022 12:26:50.6335 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Elmdstt4kHRrUhOL5WEOuj9+5qenGB+jvZYJFBGssuyEmvJ2mgvzwSmWGd3+DJmfDYDT1z1XfIXfIK9bGGZX+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR10MB1770 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-11_05,2022-08-11_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208110038 X-Proofpoint-GUID: ykVq124CrZea9Tzzjbs8WZ_tVU53hAsV X-Proofpoint-ORIG-GUID: ykVq124CrZea9Tzzjbs8WZ_tVU53hAsV 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=205.220.165.32; envelope-from=jonah.palmer@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1660221996506100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Laurent Vivier This new command shows the information of a VirtQueue element. [Note: Up until v10 of this patch series, virtio.json had many (15+) enums defined (e.g. decoded device features, statuses, etc.). In v10 most of these enums were removed and replaced with string literals. By doing this we get (1) simpler schema, (2) smaller generated code, and (3) less maintenance burden for when new things are added (e.g. devices, device features, etc.).] Signed-off-by: Laurent Vivier Signed-off-by: Jonah Palmer --- hw/virtio/virtio-stub.c | 9 ++ hw/virtio/virtio.c | 154 +++++++++++++++++++++++++++++++ qapi/virtio.json | 197 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 360 insertions(+) diff --git a/hw/virtio/virtio-stub.c b/hw/virtio/virtio-stub.c index 13e5f93652..7ddb22cc5e 100644 --- a/hw/virtio/virtio-stub.c +++ b/hw/virtio/virtio-stub.c @@ -31,3 +31,12 @@ VirtQueueStatus *qmp_x_query_virtio_queue_status(const c= har *path, { return qmp_virtio_unsupported(errp); } + +VirtioQueueElement *qmp_x_query_virtio_queue_element(const char *path, + uint16_t queue, + bool has_index, + uint16_t index, + Error **errp) +{ + return qmp_virtio_unsupported(errp); +} diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index dc73b82b38..c6e244a3c9 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -823,6 +823,19 @@ static inline void vring_used_write(VirtQueue *vq, VRi= ngUsedElem *uelem, address_space_cache_invalidate(&caches->used, pa, sizeof(VRingUsedElem= )); } =20 +/* Called within rcu_read_lock(). */ +static inline uint16_t vring_used_flags(VirtQueue *vq) +{ + VRingMemoryRegionCaches *caches =3D vring_get_region_caches(vq); + hwaddr pa =3D offsetof(VRingUsed, flags); + + if (!caches) { + return 0; + } + + return virtio_lduw_phys_cached(vq->vdev, &caches->used, pa); +} + /* Called within rcu_read_lock(). */ static uint16_t vring_used_idx(VirtQueue *vq) { @@ -4773,6 +4786,147 @@ VirtQueueStatus *qmp_x_query_virtio_queue_status(co= nst char *path, return status; } =20 +static strList *qmp_decode_vring_desc_flags(uint16_t flags) +{ + strList *list =3D NULL; + strList *node; + int i; + + struct { + uint16_t flag; + const char *value; + } map[] =3D { + { VRING_DESC_F_NEXT, "next" }, + { VRING_DESC_F_WRITE, "write" }, + { VRING_DESC_F_INDIRECT, "indirect" }, + { 1 << VRING_PACKED_DESC_F_AVAIL, "avail" }, + { 1 << VRING_PACKED_DESC_F_USED, "used" }, + { 0, "" } + }; + + for (i =3D 0; map[i].flag; i++) { + if ((map[i].flag & flags) =3D=3D 0) { + continue; + } + node =3D g_malloc0(sizeof(strList)); + node->value =3D g_strdup(map[i].value); + node->next =3D list; + list =3D node; + } + + return list; +} + +VirtioQueueElement *qmp_x_query_virtio_queue_element(const char *path, + uint16_t queue, + bool has_index, + uint16_t index, + Error **errp) +{ + VirtIODevice *vdev; + VirtQueue *vq; + VirtioQueueElement *element =3D NULL; + + vdev =3D virtio_device_find(path); + if (vdev =3D=3D NULL) { + error_setg(errp, "Path %s is not a VirtIO device", path); + return NULL; + } + + if (queue >=3D VIRTIO_QUEUE_MAX || !virtio_queue_get_num(vdev, queue))= { + error_setg(errp, "Invalid virtqueue number %d", queue); + return NULL; + } + vq =3D &vdev->vq[queue]; + + if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) { + error_setg(errp, "Packed ring not supported"); + return NULL; + } else { + unsigned int head, i, max; + VRingMemoryRegionCaches *caches; + MemoryRegionCache indirect_desc_cache =3D MEMORY_REGION_CACHE_INVA= LID; + MemoryRegionCache *desc_cache; + VRingDesc desc; + VirtioRingDescList *list =3D NULL; + VirtioRingDescList *node; + int rc; int ndescs; + + RCU_READ_LOCK_GUARD(); + + max =3D vq->vring.num; + + if (!has_index) { + head =3D vring_avail_ring(vq, vq->last_avail_idx % vq->vring.n= um); + } else { + head =3D vring_avail_ring(vq, index % vq->vring.num); + } + i =3D head; + + caches =3D vring_get_region_caches(vq); + if (!caches) { + error_setg(errp, "Region caches not initialized"); + return NULL; + } + if (caches->desc.len < max * sizeof(VRingDesc)) { + error_setg(errp, "Cannot map descriptor ring"); + return NULL; + } + + desc_cache =3D &caches->desc; + vring_split_desc_read(vdev, &desc, desc_cache, i); + if (desc.flags & VRING_DESC_F_INDIRECT) { + int64_t len; + len =3D address_space_cache_init(&indirect_desc_cache, vdev->d= ma_as, + desc.addr, desc.len, false); + desc_cache =3D &indirect_desc_cache; + if (len < desc.len) { + error_setg(errp, "Cannot map indirect buffer"); + goto done; + } + + max =3D desc.len / sizeof(VRingDesc); + i =3D 0; + vring_split_desc_read(vdev, &desc, desc_cache, i); + } + + element =3D g_new0(VirtioQueueElement, 1); + element->avail =3D g_new0(VirtioRingAvail, 1); + element->used =3D g_new0(VirtioRingUsed, 1); + element->name =3D g_strdup(vdev->name); + element->index =3D head; + element->avail->flags =3D vring_avail_flags(vq); + element->avail->idx =3D vring_avail_idx(vq); + element->avail->ring =3D head; + element->used->flags =3D vring_used_flags(vq); + element->used->idx =3D vring_used_idx(vq); + ndescs =3D 0; + + do { + /* A buggy driver may produce an infinite loop */ + if (ndescs >=3D max) { + break; + } + node =3D g_new0(VirtioRingDescList, 1); + node->value =3D g_new0(VirtioRingDesc, 1); + node->value->addr =3D desc.addr; + node->value->len =3D desc.len; + node->value->flags =3D qmp_decode_vring_desc_flags(desc.flags); + node->next =3D list; + list =3D node; + + ndescs++; + rc =3D virtqueue_split_read_next_desc(vdev, &desc, desc_cache, + max, &i); + } while (rc =3D=3D VIRTQUEUE_READ_DESC_MORE); + element->descs =3D list; +done: + address_space_cache_destroy(&indirect_desc_cache); + } + + return element; +} + static const TypeInfo virtio_device_info =3D { .name =3D TYPE_VIRTIO_DEVICE, .parent =3D TYPE_DEVICE, diff --git a/qapi/virtio.json b/qapi/virtio.json index d9050f3584..e47a8fb2e0 100644 --- a/qapi/virtio.json +++ b/qapi/virtio.json @@ -755,3 +755,200 @@ 'data': { 'path': 'str', 'queue': 'uint16' }, 'returns': 'VirtVhostQueueStatus', 'features': [ 'unstable' ] } + +## +# @VirtioRingDesc: +# +# Information regarding the vring descriptor area +# +# @addr: Guest physical address of the descriptor area +# +# @len: Length of the descriptor area +# +# @flags: List of descriptor flags +# +# Since: 7.1 +# +## + +{ 'struct': 'VirtioRingDesc', + 'data': { 'addr': 'uint64', + 'len': 'uint32', + 'flags': [ 'str' ] } } + +## +# @VirtioRingAvail: +# +# Information regarding the avail vring (a.k.a. driver area) +# +# @flags: VRingAvail flags +# +# @idx: VRingAvail index +# +# @ring: VRingAvail ring[] entry at provided index +# +# Since: 7.1 +# +## + +{ 'struct': 'VirtioRingAvail', + 'data': { 'flags': 'uint16', + 'idx': 'uint16', + 'ring': 'uint16' } } + +## +# @VirtioRingUsed: +# +# Information regarding the used vring (a.k.a. device area) +# +# @flags: VRingUsed flags +# +# @idx: VRingUsed index +# +# Since: 7.1 +# +## + +{ 'struct': 'VirtioRingUsed', + 'data': { 'flags': 'uint16', + 'idx': 'uint16' } } + +## +# @VirtioQueueElement: +# +# Information regarding a VirtQueue's VirtQueueElement including +# descriptor, driver, and device areas +# +# @name: Name of the VirtIODevice that uses this VirtQueue +# +# @index: Index of the element in the queue +# +# @descs: List of descriptors (VirtioRingDesc) +# +# @avail: VRingAvail info +# +# @used: VRingUsed info +# +# Since: 7.1 +# +## + +{ 'struct': 'VirtioQueueElement', + 'data': { 'name': 'str', + 'index': 'uint32', + 'descs': [ 'VirtioRingDesc' ], + 'avail': 'VirtioRingAvail', + 'used': 'VirtioRingUsed' } } + +## +# @x-query-virtio-queue-element: +# +# Return the information about a VirtQueue's VirtQueueElement +# +# @path: VirtIODevice canonical QOM path +# +# @queue: VirtQueue index to examine +# +# @index: Index of the element in the queue +# (default: head of the queue) +# +# Features: +# @unstable: This command is meant for debugging. +# +# Returns: VirtioQueueElement information +# +# Since: 7.1 +# +# Examples: +# +# 1. Introspect on virtio-net's VirtQueue 0 at index 5 +# +# -> { "execute": "x-query-virtio-queue-element", +# "arguments": { "path": "/machine/peripheral-anon/device[1]/virtio-b= ackend", +# "queue": 0, +# "index": 5 } +# } +# <- { "return": { +# "index": 5, +# "name": "virtio-net", +# "descs": [ +# { +# "flags": ["write"], +# "len": 1536, +# "addr": 5257305600 +# } +# ], +# "avail": { +# "idx": 256, +# "flags": 0, +# "ring": 5 +# }, +# "used": { +# "idx": 13, +# "flags": 0 +# } +# } +# } +# +# 2. Introspect on virtio-crypto's VirtQueue 1 at head +# +# -> { "execute": "x-query-virtio-queue-element", +# "arguments": { "path": "/machine/peripheral/crypto0/virtio-backend", +# "queue": 1 } +# } +# <- { "return": { +# "index": 0, +# "name": "virtio-crypto", +# "descs": [ +# { +# "flags": [], +# "len": 0, +# "addr": 8080268923184214134 +# } +# ], +# "avail": { +# "idx": 280, +# "flags": 0, +# "ring": 0 +# }, +# "used": { +# "idx": 280, +# "flags": 0 +# } +# } +# } +# +# 3. Introspect on virtio-scsi's VirtQueue 2 at head +# +# -> { "execute": "x-query-virtio-queue-element", +# "arguments": { "path": "/machine/peripheral-anon/device[2]/virtio-b= ackend", +# "queue": 2 } +# } +# <- { "return": { +# "index": 19, +# "name": "virtio-scsi", +# "descs": [ +# { +# "flags": ["used", "indirect", "write"], +# "len": 4099327944, +# "addr": 12055409292258155293 +# } +# ], +# "avail": { +# "idx": 1147, +# "flags": 0, +# "ring": 19 +# }, +# "used": { +# "idx": 280, +# "flags": 0 +# } +# } +# } +# +## + +{ 'command': 'x-query-virtio-queue-element', + 'data': { 'path': 'str', 'queue': 'uint16', '*index': 'uint16' }, + 'returns': 'VirtioQueueElement', + 'features': [ 'unstable' ] } --=20 2.31.1 From nobody Thu May 2 02:55:14 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=oracle.com); dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1660223617; cv=pass; d=zohomail.com; s=zohoarc; b=C9sMYrH6Kp18A2sMrdgKALY9lVCF8sBhhiYDWJgbzxwfknBlzKrD96pNYerwLdwO5mkcHZNXJ6hBCHVQKOoQE2WgEHrR/TqX4An87odScUUHX1mhkWUZX7Os910mU6K990FWKsDzEMUEyhZKRv4xy10cng/Zf/ysuHj3/sq4fHk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660223617; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=W6L/jygsI/LiXGnghNuVDHnzVmKpkn5D8aCNSzxNsTs=; b=Cznx45ZAdUeUm1AyDtFyG4MlSdkBakhR4Y1fvKRuxJ9uxSj1zb8u5KBQjDpB2Pq46ppxD/jo3c+DztvhvgAAnBQMRRRW+zBYkcAki69k8hWpJYPG+d3bWpZ7KqjUAzVKorXquwow8+P8gTR0seE9aTVzGGKp7q2juswe4AXRayI= 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=oracle.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660223617182279.33142255065786; Thu, 11 Aug 2022 06:13:37 -0700 (PDT) Received: from localhost ([::1]:57540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oM80E-0007bS-K4 for importer@patchew.org; Thu, 11 Aug 2022 09:13:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM7HR-0002mc-8P; Thu, 11 Aug 2022 08:27:17 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:22794) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oM7HO-0002Zo-MH; Thu, 11 Aug 2022 08:27:16 -0400 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27BCNC2j009437; Thu, 11 Aug 2022 12:27:01 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3huwqgmeep-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Aug 2022 12:27:01 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 27BC4f4M023707; Thu, 11 Aug 2022 12:27:00 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3huwqh2m8y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Aug 2022 12:27:00 +0000 Received: from PH0PR10MB4664.namprd10.prod.outlook.com (2603:10b6:510:41::11) by DM5PR1001MB2090.namprd10.prod.outlook.com (2603:10b6:4:32::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.19; Thu, 11 Aug 2022 12:26:58 +0000 Received: from PH0PR10MB4664.namprd10.prod.outlook.com ([fe80::a9e2:3c71:4b09:789]) by PH0PR10MB4664.namprd10.prod.outlook.com ([fe80::a9e2:3c71:4b09:789%9]) with mapi id 15.20.5525.011; Thu, 11 Aug 2022 12:26:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2022-7-12; bh=W6L/jygsI/LiXGnghNuVDHnzVmKpkn5D8aCNSzxNsTs=; b=x4LgL1K7vf/AZKcIZbiqAJCDKelyhEL+KTQMrL5cpeTpXl27F2FQIz7q9SFwJtUobEZe VWONWe2AaQwrJ2xMWj1QfpjGOlCB0hYE3YaeUndzsuCiidfa+B3iTiYToxvVllpJCZ2/ NwTxztYIl2bLB3yVaAU4Ri2FWxKuIp3L351Vww/NpDfcpsyvWv7L7VrwN1wUT1ugBR1k xRZauVIlWiXSeqSQ08zaemJDRPyvnuFblf9k0oe3aufRLgQ1PkNk+hPJMywtuUqJH8eT EIUpPW8hk/34lGdnBIV6lN3kFHxizfeJt/4d2YvjVY1eUcnoMdA1eSsJfU1J7sY4GEOk XA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LnIUlHaEMhADw49dc+0I8jDjaIgeaIO8i8lTsD7U05/41PPBFvKX/nNbfzMzaReCAAhtHB+Ksa2/jUEngNJ0m3oLQP68lbTuO5xnOHKiDInuDXD0RkJYwpGxX6FTDMlDJWItPdrDCDqGQA41ya/eOeFEif2syaUpo04TYqQmEAAzaigHvsvEuBgMEGC+4e4pIdqziVVV2zIXXDhPFD0Ap1snZ8XPmq7MBj4RFIAJGHpY0Z4mETYB2KYaCDKiZtc1L9thobTh254YVGEW2HB59SEqFayJylMADmwEBGHpc+/DshKd9y+7M/5hwGNJ2t5Wmlnb62xk+TlXqTwhHbyrsg== 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=W6L/jygsI/LiXGnghNuVDHnzVmKpkn5D8aCNSzxNsTs=; b=cUNCMVOSCluMeCfFvpTxWGKKpYOwT2koP89QqxsoYQysMjKpZL6J6jF1jgT9BuG0Kp7A9+MWrVwGeQVRr98kc+cUcS3hQC1MOuVXeuaxj63YRZ1iCF+WWeX1pnUb54rLZSkfAhGP5rPQJyumCxagDDzcQKW1xmTr9ffwJSP7xBY/bWlnIGWTIRDNmt1YUYygGd5Dt9VPuGUdvFMQ0857whsyLhP2JGpC5yGy08gaCvVOw1hydpuK0t5gpbw8qoSZw4+I9yhro7hw1GIXtfy2YZZ+VGCwI4Li0ww1fKUEX407QI5sEwlprZYcj5/hmD3VuxpVA7G0PA4A4bYCrgUWog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W6L/jygsI/LiXGnghNuVDHnzVmKpkn5D8aCNSzxNsTs=; b=nnmiAPKYwY05Nhql1sPCy+fOpcI/4lCnIuR6bb7LtHZNN9e1DWmKliluivx3RV5jMkIyWm/vCs1SkYfPq3ATINxHqkt3utXJHVKwlWfsfgqr5xuzw/EGCYR2WoyEeIYFYqE/nZbAa4TDtsrgSu2T/1Ttp8DRhzMsvBRI0xvr0+U= From: Jonah Palmer To: qemu-devel@nongnu.org Cc: mst@redhat.com, qemu_oss@crudebyte.com, kraxel@redhat.com, si-wei.liu@oracle.com, joao.m.martins@oracle.com, eblake@redhat.com, qemu-block@nongnu.org, david@redhat.com, armbru@redhat.com, arei.gonglei@huawei.com, marcandre.lureau@redhat.com, lvivier@redhat.com, thuth@redhat.com, michael.roth@amd.com, groug@kaod.org, dgilbert@redhat.com, eric.auger@redhat.com, stefanha@redhat.com, boris.ostrovsky@oracle.com, kwolf@redhat.com, mathieu.poirier@linaro.org, raphael.norwitz@nutanix.com, pbonzini@redhat.com Subject: [PATCH v15 6/6] hmp: add virtio commands Date: Thu, 11 Aug 2022 08:24:44 -0400 Message-Id: <1660220684-24909-7-git-send-email-jonah.palmer@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1660220684-24909-1-git-send-email-jonah.palmer@oracle.com> References: <1660220684-24909-1-git-send-email-jonah.palmer@oracle.com> X-ClientProxiedBy: DM6PR03CA0077.namprd03.prod.outlook.com (2603:10b6:5:333::10) To PH0PR10MB4664.namprd10.prod.outlook.com (2603:10b6:510:41::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ba519848-d971-40e5-d039-08da7b94c8d3 X-MS-TrafficTypeDiagnostic: DM5PR1001MB2090:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3n32SRv16q5NfyxUFZt4ds9PK7IMHYFNfY2IwueQksvk/gdmScTaVmW94z6cju51bxIiypi8Euhgk9di3myovvLA40qUbfe1eVNHNjjwxMEWkKa2aL228T8LGJ+96Z3Y68s9Qd9FeSKPz7tJtShGMJYHGU86nxN+JjySRc9nNfM95HouzIWDaPe9L6A6/5Gz4hR1Mp2Ds2gmMOudYL4kHuwXGiusxhAp8nJpP1+WrZ88PPOkyP+Chpf4JD0sFn1ZKK0aLPpx8pkEUklVGalD6v+7oMqUwRMgqJZ4YFLCTXp/xYGuBXL5BCgphNzaB3siE6VQdDIEW1yGYzL1UsgiNhv9XTCWcGwO7m71kUEWgVvF5mx3mhTF/rfXftBwQYD+GnoJlyf3wReZ2mRkHeJFtVflLUhasyfpYIl/DZ8KX+5F3Wyx21Hqg9bqZUGFpunwfRIzB8+aejNQyR3b9kkjwKrU9vNwkYFxn2TabifCY8hw6LhfF4hX8JB8BXOHHkD00ZrHVxeE8O223iot+eiT9q/Dz0fJLQy9Zmm8buQ6TXNqONOVm0II4x6tIv7A1Pyx6olOMitZXG6Q2vS4h8Ut3Xscz4YwKQ08LZZQhY+Re/E7Xho9pDgbuR9YPGop47QALic1Yb5nft/WPKE80WKhl8f0rplyLRwY5gZCp8sKSpRZbYaPb6jwPU3/8bgosBOnNshhhV4ft2SboAh58XqfuK0hi0jNSqYGYoLfyBVwHcaXIY2TdreInMt+oB1gUS1p+Ga8CogoCksNBvvP41ql7loN/8PQGRwC8LyD2Om2Xls= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR10MB4664.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(39860400002)(396003)(366004)(136003)(376002)(346002)(36756003)(6506007)(316002)(41300700001)(52116002)(6916009)(6512007)(66556008)(26005)(6666004)(6486002)(478600001)(2906002)(86362001)(8936002)(66946007)(4326008)(8676002)(66476007)(30864003)(5660300002)(44832011)(38100700002)(38350700002)(7416002)(83380400001)(2616005)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?LSLgirgrl/V6vc0e8vYhsHQz863Vhm8Cs95OpQgCWRqpPz6ur3qBRfaQE2Cv?= =?us-ascii?Q?Ry7AvQannIaMtWi5arQjjlCc6EEXlGEcZcXK60VWGheGraLb2o6FgBuoJTBj?= =?us-ascii?Q?VpeTiwDwPYRXzpxIY3AKmeeAEsS2YtiFJO3Ikw+3K9MJWknOX0yH2m5+J/Q9?= =?us-ascii?Q?XP5qTp8yzD3UkgmvAcZSYp8bzbXdBpXoODmYIPCa7BqLTVj8zbLlWCPEgfJA?= =?us-ascii?Q?ivui18ehTi3w98G3tnJ1iTpLQo5G+APRuThYnuV2v9/zsQNVnd9zMvT87RtC?= =?us-ascii?Q?/I3QyqCGoNgMdOl1rTgp2GpvC3mSKPC4VnnjfDKEOXzKaIunmmU8GsLlO6XO?= =?us-ascii?Q?rk4Fjk0U10pkahjnISKvV5+XW+eyug6MKTNFFPHCodVq2jRV7gskh380NVRT?= =?us-ascii?Q?D1mDJA/4hj39edZWu0RMp5DX5ZYovuUS8Q9/e+8K+H668smHHTqf3JGgo4zh?= =?us-ascii?Q?KrTQinjsIHGlI7ymjqQQUi9ugicyGB5pv1Ml1Ph3KZvCo1dMWNM6ceyAFwYf?= =?us-ascii?Q?m7sjSsPUUXE1oWLjAaoz2k5xOipBfFOZ+2TdCgrZhu/FfDeXVqsXncc5u2H2?= =?us-ascii?Q?2NilUCAbwIjFjYtxYZlfEBaGqdW6h2vZgGduWQFHvA8YrrDNQLOoPQceSOaJ?= =?us-ascii?Q?4JderTqezQSUCccrgaUFuly1SM0YSF8jkOEOoVnIyRAvy97jmJRPWh/aFWVs?= =?us-ascii?Q?kxZzDU40hQA9FTiyLQYTmjQneSGOfQJ/lnSGHwWnPL3JsGrRWC4x2TbqRZFq?= =?us-ascii?Q?V8ZtarzmD2OvYd+Ypiac8uDMl7n2+InFtY289uC0CJPUYpYs7MQuH6ycQCEJ?= =?us-ascii?Q?rozkzecSKBCeDee9nNmV3WKQ9XhO+NmDgxGGqjelYK/9gJ4TiCkaZoIh6aU9?= =?us-ascii?Q?sB2tIIvkLFbg8fE5F9qv/5lOn2359JUz2UmbCx0aOOmkKyVocx1bAqQUP7D+?= =?us-ascii?Q?KbzjfDyPOE7bSpyU5WzUPc3OfOtMoZ9lWpjBd/G/yPz7xQa0cQUvku2lmglq?= =?us-ascii?Q?NBXC0mbmxuUmvT23IheUo2bi2qm7jSULR4PK6kVK5nb2b3vMFmrX0Dy6qZvy?= =?us-ascii?Q?DpbOdImP6wTD3E6SKPPXxUVk+KY/GzUZ0eKdXjtRFyVlaB9eSGWfwfMKHD75?= =?us-ascii?Q?zqUjXIGBeYN7wFAjMe/sDSS4sXO43mFt+GpOYkFHjDSbSClypPLw11ljeDu+?= =?us-ascii?Q?CM3Zl2T3CshcOu9tP0oGHhjmR9cVpSeMH4wr2/1jJnZksmjepCjKNPlW2UEm?= =?us-ascii?Q?LGo73GveCt4CLTDDrQd7TZCqtJmx+tDhoC2hls/Kx9KrI6ldzebKq8PrtywR?= =?us-ascii?Q?1L3mu38vtFD2ef1Liz3PgnFvplr/zxkyFcZNk/wLJaM9v8SaXgcIi0W45IOS?= =?us-ascii?Q?HgIF+jtrNKSeaQBauHEg6WxEySJ2RfDe0gL68sjTlda/j7im8Pbd21aLZGzK?= =?us-ascii?Q?Hlh+SdxmPn7KJJ4nZvEDvNvKzCojsWcC40B3ddgnsaCAro6pEGGdq97Ptkdk?= =?us-ascii?Q?9qKOW0lCvZBt1sJ/LGfcgPcvTj86tUq8C9Rr+OLHwyv10PTGrDLLex27b7Gq?= =?us-ascii?Q?zgMZoKgKhft7cvsESDxr7lB7w8DXE7QjkkdTB2t9?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba519848-d971-40e5-d039-08da7b94c8d3 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB4664.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2022 12:26:58.3234 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: POMWb8fd+UrJnaF1itymN85AflDvc5KOd/rsPcwhST61yMRAbq3eS42fee2eVBIDM5kbSuqshuaD4OOKA8z+eA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1001MB2090 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-11_05,2022-08-11_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 suspectscore=0 adultscore=0 phishscore=0 mlxscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208110038 X-Proofpoint-GUID: -9vLsWYiOmuWFivONiVDDXcZJ31U5aPL X-Proofpoint-ORIG-GUID: -9vLsWYiOmuWFivONiVDDXcZJ31U5aPL 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=205.220.165.32; envelope-from=jonah.palmer@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1660223618200100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Laurent Vivier This patch implements the HMP versions of the virtio QMP commands. [Jonah: Adjusted hmp monitor output format for features / statuses with their descriptions.] Signed-off-by: Laurent Vivier Signed-off-by: Jonah Palmer --- hmp-commands-info.hx | 70 ++++++++++ include/monitor/hmp.h | 5 + monitor/hmp-cmds.c | 310 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 385 insertions(+) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 188d9ece3b..58cfa86638 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -921,3 +921,73 @@ SRST ``stats`` Show runtime-collected statistics ERST + + { + .name =3D "virtio", + .args_type =3D "", + .params =3D "", + .help =3D "List all available virtio devices", + .cmd =3D hmp_virtio_query, + .flags =3D "p", + }, + +SRST + ``info virtio`` + List all available virtio devices +ERST + + { + .name =3D "virtio-status", + .args_type =3D "path:s", + .params =3D "path", + .help =3D "Display status of a given virtio device", + .cmd =3D hmp_virtio_status, + .flags =3D "p", + }, + +SRST + ``info virtio-status`` *path* + Display status of a given virtio device +ERST + + { + .name =3D "virtio-queue-status", + .args_type =3D "path:s,queue:i", + .params =3D "path queue", + .help =3D "Display status of a given virtio queue", + .cmd =3D hmp_virtio_queue_status, + .flags =3D "p", + }, + +SRST + ``info virtio-queue-status`` *path* *queue* + Display status of a given virtio queue +ERST + + { + .name =3D "virtio-vhost-queue-status", + .args_type =3D "path:s,queue:i", + .params =3D "path queue", + .help =3D "Display status of a given vhost queue", + .cmd =3D hmp_vhost_queue_status, + .flags =3D "p", + }, + +SRST + ``info virtio-vhost-queue-status`` *path* *queue* + Display status of a given vhost queue +ERST + + { + .name =3D "virtio-queue-element", + .args_type =3D "path:s,queue:i,index:i?", + .params =3D "path queue [index]", + .help =3D "Display element of a given virtio queue", + .cmd =3D hmp_virtio_queue_element, + .flags =3D "p", + }, + +SRST + ``info virtio-queue-element`` *path* *queue* [*index*] + Display element of a given virtio queue +ERST diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index a618eb1e4e..a9cf064ee8 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -95,6 +95,11 @@ void hmp_qom_list(Monitor *mon, const QDict *qdict); void hmp_qom_get(Monitor *mon, const QDict *qdict); void hmp_qom_set(Monitor *mon, const QDict *qdict); void hmp_info_qom_tree(Monitor *mon, const QDict *dict); +void hmp_virtio_query(Monitor *mon, const QDict *qdict); +void hmp_virtio_status(Monitor *mon, const QDict *qdict); +void hmp_virtio_queue_status(Monitor *mon, const QDict *qdict); +void hmp_vhost_queue_status(Monitor *mon, const QDict *qdict); +void hmp_virtio_queue_element(Monitor *mon, const QDict *qdict); void object_add_completion(ReadLineState *rs, int nb_args, const char *str= ); void object_del_completion(ReadLineState *rs, int nb_args, const char *str= ); void device_add_completion(ReadLineState *rs, int nb_args, const char *str= ); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index c6cd6f91dd..0934dbd557 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -43,6 +43,8 @@ #include "qapi/qapi-commands-stats.h" #include "qapi/qapi-commands-tpm.h" #include "qapi/qapi-commands-ui.h" +#include "qapi/qapi-commands-virtio.h" +#include "qapi/qapi-visit-virtio.h" #include "qapi/qapi-visit-net.h" #include "qapi/qapi-visit-migration.h" #include "qapi/qmp/qdict.h" @@ -2472,3 +2474,311 @@ exit: exit_no_print: error_free(err); } + +static void hmp_virtio_dump_protocols(Monitor *mon, + VhostDeviceProtocols *pcol) +{ + strList *pcol_list =3D pcol->protocols; + while (pcol_list) { + monitor_printf(mon, "\t%s", pcol_list->value); + pcol_list =3D pcol_list->next; + if (pcol_list !=3D NULL) { + monitor_printf(mon, ",\n"); + } + } + monitor_printf(mon, "\n"); + if (pcol->has_unknown_protocols) { + monitor_printf(mon, " unknown-protocols(0x%016"PRIx64")\n", + pcol->unknown_protocols); + } +} + +static void hmp_virtio_dump_status(Monitor *mon, + VirtioDeviceStatus *status) +{ + strList *status_list =3D status->statuses; + while (status_list) { + monitor_printf(mon, "\t%s", status_list->value); + status_list =3D status_list->next; + if (status_list !=3D NULL) { + monitor_printf(mon, ",\n"); + } + } + monitor_printf(mon, "\n"); + if (status->has_unknown_statuses) { + monitor_printf(mon, " unknown-statuses(0x%016"PRIx32")\n", + status->unknown_statuses); + } +} + +static void hmp_virtio_dump_features(Monitor *mon, + VirtioDeviceFeatures *features) +{ + strList *transport_list =3D features->transports; + while (transport_list) { + monitor_printf(mon, "\t%s", transport_list->value); + transport_list =3D transport_list->next; + if (transport_list !=3D NULL) { + monitor_printf(mon, ",\n"); + } + } + + monitor_printf(mon, "\n"); + strList *list =3D features->dev_features; + if (list) { + while (list) { + monitor_printf(mon, "\t%s", list->value); + list =3D list->next; + if (list !=3D NULL) { + monitor_printf(mon, ",\n"); + } + } + monitor_printf(mon, "\n"); + } + + if (features->has_unknown_dev_features) { + monitor_printf(mon, " unknown-features(0x%016"PRIx64")\n", + features->unknown_dev_features); + } +} + +void hmp_virtio_query(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + VirtioInfoList *list =3D qmp_x_query_virtio(&err); + VirtioInfoList *node; + + if (err !=3D NULL) { + hmp_handle_error(mon, err); + return; + } + + if (list =3D=3D NULL) { + monitor_printf(mon, "No VirtIO devices\n"); + return; + } + + node =3D list; + while (node) { + monitor_printf(mon, "%s [%s]\n", node->value->path, + node->value->name); + node =3D node->next; + } + qapi_free_VirtioInfoList(list); +} + +void hmp_virtio_status(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + const char *path =3D qdict_get_try_str(qdict, "path"); + VirtioStatus *s =3D qmp_x_query_virtio_status(path, &err); + + if (err !=3D NULL) { + hmp_handle_error(mon, err); + return; + } + + monitor_printf(mon, "%s:\n", path); + monitor_printf(mon, " device_name: %s %s\n", + s->name, s->has_vhost_dev ? "(vhost)" : ""); + monitor_printf(mon, " device_id: %d\n", s->device_id); + monitor_printf(mon, " vhost_started: %s\n", + s->vhost_started ? "true" : "false"); + monitor_printf(mon, " bus_name: %s\n", s->bus_name); + monitor_printf(mon, " broken: %s\n", + s->broken ? "true" : "false"); + monitor_printf(mon, " disabled: %s\n", + s->disabled ? "true" : "false"); + monitor_printf(mon, " disable_legacy_check: %s\n", + s->disable_legacy_check ? "true" : "false"); + monitor_printf(mon, " started: %s\n", + s->started ? "true" : "false"); + monitor_printf(mon, " use_started: %s\n", + s->use_started ? "true" : "false"); + monitor_printf(mon, " start_on_kick: %s\n", + s->start_on_kick ? "true" : "false"); + monitor_printf(mon, " use_guest_notifier_mask: %s\n", + s->use_guest_notifier_mask ? "true" : "false"); + monitor_printf(mon, " vm_running: %s\n", + s->vm_running ? "true" : "false"); + monitor_printf(mon, " num_vqs: %"PRId64"\n", s->num_v= qs); + monitor_printf(mon, " queue_sel: %d\n", + s->queue_sel); + monitor_printf(mon, " isr: %d\n", s->isr); + monitor_printf(mon, " endianness: %s\n", + s->device_endian); + monitor_printf(mon, " status:\n"); + hmp_virtio_dump_status(mon, s->status); + monitor_printf(mon, " Guest features:\n"); + hmp_virtio_dump_features(mon, s->guest_features); + monitor_printf(mon, " Host features:\n"); + hmp_virtio_dump_features(mon, s->host_features); + monitor_printf(mon, " Backend features:\n"); + hmp_virtio_dump_features(mon, s->backend_features); + + if (s->has_vhost_dev) { + monitor_printf(mon, " VHost:\n"); + monitor_printf(mon, " nvqs: %d\n", + s->vhost_dev->nvqs); + monitor_printf(mon, " vq_index: %"PRId64"\n", + s->vhost_dev->vq_index); + monitor_printf(mon, " max_queues: %"PRId64"\n", + s->vhost_dev->max_queues); + monitor_printf(mon, " n_mem_sections: %"PRId64"\n", + s->vhost_dev->n_mem_sections); + monitor_printf(mon, " n_tmp_sections: %"PRId64"\n", + s->vhost_dev->n_tmp_sections); + monitor_printf(mon, " backend_cap: %"PRId64"\n", + s->vhost_dev->backend_cap); + monitor_printf(mon, " log_enabled: %s\n", + s->vhost_dev->log_enabled ? "true" : "false"); + monitor_printf(mon, " log_size: %"PRId64"\n", + s->vhost_dev->log_size); + monitor_printf(mon, " Features:\n"); + hmp_virtio_dump_features(mon, s->vhost_dev->features); + monitor_printf(mon, " Acked features:\n"); + hmp_virtio_dump_features(mon, s->vhost_dev->acked_features); + monitor_printf(mon, " Backend features:\n"); + hmp_virtio_dump_features(mon, s->vhost_dev->backend_features); + monitor_printf(mon, " Protocol features:\n"); + hmp_virtio_dump_protocols(mon, s->vhost_dev->protocol_features); + } + + qapi_free_VirtioStatus(s); +} + +void hmp_vhost_queue_status(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + const char *path =3D qdict_get_try_str(qdict, "path"); + int queue =3D qdict_get_int(qdict, "queue"); + VirtVhostQueueStatus *s =3D + qmp_x_query_virtio_vhost_queue_status(path, queue, &err); + + if (err !=3D NULL) { + hmp_handle_error(mon, err); + return; + } + + monitor_printf(mon, "%s:\n", path); + monitor_printf(mon, " device_name: %s (vhost)\n", + s->name); + monitor_printf(mon, " kick: %"PRId64"\n", s->kick); + monitor_printf(mon, " call: %"PRId64"\n", s->call); + monitor_printf(mon, " VRing:\n"); + monitor_printf(mon, " num: %"PRId64"\n", s->num); + monitor_printf(mon, " desc: 0x%016"PRIx64"\n", s->desc); + monitor_printf(mon, " desc_phys: 0x%016"PRIx64"\n", + s->desc_phys); + monitor_printf(mon, " desc_size: %"PRId32"\n", s->desc_size); + monitor_printf(mon, " avail: 0x%016"PRIx64"\n", s->avail); + monitor_printf(mon, " avail_phys: 0x%016"PRIx64"\n", + s->avail_phys); + monitor_printf(mon, " avail_size: %"PRId32"\n", s->avail_size); + monitor_printf(mon, " used: 0x%016"PRIx64"\n", s->used); + monitor_printf(mon, " used_phys: 0x%016"PRIx64"\n", + s->used_phys); + monitor_printf(mon, " used_size: %"PRId32"\n", s->used_size); + + qapi_free_VirtVhostQueueStatus(s); +} + +void hmp_virtio_queue_status(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + const char *path =3D qdict_get_try_str(qdict, "path"); + int queue =3D qdict_get_int(qdict, "queue"); + VirtQueueStatus *s =3D qmp_x_query_virtio_queue_status(path, queue, &e= rr); + + if (err !=3D NULL) { + hmp_handle_error(mon, err); + return; + } + + monitor_printf(mon, "%s:\n", path); + monitor_printf(mon, " device_name: %s\n", s->name); + monitor_printf(mon, " queue_index: %d\n", s->queue_index); + monitor_printf(mon, " inuse: %d\n", s->inuse); + monitor_printf(mon, " used_idx: %d\n", s->used_idx); + monitor_printf(mon, " signalled_used: %d\n", + s->signalled_used); + monitor_printf(mon, " signalled_used_valid: %s\n", + s->signalled_used_valid ? "true" : "false"); + if (s->has_last_avail_idx) { + monitor_printf(mon, " last_avail_idx: %d\n", + s->last_avail_idx); + } + if (s->has_shadow_avail_idx) { + monitor_printf(mon, " shadow_avail_idx: %d\n", + s->shadow_avail_idx); + } + monitor_printf(mon, " VRing:\n"); + monitor_printf(mon, " num: %"PRId32"\n", s->vring_num); + monitor_printf(mon, " num_default: %"PRId32"\n", + s->vring_num_default); + monitor_printf(mon, " align: %"PRId32"\n", + s->vring_align); + monitor_printf(mon, " desc: 0x%016"PRIx64"\n", + s->vring_desc); + monitor_printf(mon, " avail: 0x%016"PRIx64"\n", + s->vring_avail); + monitor_printf(mon, " used: 0x%016"PRIx64"\n", + s->vring_used); + + qapi_free_VirtQueueStatus(s); +} + +void hmp_virtio_queue_element(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + const char *path =3D qdict_get_try_str(qdict, "path"); + int queue =3D qdict_get_int(qdict, "queue"); + int index =3D qdict_get_try_int(qdict, "index", -1); + VirtioQueueElement *e; + VirtioRingDescList *list; + + e =3D qmp_x_query_virtio_queue_element(path, queue, index !=3D -1, + index, &err); + if (err !=3D NULL) { + hmp_handle_error(mon, err); + return; + } + + monitor_printf(mon, "%s:\n", path); + monitor_printf(mon, " device_name: %s\n", e->name); + monitor_printf(mon, " index: %d\n", e->index); + monitor_printf(mon, " desc:\n"); + monitor_printf(mon, " descs:\n"); + + list =3D e->descs; + while (list) { + monitor_printf(mon, " addr 0x%"PRIx64" len %d", + list->value->addr, list->value->len); + if (list->value->flags) { + strList *flag =3D list->value->flags; + monitor_printf(mon, " ("); + while (flag) { + monitor_printf(mon, "%s", flag->value); + flag =3D flag->next; + if (flag) { + monitor_printf(mon, ", "); + } + } + monitor_printf(mon, ")"); + } + list =3D list->next; + if (list) { + monitor_printf(mon, ",\n"); + } + } + monitor_printf(mon, "\n"); + monitor_printf(mon, " avail:\n"); + monitor_printf(mon, " flags: %d\n", e->avail->flags); + monitor_printf(mon, " idx: %d\n", e->avail->idx); + monitor_printf(mon, " ring: %d\n", e->avail->ring); + monitor_printf(mon, " used:\n"); + monitor_printf(mon, " flags: %d\n", e->used->flags); + monitor_printf(mon, " idx: %d\n", e->used->idx); + + qapi_free_VirtioQueueElement(e); +} --=20 2.31.1