Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp164985ybi; Fri, 24 May 2019 01:49:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFeye9hWQVfFA2Lt9AMrNyfhiSRMWuV3yupWiq4kwGHaNrV3k4tvQkGcB/99j1SNnGdzhy X-Received: by 2002:aa7:9563:: with SMTP id x3mr28020019pfq.118.1558687759907; Fri, 24 May 2019 01:49:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558687759; cv=none; d=google.com; s=arc-20160816; b=eTzhW5CnZpb5wrKizJ1P7KsfdqRUwAkjHOVZBZv2iqUI9G9VYNzzrooefZA2ct/AwS rzAehHwuZSmKZZKT0xfyW07NNYJ4JMUZe/kw6JT5MgiPQ9EBGQ3PlkSGXlJvSIWDARLN FDRN6Xx6Go1saOY5xjgD/vRq/In+UAjjTL5dtoM/8OtZNlEP8wKaWLY364FXxLr5gdlj LhatQgXukBkv+4pbMZyxfqd1v4mLXQXxy2QV3tVetj0uEp1L7yTbI2gn/I4Cejonvavn r3/TfkRup8URrCAG0c7N8yYb6qkRjUUQzXyp5f/GTsaDVRgciETj/zIMR+4IglEka2Xy iZAA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature; bh=DXFEDPWPKDOFxRB075nEECWtEkWPXsJvcN4FB3Z5q1Y=; b=futew4NQk4mfC2NSZE5sEhQRn8+5cxvyHQ+UcBTA6grpHVTqO/xmhP+KKHlX2NAZI5 ZFA0ykfxYWEZ2rij2cI59zvy+Bx263xzR/7dX5MDUzZ1HazLfnO2mf2WjXXnj6dRKntN vVMM3Tmpn46+eZ/NtRh4dRrsvbkDz9t88HtlYQjYBh9TupTeC1bCuKvYg+RQfEtEg9TT 2Ma8s2P1+1n8vRkr6jZ/DnYplOwahJl8m/p81ukO75f5jJ6NoG+uyVQeBvrLonEYLs+H aW27VJkD69iwBJaXkaR99pKeMnsOMU50obCVH3DAXE7BhOFvLvYFUNxFhHwVRt7pCLMJ S8Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Bfhp6Htr; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16si3010115pgk.431.2019.05.24.01.49.00; Fri, 24 May 2019 01:49:19 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Bfhp6Htr; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389569AbfEXIqR (ORCPT + 99 others); Fri, 24 May 2019 04:46:17 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:47892 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389349AbfEXIqQ (ORCPT ); Fri, 24 May 2019 04:46:16 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x4O8k6S3092885; Fri, 24 May 2019 03:46:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1558687566; bh=DXFEDPWPKDOFxRB075nEECWtEkWPXsJvcN4FB3Z5q1Y=; h=Subject:To:References:From:Date:In-Reply-To; b=Bfhp6HtrbU4jNqmpwALOr7PuPYMbsCKxQAY9SrbT2FRyn33xyzinHbS+fW9MZ9YYx woEVabr2VXFv/C4NiUl2k5nSdN1vJQHlaR/2WZbchu/o3/4R98whqTp16nuMVOj57N rLPDj86zqVw1fiKqm8tqzOgD8n/QDDsr/Gophvi8= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x4O8k6Gj087569 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 24 May 2019 03:46:06 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 24 May 2019 03:46:05 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 24 May 2019 03:46:05 -0500 Received: from [172.24.190.233] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x4O8k1C2076108; Fri, 24 May 2019 03:46:02 -0500 Subject: Re: [PATCH v2] PCI: endpoint: Allocate enough space for fixed size BAR To: Alan Mikhak , , , , , Palmer Dabbelt , Paul Walmsley , Bjorn Helgaas , , , References: <1558648079-13893-1-git-send-email-alan.mikhak@sifive.com> From: Kishon Vijay Abraham I Message-ID: Date: Fri, 24 May 2019 14:14:47 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/05/19 5:26 AM, Alan Mikhak wrote: > +Bjorn Helgaas, +Gustavo Pimentel, +Wen Yang, +Kangjie Lu > > On Thu, May 23, 2019 at 2:48 PM Alan Mikhak wrote: >> >> PCI endpoint test function code should honor the .bar_fixed_size parameter >> from underlying endpoint controller drivers or results may be unexpected. >> >> In pci_epf_test_alloc_space(), check if BAR being used for test register >> space is a fixed size BAR. If so, allocate the required fixed size. >> >> Signed-off-by: Alan Mikhak Acked-by: Kishon Vijay Abraham I >> --- >> drivers/pci/endpoint/functions/pci-epf-test.c | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c >> index 27806987e93b..7d41e6684b87 100644 >> --- a/drivers/pci/endpoint/functions/pci-epf-test.c >> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c >> @@ -434,10 +434,16 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) >> int bar; >> enum pci_barno test_reg_bar = epf_test->test_reg_bar; >> const struct pci_epc_features *epc_features; >> + size_t test_reg_size; >> >> epc_features = epf_test->epc_features; >> >> - base = pci_epf_alloc_space(epf, sizeof(struct pci_epf_test_reg), >> + if (epc_features->bar_fixed_size[test_reg_bar]) >> + test_reg_size = bar_size[test_reg_bar]; >> + else >> + test_reg_size = sizeof(struct pci_epf_test_reg); >> + >> + base = pci_epf_alloc_space(epf, test_reg_size, >> test_reg_bar, epc_features->align); >> if (!base) { >> dev_err(dev, "Failed to allocated register space\n"); >> -- >> 2.7.4 >>