linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Russell Currey <ruscur@russell.cc>
To: linuxppc-dev@lists.ozlabs.org
Cc: benh@kernel.crashing.org, alistair@popple.id.au, aik@ozlabs.ru,
	tpearson@raptorengineering.com
Subject: Re: [PATCH 2/3] powerpc/powernv: DMA operations for discontiguous allocation
Date: Wed, 04 Jul 2018 16:12:28 +1000	[thread overview]
Message-ID: <de891d5858b4ea39aeac425fa13260ffd22f7753.camel@russell.cc> (raw)
In-Reply-To: <20180629073437.4060-3-ruscur@russell.cc>

[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]

On Fri, 2018-06-29 at 17:34 +1000, Russell Currey wrote:

<snip>

> +		/*
> +		 * The TCE isn't being used, so let's try and
> allocate it.
> +		 * Bits 0 and 1 are read/write, and we use bit 2 as
> a "lock"
> +		 * bit.  This is to prevent any race where the value
> is set in
> +		 * the TCE table but the invalidate/mb() hasn't
> finished yet.
> +		 */
> +		entry = cpu_to_be64((addr - offset) | 7);
> +		ret = cmpxchg(&pe->tces[i], tce, entry);
> +		if (ret != tce) {
> +			/* conflict, start looking again just in
> case */
> +			i--;
> +			continue;
> +		}
> +		pnv_pci_phb3_tce_invalidate(pe, 0, 0, addr - offset,
> 1);

This is wrong and won't work outside of PHB3, will make a generic
handler

> +		mb();
> +		/* clear the lock bit now that we know it's active
> */
> +		ret = cmpxchg(&pe->tces[i], entry, cpu_to_be64((addr
> - offset) | 3));
> +		if (ret != entry) {
> +			/* conflict, start looking again just in
> case */
> +			i--;
> +			continue;
> +		}
> +
> +		return (i << phb->ioda.max_tce_order) | offset;
> +	}
> +	/* If we get here, the table must be full, so error out. */
> +	return -1ULL;
> +}
> +

[-- Attachment #2: qtpass.desktop --]
[-- Type: application/x-desktop, Size: 911 bytes --]

  parent reply	other threads:[~2018-07-04  6:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29  7:34 [PATCH 0/3] PCI DMA pseudo-bypass for powernv Russell Currey
2018-06-29  7:34 ` [PATCH 1/3] powerpc/powernv/pci: Track largest available TCE order per PHB Russell Currey
2018-07-02  7:32   ` Alexey Kardashevskiy
2018-07-02  7:34     ` Alexey Kardashevskiy
2018-07-03  5:49       ` Russell Currey
2018-06-29  7:34 ` [PATCH 2/3] powerpc/powernv: DMA operations for discontiguous allocation Russell Currey
2018-06-30  2:52   ` Benjamin Herrenschmidt
2018-07-02  8:47   ` Alexey Kardashevskiy
2018-07-03  6:09     ` Russell Currey
2018-07-04  6:12   ` Russell Currey [this message]
2018-06-29  7:34 ` [PATCH 3/3] powerpc/powernv/pci: Track TCE tables in debugfs Russell Currey

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=de891d5858b4ea39aeac425fa13260ffd22f7753.camel@russell.cc \
    --to=ruscur@russell.cc \
    --cc=aik@ozlabs.ru \
    --cc=alistair@popple.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=tpearson@raptorengineering.com \
    /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).