From patchwork Fri Oct 28 15:57:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12426 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp910489wru; Fri, 28 Oct 2022 09:01:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xJ5byLDnSn82ZotNxRfhVPNGcdiBS2WHdCvQTSfHV378PRCYo0Fo8YNLtyjFvs1XBd3oo X-Received: by 2002:a63:91:0:b0:461:f509:2a31 with SMTP id 139-20020a630091000000b00461f5092a31mr225536pga.108.1666972887372; Fri, 28 Oct 2022 09:01:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666972887; cv=pass; d=google.com; s=arc-20160816; b=QC1BnQ62TCZx8bnxa9v4/35ApX/d0nU9afQABo/GAJg7sgnnwNR/+/3cdhvVK0OEJE h7IvrMAhpp68xPB93G13oJw1NhCalARg2GvHtKmYkh4bDMm7npOHsu1IohHM3FaKfNLz 8QOy9SqCdDIfeQ4XcHG+f5aCv4eUZM83zRshJU08nx5xgN/CTUF09ZahvvMplKDp2LJJ VLrkqdWsG9DgV+SIDszM7AmIhnBvIdr9d5jVnXLsmYQlNnMd1n9XAGtaair43uZwOX5m NvR3ULM8HNTYst1+WsVZRQ46VVPWanqrlYgM2t/jhipiCvqs8Yggc77N0ve6mcJqIi2d 912A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=e7rFAgLLE8DgxLzFxypT6h/aMZ7/AGzWG+1ThOcYzlQ=; b=mHcVC/feSZe916KRM4zNfTaDwkHRKn5Op6Wr5NDw+U07z+pTh0OlXV5QcQHs26cmig 4U/R/q5fB7KviTGDZHIhFs5cQftDO3JlGs+CIWInDM4mXJLKi55m1+lh/3V38hENOtvc H4PsOzknMk32ukdbgIYW5a9TTHtTa73UR9uuiCNlu94ETw0GTVkocIAJYUJinbc3gI2q H9VzQGhecirfZyv1RJU1xQY5ioa3+epJdjQFeu4n6qU84nMdmlncL+AbejMaujQj3BjK w8U0GIBPHxjriJIe/HkO1W5+bTD7SkxmCJYmTxfTScmP4CYHTQr1kIDPCepDl5p/yUHk GRfQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=XIcofmhF; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b38-20020a630c26000000b0046eb1d42b66si5872052pgl.284.2022.10.28.09.01.11; Fri, 28 Oct 2022 09:01:27 -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=@nxp.com header.s=selector2 header.b=XIcofmhF; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230445AbiJ1P75 (ORCPT + 99 others); Fri, 28 Oct 2022 11:59:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230417AbiJ1P7A (ORCPT ); Fri, 28 Oct 2022 11:59:00 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2053.outbound.protection.outlook.com [40.107.104.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23E7D21CD46; Fri, 28 Oct 2022 08:57:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J9VbPvD3wGvJOQYsNXGVklno06CEYFq6aXMUY4Eq9lR9vsrbZ9c/HFOMOWlnAIt/VxgCWjV5zm/j/GsUY7Ty2z6DviQ6AaKBtFbVumPWP0FTZn7aKvDsNcTdvpLD6LiE/W9CBqKq5SG2LEAhUCKFi4JvLGIVvWgq510sy2y4EkykzYxqTecR9yxhSvowjo8X7YH3iQneiarmnp0EEUSUh4ybHT6IGZ3mf7c9aNEh4jwRWuDORrbPsR3h6xVFe3rMdiyLWIltcQhbqJMACtAVfH/jxIDAh7wuyrVp9aL93gJYnnh4eDSwX7xA4KkOSQQZzIaWZntrv64V3rOVij4WSA== 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=e7rFAgLLE8DgxLzFxypT6h/aMZ7/AGzWG+1ThOcYzlQ=; b=WEtztqkD2xgBrjs7tZo+eJmOWUEH0qSrKJD4AqdCHIKIBoYF3M4mEYY8rk9lAzKj80jsbi+O2w2OF3HMVIlalz+c2Xh9Ow5ScEvAMS7wDete9nGV1DdqgrfNQO++OiSBY+EWpQgwrZoBlBwkyEXhx/Ou06KeerPGQVn8QitdZQW/cO6GMPdG8bv8EnoBc+bwRd82z/KOCbe2bhxZLuGKbx9YGIiIZIjH6hs7iKwx+CYM9UJ5mOi20aE+fIgzAX1fBM9iSZch/kFxoUobm2TLuoPgw2N3hx3489ua6QMlYemGQD/OzMWBxt3VoPURCKuu+mc/okKcoNCSTzTWjuqNXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e7rFAgLLE8DgxLzFxypT6h/aMZ7/AGzWG+1ThOcYzlQ=; b=XIcofmhFu/25nSIp9SO8HuKsUbtTAPAIiwAyfN9k5lI0/ODTcF9P3yh7OpyrtaTegFEIIUYjHHucTU6NIno+C7Fy7ug3hwF9XcIlOMuCTvRR+31kExAa5tRo2sKaJCyh+zxH+YV+aP+Vo1a2g4NO0ZPOR9CcLWCwxP/XW32TciY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from HE1PR0401MB2331.eurprd04.prod.outlook.com (2603:10a6:3:24::22) by AM9PR04MB8323.eurprd04.prod.outlook.com (2603:10a6:20b:3e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15; Fri, 28 Oct 2022 15:57:45 +0000 Received: from HE1PR0401MB2331.eurprd04.prod.outlook.com ([fe80::44bb:8387:8f4b:6a28]) by HE1PR0401MB2331.eurprd04.prod.outlook.com ([fe80::44bb:8387:8f4b:6a28%10]) with mapi id 15.20.5746.028; Fri, 28 Oct 2022 15:57:45 +0000 From: Frank Li To: frank.li@nxp.com Cc: allenbh@gmail.com, bhelgaas@google.com, dave.jiang@intel.com, helgaas@kernel.org, imx@lists.linux.dev, jdmason@kudzu.us, kw@linux.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lpieralisi@kernel.org, mani@kernel.org, ntb@lists.linux.dev Subject: [PATCH v14 5/7] PCI: endpoint: pci-epf-vntb: replace hardcode 4 with sizeof(u32) Date: Fri, 28 Oct 2022 11:57:01 -0400 Message-Id: <20221028155703.318928-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221028155703.318928-1-Frank.Li@nxp.com> References: <20221028155703.318928-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR02CA0010.namprd02.prod.outlook.com (2603:10b6:a02:ee::23) To HE1PR0401MB2331.eurprd04.prod.outlook.com (2603:10a6:3:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0401MB2331:EE_|AM9PR04MB8323:EE_ X-MS-Office365-Filtering-Correlation-Id: 075b4988-f553-427a-8ca6-08dab8fd278e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UpoFVPJbbOsb206snh7r+2lNlHZLqd1OoySePfJdY/EMU7Rzvvt7wXnmIrKiDTlEuM45s+nQzgWnX5QU/q9s0RBb0tT5BICP3h8gZdyuoLvpq1evbndtRdEetoFs/SN6YuSlbd3mCzS+bSOawzIBtE099kBK9X4bZyCBwvGs9W9stAC2af/oWn59kCXtKlM//yW55WHH0SGA1KXueweJc61es2JrQeELi921LYT1zEqfZvoJ3uNvtgtfJvkaHCk9X7aLfatzmWnOZDUrsbC9/T6/55QiOdAeLhVxigwcU/1PuAzr0JMnKNv5JKcTVthP48S4VMiCVlzTU72rKdR7rc41lmYz+Xt/t/sQ4wVxrn1Pfc9aL1Yk5sVajHXRr1qcnawyVbxw/Dm/bcq6XGX2LPOMAZf6kWPP0tpKK9l2dFDTK8Fy5OiGPfNZWviXF/cqVF3Fw/YecipDdVc25dpwuIlZOTpS9AJ2bXjkUvn08GcGmSVYEQWPPay+GK3LzHdSUaEBTD1y/AY59gq62/cIp/vTW/hfDFHLaUWDAzYMGjIQ+S/Psnh258u+fUOS4DCG+EiivMU4ew+R5qxDx1NBoHOv3M3XElrwOdytErIFpuZ/8DWjGEELN+EWSm3zPmjMbVSGAikNmnao4WDgHiIJLqRwgsgwevrWsJdLgd/qM/DZkCQTkE9L8Fl0Oediav3xyHhLXQM1JDuJPtAry6t1Jnf9+uOGz0wsyqOEs3Ie1Ohf5FQeeCHttHIbsByFjRkb6WYNCajqRYRw6ld55ekZYw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0401MB2331.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(136003)(346002)(366004)(396003)(39860400002)(376002)(451199015)(6666004)(316002)(37006003)(34206002)(8936002)(5660300002)(4326008)(2616005)(186003)(1076003)(7416002)(8676002)(52116002)(36756003)(6506007)(66476007)(66946007)(66556008)(6512007)(26005)(41300700001)(83380400001)(86362001)(38100700002)(2906002)(38350700002)(6486002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: W/bG23VMqS4raFLFF0POdak/KhfEv5VX30ge6L7Ifo0U0+YxeQeVpRafRAZSkjpdxfAcN0CPwOWN5JkW9TVBMW75RYkMMd/Lwoag9aiMlKk9+yKFxlfkarI5G8/lr1sWBTuD5melNk5hJq6qk8MYemZYoUu+mjfpHSGl78rlT4Kp91OtDcRut+hkm9Vjvw8Z86sB7bORTnLU9pvV4c5JXfE1ultpiEP6+/+I6tM7mXFR6ZzTNlj5wRfxS+NG6Im922XcEUOgIa4/2ll8Qw5BuUe7GN07HmuhtiNBF+ia8mVQX+04D9lMV/0iFgG7/JB09qtzs9kokw4l6l0x/D4TQ3BYnUtGZxlaHfhQMmNMvsZuN3y1KvzkrTtMXYdFrpvILtx6iHDr519csY5zUn43P4ye3jpj7i6c9mADVqIVlJ6sfiUleXvK+e6dE2qUOoAYHJcdGRif33IzMcsqTJ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4V/2BLq5sEw0lz+ny9Yx3rbCnHTNAwCRzacFKQK38NqOF0= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 075b4988-f553-427a-8ca6-08dab8fd278e X-MS-Exchange-CrossTenant-AuthSource: HE1PR0401MB2331.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2022 15:57:45.8424 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7UuL1JoszslJGU1mmpajbThQuHuulOEFJYwO2qxXxC1x2ajwFN7mZHmpZ2+mnbrDekwNEKFoVDpAzP+jSKv8yQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8323 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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?1747947762471649491?= X-GMAIL-MSGID: =?utf-8?q?1747947762471649491?= From: Frank Li ntb span entry item size is sizeof(u32). Signed-off-by: Frank Li Acked-by: Manivannan Sadhasivam --- drivers/pci/endpoint/functions/pci-epf-vntb.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c index ee66101cb5c4..54616281da9e 100644 --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c @@ -257,12 +257,12 @@ static void epf_ntb_cmd_handler(struct work_struct *work) ntb = container_of(work, struct epf_ntb, cmd_handler.work); for (i = 1; i < ntb->db_count; i++) { - if (readl(ntb->epf_db + i * 4)) { - if (readl(ntb->epf_db + i * 4)) + if (readl(ntb->epf_db + i * sizeof(u32))) { + if (readl(ntb->epf_db + i * sizeof(u32))) ntb->db |= 1 << (i - 1); ntb_db_event(&ntb->ntb, i); - writel(0, ntb->epf_db + i * 4); + writel(0, ntb->epf_db + i * sizeof(u32)); } } @@ -433,7 +433,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb) spad_count = ntb->spad_count; ctrl_size = sizeof(struct epf_ntb_ctrl); - spad_size = 2 * spad_count * 4; + spad_size = 2 * spad_count * sizeof(u32); if (!align) { ctrl_size = roundup_pow_of_two(ctrl_size); @@ -463,7 +463,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb) ctrl->num_mws = ntb->num_mws; ntb->spad_size = spad_size; - ctrl->db_entry_size = 4; + ctrl->db_entry_size = sizeof(u32); for (i = 0; i < ntb->db_count; i++) { ntb->reg->db_data[i] = 1 + i; @@ -535,7 +535,7 @@ static int epf_ntb_db_bar_init(struct epf_ntb *ntb) struct pci_epf_bar *epf_bar; void __iomem *mw_addr; enum pci_barno barno; - size_t size = 4 * ntb->db_count; + size_t size = sizeof(u32) * ntb->db_count; epc_features = pci_epc_get_features(ntb->epf->epc, ntb->epf->func_no, @@ -1121,11 +1121,11 @@ static int vntb_epf_link_enable(struct ntb_dev *ntb, static u32 vntb_epf_spad_read(struct ntb_dev *ndev, int idx) { struct epf_ntb *ntb = ntb_ndev(ndev); - int off = ntb->reg->spad_offset, ct = ntb->reg->spad_count * 4; + int off = ntb->reg->spad_offset, ct = ntb->reg->spad_count * sizeof(u32); u32 val; void __iomem *base = ntb->reg; - val = readl(base + off + ct + idx * 4); + val = readl(base + off + ct + idx * sizeof(u32)); return val; } @@ -1133,10 +1133,10 @@ static int vntb_epf_spad_write(struct ntb_dev *ndev, int idx, u32 val) { struct epf_ntb *ntb = ntb_ndev(ndev); struct epf_ntb_ctrl *ctrl = ntb->reg; - int off = ctrl->spad_offset, ct = ctrl->spad_count * 4; + int off = ctrl->spad_offset, ct = ctrl->spad_count * sizeof(u32); void __iomem *base = ntb->reg; - writel(val, base + off + ct + idx * 4); + writel(val, base + off + ct + idx * sizeof(u32)); return 0; } @@ -1148,7 +1148,7 @@ static u32 vntb_epf_peer_spad_read(struct ntb_dev *ndev, int pidx, int idx) void __iomem *base = ntb->reg; u32 val; - val = readl(base + off + idx * 4); + val = readl(base + off + idx * sizeof(u32)); return val; } @@ -1159,7 +1159,7 @@ static int vntb_epf_peer_spad_write(struct ntb_dev *ndev, int pidx, int idx, u32 int off = ctrl->spad_offset; void __iomem *base = ntb->reg; - writel(val, base + off + idx * 4); + writel(val, base + off + idx * sizeof(u32)); return 0; }