Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2412566ybm; Thu, 23 May 2019 16:58:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhBMfT3Eukwzxfr84zcimWjhFFtrJluSLJtEfNOqBQfBAeU9SlLSRqo2i9zQjSS8dvk6gm X-Received: by 2002:a62:ae05:: with SMTP id q5mr106322375pff.13.1558655929347; Thu, 23 May 2019 16:58:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558655929; cv=none; d=google.com; s=arc-20160816; b=Ygk1N6oAIwCvKPtWvK0p2mawvoZJD+AUQQ25n0Sl6MCkNMucVMEx7JSkBIR4xYOwpj 9kMHu5E6xuPd+wmSkOWZzm0Asi/Cfit4cGsS8b4KCVlvTWWEHwrVXavOrq6RRj2lw3NQ Prm+otPaOxFAR3hc9UxkvkbIseuplCJn8ao0+pF/50UizS9/ZBEQsDW9YMpfWul7gQRB etuK+MezQLQgKye8SjobcnEOBELJW8D2VS/ZbRt70NuPOrUbHXb6bnF8YwjqVZC67Ym0 IQV0SyGOAJ2ukmg5W1AzBTg910fkHIwd7s61+knNW5kPmKGnfA2Bn9m3VU6H3wHZTRmB r2uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Rwcv7ftRka+X8HiYdZS3z2oKZ4APHYrkaB4F2nbQq/A=; b=BCrlOz4mDgTJ1pDvMzo8UpUU775IvRiqYJQWN9Ay8qz5PgCY9negr07Gz8pyHr5+r3 /PNGwQ9v0s73VPdTC+PirhNIL7DKvaDLT5tj/ao6sOW8fwQRCBk9S8iuWsW3My1acMDv aP6Jh2/OyKSYuqbRLBs9imw8su1SvI3UhK0Ihb/cdO/3hh8tmyJIQM6768uXhJBPIVQR SOr1dm4eAEp/rY8LjTUHJJu5q5vxE9nZxOspuHUa4ZVUW+hAa8yxcwtT8jNm33pdu2o3 j8Bia0RlB9wqAOrqLGgCHHmJ2DKt2NxGQWcr1NzCB9/pmfP33axJJjMzUhgs0MVG69QL c4Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=AnLJrehX; 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 c6si1730526pfc.235.2019.05.23.16.58.29; Thu, 23 May 2019 16:58:49 -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=@sifive.com header.s=google header.b=AnLJrehX; 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 S2388694AbfEWX4X (ORCPT + 99 others); Thu, 23 May 2019 19:56:23 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:37445 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388232AbfEWX4T (ORCPT ); Thu, 23 May 2019 19:56:19 -0400 Received: by mail-lj1-f196.google.com with SMTP id h19so1587985ljj.4 for ; Thu, 23 May 2019 16:56:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=Rwcv7ftRka+X8HiYdZS3z2oKZ4APHYrkaB4F2nbQq/A=; b=AnLJrehX/9SKzLuWRrRIqP+/yUIsQFZcIiCHKFCoKVjJLszzRW631gMNPPgRA8tOP1 wrqfXWhHRRoqYvBwzWiiheJDTGkKdbcNN+ngCaynpJWye/aRivH1AzTDYkZsRNUu7XfN Hzogg9u4Z5W+AR7yKg7u5qHSEeRnmQkCh0b3VhGWXUmBZ+yBgXFGWM1CQrCPUYaKuyHT dGVRDU156ornBXx5rdkou5+WPU/hu7WGJdKQ1X81ezANzfm5ub1f9DQNvAR0T+WQUqB4 8w9RzQRnOTfbvcIe+5gkLnKMB7IZcjZ1IAmhe3nznq8L+Sfaz0nuOiW1V0H+zHcEx/UE OWkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=Rwcv7ftRka+X8HiYdZS3z2oKZ4APHYrkaB4F2nbQq/A=; b=TTnP1llhhNJg1VCmLK4F3nJpuoj2I4DV727Hy4HhlVBfy4pUwbCJ63Z2waMz0wrSo6 0nHL7oHYGm2vatfvQev4kgyHNGg6ItXW+Dey2NPe3qh/tQSg1GGBRLcEDMIWm1h5n6o6 y6VnllP8oqTlZLJ5nB7pq1O0ECwJM2tNu+RdOwhTWtfWzf7UeQUN8PhL1uSylAf9gKRp 24NY4+IojnYg8v4+Ql+Mv8fgGiuTfZZAuNQGO9wTVAVh+aGgJSUWOlPGlavUYYJlJBG5 n+OhFbNO/0FvkU+9UvuZ0qjY7zOgqjFuI5p6pmLDJCdsWD52WUM3/l0waage8QguIY2p SzbA== X-Gm-Message-State: APjAAAVyq+OROKiJBJ/To97I9pKyZcQBrn1fggArmOpV0Z8utpPSnP8J QEVMcRvKdYwb6n08ndCiH2fpitsajioDp0PzHfJD5g== X-Received: by 2002:a2e:655b:: with SMTP id z88mr46764454ljb.108.1558655777580; Thu, 23 May 2019 16:56:17 -0700 (PDT) MIME-Version: 1.0 References: <1558648079-13893-1-git-send-email-alan.mikhak@sifive.com> In-Reply-To: <1558648079-13893-1-git-send-email-alan.mikhak@sifive.com> From: Alan Mikhak Date: Thu, 23 May 2019 16:56:06 -0700 Message-ID: Subject: Re: [PATCH v2] PCI: endpoint: Allocate enough space for fixed size BAR To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, kishon@ti.com, lorenzo.pieralisi@arm.com, linux-riscv@lists.infradead.org, Palmer Dabbelt , Paul Walmsley , Bjorn Helgaas , gustavo.pimentel@synopsys.com, wen.yang99@zte.com.cn, kjlu@umn.edu Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +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 > --- > 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 >