Received: by 10.192.165.148 with SMTP id m20csp4325706imm; Tue, 24 Apr 2018 00:22:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx49bokqezkCPCCn/64npXvaMbxAqhXcCH3PtJXl17yjyMyU7KFryUg8XOBnaDYNyZVe9uZqV X-Received: by 2002:a17:902:70c6:: with SMTP id l6-v6mr23886191plt.201.1524554544743; Tue, 24 Apr 2018 00:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524554544; cv=none; d=google.com; s=arc-20160816; b=xlkQn0KK84E5zNwPhzmbWy89rGl+qH3xHwsu/WKAHfbpQvZbO/xKGye3oSZswiWgSb ZCsHoN1ImZcFCzVY6WT7yhFL6bgCAVTC0HxbUg0olw+G3C5Hsf0iFdmQZ4U2s9bljxbm E68FZ02owmuHOpGDnb0s4OLEUEfI3EYh7V6fbeVyUv0tFpVDZwohdhHuYvQI3KrU1raQ T24I7vzmLOIntALFHEWb3KLEYSk8/w+vkYQua/o8v9PtKARnv4L8JX8w//TtS9oDf3/M KkSSCrQMzYSmkNLQXWxvhJfSJtHkwVqp74h4QsbmDAFCx+9hAvlq9+7YTostE5+HTFUZ EO/A== 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:dkim-signature:arc-authentication-results; bh=aNcFLMCVZ8GF01YBczpJofqMj+QxKEGOKi5yRRc4pBw=; b=qyZ7lTad/tItD13MsSjQNm8znRzet1cqdr5oCBTbxYVdsoLGN2xAiC7xyfLqxgORuI mHuhW3LzYKdT4fzgxsXT6vX8KirjAUBOuRBrse8uHWmTK8baNxr1b90yfW38V7wmM1YL Y+P51GdHCPS4Tnd2nqkX5xgYZvi2Xdq3Cqr4gwnCRPmkLG7MX1VFRat9ltI8aHyL4nJZ MgH+WZwzoPM38jecemcC+o0rqzm7JN3/epGce0nhBdh9bB4/BKx9/JitF/EzMtoqIy4k U2dNdTYeTqKI+m9uKpfDRA3HsKET6ZsHen0sZKHu1ShOAt0Rp7OgCwR9+uSyCHX9p1Ir Qgzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=DzTzpSix; 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 q1-v6si12917254plr.477.2018.04.24.00.22.10; Tue, 24 Apr 2018 00:22:24 -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=DzTzpSix; 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 S1756148AbeDXHTz (ORCPT + 99 others); Tue, 24 Apr 2018 03:19:55 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:51835 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755224AbeDXHTx (ORCPT ); Tue, 24 Apr 2018 03:19:53 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3O7JiMC024153; Tue, 24 Apr 2018 02:19:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524554384; bh=60Vwusjjy/kW9bb78Mb+gnSVud1BiAeHfIkJyggSHME=; h=Subject:To:References:CC:From:Date:In-Reply-To; b=DzTzpSixvaKH6nmkU+TW9M/d7r2BAO7E+V3pf2HiZyMH8HMeS2ovK60bn+7Sg2VrH EOhkmcG0kCQfgdeClZhrlrGQ0RVITwA9qWmYhLpPgxALGkKSgLIguN7PB+hdBrMyzU osvvlNuGASnn/CbTqQ0EyfJW5JMjWDG9ttoY0Ew4= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3O7JhR9008072; Tue, 24 Apr 2018 02:19:43 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 24 Apr 2018 02:19:43 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Tue, 24 Apr 2018 02:19:43 -0500 Received: from [172.24.190.233] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3O7JdMn005677; Tue, 24 Apr 2018 02:19:40 -0500 Subject: Re: [RFC 06/10] misc: pci_endpoint_test: Add MSI-X support To: Gustavo Pimentel , "bhelgaas@google.com" , "lorenzo.pieralisi@arm.com" , "Joao.Pinto@synopsys.com" , "jingoohan1@gmail.com" , "adouglas@cadence.com" , "niklas.cassel@axis.com" , "jesper.nilsson@axis.com" References: <8b88f8c2b766f36c71659deb0fce635154b2b39f.1523379766.git.gustavo.pimentel@synopsys.com> CC: "linux-pci@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" From: Kishon Vijay Abraham I Message-ID: Date: Tue, 24 Apr 2018 12:49:39 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" 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 Hi, On Tuesday 17 April 2018 11:08 PM, Gustavo Pimentel wrote: > Hi Kishon, > > On 17/04/2018 11:33, Kishon Vijay Abraham I wrote: >> Hi, >> >> On Tuesday 10 April 2018 10:44 PM, Gustavo Pimentel wrote: >>> Adds the MSI-X support and updates driver documentation accordingly. >>> >>> Changes the driver parameter in order to allow the interruption type >>> selection. >>> >>> Signed-off-by: Gustavo Pimentel >>> --- >>> Documentation/misc-devices/pci-endpoint-test.txt | 3 + >>> drivers/misc/pci_endpoint_test.c | 102 +++++++++++++++++------ >>> 2 files changed, 79 insertions(+), 26 deletions(-) >>> >>> diff --git a/Documentation/misc-devices/pci-endpoint-test.txt b/Documentation/misc-devices/pci-endpoint-test.txt >>> index 4ebc359..fdfa0f6 100644 >>> --- a/Documentation/misc-devices/pci-endpoint-test.txt >>> +++ b/Documentation/misc-devices/pci-endpoint-test.txt >>> @@ -10,6 +10,7 @@ The PCI driver for the test device performs the following tests >>> *) verifying addresses programmed in BAR >>> *) raise legacy IRQ >>> *) raise MSI IRQ >>> + *) raise MSI-X IRQ >>> *) read data >>> *) write data >>> *) copy data >>> @@ -25,6 +26,8 @@ ioctl >>> PCITEST_LEGACY_IRQ: Tests legacy IRQ >>> PCITEST_MSI: Tests message signalled interrupts. The MSI number >>> to be tested should be passed as argument. >>> + PCITEST_MSIX: Tests message signalled interrupts. The MSI-X number >>> + to be tested should be passed as argument. >>> PCITEST_WRITE: Perform write tests. The size of the buffer should be passed >>> as argument. >>> PCITEST_READ: Perform read tests. The size of the buffer should be passed >>> diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c >>> index 37db0fc..a7d9354 100644 >>> --- a/drivers/misc/pci_endpoint_test.c >>> +++ b/drivers/misc/pci_endpoint_test.c >>> @@ -42,11 +42,16 @@ >>> #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 COMMAND_RAISE_MSIX_IRQ BIT(2) >>> +#define IRQ_TYPE_SHIFT 3 >>> +#define IRQ_TYPE_LEGACY 0 >>> +#define IRQ_TYPE_MSI 1 >>> +#define IRQ_TYPE_MSIX 2 >>> +#define MSI_NUMBER_SHIFT 5 >> >> Now that you are anyways fixing this, add a new register entry for MSI numbers. >> Let's not keep COMMAND and MSI's together. > > What you suggest? #define PCI_ENDPOINT_TEST_COMMAND 0x4 #define COMMAND_RAISE_LEGACY_IRQ BIT(0) #define COMMAND_RAISE_MSI_IRQ BIT(1) #define COMMAND_RAISE_MSIX_IRQ BIT(2) #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 0xc #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_MSI_NUMBER 0x24 We should try not to modify either the existing register offsets or the bit fields within these registers in the future as EP and RC will be running on different systems and it is possible one of them might not have the updated kernel. > >>> +/* 12 bits for MSI number */ >>> +#define COMMAND_READ BIT(17) >>> +#define COMMAND_WRITE BIT(18) >>> +#define COMMAND_COPY BIT(19) >> >> This change should be done along with the pci-epf-test in a single patch. > > To be clear, you're saying is this patch should be just be squashed into the > patch number 8 [1], because there is a lot of dependencies namely the defines, > that is used on the alter functions. > > [1] -> https://patchwork.ozlabs.org/patch/896841/ yeah. We have to make sure git bisect doesn't break functionality. > >>> >>> #define PCI_ENDPOINT_TEST_STATUS 0x8 >>> #define STATUS_READ_SUCCESS BIT(0) >>> @@ -73,9 +78,9 @@ static DEFINE_IDA(pci_endpoint_test_ida); >>> #define to_endpoint_test(priv) container_of((priv), struct pci_endpoint_test, \ >>> miscdev) >>> >>> -static bool no_msi; >>> -module_param(no_msi, bool, 0444); >>> -MODULE_PARM_DESC(no_msi, "Disable MSI interrupt in pci_endpoint_test"); >> >> Let's not remove this just to make sure existing users doesn't get affected. > > Hum, by making an internal conversion? Like this > no_msi = false <=> irq_type = 1 > no_msi = true <=> irq_type = 0 yeah.. Thanks Kishon