All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Rosato <mjrosato@linux.ibm.com>
To: Konstantin Shkolnyy <kshk@linux.ibm.com>
Cc: alifm@linux.ibm.com, farman@linux.ibm.com,
	richard.henderson@linaro.org, iii@linux.ibm.com,
	david@kernel.org, cohuck@redhat.com, pasic@linux.ibm.com,
	borntraeger@linux.ibm.com, qemu-s390x@nongnu.org,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v11 14/16] s390x/pci: Factor ioat sanity checks into a separate function
Date: Mon, 5 Oct 2026 09:46:21 -0400	[thread overview]
Message-ID: <8f105949-c5e1-479a-a996-3dacede11738@linux.ibm.com> (raw)
In-Reply-To: <cbd6f028-1c29-42fc-b7fc-7510ecc08ac6@linux.ibm.com>

On 10/5/26 9:23 AM, Konstantin Shkolnyy wrote:
> On 261002 19:43, Konstantin Shkolnyy wrote:
>> On 261002 13:28, Matthew Rosato wrote:
>>>
>>>> -static int reg_ioat(CPUS390XState *env, S390PCIBusDevice *pbdev,
>>>> ZpciFib fib,
>>>> -                    uintptr_t ra)
>>>> +bool s390_pci_ioat_validate(S390PCIBusDevice *pbdev, uint64_t pba,
>>>> +                             uint64_t pal, uint64_t g_iota, Error
>>>> **errp)
>>>>   {
>>>> -    uint64_t pba = ldq_be_p(&fib.pba);
>>>> -    uint64_t pal = ldq_be_p(&fib.pal);
>>>> -    uint64_t g_iota = ldq_be_p(&fib.iota);
>>>>       uint8_t dt = (g_iota >> 2) & 0x7;
>>>>       bool t = s390_pci_is_translation_enabled(g_iota);
>>>> -    pba &= ~0xfff;
>>>> -    pal |= 0xfff;
>>>>       if (pba > pal || pba < pbdev->zpci_fn.sdma || pal > pbdev-
>>>> >zpci_fn.edma) {
>>>> -        s390_program_interrupt(env, PGM_OPERAND, ra);
>>>> -        return -EINVAL;
>>>> +        return false;
>>>
>>> This will now violate include/qapi/error.h because you're returning
>>> false but not setting errp:
>>>
>>>   * - On success, the function should not touch *errp.  On failure, it
>>>   *   should set a new error, e.g. with error_setg(errp, ...), or
>>>   *   propagate an existing one, e.g. with error_propagate(errp, ...).
>>>
>>> A simple solution would be to add a new message for this case.
>>
>> But the original reg_ioat() also didn't print any message in this
>> error branch. I had to assume it was intentional, and preserved the
>> behavior.
>>
>> If you believe a new message should be introduced, I can insert a
>> commit for that - what would be the explanation?
> 
> Other code sites reporting PGM_OPERAND also don't generate error
> messages - it appears, the current policy is not to do that in the cases
> when the guest is at fault (gave invalid parameters). The case at hand
> falls in that category.
> 
The other 2 cases in this very function, where we are providing an error
message, are also due to invalid guest parameters.  We advertised the
necessary information to make a correct decision via CLP query payloads,
but the guest gave us bad input anyway.

The fact that these messages are in response to guest parameters is why
it made sense to switch to qemu_log_mask(LOG_GUEST_ERROR, ...) -- the
guest can control if the message pops by purposely setting bad inputs.

With that in mind, there's probably an argument for adding more messages
and/or trace events to other PGM_OPERAND paths for debug purposes since
these aren't things expected to fail on a normally-behaving guest.  But
that's beyond the scope of this series.

For this series:  you need to either add a message to this case or, if
you feel that strongly about not reporting a message for it, then
another solution would be to remove it from the s390_pci_ioat_validate()
function and check it in 2 places so that a message is not required and
then everything in s390_pci_ioat_validate() will generate an errp for
the false case, satisfying include/qapi/error.h.

Thanks,
Matt


  reply	other threads:[~2026-10-05 14:08 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 14:52 [PATCH v11 00/16] s390x/pci: Implement migration for emulated devices Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 01/16] s390x/pci: implement IOMMU replay Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 02/16] s390x/pci: Create function to contain translation status check Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 03/16] s390x/pci: Move iommu_mr from S390PCIIOMMU to S390PCIBusDevice Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 04/16] s390x/pci: Move dm_mr " Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 05/16] s390x/pci: Move iotlb " Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 06/16] s390x/pci: Remove a ptr to S390PCIBusDevice from S390PCIIOMMU Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 07/16] s390x/pci: Move/rename enabled from S390PCIIOMMU to S390PCIBusDevice Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 08/16] s390x/pci: Move dma_limit " Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 09/16] s390x/pci: Move g_iota " Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 10/16] s390x/pci: Move pba " Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 11/16] s390x/pci: Move pal " Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 12/16] s390x/pci: Move max_dma_limit " Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 13/16] s390x/pci: Add a comment explaining S390PCIIOMMU purpose Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 14/16] s390x/pci: Factor ioat sanity checks into a separate function Konstantin Shkolnyy
2026-10-02 18:28   ` Matthew Rosato
2026-10-03  0:43     ` Konstantin Shkolnyy
2026-10-05 13:23       ` Konstantin Shkolnyy
2026-10-05 13:46         ` Matthew Rosato [this message]
2026-10-05 16:20           ` Konstantin Shkolnyy
2026-10-05 13:30       ` Matthew Rosato
2026-09-30 14:52 ` [PATCH v11 15/16] s390x/pci: Implement migration for emulated devices Konstantin Shkolnyy
2026-10-05 19:39   ` Matthew Rosato
2026-10-05 22:20   ` Farhan Ali
2026-10-05 22:31     ` Konstantin Shkolnyy
2026-09-30 14:52 ` [PATCH v11 16/16] s390x/pci: Create function to contain fmb_timer start Konstantin Shkolnyy

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=8f105949-c5e1-479a-a996-3dacede11738@linux.ibm.com \
    --to=mjrosato@linux.ibm.com \
    --cc=alifm@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@kernel.org \
    --cc=farman@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=kshk@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.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.