Re: [PATCH v2] MIPS: sgi-ip32: Fence PIO reads on CRIME 1.1

From: Maciej W. Rozycki

Date: Sun Nov 08 2026 - 04:29:27 EST


On Sat, 7 Nov 2026, Imre Kaloz wrote:

> diff --git a/arch/mips/include/asm/mach-ip32/read-fence.h b/arch/mips/include/asm/mach-ip32/read-fence.h
> new file mode 100644
> index 000000000000..7e3105af4c6f
> --- /dev/null
> +++ b/arch/mips/include/asm/mach-ip32/read-fence.h
> @@ -0,0 +1,29 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __ASM_MACH_IP32_READ_FENCE_H
> +#define __ASM_MACH_IP32_READ_FENCE_H
> +
> +#include <linux/irqflags.h>
> +#include <linux/types.h>
> +
> +extern bool crime_read_fence;
> +void crime_read_fence_end(unsigned long flags);
> +
> +/*
> + * CRIME 1.1 can return a PCI read's data again to the next MACE or PCI
> + * read issued within about 2us, so each read is followed by 5us with
> + * interrupts off.
> + */
> +static inline bool plat_read_fence_begin(unsigned long *flags)
> +{
> + if (!crime_read_fence)
> + return false;
> + local_irq_save(*flags);
> + return true;
> +}
> +
> +static inline void plat_read_fence_end(unsigned long flags)
> +{
> + crime_read_fence_end(flags);
> +}

This seems hackish to me with the call to local_irq_restore() buried in
crime_read_fence_end(). Why is is out of line?

Maciej