Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2428561imm; Mon, 16 Jul 2018 07:54:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpea+jImErCGo0nXkgweo8VqvVdw1/IoJillcM2vjpyIsQsHowXe0GyflxIG8aUaRWxfMZmE X-Received: by 2002:a63:6cc8:: with SMTP id h191-v6mr15809750pgc.359.1531752855417; Mon, 16 Jul 2018 07:54:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531752855; cv=none; d=google.com; s=arc-20160816; b=iBQPgDUIspvLxJbzRy5XdkRIjcjpR5LDCUiLWevMEUIHs+RUh536PYPOF+Sgq+0vCX 5mxibuiYP9mbSFr656xlePy45PoFBfx0YcftIJVAovNfgW7fBHPpDHO4I81NaXTvuon0 l3x9hAQ3tOLIWrwiIefz6Di8YwfpzgVr/VjmW4Y3jNf+Gi3dzBHrZau7gUsda5fZHk2k aAqebbgP0pp2rmUVLiFLn4grdbz6cs2QM1yPSGCnkfdAGl+OjRmHE+hVJL5fyGt482iD kudbqlAFk2DZMOKjkN+0T8obzKPPFOaEkyQXfWskiPuUhh7hzwsXCUup+Adb5YiE/cVu xBNQ== 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=gNhcEgSIxqjjUjbcoR2CRz/a0202orUZdmbViGZVgyI=; b=F8S8ZjtmKm/OREfIanLNObqDZ36rb++NfkM4S47JIYTs+CoqAPNSnvcFjpP/JO1K2A OGNQonqLUE4cM9+Cwt1R17Cc+jDtiOoaVY51b8SR/DTtiPMLlGDyFQF1S5JPMSFEN0kO NGeS8SovYUafh2UYrb6DUhs2eS5+Q2RS4+fmdqeCA+1giuvP6vovICnrkewMUkTH1/bD VUBVDlP1lkZqTq3FKNmJJwASrd5M/EdzsmZD0xyiICgOcmMpImiCnabnZupOfcWsl5nX iZgC9YrSJnIlDkTxtWAiNqOTTKirnfOGfOCT1PukNTRYl4b6i2POfEZIkaOx7vYWf3av WyrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=Zutlz8rx; 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 t188-v6si25869061pfd.148.2018.07.16.07.54.00; Mon, 16 Jul 2018 07:54:15 -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=Zutlz8rx; 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 S1730375AbeGPPUW (ORCPT + 99 others); Mon, 16 Jul 2018 11:20:22 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:39738 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729927AbeGPPUQ (ORCPT ); Mon, 16 Jul 2018 11:20:16 -0400 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 4198224E2490; Mon, 16 Jul 2018 07:52:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1531752749; bh=b/3smoDa2w+5T+r/tpbRBW3g6ZaMlHT3sgSEmeQcB+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=Zutlz8rxdHvr2utnyS9/lUSO4kTglV3S/mkXkwG+ZKnAZ/tECFMTbU6oHRM2eOPhL lKeGTDeB03H+FaFEoOHq9Y7Rqqf/dfddn2u+Yy0tB3jrKEdwd+v0kx3ejJ25/VxsXS yqI7f4LrxYMbQPqPISUrEzLyoG1rvuEnufD+wEvH44bXkmU17hKiKIV4phSpVx7wta 0yq+c+yxCqbdy5ppRIOmzmORsDgbWBuqjqU23iECNbYa7K6q3mMZUv0s6joPP+lR+f FccIlORbh4jOiAKtiEk78UTWyq40WEQwgQSmETRtk9ay7XGDrhIVNYlQn6ZMOwaYaL D6d8oG7NpazAg== Received: from de02.synopsys.com (germany.internal.synopsys.com [10.225.17.21]) by mailhost.synopsys.com (Postfix) with ESMTP id E1C003093; Mon, 16 Jul 2018 07:52:28 -0700 (PDT) Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by de02.synopsys.com (Postfix) with ESMTP id 4BA013DCD8; Mon, 16 Jul 2018 16:52:27 +0200 (CEST) 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 v11 08/12] pci-epf-test/pci_endpoint_test: Use irq_type module parameter Date: Mon, 16 Jul 2018 16:52:20 +0200 Message-Id: <26c2255c0e8a03378f55c1e5227f267898ddbef7.1531751641.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 Acked-by: Kishon Vijay Abraham I --- 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. Change v9->v10: - Nothing changed, just to follow the patch set version. Change v10->v11: - 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