Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1361822pxb; Fri, 21 Jan 2022 16:32:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzu8KODAyM1KBj/3eExI4cjn/NZq0dc4YGlHXmTIry6VD79AX0EK0YF0dq0vZfv+IwvNNm9 X-Received: by 2002:a17:902:f545:b0:14b:18f:9389 with SMTP id h5-20020a170902f54500b0014b018f9389mr6014303plf.25.1642811527004; Fri, 21 Jan 2022 16:32:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1642811526; cv=pass; d=google.com; s=arc-20160816; b=e8tRMNB3emYci3CSQF90mw6jhAtquoIALpdhVKUPpW32sk2YxfU0BewzOT5fQGHam4 jQTdznyWi2Czfs0+J+gCOfE5sxGIQQ1EjYvyivSWhYmtkT8Wp/OgZamp4FO71p4WouNB ediwMdst2VD0lW6nR1l0Oltu6AE6Z2JdMHOsjkPCPZDB6BVkeJattvslcZjRTYRnw2Vw cBezHyOgxFrdjU6EDdhnD4uvDbnMV7vyCqWOXf/1YbanTuC+hq08EJyy8deOMDGYmH2r qPtnYbkygZVU29Du0DUZLpj4O1+lYvL6NURqY14ccrNWggBGmcsHeiY94R6D8uYzAwUM AQTA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:importance:content-transfer-encoding :mime-version:subject:in-reply-to:message-id:cc:to:from:date :dkim-signature; bh=6OqN5KFL3TzRtCH3fbY7QtTlkqaTO04W2B0TqAkZ6Pg=; b=zzFptnClYPyMcRc4TXSrQand1M+ifI9mEUJthHt6La9vsc+iHs+4uEEHxm/ms5asJE QbxGZjUwuXNDHDS7RvdsGX9vzBFn6XsCdHuw7zayAQIF/XfGdSeF1iyfNQpk07FMK6kP l275Y7oz6/VgVwkyoqZUoMyeh+w/iGupce5KHCcCe4KTgPxBqgFHKs0lGhEZBhjvnIGF 145EFEWI1YdYTNSdSFBozlybTWyRkDcaPL1w9DNKWlwOmrgq80699Yp95E7gT3fTM9dg e87U9+yIz2Txg2hAi3gI+/mhG+u2ckZZBe3vqrPquWt7zIVsughSV9k2dBVpITwr0ymJ R4MQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zohomail.com header.s=zm2020 header.b=P8UbR6Vd; arc=pass (i=1 spf=pass spfdomain=zohomail.com dkim=pass dkdomain=zohomail.com dmarc=pass fromdomain=zohomail.com>); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=zohomail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c5si8131498plg.443.2022.01.21.16.31.54; Fri, 21 Jan 2022 16:32:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@zohomail.com header.s=zm2020 header.b=P8UbR6Vd; arc=pass (i=1 spf=pass spfdomain=zohomail.com dkim=pass dkdomain=zohomail.com dmarc=pass fromdomain=zohomail.com>); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=zohomail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234043AbiAUENF (ORCPT + 99 others); Thu, 20 Jan 2022 23:13:05 -0500 Received: from sender4-pp-o95.zoho.com ([136.143.188.95]:25595 "EHLO sender4-pp-o95.zoho.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233558AbiAUENE (ORCPT ); Thu, 20 Jan 2022 23:13:04 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1642738378; cv=none; d=zohomail.com; s=zohoarc; b=Xe7I4/F5q1pXlFL1rhmzWFPv/ozwn99MqZpMCvCsah6sieW+5MvoEAzvaNiDl6k7sCsC0Hz9iNt9n0kb3ExrHC5OgsaGlEFyQlHPjwYoTgdp/wN7wq6pZW6FbA8+RoSmL8ef5q0I6wXCL8gSEqWOKoNFEm32sdzExSu2s7Emc/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642738378; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=6OqN5KFL3TzRtCH3fbY7QtTlkqaTO04W2B0TqAkZ6Pg=; b=UpfwIdV1rWzn8q6goAcWWQrfnpZ6RL/cXHzdHHzsI2Q5J45NbLfLc8TaJgPlm8Qrgs/1WwBCCsa4kHj3SoHIV3OO27XyhkgngSywIKM8FiYlXDOneCecSxB/r5JfhPHFuSHJ+wQ5Q9MCz/50EEFEiZ5Ug5We6twBe0Lv1bQWz3w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=zohomail.com; spf=pass smtp.mailfrom=lchen.firstlove@zohomail.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1642738378; s=zm2020; d=zohomail.com; i=lchen.firstlove@zohomail.com; h=Date:From:To:Cc:Message-ID:In-Reply-To:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=6OqN5KFL3TzRtCH3fbY7QtTlkqaTO04W2B0TqAkZ6Pg=; b=P8UbR6VdnFgqss5emjwEaYWQGOBbwXW6CLObUR1h6X+az1sHTEnKanLrzhEcmgfS Q0qlBcOC0VoaUId1wc39hmBLpIt1uuUDQM8fWf9IHtfAjA9AKJvSag7RJ2n85dyLZUt NtBOJrTwrmpXtNGnh9awwZcWC648cO9yxDe9tEnk= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1642738376718895.9144931596065; Thu, 20 Jan 2022 20:12:56 -0800 (PST) Received: from [203.218.243.128] by mail.zoho.com with HTTP;Thu, 20 Jan 2022 20:12:56 -0800 (PST) Date: Fri, 21 Jan 2022 12:12:56 +0800 From: Li Chen To: "Bjorn Helgaas" Cc: "Kishon Vijay Abraham I" , "Lorenzo Pieralisi" , "Bjorn Helgaas" , "linux-pci" , "linux-kernel" Message-ID: <17e7ad65ff5.d9de88b4962.1109678039880040918@zohomail.com> In-Reply-To: Subject: [PATCH v4] PCI: endpoint: Add prefetch BAR support MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Li Chen Before this commit, epf cannot set BAR to be prefetchable. Prefetchable BAR can also help epf device to use bridge's prefetch memory window. Signed-off-by: Li Chen --- Changes in v2: Remove Gerrit Change-id Changes in v3: capitalize "BAR" in the subject and commit log as suggested by Bjorn. Changes in v4: This patch context doesn't change but resend with my Zoho mail account in that previous company mail will contain un-removeable proprietary messages. Add "From:" to the first line of the message body. drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++++ include/linux/pci-epc.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index 90d84d3bc868..96489cfdf58d 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -817,15 +817,19 @@ static void pci_epf_configure_bar(struct pci_epf *epf, { struct pci_epf_bar *epf_bar; bool bar_fixed_64bit; + bool bar_prefetch; int i; for (i = 0; i < PCI_STD_NUM_BARS; i++) { epf_bar = &epf->bar[i]; bar_fixed_64bit = !!(epc_features->bar_fixed_64bit & (1 << i)); + bar_prefetch = !!(epc_features->bar_prefetch & (1 << i)); if (bar_fixed_64bit) epf_bar->flags |= PCI_BASE_ADDRESS_MEM_TYPE_64; if (epc_features->bar_fixed_size[i]) bar_size[i] = epc_features->bar_fixed_size[i]; + if (bar_prefetch) + epf_bar->flags |= PCI_BASE_ADDRESS_MEM_PREFETCH; } } diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h index a48778e1a4ee..825632d581d0 100644 --- a/include/linux/pci-epc.h +++ b/include/linux/pci-epc.h @@ -161,6 +161,7 @@ struct pci_epc { * @msix_capable: indicate if the endpoint function has MSI-X capability * @reserved_bar: bitmap to indicate reserved BAR unavailable to function driver * @bar_fixed_64bit: bitmap to indicate fixed 64bit BARs + * @bar_prefetch: bitmap to indicate prefetchable BARs * @bar_fixed_size: Array specifying the size supported by each BAR * @align: alignment size required for BAR buffer allocation */ @@ -171,6 +172,7 @@ struct pci_epc_features { unsigned int msix_capable : 1; u8 reserved_bar; u8 bar_fixed_64bit; + u8 bar_prefetch; u64 bar_fixed_size[PCI_STD_NUM_BARS]; size_t align; }; -- 2.34.1