From patchwork Fri Mar 26 05:44:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Zhang X-Patchwork-Id: 12165777 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BB12C433C1 for ; Fri, 26 Mar 2021 05:51:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A6760619E8 for ; Fri, 26 Mar 2021 05:51:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6760619E8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPfNr-0002Dz-LQ for qemu-devel@archiver.kernel.org; Fri, 26 Mar 2021 01:51:47 -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 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== 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 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; 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 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 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 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: H7VV3wjJgPvn2p/TnxaEZaIOXzrq1oPNoAvWBlQUPOEoU36okWZeWUBtEKN7KaI8cQ2r4tc1WZDpHUXBc5KVAzb42FufW+iU8ll5fW9MZKoIL6Oum0I/cJOZ4vBGw2I6+abx64Y9uDBW4JvU6zJS7sAxJ3oe7Jr7MDodn94bd5O06ponWZIkTNFQm530xIViwkue44Z3viaLUqsLHiPhVg6McFS/vXhjoOj0XtFpdw+ytE3JzkRzkfH26jkHxYznqA48IBgnuQRugSyjKgL1n8yBls/bWFZ8vjZqPpfKQLU3EZ9r1Uvud/ZTwdwoxbKDrGneYKhee/acfW5n0V2dqkc2PoXmmat5i4ntAAZ+CVxqTqT66nmYDZBC+HkmZnmMw6wdnAdmvMLpVks4SgnS0rV49GK4yKCuThOq4najoZu5dhuWMpsdZN7x7oF5Iwvq6rTmDsl2T/c3RtgVbdFruStYwe4SByH5g2YdkxudrH1i1v1DzaUWDK3xQP93Xw7YwKa1HVDMBvTTfoT9sSgfVPYlZsCcrV+VOoHvsGleUUzNDSA9tJiLwQD1l1dP8ZLtHUjoMmlMRO8bR0qzxzpn0m48bWjcmIR8g+VjL44LvAOeNfFFxIwtyzDXqragiWCW7q9cDBLZDQ9dpQzZf48JiicoXYZIM0T2Z7LK6gR+aMEhuRtTwG1mDAPZZrf5CAMuI741G45f526yisQ5dOfJ6dTiGw7RvPNyXXtzQgK89PPqWynBp1LYMsjiRZpGDZP59QMsbwL7zbb7U78te6flzHEuRK8geEWxxCtDaV7/MYS+FUBFImYjoDkMaiTDADNVj9Lyp88TUnXG6AQtRhco1E48460vCRLXLou9e6pT4Sfay9Dpkljh4+EJOD41xE1f6a8Y29mgO3EwPf6wJDKrN+vO5/yAYAvKLsEkERN9MSZ+2scDDoruwJ2BGCNDxrfl9dv3O07GUOWxbnyaKh+py+9RYxw/lNnI9g1+ATWeWb6xHFLYf/4XoCCswfbugaTneebKldlJIzKievK6S2E63EqnO8zoqH6m+VU5DwjerramCMEt19XPFXctbEYzvhQlHQf7JHGIxKaOdrbRYcpp6V6GMbPqH/v2lEYMnLZib94xr9SRrK8SWXHWt4Db/LRM/EWwmp1qKPv9DxNqZQAHMY3xgLfIfzF30huf8kOD9IOjgUzFfNYtOq52NM5WHQXYhxXb6cbS+2TWN7h55pj1yjvq2PZ1fFehtuKJSHIFvKOJDdFWsagYWgDeXMBdsvR7sYuiQX8bne+kS1KvOyHUS5+WEhH2/90qPYoEoT6JsZYXZbuF56S9y7ExOGWdlXuM 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 = "p", }, + { + .name = "x-debug-device-event", + .args_type = "dev:s,event:s,queue:l", + .params = "dev event queue", + .help = "generate device event for a specific device queue", + .cmd = hmp_x_debug_device_event, + .flags = "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; +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); @@ -132,6 +140,7 @@ struct DeviceClass { DeviceReset reset; DeviceRealize realize; DeviceUnrealize unrealize; + DeviceEvent event; /* 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); #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); } +static const char * const device_events[DEVICE_EVENT_MAX] = { + [DEVICE_EVENT_KICK] = "kick", + [DEVICE_EVENT_CALL] = "call" +}; + +static int get_device_event(const char *event) +{ + int evt; + + for (evt = 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 = find_device_state(dev, NULL); + DeviceClass *dc; + int evt; + + if (!device) { + error_setg(errp, "Device %s not found", dev); + return; + } + + dc = DEVICE_GET_CLASS(device); + if (!dc->event) { + error_setg(errp, "device_event is not supported"); + return; + } + + evt = 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 = qdict_get_str(qdict, "dev"); + const char *event = qdict_get_str(qdict, "event"); + int queue = qdict_get_try_int(qdict, "queue", -1); + Error *err = 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; From patchwork Fri Mar 26 05:44:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Zhang X-Patchwork-Id: 12165767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83A28C433DB for ; Fri, 26 Mar 2021 05:47:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EE63C61A38 for ; Fri, 26 Mar 2021 05:47:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE63C61A38 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPfJd-0005MS-PK for qemu-devel@archiver.kernel.org; Fri, 26 Mar 2021 01:47:25 -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 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== 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 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; 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 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 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 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: Mi3qSJuqITp8AoVRXOyBkYNkL4RVqmoPjvDYPcWY1JYAX9fleUWTeSQieKtkDRRcmDveP09LY88Hbnztk3vUrawkCpTAnZeGZbLrQ3wgBbYi/ewjwmfw44ZUWYxV+2ZHFpPEacp1YAxz1eJ1J/GpVFPhtNC9yShEXDn+eAPcXXmuZNHETt095rBorxtOTJ2iKPTgGqEB+HMhx7U3cPRaqyQdSS0VK07Oyr35Pdq4IpvaE3mQF5zBlLVvqfLc1BXVYNKhYol3+AwfqKi1LuCPowQ+gy766aeW1m+adc/juTKzCF4DWoD68zbnooNWxNiS2ymJaDiOYCujewcMlRqWOGPQ8gqYTr3CHg4lmTLxlOltLFi9M/4jpl5zWXgU5OPQXVcJdZM92Fm3tfVA0xyq6QyxhKeA7aQX3UcCrXKz9uCceXpx5ZLxz6+TFGtQ3CgKKmSZWLRKeQnbBqu2x/6gN855iZL90aVPS7eudZbLqRFp0zAQbh9ui8bbBd93vDj1fzKKklMP2w81CHDVUJt8lHIKq6fThl0sHjFe5+KapOSJhDe1mDro5+DjoMmrAsEI79HuSGcM2ySI/fMVbrVpCKTCNfIu2T5fBZQw9AWGW9yiFc375SEsfYqsg0ROJxKtpplq2voDDPkXEnTrTf6shcai4PDe9NZszR+NH4eVlh5Uu18nAhmu9UymnkGwwwGKzXVs6Lv6/cyYw5kr/tZqWD5167AOAa6V54D/OKDdDOKF8lKL2np/OEd2WEspGFXIMrfWFWJSP9cd+vmCDJstjWbO0b2wNmgxneO1rsCiy4ZaXtdwe5qjZ36baaK/5El7sRfF5UILD94a8rdltHuO6DdNZ052waMk4VH6Hab4IuNS5ch+i0wNC2H6lQjRV61+Ov99oQG2dlRFpJt+9Vd76eXM+ZldlpCvKHK+2ivO6THMFGdCkfFaGT2K8quGOIiwZIrIK5KJa7fHwtd8nNCoFIg0oBlcFHJBYKjJaiMWCF40heWzoLpwozjhV2NnjSu5wBpGwVD0hSlGMK/ZwJvtmZJ8hYqVOYWGoDZDzMECodLP0NC30lnLiN9KTCxA34/UqZ5R2BjVg/gxQjQBCxhoDmayHITGVd9D5o20KrCgmKvWxBSxIybAjDSY+4yKsavEUNByMSu6ATxy91AGKuXPPZ+4wFJxTgPpx/7LSNyv506mGcDz22v6kK4gHxZAoRTj4ypRo5OfMYTpDn1olxQ8Nvh1ffcl4YrZUuc+57IH5zyyepWq1bIuX9pItBpswhd3slfV0D7Q4MXt6tkADJug/4CTGJVGARfqU2kQaUTXnPAd7VivEBulP4IZsxIoJHih 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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" +/* #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); } +static void virtio_device_event_call(VirtQueue *vq, bool eventfd, + Error **errp) +{ +#ifdef DEBUG_VIRTIO_EVENT + printf("The 'call' event is triggered for path=%s, queue=%d, irqfd=%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=%s, queue=%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] = { + [DEVICE_EVENT_CALL] = virtio_device_event_call, + [DEVICE_EVENT_KICK] = virtio_device_event_kick +}; + +void virtio_device_event(DeviceState *dev, int event, int queue, + bool eventfd, Error **errp) +{ + struct VirtIODevice *vdev = VIRTIO_DEVICE(dev); + int num = 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 >= num) { + error_setg(errp, "Invalid queue %d", queue); + return; + } + + vq = &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); +void virtio_device_event(DeviceState *dev, int event, int queue, + bool eventfd, Error **errp); + int virtio_save(VirtIODevice *vdev, QEMUFile *f); extern const VMStateInfo virtio_vmstate_info; From patchwork Fri Mar 26 05:44:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Zhang X-Patchwork-Id: 12165773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9F7BC433C1 for ; Fri, 26 Mar 2021 05:49:15 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27CC260234 for ; Fri, 26 Mar 2021 05:49:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27CC260234 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPfLO-0008Rc-61 for qemu-devel@archiver.kernel.org; Fri, 26 Mar 2021 01:49:14 -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 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== 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 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; 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 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 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 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: dAGcrILfy6Nc5D6bK9kfzHgbniqlII8Nx7Gdu4wMsSKw2UuminHGKpuIdmNzr0hg84kkrUzbFUik1/u4iDVMfhos/EhULK+0d7RTFYFJorr5zvXLLjUthjc82MdC9A0NR/SJ1wRQo1whUNJnJ4FKl3ZlLjH92CnlhmfhIDogihbKluPc56yGZOlzzq89+fVsjAlgfH5UUYZTNgEok7S5/sc75Jv4MwWcoR25tBoKmxYTmblFRmr6/aMVhC6Z5A2tROksMIJdU1N2mN9eW+BQT2ImPv7pLtKALlqOpwwMtjvCpU0D2t4MV9FXeijG0mviRrspeq0MDJGQ89qXtBHN0DfG2Pj4CNXgexvvxkGOej1q5ezuoEqxRbIISt6w5/eMotkOAyQWHqXMTu9eNSupDJJ3pXWcyiVJq6gjVtqRcwq4A/XcN+DT91b9XGOiTl3My2+ONi5AeceI4UkCmMU2Fq9rehv/TxcytsCTsZ4VKMUhmP/Dw2sMoZNwitq3tsBSfGxUCziJB7bwuLkE7OOKoo4C/iOPLdJbDGYY89H7qdx10We75N9oKD/W/cGo/alOIERl4FbSkk5rp6+N14q38bktb9ZnySa70UZgrX/L0TKQAdc+jsInQYMeEWQ7O2KJQCbHdAr2EpHAZuOW4pMIqGFgfyHLIjJRS3OdtqcKSM9DdgZ56L4iJWlvzfuKBVo+fPMpNegQ1o4EiRD2GxVmtPhg7JHtmTPxh3n3/cWD1edz6jHWmIfBABsDCJAhIkharEE5FuJdXEH5vH7aR63b0c+w2TwhcqQPiy/aGMahTEMIp5SdY+Xld563cIX3GpFNMT70jafTJ/f6adiGhYrAJK2YqMdhyiep8KKep0G4Uw+5ns7pvKkZGCpCruzZPjp73ZaT3eh2Czm7oM8ESGHQftGWWn2sHx4KLwAM9JbqVr1wq0gggX4+VhNOOm1NyNyE/wkg8hJKDegfT9P32NF543fSwE1TMDuE57ZmuHs3Ur/75+M38T4Uc8XqJdcMGYIP1cI9QGfwbMzmrq2JxtckRgdKNIRLCPeMUsONNR1LOG0RaY+EXqD1WkD9zse67trm8cENancFy5QEXwbBoOdh4wMQYsN+yyduTtueebHho8DEM5R1ENTuoRCi+UC0PzaUH1GxbUR2NTRbXq7mWjRqUO+VYadjFe/yj9WrsfQzprBSTgzbqG/it1tzZx0JzFQl78FevJi4pdpJDeKVxXUVq7/kB6RC4FObK8YhVwIh6rhFqZZi6+MikQWs1cug78Eda0m1ZNNRCilwG3Y9xx231QIXPLjZ5oCkW27g7qIJzwmnpr30yBJIituKmkYeKO8c 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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; } +void virtio_blk_device_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + VirtIOBlock *s = VIRTIO_BLK(dev); + bool irqfd = s->dataplane_started && !s->dataplane_disabled; + + virtio_device_event(dev, event, queue, irqfd, errp); +} + static void virtio_resize_cb(void *opaque) { VirtIODevice *vdev = 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[] = { DEFINE_PROP_END_OF_LIST(), }; +static void virtio_blk_pci_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + VirtIOBlkPCI *vblk = VIRTIO_BLK_PCI(dev); + DeviceState *vdev = DEVICE(&vblk->vdev); + + virtio_blk_device_event(vdev, event, queue, errp); +} + static void virtio_blk_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { VirtIOBlkPCI *dev = VIRTIO_BLK_PCI(vpci_dev); @@ -72,6 +81,7 @@ static void virtio_blk_pci_class_init(ObjectClass *klass, void *data) set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); device_class_set_props(dc, virtio_blk_pci_properties); + dc->event = virtio_blk_pci_event; k->realize = virtio_blk_pci_realize; pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET; pcidev_k->device_id = 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 { 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); #endif From patchwork Fri Mar 26 05:44:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Zhang X-Patchwork-Id: 12165771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E6DDC433C1 for ; Fri, 26 Mar 2021 05:47:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B1BDE61A43 for ; Fri, 26 Mar 2021 05:47:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B1BDE61A43 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPfJv-0005rE-Pf for qemu-devel@archiver.kernel.org; Fri, 26 Mar 2021 01:47:43 -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 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== 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 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; 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 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 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 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: gMen1FSWDiazDACRyzA0pkVlcgrVa+DMMl1n/5qSxhZQrvBfm2izYXfiTAk/woHWpxLBcEMlRJEFM7XDS8ROukjQmmzHVV79hkiCWMTHTpuMWPvYgs9nEkNAzGIRjc35puyqSHONbYuxjo3xdPpOHP+Ljm2DdnkfAEq5Pq7I1PAdZGYjoz+YKm7UZUW2pucNEHsoSp9xVwDywMM3srCS3kwGywLDdZsR9wEDmFNJYnG5Zu+4ebfhJ5rzk3qBYBZHlBj+FjIIQIACE756CPhJDLB8bWYqrAh7uwPe7Gt13P7iBffQVt5xiUvhQCmYjG0N4ED9yXxr040vQoS2NLGkho/zZHKEoVBnHoVyHhj0fpaiJBpq4k2jZgD6Bu9IZ0dF5Q7Gx36CZsQzMNp2+MM3FxpEjOEt2FgF+PVFpUqRpv/jIOAJns5H8W+zs95Icqvrz3VRViiKGzSMQh7SJ60acuddoNM/9YHuRm400Kc1DDI72SGdTh1sYHRtavpeIU8/dAHYlIgrhraSik0Qh4HMYsmgQbcvnUS7+CSsfpXDHw+laS3lMO5horQLERTquctshIRRZxAX4STl+BeLjAOZX2Cx1MJVaa9mqpqlchlR7b/jRvxO0elJfYFT1J1lZBEkQUd3TXWSmxrgCGOnjnJFKvDN8RVniqhyraTcU184vGo8mmNdF7d9J/LSxapJ5Ppw3eo11pM0Aeno5yfkwrWWDrBBN1DnfbMKhGSoZ/2pA4g608KQMrfgJeZMYW7q0aRNJOtyP+zhqOTQ3zC5lYWuswcIiM5GT5uVELcC6nTQJNcFfvjj7LnuvKGGWDgQGMsiV6NWFn4Hzuv4z/q2cpzbUSMX5ztylqYbv9oWTlCvecvEHLg63DhaoV0nDkdunp50XPwB+anmgl7Vc6FyHYYhvyHse9VQTWFh0De2/TbHpbTbKEu56D8/54rFide3XN87XjjIFmPVd9FXi/oR6iHiIM13wXStirFFAs/8ePLR4HG8QIz3m7BqNi1rh0G6cJcpzmGU6WY4EXQPFSaDq45imhUzGY1cg4NpvysQqiQd/otJHt0V0uwe5nFCSJYRi0criL8+LrAVn3EsuGR6OyrP/QWIL1Yd69kao6uzrUfCPoCIjNniWu4ikDuDWkLQdEKTXZW9QgnlKwaetfICT3P/G3g1D28M3/wdAWpgDwZL5mRdeVjxY+u21OJsuv5hF9H1gNoc63Lt+k6wLRr8dbaHIZG8fV6lR/QZsuob/AQxLREJqRdeJQMGuIAooAbXR+ITxhQcaIjjcrPjNRM5ZpGymKgcBqQ1a1BqXHPAWc7KEWfg8AaOYomjYl9lOzsY1jae 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 = { .load_request = virtio_scsi_load_request, }; +void virtio_scsi_device_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + VirtIOSCSI *s = VIRTIO_SCSI(dev); + bool irqfd = 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[] = { DEFINE_PROP_END_OF_LIST(), }; +static void virtio_scsi_pci_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + VirtIOSCSIPCI *vscsi = VIRTIO_SCSI_PCI(dev); + DeviceState *vdev = DEVICE(&vscsi->vdev); + + virtio_scsi_device_event(vdev, event, queue, errp); +} + static void virtio_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { VirtIOSCSIPCI *dev = VIRTIO_SCSI_PCI(vpci_dev); @@ -82,6 +91,7 @@ static void virtio_scsi_pci_class_init(ObjectClass *klass, void *data) k->realize = virtio_scsi_pci_realize; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); device_class_set_props(dc, virtio_scsi_pci_properties); + dc->event = virtio_scsi_pci_event; pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET; pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_SCSI; pcidev_k->revision = 0x00; diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.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); +void virtio_scsi_device_event(DeviceState *dev, int event, int queue, + Error **errp); + #endif /* QEMU_VIRTIO_SCSI_H */ From patchwork Fri Mar 26 05:44:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Zhang X-Patchwork-Id: 12165775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 488AAC433DB for ; Fri, 26 Mar 2021 05:49:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2926619E8 for ; Fri, 26 Mar 2021 05:49:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2926619E8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPfLo-0000UF-KO for qemu-devel@archiver.kernel.org; Fri, 26 Mar 2021 01:49:40 -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 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== 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 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; 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 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 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 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: 4kd8aCN1h3oODS7TdroiyaJleYE9IPQUX074qCjgyrWj852+BR50Jm2bxa+Q5a5u43Z26CL6Za0UchX+k6fF7k5Y+Yz/Ulh4VnJNDXjjI/5+7+fKfbZlRYaA6ECIEV7Wm861/TwBPTe6Y8lUQ8R+bPWpbN4iJlLGx9xgp72j6kPiXFUNHBCLOZyceGpFxYD+WX/+Et1eiu4hPw9Vk++5VRmTi4YbgywQHRNwvWrUgGSRzBVOfDE5s7EPYYFjJfrLFW0BrNl74huig8OonlMXtGTUi1LV8k9tWaGm6I4kLm7wvGPSoe1/RGwQtngXKtjAQg0B26wg3lkWylrNhas5MfCc4kbciF7DLh0C2QAOIilCEQJeaBfROD3Dm5PY/s9S0jUgIYTF+KARk9Ifepj+cbUD4UNeTDeYlFnBTPgea3aJwHRnRg/v8XQ4XrLALYM2nG9yeTYdJ84RYZL0PLvH7IurZyx+zto7SbBGC/JaME1L3mYnoURsqDxxYcummWokt2FEDvq88HSxJaup8Q/zgT+rnrzWkbVivSKiaQfJXuieduPhylfGwP0DbjZYc0abFFF07cWe9f22BVdVME5OCV9un6RHWLF2DS1YJDiBn5IZzQWuQpCoLfQyHnEtA8Z4+KcvtCMe6hLhRTt8hfhldfS9xp2OblQPCuaRaBcDa1wzUIdFRjsfJ1M2f3QgE/Ckt8jPQcvI1rmKdABhpVT2JHC6SSgAbp8sC1RJOWqnA2Kc51vsPq6J17ZtpvwR+NqI5+bxvtDv8/vLqjx4kjJ7DuMDlIhw/Ja0p/Y7WUolbNnAlTidbm3g3F9fyj/c7Edk3qcB0N9bUDBB73/9n1smASN072BfDaUvgYVmDnD9UHw1UaTgakqZgm65ixyqfcTKhhFONGB/Ygl0U3t9twYNo16djfnbFTk1wFOqMSclNp671s1kazXu0Q7QzshtWz5Wr/nBs5p4BDe56B4g3NJ5arcxkOEQuEk2CL+jbUmdfInQ8Kex/VxnXES//i9UNqXTYzJ2sZkSgEKVwNfTfRW41K9PyOuBKko1/WgbBmfsWUw//iqX5jNCjoorQ5wRHPj2Uh0tUfRxFshHeO4k1zkz/1Y13s9CTzOm70wtAisrpyP1zCcEFRaovZXlb5gKYnRO8cLSX3P08cEAcGdXv/2m9XuBfz0c2iuumA8fZKkrSfUeT8QS5Kpc7OaO2ZsnWVfoZlvF4pOUPnXXctFtxx+3nk3Xvn2PrDscA5cpJ4huno9/APdmuk8Stgk4RRfXYA3A4Pg7UlkWQxsTeCkHR0KEKKpgXPZaMDypji9qrzYlT/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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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_scsi = { .pre_save = vhost_scsi_pre_save, }; +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 = 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[] = { DEFINE_PROP_END_OF_LIST(), }; +static void vhost_scsi_pci_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + VHostSCSIPCI *vscsi = VHOST_SCSI_PCI(dev); + DeviceState *vdev = DEVICE(&vscsi->vdev); + + vhost_scsi_device_event(vdev, event, queue, errp); +} + static void vhost_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { VHostSCSIPCI *dev = VHOST_SCSI_PCI(vpci_dev); @@ -70,6 +79,7 @@ static void vhost_scsi_pci_class_init(ObjectClass *klass, void *data) k->realize = vhost_scsi_pci_realize; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); device_class_set_props(dc, vhost_scsi_pci_properties); + dc->event = vhost_scsi_pci_event; pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET; pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_SCSI; pcidev_k->revision = 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; }; +void vhost_scsi_device_event(DeviceState *dev, int event, int queue, + Error **errp); + #endif From patchwork Fri Mar 26 05:44:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Zhang X-Patchwork-Id: 12165769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6789C433C1 for ; Fri, 26 Mar 2021 05:47:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 254FA61A43 for ; Fri, 26 Mar 2021 05:47:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 254FA61A43 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPfJm-0005dw-QZ for qemu-devel@archiver.kernel.org; Fri, 26 Mar 2021 01:47:34 -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 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== 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 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; 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 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 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 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: f1TSKN5mVA7wvG4G9ArcelinacpaNewNB3LYExkQ/bzAZJKsbt2N4bt1mJJfYFQtfyP/jIoBXmao9PveYir25fDWYPmIu6Fo+fWgBLcsGgoVbQyUgqw8Nmz72g9SAVG5ItNA4gVHn9BZNTVefoVBj2SxZ2SPtoHWpxbMfxxjlryOOKS1fzD/NDc2TAGG8/zMMPseziKea7i3sL6RDPVbG8DLCAgHkwscWiih6gJICs5od0hccaHEVlnu7tRnxhE6vj1lXcuUVT+cuQAb1eWclc1KT72I6SbQ1I04FLNrUG0yuCU3FSi1Yr77GUTs+XLvjmRkQ0Ts4Fef0UIvqRUfBWzjWD/ifZoGGojRk9LoguJ6lK0JSjou/KgthzJXVv7V7k8Z4cR2rW7bgOdYNOL82cIYtytWg8c40A7RqLQtQoVFLffad5pUpQZagPBN1rIZA2bBk4eFwFguPBS3JxUiywdS2JjKpbUD0o2Rfb4Jq6BjH9pZnPCI6jCFGfipeTOxzvj4lUEf+4ZcGllhdl2YgUxBFFNCcGNuTCks5j7EttoznXvfqpqgbIh8OgAZwa3JqM5vQwo6XFDUc4p9L8m2ow42N5Idk4Lh8DGLbkh5tw12bGsGaVE2BeproSMGjhLn0GMAjUlkIu26x1t4vxH3nPEp8SMQVOPaIsrVENrYtxe8zIZet0UdURCkVNJP2Ff2mpl4/5vdMP4qpJWGjfnF7isJ+xXuU1DuR/GXwqhNLxAxG1CS7re7AIgb/nq66TVQMQx1vJoTMnnnd4PcEDdFLng860PO+h1PN0vdRnrykaz/dUjNlYSgwYqPnnXkaIgSI20tSftDhMVzrV1wD4ZMS7CHP/hI2GMYrkc8aLrveyIi+JwqC2KL1b4xpBJGQIp0AbLmwISs6Xa370XJ4Lij0zX0OcQoahocbE4p7Nvuf+lw3Dp1jxN7XLLNpmbyYBLQK+vMTNPmV1OMtgNI3xvnDlPVD3jZc5Mg2JanjsQXDtlYsyObOYREVOMv24/uRBoPKQx6zmpbWCIb/t59zXgOCePSftiIZUyYgoqGrS8hnXhCL7MzdLYUpUG3QTeiGj8ONkYltEY/byIzDCAg8SMY7bi8kVbu2FNftE55qsZVhwSu1COG4oq5btlkK4H0pmgzoxUpqZ3cn4MaFkGrO9wXohpYQ+tNFum8AhgNyeS1FoseOwx4F5YaNhFt6pPlN98zsp+eotk+eGhppFNWdyx8M1Vq7fvu0I+hu2NRl1QX9QzpwVF1pLWgoKtgDWq9hst4YtvIMVa+sUdlHu49EtUUDZFPAyMwT5lgo+FQB3LfRYhlQJQ2+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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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(DeviceListener *listener, return qatomic_read(&n->failover_primary_hidden); } +void virtio_net_device_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + VirtIONet *n = VIRTIO_NET(dev); + bool irqfd = n->vhost_started; + + virtio_device_event(dev, event, queue, irqfd, errp); +} + static void virtio_net_device_realize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = 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[] = { DEFINE_PROP_END_OF_LIST(), }; +static void virtio_net_pci_event(DeviceState *dev, int event, int queue, + Error **errp) +{ + VirtIONetPCI *vnet = VIRTIO_NET_PCI(dev); + DeviceState *vdev = DEVICE(&vnet->vdev); + + virtio_net_device_event(vdev, event, queue, errp); +} + static void virtio_net_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { DeviceState *qdev = DEVICE(vpci_dev); @@ -77,6 +86,7 @@ static void virtio_net_pci_class_init(ObjectClass *klass, void *data) k->class_id = PCI_CLASS_NETWORK_ETHERNET; set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); device_class_set_props(dc, virtio_net_properties); + dc->event = virtio_net_pci_event; vpciklass->realize = virtio_net_pci_realize; } 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); +void virtio_net_device_event(DeviceState *dev, int event, int queue, + Error **errp); + #endif