Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7890175rwl; Thu, 23 Mar 2023 09:52:10 -0700 (PDT) X-Google-Smtp-Source: AKy350a873KoCHrqqRbuLMRGNod3rix7DgY8wn6+DF6Ag5zbZG3yJ63Vvtf+mw/xiH8VLn9xFVJ/ X-Received: by 2002:a05:6402:5178:b0:4fa:57bf:141a with SMTP id d24-20020a056402517800b004fa57bf141amr26283ede.32.1679590330529; Thu, 23 Mar 2023 09:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679590330; cv=none; d=google.com; s=arc-20160816; b=O6noRe7y1Ql1az7YNki5hrcUV6nwPe5WBRvmbjz8nsODZnR4zac2gN+09O4QUXqhr9 X8O9iC08r4J9FdKOgc0v5rxt6rQXkmXnHUwz23AWWJQ2V6C6SBtTRR4pap/+9+Fqqv1o ze6LbQebLHOCY5EHFS1LvAei1f5ygSziOzefNLoDmq0XeVRCBMFgWApR5o2w+4j2lMYC RmoGnoXCHRrtUQFMvyo3DOZeU34mO1kBI+srjCxhoyyy/gdnA6jRt0WeFHdmwWHR7i/l QXYGZXCBuvZPjPLif+XXbcYbm1JwYuI6So3+6g1Jd/Lruq67OTJ+yq/QNZXXg5hXuBl4 TXRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=2GoYNI0F1D8yVcQba2c1YEQlQ4+OmnrluIfKdQJMhP8=; b=VXH/4i8t/2yHj9jAGzfl8OkyRLFF7dyOqR6MHkiDfW2QkisYTDF/S4bBanch5Vx45J 5Pvp3y81nLxi6/EYnOZiw4LwmQwkiIgT3wqqPx08jNry3apUnwn9pusLzCup2F/357o7 jgztHE8q0Xvm3WWiT/nxiiSh98qULFP4OETDcruJaE2xeTtOTUhwBlK+nI7pDB7cnXc2 xaj2wOgWg4+z4zqR8i13PR7QiVgdXhfx4BRlyu2hrlWcxw4QqbiRL+/wr+szVeZDRc/c +jONBviLTeWOxgij2y4nSX1k9u4d37gTu9EDtIx9j9jTpddK/nxP3zXxA7W1wAVmos2P m7+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ly2pRhd4; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c8-20020aa7c988000000b004fc494a98f0si20718702edt.277.2023.03.23.09.51.46; Thu, 23 Mar 2023 09:52:10 -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=@intel.com header.s=Intel header.b=Ly2pRhd4; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232382AbjCWQvn (ORCPT + 99 others); Thu, 23 Mar 2023 12:51:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232341AbjCWQvl (ORCPT ); Thu, 23 Mar 2023 12:51:41 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 685ED26A9 for ; Thu, 23 Mar 2023 09:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679590300; x=1711126300; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=d9ywmKZwPZMfidXQiYHgda70SVYEXn3j56eoKfCXPYM=; b=Ly2pRhd4BIN0i8F90pv7oXSjBIgNS/O0uPJEa4o10zS7EXOFC/koIw/x D3Eof4SquMUDZqOB+QF2jb1k42bYQgx7A4VJky8O0cSsT6wyE+nj9he6H Kn9vAgtpAYjvf/1DEp5Vc1GkA83PZ27OtKyHodxRCVxmJgOOEVBsaej8L c01z6BtAxf9Q3VHB4am6aIYPIqHHhMtkJ+X5UQ8eKUKCnGjcbAQJSAaer QYQO4aXzUKlHEpyONJuLEN5KxdyqBA+FECD8m0YOEZE3GYyOlpcBOlpd3 PmEDXtHw7o1CyLkqqJ9lCLMywews2s/vDkC/BcZDX7HQRFNrnUW8smpiF g==; X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="337061036" X-IronPort-AV: E=Sophos;i="5.98,285,1673942400"; d="scan'208";a="337061036" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 09:51:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="632495129" X-IronPort-AV: E=Sophos;i="5.98,285,1673942400"; d="scan'208";a="632495129" Received: from sramak5-mobl.amr.corp.intel.com (HELO [10.212.70.194]) ([10.212.70.194]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 09:51:39 -0700 Message-ID: <20d2cb3a-3f6d-23ca-1044-3105704cc144@intel.com> Date: Thu, 23 Mar 2023 09:51:38 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.6.0 Subject: Re: [PATCH 3/3] ntb: intel: Remove redundant pci_clear_master Content-Language: en-US To: Cai Huoqing Cc: Sanjay R Mehta , Shyam Sundar S K , Jon Mason , Allen Hubbe , Frank Li , ntb@lists.linux.dev, linux-kernel@vger.kernel.org References: <20230323115336.12986-1-cai.huoqing@linux.dev> <20230323115336.12986-3-cai.huoqing@linux.dev> From: Dave Jiang In-Reply-To: <20230323115336.12986-3-cai.huoqing@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 On 3/23/23 4:53 AM, Cai Huoqing wrote: > 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 > --- > 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);