From: Omar Elghoul <oelghoul@linux.ibm.com>
To: Alex Williamson <alex@shazbot.org>
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, hca@linux.ibm.com, gor@linux.ibm.com,
agordeev@linux.ibm.com, borntraeger@linux.ibm.com,
svens@linux.ibm.com, schnelle@linux.ibm.com,
mjrosato@linux.ibm.com, alifm@linux.ibm.com,
farman@linux.ibm.com, gbayer@linux.ibm.com
Subject: Re: [PATCH v4 2/4] s390/pci: Preserve FMB state in device re-enablement
Date: Mon, 22 Jun 2026 17:40:29 -0400 [thread overview]
Message-ID: <c83fdbc0-c01e-43c7-abca-33273b821f73@linux.ibm.com> (raw)
In-Reply-To: <20260622142201.3d5da194@shazbot.org>
On 6/22/26 4:22 PM, Alex Williamson wrote:
> On Fri, 12 Jun 2026 14:10:46 -0400
> Omar Elghoul <oelghoul@linux.ibm.com> wrote:
>> +int zpci_fmb_reenable_device(struct zpci_dev *zdev)
>> +{
>> + u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, ZPCI_MOD_FC_SET_MEASURE);
>> + struct zpci_fib fib = {0};
>> + u8 cc, status;
>> + int rc;
>> +
>> + lockdep_assert_held(&zdev->fmb_lock);
>> +
>> + if (!zdev->fmb)
>> + return zpci_fmb_enable_device(zdev);
>> +
>> + fib.gd = zdev->gisa;
>> + cc = zpci_mod_fc(req, &fib, &status); /* Disable function measurement */
>> +
>> + /* Unlike in zpci_fmb_disable_device(), cc == 3 is not a valid state here
>> + * because we are re-enabling function measurement for the same function
>> + * handle.
>> + */
>> + if (cc)
>> + return -EIO;
>> +
>> + zpci_fmb_clear_iommu_ctrs(zdev);
>> +
>> + rc = zpci_fmb_do_enable(zdev);
>> + if (rc) {
>> + kmem_cache_free(zdev_fmb_cache, zdev->fmb);
>> + zdev->fmb = NULL;
>> + }
>> +
>> + return rc;
>> +}
>> +EXPORT_SYMBOL_GPL(zpci_fmb_reenable_device);
>
> Why is this exported? Maybe this is leftover from the previous version
> where it was noted that the API claimed a failure on double enable that
> didn't actually occur because if used reenable. Now we seem to have
> the alternate inconsistency, that FMB is automatically enabled as part
> of the standard PCI enable path, so the only initial operation
> available to userspace is to first disable FMB, which is an awkward
> API. The v3 problem could have been solved in documentation, noting
> that a nested enable resets counters[1], while a nested disable
> generates an errno. Thanks,
Acked in my reply to patch 3/4
>
> Alex
>
> [1] Also note the sashiko question whether reenable actually zeros the
> current fmb buffer or only the internal counters
> https://sashiko.dev/#/message/20260612182632.E4EE71F000E9%40smtp.kernel.org
This question may not be applicable because firmware resets them in
practice, but I will discuss it further with my team.
Thanks.
next prev parent reply other threads:[~2026-06-22 21:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 18:10 [PATCH v4 0/4] vfio-pci/zdev: Improved zPCI Function Measurement Support Omar Elghoul
2026-06-12 18:10 ` [PATCH v4 1/4] s390/pci: Hold fmb_lock when enabling or disabling PCI devices Omar Elghoul
2026-06-12 18:10 ` [PATCH v4 2/4] s390/pci: Preserve FMB state in device re-enablement Omar Elghoul
2026-06-22 20:22 ` Alex Williamson
2026-06-22 21:40 ` Omar Elghoul [this message]
2026-06-12 18:10 ` [PATCH v4 3/4] vfio-pci/zdev: Add VFIO FMB device features Omar Elghoul
2026-06-22 20:22 ` Alex Williamson
2026-06-22 21:30 ` Omar Elghoul
2026-06-12 18:10 ` [PATCH v4 4/4] s390/pci: Fence FMB enable/disable via sysfs for passthrough devices Omar Elghoul
2026-06-22 18:06 ` [PATCH v4 0/4] vfio-pci/zdev: Improved zPCI Function Measurement Support Omar Elghoul
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=c83fdbc0-c01e-43c7-abca-33273b821f73@linux.ibm.com \
--to=oelghoul@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=alex@shazbot.org \
--cc=alifm@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=farman@linux.ibm.com \
--cc=gbayer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=schnelle@linux.ibm.com \
--cc=svens@linux.ibm.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
Powered by JetHome