From: Paolo Bonzini <pbonzini@redhat.com>
To: "Peter Xu" <peterx@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>
Cc: "QEMU Developers" <qemu-devel@nongnu.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Philippe Mathieu-Daudé" <philippe.mathieu-daude@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>
Subject: Re: should ioapic_service really be modelling cpu writes?
Date: Fri, 11 Nov 2022 12:08:39 +0100 [thread overview]
Message-ID: <022fd97e-3500-5830-9a22-7caadc03d5a0@redhat.com> (raw)
In-Reply-To: <Y21+VFqKpF6LGz2C@x1n>
On 11/10/22 23:42, Peter Xu wrote:
> I think it shouldn't? Normally the irq will be in MSI format (IOAPIC will
> translate to an MSI in QEMU, per ioapic_entry_parse()).
>
> I had a feeling that it'll just go the shortcut here (MSI always starts
> with 0xfeeXXXXX so definitely bigger than 0xfff):
Note that QEMU subtracts 0xfee00000 by the time you get to
apic_mem_write, but still yes, that's what happens for IOAPIC. The
write is on the PCI bus.
> if (addr > 0xfff || !index) {
> /* MSI and MMIO APIC are at the same memory location,
> * but actually not on the global bus: MSI is on PCI bus
> * APIC is connected directly to the CPU.
> * Mapping them on the global bus happens to work because
> * MSI registers are reserved in APIC MMIO and vice versa. */
> MSIMessage msi = { .address = addr, .data = val };
> apic_send_msi(&msi);
> return;
> }
>
> apic_send_msi() doesn't need a cpu context.
Alex, perhaps you can change the shortcut to
if (size < 4) {
return;
}
dev = cpu_get_current_apic(memtxattrs);
if (!dev) {
/* comment here... */
MSIMessage msi = { .address = addr, .data = val };
apic_send_msi(&msi);
return;
}
s = APIC(dev);
...
Paolo
next prev parent reply other threads:[~2022-11-11 11:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 17:01 should ioapic_service really be modelling cpu writes? Alex Bennée
2022-11-10 17:55 ` Alex Bennée
2022-11-10 22:42 ` Peter Xu
2022-11-11 11:08 ` Paolo Bonzini [this message]
2022-11-11 12:26 ` Alex Bennée
2022-11-11 13:14 ` Paolo Bonzini
2022-11-11 14:00 ` Alex Bennée
2022-11-11 15:57 ` Paolo Bonzini
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=022fd97e-3500-5830-9a22-7caadc03d5a0@redhat.com \
--to=pbonzini@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philippe.mathieu-daude@linaro.org \
--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 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).