From patchwork Mon Jun 27 08:49:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: abhimanyu.saini@xilinx.com X-Patchwork-Id: 113461 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4D392A0552; Mon, 27 Jun 2022 10:49:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C04A410EF; Mon, 27 Jun 2022 10:49:35 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2083.outbound.protection.outlook.com [40.107.220.83]) by mails.dpdk.org (Postfix) with ESMTP id 2C5C3400D5; Mon, 27 Jun 2022 10:49:34 +0200 (CEST) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=MJnJ/GfMCYGMOu9OKMVG7bOirC3SzfgDc8uL+BboKzZ1Ri1nwnahF0jkCpRXyEktIkmlJb1EbpapvgSU2hc6GwmzLffoQzbNlhHsboJgmgR7ZJAQo5M4TZehpHs4lPOleKansNZK6pTUp8M9DtrJX135icK+S2ab5fX5RLYW6oVXU1mP2UkAoBAYVTZt5u/iYvI+JWqUiazPxkuWpKsCeJBYU0VdWpiyDhQlZZoDtDIFugPykGG6v2W/Dkn4CEhCzU9TFfeO7CVDQ+92/fa6fPUurMNeNA1xoxUmC0HpqnHdJNCa246xxcx2JKo8ubMVwcEGcH9PSWvIgTze4n6Geg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=c1QNOwhm5jckj9DZLhwe3rUPDYP80x2QNFKReY+M6k0=; b=ixw9gi3mX9WEJd/jAxlpuikCegjIFjF4PvMW5TnEbh9MGXcTJ3o7bXaxbRNNp+gAu9433q+DspP4RLRkJppiMEAcPaqPrIK4U8p/wf6BAs4zvqK3BM72/KXQNCp3xCS9kRSLRTqAhVmX8c+I8sIpFZIuJfrFOs5kjLjJNK6VORCJK6nEVWF3+FiN+2zxgNhPjGxJyeD+Lyr98LH4GS2NYKXkruWAIHFohv/uyyRL02qup8iCdZdnps2SY3kcOPwIAiyAY3xY9ovFnKciJ60GZO+9/bFjEHG/P1igymqRkSIsqy6TgwbHTZxR9tzNXfoANA2rePLEvOvpdyadoRDuHQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 20.83.241.18) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=xilinx.com] dmarc=[1,1,header.from=xilinx.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c1QNOwhm5jckj9DZLhwe3rUPDYP80x2QNFKReY+M6k0=; b=qhkFNRCMroAYXaoHEtmmK6+CiuBaDnWJeDsR/Vb16dLnWNt2skbEwUsYbHGGuStZKM7KwuAuOqhnAchPfF2nsT9yGxNTA4L4wmTSA02sJ2fxn5VPDThm7CWPs7w/qv8zsIWKRNXdO0Dq2HZlxpxajwM0pQU1mYeNHb5kNTTzcsGtvG7T5AkNs5UmCe5m9LtSvlhJ4j/nFjuaPeONeFrvOWuSxBwj9+5L35RsyPwE4p2vDHDw2b9KV8E+JklQ9Vbn7XUXuftD5R1MLiJkXuY16KfwqiHF/Ot1Smf1W+usomGIXNK4H+ZycNpo/yBGGyxFkya/LSx7tDvh4OH3lKe5mw== Received: from MW3PR06CA0018.namprd06.prod.outlook.com (2603:10b6:303:2a::23) by DM4PR12MB5230.namprd12.prod.outlook.com (2603:10b6:5:399::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.16; Mon, 27 Jun 2022 08:49:30 +0000 Received: from CO1NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2a:cafe::70) by MW3PR06CA0018.outlook.office365.com (2603:10b6:303:2a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.16 via Frontend Transport; Mon, 27 Jun 2022 08:49:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.83.241.18) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 20.83.241.18 as permitted sender) receiver=protection.outlook.com; client-ip=20.83.241.18; helo=mailrelay000000.14r1f435wfvunndds3vy4cdalc.xx.internal.cloudapp.net; pr=C Received: from mailrelay000000.14r1f435wfvunndds3vy4cdalc.xx.internal.cloudapp.net (20.83.241.18) by CO1NAM11FT034.mail.protection.outlook.com (10.13.174.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15 via Frontend Transport; Mon, 27 Jun 2022 08:49:30 +0000 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) by mailrelay000000.14r1f435wfvunndds3vy4cdalc.xx.internal.cloudapp.net (Postfix) with ESMTPS id 135FB3F030; Mon, 27 Jun 2022 08:49:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OPkNtRMJQs+DtjgGjjnLgD2zgGFzvYG3KHTNvN+nV7Vu9HAYU1OMKMzbvFfOPibU6rKizTwhqFAaZR4CnlEDzkcz7FpXvPo6QvUkQFzwi88eS0Xbj0+Lfp2l5gqbLP+qWDnhFWxI9CLiaBVJiVWNcb2oUd2GTH1e5wUhbUi1Rj75OUAXurWh9SOKf2P1cG4dYQaDkfKxZOfISbvqPgD8oTHzAp6kVkZCZQL+niB1k626ckAKlSDHopTmQGfATBGDlahFIq1Io3tmQS542E4HL8Pl6jtDzs/yIYgJTKxEj9/nZ/OG1/6yS91sMKkANsDR/oMC6OioGEmjBhb1jJsXFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=c1QNOwhm5jckj9DZLhwe3rUPDYP80x2QNFKReY+M6k0=; b=nylxXSrjuZNEBhBJjMVC/8U5rweqvLDHhu5huhmzHkStZI2gvXxJCbdeLZrZCPZqKG+E5thB6c92BLWJc1UTk92y8ptkbura31iXxY14n9B/VYaYWNvKDecl6xZwT3uVSI8cBFBwq3B2J3E7Mr3ShCsDANb2goiToCnBmJoTeyHAHbcX+/PjqJVvto38MtID4Y3wYsRva6vTsJPHkIW5brv3i6PpHNfhOAF3IfRrcTTEYFL9RuTJPqNK+aSsUwPFixKhXusOeWIhH3EOJBKT9tZwiMEMr+8mgrbgE6h0nqEDyF48xVTRGdEUvxN+PGdjcAIodiX/PzZ7f8BGqyjSCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=dpdk.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none Received: from BN9PR03CA0929.namprd03.prod.outlook.com (2603:10b6:408:107::34) by DM6PR02MB4794.namprd02.prod.outlook.com (2603:10b6:5:17::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.16; Mon, 27 Jun 2022 08:49:24 +0000 Received: from BN1NAM02FT018.eop-nam02.prod.protection.outlook.com (2603:10b6:408:107:cafe::62) by BN9PR03CA0929.outlook.office365.com (2603:10b6:408:107::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.17 via Frontend Transport; Mon, 27 Jun 2022 08:49:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BN1NAM02FT018.mail.protection.outlook.com (10.13.3.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5373.15 via Frontend Transport; Mon, 27 Jun 2022 08:49:23 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 27 Jun 2022 01:49:23 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 27 Jun 2022 01:49:23 -0700 Envelope-to: dev@dpdk.org, chenbo.xia@intel.com, maxime.coquelin@redhat.com, andrew.rybchenko@oktetlabs.ru, stable@dpdk.org, absaini@amd.com Received: from [10.170.66.118] (port=41974 helo=xndengvm004118.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1o5kQs-000CT1-KL; Mon, 27 Jun 2022 01:49:23 -0700 From: To: CC: , , , , Abhimanyu Saini , Vijay Kumar Srivastava Subject: [PATCH] vdpa/sfc: handle sync issue between qemu and vhost-user Date: Mon, 27 Jun 2022 14:19:17 +0530 Message-ID: <20220627084917.2295-1-asaini@xilinx.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: a1421afd-58dd-4abd-a762-08da5819f326 X-MS-TrafficTypeDiagnostic: DM6PR02MB4794:EE_|CO1NAM11FT034:EE_|DM4PR12MB5230:EE_ X-MS-Exchange-SenderADCheck: 0 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: kwNEroVqba2YZqTieI8q5m/zl2meURssQBEKNCEDCXxg5NPnFypgDg+Y8j+Jj13fSGl6qAf95W13dLJL+DLTdv5O0yZSwIfw41Rxt7MaOZ7Qx0pF8loZwYn4SqtS2ljCSrMn3z5ETkplZObdYox6m4VD36E9Hl/unPyeJxCqALr2lgVDLP7LHG/pWgKXCComa/EA6yFuydZsFg/FeVkSPF2KiLCZQmCbpvZQX+C1fR+rUnR8ODd1hqivVPjcZm+gXq4eTQ9iCN31UGfbjBJnQqhoBNC4tTvNvbvk9SVlOkOmyYZ0B7fa5Sv5peR9FWrwMQnDJCu84qQj3saLDthy5jywjbLajAMdrVshEx54gdnBfwC27VDH2qw1G7B17xGdt06627WDcihiZF0FjJKNjsfQX2EmcsH6VqrQ5gO8jLq7Q7rdsz5mkrJ3Vx97gzNW/Wc2fiFJ51ocmuMtGNzX3DuKHV23kYUi2LjfebD++wPSR8+fIgxckfkyXME2EcN6NfKBC06sDSGap0/KvXEYWdKa+5JJO/ZX5W3I6EEjHT7cY4BkL0tqovuiahPrEjzunFLek/rn41VgJrtoYxbZ91vR0KT83CRNAADRbG8j8VGObD3VjczMwlbAO8FOrLyVV0zU6qeluaMNuMmwyfmLa8TdS7+VE5cvNESa9zhSxZqvDqUNg/RCfLRS1T3JDiKYCnvLo+Q3BCI3s+MgZCKlogGkOhGU2JRbVut9MNMZzxgjEiiCqybA4FTa4P/cii1V0rWN4Vod0TOGk7hdvNahnaqVOjiw4hFSBbWYB3ywIFsqmXpv+mY3/Yavnj7AOjfLjQRV8DQAUpX0Uf5uncy4Pg== X-Forefront-Antispam-Report-Untrusted: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(13230016)(4636009)(346002)(376002)(396003)(39860400002)(136003)(36840700001)(40470700004)(46966006)(186003)(2616005)(47076005)(107886003)(1076003)(40480700001)(82310400005)(336012)(426003)(36756003)(316002)(70586007)(54906003)(6916009)(4326008)(70206006)(83380400001)(8936002)(9786002)(5660300002)(8676002)(26005)(7696005)(40460700003)(36860700001)(7636003)(356005)(82740400003)(2906002)(2876002)(6666004)(41300700001)(478600001)(102446001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB4794 X-MS-Exchange-Transport-CrossTenantHeadersStripped: CO1NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 60c6906d-7104-4353-2552-08da5819ef6a X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7/yau4H69DqoYf0c4BuxVHMDTBPHd/r7q+9+3/zu3EGIsn3HR3psI1J9PrJQw+JIQQsbS0Agaep+1G/oSqbbvED7i2Kr6lU2z1VHDC6hhx60aGGAJ7/ZAqGHmOjXwTCvMsljLOeCW5CxhpsoYPuR28a4xDocbG+FyNZ/9tr0Rg+5gmg+Y93XWwJiGwP6REqoT3IIjASJREvKyuf7M9QgAXw1UhTIue+hEizmvODELCh4m40t3RVByeZNEOgaon4u69KNH379wZUGOq7fFyEs0CgxtDgNCZhIIhb06DvTZ1Cuo7d7fTB41jT+/XrnzhTOyZFNKxRcHy29se14v10NyMUpl8mif8/JCcCmsSE9zeHDtnzTDxHvM4Wu5fOvIGdWL8KJz7kChNIIKREJiGrY+uD/zHAo/gq1wVOihIiLxUfItGk9e1sWuFD/L0bvdvTsUH0/LVw0kxsKcuDM579RgFj9BWm4q4yexLGj/seg7aC9wZxT8RXJS44+Kq4iHa+Z64x5pIwHYqy8M8nqiuofrRNBUz2bhKe1AUP+wkyqkxok6GVSqsys82tLLBsWxNghbiRFD96BzjDmn2tCy9M0RDVYRF6h5wFnMheT/oUDQkZJiBOkQua6j1R9SwbFw58pVt8FqIt/Z1YueZX/ElM+orFB0NwKkWsW6csqQVV+lGg0m7p2K2nsIGEM0G7/Xvxi33LVFw8r+NStXkZtUM802govO0MEfLsU+k2KnnNXyA0enbNg8++5C+kYFqExJPCTxrAAzbF7idezxeGWYZwYgO8RmhW0TzIsTfVUWCYas/olojsEbnP4qp1EnwUhbOS44kFQdC8t5eHsvnkc6sfEjA== X-Forefront-Antispam-Report: CIP:20.83.241.18; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mailrelay000000.14r1f435wfvunndds3vy4cdalc.xx.internal.cloudapp.net; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(136003)(376002)(346002)(39860400002)(396003)(46966006)(36840700001)(478600001)(6916009)(316002)(8676002)(5660300002)(4326008)(9786002)(8936002)(2906002)(41300700001)(83170400001)(82740400003)(36860700001)(81166007)(40480700001)(26005)(7696005)(336012)(107886003)(2616005)(42882007)(47076005)(1076003)(426003)(2876002)(6666004)(83380400001)(54906003)(82310400005)(36756003)(186003)(70206006)(102446001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2022 08:49:30.2701 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a1421afd-58dd-4abd-a762-08da5819f326 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[20.83.241.18]; Helo=[mailrelay000000.14r1f435wfvunndds3vy4cdalc.xx.internal.cloudapp.net] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-CO1NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5230 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Abhimanyu Saini When DPDK app is running in the VF, it sometimes rings the doorbell before dev_config has had a chance to complete and hence it misses the event. As workaround, ring the doorbell when vDPA reports the notify_area to QEMU. Fixes: 5e7596ba7cb3 ("vdpa/sfc: introduce Xilinx vDPA driver") Cc: stable@dpdk.org Signed-off-by: Vijay Kumar Srivastava Signed-off-by: Abhimanyu Saini --- drivers/vdpa/sfc/sfc_vdpa_ops.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c index b3d9b6c..63aa52d 100644 --- a/drivers/vdpa/sfc/sfc_vdpa_ops.c +++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c @@ -794,6 +794,8 @@ int vfio_dev_fd; efx_rc_t rc; unsigned int bar_offset; + volatile void *doorbell; + struct rte_pci_device *pci_dev; struct rte_vdpa_device *vdpa_dev; struct sfc_vdpa_ops_data *ops_data; struct vfio_region_info reg = { .argsz = sizeof(reg) }; @@ -856,6 +858,18 @@ sfc_vdpa_info(dev, "vDPA ops get_notify_area :: offset : 0x%" PRIx64, *offset); + pci_dev = sfc_vdpa_adapter_by_dev_handle(dev)->pdev; + doorbell = (uint8_t *)pci_dev->mem_resource[reg.index].addr + *offset; + + /* + * virtio-net driver in VM sends queue notifications before + * vDPA has a chance to setup the queues and notification area, + * and hence the HW misses these doorbell notifications. + * Since, it is safe to send duplicate doorbell, send another + * doorbell from vDPA driver as workaround for this timing issue. + */ + rte_write16(qid, doorbell); + return 0; }