lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871q8mdr2i.fsf@all.your.base.are.belong.to.us>
Date: Thu, 07 Mar 2024 16:01:09 +0100
From: Björn Töpel <bjorn@...nel.org>
To: Anup Patel <apatel@...tanamicro.com>
Cc: Palmer Dabbelt <palmer@...belt.com>, Paul Walmsley
 <paul.walmsley@...ive.com>, Thomas Gleixner <tglx@...utronix.de>, Rob
 Herring <robh+dt@...nel.org>, Krzysztof Kozlowski
 <krzysztof.kozlowski+dt@...aro.org>, Frank Rowand
 <frowand.list@...il.com>, Conor Dooley <conor+dt@...nel.org>,
 devicetree@...r.kernel.org, Saravana Kannan <saravanak@...gle.com>, Marc
 Zyngier <maz@...nel.org>, Anup Patel <anup@...infault.org>,
 linux-kernel@...r.kernel.org, Atish Patra <atishp@...shpatra.org>,
 linux-riscv@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org,
 Andrew Jones <ajones@...tanamicro.com>
Subject: Re: [PATCH v15 08/10] irqchip/riscv-aplic: Add support for MSI-mode

Anup Patel <apatel@...tanamicro.com> writes:

> On Wed, Mar 6, 2024 at 9:22 PM Björn Töpel <bjorn@...nel.org> wrote:
>>
>> Anup Patel <apatel@...tanamicro.com> writes:
>>
>> > diff --git a/drivers/irqchip/irq-riscv-aplic-msi.c b/drivers/irqchip/irq-riscv-aplic-msi.c
>> > new file mode 100644
>> > index 000000000000..b2a25e011bb2
>> > --- /dev/null
>> > +++ b/drivers/irqchip/irq-riscv-aplic-msi.c
>> > +static void aplic_msi_write_msg(struct irq_data *d, struct msi_msg *msg)
>> > +{
>> > +     unsigned int group_index, hart_index, guest_index, val;
>> > +     struct aplic_priv *priv = irq_data_get_irq_chip_data(d);
>> > +     struct aplic_msicfg *mc = &priv->msicfg;
>> > +     phys_addr_t tppn, tbppn, msg_addr;
>> > +     void __iomem *target;
>> > +
>> > +     /* For zeroed MSI, simply write zero into the target register */
>> > +     if (!msg->address_hi && !msg->address_lo && !msg->data) {
>> > +             target = priv->regs + APLIC_TARGET_BASE;
>> > +             target += (d->hwirq - 1) * sizeof(u32);
>> > +             writel(0, target);
>>
>> Is the fence needed here (writel_relaxed())...
>
> The pci_write_msg_msix() (called via pci_msi_domain_write_msg())
> uses writel() hence taking inspiration from that we use writel() over here
> as well.
>
> If that's wrong then pci_write_msg_msix() must be fixed as well.

Huh? The writel()s in pci_write_msg_msix() are because there's an
ordering constraint, and code would be broken w/o it. My question was
"what are the ordering constraints for this piece of code", because it
looks like this is a single I/O write without any ordering constraints.

I'm not a fan of sprinkling fences around "to be safe", but I don't want
to delay the v16 because of it. It can be fixed later, if it's not
needed.


Cheers, and thanks for your hard work!
Björn

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ