All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Igor Lesik <lesikigor@meta.com>
Subject: Re: How to synchronize CPUs on MMIO read?
Date: Wed, 16 Aug 2023 19:16:55 +0100	[thread overview]
Message-ID: <87edk2onr6.fsf@linaro.org> (raw)
In-Reply-To: <SN7PR15MB6086D1B0ECEE5ADBD07F8847C315A@SN7PR15MB6086.namprd15.prod.outlook.com>


Igor Lesik <lesikigor@meta.com> writes:

> Hi.
>
> I need to model some custom HW that synchronizes CPUs when they read MMIO register N: MMIO read does not
> return until another CPU writes to MMIO register M. I modeled this behavior with a) on MMIO read of N, save CPU into
> a list of waiting CPUs and put it asleep with cpu_interrupt(current_cpu, CPU_INTERRUPT_HALT) and b) on MMIO write
> to M, wake all waiting CPUs with cpu->halted = 0; qemu_cpu_kick(cpu). It seems to work fine. However, this HW has a
> twist: MMIO read of N returns a value that was written by MMIO write to M. Can anyone please advise how this could
> be done?

Under TCG all MMIO accesses should be serialised by the BQL so no other
MMIO access can be taking place until you finish the operation.

>
>  
>
> Thanks!
>
> Igor


-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2023-08-16 18:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16 16:31 How to synchronize CPUs on MMIO read? Igor Lesik
2023-08-16 18:16 ` Alex Bennée [this message]
2023-08-17 21:51 ` Richard Henderson

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=87edk2onr6.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=lesikigor@meta.com \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.