Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3417336ybz; Mon, 20 Apr 2020 02:17:57 -0700 (PDT) X-Google-Smtp-Source: APiQypJ3nYXZSSzyDPBYDm+rbJIcgSBluZFSn8/AP+HeOyHhCGZ1TMVpjNF37sCHfvM5IANuHwkC X-Received: by 2002:a17:906:f1c3:: with SMTP id gx3mr15332636ejb.25.1587374277590; Mon, 20 Apr 2020 02:17:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587374277; cv=none; d=google.com; s=arc-20160816; b=xMm3Sjp3vKMARQjOLkvCUHVoHVF933i/bz1qckqKUq3kPUF9ATjcUMuBn+xul992O+ UWKot7IvGjZGj1Co3qjmJuruLtVUaHC1HOmCEYjZN5S7BaYNGS/PJ4wurVcVWdacwZWQ RybpfhWMbA+BqcyhrVOO11X7HSi962BtitJzrKTOjz+swjfsjZmsiw2QY3EfpcTWzbUU 8Jpt2LYF+jOtjyZVzrZB4q3TIIywsl19OccMkSFSq8UG8Xu5BEy0Iu/vqoEm4CP3tB+a lkzccGau8RlI0LnOWtR3BVoNsDNI3TpNkEs6Orf/etP7FbrlXafL5lRk53/j0aBQEG9k pylA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=LY73OUo0+AlWC75hotE9Q+n3IXRjW20shXXLMxebx7c=; b=w0Iw4OZ0SgzD+BGZQt90Ic81o0jkD+GfMhMjMQYi0FsFgaXyF/lbpDJvfzhlpxsPel nB8WAhEBErEj98uMRqI6r+Izkn0ovAtkpIwGSxDQgB7o7U92Qu2zO/VYVoMhNeA5yOwb 8RT2pcRSMLXWT76jL7OzIPdf3ymplohPqHerot3oemaw8Ba4RGJD/xFI+fAqieujV3Y3 XUvR3SFza8i4viz0DTSJIsIpmPjvtFxPRIihzTaqjO13TQWnjuVyABDAPFLyfpqKcGbu nT/Cuf74QsCG9VALKOFQDvYRtiFAXpky4kyCYy/HiLJcwRXF0cZLsVn0wLm6dWp3q5RB 9a1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FWW6qJ6Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sb18si170264ejb.318.2020.04.20.02.17.35; Mon, 20 Apr 2020 02:17:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FWW6qJ6Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726100AbgDTJOg (ORCPT + 99 others); Mon, 20 Apr 2020 05:14:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:41434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725865AbgDTJOg (ORCPT ); Mon, 20 Apr 2020 05:14:36 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 08C692078E; Mon, 20 Apr 2020 09:14:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587374075; bh=+x/OfWUtv6vxKKGVV82g7KQURoCOuxYGmr6C4EACaJc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FWW6qJ6ZX323VPf6/ew/Zd9S7mctMMY46H2fDfg6+6MVwlnMW76TITYkYxo17RpuL 1bkpH9ag5tCOybB9eJk99eMNiFqz+tcvkaCwHFFRwYDLMhmDlX+zxfz7nWQVw9LsSr QT+T6VJIQgoHmE4wiM2NUAwghoGg872domNLa8OQ= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jQSVd-004osT-CU; Mon, 20 Apr 2020 10:14:33 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 20 Apr 2020 10:14:33 +0100 From: Marc Zyngier To: Gustavo Pimentel , Alan Mikhak Cc: linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, kishon@ti.com, paul.walmsley@sifive.com Subject: Re: [PATCH] genirq/msi: Check null pointer before copying struct msi_msg In-Reply-To: References: <1587149322-28104-1-git-send-email-alan.mikhak@sifive.com> <20200418122123.10157ddd@why> Message-ID: <8a03b55223b118c6fc605d7204e01460@kernel.org> X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/1.3.10 X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: Gustavo.Pimentel@synopsys.com, alan.mikhak@sifive.com, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-pci@vger.kernel.org, tglx@linutronix.de, kishon@ti.com, paul.walmsley@sifive.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-04-18 16:19, Gustavo Pimentel wrote: > Hi Marc and Alan, > >> I'm not convinced by this. If you know that, by construction, these >> interrupts are not associated with an underlying MSI, why calling >> get_cached_msi_msg() the first place? >> >> There seem to be some assumptions in the DW EDMA driver that the >> signaling would be MSI based, so maybe someone from Synopsys >> (Gustavo?) >> could clarify that. From my own perspective, running on an endpoint >> device means that it is *generating* interrupts, and I'm not sure what >> the MSIs represent here. > > Giving a little context to this topic. > > The eDMA IP present on the Synopsys DesignWare PCIe Endpoints can be > configured and triggered *remotely* as well *locally*. > For the sake of simplicity let's assume for now the eDMA was > implemented > on the EP and that is the IP that we want to configure and use. > > When I say *remotely* I mean that this IP can be configurable through > the > RC/CPU side, however, for that, it requires the eDMA registers to be > exposed through a PCIe BAR on the EP. This will allow setting the SAR, > DAR and other settings, also need(s) the interrupt(s) address(es) to be > set as well (MSI or MSI-X only) so that it can signal through PCIe (to > the RC and consecutively the associated EP driver) if the data transfer > has been completed, aborted or if the Linked List consumer algorithm > has > passed in some linked element marked with a watermark. > > It was based on this case that the eDMA driver was exclusively > developed. > > However, Alan, wants to expand a little more this, by being able to use > this driver on the EP side (through > pcitest/pci_endpoint_test/pci_epf_test) so that he can configure this > IP > *locally*. > In fact, when doing this, he doesn't need to configure the interrupt > address (MSI or MSI-X), because this IP provides a local interrupt line > so that be connected to other blocks on the EP side. Right, so this confirms my hunch that the driver is being used in a way that doesn't reflect the expected use case. Rather than papering over the problem by hacking the core code, I'd rather see the eDMA driver be updated to support both host and endpoint cases. This probably boils down to a PCI vs non-PCI set of helpers. Alan, could you confirm whether we got it right? Thanks, M. -- Jazz is not dead. It just smells funny...