From patchwork Thu Mar 23 08:35:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cai Huoqing X-Patchwork-Id: 73910 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2800637wrt; Thu, 23 Mar 2023 02:10:10 -0700 (PDT) X-Google-Smtp-Source: AK7set8wO4KRwgrTbHIH5zSWOhHUaTk25YP6S4AFW3SJSZffQ/ZkB/X8yxMizugoKxwPGx8RNqL9 X-Received: by 2002:a17:903:68f:b0:19f:8ad5:4331 with SMTP id ki15-20020a170903068f00b0019f8ad54331mr4766936plb.38.1679562609942; Thu, 23 Mar 2023 02:10:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679562609; cv=none; d=google.com; s=arc-20160816; b=UTJcCdI2KUWyOQOkt6eLSZM0LYghfpu1M4gUtSlpF8n+Xr7a7/Jo4+R4HJadiWE4yW ZQ4xvMTBFteRfiH0PmgfjK/0kDIhMOgJDTh3moqBX6kJ8aPxtzzD+oJj/WvkBJQj2Fxx nSdd1rCSYyjveMUlRlikihAEDd01/AAE33b9Wd7TlUImzlPY5rwpG5yYOU73Zjo1REym JOTVgaIHTHstIOhFinxp8H7JxvowcWmF0oFBteB4FIVodgXdQceSGw6YERTIEamcQCLY aCTZ5ouw+9schgYSk98F9De9x9KPzoqgKLq99GOVD2Vmw96cKI7UmuD0Yy58afQWe25+ p8zA== 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=sR3yPTtRDVj1xoPJWPkU1xtU6p71nBTQtzFAzgAXTAM=; b=cVcI7jlgM5SJNL1sOqLHMLbR8Tp0wrITL9U1KDVuXEa9WmTcrzF9F2TjQyg4+j4T80 oUuYppujL9LWb44Xnd/1ru9Is8Yb1GKK+MTKij6Y8X/HLnw0Qiy5BNIfIA8fMsDIDpSJ D1YhrcSKexPZKApNsfU2vZa+HnSbEJAxj9APtY35HK+yR0rpJBRt57njSb1GeYbks4Rr qRPm2rbSwaE2MUT7t3im4Ig4f/VRsdy0ML8+DbJwliMBLTGqD6LcHbDMP36s7+BBMKdv uT8loUijAYQDKphEQLUrWI28P0F/u4Vu+IPn2aU9z7iAplrWNB26dqIuGh436xTcGfOG aWgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=aPn5X1CD; 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 bc22-20020a656d96000000b004fbba9a8f99si16749207pgb.856.2023.03.23.02.09.57; Thu, 23 Mar 2023 02:10:09 -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=aPn5X1CD; 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 S229589AbjCWIha (ORCPT + 99 others); Thu, 23 Mar 2023 04:37:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231608AbjCWIhH (ORCPT ); Thu, 23 Mar 2023 04:37:07 -0400 Received: from out-5.mta1.migadu.com (out-5.mta1.migadu.com [IPv6:2001:41d0:203:375::5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B0D0FF29 for ; Thu, 23 Mar 2023 01:35:59 -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=1679560557; 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=sR3yPTtRDVj1xoPJWPkU1xtU6p71nBTQtzFAzgAXTAM=; b=aPn5X1CDLNGicO++xOTkolNf/4Uw7IjGooBgYaR1whX2aspiUAaolHbmudZtyPshdQLFP0 fJY3I+uyqublkl7FC6ehPI+9HsohOvYbxM+ecTX/IZ19buHUPFHHCR1ZiqHI5Dl8iYRip1 fJBODkoL2vICZ6cHnXb92wg9orz9H3w= From: Cai Huoqing To: cai.huoqing@linux.dev Cc: Oded Gabbay , Tomer Tayar , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] accel/habanalabs: Remove redundant pci_clear_master Date: Thu, 23 Mar 2023 16:35:49 +0800 Message-Id: <20230323083553.16864-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?1761149043478254940?= X-GMAIL-MSGID: =?utf-8?q?1761149043478254940?= 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 Reviewed-by: Stanislaw Gruszka --- drivers/accel/habanalabs/common/device.c | 1 - drivers/accel/habanalabs/common/pci/pci.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c index 713005998cbc..2fb1e2ec3a83 100644 --- a/drivers/accel/habanalabs/common/device.c +++ b/drivers/accel/habanalabs/common/device.c @@ -1271,7 +1271,6 @@ int hl_device_resume(struct hl_device *hdev) return 0; disable_device: - pci_clear_master(hdev->pdev); pci_disable_device(hdev->pdev); return rc; diff --git a/drivers/accel/habanalabs/common/pci/pci.c b/drivers/accel/habanalabs/common/pci/pci.c index d1f4c695baf2..191e0e3cf3a5 100644 --- a/drivers/accel/habanalabs/common/pci/pci.c +++ b/drivers/accel/habanalabs/common/pci/pci.c @@ -420,7 +420,6 @@ int hl_pci_init(struct hl_device *hdev) unmap_pci_bars: hl_pci_bars_unmap(hdev); disable_device: - pci_clear_master(pdev); pci_disable_device(pdev); return rc; @@ -436,6 +435,5 @@ void hl_pci_fini(struct hl_device *hdev) { hl_pci_bars_unmap(hdev); - pci_clear_master(hdev->pdev); pci_disable_device(hdev->pdev); }