Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp833217imm; Wed, 20 Jun 2018 07:21:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIlGGo7HcbiZAbPpk/8zLyEaKMD9AYj6KG9nfz0YersgfdhfcyRilOA+GOkTtFWiu2TJbj8 X-Received: by 2002:a62:9bc9:: with SMTP id e70-v6mr22789619pfk.15.1529504491482; Wed, 20 Jun 2018 07:21:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529504491; cv=none; d=google.com; s=arc-20160816; b=gCqMZIaa3Q1P88Qj5Natn+X85yQZ4lsJ9xENeqscpv4gKJzR1slSKgD37eTfWB1Wrm z5lzVCl/QquyNGESdAWf5MTwHOJWT460+2I3LU5HzRr3r19NubFW9Iq4c8y+0ZaoKJdo /2s90w5WFfhqnqyLiNhR2cMDiYYCkHw2HOh0L6HDYtNUTBOiuyVfnxbVGRPCzy0Pj/fg hmwJRJyw89BNnpqbCQqQDJLr3OHFcIRZql4MyPOLcooWdt4RMPJhjg30lZCm6ngBjU4V 4gNu3rgVAwXHYG31+IW9l7gS+S8ZrJUxzqyk3TCZMPl0plHV8HD4rmfbsxH/JE6S6SKq FKsg== 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:cc:to:subject:dkim-signature :arc-authentication-results; bh=rjF/E1Idxhj6FXhLI9lP/woEriwzizD3GVlSLuWJ2sg=; b=n4cl5o0le4lvFvXNojiMcItfu9Ph+RiFTHUnCW+GfVc+rG2Pj5H40ihw04HFJ01nW/ yocpNv4qDDv36tOWbDUlQIgzWwUsh6tQMl+ILt4TMNcdQtDKYYrN9tUVJ5cuES47g8JL yC21Xk5pN9PuiCnVZEmn5gjy5A0eBh5eB8Nk7JjEYOpizaqGAlnZVC+Iw7ASiBxlosva e2VCC72boqwveUirUXogFBhq3Lw2bnaAAHfZebGfnxW7o/uLR1Jf86fxVk6PhLLuB+Rn z8t3VOR5IkWZpkYh9hOjZDsZ0JJFdVg6PLPr+5pWTcC5YlXELk+x8Ke07Jrc94Tptxgs Ee7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=eMOSZdKn; 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=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10-v6si2364706plg.396.2018.06.20.07.21.17; Wed, 20 Jun 2018 07:21:31 -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=@synopsys.com header.s=mail header.b=eMOSZdKn; 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=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753987AbeFTOUh (ORCPT + 99 others); Wed, 20 Jun 2018 10:20:37 -0400 Received: from smtprelay.synopsys.com ([198.182.37.59]:51957 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752798AbeFTOUf (ORCPT ); Wed, 20 Jun 2018 10:20:35 -0400 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 1DBB11E04FD; Wed, 20 Jun 2018 16:20:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1529504433; bh=fs43v7WGQtmUtL/O6havRfWJnbRF5h6W1zD3/xa7NJs=; h=Subject:To:CC:References:From:Date:In-Reply-To:From; b=eMOSZdKnh7WrDgya6Hzo89rXgnQQy1MF+fVpkWEPWFPhsljr1GWwZiISDVgMuUkDk VARbu/StWa8n2zZbevUraySi9G2Un7/1/Ex2P0t549m6p49xLNmYX/ZW3m4wN4B9cL eUl4u6ERHJBvrrZh9/L869PKLQ5rmA/nxAwKv4ZPJXKo6EDPxblV7qaAijjjDo1yzj eGu4AUEIhO4VntgtUQusnfsNkFjGKHTclugv1QcgeM4XmabNXffYT6lLucz99u0cbD +r4VFoqk7vhZhcHsJwI/SGtEScsKkw1nzsJ2hGPzUZpmUmbJFtadn0ZnFoHTVd2DBB 0Tr4BUjpe2zmw== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id 34D8D3FA0; Wed, 20 Jun 2018 07:20:32 -0700 (PDT) Received: from DE02WEHTCA.internal.synopsys.com (10.225.19.92) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 20 Jun 2018 07:20:31 -0700 Received: from DE02WEHTCB.internal.synopsys.com (10.225.19.94) by DE02WEHTCA.internal.synopsys.com (10.225.19.92) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 20 Jun 2018 16:20:28 +0200 Received: from [10.107.25.102] (10.107.25.102) by DE02WEHTCB.internal.synopsys.com (10.225.19.80) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 20 Jun 2018 16:20:28 +0200 Subject: Re: [PATCH v4 06/10] pci-epf-test/pci_endpoint_test: Cleanup PCI_ENDPOINT_TEST memspace To: Kishon Vijay Abraham I , Gustavo Pimentel , "bhelgaas@google.com" , "lorenzo.pieralisi@arm.com" , "Joao.Pinto@synopsys.com" , "jingoohan1@gmail.com" , "adouglas@cadence.com" , "jesper.nilsson@axis.com" CC: "linux-pci@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <13077810f3630c01835041e41b338dd85fa91953.1529329262.git.gustavo.pimentel@synopsys.com> From: Gustavo Pimentel Message-ID: <83b41df3-22eb-e4ba-4b45-840c23051f1d@synopsys.com> Date: Wed, 20 Jun 2018 15:18:27 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.107.25.102] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 20/06/2018 08:53, Kishon Vijay Abraham I wrote: > Hi, > > On Monday 18 June 2018 08:30 PM, Gustavo Pimentel wrote: >> Cleanup PCI_ENDPOINT_TEST memspace (by moving the interrupt number away >> from command section). >> >> Signed-off-by: Gustavo Pimentel >> --- >> Change v2->v3: >> - New patch file created base on the previous patch >> "misc: pci_endpoint_test: Add MSI-X support" patch file following >> Kishon's suggestion. >> Change v3->v4: >> - Rebased to Lorenzo's master branch v4.18-rc1. >> >> drivers/misc/pci_endpoint_test.c | 84 ++++++++++++++++----------- >> drivers/pci/endpoint/functions/pci-epf-test.c | 60 ++++++++++++------- >> 2 files changed, 91 insertions(+), 53 deletions(-) >> >> diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c >> index 7b37046..56be808 100644 >> --- a/drivers/misc/pci_endpoint_test.c >> +++ b/drivers/misc/pci_endpoint_test.c >> @@ -35,38 +35,42 @@ >> >> #include >> >> -#define DRV_MODULE_NAME "pci-endpoint-test" >> - >> -#define PCI_ENDPOINT_TEST_MAGIC 0x0 >> - >> -#define PCI_ENDPOINT_TEST_COMMAND 0x4 >> -#define COMMAND_RAISE_LEGACY_IRQ BIT(0) >> -#define COMMAND_RAISE_MSI_IRQ BIT(1) >> -#define MSI_NUMBER_SHIFT 2 >> -/* 6 bits for MSI number */ >> -#define COMMAND_READ BIT(8) >> -#define COMMAND_WRITE BIT(9) >> -#define COMMAND_COPY BIT(10) >> - >> -#define PCI_ENDPOINT_TEST_STATUS 0x8 >> -#define STATUS_READ_SUCCESS BIT(0) >> -#define STATUS_READ_FAIL BIT(1) >> -#define STATUS_WRITE_SUCCESS BIT(2) >> -#define STATUS_WRITE_FAIL BIT(3) >> -#define STATUS_COPY_SUCCESS BIT(4) >> -#define STATUS_COPY_FAIL BIT(5) >> -#define STATUS_IRQ_RAISED BIT(6) >> -#define STATUS_SRC_ADDR_INVALID BIT(7) >> -#define STATUS_DST_ADDR_INVALID BIT(8) >> - >> -#define PCI_ENDPOINT_TEST_LOWER_SRC_ADDR 0xc >> +#define DRV_MODULE_NAME "pci-endpoint-test" >> + >> +#define IRQ_TYPE_LEGACY 0 >> +#define IRQ_TYPE_MSI 1 >> + >> +#define PCI_ENDPOINT_TEST_MAGIC 0x0 >> + >> +#define PCI_ENDPOINT_TEST_COMMAND 0x4 >> +#define COMMAND_RAISE_LEGACY_IRQ BIT(0) >> +#define COMMAND_RAISE_MSI_IRQ BIT(1) > > Maybe you can add a comment here that BIT(2) is reserved for MSIX support Sure. >> +#define COMMAND_READ BIT(3) >> +#define COMMAND_WRITE BIT(4) >> +#define COMMAND_COPY BIT(5) >> + >> +#define PCI_ENDPOINT_TEST_STATUS 0x8 >> +#define STATUS_READ_SUCCESS BIT(0) >> +#define STATUS_READ_FAIL BIT(1) >> +#define STATUS_WRITE_SUCCESS BIT(2) >> +#define STATUS_WRITE_FAIL BIT(3) >> +#define STATUS_COPY_SUCCESS BIT(4) >> +#define STATUS_COPY_FAIL BIT(5) >> +#define STATUS_IRQ_RAISED BIT(6) >> +#define STATUS_SRC_ADDR_INVALID BIT(7) >> +#define STATUS_DST_ADDR_INVALID BIT(8) >> + >> +#define PCI_ENDPOINT_TEST_LOWER_SRC_ADDR 0x0c >> #define PCI_ENDPOINT_TEST_UPPER_SRC_ADDR 0x10 >> >> #define PCI_ENDPOINT_TEST_LOWER_DST_ADDR 0x14 >> #define PCI_ENDPOINT_TEST_UPPER_DST_ADDR 0x18 >> >> -#define PCI_ENDPOINT_TEST_SIZE 0x1c >> -#define PCI_ENDPOINT_TEST_CHECKSUM 0x20 >> +#define PCI_ENDPOINT_TEST_SIZE 0x1c >> +#define PCI_ENDPOINT_TEST_CHECKSUM 0x20 >> + >> +#define PCI_ENDPOINT_TEST_IRQ_TYPE 0x24 > > Is this not redundant? COMMAND_RAISE_LEGACY_IRQ, COMMAND_RAISE_MSI_IRQ already > indicates the irq type to be used. In previous implementation the distinction between interrupt types was simpler, basically legacy *number* always set as zero and the MSI *number* always non-zero. However by introducing the MSI-X this simple mechanism is no longer valid, because the MSI-X *number* is also always non-zero like as MSI. Therefore is necessary to distinguish which interrupt type was been triggered (MSI or MSI-X) especially for the Write/Read/Copy tests. >> +#define PCI_ENDPOINT_TEST_IRQ_NUMBER 0x28 >> >> static DEFINE_IDA(pci_endpoint_test_ida); >> >> @@ -179,6 +183,9 @@ static bool pci_endpoint_test_legacy_irq(struct pci_endpoint_test *test) >> { >> u32 val; >> >> + pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, >> + IRQ_TYPE_LEGACY); >> + pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 0); > > Not sure if the above writes are really required. Is not required, but I added those write for keeping the code coherency between pci_endpoint_test_legacy_irq() and pci_endpoint_test_msi_irq(), basically both functions write on the same registers. I think it doesn't cause any harm. >> pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, >> COMMAND_RAISE_LEGACY_IRQ); >> val = wait_for_completion_timeout(&test->irq_raised, >> @@ -190,20 +197,22 @@ static bool pci_endpoint_test_legacy_irq(struct pci_endpoint_test *test) >> } >> >> static bool pci_endpoint_test_msi_irq(struct pci_endpoint_test *test, >> - u8 msi_num) >> + u8 irq_num) > > why do you want to rename this? Initially this patch file contained the changes related to MSI-X support and by that time I had changed the name of this variable so that its name had a broader meaning that contemplated these two types. Now that I see this, I think the original name may also be valid, I will revert this name change. Regards, Gustavo > > Thanks > Kishon >