Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2344181ybb; Thu, 2 Apr 2020 18:51:15 -0700 (PDT) X-Google-Smtp-Source: APiQypJi2kNzDkloeP+pIIvadr+in3KUtXrHAiSXXqnF4rD5vivjdPD/sG2k0LIoebUg/pzviB3Y X-Received: by 2002:aca:c209:: with SMTP id s9mr1358738oif.131.1585878675808; Thu, 02 Apr 2020 18:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585878675; cv=none; d=google.com; s=arc-20160816; b=pnVj7g/4jGNcokCThoTbdLuwUU/pu0OFvVFZcX0O5Qv7QqAFYQbom9U9C8r498BRaQ vvP1it/NVgVVwft6VRFwq3UzDa8oT19vkwM7qno+IjWWUVyoWoUbaia+TQoUJp3tyABa PX0y04KB3hm2r7GFbvTbnUVsPzsmorb73xkFJI5rlwHi1n6dIKe8hkYOs3XGN35xtd/H kiXfPCJ9hpjR9eoLLv8fITbBoZJa19Seu14Ck+VyzyOn7yVP4i2y8omo8O7KwUToRgo+ JBpPgjzZbdHOFxPm/NShGYWifwRX2wFpU+NP937gyuKfiMV3n8YnVE6ooyR9qw2WE9sv HJTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :mime-version:dkim-signature; bh=okSzurA2TnTvishCfA5UABEnEmnZ1xC7aBRu4+DTlSg=; b=Xz4YvB/3n4TKgcSM7TdE0y3RwBTvRBqfMSPdIWRtIDBfFcl4HEUkg0+rc+M1Iy/gdl 5A4YkrrkacNSnRs5prWQGGFf0i3fJhP3ozT2oONfsRHHJo3wuGpD3afbM7xi6JGurXSY F5vyN38lHYBJgmlzMaepOkLGsWeYxUxXJV4cb6kVlDB9pcDIlmtVBYLB7IQfaIOevr3B 0kIFTm4pUFt9Q46zHyWnwbZ9j+zj5nxHxfYR9AR8ODVdLyFACZ9D4ntLLzeeLnsb5rZh 6d4SUMoCTdYjt4Kb3fD4UrmKxmIVz9EcEt4gTVUnUlrV7ho4dNrqrmLNcLadQcglyOD5 3pwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZKfwGVIC; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q197si2978359oic.262.2020.04.02.18.51.02; Thu, 02 Apr 2020 18:51: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=@gmail.com header.s=20161025 header.b=ZKfwGVIC; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390343AbgDCBfQ (ORCPT + 99 others); Thu, 2 Apr 2020 21:35:16 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]:40805 "EHLO mail-wr1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388709AbgDCBfP (ORCPT ); Thu, 2 Apr 2020 21:35:15 -0400 Received: by mail-wr1-f42.google.com with SMTP id s8so4493214wrt.7 for ; Thu, 02 Apr 2020 18:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=okSzurA2TnTvishCfA5UABEnEmnZ1xC7aBRu4+DTlSg=; b=ZKfwGVICCjRx5AWbAhHCXAgDeMHWdOi5C4RE0z1zPUPuoU2rWpb5wystqf2uqosPVJ bdb9FQS3BrN4wC8okLZnEDzl1SrxB+qdmdFeYV1/apo4VpVsqdVSfEdTmZFLxJwYy5C/ hun4imbdf1de+VHlZEl8nVMg99+6dwrgLcew+tTkoTJox7p3/IH3EXSAe6yJkkkgQJqy a5cofaCJzqJ6uiaSzd7WyETrmqGujjICdiv1Y/wGbvGRzD3wm+NoRjGAOOYW+8dVC+h7 7SDl1VckNapg0oXqqGmYfYlc4l7fI9eULatsCHzkbwJPvEn6nP07VffpV+ibbIeUYkEU kjnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=okSzurA2TnTvishCfA5UABEnEmnZ1xC7aBRu4+DTlSg=; b=Ng/JbAhKAHGoBcqmMIlrZlj0/oMy+ntn0IQ6luzH83HtQ3sKnrUV4V3LYgaddja25A nWrbjLHYXzdegfe6iGLlFzZVSgEt1vzft3nu8CND++xg6xNJr7Ys1sgiofY4w4SM4jrc t33eqANZ4BEfNIB4Z+pjLAMB0KdVksLiqcekMDsA33RgOwwfM8n3KcNohwprLbpgoTbg Azd64LwLfyf88weZmzJ6kvhHS8RM83nb8zSbHxdrwUtWoNZT3tNUmrDZKMFjwU5KDZw8 8Eb/PPcRCx12W7K1IqrIkipN/Zh3LB/MUD4up/x51yIDCycFz35qqwQw68GRK2nA4pFk mBuA== X-Gm-Message-State: AGi0PuZ9TwhOxWRg0qcty88p/Kg65sEt1RSM5RZ3GAaVlYmpf93KUpqb 7lDFtzkI8wlmyd9pPcIyUIbW+lSqKNUrBaJx6naKuQ== X-Received: by 2002:adf:aacf:: with SMTP id i15mr6013203wrc.31.1585877712013; Thu, 02 Apr 2020 18:35:12 -0700 (PDT) MIME-Version: 1.0 From: =?UTF-8?Q?Lu=C3=ADs_Matallui?= Date: Thu, 2 Apr 2020 19:35:01 -0600 Message-ID: Subject: Help with IRQ-MSI-IRQ bridges To: linux-kernel@vger.kernel.org Cc: maz@kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I've got this SoC which uses IRQ-MSI and MSI-IRQ bridges in order to get interrupts from devices external to the ARM subsystem. I already got some pointers from Maz and have been able to create the drivers with the stacked domains and can now see the mappings working fine across domains. Maz pointed me to the Marvell mvebu-gicp (for my MSI controller, a.k.a MSI-IRQ bridge) and to mvebu-icu for the MSI client (IRQ-MSI bridge). I now have the interrupts working, but it seems like I'm missing a bunch of them. And therefore my device doesn't work properly. The main difference between my HW and Marvell's is that my IRQs are not level-triggered and the MSIs don't support the two messages for level-triggered interrupts. To illustrate my system: DEV --line--> IRQ-MSI Bridge (MSIC) --msi--> MSI-IRQ Bridge (GICP) --line--> GICv2 For MSIC, all I can do is configure the address and data for the MSI, and I believe on every rising edge of the Device IRQ, an MSI is sent. For GICP, all I have is a doorbell and a way to enable/disable it, and whenever the doorbell is enabled and has a value != 0, the IRQ line to GICv2 gets asserted. The first thing I noticed is that when I get an interrupt, the IRQ flow goes like: handle_irq(); irq_eoi(); So, I guess my first question here is, how can I guarantee that I don't get another MSI whilst in handle_irq()? If I do, then I will clear the doorbell on irq_eoi() (because that's my only choice) and will lose the queued IRQs. It also seems that I'm missing IRQs in the beginning after probing the device, and before it was working for me when I was setting up all these registers manually and simply using GICv2 as my only interrupt controller. I do see the unmask() ops being called for all my stacked irqchips, so I don't understand how I'm missing so many interrupts. Any help would be truly appreciated. Thanks, ltanica