Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932671AbbELMUM (ORCPT ); Tue, 12 May 2015 08:20:12 -0400 Received: from mail-by2on0099.outbound.protection.outlook.com ([207.46.100.99]:8736 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932488AbbELMUJ (ORCPT ); Tue, 12 May 2015 08:20:09 -0400 X-Greylist: delayed 1985 seconds by postgrey-1.27 at vger.kernel.org; Tue, 12 May 2015 08:20:08 EDT Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; Date: Tue, 12 May 2015 13:46:47 +0200 From: Robert Richter To: Tejun Heo CC: Robert Richter , Catalin Marinas , Will Deacon , Sunil Goutham , Jiang Liu , , , , Alexander Gordeev Subject: Re: [PATCH v2] AHCI: Add generic MSI-X interrupt support to SATA PCI driver Message-ID: <20150512114647.GN10428@rric.localhost> References: <1430725538-22162-1-git-send-email-rric@kernel.org> <20150504160652.GB1971@htj.duckdns.org> <20150511171810.GB29499@rric.localhost> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20150511171810.GB29499@rric.localhost> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [78.53.81.44] X-ClientProxiedBy: VI1PR05CA0034.eurprd05.prod.outlook.com (25.162.33.172) To BLUPR0701MB802.namprd07.prod.outlook.com (10.141.253.23) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0701MB802; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BLUPR0701MB802;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0701MB802; X-Forefront-PRVS: 0574D4712B X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(6009001)(164054003)(24454002)(51704005)(62966003)(46406003)(77156002)(97756001)(23726002)(33656002)(76506005)(42186005)(66066001)(50466002)(47776003)(189998001)(83506001)(86362001)(87976001)(50986999)(54356999)(76176999)(92566002)(5001960100002)(40100003)(122386002)(2950100001)(110136002)(46102003)(4001350100001)(77096005)(5001920100001)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR0701MB802;H:rric.localhost;FPR:;SPF:None;MLV:sfv;LANG:en; X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2015 11:46:59.3872 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB802 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2854 Lines: 79 Tejun, On 11.05.15 19:18:10, Robert Richter wrote: > > > +static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, > > > + struct ahci_host_priv *hpriv) > > > +{ > > > + struct msi_desc *desc; > > > + > > > + __ahci_init_interrupts(pdev, n_ports, hpriv); > > > + > > > + if (!pdev->msix_enabled) > > > + return pdev->irq; > > > + > > > + desc = msix_get_desc(pdev, 0); /* first entry */ > > > + if (!desc) > > > + return -ENODEV; > > > + > > > + return desc->irq; > > > +} > > > > Can we please do this properly? We should be able to move port priv > > allocation to host allocaotion time and add and use pp->irq instead, > > right? > > I started working implementing this. > > Will send an updated patch set once finished. A couple of questions here. If we store the irq for each port separate in host->ports[i]->irq, then there are duplicates for !AHCI_HFLAG_MULTI_MSI. We can not iterate over all ports then to initialize the interrupt. Instead we need to check for !AHCI_HFLAG_MULTI_MSI and store in that case the irq in host->irq. This would avoid initializing duplicates and makes host->ports[i]->irq only useful for multi-msi. Right now multi-msi uses a base irq + index to register all irqs. This makes host->ports[i]->irq obsolete at all. Now, adding host->irq would change the function interface of ahci_host_activate() to: int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht); I don't think this is worth the effort as all internal and external drivers need to be changed basically from: ahci_host_activate(host, irq, &ahci_sht); to: host->irq = irq; ahci_host_activate(host, &ahci_sht); This looks not very useful to do. Since irq is used only a single time, there is no reason to store it in the host's data structure. It also makes the interface more error prone since host->irq might not be setup. Apart from that there is an abi change. I agree that we will need the implemention of host->ports[i]->irq for the case there irqs are no longer in sequential order as this might be the case for per-port msi-x interrupts. But this is not the focus of my implementation and as long there is no hardware for this available, it wouldn't make sense to implement this at all. So how to proceed? I could send you patches that implement host->irq for a single per-host interrupt, and also one that reworks multi-port interrupts to use host->ports[i]->irq. But I don't see any benefit here. That said, I would better keep my patch here as it is. That do you think? Thanks, -Robert -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/