Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp2912235rwo; Mon, 24 Jul 2023 03:24:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlHOGYYAD9qW3QT9te1iK07a9YKRPpbqDgeBBoIpkWedIX1c6pZ1l/oLaRxUmZcF0Fx4AgmK X-Received: by 2002:a05:6808:178e:b0:3a0:57d5:c0de with SMTP id bg14-20020a056808178e00b003a057d5c0demr9886221oib.31.1690194286326; Mon, 24 Jul 2023 03:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690194286; cv=none; d=google.com; s=arc-20160816; b=qfNez7OaaKzYoDsNzdtKOvrYAy0hpaLis5wcP8k9bTHR3z3pc8fyqEyUjmF/GId7FI 3EDn8xcS1Fs1dI2pCYn5VHH74zTLTEfa0y47yJ5hxvac7Vk1PYFPp0e3WWo54Ti4Un5K SOHvaebb0+G6JOwPffEGfPYngEaLdgFvsDRGOOiWElCFOXjdzz1fikotS7S+rZJYohgD RVOkb2pFLyqyXyhxxU6qoeiRlMD9Gum37C+JbuPGNUcW5DZ5CbTXXsYFDf3lXvB4+/fI 3460DFDWt5Fdt/ND3IJqSxRq8luSxKPmuWB07PRp2pDZ26tJn9C4XRpdEqSY1Gr+j2Oq HO4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=D8bfGUj6PVSplOllAd2MEpS6lx5ONn993m33c0NCbEw=; fh=riyKrOB71QeaYkNgYFXKbZofm92XDtbw7DHqYdEKRCg=; b=VQ1qCFNyVTB1gxOnxGHZ9UphLY7FUC/kJ+6eTDyyzXdVp7o7EZN+56Nh0lKX7MwCDB 18FjvEupGK9WRhVebG/N8AhyDu16ahqfOsSKWacJPvwU+AN14sxLMayCzx7KgCTtvUOS UlkiXZ+JrJdlw26X7x6cV5FYonihUzusHUuTvGnpRmjposSSvlw5UPQxymae2AFJ3scg CVSk+WieFzZbQFP7dLePy4PoemUPG+LmGY0HGNEIdVdCae5lLvrfB7tkPB9uMFFwbX4T Y9pbmrh9irSTBs40U1ppUXuKfTVFYSLJDEM+5jaWmUailBh4AxEQK1oSj++GELOzQhn5 PERQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b="eG+k/0eQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j13-20020a17090a31cd00b002681e957ab9si1422001pjf.178.2023.07.24.03.24.30; Mon, 24 Jul 2023 03:24:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b="eG+k/0eQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232502AbjGXJv1 (ORCPT + 99 others); Mon, 24 Jul 2023 05:51:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231641AbjGXJug (ORCPT ); Mon, 24 Jul 2023 05:50:36 -0400 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D91A535A2 for ; Mon, 24 Jul 2023 02:48:14 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-78847bb8940so230797039f.0 for ; Mon, 24 Jul 2023 02:48:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1690192068; x=1690796868; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=D8bfGUj6PVSplOllAd2MEpS6lx5ONn993m33c0NCbEw=; b=eG+k/0eQ1dVjbqUi+Fgm5PV75urijLYhKsnv1AN21qidWsleaq1GIF1yDsE1SYlpcS T1BxyDHhpVghbdpylHZWvEkgNNXNsUhPOhkVR8ztiRuD38F3hfD5yQS0Kq7CCZmCY1wt KsRe23hLlzfw1YizGD0LyDsk9NdWHCl6NGAIqVzPI0doFxxf1ycp5HjHdw2u2iKzaIKk TiVKYNEmEpfQmhNW9llQU5t5Xriof54H/K3G5MSMVJ9/HCFuo9E32mevzrPPrJJAaXmt fOgsXcbEw7RdxuFumYd8xkSO8kzeatorXj3eZK3kKdFo3ZGLz4dbfiLi8cg6wEHOxhYD W6Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690192068; x=1690796868; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D8bfGUj6PVSplOllAd2MEpS6lx5ONn993m33c0NCbEw=; b=XmxPLw6O/U4i6D7VrVdvSpdmyWlAdnS4DhhPmCS7K5TY1m7JAVbmLJwXH9Nx3nvF6P E5rk6vKcec2EuLve9D3OVWV9RXF6MivvF3ztR1xRZkaXRWDSwCb3+3/K9rJ293Y8n3Tq YpU4gp1bwElGfrjoptRsRv1fB02BrndGuYmew+pR+PT7u2LMOo9y6+h9TRwLlH/A+ltm VIMETzuyJsBaTqknqcFej9GkQ19zWozDz/kZe/KMS5GpulWIoEO2QQhdRoshz/B9DujH EqrSU5TKWcwdNN1e9a78nglYpROix+tlOkdzbIxbt5iNXOv4TlQobL1h+fCiMpJjmt4B XtDw== X-Gm-Message-State: ABy/qLaDfyFWi/eJlm2kmXqVZ7OYOsF6x3nGJt4jb+dVlON/i7CsixKc aMUY1QojpD1gM/eZ8lSamwYaLCRTM/cliri1CYQyiw== X-Received: by 2002:a5d:81d1:0:b0:783:74c0:54ae with SMTP id t17-20020a5d81d1000000b0078374c054aemr6940592iol.21.1690192068270; Mon, 24 Jul 2023 02:47:48 -0700 (PDT) MIME-Version: 1.0 References: <1fd79e5c53d9d6ed2264f60dd4261f293cc00472.1689792825.git.tjeznach@rivosinc.com> <5b8fd18e-8dfa-96bf-cdd4-4498b1d15ab9@ics.forth.gr> In-Reply-To: From: Zong Li Date: Mon, 24 Jul 2023 17:47:37 +0800 Message-ID: Subject: Re: [PATCH 06/11] RISC-V: drivers/iommu/riscv: Add command, fault, page-req queues To: Tomasz Jeznach Cc: Nick Kossifidis , Anup Patel , Albert Ou , linux@rivosinc.com, Will Deacon , Joerg Roedel , linux-kernel@vger.kernel.org, Sebastien Boeuf , iommu@lists.linux.dev, Palmer Dabbelt , Paul Walmsley , linux-riscv@lists.infradead.org, Robin Murphy Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 21, 2023 at 2:00=E2=80=AFAM Tomasz Jeznach wrote: > > On Wed, Jul 19, 2023 at 8:12=E2=80=AFPM Nick Kossifidis wrote: > > > > Hello Tomasz, > > > > On 7/19/23 22:33, Tomasz Jeznach wrote: > > > Enables message or wire signal interrupts for PCIe and platforms devi= ces. > > > > > > > The description doesn't match the subject nor the patch content (we > > don't jus enable interrupts, we also init the queues). > > > > > + /* Parse Queue lengts */ > > > + ret =3D of_property_read_u32(pdev->dev.of_node, "cmdq_len", &io= mmu->cmdq_len); > > > + if (!ret) > > > + dev_info(dev, "command queue length set to %i\n", iommu= ->cmdq_len); > > > + > > > + ret =3D of_property_read_u32(pdev->dev.of_node, "fltq_len", &io= mmu->fltq_len); > > > + if (!ret) > > > + dev_info(dev, "fault/event queue length set to %i\n", i= ommu->fltq_len); > > > + > > > + ret =3D of_property_read_u32(pdev->dev.of_node, "priq_len", &io= mmu->priq_len); > > > + if (!ret) > > > + dev_info(dev, "page request queue length set to %i\n", = iommu->priq_len); > > > + > > > dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); > > > > > > > We need to add those to the device tree binding doc (or throw them away= , > > I thought it would be better to have them as part of the device > > desciption than a module parameter). > > > > We can add them as an optional fields to DT. > Alternatively, I've been looking into an option to auto-scale CQ/PQ > based on number of attached devices, but this gets trickier for > hot-pluggable systems. I've added module parameters as a bare-minimum, > but still looking for better solutions. > > > > > > +static irqreturn_t riscv_iommu_priq_irq_check(int irq, void *data); > > > +static irqreturn_t riscv_iommu_priq_process(int irq, void *data); > > > + > > > > > + case RISCV_IOMMU_PAGE_REQUEST_QUEUE: > > > + q =3D &iommu->priq; > > > + q->len =3D sizeof(struct riscv_iommu_pq_record); > > > + count =3D iommu->priq_len; > > > + irq =3D iommu->irq_priq; > > > + irq_check =3D riscv_iommu_priq_irq_check; > > > + irq_process =3D riscv_iommu_priq_process; > > > + q->qbr =3D RISCV_IOMMU_REG_PQB; > > > + q->qcr =3D RISCV_IOMMU_REG_PQCSR; > > > + name =3D "priq"; > > > + break; > > > > > > It makes more sense to add the code for the page request queue in the > > patch that adds ATS/PRI support IMHO. This comment also applies to its > > interrupt handlers below. > > > > ack. will do. > > > > > > +static inline void riscv_iommu_cmd_inval_set_addr(struct riscv_iommu= _command *cmd, > > > + u64 addr) > > > +{ > > > + cmd->dword0 |=3D RISCV_IOMMU_CMD_IOTINVAL_AV; > > > + cmd->dword1 =3D addr; > > > +} > > > + > > > > This needs to be (addr >> 2) to match the spec, same as in the iofence > > command. > > > > oops. Thanks! > I think it should be (addr >> 12) according to the spec. > > Regards, > > Nick > > > > regards, > - Tomasz > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv