Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2226280imm; Thu, 21 Jun 2018 09:03:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK0TvdH/EVEbAQow63JaAk5H5TfnaZRSRUQLdJlSiJ8/xjBtF/DZWJVcOR4//ItP9gt98FQ X-Received: by 2002:a63:91c8:: with SMTP id l191-v6mr23244878pge.53.1529597038719; Thu, 21 Jun 2018 09:03:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529597038; cv=none; d=google.com; s=arc-20160816; b=ocN9pd6Ik4ke2QgPqRyg67qeB2wVfHsE/DvFpHZr+pYxeXfFaXbGj96ya9b/Q4xaMr PsyDh7JlDR4sgwt9tKqbke11VV5xnY5TMyJeaNlgn/JdLBy5l41DLmyAnkj6g+0ZMar/ +91drKeH9sQpQggthqb1ITNooF+xLVEJfV3AH3N39N9He3MYjp8nXHgejR6CgAfJdpoL M+JEOwJhuXckZwh3hXNAfNLVX+bwAAuEGjxUmyUd6IlFeayydJTYjpc9OxaM/ZDpZPUU IuiYlaZHh5fj71CUUzU8xRye/e8SwrNUQGRbwi+/INm7m75G5usZi5pDEq+oa4M8bq/y GrbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=hgyk8HbBtPFBS95SHK6Pwe+OjZg0/pPnt4YOhBxFjoU=; b=f1r1GCAiWdjtY5qkuUO5KMdAiHR8z97NZv+NMl6901D679ZMlHHMhYS22CvpRIVxYa aCwtbJt344lG+CSL69LauoO1A+LFnyufvab0sneglB5kQswQ1gDQ7oyKpe9HcBcwOQyv KWd6XdZhOP7mRAo/hoH/kK2yh/4v6YbAiifMdoCkkHF+y+te64HSkiGmGE5dnV37JTpy ntItaoBOQh5bK+1eo4zJaUkDJfCkHvkuc+slQQ0gKbh9mad0/8csWVUXbFnd6h028u42 s4ZXAc8BsZn36z2b8EEGHtBuPivgiIq7ysuIECdhafBBorAmjT24aFxlCWQYZPpD2dhN 28ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=fqDt8En9; 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 d1-v6si5079813pld.515.2018.06.21.09.03.40; Thu, 21 Jun 2018 09:03:58 -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=fqDt8En9; 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 S933554AbeFUQCh (ORCPT + 99 others); Thu, 21 Jun 2018 12:02:37 -0400 Received: from smtprelay.synopsys.com ([198.182.37.59]:57291 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933389AbeFUQBt (ORCPT ); Thu, 21 Jun 2018 12:01:49 -0400 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 46D811E16D3; Thu, 21 Jun 2018 18:01:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1529596907; bh=pRouPcXYoFMGnUy8cXkkisr7PxXQEeC7V6tKwQ1Htu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=fqDt8En9LUuLpnmvq3mUwUCzLdX4wVo0Iak5ScpeICgyhV6MFf6h2JWd6lewCbmDa VeYUanFP7OfzhrllRVOEwcit/5AJ82L0n48k+P5cstEle55zK6LGpbC6V1rULW57jw gmqOD0Huv5wKQwo/FTifFFs7A+eUplAoz1eMGv+u1oLcTTnc0mcvmDFw9k1bNiMRox oUeyuMkmOOJNj2+BnvnvhDWfftkgTKBA/dcZXHJDcgXROlQjkbjlqezfZUp0F46Stw P6kpRo7S7cGRES3JmMiPIQox8i/xUKpzPUVr2KyhN76OmEEcQNguXYsPeP0WV8MBwt VsiClhN9YbF+w== Received: from pt02.synopsys.com (pt02.internal.synopsys.com [10.107.23.240]) by mailhost.synopsys.com (Postfix) with ESMTP id 3001B3B27; Thu, 21 Jun 2018 09:01:46 -0700 (PDT) Received: from UbuntuMate-64Bits.internal.synopsys.com (gustavo-e7480.internal.synopsys.com [10.107.25.102]) by pt02.synopsys.com (Postfix) with ESMTP id 37CE53D12F; Thu, 21 Jun 2018 17:01:44 +0100 (WEST) From: Gustavo Pimentel To: bhelgaas@google.com, lorenzo.pieralisi@arm.com, Joao.Pinto@synopsys.com, jingoohan1@gmail.com, kishon@ti.com, adouglas@cadence.com, jesper.nilsson@axis.com, shawn.lin@rock-chips.com Cc: linux-pci@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Gustavo Pimentel Subject: [PATCH v6 07/11] pci-epf-test/pci_endpoint_test: Use irq_type module parameter Date: Thu, 21 Jun 2018 17:01:32 +0100 Message-Id: <98be2b2cfd6dfb9cdfed95da5fe8cde0a96ce37e.1529595907.git.gustavo.pimentel@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add new driver parameter to allow interruption type selection. 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. Change v4->v5: - Nothing changed, just to follow the patch set version. Change v5->v6: - Nothing changed, just to follow the patch set version. drivers/misc/pci_endpoint_test.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 35fbfbd..4d2c9cb 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -82,6 +82,10 @@ static bool no_msi; module_param(no_msi, bool, 0444); MODULE_PARM_DESC(no_msi, "Disable MSI interrupt in pci_endpoint_test"); +static int irq_type = IRQ_TYPE_MSI; +module_param(irq_type, int, 0444); +MODULE_PARM_DESC(irq_type, "IRQ mode selection in pci_endpoint_test (0 - Legacy, 1 - MSI)"); + enum pci_barno { BAR_0, BAR_1, @@ -108,7 +112,7 @@ struct pci_endpoint_test { struct pci_endpoint_test_data { enum pci_barno test_reg_bar; size_t alignment; - bool no_msi; + int irq_type; }; static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test, @@ -291,8 +295,7 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, size_t size) pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE, size); - pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, - no_msi ? IRQ_TYPE_LEGACY : IRQ_TYPE_MSI); + pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, irq_type); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, COMMAND_COPY); @@ -361,8 +364,7 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test, size_t size) pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE, size); - pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, - no_msi ? IRQ_TYPE_LEGACY : IRQ_TYPE_MSI); + pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, irq_type); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, COMMAND_READ); @@ -419,8 +421,7 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test, size_t size) pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_SIZE, size); - pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, - no_msi ? IRQ_TYPE_LEGACY : IRQ_TYPE_MSI); + pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE, irq_type); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 1); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND, COMMAND_WRITE); @@ -505,11 +506,14 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, test->alignment = 0; test->pdev = pdev; + if (no_msi) + irq_type = IRQ_TYPE_LEGACY; + data = (struct pci_endpoint_test_data *)ent->driver_data; if (data) { test_reg_bar = data->test_reg_bar; test->alignment = data->alignment; - no_msi = data->no_msi; + irq_type = data->irq_type; } init_completion(&test->irq_raised); @@ -529,13 +533,21 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, pci_set_master(pdev); - if (!no_msi) { + switch (irq_type) { + case IRQ_TYPE_LEGACY: + irq = 0; + break; + case IRQ_TYPE_MSI: irq = pci_alloc_irq_vectors(pdev, 1, 32, PCI_IRQ_MSI); if (irq < 0) dev_err(dev, "Failed to get MSI interrupts\n"); test->num_irqs = irq; + break; + default: + dev_err(dev, "Invalid IRQ type selected\n"); } + err = devm_request_irq(dev, pdev->irq, pci_endpoint_test_irqhandler, IRQF_SHARED, DRV_MODULE_NAME, test); if (err) { -- 2.7.4