From patchwork Mon Oct 17 19:20:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: longli@linuxonhyperv.com X-Patchwork-Id: 3669 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1605745wrs; Mon, 17 Oct 2022 12:21:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GIYcN/NDRjaYWLHCTZhc/8+yCcf0muf7k8VamRM3nY87drrS57EJtTgowZzZ2kRS006bO X-Received: by 2002:a17:902:ef83:b0:17c:a2f:1e3 with SMTP id iz3-20020a170902ef8300b0017c0a2f01e3mr13220223plb.35.1666034513169; Mon, 17 Oct 2022 12:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666034513; cv=none; d=google.com; s=arc-20160816; b=GHSyWDO59txTtL+A4JdwkPL0/zDgYwgYBsvwA3V5PJ/DWP58LofTHIhaJahyUfKPAg HED1kp/6lqmzX7eTHXg14f4tBeDMI7QFM2wLJA/Yu0pYTf49MHz67YiXinaM0SS5GtYl bmSA2Yf82yzcg1RsLbqBAaAIovF0VvFsbKK0hzvHV4/jeOEaPAj94Z/V7nhBXvT4LXgL jgNCNxEQ4i4wIdi1k92z47LMeqBtYOHurBmeXYkJCt1Ceru8oSFIGKjNlMnIAaEnn+mF A3ow18Cza2ZCIO4kNqsH3X2tHnOHLK9qgaWeTCqBq1XjtyzzqOZGm8uQwTLCLIPTvVbe DE1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:reply-to:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=8Z6yW2KqbQl4Wyror+q4zSVQuzt8hLhkxhobys217qM=; b=qDuPSE/n8NEi3cqKSkASgIrRmlkRMhAXwUMtx1B2QnmtBl60600PUzC3qERhtuviK0 J0Rl/xGUeLI/r3aECju6FLxlM2LEHIp5h0ecEep+Rtnh2uX1wUa3/fBP0J9Ig2n/8aRz 1RWZy2o4Ltum6eYBjaVPhiqVhZBO+hHLfRmIkGMrn8L8NL9DkzXThgAunVklxBVHFBSG N8yvFyBMoBySKWrZkZe+M14OFmoAYrQrycCzlKopcN/hRsEr4Sy/bwiL4AEi7Z7o5V/+ FjlXbEipTLKMBNEXWEzwlRACZk7G7YYcwsJNPMEuxd4KqUfEn0/0A7EO5LawPu3U5uIU NpLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxonhyperv.com header.s=default header.b="q0/b6nRM"; 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=linuxonhyperv.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e20-20020a056a001a9400b00562be402e14si13408971pfv.353.2022.10.17.12.21.39; Mon, 17 Oct 2022 12:21:53 -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=@linuxonhyperv.com header.s=default header.b="q0/b6nRM"; 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=linuxonhyperv.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231254AbiJQTVU (ORCPT + 99 others); Mon, 17 Oct 2022 15:21:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbiJQTU4 (ORCPT ); Mon, 17 Oct 2022 15:20:56 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D9ED86D9ED; Mon, 17 Oct 2022 12:20:52 -0700 (PDT) Received: by linux.microsoft.com (Postfix, from userid 1004) id D131320FD95B; Mon, 17 Oct 2022 12:20:51 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D131320FD95B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1666034451; bh=8Z6yW2KqbQl4Wyror+q4zSVQuzt8hLhkxhobys217qM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=q0/b6nRMWRRdKzWgU5v810SJnw4VAWNwFeM3LUEfrntLpV33qbiG9j12ECHY2t8yE 5ac7p+H2BJPA6DBModkZ4Je9Q/igwLixo96/fWmJagJwZsDwUV3ggSGs4542vnyPjd a1vNDJ4+LrQ9S+k1gNftCQQmNE8lW1avd+u+QICg= From: longli@linuxonhyperv.com To: "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Jason Gunthorpe , Leon Romanovsky , edumazet@google.com, shiraz.saleem@intel.com, Ajay Sharma Cc: linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Long Li Subject: [Patch v7 02/12] net: mana: Record the physical address for doorbell page region Date: Mon, 17 Oct 2022 12:20:31 -0700 Message-Id: <1666034441-15424-3-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666034441-15424-1-git-send-email-longli@linuxonhyperv.com> References: <1666034441-15424-1-git-send-email-longli@linuxonhyperv.com> Reply-To: longli@microsoft.com X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_SPF_WL autolearn=ham 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?1746963805724954833?= X-GMAIL-MSGID: =?utf-8?q?1746963805724954833?= From: Long Li For supporting RDMA device with multiple user contexts with their individual doorbell pages, record the start address of doorbell page region for use by the RDMA driver to allocate user context doorbell IDs. Reviewed-by: Dexuan Cui Signed-off-by: Long Li Acked-by: Haiyang Zhang --- Change log: v6: rebased to rdma-next drivers/net/ethernet/microsoft/mana/gdma.h | 2 ++ drivers/net/ethernet/microsoft/mana/gdma_main.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/drivers/net/ethernet/microsoft/mana/gdma.h b/drivers/net/ethernet/microsoft/mana/gdma.h index f321a2616d03..72eaec2470c0 100644 --- a/drivers/net/ethernet/microsoft/mana/gdma.h +++ b/drivers/net/ethernet/microsoft/mana/gdma.h @@ -351,9 +351,11 @@ struct gdma_context { u32 test_event_eq_id; bool is_pf; + phys_addr_t bar0_pa; void __iomem *bar0_va; void __iomem *shm_base; void __iomem *db_page_base; + phys_addr_t phys_db_page_base; u32 db_page_size; /* Shared memory chanenl (used to bootstrap HWC) */ diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c index 5f9240182351..0cfe5f15458e 100644 --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c @@ -44,6 +44,9 @@ static void mana_gd_init_vf_regs(struct pci_dev *pdev) gc->db_page_base = gc->bar0_va + mana_gd_r64(gc, GDMA_REG_DB_PAGE_OFFSET); + gc->phys_db_page_base = gc->bar0_pa + + mana_gd_r64(gc, GDMA_REG_DB_PAGE_OFFSET); + gc->shm_base = gc->bar0_va + mana_gd_r64(gc, GDMA_REG_SHM_OFFSET); } @@ -1367,6 +1370,7 @@ static int mana_gd_probe(struct pci_dev *pdev, const struct pci_device_id *ent) mutex_init(&gc->eq_test_event_mutex); pci_set_drvdata(pdev, gc); + gc->bar0_pa = pci_resource_start(pdev, 0); bar0_va = pci_iomap(pdev, bar, 0); if (!bar0_va)