From patchwork Fri Mar 24 01:32:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 74295 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp81187wrt; Thu, 23 Mar 2023 18:36:02 -0700 (PDT) X-Google-Smtp-Source: AKy350aos4ySn6DmogEZND4L89e/pogFVTEcPIS6TYt/3Edm+2qoK+pmaM/UqWzN0Q2VV6vlI4hL X-Received: by 2002:a17:902:e889:b0:19a:a815:2858 with SMTP id w9-20020a170902e88900b0019aa8152858mr1191757plg.51.1679621762642; Thu, 23 Mar 2023 18:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679621762; cv=none; d=google.com; s=arc-20160816; b=0JM0RLKQpQLZB5tt8LskSqavDXfF5MwjidvxabV5cHj8IAl+SKOdL8sC/psLGw29j9 RHPNoZJgQs830YA/ZtvKaMCU3ho5r4lsIJb6F3oXq7KwtStJgzRJbHp10h+Aig0F0Nfi Gt7Vj3r6mmVQOrVFEENduOlCpq5m+IQSL0jb9sruL2/g8AdN19w66EgWgkL79F3y43DK 7fNGP3G/hzQBvOD5IznLND8ptZ89mIIJQmYswURU53RS5ONtFm8kBIuuNr+NtdLRJbxk eflfkSuuhHEexgsPO810Ndm85qjE6Xuq1CZ9Ria4kb6wdErcl0ueYJPX9+JE3uSjXPnw 0LTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=W2nbe/qe97oAd0bkNVfAnRrtvuCJRlnabZEg2AKy4ms=; b=yUG6SGwVtEWSnuRuX9D4DopCJl+m7cskUX7PzvwrbeyNQfVivEBfiUJTaonGqrvrlJ OYecz4/fL3P/iiAFtZiyEiI76F5wFifkvTEnghPEz88sct3cz1hjn2KkdacaYzhr+B1p 2at4VfuDVQoXvpMWQIj2IGRMBxtOJGPyubKNzMZMo77XVjA3f4K2HnEWjbMQ27rkBVEI 9Y5gcA0ZjR9D/+Dm3W0X0NMYRN5sgZ1CBpv4SOTRueZDpaWfZMCwR3jss+rRXO5rguIQ cBkxGlPuZajuGZEpVDG13TLfTeKaQiiQDmGcgNyPaMt8pecQ703QHnxo/Fsk2YBY6Z8a bVkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ihN99A1F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x24-20020a63db58000000b0050bfb509db2si19920665pgi.633.2023.03.23.18.35.48; Thu, 23 Mar 2023 18:36:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ihN99A1F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230098AbjCXBcg (ORCPT + 99 others); Thu, 23 Mar 2023 21:32:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbjCXBce (ORCPT ); Thu, 23 Mar 2023 21:32:34 -0400 Received: from out-45.mta1.migadu.com (out-45.mta1.migadu.com [95.215.58.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E264340C0 for ; Thu, 23 Mar 2023 18:32:32 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1679621550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=W2nbe/qe97oAd0bkNVfAnRrtvuCJRlnabZEg2AKy4ms=; b=ihN99A1FVxcJ7h4amVIKFbjkcMh/XINOnSx09wZ80dEXEv//9JkdYcwVFzIvU2DTOVL2r1 GtlBvV5dgMSzkx5XdoEPG+MC8dM6jY5qFi8n+Y+8x7/agsDr5qYYCK86BiYQbxnR9VAsSK kMUiRDLq9EE1QY3m3mcCiksOhyW4lf4= From: Cai Huoqing To: cai.huoqing@linux.dev Cc: Sanjay R Mehta , Shyam Sundar S K , Jon Mason , Dave Jiang , Allen Hubbe , Frank Li , ntb@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] ntb_hw_amd: Remove redundant pci_clear_master Date: Fri, 24 Mar 2023 09:32:18 +0800 Message-Id: <20230324013224.5963-1-cai.huoqing@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TO_EQ_FM_DIRECT_MX autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761211069573992793?= X-GMAIL-MSGID: =?utf-8?q?1761211069573992793?= Remove pci_clear_master to simplify the code, the bus-mastering is also cleared in do_pci_disable_device, like this: ./drivers/pci/pci.c:2197 static void do_pci_disable_device(struct pci_dev *dev) { u16 pci_command; pci_read_config_word(dev, PCI_COMMAND, &pci_command); if (pci_command & PCI_COMMAND_MASTER) { pci_command &= ~PCI_COMMAND_MASTER; pci_write_config_word(dev, PCI_COMMAND, pci_command); } pcibios_disable_device(dev); }. And dev->is_busmaster is set to 0 in pci_disable_device. Signed-off-by: Cai Huoqing --- v1->v2: No change v1 link: https://lore.kernel.org/lkml/20230323115336.12986-1-cai.huoqing@linux.dev/ drivers/ntb/hw/amd/ntb_hw_amd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c index 730f2103b91d..855ff65f64a5 100644 --- a/drivers/ntb/hw/amd/ntb_hw_amd.c +++ b/drivers/ntb/hw/amd/ntb_hw_amd.c @@ -1194,7 +1194,6 @@ static int amd_ntb_init_pci(struct amd_ntb_dev *ndev, return 0; err_dma_mask: - pci_clear_master(pdev); pci_release_regions(pdev); err_pci_regions: pci_disable_device(pdev); @@ -1209,7 +1208,6 @@ static void amd_ntb_deinit_pci(struct amd_ntb_dev *ndev) pci_iounmap(pdev, ndev->self_mmio); - pci_clear_master(pdev); pci_release_regions(pdev); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); From patchwork Fri Mar 24 01:32:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 74296 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp81541wrt; Thu, 23 Mar 2023 18:37:15 -0700 (PDT) X-Google-Smtp-Source: AK7set96IN5n0GzpdFvVe/11zXF75dmpoSDFhIiNxfsA5Nc5p8/fYV9jLNRWWZVjknxXnvV/jVj6 X-Received: by 2002:a05:6a20:bf18:b0:da:462c:9e15 with SMTP id gc24-20020a056a20bf1800b000da462c9e15mr1170361pzb.48.1679621834755; Thu, 23 Mar 2023 18:37:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679621834; cv=none; d=google.com; s=arc-20160816; b=PZEdTxH9uiusVnP32qSSEKCOgU0HPVKNATr/9hfp/af6exPFvh2HJ+6sOgaH4ANvlN CJNdW1lJeitHKsauVh4UMuodmuux8yn7hVFM0oL/it/B8CWI2leHqefztF6rQtcen2NJ LBvWABIDwZh0SXDNilVV+KJJD87MU8c1xXndUGSc2ctzRCKg5IMsMJX/Bv6rjuzusPo1 YnsloPXzc6dBejLWOwRYBH4ritDiUZjDLc7ipdBgoRebfwUySAAz8/mHNqNbAkuEiml8 g0bXq4aUYe/ZCmriiaWVL296ZcmJXSewAzUsoYYgJ72hKGvNkLz8e11eQUgJ/aGtE70Q /XKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RrieUzsMuRHYXa8v1AQdzJWDE6SJhykPzWCWACiwQL8=; b=vZz37+P1d3o5xfnFShZ5qM0fPBBy6GAHEYi5va4tjAXA+2IpHU8I0OcGwyigA/n0+f zhgSsDvsc/6z1sJ0LprGRRlI/7jetuHgP/+AqXuvOEGmbRj3lRUSVEECXBMNj20vsSo5 6fcdDPCwr/XCl/J28W+rILXyH+caGL4SIRKL0VKJ0lb6IwStU/Y0B+mz/YWEP80Vh8Zv bcFCm0K+Jt3ga0HagI2D/V5xdJfjsxuhpJdMP1BrqpDqr/T5k/fhYltAiipl1ndc5b+1 if7Ucv8NddBxJymGE4EGl6unCNhU+boiydPcWN0M9+CBJL/ntjt4vvzpsEw6AJBxcdco G4xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=gSX0c39M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x24-20020a63db58000000b0050bfb509db2si19920665pgi.633.2023.03.23.18.37.01; Thu, 23 Mar 2023 18:37:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=gSX0c39M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230418AbjCXBcm (ORCPT + 99 others); Thu, 23 Mar 2023 21:32:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230213AbjCXBck (ORCPT ); Thu, 23 Mar 2023 21:32:40 -0400 Received: from out-57.mta0.migadu.com (out-57.mta0.migadu.com [91.218.175.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6796C2B60B for ; Thu, 23 Mar 2023 18:32:39 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1679621557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RrieUzsMuRHYXa8v1AQdzJWDE6SJhykPzWCWACiwQL8=; b=gSX0c39MYWvxeObx2gcyVm4rNyqxjY2FDJcQzPbUsmjLAH0+FwWuhfYLCESL1v6J99OA1G wdtLiwdQeyOHlvmfX75a9RkPwzrBm2vnvPBTHtEzDxiL/QfqwZ0ky2AF9aFFKeftLkMMYL eMNJ9p3Vf0kLvPeiaCXwb0M9+ujlyEs= From: Cai Huoqing To: cai.huoqing@linux.dev Cc: Sanjay R Mehta , Shyam Sundar S K , Jon Mason , Dave Jiang , Allen Hubbe , Frank Li , ntb@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] ntb: epf: Remove redundant pci_clear_master Date: Fri, 24 Mar 2023 09:32:19 +0800 Message-Id: <20230324013224.5963-2-cai.huoqing@linux.dev> In-Reply-To: <20230324013224.5963-1-cai.huoqing@linux.dev> References: <20230324013224.5963-1-cai.huoqing@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TO_EQ_FM_DIRECT_MX autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761211144552795873?= X-GMAIL-MSGID: =?utf-8?q?1761211144552795873?= Remove pci_clear_master to simplify the code, the bus-mastering is also cleared in do_pci_disable_device, like this: ./drivers/pci/pci.c:2197 static void do_pci_disable_device(struct pci_dev *dev) { u16 pci_command; pci_read_config_word(dev, PCI_COMMAND, &pci_command); if (pci_command & PCI_COMMAND_MASTER) { pci_command &= ~PCI_COMMAND_MASTER; pci_write_config_word(dev, PCI_COMMAND, pci_command); } pcibios_disable_device(dev); }. And dev->is_busmaster is set to 0 in pci_disable_device. Signed-off-by: Cai Huoqing --- v1->v2: Fix the removed label-err_dma_mask v1 link: https://lore.kernel.org/lkml/20230323115336.12986-2-cai.huoqing@linux.dev/ drivers/ntb/hw/epf/ntb_hw_epf.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/ntb/hw/epf/ntb_hw_epf.c b/drivers/ntb/hw/epf/ntb_hw_epf.c index 3ece49cb18ff..b640aa0bf45e 100644 --- a/drivers/ntb/hw/epf/ntb_hw_epf.c +++ b/drivers/ntb/hw/epf/ntb_hw_epf.c @@ -591,7 +591,7 @@ static int ntb_epf_init_pci(struct ntb_epf_dev *ndev, ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); if (ret) { dev_err(dev, "Cannot set DMA mask\n"); - goto err_dma_mask; + goto err_pci_regions; } dev_warn(&pdev->dev, "Cannot DMA highmem\n"); } @@ -599,14 +599,14 @@ static int ntb_epf_init_pci(struct ntb_epf_dev *ndev, ndev->ctrl_reg = pci_iomap(pdev, ndev->ctrl_reg_bar, 0); if (!ndev->ctrl_reg) { ret = -EIO; - goto err_dma_mask; + goto err_pci_regions; } if (ndev->peer_spad_reg_bar) { ndev->peer_spad_reg = pci_iomap(pdev, ndev->peer_spad_reg_bar, 0); if (!ndev->peer_spad_reg) { ret = -EIO; - goto err_dma_mask; + goto err_pci_regions; } } else { spad_sz = 4 * readl(ndev->ctrl_reg + NTB_EPF_SPAD_COUNT); @@ -617,14 +617,11 @@ static int ntb_epf_init_pci(struct ntb_epf_dev *ndev, ndev->db_reg = pci_iomap(pdev, ndev->db_reg_bar, 0); if (!ndev->db_reg) { ret = -EIO; - goto err_dma_mask; + goto err_pci_regions; } return 0; -err_dma_mask: - pci_clear_master(pdev); - err_pci_regions: pci_disable_device(pdev); @@ -642,7 +639,6 @@ static void ntb_epf_deinit_pci(struct ntb_epf_dev *ndev) pci_iounmap(pdev, ndev->peer_spad_reg); pci_iounmap(pdev, ndev->db_reg); - pci_clear_master(pdev); pci_release_regions(pdev); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); From patchwork Fri Mar 24 01:32:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 74297 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp82430wrt; Thu, 23 Mar 2023 18:39:56 -0700 (PDT) Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=lV3kZeBr X-Google-Smtp-Source: AKy350bCBr+PPDqBpRHvfqSC5rBn4Rm/wmbVhhVzP1uZVmL/0ZRzLAC0m9CuaeltAVQfQuaY7CVY X-Received: by 2002:a17:902:e812:b0:19c:e440:9256 with SMTP id u18-20020a170902e81200b0019ce4409256mr1214586plg.35.1679621996089; Thu, 23 Mar 2023 18:39:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679621996; cv=none; d=google.com; s=arc-20160816; b=KvJda4BUv+ha67eOUTvW2rNocaxp7En4qCIuNSMfyGfxRCjKb4SsfHMyrAYx7sQ/er qBlOHbDMO/9qEDlk2aKBtTmICvXhtcVP1UOsOJ6ZH+IG/Zra4JdmbcnHZ8Hx3EOIMHFv K9Z6drGAvZwlKtrzuyTYUu9qJGNApQhJGSFuKKp/4G0SMqug2rp6GZP8EIAl4LKp0wG4 W4kD48u6xztI8TD1xQkQP757MLPNQMbPMz+/WhzogqbtlDuaVb6BvRUS7mQ0yPxaNrzk 9sjNqdHv6GzdKMpd0v3InFfHc1IEKm/AmyalmOmOyY3Kz2oJ6x678vTNI0RGRN9fdCEv bnQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=M70XsVdJtUL81tuo2OKkYLLlk8pQMU03G6wBmbDiO64=; b=J+aKPTRPgFNhRMO4YlPEMwoYTBuP7dfVPzbYpty1rxOSDTjvx7Mq+jBqcSD9RaaCvN Wpl8kvbWIVQsbkult4q/Hb8CRwqJz4tyDy5Becfa88+CBKX7LObBdaXHDrjbiA2yhApY RY0aE3HAp5CtJ+D6Jh9M4IZ48h8w0BAp8wAaPRMHA1445mUOS1P5sU/ObrTRKatMQ9zP ZiVjMcAU3ttcpAUhKG7A74xEovEOF41o/K2jF9G1Bk8txY2+kNSJ77ZNsbt/bOrf0Zun h0+TfCVxBThNxI3zh9IEb3kqx9OqN+fGjJJCqIYjUWOqJ8H3ErUXs0Lf+Hvi+6Fe4puh rO1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=lV3kZeBr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp5-20020a17090b190500b0023f2497e6f1si2960475pjb.182.2023.03.23.18.39.43; Thu, 23 Mar 2023 18:39:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=lV3kZeBr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230430AbjCXBcs (ORCPT + 99 others); Thu, 23 Mar 2023 21:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230487AbjCXBcr (ORCPT ); Thu, 23 Mar 2023 21:32:47 -0400 Received: from out-12.mta0.migadu.com (out-12.mta0.migadu.com [91.218.175.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CC84619F for ; Thu, 23 Mar 2023 18:32:44 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1679621563; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M70XsVdJtUL81tuo2OKkYLLlk8pQMU03G6wBmbDiO64=; b=lV3kZeBrOOcFCbH1tQshhiHqpu5Z4QEJXzp9hx5KbtNMKoGZi/Dvw0G2zEPF+QC/y86Wy4 2rhYCkfdwv1CtazOnV2bOPZjMNVZ3bI+JO3R8w9fbgW7tA5MUkxF2bls339hOwWbJSjaZR 7Cl6cwRZpO6VRMlanzxxMRjXFEsSYyc= From: Cai Huoqing To: cai.huoqing@linux.dev Cc: Dave Jiang , Sanjay R Mehta , Shyam Sundar S K , Jon Mason , Allen Hubbe , Frank Li , ntb@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] ntb: intel: Remove redundant pci_clear_master Date: Fri, 24 Mar 2023 09:32:20 +0800 Message-Id: <20230324013224.5963-3-cai.huoqing@linux.dev> In-Reply-To: <20230324013224.5963-1-cai.huoqing@linux.dev> References: <20230324013224.5963-1-cai.huoqing@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TO_EQ_FM_DIRECT_MX autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761211314165767357?= X-GMAIL-MSGID: =?utf-8?q?1761211314165767357?= Remove pci_clear_master to simplify the code, the bus-mastering is also cleared in do_pci_disable_device, like this: ./drivers/pci/pci.c:2197 static void do_pci_disable_device(struct pci_dev *dev) { u16 pci_command; pci_read_config_word(dev, PCI_COMMAND, &pci_command); if (pci_command & PCI_COMMAND_MASTER) { pci_command &= ~PCI_COMMAND_MASTER; pci_write_config_word(dev, PCI_COMMAND, pci_command); } pcibios_disable_device(dev); }. And dev->is_busmaster is set to 0 in pci_disable_device. Signed-off-by: Cai Huoqing Acked-by: Dave Jiang --- v1->v2: No change v1 link: https://lore.kernel.org/lkml/20230323115336.12986-3-cai.huoqing@linux.dev/ drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/ntb/hw/intel/ntb_hw_gen1.c b/drivers/ntb/hw/intel/ntb_hw_gen1.c index 60a4ebc7bf35..9ab836d0d4f1 100644 --- a/drivers/ntb/hw/intel/ntb_hw_gen1.c +++ b/drivers/ntb/hw/intel/ntb_hw_gen1.c @@ -1791,7 +1791,6 @@ static int intel_ntb_init_pci(struct intel_ntb_dev *ndev, struct pci_dev *pdev) err_mmio: err_dma_mask: - pci_clear_master(pdev); pci_release_regions(pdev); err_pci_regions: pci_disable_device(pdev); @@ -1808,7 +1807,6 @@ static void intel_ntb_deinit_pci(struct intel_ntb_dev *ndev) pci_iounmap(pdev, ndev->peer_mmio); pci_iounmap(pdev, ndev->self_mmio); - pci_clear_master(pdev); pci_release_regions(pdev); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL);