qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Marcel Apfelbaum <marcel@redhat.com>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com,
	mst@redhat.com, "Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Alexander Bezzubikov <zuban32s@gmail.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] hw/pcie: disable IO port fwd by default for pcie-root-port
Date: Thu, 28 Sep 2017 09:48:02 +0200	[thread overview]
Message-ID: <6e81f338-1a43-518c-b39e-f09de76c3106@redhat.com> (raw)
In-Reply-To: <13096938-e70f-7a3a-3cd0-4b9d475c2b18@redhat.com>

On 09/27/17 12:06, Marcel Apfelbaum wrote:
> Hi Laszlo,
> 
> On 20/09/2017 14:01, Laszlo Ersek wrote:
>>   We now have
>>
>>      if (mem_pref_32_reserve != (uint32_t)-1 &&
>>          mem_pref_64_reserve != (uint64_t)-1) {
>>          error_setg(errp,
>>
>> but after introducing the zero value, this is going to be too strict.
>> Consider all the possible combinations:
>>
>> * (-1; -1): default fw behavior, check is OK
>>
>> * (-1;  0): fw sticks with the default for the first component, picks
>>              "no reservation" for the second component, check is OK
>>
>> * (-1; >0): fw can treat this identically to ( 0; >0) -- see below. This
>>              is justified because, while the first component says "use
>>              the default", the entire situation of having such a
>>              capability is new, so the firmware can introduce new ways
>>              for handling it. The check passes, which is good.
>>
>> * ( 0;  0): check reports error, but the firmware can handle this case
>>              fine (no reservation for either component)
>>
>> * ( 0; >0): check reports error, but the fw can handle this (no
>>              reservation for the first component, specific reservation
>>              for the second)
>>
>> * (>0; >0): conflict, check is OK
>>
>> (I'm skipping the description of the inverted orderings, such as (0;-1),
>> they behave similarly.)
>>
>> So we need to accept 0 as "valid" for either component:
>>
>>      if (mem_pref_32_reserve > 0 &&
>>          mem_pref_32_reserve < (uint32_t)-1 &&
>>          mem_pref_64_reserve > 0 &&
>>          mem_pref_64_reserve < (uint64_t)-1) {
>>          error_setg(errp,
>>
> 
> SeaBIOS  will not allow (0,0) values for pref32 and pref64 fields.
> More than that, 0 values are not being taken in consideration.
> 
> We may say is a bug and fix it. But taking a step back, we need the
> hints to reserve *more* mem range, I am not sure 0 values are
> interesting for mem reservation. Also is also only a hint,
> the firmware should decide.
> 
> Do we have a concrete scenario where would we want to use (0, non-zero)
> or (non-zero, 0) ? (ask for 32/64 prefetch)
> 
> Our current semantic is: "we give a hint to the Guest Firmware,
> we don't decide. However, giving hints to both pref32 and pref64
> is wrong".

After having written the OVMF code for this, my understanding is
clearer, and I agree that, for *prefetchable*, distinguishing -1 from 0
is not necessary (-1 means "firmware default (unspecified)", and 0 means
"do not reserve"; and for prefetchable, the two things mean the same in
OVMF). So the current QEMU code should be fine.

> Not related: Using 0 value to disable IO works just fine!
> No need for disable-IO-fwd property :)

Great!

Thanks!
Laszlo

      reply	other threads:[~2017-09-28  7:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-06 14:26 [Qemu-devel] [PATCH 0/2] hw/pcie: disable IO port fwd by default for pcie-root-port Marcel Apfelbaum
2017-09-06 14:26 ` [Qemu-devel] [PATCH 1/2] pc: add 2.11 machine types Marcel Apfelbaum
2017-09-06 14:26 ` [Qemu-devel] [PATCH 2/2] hw/pcie: disable IO port fwd by default for pcie-root-port Marcel Apfelbaum
2017-09-06 14:49   ` Eduardo Habkost
2017-09-08 11:39     ` Marcel Apfelbaum
2017-09-19 22:15   ` Laszlo Ersek
2017-09-20  7:42     ` Marcel Apfelbaum
2017-09-20 11:01       ` Laszlo Ersek
2017-09-20 11:16         ` Marcel Apfelbaum
2017-09-20 11:35           ` Laszlo Ersek
2017-09-27 10:06         ` Marcel Apfelbaum
2017-09-28  7:48           ` Laszlo Ersek [this message]

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=6e81f338-1a43-518c-b39e-f09de76c3106@redhat.com \
    --to=lersek@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=zuban32s@gmail.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).