Received: by 10.192.165.156 with SMTP id m28csp109599imm; Wed, 18 Apr 2018 18:19:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/wyq2ZejjEuXW2FTbCSmc3BqdFvQUZatzpAxJf1vrzaleP/CBtPK101goRBYmb+B0YhEZx X-Received: by 2002:a17:902:7042:: with SMTP id h2-v6mr4148872plt.249.1524100793585; Wed, 18 Apr 2018 18:19:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524100793; cv=none; d=google.com; s=arc-20160816; b=lue8W90yB3T+jUHE5v4iwBnU4xpAtb/Lu05G1ysu7jbHdYH8GXhdkEku0j7hXWPIh+ d/VMMu9Zq9L3wv2+9o/OsCFKDeLOEadNS3tN/ggdWlq6SciOysS6BadJ7qQt55Iobvpo jxvqx9JKolMkMhrVafX6zG85F5enZvk7lPuExGdLhyYeKbbtZgIf1AoGxTmv4z47LZz+ fgUaQZyjN3VpZQxj92r/As/zLbUo21XUBQzQrqfpB8JHkkBLGSGxamjkzeGWLipoB1Gw IP+yiCm/GiWvEZyPxSFDLdoHByOQC6vzTSOhuxjudm2yRMBSHjIarywIDAl+c6AYcrDB 3yaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=b8LbAKUm5HtnKq+2stViDARJq3aCfq9PqiaRkihHxvk=; b=FORIIVznpmtij8veOPdZf1jLofF+P1Ve4ZNUjKC9sdT5K7cw98SgqP3UozBhnu2cLt QVugmF4Lz51lHy/OOnTiLD+Tfz8Wyd/ZSs/V+jdg3wliZfcJm1pivmTDzlOCnTbSdHY8 giQGB2LoIik/7rIqj4UkZUHLMIATGUOKbz28joRHf+fgFSkWQYJrBgu3OQMHHrdzGjM0 JpCXFsRB02rfJ/Yr9KR5YhlbEL1vJXVaOFmbQnqSDU0O7J5Xw/qtF7PBDyqopNOEBjKh Ca2UfbuX1CWIp/h4dnulR/yHhEg3ELYhHPIqfleAy0gTHMxh/s+TVoSOkv4jKM2mm1cv jZYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s1si2125437pfm.62.2018.04.18.18.19.39; Wed, 18 Apr 2018 18:19:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752903AbeDSBSJ (ORCPT + 99 others); Wed, 18 Apr 2018 21:18:09 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:48783 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752392AbeDSBSI (ORCPT ); Wed, 18 Apr 2018 21:18:08 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 10AE4454740CD; Thu, 19 Apr 2018 09:18:05 +0800 (CST) Received: from [127.0.0.1] (10.177.29.40) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.361.1; Thu, 19 Apr 2018 09:17:58 +0800 Subject: Re: [PATCH 2/2] perf: add arm64 smmuv3 pmu driver To: Shameerali Kolothum Thodi , "Neil Leeder" , Will Deacon , "Mark Rutland" References: <1501876754-1064-1-git-send-email-nleeder@codeaurora.org> <1501876754-1064-3-git-send-email-nleeder@codeaurora.org> <883d32ce-6581-ecf6-5088-ecb238322ebe@huawei.com> <5FC3163CFD30C246ABAA99954A238FA83868C029@FRAEML521-MBX.china.huawei.com> CC: Mark Langsdorf , Jon Masters , "Timur Tabi" , "linux-kernel@vger.kernel.org" , Mark Brown , Mark Salter , "linux-arm-kernel@lists.infradead.org" From: Yisheng Xie Message-ID: <70d0c34c-853d-547b-49cb-4b70a85c4da4@huawei.com> Date: Thu, 19 Apr 2018 09:17:48 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <5FC3163CFD30C246ABAA99954A238FA83868C029@FRAEML521-MBX.china.huawei.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.40] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Shameerali, On 2018/4/18 19:05, Shameerali Kolothum Thodi wrote: > > >> -----Original Message----- >> From: linux-arm-kernel [mailto:linux-arm-kernel-bounces@lists.infradead.org] >> On Behalf Of Yisheng Xie >> Sent: Thursday, March 29, 2018 8:04 AM >> To: Neil Leeder ; Will Deacon >> ; Mark Rutland >> Cc: Mark Langsdorf ; Jon Masters >> ; Timur Tabi ; linux- >> kernel@vger.kernel.org; Mark Brown ; Mark Salter >> ; linux-arm-kernel@lists.infradead.org >> Subject: Re: [PATCH 2/2] perf: add arm64 smmuv3 pmu driver >> >> Hi Neil, >> >> On 2017/8/5 3:59, Neil Leeder wrote: >>> + mem_resource_0 = platform_get_resource(pdev, IORESOURCE_MEM, >> 0); >>> + mem_map_0 = devm_ioremap_resource(&pdev->dev, >> mem_resource_0); >>> + >> Can we use devm_ioremap instead? for the reg_base of smmu_pmu is >> IMPLEMENTATION DEFINED. If the reg of smmu_pmu is inside smmu, >> devm_ioremap_resource will failed and return -EBUSY, eg.: >> >> smmu reg ranges: 0x180000000 ~ 0x1801fffff >> its smmu_pmu reg ranges: 0x180001000 ~ 0x180001fff > > I think this will not solve the issue completely as the smmu v3 driver > uses devm_ioremap_resource() currently and that will fail because of > the overlap. Right, I get your point. > > Please find the discussion here: > https://lkml.org/lkml/2018/1/31/235 Thanks for the infomation. Thanks Yisheng > > Thanks, > Shameer > >>> + if (IS_ERR(mem_map_0)) { >>> + dev_err(&pdev->dev, "Can't map SMMU PMU @%pa\n", >>> + &mem_resource_0->start); >>> + return PTR_ERR(mem_map_0); >>> + } >>> + >>> + smmu_pmu->reg_base = mem_map_0; >>> + smmu_pmu->pmu.name = >>> + devm_kasprintf(&pdev->dev, GFP_KERNEL, "smmu_0_%llx", >>> + (mem_resource_0->start) >> SMMU_PA_SHIFT); >>> + >>> + if (!smmu_pmu->pmu.name) { >>> + dev_err(&pdev->dev, "Failed to create PMU name"); >>> + return -EINVAL; >>> + } >>> + >>> + ceid_64 = readq(smmu_pmu->reg_base + SMMU_PMCG_CEID0); >>> + ceid[0] = ceid_64 & GENMASK(31, 0); >>> + ceid[1] = ceid_64 >> 32; >>> + ceid_64 = readq(smmu_pmu->reg_base + SMMU_PMCG_CEID1); >>> + ceid[2] = ceid_64 & GENMASK(31, 0); >>> + ceid[3] = ceid_64 >> 32; >>> + bitmap_from_u32array(smmu_pmu->supported_events, >> SMMU_MAX_EVENT_ID, >>> + ceid, SMMU_NUM_EVENTS_U32); >>> + >>> + /* Determine if page 1 is present */ >>> + if (readl(smmu_pmu->reg_base + SMMU_PMCG_CFGR) & >>> + SMMU_PMCG_CFGR_RELOC_CTRS) { >>> + mem_resource_1 = platform_get_resource(pdev, >> IORESOURCE_MEM, 1); >>> + mem_map_1 = devm_ioremap_resource(&pdev->dev, >> mem_resource_1); >>> + >> The same as above. >> >> Thanks >> Yisheng >> >>> + if (IS_ERR(mem_map_1)) { >>> + dev_err(&pdev->dev, "Can't map SMMU PMU >> @%pa\n", >>> + &mem_resource_1->start); >>> + return PTR_ERR(mem_map_1); >>> + } >>> + smmu_pmu->reloc_base = mem_map_1; >>> + } else { >>> + smmu_pmu->reloc_base = smmu_pmu->reg_base; >>> + } >>> + >>> + irq = platform_get_irq(pdev, 0); >>> + if (irq < 0) { >>> + dev_err(&pdev->dev, >>> + "Failed to get valid irq for smmu @%pa\n", >>> + &mem_resource_0->start); >>> + return irq; >>> + } >> >> >> _______________________________________________ >> linux-arm-kernel mailing list >> linux-arm-kernel@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > > . >