linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: David Daney <ddaney@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH 2/2] MIPS: Octeon: Use lockless interrupt controller operations when possible.
Date: Tue, 13 Oct 2009 18:20:18 +0200	[thread overview]
Message-ID: <20091013162018.GB27508@linux-mips.org> (raw)
In-Reply-To: <1255449149-22054-2-git-send-email-ddaney@caviumnetworks.com>

On Tue, Oct 13, 2009 at 08:52:29AM -0700, David Daney wrote:

> Some newer Octeon chips have registers that allow lockless operation
> of the interrupt controller.  Take advantage of them.

Good stuff.

> +/*
> + * Disable the irq on the all cores for chips that have the EN*_W1{S,C}
> + * registers.
> + */
> +static void octeon_irq_ciu0_disable_all_v2(unsigned int irq)
> +{
> +	u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);
> +	int index;
> +#ifdef CONFIG_SMP
> +	int cpu;
> +	for_each_online_cpu(cpu) {
> +		index = cpu_logical_map(cpu) * 2;
> +		cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);
> +	}
> +#else
> +	index = cvmx_get_core_num() * 2;
> +	cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);
> +#endif

This #ifdef should be unnecessary.  For NR_CPUS == 1 it is defined as

#define for_each_online_cpu(cpu)   for_each_cpu((cpu), cpu_online_mask)
And for NR_CPUS == 1:
#define for_each_cpu(cpu, mask)                 \
        for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)

Iow, the loop will go away for uniprocessor kernels.

Rest looks ok at a glance.

  Ralf

  reply	other threads:[~2009-10-13 16:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-13 15:51 [PATCH 0/2] Two improvements to Octeon irq handling David Daney
2009-10-13 15:52 ` [PATCH 1/2] MIPS: Octeon: Use write_lock_irqsave/write_unlock_irqrestore when setting irq affinity David Daney
2009-10-13 16:17   ` Ralf Baechle
2009-10-13 15:52 ` [PATCH 2/2] MIPS: Octeon: Use lockless interrupt controller operations when possible David Daney
2009-10-13 16:20   ` Ralf Baechle [this message]
2009-10-13 18:26     ` [PATCH] " David Daney
2009-10-13 19:41       ` Ralf Baechle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091013162018.GB27508@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=ddaney@caviumnetworks.com \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).