From: Nicolin Chen <nicolinc@nvidia.com>
To: Shameer Kolothum Thodi <skolothumtho@nvidia.com>
Cc: "eric.auger@redhat.com" <eric.auger@redhat.com>,
"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"peter.maydell@linaro.org" <peter.maydell@linaro.org>,
"clg@redhat.com" <clg@redhat.com>,
"alex@shazbot.org" <alex@shazbot.org>,
Nathan Chen <nathanc@nvidia.com>, Matt Ochs <mochs@nvidia.com>,
Jiandi An <jan@nvidia.com>, Jason Gunthorpe <jgg@nvidia.com>,
"jonathan.cameron@huawei.com" <jonathan.cameron@huawei.com>,
"zhangfei.gao@linaro.org" <zhangfei.gao@linaro.org>,
"zhenzhong.duan@intel.com" <zhenzhong.duan@intel.com>,
Krishnakant Jaju <kjaju@nvidia.com>,
"phrdina@redhat.com" <phrdina@redhat.com>
Subject: Re: [PATCH v3 17/32] hw/arm/tegra241-cmdqv: mmap VINTF Page0 for CMDQV
Date: Thu, 12 Mar 2026 14:11:32 -0700 [thread overview]
Message-ID: <abMsBC8xgCdyKp5C@Asurada-Nvidia> (raw)
In-Reply-To: <CH3PR12MB754836BEE54E39B30C7210C0AB44A@CH3PR12MB7548.namprd12.prod.outlook.com>
On Thu, Mar 12, 2026 at 11:05:36AM -0700, Shameer Kolothum Thodi wrote:
> > I understand. But guest works in HYP_OWN mode as it sets the HYP_OWN
> > bit. So resetting it looks like a hack to me, not documented in any way
> > in the spec. Besides, as tegra241_guest_vcmdq_supports_cmd() forces to
> > send on the cmdqv cmdq only legal cmds I don't see any problem leaving
> > the bit to 1. What is important is that the host does the check (and the
> > host sets HYP_OWN to 0 for that cmdq). I did the trial to comment
> > //value &= ~R_VINTF0_CONFIG_HYP_OWN_MASK;
> >
> > and it seems to work properly
>
> Ah.. that’s interesting. .I was under the impression that we are toggling
> the HYP_OWN so that guest does sets the tegra241_guest_vcmdq_supports_cmd()
> correctly and delegates the supported cmds through that queue.
>
> See,
> tegra241_cmdqv_init_structures()
> tegra241_vintf_alloc_lvcmdq()
> tegra241_vcmdq_alloc_smmu_cmdq()
> {
> ....
> if (!vcmdq->vintf->hyp_own)
> cmdq->supports_cmd = tegra241_guest_vcmdq_supports_cmd;
>
> However, it looks like the above happens before tegra241_vintf_hw_init(),
> which sets HYP_OWN. That may explain why toggling the bit here does not
> make any difference.
Well, looks like we exposed a kernel bug...
It seems that the sequence of setting hyp_own and supports_cmd got
inverted during a rework when I got the driver upstream.
It turned out that both host and guest kernels sets supports_cmd to
tegra241_guest_vcmdq_supports_cmd().. IOW, the host is sending non-
invalidation commands to the SMMU CMDQ rather than the HYP_OWNed
VCMDQ, although this is completely harmless and probably does not
affect host performance at all since non-invalidation commands are
not that frequently issued.
This explains why Eric's experiment didn't fail. I'll submit a fix.
With that being said, in QEMU we do need to wire HYP_OWN bit to 0.
This is not decided by the spec, but by the host SW implementation:
550 /*
551 * Note that HYP_OWN bit is wired to zero when running in guest kernel,
552 * whether enabling it here or not, as !HYP_OWN cmdq HWs only support a
553 * restricted set of supported commands.
554 */
555 regval = FIELD_PREP(VINTF_HYP_OWN, hyp_own) |
556 FIELD_PREP(VINTF_VMID, vintf->vsmmu.vmid);
557 writel(regval, REG_VINTF(vintf, CONFIG));
558
559 ret = vintf_write_config(vintf, regval | VINTF_EN);
560 if (ret)
561 return ret;
562 /*
563 * As being mentioned above, HYP_OWN bit is wired to zero for a guest
564 * kernel, so read it back from HW to ensure that reflects in hyp_own
565 */
566 vintf->hyp_own = !!(VINTF_HYP_OWN & readl(REG_VINTF(vintf, CONFIG)));
This should have been mentioned in the uAPI header. I'll submit a
patch to add this line near IOMMU_VIOMMU_TYPE_TEGRA241_CMDQV.
One thing we need to get our head around is that a guest hardware
is different than the host hardware:
- Host HW is backed by a VINTF (HYP_OWN=1)
- Guest HW is backed by a VINTF (HYP_OWN=0)
This is a fixed configuration, decided by the hardware and the spec
also.
Thus, the guest version of the VINTF must align with its underlying
hardware, so QEMU cannot allow setting HYP_OWN=1.
Otherwise, guest OS would have no idea this is a guest version of
hardware and would issue unsupported commands that will fail.
Nicolin
next prev parent reply other threads:[~2026-03-12 21:12 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 10:50 [PATCH v3 00/32] hw/arm/virt: Introduce Tegra241 CMDQV support for accelerated SMMUv3 Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 01/32] backends/iommufd: Update iommufd_backend_get_device_info Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 02/32] backends/iommufd: Update iommufd_backend_alloc_viommu to allow user ptr Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 03/32] backends/iommufd: Introduce iommufd_backend_alloc_hw_queue Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 04/32] backends/iommufd: Introduce iommufd_backend_viommu_mmap Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 05/32] hw/arm/smmuv3-accel: Introduce CMDQV ops interface Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 06/32] hw/arm/tegra241-cmdqv: Add Tegra241 CMDQV ops backend stub Shameer Kolothum
2026-03-09 9:18 ` Eric Auger
2026-03-09 10:48 ` Shameer Kolothum Thodi
2026-03-09 12:52 ` Eric Auger
2026-03-09 12:59 ` Eric Auger
2026-02-26 10:50 ` [PATCH v3 07/32] hw/arm/smmuv3-accel: Wire CMDQV ops into accel lifecycle Shameer Kolothum
2026-03-09 11:05 ` Eric Auger
2026-02-26 10:50 ` [PATCH v3 08/32] hw/arm/virt: Store SMMUv3 device objects in VirtMachineState Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 09/32] hw/arm/virt-acpi-build: Use stored SMMUv3 devices for IORT build Shameer Kolothum
2026-03-09 10:18 ` Eric Auger
2026-02-26 10:50 ` [PATCH v3 10/32] hw/arm/tegra241-cmdqv: Probe host Tegra241 CMDQV support Shameer Kolothum
2026-03-09 10:31 ` Eric Auger
2026-03-09 10:54 ` Shameer Kolothum Thodi
2026-02-26 10:50 ` [PATCH v3 11/32] hw/arm/tegra241-cmdqv: Implement CMDQV init Shameer Kolothum
2026-03-09 10:44 ` Eric Auger
2026-02-26 10:50 ` [PATCH v3 12/32] hw/arm/virt: Link SMMUv3 CMDQV resources to platform bus Shameer Kolothum
2026-03-09 10:57 ` Eric Auger
2026-02-26 10:50 ` [PATCH v3 13/32] hw/arm/tegra241-cmdqv: Implement CMDQV vIOMMU alloc/free Shameer Kolothum
2026-03-09 11:09 ` Eric Auger
2026-03-09 11:31 ` Shameer Kolothum Thodi
2026-03-09 12:46 ` Eric Auger
2026-03-09 18:09 ` Nicolin Chen
2026-03-09 18:25 ` Shameer Kolothum Thodi
2026-03-09 19:05 ` Nicolin Chen
2026-02-26 10:50 ` [PATCH v3 14/32] hw/arm/tegra241-cmdqv: Emulate global CMDQV registers Shameer Kolothum
2026-03-09 16:33 ` Eric Auger
2026-03-10 11:37 ` Shameer Kolothum Thodi
2026-03-11 10:34 ` Eric Auger
2026-03-09 17:15 ` Eric Auger
2026-03-09 17:56 ` Eric Auger
2026-03-11 7:47 ` Eric Auger
2026-02-26 10:50 ` [PATCH v3 15/32] hw/arm/tegra241-cmdqv: Emulate global and VINTF VCMDQ register reads Shameer Kolothum
2026-02-27 15:58 ` Jonathan Cameron via
2026-02-27 15:58 ` Jonathan Cameron via qemu development
2026-03-09 17:44 ` Eric Auger
2026-03-09 18:04 ` Shameer Kolothum Thodi
2026-03-09 18:40 ` Nicolin Chen
2026-03-09 18:53 ` Shameer Kolothum Thodi
2026-03-09 19:14 ` Nicolin Chen
2026-03-11 9:26 ` Eric Auger
2026-02-26 10:50 ` [PATCH v3 16/32] hw/arm/tegra241-cmdqv: Emulate global and VINTF VCMDQ register writes Shameer Kolothum
2026-03-11 13:32 ` Eric Auger
2026-04-15 13:17 ` Shameer Kolothum Thodi
2026-02-26 10:50 ` [PATCH v3 17/32] hw/arm/tegra241-cmdqv: mmap VINTF Page0 for CMDQV Shameer Kolothum
2026-03-09 17:52 ` Eric Auger
2026-03-11 7:55 ` Eric Auger
2026-03-11 9:26 ` Shameer Kolothum Thodi
2026-03-11 10:05 ` Eric Auger
2026-03-11 12:34 ` Shameer Kolothum Thodi
2026-03-11 13:19 ` Eric Auger
2026-03-11 13:59 ` Shameer Kolothum Thodi
[not found] ` <70cab06d-2114-46b6-ab56-403cbd0003e0@redhat.com>
2026-03-12 18:05 ` Shameer Kolothum Thodi
2026-03-12 21:11 ` Nicolin Chen [this message]
2026-03-11 13:43 ` Eric Auger
2026-03-11 13:59 ` Eric Auger
2026-04-13 6:52 ` Shameer Kolothum Thodi
2026-02-26 10:50 ` [PATCH v3 18/32] system/physmem: Add address_space_is_ram() helper Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 19/32] hw/arm/tegra241-cmdqv: Allocate HW VCMDQs on base register programming Shameer Kolothum
2026-03-11 14:33 ` Eric Auger
2026-04-13 7:40 ` Shameer Kolothum Thodi
2026-02-26 10:50 ` [PATCH v3 20/32] hw/arm/tegra241-cmdqv: Use mmap'ed VINTF page0 as VCMDQ backing Shameer Kolothum
2026-03-11 14:52 ` Eric Auger
2026-03-11 15:43 ` Shameer Kolothum Thodi
2026-02-26 10:50 ` [PATCH v3 21/32] hw/arm/tegra241-cmdqv: Map VINTF page0 into guest MMIO space Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 22/32] hw/arm/tegra241-cmdqv: Add vEVENTQ allocation and free Shameer Kolothum
2026-03-09 17:24 ` Nicolin Chen
2026-03-09 17:41 ` Shameer Kolothum Thodi
2026-03-09 19:37 ` Nicolin Chen
2026-02-26 10:50 ` [PATCH v3 23/32] hw/arm/smmuv3-accel: Introduce common helper for veventq read Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 24/32] hw/arm/tegra241-cmdqv: Read and propagate Tegra241 CMDQV errors Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 25/32] hw/arm/tegra241-cmdqv: Add reset handler Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 26/32] hw/arm/tegra241-cmdqv: Limit queue size based on backend page size Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 27/32] tests/qtest/bios-tables-test: Prepare for IORT SMMUv3 node identifier change Shameer Kolothum
2026-03-09 18:06 ` Eric Auger
2026-02-26 10:50 ` [PATCH v3 28/32] hw/arm/smmuv3: Add per-device identifier property Shameer Kolothum
2026-03-09 18:11 ` Eric Auger
2026-03-09 18:22 ` Eric Auger
2026-03-09 18:33 ` Shameer Kolothum Thodi
2026-02-26 10:50 ` [PATCH v3 29/32] tests/qtest/bios-tables-test: Update IORT blobs for SMMUv3 identifier change Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 30/32] hw/arm/smmuv3-accel: Introduce helper to query CMDQV type Shameer Kolothum
2026-03-09 18:05 ` Eric Auger
2026-02-26 10:50 ` [PATCH v3 31/32] hw/arm/virt-acpi: Advertise Tegra241 CMDQV nodes in DSDT Shameer Kolothum
2026-02-26 10:50 ` [PATCH v3 32/32] hw/arm/smmuv3: Add cmdqv property for SMMUv3 device Shameer Kolothum
2026-03-11 18:24 ` [PATCH v3 00/32] hw/arm/virt: Introduce Tegra241 CMDQV support for accelerated SMMUv3 Eric Auger
2026-03-11 18:34 ` Shameer Kolothum Thodi
2026-03-11 20:00 ` Jason Gunthorpe
2026-03-13 11:06 ` Shameer Kolothum Thodi
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=abMsBC8xgCdyKp5C@Asurada-Nvidia \
--to=nicolinc@nvidia.com \
--cc=alex@shazbot.org \
--cc=clg@redhat.com \
--cc=eric.auger@redhat.com \
--cc=jan@nvidia.com \
--cc=jgg@nvidia.com \
--cc=jonathan.cameron@huawei.com \
--cc=kjaju@nvidia.com \
--cc=mochs@nvidia.com \
--cc=nathanc@nvidia.com \
--cc=peter.maydell@linaro.org \
--cc=phrdina@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=skolothumtho@nvidia.com \
--cc=zhangfei.gao@linaro.org \
--cc=zhenzhong.duan@intel.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 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.