From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB20BC433F5 for ; Mon, 13 Sep 2021 20:44:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4605610E7 for ; Mon, 13 Sep 2021 20:44:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242924AbhIMUp7 (ORCPT ); Mon, 13 Sep 2021 16:45:59 -0400 Received: from rosenzweig.io ([138.197.143.207]:46342 "EHLO rosenzweig.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242398AbhIMUp7 (ORCPT ); Mon, 13 Sep 2021 16:45:59 -0400 Date: Mon, 13 Sep 2021 16:43:23 -0400 From: Alyssa Rosenzweig To: Marc Zyngier Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Bjorn Helgaas , Rob Herring , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Stan Skowronek , Mark Kettenis , Sven Peter , Hector Martin , Robin Murphy , kernel-team@android.com Subject: Re: [PATCH v3 08/10] PCI: apple: Implement MSI support Message-ID: References: <20210913182550.264165-1-maz@kernel.org> <20210913182550.264165-9-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210913182550.264165-9-maz@kernel.org> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org > +static void apple_msi_compose_msg(struct irq_data *data, struct msi_msg *msg) > +{ > + BUILD_BUG_ON(upper_32_bits(DOORBELL_ADDR)); > + > + msg->address_hi = upper_32_bits(DOORBELL_ADDR); > + msg->address_lo = lower_32_bits(DOORBELL_ADDR); > + msg->data = data->hwirq; > +} ... > @@ -269,6 +378,14 @@ static int apple_pcie_port_setup_irq(struct apple_pcie_port *port) > > irq_set_chained_handler_and_data(irq, apple_port_irq_handler, port); > > + /* Configure MSI base address */ > + writel_relaxed(lower_32_bits(DOORBELL_ADDR), port->base + PORT_MSIADDR); > + > + /* Enable MSIs, shared between all ports */ > + writel_relaxed(0, port->base + PORT_MSIBASE); > + writel_relaxed((ilog2(port->pcie->nvecs) << PORT_MSICFG_L2MSINUM_SHIFT) | > + PORT_MSICFG_EN, port->base + PORT_MSICFG); > + > return 0; > } I think the BUILD_BUG_ON makes more sense next to configuring the base address (which only has a 32-bit register, the BUILD_BUG_ON justifies using writel and not writeq), rather than configuring the message (which specifies the full 64-bits).