From nobody Mon Apr 29 00:55:16 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=1dmarc=pass fromdomain=oracle.com); dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1616737912; cv=pass; d=zohomail.com; s=zohoarc; b=SxPyna0oM7+dWsbrX63NU4J/3g73SKP34uqsMR2AadR5VJrMoGa3RKkkJTzx2FiLgBrl3tc847qa6/gpE5XAhrqcEUoe7NG7wAWGggJ6288W+8m+1PQ9oCriVof3XwxrSTi3VM0rzngK8OygrXdl5dkoGGLQPjjY16FN4XssaFs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616737912; 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=imsKgCj1Dwu8nUrJWQbZD7znxPHHyeEE0O+O1bABRoA=; b=O7NTePCYIZ/BrYLXNfLEAXF6KQlv9x4yNUpYbTa8P2jlpDtRlRcUAEndqp2Bq4CnFGFv8Gh0s6tYLJi+a+z+28CpHYH4PKiiqEtIvkHEgpfslr6p8KXzB7krCe6Z+Y4lf+x8R0PAG2C6R3oCGeJGui9TpT1Jzl1yIs2Mh18dmiY= 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=1dmarc=pass fromdomain=oracle.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1616737912271405.1602004696848; Thu, 25 Mar 2021 22:51:52 -0700 (PDT) Received: from localhost ([::1]:36476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPfNv-0002Dz-49 for importer@patchew.org; Fri, 26 Mar 2021 01:51:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPfHt-0003Zt-7f; Fri, 26 Mar 2021 01:45:37 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:47100) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPfHf-00045U-1R; Fri, 26 Mar 2021 01:45:36 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12Q5hwbD195112; Fri, 26 Mar 2021 05:45:06 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 37h1420vyg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Mar 2021 05:45:06 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12Q5aJeY140931; Fri, 26 Mar 2021 05:45:05 GMT Received: from nam02-bl2-obe.outbound.protection.outlook.com (mail-bl2nam02lp2052.outbound.protection.outlook.com [104.47.38.52]) by userp3020.oracle.com with ESMTP id 37h14grkca-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Mar 2021 05:45:05 +0000 Received: from DM6PR10MB2668.namprd10.prod.outlook.com (2603:10b6:5:b2::25) by DM6PR10MB3068.namprd10.prod.outlook.com (2603:10b6:5:6a::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.26; Fri, 26 Mar 2021 05:45:03 +0000 Received: from DM6PR10MB2668.namprd10.prod.outlook.com ([fe80::9d2c:340:5b24:bff7]) by DM6PR10MB2668.namprd10.prod.outlook.com ([fe80::9d2c:340:5b24:bff7%6]) with mapi id 15.20.3846.054; Fri, 26 Mar 2021 05:45:03 +0000 Received: from localhost.localdomain (138.3.200.16) by BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.25 via Frontend Transport; Fri, 26 Mar 2021 05:45:02 +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-2020-01-29; bh=imsKgCj1Dwu8nUrJWQbZD7znxPHHyeEE0O+O1bABRoA=; b=VPbrGOu7gLULxjwvjUY78ggWTjquxKj1kil0T2HZGOub0Tm9lnaNhyw2hGXmwjgglaAo W5TZABdoqHciddq+P04pVcuMB/LR7pnmUUrcHFMH9jQwH/7aHobGI2QtVagwRY0+cnF5 X6SXJpyB6qedVnKHu78yEU4V22r5NXZYlt977NBkBsjEpvGO0E3RZzgRP7NAIeTfSxZe zo6L+PC7YMSSIcPsmBsJC8/ja/1ioLU77b4HqArH1VhEQlKVSou63bbvcyIMNh7dnHqL MEJPCYpBHr3ozxKUGqMMWs82CAhGAi3rtkrAm4ZpSOrnm0WpWMKrPhRIQYCnkU3GUpRJ RA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gti4G16ybyqs3tu1bUD6p/KOfv0k7shsHOo5F5zdMkva+Pj92iRWXzyCxffe93MQaPhm3Fa9e9rafjYn1vhLB35JsG41ikZ5mkRLNsWkMG3t57UMOLe/RHmCod/O6cJUSpF5cUxcsH2WEr+tNo3xDqI7LkcKSIqENossnvBWTa2SAKX6w8EcKBiwMaW1bxYRdqoJLs6aoh6ua3otMLa+ntZL6jfOM/0Pwz7i3JArAIWJs5LujwNCZpDbBWDVtafhw+Rh+5ENAlxQzVngws/A8PDnT3GUNC8De6O1RrZM3BW9+z+Jc0JgS9ZIcB7ZFOteumAhEVZOfX8LJEEfoN7KLA== 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-SenderADCheck; bh=imsKgCj1Dwu8nUrJWQbZD7znxPHHyeEE0O+O1bABRoA=; b=R9bqWCZITARhCGTUAk8b3cwV7QEZsGgo9MYJX3Ps9+RnhUxpldRhhasbRhL+ESGYUN/lUYpGe3ji9cz1pvRVqrSI5fkvKW90L5K4GArGZrELdlGxPyO0ItzQOshGlp+QfxApI6vCB11TxsGY2PrP6n7kvjwIW7SMqd++BYAmKpmxJr/9T+xEFMG7N55vbv0KaQh3mlSCOHna0F+G2DrLTp9YlkiZp7WwvnHof1F4m64S+tGe1LflwKiiHzh530S4nQ3gssClxkD76KUnCk1erewqnX07VGoonWkXlfrPJ5mm1wgNqCJhaq64ldHyxeY2lmLehpn9/HHTbyXfzmB3VQ== 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=imsKgCj1Dwu8nUrJWQbZD7znxPHHyeEE0O+O1bABRoA=; b=cNlcDjlt+IMTOpXoKSALficSlJYnf4N09wjYO2nNZ86azRkdT6eZOdaa0RKBeTAy/ZVvi6BxjnskcEoOgTo9Y3qlVomFJKBqFSyDiXdszg4iAFjACWaVTAEBG4NFjX+1ID3+JH/7beyDg+ADDA07vUTJPubhzRYWTBKfVpIXf+M= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=oracle.com; From: Dongli Zhang To: qemu-block@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 1/6] qdev: introduce qapi/hmp command for kick/call event Date: Thu, 25 Mar 2021 22:44:28 -0700 Message-Id: <20210326054433.11762-2-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210326054433.11762-1-dongli.zhang@oracle.com> References: <20210326054433.11762-1-dongli.zhang@oracle.com> X-Originating-IP: [138.3.200.16] X-ClientProxiedBy: BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) To DM6PR10MB2668.namprd10.prod.outlook.com (2603:10b6:5:b2::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fdb8a088-6ff8-4945-dee2-08d8f01a4d66 X-MS-TrafficTypeDiagnostic: DM6PR10MB3068: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:107; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7bFo/+7q6VquMF8jlcwR/TKCHlYFQzDak4Mn+eN+XtSjvVzMdcHQVUStqsCChmhq9LtsRmKGueImH3/pSNjRF9yInkrh8pYc34u5JvCYILOTRSxyQd7/mcRcPhWWkSFYx+02rZZM2KZpkV7FQ8w5ZS6psQVeGAAqw903wumrSevMMbCnFFV+CxHcuVc2I44trTLV0wMxLlGgodSoP9YqY7avykGuFYcKmD04aPCLYliyfNpzhkworl6SetK37tFLuW1dvYQCYzYuUePv1NrkYBR75E4RUl4zX9pF7/0DApV40NJdo3Vijbkuf3RDPyE+AmORF1+kEAVCI5KP265uUsC62aw6TJo6Fv9IJH81bW35kIW2Ioh4pVyOVfyv0O12vDaADfVs0vrOP8hblhSSJgTP6yuJW9GCeXJ78kEWmAi2byHlFaKdDF/mpxoLoXa8onkOCPimGTADxAxwIl6Sokjs/ibz20CMeax/3KJ/krUtNMY7iSjUzD8Daz9s24+BucYxjb4w3W9FiPtx93/IUQnygqYSjKqpatsQQv5uOQyZnJxis0RUAbGs/SY5Q1y0qdvZANJPKN35Sw3DsQqF1gp8Fe3+TJ/gFUtCgNSSf3o4x0rKWvkyviu9QCLzAXjTD667JIaotQCBbkDbymjdXWltMoSQLsllxLaNKbOXoDzXo4G9L+tkhUtpg47NBqX5Sb0+t6q0r6e7tYWWmjhXvlQq6nxQBY7BphV9ncmcjbG+SMkFgELgBlOF/eyb9iBIOpWUYTmHnZ9tAdjh7cT7wA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB2668.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(366004)(396003)(346002)(26005)(8936002)(956004)(8676002)(36756003)(44832011)(6666004)(16526019)(2616005)(83380400001)(7416002)(6506007)(186003)(6486002)(966005)(478600001)(5660300002)(52116002)(69590400012)(66556008)(38100700001)(1076003)(4326008)(66476007)(6512007)(66946007)(316002)(107886003)(86362001)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?H7VV3wjJgPvn2p/TnxaEZaIOXzrq1oPNoAvWBlQUPOEoU36okWZeWUBtEKN7?= =?us-ascii?Q?KaI8cQ2r4tc1WZDpHUXBc5KVAzb42FufW+iU8ll5fW9MZKoIL6Oum0I/cJOZ?= =?us-ascii?Q?4vBGw2I6+abx64Y9uDBW4JvU6zJS7sAxJ3oe7Jr7MDodn94bd5O06ponWZIk?= =?us-ascii?Q?TNFQm530xIViwkue44Z3viaLUqsLHiPhVg6McFS/vXhjoOj0XtFpdw+ytE3J?= =?us-ascii?Q?zkRzkfH26jkHxYznqA48IBgnuQRugSyjKgL1n8yBls/bWFZ8vjZqPpfKQLU3?= =?us-ascii?Q?EZ9r1Uvud/ZTwdwoxbKDrGneYKhee/acfW5n0V2dqkc2PoXmmat5i4ntAAZ+?= =?us-ascii?Q?CVxqTqT66nmYDZBC+HkmZnmMw6wdnAdmvMLpVks4SgnS0rV49GK4yKCuThOq?= =?us-ascii?Q?4najoZu5dhuWMpsdZN7x7oF5Iwvq6rTmDsl2T/c3RtgVbdFruStYwe4SByH5?= =?us-ascii?Q?g2YdkxudrH1i1v1DzaUWDK3xQP93Xw7YwKa1HVDMBvTTfoT9sSgfVPYlZsCc?= =?us-ascii?Q?rV+VOoHvsGleUUzNDSA9tJiLwQD1l1dP8ZLtHUjoMmlMRO8bR0qzxzpn0m48?= =?us-ascii?Q?bWjcmIR8g+VjL44LvAOeNfFFxIwtyzDXqragiWCW7q9cDBLZDQ9dpQzZf48J?= =?us-ascii?Q?iicoXYZIM0T2Z7LK6gR+aMEhuRtTwG1mDAPZZrf5CAMuI741G45f526yisQ5?= =?us-ascii?Q?dOfJ6dTiGw7RvPNyXXtzQgK89PPqWynBp1LYMsjiRZpGDZP59QMsbwL7zbb7?= =?us-ascii?Q?U78te6flzHEuRK8geEWxxCtDaV7/MYS+FUBFImYjoDkMaiTDADNVj9Lyp88T?= =?us-ascii?Q?UnXG6AQtRhco1E48460vCRLXLou9e6pT4Sfay9Dpkljh4+EJOD41xE1f6a8Y?= =?us-ascii?Q?29mgO3EwPf6wJDKrN+vO5/yAYAvKLsEkERN9MSZ+2scDDoruwJ2BGCNDxrfl?= =?us-ascii?Q?9dv3O07GUOWxbnyaKh+py+9RYxw/lNnI9g1+ATWeWb6xHFLYf/4XoCCswfbu?= =?us-ascii?Q?gaTneebKldlJIzKievK6S2E63EqnO8zoqH6m+VU5DwjerramCMEt19XPFXct?= =?us-ascii?Q?bEYzvhQlHQf7JHGIxKaOdrbRYcpp6V6GMbPqH/v2lEYMnLZib94xr9SRrK8S?= =?us-ascii?Q?WXHWt4Db/LRM/EWwmp1qKPv9DxNqZQAHMY3xgLfIfzF30huf8kOD9IOjgUzF?= =?us-ascii?Q?fNYtOq52NM5WHQXYhxXb6cbS+2TWN7h55pj1yjvq2PZ1fFehtuKJSHIFvKOJ?= =?us-ascii?Q?DdFWsagYWgDeXMBdsvR7sYuiQX8bne+kS1KvOyHUS5+WEhH2/90qPYoEoT6J?= =?us-ascii?Q?sZYXZbuF56S9y7ExOGWdlXuM?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdb8a088-6ff8-4945-dee2-08d8f01a4d66 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB2668.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2021 05:45:03.3857 (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: RKxpaJt9an+1xxNhzsvqEaXe9YCcC8FuPjCm/cZX/Qes6+/n3wYusi1wxsdCHPKlKEVVTo/GZ54kA7+OI2ZSpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3068 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9934 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 spamscore=0 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103260040 X-Proofpoint-GUID: 2_9xCqXqXIu0JHRgjFsCXlv9YVbBUW1P X-Proofpoint-ORIG-GUID: 2_9xCqXqXIu0JHRgjFsCXlv9YVbBUW1P X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9934 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxscore=0 clxscore=1015 impostorscore=0 spamscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103260041 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=141.146.126.78; envelope-from=dongli.zhang@oracle.com; helo=aserp2120.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, berrange@redhat.com, ehabkost@redhat.com, mst@redhat.com, jasowang@redhat.com, joe.jin@oracle.com, armbru@redhat.com, dgilbert@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @oracle.onmicrosoft.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The virtio device/driver (e.g., vhost-scsi or vhost-net) may hang due to the loss of doorbell kick, e.g., https://lists.gnu.org/archive/html/qemu-devel/2018-12/msg01711.html ... or due to the loss of IRQ, e.g., as fixed by linux kernel commit fe200ae48ef5 ("genirq: Mark polled irqs and defer the real handler"). This patch introduces a new debug interface 'DeviceEvent' to DeviceClass to help narrow down if the issue is due to loss of irq/kick. So far the new interface handles only two events: 'call' and 'kick'. Any device (e.g., virtio/vhost or VFIO) may implement the interface (e.g., via eventfd, MSI-X or legacy IRQ). The 'call' is to inject irq on purpose by admin for a specific device (e.g., vhost-scsi) from QEMU/host to VM, while the 'kick' is to kick the doorbell on purpose by admin at QEMU/host side for a specific device. Signed-off-by: Dongli Zhang --- hmp-commands.hx | 14 +++++++++++ include/hw/qdev-core.h | 9 +++++++ include/monitor/hmp.h | 1 + qapi/qdev.json | 30 ++++++++++++++++++++++ softmmu/qdev-monitor.c | 56 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 110 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index 435c591a1c..d74b895fff 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1725,3 +1725,17 @@ ERST .flags =3D "p", }, =20 + { + .name =3D "x-debug-device-event", + .args_type =3D "dev:s,event:s,queue:l", + .params =3D "dev event queue", + .help =3D "generate device event for a specific device queue= ", + .cmd =3D hmp_x_debug_device_event, + .flags =3D "p", + }, + +SRST +``x-debug-device-event`` *dev* *event* *queue* + Generate device event *event* for specific *queue* of *dev* +ERST + diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index bafc311bfa..1ea8bf23b9 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -29,9 +29,17 @@ typedef enum DeviceCategory { DEVICE_CATEGORY_MAX } DeviceCategory; =20 +enum { + DEVICE_EVENT_CALL, + DEVICE_EVENT_KICK, + DEVICE_EVENT_MAX +}; + typedef void (*DeviceRealize)(DeviceState *dev, Error **errp); typedef void (*DeviceUnrealize)(DeviceState *dev); typedef void (*DeviceReset)(DeviceState *dev); +typedef void (*DeviceEvent)(DeviceState *dev, int event, int queue, + Error **errp); typedef void (*BusRealize)(BusState *bus, Error **errp); typedef void (*BusUnrealize)(BusState *bus); =20 @@ -132,6 +140,7 @@ struct DeviceClass { DeviceReset reset; DeviceRealize realize; DeviceUnrealize unrealize; + DeviceEvent event; =20 /* device state */ const VMStateDescription *vmsd; diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 605d57287a..c7795d4ba5 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -129,5 +129,6 @@ void hmp_info_replay(Monitor *mon, const QDict *qdict); void hmp_replay_break(Monitor *mon, const QDict *qdict); void hmp_replay_delete_break(Monitor *mon, const QDict *qdict); void hmp_replay_seek(Monitor *mon, const QDict *qdict); +void hmp_x_debug_device_event(Monitor *mon, const QDict *qdict); =20 #endif diff --git a/qapi/qdev.json b/qapi/qdev.json index b83178220b..711c4a297a 100644 --- a/qapi/qdev.json +++ b/qapi/qdev.json @@ -124,3 +124,33 @@ ## { 'event': 'DEVICE_DELETED', 'data': { '*device': 'str', 'path': 'str' } } + +## +# @x-debug-device-event: +# +# Generate device event for a specific device queue +# +# @dev: device path +# +# @event: event (e.g., kick or call) to trigger +# +# @queue: queue id +# +# Returns: Nothing on success +# +# Since: 6.1 +# +# Notes: This is used to debug VM driver hang issue. The 'kick' event is to +# send notification to QEMU/vhost while the 'call' event is to +# interrupt VM on purpose. +# +# Example: +# +# -> { "execute": "x-debug-device_event", +# "arguments": { "dev": "/machine/peripheral/vscsi0", "event": "kick", +# "queue": 1 } } +# <- { "return": {} } +# +## +{ 'command': 'x-debug-device-event', + 'data': {'dev': 'str', 'event': 'str', 'queue': 'int'} } diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index a9955b97a0..bca53111fb 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -924,6 +924,62 @@ void hmp_device_del(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, err); } =20 +static const char * const device_events[DEVICE_EVENT_MAX] =3D { + [DEVICE_EVENT_KICK] =3D "kick", + [DEVICE_EVENT_CALL] =3D "call" +}; + +static int get_device_event(const char *event) +{ + int evt; + + for (evt =3D 0; evt < ARRAY_SIZE(device_events); evt++) { + if (!strcmp(device_events[evt], event)) { + return evt; + } + } + + return -ENOENT; +} + +void qmp_x_debug_device_event(const char *dev, const char *event, + int64_t queue, Error **errp) +{ + DeviceState *device =3D find_device_state(dev, NULL); + DeviceClass *dc; + int evt; + + if (!device) { + error_setg(errp, "Device %s not found", dev); + return; + } + + dc =3D DEVICE_GET_CLASS(device); + if (!dc->event) { + error_setg(errp, "device_event is not supported"); + return; + } + + evt =3D get_device_event(event); + if (evt < 0) { + error_setg(errp, "Unsupported event %s", event); + return; + } + + dc->event(device, evt, queue, errp); +} + +void hmp_x_debug_device_event(Monitor *mon, const QDict *qdict) +{ + const char *dev =3D qdict_get_str(qdict, "dev"); + const char *event =3D qdict_get_str(qdict, "event"); + int queue =3D qdict_get_try_int(qdict, "queue", -1); + Error *err =3D NULL; + + qmp_x_debug_device_event(dev, event, queue, &err); + hmp_handle_error(mon, err); +} + BlockBackend *blk_by_qdev_id(const char *id, Error **errp) { DeviceState *dev; --=20 2.17.1 From nobody Mon Apr 29 00:55:16 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=1dmarc=pass fromdomain=oracle.com); dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1616737652; cv=pass; d=zohomail.com; s=zohoarc; b=jgtuRJtkyFaJvPL14PgmVeXsRrsiGRK9m9MjTu8ulCtiwg77niEhLMvkB/q+DqqIbmrorBatkf22b1YZzw7cvT8oGDVmru7nq4v5SjfOrSy2hcqDwdaRGgUWbCnE0YlRLEhDjH/DUUbK5XTWbQMKwJt7TTWcD+eqlguZm0M0KIs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616737652; 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=U3zEkKEGf8a3E3EmWVM3QIoTpwifFP9o4rAzg3VF9bI=; b=W1/TBr2xqU+mSUwqPe6Jay0dcF+KyfLOuRE9eL0HMpkEezPGu9JX27t0lLhUtqAvLw8p2s7w++R3XhMyLm8oSp4+mXJ74kNMXVcgxtYvxY1laBsKPBcPB8cyswOjkoALf+P4736P/AWusdIYOewR+2fIInwUtZC3Ar1GFfarsFo= 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=1dmarc=pass fromdomain=oracle.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1616737652565306.514921445518; Thu, 25 Mar 2021 22:47:32 -0700 (PDT) Received: from localhost ([::1]:51874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPfJi-0005MS-W9 for importer@patchew.org; Fri, 26 Mar 2021 01:47:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34054) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPfHl-0003Sw-Ox; Fri, 26 Mar 2021 01:45:29 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:32928) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPfHi-0004Bw-3V; Fri, 26 Mar 2021 01:45:29 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12Q5j6sh149526; Fri, 26 Mar 2021 05:45:20 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 37h13rrvsu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Mar 2021 05:45:20 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12Q5jJEI138174; Fri, 26 Mar 2021 05:45:19 GMT Received: from nam02-bl2-obe.outbound.protection.outlook.com (mail-bl2nam02lp2058.outbound.protection.outlook.com [104.47.38.58]) by aserp3030.oracle.com with ESMTP id 37h140yy68-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Mar 2021 05:45:07 +0000 Received: from DM6PR10MB2668.namprd10.prod.outlook.com (2603:10b6:5:b2::25) by DM6PR10MB3068.namprd10.prod.outlook.com (2603:10b6:5:6a::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.26; Fri, 26 Mar 2021 05:45:05 +0000 Received: from DM6PR10MB2668.namprd10.prod.outlook.com ([fe80::9d2c:340:5b24:bff7]) by DM6PR10MB2668.namprd10.prod.outlook.com ([fe80::9d2c:340:5b24:bff7%6]) with mapi id 15.20.3846.054; Fri, 26 Mar 2021 05:45:05 +0000 Received: from localhost.localdomain (138.3.200.16) by BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.25 via Frontend Transport; Fri, 26 Mar 2021 05:45:03 +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-2020-01-29; bh=U3zEkKEGf8a3E3EmWVM3QIoTpwifFP9o4rAzg3VF9bI=; b=QP9t+YIDQZxdTprcAYItMKpLUtYioZdsYwrV/NpuZ/6PGhDmHRlynN3QMNi0NZpCNFwl UG1ar8YdJf3h2F+QPLVbYh7bSKCEK+AMjSCXw6ao12CK6E3+dz5OpeJVQ6UG8bFiUcqi CpiI9FsVRoKnYzX6GQJHrD/Dmlaby/D1jtr5nedaI9kpDWnHczUTE/MDfmb3NhlnkEVS MNp8TJucrNngqmO1P4/oknvNfmyfZJXEQeWfNl1rJe/7qNfRA3ignQq7LCTcubyzfs65 Tf7EaN0YNqaBqySSj4oBkUah/5PDYtUx9Ow1UC3swxT+f2ljYQY3iKtwA+RJ72Z3XEFJ Dw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Agz5qLeWIGHKcNIYhclkVsDokxIn4cbhr6VrVDYzsAoTxgZ72bWYHxeU3mkryeoXqlq6XGlIBMPQXt4u7nGvm+FQUS3bvIxF+F0oqr7UmUU77VK4fZBdJgzZsM4+hWxu51wbkWayAhKUo6VkODpx2QQ8uIs+62V3PR+PoDAf2T0NOXbvpmRAii1z8Po17wxgqx/QXxirb1yjqxyHo9cxmS3Lr39PVUfcwiwhaFb0plWrcli7OnR/aavdn3bUJ8wXfTC3ejVu742S51C35HZ4lXQWy5OnGUNd5nb/Wh1QRj0k9+P0ncn+28frkrY1DLXXd5YTUDhxe1EeMxuOiWh8sw== 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-SenderADCheck; bh=U3zEkKEGf8a3E3EmWVM3QIoTpwifFP9o4rAzg3VF9bI=; b=keqz7A+xwF/SN3L8yc5Wi/Jpka2BnT4MNe/xmHpNpRwvNA4ri7EBBL2T/iy8YhZ3q/nJt8ZixWOCF5nSw+aNP3xd+3txxIBNNuLS+ydREV+OxPAVhgm6eT3isQiV2jPHP/IeO5rhy/4rWGnLKDMs/o6Ws4Hvb2tl4fpcCfsZMNksLQlxR5Z99fLKqOXfWP8JjFe2OMgLY7NcY6oTL3t2R6l3+RChqziVkhBfj990oSwKfxYPIpFl2NL0tulOp5MzpdtBAFHm/u7mH/Ajv/G9ZVkA54PK/JnLrBpR8GWibOF4VZGEna1gYhgMSGyY/kQ8jzR5o7lk1gakv4oovYDfbA== 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=U3zEkKEGf8a3E3EmWVM3QIoTpwifFP9o4rAzg3VF9bI=; b=jioZ/VeI12CQCTkXchHgPdcWnNE0hPCbdcdIFH4AleJ7it49JXwIlx63jx0YlQqQhhYmeeqaPyJjOtPddxNM6O7jDflQFG0dw/+uGXWAv+ZuoPD00hQ8NMeiB9BPe95U1kDNYAdMvVBIha8ONNz7vAZy2CR35Wcb2zePP7VSTJE= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=oracle.com; From: Dongli Zhang To: qemu-block@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 2/6] virtio: introduce helper function for kick/call device event Date: Thu, 25 Mar 2021 22:44:29 -0700 Message-Id: <20210326054433.11762-3-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210326054433.11762-1-dongli.zhang@oracle.com> References: <20210326054433.11762-1-dongli.zhang@oracle.com> X-Originating-IP: [138.3.200.16] X-ClientProxiedBy: BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) To DM6PR10MB2668.namprd10.prod.outlook.com (2603:10b6:5:b2::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b60acd9a-d7d4-470b-f4d8-08d8f01a4e50 X-MS-TrafficTypeDiagnostic: DM6PR10MB3068: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:561; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 565Gaj23S28eDlNOK0es9YPC3EVwxQc8AhoeG8KGPkX2TRQKEQA6Om3zRDFaNr01vGOUCIPeokO5KncDKNyJp4CJYk0ggyFYuB4pDS8QBIvO481U2q0rdcim4xPyWnDwfIqBTq+WmIbBiNX+xuaP/m339NmDjKwBGeKUped0Lwm9GIm91tl0ZGKpvyjxQKwCNlA8nr8QZe105qIm4qsvtjv+6tcd2NO7D3+RApZiu8X7pz+QX3GOnbHRMya6HNNJn6X9V5gCi1wiYvh6xuVMz8UvSWLgpixd3iEZc/wCiAcTMECMsYaebfagni6yWnLn55TwP5mUH6HIt6fSUjOSYcjSUIbwbOwBJCNQuMyojVtT5M51Xzb/uroEUIRYTLkOksiMlvqPVhLLhxhK9qXbJBXvEBxL7eqef9scxMvORpfix2Fm5MW7zpsPMEQ/sIohE+w1Vrc753i/iKCQVfj7/lCtvPmRq/RL0b8mCV5rrJP0BgFSV/Xe5upGzRb8u2O9M9AVo1yyNENkGiUROw5EvLpYDKD0BL99t4McdXlWoJJmeyanKpY6SgOFCT5uScNgO3o3RntonIfCbDjbL38etDZPDbEdREbVOtLLeziaZ4OKLFxBPPmZMMygzP0uHcqXy/ydD0Ci4OE+aGudJwbpEVKZ+TDI0PdRerBTmWNMdMq/mCSYrdZ/cxKBZz+WOFsq X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB2668.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(366004)(396003)(346002)(26005)(8936002)(956004)(8676002)(36756003)(44832011)(6666004)(16526019)(2616005)(7416002)(6506007)(186003)(6486002)(478600001)(5660300002)(52116002)(69590400012)(66556008)(38100700001)(1076003)(4326008)(66476007)(6512007)(66946007)(316002)(107886003)(86362001)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?Mi3qSJuqITp8AoVRXOyBkYNkL4RVqmoPjvDYPcWY1JYAX9fleUWTeSQieKtk?= =?us-ascii?Q?DRRcmDveP09LY88Hbnztk3vUrawkCpTAnZeGZbLrQ3wgBbYi/ewjwmfw44ZU?= =?us-ascii?Q?WYxV+2ZHFpPEacp1YAxz1eJ1J/GpVFPhtNC9yShEXDn+eAPcXXmuZNHETt09?= =?us-ascii?Q?5rBorxtOTJ2iKPTgGqEB+HMhx7U3cPRaqyQdSS0VK07Oyr35Pdq4IpvaE3mQ?= =?us-ascii?Q?F5zBlLVvqfLc1BXVYNKhYol3+AwfqKi1LuCPowQ+gy766aeW1m+adc/juTKz?= =?us-ascii?Q?CF4DWoD68zbnooNWxNiS2ymJaDiOYCujewcMlRqWOGPQ8gqYTr3CHg4lmTLx?= =?us-ascii?Q?lOltLFi9M/4jpl5zWXgU5OPQXVcJdZM92Fm3tfVA0xyq6QyxhKeA7aQX3UcC?= =?us-ascii?Q?rXKz9uCceXpx5ZLxz6+TFGtQ3CgKKmSZWLRKeQnbBqu2x/6gN855iZL90aVP?= =?us-ascii?Q?S7eudZbLqRFp0zAQbh9ui8bbBd93vDj1fzKKklMP2w81CHDVUJt8lHIKq6fT?= =?us-ascii?Q?hl0sHjFe5+KapOSJhDe1mDro5+DjoMmrAsEI79HuSGcM2ySI/fMVbrVpCKTC?= =?us-ascii?Q?NfIu2T5fBZQw9AWGW9yiFc375SEsfYqsg0ROJxKtpplq2voDDPkXEnTrTf6s?= =?us-ascii?Q?hcai4PDe9NZszR+NH4eVlh5Uu18nAhmu9UymnkGwwwGKzXVs6Lv6/cyYw5kr?= =?us-ascii?Q?/tZqWD5167AOAa6V54D/OKDdDOKF8lKL2np/OEd2WEspGFXIMrfWFWJSP9cd?= =?us-ascii?Q?+vmCDJstjWbO0b2wNmgxneO1rsCiy4ZaXtdwe5qjZ36baaK/5El7sRfF5UIL?= =?us-ascii?Q?D94a8rdltHuO6DdNZ052waMk4VH6Hab4IuNS5ch+i0wNC2H6lQjRV61+Ov99?= =?us-ascii?Q?oQG2dlRFpJt+9Vd76eXM+ZldlpCvKHK+2ivO6THMFGdCkfFaGT2K8quGOIiw?= =?us-ascii?Q?ZIrIK5KJa7fHwtd8nNCoFIg0oBlcFHJBYKjJaiMWCF40heWzoLpwozjhV2Nn?= =?us-ascii?Q?jSu5wBpGwVD0hSlGMK/ZwJvtmZJ8hYqVOYWGoDZDzMECodLP0NC30lnLiN9K?= =?us-ascii?Q?TCxA34/UqZ5R2BjVg/gxQjQBCxhoDmayHITGVd9D5o20KrCgmKvWxBSxIybA?= =?us-ascii?Q?jDSY+4yKsavEUNByMSu6ATxy91AGKuXPPZ+4wFJxTgPpx/7LSNyv506mGcDz?= =?us-ascii?Q?22v6kK4gHxZAoRTj4ypRo5OfMYTpDn1olxQ8Nvh1ffcl4YrZUuc+57IH5zyy?= =?us-ascii?Q?epWq1bIuX9pItBpswhd3slfV0D7Q4MXt6tkADJug/4CTGJVGARfqU2kQaUTX?= =?us-ascii?Q?nPAd7VivEBulP4IZsxIoJHih?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b60acd9a-d7d4-470b-f4d8-08d8f01a4e50 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB2668.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2021 05:45:05.3795 (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: MvsbkuIqX72RNk3hduY2wPNyHZ6cnk3U0ZvgqCTMSpf7p2got3kISu1tUItCExG+ZiM86DFYT0yFaLuvhntJlw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3068 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9934 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103260041 X-Proofpoint-ORIG-GUID: 3Yp8ee4U1f3X20mCU_Kk-bJoI4WJ2Qeb X-Proofpoint-GUID: 3Yp8ee4U1f3X20mCU_Kk-bJoI4WJ2Qeb X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9934 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 adultscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103260041 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=156.151.31.86; envelope-from=dongli.zhang@oracle.com; helo=userp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, berrange@redhat.com, ehabkost@redhat.com, mst@redhat.com, jasowang@redhat.com, joe.jin@oracle.com, armbru@redhat.com, dgilbert@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @oracle.onmicrosoft.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is to introduce the helper function for virtio device to kick or call. Signed-off-by: Dongli Zhang --- hw/virtio/virtio.c | 64 ++++++++++++++++++++++++++++++++++++++ include/hw/virtio/virtio.h | 3 ++ 2 files changed, 67 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 07f4e60b30..e081041a75 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -30,6 +30,8 @@ #include "sysemu/runstate.h" #include "standard-headers/linux/virtio_ids.h" =20 +/* #define DEBUG_VIRTIO_EVENT */ + /* * The alignment to use between consumer and producer parts of vring. * x86 pagesize again. This is the default, used by transports like PCI @@ -2572,6 +2574,68 @@ void virtio_notify(VirtIODevice *vdev, VirtQueue *vq) virtio_irq(vq); } =20 +static void virtio_device_event_call(VirtQueue *vq, bool eventfd, + Error **errp) +{ +#ifdef DEBUG_VIRTIO_EVENT + printf("The 'call' event is triggered for path=3D%s, queue=3D%d, irqfd= =3D%d.\n", + object_get_canonical_path(OBJECT(vq->vdev)), + vq->queue_index, eventfd); +#endif + + if (eventfd) { + virtio_set_isr(vq->vdev, 0x1); + event_notifier_set(&vq->guest_notifier); + } else { + virtio_irq(vq); + } +} + +static void virtio_device_event_kick(VirtQueue *vq, bool eventfd, + Error **errp) +{ +#ifdef DEBUG_VIRTIO_EVENT + printf("The 'kick' event is triggered for path=3D%s, queue=3D%d.\n", + object_get_canonical_path(OBJECT(vq->vdev)), vq->queue_index); +#endif + + virtio_queue_notify(vq->vdev, virtio_get_queue_index(vq)); +} + +typedef void (VirtIOEvent)(VirtQueue *vq, bool eventfd, Error **errp); + +static VirtIOEvent *virtio_event_funcs[DEVICE_EVENT_MAX] =3D { + [DEVICE_EVENT_CALL] =3D virtio_device_event_call, + [DEVICE_EVENT_KICK] =3D virtio_device_event_kick +}; + +void virtio_device_event(DeviceState *dev, int event, int queue, + bool eventfd, Error **errp) +{ + struct VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + int num =3D virtio_get_num_queues(vdev); + VirtQueue *vq; + + assert(event < DEVICE_EVENT_MAX); + + if (vdev->broken) { + error_setg(errp, "Broken device"); + return; + } + + if (queue < 0 || queue >=3D num) { + error_setg(errp, "Invalid queue %d", queue); + return; + } + + vq =3D &vdev->vq[queue]; + + if (virtio_event_funcs[event]) + virtio_event_funcs[event](vq, eventfd, errp); + else + error_setg(errp, "The event is not supported"); +} + void virtio_notify_config(VirtIODevice *vdev) { if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index b7ece7a6a8..21bb13ffa6 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -210,6 +210,9 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned = int *in_bytes, void virtio_notify_irqfd(VirtIODevice *vdev, VirtQueue *vq); void virtio_notify(VirtIODevice *vdev, VirtQueue *vq); =20 +void virtio_device_event(DeviceState *dev, int event, int queue, + bool eventfd, Error **errp); + int virtio_save(VirtIODevice *vdev, QEMUFile *f); =20 extern const VMStateInfo virtio_vmstate_info; --=20 2.17.1 From nobody Mon Apr 29 00:55:16 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=1dmarc=pass fromdomain=oracle.com); dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1616737759; cv=pass; d=zohomail.com; s=zohoarc; b=V7g1WIE44IKC+1JZX0SddjzK3A2dCj3ywt+4RBMUDsa9TtSLd8chKbkgwiCJZvm3Wje0+npGZYzqVlR4erA4SEUeeX1GZoadtWBJ3nkae3f9rAh3TdeLiungfM641Y0Y4Hu2N8hN7ZO7hw0mX+bjuYTG/wtnaJmIZkdxoDVVrn0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616737759; 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=SGOhVftNZ3loAeAiEr0UwV9tBb0hpZnIvHuaMM4XLSw=; b=BfvLVVGeWD8Urnq0HibeEjN/NcMz12WkOSdCYM70TKp6gkC+78dTN6xpkmKWa5yzJKC6w1rPJYsaVHueNo1i14y/CPkA6Cpl2q2X5VsBTLlCWkSZMjSeIAFijxq/s3jyT8lsiausEm+WewVtG3+PqfZqBl2bAn8Jlri9PXe6R0A= 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=1dmarc=pass fromdomain=oracle.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1616737759604654.1059385345422; Thu, 25 Mar 2021 22:49:19 -0700 (PDT) Received: from localhost ([::1]:59444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPfLS-0008Rc-7x for importer@patchew.org; Fri, 26 Mar 2021 01:49:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPfHr-0003YT-6P; Fri, 26 Mar 2021 01:45:35 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:35078) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPfHk-0004DL-H1; Fri, 26 Mar 2021 01:45:31 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12Q5i6iM146298; Fri, 26 Mar 2021 05:45:24 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 37h13e8vv8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Mar 2021 05:45:24 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12Q5jJEQ138174; Fri, 26 Mar 2021 05:45:23 GMT Received: from nam02-bl2-obe.outbound.protection.outlook.com (mail-bl2nam02lp2058.outbound.protection.outlook.com [104.47.38.58]) by aserp3030.oracle.com with ESMTP id 37h140yy68-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Mar 2021 05:45:22 +0000 Received: from DM6PR10MB2668.namprd10.prod.outlook.com (2603:10b6:5:b2::25) by DM6PR10MB3068.namprd10.prod.outlook.com (2603:10b6:5:6a::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.26; Fri, 26 Mar 2021 05:45:06 +0000 Received: from DM6PR10MB2668.namprd10.prod.outlook.com ([fe80::9d2c:340:5b24:bff7]) by DM6PR10MB2668.namprd10.prod.outlook.com ([fe80::9d2c:340:5b24:bff7%6]) with mapi id 15.20.3846.054; Fri, 26 Mar 2021 05:45:06 +0000 Received: from localhost.localdomain (138.3.200.16) by BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.25 via Frontend Transport; Fri, 26 Mar 2021 05:45:05 +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-2020-01-29; bh=SGOhVftNZ3loAeAiEr0UwV9tBb0hpZnIvHuaMM4XLSw=; b=vn+dt9UAtxFfzMJZs0/8bTBRwx5OxD0pDtBBi7fozKUOb2jiPbRFNRELvYDbRGR/wTe6 dK314/ChGPrbKIu5zEQTKOiIE6SuxwoOL6KMLxq92GDJmyT/KhOgDR0uhk897kF70GUl 6A740JKj/siAy8uXyuHsLqqlFg5Pcl0FVwHi8Cno5mEg0zCfyPbOEw1j2xYqo1lzWJ4m jffNZv9O/OKwCQL/zwE8AohmC8BActikQuOWBQ+EHfar6HfRKFHH88pWaT8S16umz/m+ iRGhJ4dSy1F4fWY09ST6aDnewf7QmPlkQLV8iXBmPBPTVibcibPVHdQnyMku2TnzVxhm Dw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VvSLwUD/FhRMwU/SuUd1LsOMhhQgvVswrJcZAarKdjhR5HE6Lhvs1yiYmOw9Ew6CIZQrRlklqFos6f1I+/3nwx3rOVucCzxIB1qAPkZAwbgiqM8VEu1X8IGPdYTz4hfIwV0RKJwa5f9obx5UafqXWvjIA2i4zOirh4jNMZBFhHBYJWajf1wvGGqNP3QEtNjiGYLVYSkZPqrrNWmP120Hs/OwOlwW4Ttgk2497OyZYUFGkpiOLBf15FMh3wrDWGZT/P8BBW+bGFNCXxjwFM4HFoA9X6tYTEPmo6kwo21cEoTHaWDUY47n/7j6hhhRt5MGOC+DKymDasXPdFLeo0TMnQ== 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-SenderADCheck; bh=SGOhVftNZ3loAeAiEr0UwV9tBb0hpZnIvHuaMM4XLSw=; b=C/yaDPHbASKxFnIqrK51Skqw0WALekWTCCm1eKM84E8oQ6zYF5A9YHggeZg1Em8EtJRtSjMRyip/01EcNsD2LDiHkeuRwdmjw9zWHDnGz5zm5KdilOh2++f8LmGkpIT/tzW4ra2x9CfbFFp24fPDoyugwWl+Wn3vgEDo+/CKFdNJSzsIhurrjJR9wMDmlP/lQgYbua8c9/rQFi9mYdo3U95j8zRuldLAb2oOD6AAL8S6PoauPNpDiiMEEPgAu0+ZNfKHDJCSGYY2H8ZdONpbhKNHUJsbhh3pyS2oG2PlmJUE3epktVki/pTrnZtRUnOLubwNjkGamacIACzZtLJ2jA== 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=SGOhVftNZ3loAeAiEr0UwV9tBb0hpZnIvHuaMM4XLSw=; b=xYWJS5CyZFpLpqpd0M2q16l0ltsckMgNcPo07IJDLfmY6iw8QnPvLczZ9XVv6R8YwBqk0i9b5rErAR/KO2FBeVJBqdY0Ujp2NN2DVSptvumvRPoWGthKXBp4ZVZ2zqyAZLKI/XRRkSU+B0eK+vosITo3+NkqGOPd19msVj/hky4= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=oracle.com; From: Dongli Zhang To: qemu-block@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 3/6] virtio-blk-pci: implement device event interface for kick/call Date: Thu, 25 Mar 2021 22:44:30 -0700 Message-Id: <20210326054433.11762-4-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210326054433.11762-1-dongli.zhang@oracle.com> References: <20210326054433.11762-1-dongli.zhang@oracle.com> X-Originating-IP: [138.3.200.16] X-ClientProxiedBy: BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) To DM6PR10MB2668.namprd10.prod.outlook.com (2603:10b6:5:b2::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a986a158-89a5-4043-a829-08d8f01a4f66 X-MS-TrafficTypeDiagnostic: DM6PR10MB3068: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:138; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HJ6aTVm2FIgz5dGSNS3UouecdmBOoM/Qi+oQtZ3EVv2RuGyuOTDGpuYyE43YojlDX8qdDuTJhxbnNaViMVKd5lDSP/u1CeFtcV3OV3IgHfkHDuKh8zpd1VAF3eOSi2pc5igTL5EWcyED5mERBxgwsI7ptuzW3w8WAt+hhhPBifimOkj4s1JFL1an+t/qnt5ahTFyztihx//91FsXHlGJ/vcSmRP394Z5/SZvHrNHMvTEjrhsA9r1JdOx8sFyc4zOzYs5iQchS5x4W3eYZX7VohUQ13TsXlgc7IftzNmPH+A/dk0hWyXpyprq53iLM41yHvwg2zWWjeTHZivNRoZRVbre92HtkQbOMSfLARc3IpiS158kbqkjJt5KZ/CUHhp0pdP468NUfUDSkP1PTC2DLBLclODXwOxheCEeZkhsLXHW7mA5XdeFi0vued6/zkiBKTA5B+MMpk4t2w+9XGraLPH6ZMVUg5jR9RCXcUOevUGpuP9bVW0FU6XnOLpFDOSRMRHPVA3eEB8sTL5E2CGvZLrFYuLDkxcZPzoFzZ/aCgfnk5I4Xqe+1zvi1RJbqxNqAj3tHszbU/3fQQC0RlawxN8RzneSE1lx7G9JYO3wohXGYHX2X84A4qMSGPz3T9WjI7enunc6kMpAykeTpwOP5z2cB6w/n/sESHi6LY0t3wNyhiN/3SdFBMljFk50QEIT X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB2668.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(366004)(396003)(346002)(26005)(8936002)(956004)(8676002)(36756003)(44832011)(6666004)(16526019)(2616005)(83380400001)(7416002)(6506007)(186003)(6486002)(478600001)(5660300002)(52116002)(69590400012)(66556008)(38100700001)(1076003)(4326008)(66476007)(6512007)(66946007)(316002)(107886003)(86362001)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?dAGcrILfy6Nc5D6bK9kfzHgbniqlII8Nx7Gdu4wMsSKw2UuminHGKpuIdmNz?= =?us-ascii?Q?r0hg84kkrUzbFUik1/u4iDVMfhos/EhULK+0d7RTFYFJorr5zvXLLjUthjc8?= =?us-ascii?Q?2MdC9A0NR/SJ1wRQo1whUNJnJ4FKl3ZlLjH92CnlhmfhIDogihbKluPc56yG?= =?us-ascii?Q?ZOlzzq89+fVsjAlgfH5UUYZTNgEok7S5/sc75Jv4MwWcoR25tBoKmxYTmblF?= =?us-ascii?Q?Rmr6/aMVhC6Z5A2tROksMIJdU1N2mN9eW+BQT2ImPv7pLtKALlqOpwwMtjvC?= =?us-ascii?Q?pU0D2t4MV9FXeijG0mviRrspeq0MDJGQ89qXtBHN0DfG2Pj4CNXgexvvxkGO?= =?us-ascii?Q?ej1q5ezuoEqxRbIISt6w5/eMotkOAyQWHqXMTu9eNSupDJJ3pXWcyiVJq6gj?= =?us-ascii?Q?VtqRcwq4A/XcN+DT91b9XGOiTl3My2+ONi5AeceI4UkCmMU2Fq9rehv/Txcy?= =?us-ascii?Q?tsCTsZ4VKMUhmP/Dw2sMoZNwitq3tsBSfGxUCziJB7bwuLkE7OOKoo4C/iOP?= =?us-ascii?Q?LdJbDGYY89H7qdx10We75N9oKD/W/cGo/alOIERl4FbSkk5rp6+N14q38bkt?= =?us-ascii?Q?b9ZnySa70UZgrX/L0TKQAdc+jsInQYMeEWQ7O2KJQCbHdAr2EpHAZuOW4pMI?= =?us-ascii?Q?qGFgfyHLIjJRS3OdtqcKSM9DdgZ56L4iJWlvzfuKBVo+fPMpNegQ1o4EiRD2?= =?us-ascii?Q?GxVmtPhg7JHtmTPxh3n3/cWD1edz6jHWmIfBABsDCJAhIkharEE5FuJdXEH5?= =?us-ascii?Q?vH7aR63b0c+w2TwhcqQPiy/aGMahTEMIp5SdY+Xld563cIX3GpFNMT70jafT?= =?us-ascii?Q?J/f6adiGhYrAJK2YqMdhyiep8KKep0G4Uw+5ns7pvKkZGCpCruzZPjp73ZaT?= =?us-ascii?Q?3eh2Czm7oM8ESGHQftGWWn2sHx4KLwAM9JbqVr1wq0gggX4+VhNOOm1NyNyE?= =?us-ascii?Q?/wkg8hJKDegfT9P32NF543fSwE1TMDuE57ZmuHs3Ur/75+M38T4Uc8XqJdcM?= =?us-ascii?Q?GYIP1cI9QGfwbMzmrq2JxtckRgdKNIRLCPeMUsONNR1LOG0RaY+EXqD1WkD9?= =?us-ascii?Q?zse67trm8cENancFy5QEXwbBoOdh4wMQYsN+yyduTtueebHho8DEM5R1ENTu?= =?us-ascii?Q?oRCi+UC0PzaUH1GxbUR2NTRbXq7mWjRqUO+VYadjFe/yj9WrsfQzprBSTgzb?= =?us-ascii?Q?qG/it1tzZx0JzFQl78FevJi4pdpJDeKVxXUVq7/kB6RC4FObK8YhVwIh6rhF?= =?us-ascii?Q?qZZi6+MikQWs1cug78Eda0m1ZNNRCilwG3Y9xx231QIXPLjZ5oCkW27g7qIJ?= =?us-ascii?Q?zwmnpr30yBJIituKmkYeKO8c?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a986a158-89a5-4043-a829-08d8f01a4f66 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB2668.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2021 05:45:06.6687 (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: 8vFxNWfvNZTzz6jk8AUtz8I9rFlIsV/mRJmNS//IU6Bk805+GzOg883w5/NM22UVQ1aneFAVHRMEq+aqOLnGFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3068 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9934 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103260041 X-Proofpoint-ORIG-GUID: PVedBoFQArs7i7SZtAo31SKDIyp4QIJ_ X-Proofpoint-GUID: PVedBoFQArs7i7SZtAo31SKDIyp4QIJ_ X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9934 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 impostorscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103260041 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=156.151.31.85; envelope-from=dongli.zhang@oracle.com; helo=userp2120.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, berrange@redhat.com, ehabkost@redhat.com, mst@redhat.com, jasowang@redhat.com, joe.jin@oracle.com, armbru@redhat.com, dgilbert@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @oracle.onmicrosoft.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is to implement the device event interface for virtio-blk-pci. Signed-off-by: Dongli Zhang --- hw/block/virtio-blk.c | 9 +++++++++ hw/virtio/virtio-blk-pci.c | 10 ++++++++++ include/hw/virtio/virtio-blk.h | 2 ++ 3 files changed, 21 insertions(+) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index d28979efb8..2b3583a913 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -1118,6 +1118,15 @@ static int virtio_blk_load_device(VirtIODevice *vdev= , QEMUFile *f, return 0; } =20 +void virtio_blk_device_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + VirtIOBlock *s =3D VIRTIO_BLK(dev); + bool irqfd =3D s->dataplane_started && !s->dataplane_disabled; + + virtio_device_event(dev, event, queue, irqfd, errp); +} + static void virtio_resize_cb(void *opaque) { VirtIODevice *vdev =3D opaque; diff --git a/hw/virtio/virtio-blk-pci.c b/hw/virtio/virtio-blk-pci.c index 9d5795810c..f1fc72e7f1 100644 --- a/hw/virtio/virtio-blk-pci.c +++ b/hw/virtio/virtio-blk-pci.c @@ -47,6 +47,15 @@ static Property virtio_blk_pci_properties[] =3D { DEFINE_PROP_END_OF_LIST(), }; =20 +static void virtio_blk_pci_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + VirtIOBlkPCI *vblk =3D VIRTIO_BLK_PCI(dev); + DeviceState *vdev =3D DEVICE(&vblk->vdev); + + virtio_blk_device_event(vdev, event, queue, errp); +} + static void virtio_blk_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { VirtIOBlkPCI *dev =3D VIRTIO_BLK_PCI(vpci_dev); @@ -72,6 +81,7 @@ static void virtio_blk_pci_class_init(ObjectClass *klass,= void *data) =20 set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); device_class_set_props(dc, virtio_blk_pci_properties); + dc->event =3D virtio_blk_pci_event; k->realize =3D virtio_blk_pci_realize; pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_BLOCK; diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h index 29655a406d..500be01dff 100644 --- a/include/hw/virtio/virtio-blk.h +++ b/include/hw/virtio/virtio-blk.h @@ -92,5 +92,7 @@ typedef struct MultiReqBuffer { =20 bool virtio_blk_handle_vq(VirtIOBlock *s, VirtQueue *vq); void virtio_blk_process_queued_requests(VirtIOBlock *s, bool is_bh); +void virtio_blk_device_event(DeviceState *dev, int event, int queue, + Error **errp); =20 #endif --=20 2.17.1 From nobody Mon Apr 29 00:55:16 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=1dmarc=pass fromdomain=oracle.com); dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1616737703; cv=pass; d=zohomail.com; s=zohoarc; b=flQboDdwhRPV707X8QZRPWgQ9tzrQH3ehgN3kk/v2lIBnKDmJyf//Inik9FaF/j8ZXoFDobZgCh5kTQuN1cqfNkFbBOvy5v06vPGpD8uN1T/+dYhcRZHW34yi/tsLl5TafKrXBuA3mgzaTVI5LNEqZW+fm+mScmEu6jnOU/FtXI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616737703; 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=zGRRMfIHZbgrQm9YJE1RREplBXoXmYnQ8wXownCZOiA=; b=HPznbaupF1b9f3P9Bvb4PiTxAfWFTcNEOspjQMvavVbAv0+JgUoxOrba73U7AUQh1zrXSCrJrzB86ylu4rydWlvkMwwpxZe57qhBpTTsgC9X8FPvpkxHVu9YwCPtzb58ogsq27UySc13vqPfVREWNqjv+3pEhKynZQbPBg0gQ3c= 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=1dmarc=pass fromdomain=oracle.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1616737703488565.7986269615919; Thu, 25 Mar 2021 22:48:23 -0700 (PDT) Received: from localhost ([::1]:53098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPfK1-0005rE-Vh for importer@patchew.org; Fri, 26 Mar 2021 01:47:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPfHr-0003Yd-AI; Fri, 26 Mar 2021 01:45:35 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:35364) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPfHm-0004EM-Fo; Fri, 26 Mar 2021 01:45:35 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12Q5iMUT164902; Fri, 26 Mar 2021 05:45:24 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 37h13hrvnh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Mar 2021 05:45:24 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12Q5jJES138174; Fri, 26 Mar 2021 05:45:23 GMT Received: from nam02-bl2-obe.outbound.protection.outlook.com (mail-bl2nam02lp2058.outbound.protection.outlook.com [104.47.38.58]) by aserp3030.oracle.com with ESMTP id 37h140yy68-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Mar 2021 05:45:23 +0000 Received: from DM6PR10MB2668.namprd10.prod.outlook.com (2603:10b6:5:b2::25) by DM6PR10MB3068.namprd10.prod.outlook.com (2603:10b6:5:6a::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.26; Fri, 26 Mar 2021 05:45:08 +0000 Received: from DM6PR10MB2668.namprd10.prod.outlook.com ([fe80::9d2c:340:5b24:bff7]) by DM6PR10MB2668.namprd10.prod.outlook.com ([fe80::9d2c:340:5b24:bff7%6]) with mapi id 15.20.3846.054; Fri, 26 Mar 2021 05:45:08 +0000 Received: from localhost.localdomain (138.3.200.16) by BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.25 via Frontend Transport; Fri, 26 Mar 2021 05:45:06 +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-2020-01-29; bh=zGRRMfIHZbgrQm9YJE1RREplBXoXmYnQ8wXownCZOiA=; b=Lb2F44VbhiOZlgW1aKOv3XMGuBLY26sYN5e8S95WZzlX/qfpCyhv6k9B3zVwbu8nNa+b ZQPZYvaCqMWyS0d4GlY0pVxvgbaaG6gAnE6rF/BmjBlqhqEbXz1z3894gY4113Z3Zrry uvChEYyOdvSW87N/67LZ+OXtk27I1XsBtF2R6ih9g37Lva6lT8CCC5G6OJwBmgc3B3pr h+n0DKWxO0y7JhogpWb6+LbGIUjkS0iEcPW5gaX5kPC1+TGbAFmJW6eXLfSj0GAkbg6b t3AsvW26YR6rGlw6i10/BP/v5Jp0JwwRcnZRYdH6MgdkwkGXdKQwBBU02075+Gugzxmt VA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bvDbH/UB7vj5lNXCMVps+GDgWON+tN7bMoccvOWQftaUKPTPyJXeverbPSdDToTsUkb0jUO6Zfy1aWb9mb0FlrWnxT5I9AN1v9hTDc5V7jelanAWr9kBl3r3YLl7uI2WlikU7Inp7zpKwU3Dhu2jcBx7VX7rKmWdKzzrPyHJBe2e/Cx8HVj5AuMxS31aGvRx8+QQq9ufR/8ushP5MU9CH4XDRWgplIDRcUaqdZusHTuQG7u3vj87jvu5hjp5yyqyFsYM5hlnyymiPCoVnMmWbJ07WhsqnbN4j/j84757bwGwEl+YYXVXjWdJO4+UUur+DJWwqV3NzyUB0b+Crwgdaw== 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-SenderADCheck; bh=zGRRMfIHZbgrQm9YJE1RREplBXoXmYnQ8wXownCZOiA=; b=FIm5Wm4J7vRYUxTz7aVqA6Qh0zcJrKWCpYO2N3WmmWQBOJ1BkfBrcOOiC+iENlP3+eEW66/B+mBEkFmegeKpRq4CgnoRED1/Cn09nPA+g0eZ/D80pGBIjVhx2RXu4uvhQ0LAcuFVE7oOoJPJB60xI+1kZtlyggu9Gfy8enmWlKYbOHHEcwT02X9O7giQym356e24Ya/gBFyv7ASdFDYuM0IRPWsBCqsRB6y5SWk36CvYgaWe+q+WSyE6d2VRtm/BnX1SbdrF6oQrRWH6hoKBvAi1niWd7neHcqgoJkLc3/Ac1hdPdIeOJbJhFHro8WsVX9D8MfRmYU6ZZgLHL2Bz3A== 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=zGRRMfIHZbgrQm9YJE1RREplBXoXmYnQ8wXownCZOiA=; b=zF4zVZjkaZDikOzsNRDrRV2JqtNgjsR3/G4K6OBhBa7eyrcYIxyzOYjawle7ZekIV3PNpZ75xg9cI3mYnpR1YTT6vIzwz/OIZi/d5dnhafUmEm004nIHwdQkwfd1lzBdBoi1FZ/waiCp4ddm+luefcDc1ZULl6fQqe3N0gMDA7o= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=oracle.com; From: Dongli Zhang To: qemu-block@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 4/6] virtio-scsi-pci: implement device event interface for kick/call Date: Thu, 25 Mar 2021 22:44:31 -0700 Message-Id: <20210326054433.11762-5-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210326054433.11762-1-dongli.zhang@oracle.com> References: <20210326054433.11762-1-dongli.zhang@oracle.com> X-Originating-IP: [138.3.200.16] X-ClientProxiedBy: BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) To DM6PR10MB2668.namprd10.prod.outlook.com (2603:10b6:5:b2::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 326416d9-6773-4864-4349-08d8f01a5027 X-MS-TrafficTypeDiagnostic: DM6PR10MB3068: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:241; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pgLuEUCUc2/zb0ZEM3IZ3GRyU7W09d1gLAA4u3Ho0Kbmi6uH79QkJCTLY9Dpxn7/yqjvHWa+0SbZy/7pUhLE5XRjtLYQzNkwgvEp4/OtI8vK6POyA4QXRqJPddyAEXBiEFOjBcNqjmRDjlaGd6wtUluXqbEDDu0P3u7H5PjNtB/9Xv+j0BbmqLWQ8nynRcqAXDeyvz4IZjzEBfxJ9wK9RadwdzB6shi1/QOvbdTaUUP+1+G1Y2kml0CKXUGh2APyWMtYloe/ENwMXh96TiSFUSNbeh3WibuMbeWp9ltoJqlC92w03HxcVFIb8LDB1bdO22nQnHXUg+r8nYP88czQTCD4eD4rN2MUWv7QQ2HCey5FXERkaEUkFAOwwF6mfyKX4Lqi1Kz7VpT87b4XkQjOQRiXWN2GZuEm1bw3iMsLIMeo7HZA2obcj8MktfLAeruG5BW8usnoAA84XyddKptJ6vms2q4BJI30fkMdPlvmtzJtPS7aEeuww+nZsLopjeT7QrhMeQsZ7Q0wqe81ioBMdgejpFOzy1I9xWMUy+JpfOp3VR4QzgH80qWr1PmbyUVaWn8Qayx7AMOEikkR5OM8oh9BnwTKc2e4BPUQfc7NBLvgKedZVjRFa9Rqt3RkDxvsW5VdDlLy5OXH/qviPUSU5IVUtceXu1LSvq5suDnXEhPsIJkeGHu4AyRWazLPgwu4 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB2668.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(366004)(396003)(346002)(26005)(8936002)(956004)(8676002)(36756003)(44832011)(6666004)(16526019)(2616005)(83380400001)(7416002)(6506007)(186003)(6486002)(478600001)(5660300002)(52116002)(69590400012)(66556008)(38100700001)(1076003)(4326008)(66476007)(6512007)(66946007)(316002)(107886003)(86362001)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?gMen1FSWDiazDACRyzA0pkVlcgrVa+DMMl1n/5qSxhZQrvBfm2izYXfiTAk/?= =?us-ascii?Q?woHWpxLBcEMlRJEFM7XDS8ROukjQmmzHVV79hkiCWMTHTpuMWPvYgs9nEkNA?= =?us-ascii?Q?zGIRjc35puyqSHONbYuxjo3xdPpOHP+Ljm2DdnkfAEq5Pq7I1PAdZGYjoz+Y?= =?us-ascii?Q?Km7UZUW2pucNEHsoSp9xVwDywMM3srCS3kwGywLDdZsR9wEDmFNJYnG5Zu+4?= =?us-ascii?Q?ebfhJ5rzk3qBYBZHlBj+FjIIQIACE756CPhJDLB8bWYqrAh7uwPe7Gt13P7i?= =?us-ascii?Q?BffQVt5xiUvhQCmYjG0N4ED9yXxr040vQoS2NLGkho/zZHKEoVBnHoVyHhj0?= =?us-ascii?Q?fpaiJBpq4k2jZgD6Bu9IZ0dF5Q7Gx36CZsQzMNp2+MM3FxpEjOEt2FgF+PVF?= =?us-ascii?Q?pUqRpv/jIOAJns5H8W+zs95Icqvrz3VRViiKGzSMQh7SJ60acuddoNM/9YHu?= =?us-ascii?Q?Rm400Kc1DDI72SGdTh1sYHRtavpeIU8/dAHYlIgrhraSik0Qh4HMYsmgQbcv?= =?us-ascii?Q?nUS7+CSsfpXDHw+laS3lMO5horQLERTquctshIRRZxAX4STl+BeLjAOZX2Cx?= =?us-ascii?Q?1MJVaa9mqpqlchlR7b/jRvxO0elJfYFT1J1lZBEkQUd3TXWSmxrgCGOnjnJF?= =?us-ascii?Q?KvDN8RVniqhyraTcU184vGo8mmNdF7d9J/LSxapJ5Ppw3eo11pM0Aeno5yfk?= =?us-ascii?Q?wrWWDrBBN1DnfbMKhGSoZ/2pA4g608KQMrfgJeZMYW7q0aRNJOtyP+zhqOTQ?= =?us-ascii?Q?3zC5lYWuswcIiM5GT5uVELcC6nTQJNcFfvjj7LnuvKGGWDgQGMsiV6NWFn4H?= =?us-ascii?Q?zuv4z/q2cpzbUSMX5ztylqYbv9oWTlCvecvEHLg63DhaoV0nDkdunp50XPwB?= =?us-ascii?Q?+anmgl7Vc6FyHYYhvyHse9VQTWFh0De2/TbHpbTbKEu56D8/54rFide3XN87?= =?us-ascii?Q?XjjIFmPVd9FXi/oR6iHiIM13wXStirFFAs/8ePLR4HG8QIz3m7BqNi1rh0G6?= =?us-ascii?Q?cJcpzmGU6WY4EXQPFSaDq45imhUzGY1cg4NpvysQqiQd/otJHt0V0uwe5nFC?= =?us-ascii?Q?SJYRi0criL8+LrAVn3EsuGR6OyrP/QWIL1Yd69kao6uzrUfCPoCIjNniWu4i?= =?us-ascii?Q?kDuDWkLQdEKTXZW9QgnlKwaetfICT3P/G3g1D28M3/wdAWpgDwZL5mRdeVjx?= =?us-ascii?Q?Y+u21OJsuv5hF9H1gNoc63Lt+k6wLRr8dbaHIZG8fV6lR/QZsuob/AQxLREJ?= =?us-ascii?Q?qRdeJQMGuIAooAbXR+ITxhQcaIjjcrPjNRM5ZpGymKgcBqQ1a1BqXHPAWc7K?= =?us-ascii?Q?EWfg8AaOYomjYl9lOzsY1jae?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 326416d9-6773-4864-4349-08d8f01a5027 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB2668.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2021 05:45:07.9010 (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: sH7/BpMYxii+aRyUOJSBhf6bU8+hrzrgerK0Tya7fs5n75PHJ1/W/W69SlxvP5RUz0LLHaOYo1oUVigtgZr0pA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3068 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9934 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103260041 X-Proofpoint-GUID: XeFow2WbMaiuEFAvPKiDDj_vNZoNazAc X-Proofpoint-ORIG-GUID: XeFow2WbMaiuEFAvPKiDDj_vNZoNazAc X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9934 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxscore=0 spamscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 adultscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103260041 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=141.146.126.79; envelope-from=dongli.zhang@oracle.com; helo=aserp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, berrange@redhat.com, ehabkost@redhat.com, mst@redhat.com, jasowang@redhat.com, joe.jin@oracle.com, armbru@redhat.com, dgilbert@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @oracle.onmicrosoft.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is to implement the device event interface for virtio-scsi-pci. Signed-off-by: Dongli Zhang --- hw/scsi/virtio-scsi.c | 9 +++++++++ hw/virtio/virtio-scsi-pci.c | 10 ++++++++++ include/hw/virtio/virtio-scsi.h | 3 +++ 3 files changed, 22 insertions(+) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 6d80730287..f437ed1a81 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -962,6 +962,15 @@ static struct SCSIBusInfo virtio_scsi_scsi_info =3D { .load_request =3D virtio_scsi_load_request, }; =20 +void virtio_scsi_device_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + VirtIOSCSI *s =3D VIRTIO_SCSI(dev); + bool irqfd =3D s->dataplane_started && !s->dataplane_fenced; + + virtio_device_event(dev, event, queue, irqfd, errp); +} + void virtio_scsi_common_realize(DeviceState *dev, VirtIOHandleOutput ctrl, VirtIOHandleOutput evt, diff --git a/hw/virtio/virtio-scsi-pci.c b/hw/virtio/virtio-scsi-pci.c index 97fab74236..d5db743692 100644 --- a/hw/virtio/virtio-scsi-pci.c +++ b/hw/virtio/virtio-scsi-pci.c @@ -43,6 +43,15 @@ static Property virtio_scsi_pci_properties[] =3D { DEFINE_PROP_END_OF_LIST(), }; =20 +static void virtio_scsi_pci_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + VirtIOSCSIPCI *vscsi =3D VIRTIO_SCSI_PCI(dev); + DeviceState *vdev =3D DEVICE(&vscsi->vdev); + + virtio_scsi_device_event(vdev, event, queue, errp); +} + static void virtio_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { VirtIOSCSIPCI *dev =3D VIRTIO_SCSI_PCI(vpci_dev); @@ -82,6 +91,7 @@ static void virtio_scsi_pci_class_init(ObjectClass *klass= , void *data) k->realize =3D virtio_scsi_pci_realize; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); device_class_set_props(dc, virtio_scsi_pci_properties); + dc->event =3D virtio_scsi_pci_event; pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_SCSI; pcidev_k->revision =3D 0x00; diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scs= i.h index 543681bc18..d1fff0eeac 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -163,4 +163,7 @@ void virtio_scsi_dataplane_setup(VirtIOSCSI *s, Error *= *errp); int virtio_scsi_dataplane_start(VirtIODevice *s); void virtio_scsi_dataplane_stop(VirtIODevice *s); =20 +void virtio_scsi_device_event(DeviceState *dev, int event, int queue, + Error **errp); + #endif /* QEMU_VIRTIO_SCSI_H */ --=20 2.17.1 From nobody Mon Apr 29 00:55:16 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=1dmarc=pass fromdomain=oracle.com); dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1616737791; cv=pass; d=zohomail.com; s=zohoarc; b=cF50xammg1iUignCHzcU6BgVs/eKUK3mF8YTT4KUga+kuPNyKVOIbkvUkbjTXmqJWgi40RFZL3rQIsy9sRJnv6m2K58z6Yuql8ij7OC4Uk1RrqyGGg1FSyXISGcOuZ1gtQkVil9NSkAjJtzqTzljyQVSEG+dy2w2QEQP5rhOrpw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616737791; 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=dKS7UZVS/9MljmYisshOPIWAJHJw9qDGw2K13h7Pq9M=; b=WyLClAQdI3gkZlJaLI9jGebaT54u9PBAsaIqdFYbSBbkI9SD/icHHIYE+dAOVGcoigJmwtZhwVjcr2dMl9X3h0+mfS0aNLUlsgOCLrlIgfEZWXVEbcS4dF4IY18haOy7KWHy0l1gAdw7C7iU6alO7JY+9f3h21uzL3ZfhK7B+B4= 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=1dmarc=pass fromdomain=oracle.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161673779131875.60414663362008; Thu, 25 Mar 2021 22:49:51 -0700 (PDT) Received: from localhost ([::1]:60546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPfLy-0000UF-5n for importer@patchew.org; Fri, 26 Mar 2021 01:49:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPfHv-0003bS-B1; Fri, 26 Mar 2021 01:45:39 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:35362) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPfHm-0004EN-I2; Fri, 26 Mar 2021 01:45:39 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12Q5iLER164277; Fri, 26 Mar 2021 05:45:25 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 37h13hrvnk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Mar 2021 05:45:24 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12Q5jJET138174; Fri, 26 Mar 2021 05:45:24 GMT Received: from nam02-bl2-obe.outbound.protection.outlook.com (mail-bl2nam02lp2058.outbound.protection.outlook.com [104.47.38.58]) by aserp3030.oracle.com with ESMTP id 37h140yy68-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Mar 2021 05:45:24 +0000 Received: from DM6PR10MB2668.namprd10.prod.outlook.com (2603:10b6:5:b2::25) by DM6PR10MB3068.namprd10.prod.outlook.com (2603:10b6:5:6a::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.26; Fri, 26 Mar 2021 05:45:09 +0000 Received: from DM6PR10MB2668.namprd10.prod.outlook.com ([fe80::9d2c:340:5b24:bff7]) by DM6PR10MB2668.namprd10.prod.outlook.com ([fe80::9d2c:340:5b24:bff7%6]) with mapi id 15.20.3846.054; Fri, 26 Mar 2021 05:45:09 +0000 Received: from localhost.localdomain (138.3.200.16) by BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.25 via Frontend Transport; Fri, 26 Mar 2021 05:45:08 +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-2020-01-29; bh=dKS7UZVS/9MljmYisshOPIWAJHJw9qDGw2K13h7Pq9M=; b=QwqrkJJL314pzFzwuqpX4GVT8ztdMS5tLOBYWwSlLjg2218cyr6vjty1pyvaJrkLsMLL tws5bO6ZCrIyatMRsbCrZ/0F9oVzlmfWdDDMI3vXFV8uqHEoL6XjiOef4Lbbt+AxFAiQ ITpNy/vQg0YbjQXJyCM7WQJ/FRkeg4tS1Tl03L1dHPumRNw+dRUGHKYrw3ra0M21U/lz PxU80dw+7opXshgtGW/MQbORP3tSm6m9qk6ac/ceVFs/fXTa/Z5MADmTV5jKtiGYC5Uc UcL0/OxU8TIW6kXZErc/2ju4kT7Y2mjyciphS0MgYJIFwVM9cZ1vCWcul6EmKKZJFWcQ Sw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D1yz6TkhFBSP4cgDpFkL+4I4LBwahu+9BIp6fBlhUCXpmDQz96mkauMiyEzyvmQdufsJ64B24+3AS6YQrW7AxhngEYWiwgAdVsHQga3Q8b/U8poyJE19MDXT5HUaTIGM/UDw+tEytLr0qpNeIoG6V/11PQvH2E/KNPDjK1MFNmdsTtJfy4TNgh8ax2GstI5nTikhxADMuEV8uOwd2ekisBVFBiad2WiEs3FTLkWoOIatDPiW8wJdvogOtKcfwoySOlWX0LhKNRh/nCe8OA7cFl2Nj/GDFSKmEsNlN4VhFlPaVEXfMHnHJhwSUvjsreYvVm3OzrXcDUri3wjB+941+A== 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-SenderADCheck; bh=dKS7UZVS/9MljmYisshOPIWAJHJw9qDGw2K13h7Pq9M=; b=oOMN9waX1DxKkIBPrOpwguPAAfdreuIfn5Ou8ZVQGKGjnzXK6JCeKJFBiIFro3OXF7Zt9JAFd+RHegyrHHncEop+Hl+/H9MWaf/Pd6yd9OpuEG+RnHhZQOBjrGw8kx9dwRMPLcn13M/9Y8jiMJSJXThLEIa8eTndJIq3bcs31LEQmQ0UG6vuVZ0/cZUPS5ha6/oOAeyorZdjlmQbBIY3AxpsYdjmjeM8dlLj4w5A4uyxUbBhi4do/MpXCVg9S9m7jFU+pdvownUOO/iLNT4HXEowuUYOv1DDzbP88Dr53OjXViD5kdxoLCbkQN/s1ngCXmrKB2esdioL55GQyNPXbA== 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=dKS7UZVS/9MljmYisshOPIWAJHJw9qDGw2K13h7Pq9M=; b=rdRVAmk0+/FNsGd+mxAGwvjRG9Ghh2DWYBeCkUqZ9qVYnRRoq8jrZOPF1gBH+FNHCogtFiag5TWN5tMv2BTJYJGmENOneZ+uk50ADVf+r7tIEfZSh8J/QZtCe48O2hjH+YudEkHFPas7vjlJ1j6N9VRiR7AnVX3bpGAe/oiLvCw= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=oracle.com; From: Dongli Zhang To: qemu-block@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 5/6] vhost-scsi-pci: implement device event interface for kick/call Date: Thu, 25 Mar 2021 22:44:32 -0700 Message-Id: <20210326054433.11762-6-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210326054433.11762-1-dongli.zhang@oracle.com> References: <20210326054433.11762-1-dongli.zhang@oracle.com> X-Originating-IP: [138.3.200.16] X-ClientProxiedBy: BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) To DM6PR10MB2668.namprd10.prod.outlook.com (2603:10b6:5:b2::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e38a7823-8128-46f6-ebed-08d8f01a50e1 X-MS-TrafficTypeDiagnostic: DM6PR10MB3068: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1201; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EopLsMj2ONpMugVU0ImsO5x/DnNJwTo17L8QndW8k9PwYf2zRkx+Z/7/YaDD5Yx07yxoZIYZtQmReCGV+pQJSPqVXo6XCOemAHPWGllQWeRPsV2WnWgsQMbqyxEnystT42/rIGz8iJnZ4vkFQuro70G81tjny54ja9PSxygLNHW/iumfKtHqDrynHbE0gZt8qIBRlgAryCcuDkGzMsW2V3F0FeY+pefHIAzE8L5ZPWnKczJFDqbCeApRopsI3ZtlgurC9ZLLGc1/dFIe1GumsUo0sRduNrY/d9alhZhMl5D0bZN9XtAOtN66MPG8o1v73KVuTXAbTTiyYvhpotSRK0U+NTykWaAHfUJdcZN21A2H2hG2UJ3bSr7uFxfkCQ5LIkX0BWMpyvSRN1NcZhPkXo6kfMGNbYo7DNewtBsdQMfDpgOtd/uGpchVGkFpFXBvH/RPP/TgElXjkZfv6D2Br6CuCvuBnybFhkMmFw9USZkkrUyll0aiZHisd6yHcHWclMOEvLx5scFaCSE5JAHpcPsnngFIrRtvVxZg162f6GOYScfyPGTQm70IzPiGG3c7Zxe3uflS86WjFvls02bx0Eqo1m0d4/obacgBaVnewwTZqlOhHWNrN20kCx2zi94YvD/5DxqkkHBDWOnmq+l6rDrX8TJa6BgSfNA41MR6FKsUBy7rsNXgZsdKEjqNGSCQ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB2668.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(366004)(396003)(346002)(26005)(8936002)(956004)(8676002)(36756003)(44832011)(6666004)(16526019)(2616005)(7416002)(6506007)(186003)(6486002)(478600001)(5660300002)(52116002)(69590400012)(66556008)(38100700001)(1076003)(4326008)(66476007)(6512007)(66946007)(316002)(107886003)(86362001)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?4kd8aCN1h3oODS7TdroiyaJleYE9IPQUX074qCjgyrWj852+BR50Jm2bxa+Q?= =?us-ascii?Q?5a5u43Z26CL6Za0UchX+k6fF7k5Y+Yz/Ulh4VnJNDXjjI/5+7+fKfbZlRYaA?= =?us-ascii?Q?6ECIEV7Wm861/TwBPTe6Y8lUQ8R+bPWpbN4iJlLGx9xgp72j6kPiXFUNHBCL?= =?us-ascii?Q?OZyceGpFxYD+WX/+Et1eiu4hPw9Vk++5VRmTi4YbgywQHRNwvWrUgGSRzBVO?= =?us-ascii?Q?fDE5s7EPYYFjJfrLFW0BrNl74huig8OonlMXtGTUi1LV8k9tWaGm6I4kLm7w?= =?us-ascii?Q?vGPSoe1/RGwQtngXKtjAQg0B26wg3lkWylrNhas5MfCc4kbciF7DLh0C2QAO?= =?us-ascii?Q?IilCEQJeaBfROD3Dm5PY/s9S0jUgIYTF+KARk9Ifepj+cbUD4UNeTDeYlFnB?= =?us-ascii?Q?TPgea3aJwHRnRg/v8XQ4XrLALYM2nG9yeTYdJ84RYZL0PLvH7IurZyx+zto7?= =?us-ascii?Q?SbBGC/JaME1L3mYnoURsqDxxYcummWokt2FEDvq88HSxJaup8Q/zgT+rnrzW?= =?us-ascii?Q?kbVivSKiaQfJXuieduPhylfGwP0DbjZYc0abFFF07cWe9f22BVdVME5OCV9u?= =?us-ascii?Q?n6RHWLF2DS1YJDiBn5IZzQWuQpCoLfQyHnEtA8Z4+KcvtCMe6hLhRTt8hfhl?= =?us-ascii?Q?dfS9xp2OblQPCuaRaBcDa1wzUIdFRjsfJ1M2f3QgE/Ckt8jPQcvI1rmKdABh?= =?us-ascii?Q?pVT2JHC6SSgAbp8sC1RJOWqnA2Kc51vsPq6J17ZtpvwR+NqI5+bxvtDv8/vL?= =?us-ascii?Q?qjx4kjJ7DuMDlIhw/Ja0p/Y7WUolbNnAlTidbm3g3F9fyj/c7Edk3qcB0N9b?= =?us-ascii?Q?UDBB73/9n1smASN072BfDaUvgYVmDnD9UHw1UaTgakqZgm65ixyqfcTKhhFO?= =?us-ascii?Q?NGB/Ygl0U3t9twYNo16djfnbFTk1wFOqMSclNp671s1kazXu0Q7QzshtWz5W?= =?us-ascii?Q?r/nBs5p4BDe56B4g3NJ5arcxkOEQuEk2CL+jbUmdfInQ8Kex/VxnXES//i9U?= =?us-ascii?Q?NqXTYzJ2sZkSgEKVwNfTfRW41K9PyOuBKko1/WgbBmfsWUw//iqX5jNCjoor?= =?us-ascii?Q?Q5wRHPj2Uh0tUfRxFshHeO4k1zkz/1Y13s9CTzOm70wtAisrpyP1zCcEFRao?= =?us-ascii?Q?vZXlb5gKYnRO8cLSX3P08cEAcGdXv/2m9XuBfz0c2iuumA8fZKkrSfUeT8QS?= =?us-ascii?Q?5Kpc7OaO2ZsnWVfoZlvF4pOUPnXXctFtxx+3nk3Xvn2PrDscA5cpJ4huno9/?= =?us-ascii?Q?APdmuk8Stgk4RRfXYA3A4Pg7UlkWQxsTeCkHR0KEKKpgXPZaMDypji9qrzYl?= =?us-ascii?Q?T/tCvxJlB12XrX9+GTr/FC9O?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e38a7823-8128-46f6-ebed-08d8f01a50e1 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB2668.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2021 05:45:09.3762 (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: 4RO0QeINBxf37zmMxxiYgTPHaAOI5AY8UOMtg+XfJSZbUyUb1jp/CE71QjYkRnp1qsPnVa7t8asoFHjuiUxY7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3068 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9934 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103260041 X-Proofpoint-GUID: xlCDIaY88qvEcxTektITJcVHqHLNw61J X-Proofpoint-ORIG-GUID: xlCDIaY88qvEcxTektITJcVHqHLNw61J X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9934 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 mlxscore=0 spamscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 adultscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103260041 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=141.146.126.79; envelope-from=dongli.zhang@oracle.com; helo=aserp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, berrange@redhat.com, ehabkost@redhat.com, mst@redhat.com, jasowang@redhat.com, joe.jin@oracle.com, armbru@redhat.com, dgilbert@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @oracle.onmicrosoft.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is to implement the device event interface for vhost-scsi-pci. Signed-off-by: Dongli Zhang --- hw/scsi/vhost-scsi.c | 6 ++++++ hw/virtio/vhost-scsi-pci.c | 10 ++++++++++ include/hw/virtio/vhost-scsi.h | 3 +++ 3 files changed, 19 insertions(+) diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 4d70fa036b..11dd94ff92 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -163,6 +163,12 @@ static const VMStateDescription vmstate_virtio_vhost_s= csi =3D { .pre_save =3D vhost_scsi_pre_save, }; =20 +void vhost_scsi_device_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + virtio_device_event(dev, event, queue, true, errp); +} + static void vhost_scsi_realize(DeviceState *dev, Error **errp) { VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(dev); diff --git a/hw/virtio/vhost-scsi-pci.c b/hw/virtio/vhost-scsi-pci.c index cb71a294fa..c7a614cb11 100644 --- a/hw/virtio/vhost-scsi-pci.c +++ b/hw/virtio/vhost-scsi-pci.c @@ -44,6 +44,15 @@ static Property vhost_scsi_pci_properties[] =3D { DEFINE_PROP_END_OF_LIST(), }; =20 +static void vhost_scsi_pci_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + VHostSCSIPCI *vscsi =3D VHOST_SCSI_PCI(dev); + DeviceState *vdev =3D DEVICE(&vscsi->vdev); + + vhost_scsi_device_event(vdev, event, queue, errp); +} + static void vhost_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { VHostSCSIPCI *dev =3D VHOST_SCSI_PCI(vpci_dev); @@ -70,6 +79,7 @@ static void vhost_scsi_pci_class_init(ObjectClass *klass,= void *data) k->realize =3D vhost_scsi_pci_realize; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); device_class_set_props(dc, vhost_scsi_pci_properties); + dc->event =3D vhost_scsi_pci_event; pcidev_k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; pcidev_k->device_id =3D PCI_DEVICE_ID_VIRTIO_SCSI; pcidev_k->revision =3D 0x00; diff --git a/include/hw/virtio/vhost-scsi.h b/include/hw/virtio/vhost-scsi.h index 7dc2bdd69d..b47854a0c6 100644 --- a/include/hw/virtio/vhost-scsi.h +++ b/include/hw/virtio/vhost-scsi.h @@ -32,4 +32,7 @@ struct VHostSCSI { VHostSCSICommon parent_obj; }; =20 +void vhost_scsi_device_event(DeviceState *dev, int event, int queue, + Error **errp); + #endif --=20 2.17.1 From nobody Mon Apr 29 00:55:16 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=1dmarc=pass fromdomain=oracle.com); dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1616737660; cv=pass; d=zohomail.com; s=zohoarc; b=NhRgGh8LGYocoW9wKhwIF6wZ8zwk9gsi2PaoMI+iPv+7IgyVCSbY8cogxPoN0UXf81Kmc8B/SP44jhjf5WhfFg5ADMDU7Kb1CEEC+FUli8sSeakl6SZGxrmcOfm604bRv6JSh27siTXqfxjRi/+H7Em/fKnm2TkKgjKWiShy2aI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616737660; 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=J/SU62l/o4Abi5a3LpNNvprHV0eDRuEltbaBITyBZVs=; b=MS7z8qzhEOxyF7vZgvMjD/0LpayziFjBUWkm2wvwcIFVlCxJ/7/AbkPkBu9RCIBGFCdeLQ3s/dwbWfA+KnA6KFQA7JeEpfGxqRzM5Hx4s/qd/UwmwKT6Xfs8XOWDrjEV05HbosUHwPUNA0muQzGVvWyqfV36EU4/5jPnEcftA8M= 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=1dmarc=pass fromdomain=oracle.com); dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1616737660856163.01843673322992; Thu, 25 Mar 2021 22:47:40 -0700 (PDT) Received: from localhost ([::1]:52592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPfJr-0005dw-L5 for importer@patchew.org; Fri, 26 Mar 2021 01:47:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34048) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPfHl-0003Sp-Ev; Fri, 26 Mar 2021 01:45:29 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:35002) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPfHf-00045a-2g; Fri, 26 Mar 2021 01:45:29 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12Q5jASN160538; Fri, 26 Mar 2021 05:45:14 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 37h13e8vux-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Mar 2021 05:45:14 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12Q5j9RJ031505; Fri, 26 Mar 2021 05:45:13 GMT Received: from nam02-bl2-obe.outbound.protection.outlook.com (mail-bl2nam02lp2050.outbound.protection.outlook.com [104.47.38.50]) by userp3030.oracle.com with ESMTP id 37h13x8yvu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Mar 2021 05:45:13 +0000 Received: from DM6PR10MB2668.namprd10.prod.outlook.com (2603:10b6:5:b2::25) by DM5PR10MB1772.namprd10.prod.outlook.com (2603:10b6:4:11::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.25; Fri, 26 Mar 2021 05:45:11 +0000 Received: from DM6PR10MB2668.namprd10.prod.outlook.com ([fe80::9d2c:340:5b24:bff7]) by DM6PR10MB2668.namprd10.prod.outlook.com ([fe80::9d2c:340:5b24:bff7%6]) with mapi id 15.20.3846.054; Fri, 26 Mar 2021 05:45:10 +0000 Received: from localhost.localdomain (138.3.200.16) by BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.25 via Frontend Transport; Fri, 26 Mar 2021 05:45:09 +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-2020-01-29; bh=J/SU62l/o4Abi5a3LpNNvprHV0eDRuEltbaBITyBZVs=; b=DKRO/5SvPN6d1Pqgc0Z9QSbuY2Zbs/ogfrhuDHfnCv3gVF3IFRENyDJ5c/ZVsM0ScmjZ huoFgtnE0jORewyto/ehOnMualjxIux1t80TjNyIR+aG0hb+LAoz8T2ZnvBUiRMiQZPq vGU7fuibvmllkfr9nIAnaU0gTmW/06ajd0lv38qbv8Ysa1PwvP4BqJNPLGSd2yEFDl8l 9vf1WbbJCJwidZLR0bLcIKPiImzfnwLhz+MK1FmvkBWOCkXgb6BJZm9pmtyqzDToptn4 R62Zwl2nHBerTGuPsot1WWBTaiL/n97NZ+0dgqEQePB+5bnFFZokb5gvQFbBenAeWiaZ sg== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ORkHfzt4iB4OX2qIujKhldCxmNu+OyjXv6Z67AQ92YJBYy4QhZIRsZWdQpl9jZ1lpe08iF14DkleEM7tdUay426dp87r4ghBSzSH0lTzfL9Ta+C2Ssx2jfaZe665mWoGYEEsjQoJggcZlUmXkZd9dS01weTfFsgNTddpRmmXcglXqn8Q2bP3WoRGzpyM5WR8XzIN3TL5JO/oVhczTZjj7QQIZ3OKVN4bGVGWXVp2EybYfSMS2jNWsrfyR5UPIXEAtsdRVMbykSIlrqkA/RKjkVNpDBMvuvL5EV/lz1YiqGs/KUEFpZ0Al24VY8aADiNIm+aB3sj4knFjZcmhMZf5DQ== 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-SenderADCheck; bh=J/SU62l/o4Abi5a3LpNNvprHV0eDRuEltbaBITyBZVs=; b=jbQXOn7KXbgyF8CqqI1Qgjit5LHvEMyrarqTBKiQsZRG5cZdRLcUyZMjK2dMUCiKNm+85kFeka1MDOh9jdyEefCSBIQ+J34krz+b4tt+cUw0zSlS2TolL7ENJ/507Yu9k68NUqWw4y/t2OhVevNlj/FmM1dLVb6s7FrVINmBLVUXQyYDCyltIA13FMNVH96cwbqmlMlsgvPnjnrEEvBNIVrXhYVHbKBIAvK07S9rFwAI9HYN/l8lFiMs1EfyQP/0jjzJCRCNWORfy5Qxx770nwyI45p+riVUyPf472rVnxZyNVZ9lsgN7fwriH3Z3BS/acSsrkXHPyf0Ud7YLnOkEQ== 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=J/SU62l/o4Abi5a3LpNNvprHV0eDRuEltbaBITyBZVs=; b=nSmtIQ4HAoWYFQ4ufWfHnlhGuqjpFpad+SlwUDG6XeRy/JlO4uahvA6aJ835GiAziUtyGjVmcqSXeh2fgQOsgqZF6831TsmfVZYe1oLKuwvxKwEjD6irOJ2UnoHfcaDQ26bnP9NB1egaXO/1WVSeRsVsE4LHvXYfvsLz8RiDKRQ= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=oracle.com; From: Dongli Zhang To: qemu-block@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 6/6] virtio-net-pci: implement device event interface for kick/call Date: Thu, 25 Mar 2021 22:44:33 -0700 Message-Id: <20210326054433.11762-7-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210326054433.11762-1-dongli.zhang@oracle.com> References: <20210326054433.11762-1-dongli.zhang@oracle.com> X-Originating-IP: [138.3.200.16] X-ClientProxiedBy: BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) To DM6PR10MB2668.namprd10.prod.outlook.com (2603:10b6:5:b2::25) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dff57d41-45e2-46ec-f98a-08d8f01a51c6 X-MS-TrafficTypeDiagnostic: DM5PR10MB1772: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1201; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0850uD1JgBgsu/kFUqHoOu9XBQwFOt9A063nr43zHi6x+kUn/mqxBq/1EQsh8qTnLjW/5W3pugllDL2r1Bg9Ap92BhA/s0c2z+yLFPC3taO6tartljyAtmfsTtBXQ6kTEzxXGwmf9RIMMoFxpyfjKFlEwGkJVogTcN4KtxnsA9jFBeeAsYrJeEjZOsxSP5+pibbQa2QuDbXl2R4Km/FR/Su8oqXrZLUURe5F2yx2uIl6UPzi+T6kMBMTIlJ87ARKbFT0JhNbuFE2Vbg4NHCmKHVXfqbXWER81jDNg3WM4sT+khxQmke/qk9AHag8rzoEx0AMLLaoyduzQnWv9LFvlaE8P56NlxScjH4CaDoSkrf1ylRWufqqWyvFq8JC/AX5XiUzAhSiEVdYeNs8woXwDbejeZPCeplxsD5sROBS9+Qck2JW0/gmV1ypbj59d9v6XCtl6yKKpZhP2kF3Ot084y0eGdb+4XOg+n+iyjhHOG3/WxjzaCUKkyArmYUYbgDyjE6B+P9IBZ5mbssA9T4pJg3qpiLepsusg6ZzWlJ1HMO6dCQBEQm8seaecz/XYx1QvIT0J1bv4+dMOn+1klGEm2Zqal5FYZQFbL//7iDunZ5W8YkdPBu9D4xrH3Nn9UFkn/YkmWUPa8+Y5CbJpj4kxf3eECoklGsoP0Ix164s8nSrwpvtLGbkvFVkh+bCP2up X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR10MB2668.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(366004)(136003)(396003)(346002)(376002)(6512007)(8936002)(26005)(86362001)(16526019)(7416002)(316002)(186003)(38100700001)(69590400012)(5660300002)(52116002)(4326008)(66946007)(66556008)(478600001)(6506007)(1076003)(6486002)(44832011)(6666004)(66476007)(2906002)(107886003)(8676002)(956004)(2616005)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?f1TSKN5mVA7wvG4G9ArcelinacpaNewNB3LYExkQ/bzAZJKsbt2N4bt1mJJf?= =?us-ascii?Q?YFQtfyP/jIoBXmao9PveYir25fDWYPmIu6Fo+fWgBLcsGgoVbQyUgqw8Nmz7?= =?us-ascii?Q?2g9SAVG5ItNA4gVHn9BZNTVefoVBj2SxZ2SPtoHWpxbMfxxjlryOOKS1fzD/?= =?us-ascii?Q?NDc2TAGG8/zMMPseziKea7i3sL6RDPVbG8DLCAgHkwscWiih6gJICs5od0hc?= =?us-ascii?Q?caHEVlnu7tRnxhE6vj1lXcuUVT+cuQAb1eWclc1KT72I6SbQ1I04FLNrUG0y?= =?us-ascii?Q?uCU3FSi1Yr77GUTs+XLvjmRkQ0Ts4Fef0UIvqRUfBWzjWD/ifZoGGojRk9Lo?= =?us-ascii?Q?guJ6lK0JSjou/KgthzJXVv7V7k8Z4cR2rW7bgOdYNOL82cIYtytWg8c40A7R?= =?us-ascii?Q?qLQtQoVFLffad5pUpQZagPBN1rIZA2bBk4eFwFguPBS3JxUiywdS2JjKpbUD?= =?us-ascii?Q?0o2Rfb4Jq6BjH9pZnPCI6jCFGfipeTOxzvj4lUEf+4ZcGllhdl2YgUxBFFNC?= =?us-ascii?Q?cGNuTCks5j7EttoznXvfqpqgbIh8OgAZwa3JqM5vQwo6XFDUc4p9L8m2ow42?= =?us-ascii?Q?N5Idk4Lh8DGLbkh5tw12bGsGaVE2BeproSMGjhLn0GMAjUlkIu26x1t4vxH3?= =?us-ascii?Q?nPEp8SMQVOPaIsrVENrYtxe8zIZet0UdURCkVNJP2Ff2mpl4/5vdMP4qpJWG?= =?us-ascii?Q?jfnF7isJ+xXuU1DuR/GXwqhNLxAxG1CS7re7AIgb/nq66TVQMQx1vJoTMnnn?= =?us-ascii?Q?d4PcEDdFLng860PO+h1PN0vdRnrykaz/dUjNlYSgwYqPnnXkaIgSI20tSftD?= =?us-ascii?Q?hMVzrV1wD4ZMS7CHP/hI2GMYrkc8aLrveyIi+JwqC2KL1b4xpBJGQIp0AbLm?= =?us-ascii?Q?wISs6Xa370XJ4Lij0zX0OcQoahocbE4p7Nvuf+lw3Dp1jxN7XLLNpmbyYBLQ?= =?us-ascii?Q?K+vMTNPmV1OMtgNI3xvnDlPVD3jZc5Mg2JanjsQXDtlYsyObOYREVOMv24/u?= =?us-ascii?Q?RBoPKQx6zmpbWCIb/t59zXgOCePSftiIZUyYgoqGrS8hnXhCL7MzdLYUpUG3?= =?us-ascii?Q?QTeiGj8ONkYltEY/byIzDCAg8SMY7bi8kVbu2FNftE55qsZVhwSu1COG4oq5?= =?us-ascii?Q?btlkK4H0pmgzoxUpqZ3cn4MaFkGrO9wXohpYQ+tNFum8AhgNyeS1FoseOwx4?= =?us-ascii?Q?F5YaNhFt6pPlN98zsp+eotk+eGhppFNWdyx8M1Vq7fvu0I+hu2NRl1QX9Qzp?= =?us-ascii?Q?wVF1pLWgoKtgDWq9hst4YtvIMVa+sUdlHu49EtUUDZFPAyMwT5lgo+FQB3Lf?= =?us-ascii?Q?RYhlQJQ2+SArTjnfbqz9z6W6?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dff57d41-45e2-46ec-f98a-08d8f01a51c6 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB2668.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2021 05:45:10.8003 (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: aXc8G6H1m1kfemdvevIuc1aPqDXH2q7uE5z4fOSLgnicOwjK4Tl7MAcE13Gxg1X6otTszdArtqeAonMMNayF6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR10MB1772 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9934 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103260041 X-Proofpoint-ORIG-GUID: V641eLdgVMJxal0eG88Huxd8P5MYdMD- X-Proofpoint-GUID: V641eLdgVMJxal0eG88Huxd8P5MYdMD- X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9934 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 impostorscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103260041 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=156.151.31.85; envelope-from=dongli.zhang@oracle.com; helo=userp2120.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, berrange@redhat.com, ehabkost@redhat.com, mst@redhat.com, jasowang@redhat.com, joe.jin@oracle.com, armbru@redhat.com, dgilbert@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @oracle.onmicrosoft.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is to implement the device event interface for virtio-net-pci. Signed-off-by: Dongli Zhang --- hw/net/virtio-net.c | 9 +++++++++ hw/virtio/virtio-net-pci.c | 10 ++++++++++ include/hw/virtio/virtio-net.h | 3 +++ 3 files changed, 22 insertions(+) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 66b9ff4511..b5c3fa392c 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3195,6 +3195,15 @@ static bool failover_hide_primary_device(DeviceListe= ner *listener, return qatomic_read(&n->failover_primary_hidden); } =20 +void virtio_net_device_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + VirtIONet *n =3D VIRTIO_NET(dev); + bool irqfd =3D n->vhost_started; + + virtio_device_event(dev, event, queue, irqfd, errp); +} + static void virtio_net_device_realize(DeviceState *dev, Error **errp) { VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); diff --git a/hw/virtio/virtio-net-pci.c b/hw/virtio/virtio-net-pci.c index aa0b3caecb..1fa5a6fe5d 100644 --- a/hw/virtio/virtio-net-pci.c +++ b/hw/virtio/virtio-net-pci.c @@ -46,6 +46,15 @@ static Property virtio_net_properties[] =3D { DEFINE_PROP_END_OF_LIST(), }; =20 +static void virtio_net_pci_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + VirtIONetPCI *vnet =3D VIRTIO_NET_PCI(dev); + DeviceState *vdev =3D DEVICE(&vnet->vdev); + + virtio_net_device_event(vdev, event, queue, errp); +} + static void virtio_net_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { DeviceState *qdev =3D DEVICE(vpci_dev); @@ -77,6 +86,7 @@ static void virtio_net_pci_class_init(ObjectClass *klass,= void *data) k->class_id =3D PCI_CLASS_NETWORK_ETHERNET; set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); device_class_set_props(dc, virtio_net_properties); + dc->event =3D virtio_net_pci_event; vpciklass->realize =3D virtio_net_pci_realize; } =20 diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h index 7e96d193aa..d88c9969ea 100644 --- a/include/hw/virtio/virtio-net.h +++ b/include/hw/virtio/virtio-net.h @@ -214,4 +214,7 @@ struct VirtIONet { void virtio_net_set_netclient_name(VirtIONet *n, const char *name, const char *type); =20 +void virtio_net_device_event(DeviceState *dev, int event, int queue, + Error **errp); + #endif --=20 2.17.1