Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp795015imm; Mon, 9 Jul 2018 10:45:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpedGretvycPRgAxh/596QDxRzyLJEm301ypKlNMF+o7pn2ssBI0ellArgrIxfTvpVUIuIDn X-Received: by 2002:a17:902:e101:: with SMTP id cc1-v6mr21229907plb.96.1531158342474; Mon, 09 Jul 2018 10:45:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531158342; cv=none; d=google.com; s=arc-20160816; b=kl5igOZbEJ9NrB2d6+r4P69394qiBXGyb/Imf4hvxYq5UFkJygOizcOOGuME3hGxuc MHX7P//cW04oRSMTBPIf48eeSEje5CbRashU1M6YCbUNO8/zZ3k+jEv0vddifhFR+hWp 658GOrH0rhrSe7THRlz+N84Jwoi0ck4OLaiOziZH1SkhqDzCTsY0f0LZIghYrs+49Qpl js9z4UtVboxjSRzlrmvE1ep+X4VXw3t5NtJZRBHOjPm5BaKBUDnaTjr/mlUi1gIRTGc9 suJ59XJn7MRWKsVt7dmPLh+Zz9YjiAoIOMEXHbtwkPmL1WzaRvJ9VD+ggUk7aWmQB1PD 6uHw== 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=UeyFvxpgWGatattqTR9FnNVn4k+/CRfNcP0t/AniXgE=; b=v30F1QVcU97wWUyHtY8tmmGuJWEuRKE1lHH6SD+OJ9p8zsS/iO9FEXOdr6Ypwsm0ev SEkZZy4pIqaEkvIrVmE0h7HJgK7Dt4IaoGszrnADxTcP2AISa6j2CAzNciXwhr8mDSyy 9E623emYxmJxZGCV7UdtIT3nkQbF0ibb8s2EduFbhoCs7fCbsEzm7oUmhaY6in9mI7h0 6o+MtHN87R+WDasySFN9WAMO2V19ne1tDpp3M/3oNMcCJaswDQR87KV0wJzycrGDZn1A C/uFETKvflxA786xoGLy2De8+VoT2/WkKkl6aFyp+6RTmWk8AvtYB0uy9aoreTnoIGjI MnCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=VrGPZKSL; 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 j20-v6si14238325pgb.92.2018.07.09.10.45.27; Mon, 09 Jul 2018 10:45:42 -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=VrGPZKSL; 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 S934191AbeGIRnx (ORCPT + 99 others); Mon, 9 Jul 2018 13:43:53 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:56711 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933806AbeGIRm6 (ORCPT ); Mon, 9 Jul 2018 13:42:58 -0400 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id CAD1110C1B13; Mon, 9 Jul 2018 10:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1531158177; bh=WZ+9Yg4cyJ6z/xB67evZGXWNWTIK4jOqxuCfFybDAUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=VrGPZKSLxcbBbTu/vHrO/ueN7VFvHJmZhtetXm3qqT9SK+h6mLr0X+tSpHTQDcRt1 5FPk/ELsJsDJB5lV9SxMIPfKHz+MFVIbzxwF91qUTq/muvlRflL7Wv2NxcJw4149uX 8S77X6LeABBf+H8V+NTtxmlavg+eyrCxHomPEsFDeM0TfcjIABsSok+3rhzXrquxQt NkRhVPCUCl8jF39jwT+SuWcTXbLjM2ofzQxLs7GDx1rZ3L0znw27NnHGJfSc9vnpYH pEaxXgLoS8w6mux1CWSkohXbr9N6FT7zDwQ42T+1LYJr/9RMb2caGNhpbPx8AZZnTA yM7gaiJos4JpA== Received: from pt02.synopsys.com (pt02.synopsys.com [10.107.23.240]) by mailhost.synopsys.com (Postfix) with ESMTP id 3CCAA3723; Mon, 9 Jul 2018 10:42:57 -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 C7E903EDA2; Mon, 9 Jul 2018 18:42:55 +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 v9 08/12] pci-epf-test/pci_endpoint_test: Use irq_type module parameter Date: Mon, 9 Jul 2018 18:42:46 +0100 Message-Id: <1390280769246adf7bd7339d210cf8541b74b9ef.1531155252.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. Change v6->v7: - Removed unnecessary set to zero variable. - Removed empty line. Change v7->v8: - Re-sending the patch series. Change v8->v9: - Nothing changed, just to follow the patch set version. drivers/misc/pci_endpoint_test.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 35fbfbd..349794c 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,11 +533,17 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, pci_set_master(pdev); - if (!no_msi) { + switch (irq_type) { + case IRQ_TYPE_LEGACY: + 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, -- 2.7.4